From 35ce3629611c6b29529fb8e05d53f224b255cc6f Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Tue, 3 Feb 2026 18:52:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86][upd?= =?UTF-8?q?ate]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/comps/template/comps/sp/SP001.vue | 19 ++++++---------- .../business/comps/template/comps/sp/SP002.vue | 25 ++++++++-------------- .../business/comps/template/comps/sp/SP003.vue | 19 ++++++---------- .../business/comps/template/comps/sp/SP00456.vue | 14 ++++++------ .../template/comps/sp/SWYPFXFFXYPZBB/SP008.vue | 14 ++++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP009.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP010.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP011.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP012.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP013.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP014.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP015.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP016.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP017.vue | 13 +++-------- .../template/comps/sp/SWYPFXFFXYPZBB/SP018.vue | 13 +++-------- .../comps/template/mixins/templateMixin.js | 8 +++++++ 16 files changed, 71 insertions(+), 158 deletions(-) diff --git a/src/views/business/comps/template/comps/sp/SP001.vue b/src/views/business/comps/template/comps/sp/SP001.vue index ec1d762..28ff59d 100644 --- a/src/views/business/comps/template/comps/sp/SP001.vue +++ b/src/views/business/comps/template/comps/sp/SP001.vue @@ -41,6 +41,7 @@ import CustomTable from '@/components/Template/CustomTable.vue'; import { getLatestSn } from '@/api/template'; import { EventBus } from "@/utils/eventBus"; import { uniqeResource } from "@/utils/calUnitTools"; +import { debounce } from 'lodash-es' export default { name: "SP001", @@ -248,17 +249,11 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if (!v.targetCodeSn && this.fillType === "actFill") { - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if(!formData.targetCodeSn&& this.fillType === "actFill"){ + this.getCode(formData); } + }, methods: { //打印标签 @@ -271,7 +266,7 @@ export default { EventBus.$emit('showTagPrintDialog', { printConfig }) }, //获取目标溶液编号 - async getCode(v) { + getCode: debounce(async function (v) { const result = await getLatestSn({ count: 1, pre:v.targetCode, @@ -280,7 +275,7 @@ export default { if (result.code == 200) { this.$refs.stepFormPackageRef.updateFormData("targetCodeSn", result.data[0]) } - }, + }, 100), //获取已填写的表单数据 getFilledFormData() { return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"]) diff --git a/src/views/business/comps/template/comps/sp/SP002.vue b/src/views/business/comps/template/comps/sp/SP002.vue index ca20420..83f995a 100644 --- a/src/views/business/comps/template/comps/sp/SP002.vue +++ b/src/views/business/comps/template/comps/sp/SP002.vue @@ -248,16 +248,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if (!v.targetCodeSn && this.fillType === "actFill") { - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (!formData.targetCodeSn && this.fillType === "actFill") { + this.getCode(formData); } }, methods: { @@ -270,15 +263,15 @@ export default { EventBus.$emit('showTagPrintDialog', { printConfig }) }, - getStepResource(){ + getStepResource() { return this.$refs.stepRef.getStepResource() }, //获取目标溶液编号 async getCode(v) { const result = await getLatestSn({ count: 1, - pre:v.targetCode, - type:1 + pre: v.targetCode, + type: 1 }) if (result.code == 200) { this.$refs.stepFormPackageRef.updateFormData("targetCodeSn", result.data[0]) @@ -301,7 +294,7 @@ export default { ph: '', nd: content.targetActConcentration, nddw: content.targetActConcentrationUnit, - ndz: content.targetActConcentration + content.targetActConcentrationUnit, + ndz: content.targetActConcentration + content.targetActConcentrationUnit, ly: 'ELN配制', sxrq: content.expireDate, kc: content.targetActVolume, @@ -316,8 +309,8 @@ export default { } //使用的试剂、仪器 const stepResource = this.$refs.stepRef.getStepResource() - this.resourceTmp =uniqeResource(tmpResource,stepResource.sjResource||[]) - this.yqResourceTmp = stepResource.yqResource||[] + this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || []) + this.yqResourceTmp = stepResource.yqResource || [] return content; } } diff --git a/src/views/business/comps/template/comps/sp/SP003.vue b/src/views/business/comps/template/comps/sp/SP003.vue index 7948682..caa9b4c 100644 --- a/src/views/business/comps/template/comps/sp/SP003.vue +++ b/src/views/business/comps/template/comps/sp/SP003.vue @@ -63,16 +63,7 @@ export default { default: 'preFill', }, }, - watch: { - fillType: { - immediate: true, - handler(v) { - if (v && this.fillType === "actFill") { - this.handleUpdateCode(); - } - } - }, - }, + computed: { // 存储条件表单配置 storageFormConfig() { @@ -423,6 +414,10 @@ export default { }; }, mounted() { + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.handleUpdateCode(formData); + } }, methods: { //更新记录 @@ -488,8 +483,8 @@ export default { } }, //更新代码 - async handleUpdateCode() { - const { stepTableFormData = [] } = this.formData; + async handleUpdateCode(v) { + const { stepTableFormData = [] } = v; if (stepTableFormData.length === 0) { return; } diff --git a/src/views/business/comps/template/comps/sp/SP00456.vue b/src/views/business/comps/template/comps/sp/SP00456.vue index 01fd73e..c6f29d0 100644 --- a/src/views/business/comps/template/comps/sp/SP00456.vue +++ b/src/views/business/comps/template/comps/sp/SP00456.vue @@ -133,14 +133,6 @@ export default { console.log(v, "fillType") } }, - formData: { - immediate: true, - handler(v) { - if (v && this.fillType === "actFill") { - this.handleUpdateCode(); - } - } - } }, computed: { // 存储条件表单配置 @@ -184,6 +176,12 @@ export default { }; }, mounted() { + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + setTimeout(() => { + this.handleUpdateCode(formData); + }, 0); + } }, methods: { onSureModifyRecord(type, index, e) { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP008.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP008.vue index 9682fad..94e37c7 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP008.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP008.vue @@ -244,18 +244,12 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if(this.fillType === "actFill"){ + this.getCode(formData); } }, + methods: { //点击基质选择 handleJzClickable(obj){ diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP009.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP009.vue index 6c684c6..0c636f3 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP009.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP009.vue @@ -283,16 +283,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if (this.fillType === "actFill") { - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP010.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP010.vue index 6b3069c..866d4ba 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP010.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP010.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP011.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP011.vue index 73aae91..160b63e 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP011.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP011.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP012.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP012.vue index 8ee71e9..819dd46 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP012.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP012.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP013.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP013.vue index 2bd6e5f..adc06ac 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP013.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP013.vue @@ -242,16 +242,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP014.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP014.vue index 4f2a437..2f7aa36 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP014.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP014.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP015.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP015.vue index b006c20..1661434 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP015.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP015.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP016.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP016.vue index ca5042b..9a625e4 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP016.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP016.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP017.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP017.vue index c272d75..686eae5 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP017.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP017.vue @@ -244,16 +244,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP018.vue b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP018.vue index bd87d19..61c1dc6 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP018.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXFFXYPZBB/SP018.vue @@ -242,16 +242,9 @@ export default { }; }, mounted() { - - }, - watch: { - formData: { - immediate: true, - handler(v) { - if(this.fillType === "actFill"){ - this.getCode(v); - } - } + const formData = this.getFormDataByTemplateData(); + if (this.fillType === "actFill") { + this.getCode(formData); } }, methods: { diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index 95ef8cb..4fd31d2 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -159,6 +159,14 @@ export default { this.setTemplateData({}) }, methods: { + getFormDataByTemplateData(){ + let o = {}; + const { bdnr } = this.templateData + if(bdnr){ + o = JSON.parse(bdnr) + } + return o; + }, //开始配置 //postData: {bh: '123456'} async startConfigRequest(postData) {