diff --git a/src/components/Template/BaseInfoFormPcakge.vue b/src/components/Template/BaseInfoFormPcakge.vue index e8015ee..3b1b55a 100644 --- a/src/components/Template/BaseInfoFormPcakge.vue +++ b/src/components/Template/BaseInfoFormPcakge.vue @@ -67,7 +67,7 @@
-
{{ sItem.label }}
+
{{ sItem.label }}
@@ -158,6 +158,7 @@ export default { return { label: sItem.label, options: sItem.subOptions || [], + fillType: sItem.subFillType || sItem.fillType, } }, isShowOther(v = []) { @@ -183,22 +184,22 @@ export default { let value = formData[key]; // 处理多选下拉框的默认值,确保数组类型 - if (currentConfig.type === 'select' && currentConfig.multiple) { - if (!Array.isArray(value)) { - // 转换为数组格式,确保兼容性 - value = value ? [value] : []; - } - } + // if (currentConfig.type === 'select' && currentConfig.multiple) { + // if (!Array.isArray(value)) { + // // 转换为数组格式,确保兼容性 + // value = value ? [value] : []; + // } + // } - // 处理null/undefined值,保持一致性 - if (value === null || value === undefined) { - // 根据类型设置默认值 - if (currentConfig.type === 'select' && currentConfig.multiple) { - value = []; - } else { - value = ''; - } - } + // // 处理null/undefined值,保持一致性 + // if (value === null || value === undefined) { + // // 根据类型设置默认值 + // if (currentConfig.type === 'select' && currentConfig.multiple) { + // value = []; + // } else { + // value = ''; + // } + // } // 如果formFields中已经有值,保持原值(用户输入或之前设置的值) if (formFields[key] !== null && @@ -239,21 +240,27 @@ export default { }, getFormData() { const { formFields, allFieldsConfig } = this; + const { templateStatus } = this.$store.state.template; return new Promise((resolve,reject)=>{ for (const key in formFields) { - if (!formFields[key]) { - const o = allFieldsConfig[key]; - let prefix = ""; - if (o.type === "input") { - prefix = "填写" - } else { - prefix = "选择" + console.log(key,formFields[key]) + if (!formFields[key]) { + const o = allFieldsConfig[key]; + console.log(templateStatus,o.fillType,"fill") + if (o.fillType == templateStatus) { + let prefix = ""; + if (o.type === "input") { + prefix = "填写" + } else { + prefix = "选择" + } + this.$message.error(`${o.label}还未${prefix}请${prefix}后再提交`); + reject(`${o.label}还未${prefix}`); + return; + } + } - this.$message.error(`${o.label}还未${prefix}请${prefix}后再提交`); - reject("还未填写完"); - return; } - } resolve(formFields) }) @@ -266,14 +273,14 @@ export default { // 获取对应的配置 const currentConfig = this.allFieldsConfig[key]; - // 确保多选下拉框的值是数组类型 - if (currentConfig && currentConfig.multiple) { - // 多选情况,确保值为数组类型 - this.formFields[key] = Array.isArray(val) ? val : (val ? [val] : []); - } else { + // // 确保多选下拉框的值是数组类型 + // if (currentConfig && currentConfig.multiple) { + // // 多选情况,确保值为数组类型 + // this.formFields[key] = Array.isArray(val) ? val : (val ? [val] : []); + // } else { // 单选情况 this.formFields[key] = val; - } + // } this.$emit("select", { key, value: val }); }, @@ -342,7 +349,7 @@ export default { font-weight: normal; color: #606266; } -.step-title{ +.step-form-title{ font-size: 14px; font-weight: normal; color: #606266; diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue new file mode 100644 index 0000000..99e043d --- /dev/null +++ b/src/components/Template/CustomTable.vue @@ -0,0 +1,163 @@ + + + + + \ No newline at end of file diff --git a/src/components/Template/Step.vue b/src/components/Template/Step.vue index 52ae962..421571d 100644 --- a/src/components/Template/Step.vue +++ b/src/components/Template/Step.vue @@ -1,24 +1,13 @@ @@ -31,15 +33,30 @@ import LineLabel from "@/components/Template/LineLabel"; import TableList from "@/components/Template/Table"; import Step from "@/components/Template/Step"; import templateMixin from "../../mixins/templateMixin"; +import CustomTable from '@/components/Template/CustomTable.vue'; +const mgOptions = [ + {label:"mg",value:"mg"}, + {label:"ng",value:"ng"}, +]; +const conditionOptions = [ + {label:"条件1",value:"1"}, + {label:"条件2",value:"2"}, + {label:"条件3",value:"3"}, + {label:"其他",value:"-1"}, +]; export default { name: "SWYPFXRYPZB", - components: { BaseInfoFormPcakge,LineLabel,TableList,Step }, + components: { BaseInfoFormPcakge,LineLabel,TableList,Step,CustomTable }, mixins: [templateMixin], props: { value: { type: {}, default: () => { }, - } + }, + fillType: { + type: String, + default: 'preFill', + }, }, watch: { value: { @@ -53,18 +70,18 @@ export default { return { dataSource:[{name:"名称1"}], sysjColumns:[ - {label:"试剂名称",prop:"name"}, - {label:"编号",prop:"name"}, - {label:"批号",prop:"name"}, - {label:"浓度/含量/纯度",prop:"name"}, - {label:"来源",prop:"name"}, - {label:"失效日",prop:"name"}, + {label:"试剂名称",prop:"reagentName"}, + {label:"编号",prop:"reagentCode"}, + {label:"批号",prop:"reagentNo"}, + {label:"浓度/含量/纯度",prop:"concentration"}, + {label:"来源",prop:"source"}, + {label:"失效日",prop:"expireDate"}, ], yqsColumns:[ - {label:"仪器名称",prop:"name"}, - {label:"仪器型号",prop:"name"}, - {label:"仪器编号",prop:"name"}, - {label:"下次测试/校准/检定日期",prop:"name"}, + {label:"仪器名称",prop:"instrumentName"}, + {label:"仪器型号",prop:"instrumentModel"}, + {label:"仪器编号",prop:"instrumentCode"}, + {label:"下次测试/校准/检定日期",prop:"nextTestDate"}, ], storageFormConfig:[ { @@ -74,11 +91,7 @@ export default { label:"存储条件", type:"select", fillType:"preFill", - options:[ - {label:"白光",value:"1"}, - {label:"黄光",value:"3"}, - {label:"其他",value:"-1"}, - ], + options:conditionOptions, otherCode:"other1", }, @@ -122,11 +135,7 @@ export default { type:"select", multiple:true, fillType:"preFill", - options:[ - {label:"白光",value:"1"}, - {label:"黄光",value:"3"}, - {label:"其他",value:"-1"}, - ], + options:conditionOptions, otherCode:"other1", }, act:{ @@ -135,11 +144,7 @@ export default { fillType:"actFill", otherCode:"other2", multiple:true, - options:[ - {label:"白光",value:"1"}, - {label:"黄光",value:"3"}, - {label:"其他",value:"-1"}, - ] + options:conditionOptions } } }, @@ -149,11 +154,11 @@ export default { config:{ startDate:{ label:"开始时间", - type:"dateTime", + type:"input", }, endDate:{ label:"结束时间", - type:"dateTime", + type:"input", }, } } @@ -162,31 +167,66 @@ export default { { type:"step", config:{ - startDate:{ + targetName:{ label:"目标溶液名称", type:"input", + fillType:"preFill", }, - endDate:{ + targetCode:{ label:"目标溶液编号", type:"input", subType:"span", + fillType:"preFill", subKey:"targetCode1", }, - target:{ + targetPreConcentration:{ label:"目标溶液预计浓度", type:"input", subType:"select", - subKey:"taget1", + subKey:"targetPreConcentrationUnit", + fillType:"preFill", + subOptions:mgOptions, + }, + targetActConcentration:{ + label:"目标溶液实际浓度", + type:"input", + subType:"select", + subKey:"targetActConcentrationUnit", + fillType:"actFill", + subFillType:"preFill", + subOptions:mgOptions, + }, + targetPreVolume:{ + label:"目标溶液预计体积", + type:"input", + subType:"select", + subKey:"targetPreVolumeUnit", + subOptions:mgOptions, + fillType:"preFill", + }, + targetActVolume:{ + label:"目标溶液实际体积", + type:"input", + subType:"select", + subKey:"targetActVolumeUnit", + fillType:"actFill", + subFillType:"preFill", + subOptions:mgOptions, + }, + effectivePeriod:{ + label:"有效周期", + type:"input", + subType:"select", + subKey:"effectivePeriodUnit", + fillType:"preFill", subOptions:[ - {label:"mg",value:"mg"}, - {label:"ng",value:"ng"}, + {label:"小时",value:"hour"}, + {label:"天",value:"day"}, ], }, - target:{ - label:"目标溶液预计浓度", + expireDate:{ + label:"失效日", type:"input", - subType:"clickable", - subKey:"taget1c", }, } } @@ -197,17 +237,37 @@ export default { mounted() { setTimeout(()=>{ this.formData = { - code:"code1",name:"name1",act:["1","-1"],taget1:"mg",targetCode1:"123456",taget1c:"可点击" + // code:"code1",name:"name1",act:["1","-1"],taget1:"mg",targetCode1:"123456",taget1c:"可点击" } + },3000) + setTimeout(()=>{ + this.storageFormConfig[0].config.storageCondition1.options = [ + {label:"白光",value:"1"}, + {label:"黄光",value:"3"}, + {label:"其他",value:"-1"}, + ] + },4000) }, methods: { + getFormData(){ + const baseData = this.$refs.baseInfo.getFormData(); + const conditionData = this.$refs.storageCondition.getFormData(); + const stepData = this.$refs.stepRef.getFormData(); + const stepFormData = this.$refs.stepFormPackage.getFormData(); + return { + ...baseData, + ...conditionData, + ...stepData, + ...stepFormData, + } + }, async onSave(){ - // const result1 = await this.$refs.baseInfo.getFormData(); - // const result2 = await this.$refs.storageCondition.getFormData(); - // const result3 = await this.$refs.stepRef.getFormData(); - const result = await this.$refs.stepFormPackage.getFormData(); - console.log(result,"reee") + const baseData = await this.$refs.baseInfo.getFormData(); + const conditionData = await this.$refs.storageCondition.getFormData(); + const stepData = await this.$refs.stepRef.getFormData(); + const stepFormData = await this.$refs.stepFormPackage.getFormData(); + console.log(baseData,conditionData,stepData,stepFormData,"reee") } } }; diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index e1ad914..2f9519e 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -3,9 +3,9 @@ export default { }, mounted() { - setTimeout(() => { - this.setTemplateStatus("actFill") - }, 4000) + + this.setTemplateStatus(this.fillType) + }, methods: { setTemplateStatus(status) { diff --git a/src/views/business/template/list.vue b/src/views/business/template/list.vue index 7f89510..ee331a0 100644 --- a/src/views/business/template/list.vue +++ b/src/views/business/template/list.vue @@ -79,7 +79,7 @@ - +