Commit 1680c461 authored by 仇晓婷's avatar 仇晓婷

dd

parent 01359636
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</Col> </Col>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('isInform')" prop="isInform"> <FormItem :label="l('isInform')" prop="isInform">
<Dictionary code="crm.customer.isInform" v-model="entity.isInform" type="radio"></Dictionary> <Dictionary code="crm.customer.isInform" v-model="entity.isInform" type="radio"></Dictionary>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12"> <Col :span="12">
...@@ -74,64 +74,66 @@ ...@@ -74,64 +74,66 @@
</Form> </Form>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
name: 'Edit', name: "Edit",
data() { data() {
return { return {
disabled: false, disabled: false,
entity: {}, entity: {},
rules: { rules: {
name: [{ required: true, message: '必填', trigger: 'blur' }] name: [{ required: true, message: "必填", trigger: "blur" }],
} },
} };
}, },
props: { props: {
eid: Number eid: Number,
}, },
methods: { methods: {
load(v) { load(v) {
Api.get({ id: v }).then((r) => { Api.get({ id: v }).then((r) => {
this.entity = r.result this.entity = r.result;
this.$emit('on-load') this.$emit("on-load");
}) });
}, },
handleSubmit() { handleSubmit() {
this.disabled = true;
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
this.disabled = true
Api.update(this.entity) Api.update(this.entity)
.then((r) => { .then((r) => {
this.disabled = false this.disabled = false;
if (r.success) { if (r.success) {
this.$Message.success('保存成功') this.$Message.success("保存成功");
this.$emit('on-ok') this.$emit("on-ok");
} else { } else {
this.$Message.error('保存失败') this.$Message.error("保存失败");
} }
}) })
.catch((err) => { .catch((err) => {
this.disabled = false this.disabled = false;
this.$Message.error('保存失败') this.$Message.error("保存失败");
console.warn(err)
}) });
} else {
this.disabled = false;
} }
}) });
}, },
handleClose() { handleClose() {
this.$emit('on-close') this.$emit("on-close");
}, },
l(key) { l(key) {
key = 'Customer' + '.' + key key = "Customer" + "." + key;
return this.$t(key) return this.$t(key);
} },
}, },
watch: { watch: {
eid(v) { eid(v) {
if (v != 0) { if (v != 0) {
this.load(v) this.load(v);
} }
} },
} },
} };
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment