diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js index 6bc3191..33838cb 100644 --- a/src/components/Template/mixins/formPackageMixins.js +++ b/src/components/Template/mixins/formPackageMixins.js @@ -55,15 +55,10 @@ export default { }, //更新表单数据 updateFormData(key, value,oldKeys = []) { - - if(oldKeys.length){ - // 深拷贝当前表单数据,避免直接修改原数据 - const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)); - oldKeys.forEach(oldKey => { - //需要把记录一下被更新的旧值,用于取消的时候回填,主要用于clickable类型 - this.oldFormFields[oldKey] = cloneFormFields[oldKey]; - }) - } + // 深拷贝当前表单数据,避免直接修改原数据 + const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)); + this.oldFormFields[key] = cloneFormFields[key]; + this.formFields[key] = value; // 清除该表单项的错误状态 if (this.errors[key]) { @@ -344,6 +339,7 @@ export default { }, resetRecord(key){ this.formFields = {...this.formFields, ...this.oldFormFields}; + this.oldFormFields = {}; this.$emit("resetRecord"); }, } diff --git a/src/components/Template/operation/TableOpertaion.vue b/src/components/Template/operation/TableOpertaion.vue index 3e036cb..0281aba 100644 --- a/src/components/Template/operation/TableOpertaion.vue +++ b/src/components/Template/operation/TableOpertaion.vue @@ -70,24 +70,39 @@ export default { }, methods: { + //获取实际填报的config + getColumnConfig(){ + const { columns } = this; + const { columnsData } = columns; + let o = {}; + columnsData.forEach((item) => { + if(item.bodyFillType === "actFill"){ + o[item.prop] = ""; + }else if(item.bodySubFillType === "actFill"){ + o[item.bodySubKey] = ""; + } + }); + return o; + }, // 开始配置 onStartConfig() { this.$emit("startConfig", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) }, // 配置完成 onConfigComplete() { - // const isComplete = Object.values(this.innerRow).every((val)=>{ - // // 0 算有值 - // if (val === 0) return true; - // if (val === "0") return true; - // // 其他情况:非 null、非 undefined、非空字符串 - // return val != null && val != undefined && val != ""; - // }); - // if(!isComplete){ - // this.$message.error("表单内容未填完,请填写完成后才能配制完成") - // return - // } - console.log(this.columns,"columns") + const actConfig = this.getColumnConfig(); + const cloneRow = JSON.parse(JSON.stringify(this.innerRow)); + const isComplete = Object.values({...actConfig,...cloneRow}).every((val)=>{ + // 0 算有值 + if (val === 0) return true; + if (val === "0") return true; + // 其他情况:非 null、非 undefined、非空字符串 + return val != null && val != undefined && val != ""; + }); + if(!isComplete){ + this.$message.error("表单内容未填完,请填写完成后才能配制完成") + return + } this.$emit("configComplete", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) }, // 打印标签 diff --git a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue index a267371..0b8a31f 100644 --- a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue @@ -515,10 +515,10 @@ export default { //选择试剂提交事件 onSelectReagentSubmit(code, row) { if (this.currentSubKey === "subStartSolution") {//起始源溶液点击事件 - this.$refs.stepFormPackageRef.updateFormData("targetAcSolution", row.nd, ["targetAcSolution"]); + this.$refs.stepFormPackageRef.updateFormData("targetAcSolution", row.nd); this.updateStepTableData(row); } - this.$refs.stepFormPackageRef.updateFormData(this.currentSubKey, code, [this.currentSubKey]); + this.$refs.stepFormPackageRef.updateFormData(this.currentSubKey, code); this.$refs.selectReagentDialogRef.onCancel() }, //更新table数据 diff --git a/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue b/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue index 4f0d488..c2871ad 100644 --- a/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue @@ -408,7 +408,7 @@ export default { const { actVol, actNd } = this.updateSjmbrynd(item, targetAcSolution); this.$refs[`paralleStepTableRef_${configIndex}`][0]?.updateDataSourceByRowIndex(rowIndex, { actSolutionVolume: actVol, - targetAcSolution: actNd, + actSolutionConcentration: actNd, }); } } @@ -447,11 +447,11 @@ export default { const ref = this.currentType === "ladder" ? "ladderStepFormPackageRef_" : "paralleStepFormPackageRef_" const packageRef = this.$refs[`${ref}${this.currentRowIndex}`][0]; if (currentSubKey === "subStartSolution") { - packageRef.updateFormData("targetAcSolution", row.nd, ["targetAcSolution"]); + packageRef.updateFormData("targetAcSolution", row.nd); packageRef.onValueChangeCompareTo("targetAcSolution", row.nd, "targetStartSolution"); this.updateTableNd(row); } - packageRef.updateFormData(currentSubKey, code, [currentSubKey]); + packageRef.updateFormData(currentSubKey, code); this.currentSubKey = ""; } else if (currentTableKey === "actStartSolutionCode") {//实际原始溶液编号点击事件 const tableRef = this.$refs[`paralleStepTableRef_${currentRowIndex}`][0]; @@ -461,7 +461,7 @@ export default { actStartSolutionCode: code, targetAcSolution: row.nd, actSolutionVolume: actVol, - targetAcSolution: actNd, + actSolutionConcentration: actNd, }) } @@ -484,6 +484,7 @@ export default { // 遍历数据,按要求更新起始溶液编号 newData.forEach((item, index) => { const { actVol, actNd } = this.updateSjmbrynd(item, row.nd); + console.log(actNd,"actNd") item.actSolutionVolume = actVol; item.actSolutionConcentration = actNd; }) diff --git a/vue.config.js b/vue.config.js index 56dd747..bf3ddf1 100644 --- a/vue.config.js +++ b/vue.config.js @@ -34,8 +34,8 @@ module.exports = { proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://localhost:8080`, - // target: `http://39.99.251.173:8080`, + // target: `http://localhost:8080`, + target: `http://39.99.251.173:8080`, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: ''