diff --git a/src/views/business/comps/template/comps/gsp/MJYLQSQD.vue b/src/views/business/comps/template/comps/gsp/MJYLQSQD.vue index a434388..7dc8897 100644 --- a/src/views/business/comps/template/comps/gsp/MJYLQSQD.vue +++ b/src/views/business/comps/template/comps/gsp/MJYLQSQD.vue @@ -96,7 +96,7 @@ export default { SD: { label: "template.gsp.MJYLQSQD.sd", type: "input", - disabled:true, + disabled: true, fillType: "actFill", }, sywzmc: { @@ -215,32 +215,69 @@ export default { mounted() { }, methods: { - onSelectBlur(val) { + init(val) { if (val.key == 'sywzmc') { - let tmp = [] - _.forEach(_.filter(this.gyjlOptionsOld, function (o) { - return o.remark.indexOf(val.value) > -1; - }), function (item) { - tmp.push({ label: item.dictLabel, value: item.dictValue }) - }) - this.gyjlOptions = tmp - this.gyndOptions = [] - this.$refs.baseInfoRef.batchUpdateFormData({ - gyjl: '', - xynd: '', - }); + this.filterGyjl(val, false) } if (val.key == 'gyjl') { - let tmp = [] - _.forEach(_.filter(this.gyndOptionsOld, function (o) { - return o.remark.indexOf(val.value) > -1; - }), function (item) { - tmp.push({ label: item.dictLabel, value: item.dictValue }) - }) - this.gyndOptions = tmp - this.$refs.baseInfoRef.batchUpdateFormData({ - xynd: '', - }); + this.filterGynd(val, false) + } + }, + onSelectBlur(val) { + if (val.key == 'sywzmc' && ((!this.formData.sywzmc||this.formData.sywzmc=='') || val.type == 'save')) { + this.filterGyjl(val, true) + } + if (val.key == 'gyjl' && ((!this.formData.gyjl||this.formData.gyjl=='') || val.type == 'save')) { + this.filterGynd(val, true) + } + }, + filterGyjl(val, reset) { + let that = this + let tmp = [] + _.forEach(_.filter(this.gyjlOptionsOld, function (o) { + if (o.remark && o.remark != '') { + let _index = _.findIndex(o.remark.split(','), function (r) { + return r == val.value; + }) + return _index > -1 ? true : false; + } else { + return false; + } + }), function (item) { + tmp.push({ label: item.dictLabel, value: item.dictValue }) + }) + this.gyjlOptions = tmp + if (reset) { + this.gyndOptions = [] + setTimeout(() => { + that.$refs.baseInfoRef.batchUpdateFormData({ + gyjl: '', + xynd: '', + }); + }, 10) + } + }, + filterGynd(val, reset) { + let tmp = [] + _.forEach(_.filter(this.gyndOptionsOld, function (o) { + if (o.remark && o.remark != '') { + let _index = _.findIndex(o.remark.split(','), function (r) { + return r == val.value; + }) + return _index > -1 ? true : false; + } else { + return false; + } + }), function (item) { + tmp.push({ label: item.dictLabel, value: item.dictValue }) + }) + this.gyndOptions = tmp + if (reset) { + setTimeout(() => { + that.$refs.baseInfoRef.batchUpdateFormData({ + xynd: '', + }); + }, 10) } }, //获取给药剂量 @@ -253,7 +290,7 @@ export default { }).then(response => { this.gyjlOptionsOld = response.rows if (this.formData.sywzmc && this.formData.sywzmc !== '') { - this.onSelectBlur({ key: 'sywzmc', value: this.formData.sywzmc }) + this.init({ key: 'sywzmc', value: this.formData.sywzmc }) } }) }, @@ -267,7 +304,7 @@ export default { }).then(response => { this.gyndOptionsOld = response.rows if (this.formData.gyjl && this.formData.gyjl !== '') { - this.onSelectBlur({ key: 'gyjl', value: this.formData.gyjl }) + this.init({ key: 'gyjl', value: this.formData.gyjl }) } }) },