From 14f9957c0e5f66a8cd17f2a2c3e5e1dc888e1f44 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Tue, 6 Jan 2026 23:07:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E8=89=B2=E8=B0=B14]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Template/BaseInfoFormPcakge.vue | 3 +- .../business/comps/template/TemplateTable.vue | 4 +- .../business/comps/template/comps/dl/SYWZPZJHB.vue | 2 +- .../comps/template/comps/sp/SWYPBQGZYZBB.vue | 30 +- .../comps/template/comps/sp/SWYPFXCBYPZB.vue | 16 +- .../comps/template/comps/sp/SWYPFXRYPZB.vue | 17 +- .../comps/template/comps/sp/SWYPNBGZYZBB.vue | 985 +++++++++++++++++++++ .../comps/template/mixins/templateMixin.js | 112 ++- 8 files changed, 1075 insertions(+), 94 deletions(-) create mode 100644 src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue diff --git a/src/components/Template/BaseInfoFormPcakge.vue b/src/components/Template/BaseInfoFormPcakge.vue index 3190013..57f9ef0 100644 --- a/src/components/Template/BaseInfoFormPcakge.vue +++ b/src/components/Template/BaseInfoFormPcakge.vue @@ -235,7 +235,8 @@ export default { isShowOther(v = []) { // 确保v是数组类型,以避免类型错误 const arr = Array.isArray(v) ? v : [v]; - return arr.map(val => String(val)).includes("-1"); + //和凡哥商量,只要value为负数都显示其他 + return arr.some(item => item<0); }, // 根据formConfig回填form表单数据 handleFormField() { diff --git a/src/views/business/comps/template/TemplateTable.vue b/src/views/business/comps/template/TemplateTable.vue index a5ad308..c62967b 100644 --- a/src/views/business/comps/template/TemplateTable.vue +++ b/src/views/business/comps/template/TemplateTable.vue @@ -14,11 +14,12 @@ import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue"; import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue"; import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue"; import SYWZPZJHB from "./comps/dl/SYWZPZJHB.vue"; +import SWYPNBGZYZBB from "./comps/sp/SWYPNBGZYZBB.vue"; import Demo from "./comps/sp/Demo.vue"; export default { name: "TemplateTable", components: { - SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,SYWZPZJHB, + SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,SYWZPZJHB,SWYPNBGZYZBB, }, props: { sn: { @@ -42,6 +43,7 @@ export default { 'SP001': 'SWYPFXRYPZB', 'SP002': 'SWYPFXCBYPZB', 'SP003': 'SWYPBQGZYZBB', + 'SP004': 'SWYPNBGZYZBB', 'DL001': 'SYWZPZJHB', // 'SP001': 'Demo', } diff --git a/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue b/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue index bf2b407..45f01d3 100644 --- a/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue +++ b/src/views/business/comps/template/comps/dl/SYWZPZJHB.vue @@ -235,6 +235,6 @@ export default { .add-row{ display: flex; justify-content: center; - margin-top: 20px; + padding: 20px 0; } \ No newline at end of file diff --git a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue index 636359a..bb287eb 100644 --- a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue @@ -87,7 +87,7 @@ export default { label: "存储条件", type: "select", fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions('business_cctj'), otherCode: "other1", }, @@ -155,7 +155,7 @@ export default { type: "select", multiple: true, fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions('business_pztj'), otherCode: "preOther", }, act: { @@ -164,7 +164,7 @@ export default { fillType: "actFill", otherCode: "actOther", multiple: true, - options: this.$store.state.template.conditionOptions + options: this.getDictOptions('business_pztj') } } }, @@ -174,7 +174,7 @@ export default { containerMaterial: { label: "容器材质", type: "select", - options: this.$store.state.template.containerMaterialOptions, + options: this.getDictOptions('business_rqcz'), fillType: "actFill", otherCode: "containerMaterialOther", } @@ -216,7 +216,7 @@ export default { type: "inputNumber", subType: "select", fillType: "preFill", - subOptions: this.$store.state.template.mgOptions, + subOptions: this.getDictOptions('business_nddw'), subKey: "subTargetStartSolution", maxlength: 10, }, @@ -246,7 +246,7 @@ export default { label: "存储条件", type: "select", fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions('business_cctj'), otherCode: "stepStorageConditionOther", }, @@ -256,7 +256,7 @@ export default { subType: "select", subKey: "effectivePeriodUnit", fillType: "preFill", - subOptions: this.$store.state.template.effectivePeriodOptions, + subOptions: this.getDictOptions('business_yxqdw'), }, expireDate: { label: "目标溶液失效日", @@ -292,7 +292,7 @@ export default { width: 280, headerSelectKey: "targetStartSolutionVolumeUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_tjdw'), defaultValue: "mg", bodyType: "inputNumber", bodySubType: "inputNumber", @@ -311,7 +311,7 @@ export default { width: 280, headerSelectKey: "actStartSolutionVolumeUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_tjdw'), bodyType: "inputNumber", bodyFillType: "actFill", bodyMaxlength: 10, @@ -323,7 +323,7 @@ export default { width: 280, headerSelectKey: "targetDiluentVolumeUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_tjdw'), defaultValue: "mg", bodyType: "inputNumber", bodySubType: "inputNumber", @@ -342,7 +342,7 @@ export default { width: 280, headerSelectKey: "actDiluentVolumeUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_tjdw'), bodyType: "inputNumber", bodyFillType: "actFill", bodyMaxlength: 10, @@ -354,7 +354,7 @@ export default { width: 280, headerSelectKey: "targetSolutionConcentrationUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_nddw'), bodyType: "inputNumber", bodyFillType: "preFill", bodyMaxlength: 10, @@ -365,7 +365,7 @@ export default { width: 280, headerSelectKey: "actSolutionConcentrationUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_nddw'), defaultValue: "mg", bodyType: "inputNumber", bodySubType: "inputNumber", @@ -385,7 +385,7 @@ export default { width: 280, headerSelectKey: "targetSolutionVolumeUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_tjdw'), bodyType: "inputNumber", bodyFillType: "preFill", bodyMaxlength: 10, @@ -396,7 +396,7 @@ export default { width: 280, headerSelectKey: "actSolutionVolumeUnit", fillType: "preFill", - headerOptions: this.$store.state.template.volumeOptions, + headerOptions: this.getDictOptions('business_tjdw'), defaultValue: "mg", bodyType: "inputNumber", bodySubType: "inputNumber", diff --git a/src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue b/src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue index 5488650..e2a8d90 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue @@ -68,7 +68,7 @@ export default { label: "存储条件", type: "select", fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions('business_cctj'), otherCode: "storageConditionOther", }, @@ -131,7 +131,7 @@ export default { type: "select", multiple: true, fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions('business_pztj'), otherCode: "preOther", }, act: { @@ -140,7 +140,7 @@ export default { fillType: "actFill", otherCode: "actOther", multiple: true, - options: this.$store.state.template.conditionOptions + options: this.getDictOptions('business_pztj'), } } }, @@ -183,7 +183,7 @@ export default { subType: "select", subKey: "targetPreConcentrationUnit", fillType: "preFill", - subOptions: this.$store.state.template.mgOptions, + subOptions: this.getDictOptions('business_nddw'), }, targetActConcentration: { label: "目标溶液实际浓度", @@ -192,7 +192,7 @@ export default { subKey: "targetActConcentrationUnit", fillType: "actFill", subFillType: "preFill", - subOptions: this.$store.state.template.mgOptions, + subOptions: this.getDictOptions('business_nddw'), copyFrom: "targetPreConcentration",//复制哪个字段 }, targetPreVolume: { @@ -200,7 +200,7 @@ export default { type: "input", subType: "select", subKey: "targetPreVolumeUnit", - subOptions: this.$store.state.template.volumeOptions, + subOptions: this.getDictOptions('business_tjdw'), fillType: "preFill", }, targetActVolume: { @@ -210,7 +210,7 @@ export default { subKey: "targetActVolumeUnit", fillType: "actFill", subFillType: "preFill", - subOptions: this.$store.state.template.volumeOptions, + subOptions: this.getDictOptions('business_tjdw'), copyFrom: "targetPreVolume",//复制哪个字段 }, effectivePeriod: { @@ -219,7 +219,7 @@ export default { subType: "select", subKey: "effectivePeriodUnit", fillType: "preFill", - subOptions: this.$store.state.template.effectivePeriodOptions, + subOptions: this.getDictOptions('business_yxqdw'), }, expireDate: { label: "失效日", diff --git a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue index b927781..7b392dd 100644 --- a/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue @@ -68,7 +68,7 @@ export default { label: this.$t('template.common.storageConditionLabel'), type: "select", fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions("business_cctj"), otherCode: "storageConditionOther", }, @@ -133,7 +133,7 @@ export default { type: "select", multiple: true, fillType: "preFill", - options: this.$store.state.template.conditionOptions, + options: this.getDictOptions('business_pztj'), otherCode: "preOther", }, act: { @@ -142,7 +142,7 @@ export default { fillType: "actFill", otherCode: "actOther", multiple: true, - options: this.$store.state.template.conditionOptions + options: this.getDictOptions('business_pztj') } } }, @@ -187,7 +187,7 @@ export default { subType: "select", subKey: "targetPreConcentrationUnit", fillType: "preFill", - subOptions: this.$store.state.template.mgOptions, + subOptions: this.getDictOptions('business_nddw'), maxlength:10 }, targetActConcentration: { @@ -197,7 +197,7 @@ export default { subKey: "targetActConcentrationUnit", fillType: "actFill", subFillType: "preFill", - subOptions: this.$store.state.template.mgOptions, + subOptions: this.getDictOptions('business_nddw'), copyFrom: "targetPreConcentration",//复制哪个字段 maxlength:10 }, @@ -206,7 +206,7 @@ export default { type: "inputNumber", subType: "select", subKey: "targetPreVolumeUnit", - subOptions: this.$store.state.template.volumeOptions, + subOptions: this.getDictOptions('business_tjdw'), fillType: "preFill", maxlength:10 }, @@ -217,7 +217,7 @@ export default { subKey: "targetActVolumeUnit", fillType: "actFill", subFillType: "preFill", - subOptions: this.$store.state.template.volumeOptions, + subOptions: this.getDictOptions('business_tjdw'), copyFrom: "targetPreVolume",//复制哪个字段 maxlength:10 }, @@ -227,7 +227,7 @@ export default { subType: "select", subKey: "effectivePeriodUnit", fillType: "preFill", - subOptions: this.$store.state.template.effectivePeriodOptions, + subOptions: this.getDictOptions('business_yxqdw'), maxlength:10 }, expireDate: { @@ -264,7 +264,6 @@ export default { this.formData = { effectivePeriodUnit:"days",//设置默认值 createTime: "2026-01-02 18:05:36",//设置默认值 - targetPreConcentration:2, } } }, diff --git a/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue b/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue new file mode 100644 index 0000000..187ad88 --- /dev/null +++ b/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue @@ -0,0 +1,985 @@ + + + + + \ No newline at end of file diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index 8904b67..fb05cb9 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -1,53 +1,47 @@ import moment from "moment"; export default { + dicts: ['business_pztj','business_cctj','business_nddw','business_tjdw','business_yxqdw','business_rqcz'], props: { templateData: { type: Object, - default: () => {}, + default: () => { }, }, }, watch: { - templateData: { - immediate: true, - handler(v) { - if(v){ - let n = {...v}; - if(v.bdnr){ - this.formData = {...n,...JSON.parse(v.bdnr)}; + templateData: { + immediate: true, + handler(v) { + if (v) { + let n = { ...v }; + if (v.bdnr) { + this.formData = { ...n, ...JSON.parse(v.bdnr) }; } this.templateDetail = n; this.setTemplateData(n); } - } - } - }, + } + } + }, data() { return { formData: {}, - templateDetail:{} + templateDetail: {} } }, mounted() { - - setTimeout(() => { - this.setConditionOptions( - [ - { label: "条件5", value: "1" }, - { label: "条件6", value: "2" }, - { label: "条件7", value: "3" }, - { label: "其他", value: "-1" }, - ] - ) - }, 1000); - // this.setTemplateStatus("actFill"); - this.setTemplateStatus(this.fillType) - + // this.setTemplateStatus("actFill"); + this.setTemplateStatus(this.fillType); }, unmounted() { this.setTemplateStatus(""); this.setTemplateData({}); }, methods: { + + //试验配制条件options + getDictOptions(dictType) { + return this.dict.type[dictType] || []; + }, setTemplateStatus(status) { this.$store.commit('template/SET_TEMPLATE_STATUS', status) }, @@ -62,58 +56,58 @@ export default { this.$refs.stepTableRef.deleteRow(index); }, //获取版本号 - getVersionNum(){ + getVersionNum() { return this.formData.versionNum || ""; }, //统一处理blur事件,因为有效周期和过期日期是相关的,所以需要在有效周期失焦时更新过期日期 - onHandleBlur(fields){ - const {key ,effectivePeriodUnit,effectivePeriod,codeSTD,targetStartSolution} = fields; - const {createTime} = this.formData; - if(key ==="effectivePeriod"){//统一处理有效周期失焦,计算失效事件,保证字段名不能变 - const start = moment(createTime); - const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss"); - this.$refs.stepFormPackageRef.updateFormData("expireDate", end); - }else if(key === "codeSTD"){//起始编号STD失焦时,更新stepDataSource - const arr = Array.from({length:codeSTD},(item,index) => ({ - actSolutionVolumePrecision:3,//小数点精度默认为3 - actSolutionConcentrationPrecision:3,//小数点精度默认为3 - targetDiluentVolumePrecision:3,//小数点精度默认为3 - targetStartSolutionVolumePrecision:3,//小数点精度默认为3 - targetSolutionCode:`STD${Number(codeSTD)-index}` + onHandleBlur(fields) { + const { key, effectivePeriodUnit, effectivePeriod, codeSTD, targetStartSolution } = fields; + const { createTime } = this.formData; + if (key === "effectivePeriod") {//统一处理有效周期失焦,计算失效事件,保证字段名不能变 + const start = moment(createTime); + const end = start.add(Number(effectivePeriod), effectivePeriodUnit).format("YYYY-MM-DD HH:mm:ss"); + this.$refs.stepFormPackageRef.updateFormData("expireDate", end); + } else if (key === "codeSTD") {//起始编号STD失焦时,更新stepDataSource + const arr = Array.from({ length: codeSTD }, (item, index) => ({ + actSolutionVolumePrecision: 3,//小数点精度默认为3 + actSolutionConcentrationPrecision: 3,//小数点精度默认为3 + targetDiluentVolumePrecision: 3,//小数点精度默认为3 + targetStartSolutionVolumePrecision: 3,//小数点精度默认为3 + targetSolutionCode: `STD${Number(codeSTD) - index}` })); this.$refs.stepTableRef.updateDataSource(arr); - }else if(key === "targetStartSolution"){//起始溶液体积失焦时,更新目标溶液预计浓度 + } else if (key === "targetStartSolution") {//起始溶液体积失焦时,更新目标溶液预计浓度 const arr = this.$refs.stepTableRef.getDataSource(); - arr.forEach((item,rowIndex) => { - this.updateTargetStartSolutionVolume(rowIndex,item,targetStartSolution); + arr.forEach((item, rowIndex) => { + this.updateTargetStartSolutionVolume(rowIndex, item, targetStartSolution); }) } - }, + }, //统一处理table失焦事件 - onHandleTableBlur(params){ - const {rowIndex, colKey, value,item} = params; - console.log(rowIndex, colKey, value,item, "params") - if(colKey === "targetSolutionVolume" || colKey === "targetSolutionConcentration" || colKey === "targetStartSolutionVolumePrecision" || colKey === "targetDiluentVolumePrecision"){ + onHandleTableBlur(params) { + const { rowIndex, colKey, value, item } = params; + console.log(rowIndex, colKey, value, item, "params") + if (colKey === "targetSolutionVolume" || colKey === "targetSolutionConcentration" || colKey === "targetStartSolutionVolumePrecision" || colKey === "targetDiluentVolumePrecision") { const volume = this.$refs.stepFormPackageRef.getFormDataByKey("targetStartSolution") || 0; - if(volume){ - this.updateTargetStartSolutionVolume(rowIndex,item,volume); + if (volume) { + this.updateTargetStartSolutionVolume(rowIndex, item, volume); } } }, //更新起始溶液体积时,更新目标溶液预计浓度 - updateTargetStartSolutionVolume(rowIndex,item,volume){ + updateTargetStartSolutionVolume(rowIndex, item, volume) { const precision = item.targetStartSolutionVolumePrecision || 0; const concentration = item.targetSolutionConcentration || 0; const targetVolume = item.targetSolutionVolume || 0; //目标溶液预计浓度:(目标溶液预计体积 乘以 起始溶液浓度)除以 起始溶液体积 const result = ((concentration * targetVolume) / volume).toFixed(precision); - this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex,{targetStartSolutionVolume:result}); - if(targetVolume){ - //预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积; - const precision1 = item.targetDiluentVolumePrecision || 0; - const result1 = (targetVolume - result).toFixed(precision1); - this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex,{targetDiluentVolume:result1}); - } + this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetStartSolutionVolume: result }); + if (targetVolume) { + //预设稀释液体积:目标溶液预计体积 减去 源溶液预计体积; + const precision1 = item.targetDiluentVolumePrecision || 0; + const result1 = (targetVolume - result).toFixed(precision1); + this.$refs.stepTableRef.updateDataSourceByRowIndex(rowIndex, { targetDiluentVolume: result1 }); + } } },