From 45bca77e7f8a17d55bcf89695739cc43e3c0a304 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Mon, 23 Mar 2026 22:07:27 +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 --- src/components/Template/BaseInfoFormPackage.vue | 5 + src/components/Template/CustomTable.vue | 23 ++- src/components/Template/HandleFormItem.vue | 1 + src/components/Template/mixins/operationMixins.js | 16 ++- .../business/comps/template/comps/dl/DL022.vue | 157 +++++++++++---------- .../business/comps/template/comps/sp/SP003.vue | 2 +- .../business/comps/template/comps/yp/YP005.vue | 5 +- .../comps/template/mixins/templateMixin.js | 2 + 8 files changed, 121 insertions(+), 90 deletions(-) diff --git a/src/components/Template/BaseInfoFormPackage.vue b/src/components/Template/BaseInfoFormPackage.vue index 4b3dc69..7350c5b 100644 --- a/src/components/Template/BaseInfoFormPackage.vue +++ b/src/components/Template/BaseInfoFormPackage.vue @@ -107,9 +107,11 @@ {{ $t(sItem.subText) }} @@ -255,6 +257,7 @@
@@ -276,6 +279,7 @@
@@ -324,6 +328,7 @@ :orange-bg="orangeBgFields[sItem.thirdKey]" />
diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index c7f930e..40c4ebf 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -98,6 +98,7 @@ @blur="onBlur(rowIndex, col.prop, $event)" @copy="onCopy(rowIndex, col)" class="body-input" :item="getBodyItem(col, rowIndex)" v-model="row[col.prop]" + :ref = "col.prop+rowIndex" @change="onBodyValueChange(rowIndex, colIndex, $event, row, col.bodyType)" :error="hasError(rowIndex, colIndex, col.prop)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" @@ -208,6 +209,7 @@ :fieldItemLabel="fieldItemLabel" :type="col.bodySubType" @blur="onSubBlur(rowIndex, col.bodySubKey, $event)" @copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)" + v-model="row[col.bodySubKey]" @change="onBodySubValueChange(rowIndex, colIndex, $event, row, col.bodySubType)" :error="hasError(rowIndex, colIndex, col.bodySubKey)" @@ -222,7 +224,7 @@
+ @clickButton="(e,val, data) => handleClickButton(e, data, col.bodyThirdKey, rowIndex, colIndex)" />
@@ -523,7 +525,6 @@ export default { }, // 点击事件 handleClickable(col, rowIndex, colIndex, row) { - console.log("clickable", rowIndex, colIndex, col, row) if (this.templateFillType !== 'actFill') { return } @@ -537,7 +538,6 @@ export default { }, onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex) { this.headerFields[`${colIndex}_${headerIndex}`] = inputValue; - console.log("onHeaderRegentSubmit", data, inputValue, colIndex, headerIndex, this.headerFields) this.$emit("onHeaderRegentSubmit", { selectInfo: data, headerIndex, colIndex, headerFields: this.headerFields }) }, @@ -938,7 +938,7 @@ export default { item.checkboxLabel = this.$t(col.checkboxLabel); } if (col.bodyType === "operableInput" ) { - if(currentItem.isComplete){ + if(currentItem.isComplete || this.templateFillType !== 'actFill'){ item.disabled = true; }else{ item.disabled = false; @@ -1017,10 +1017,21 @@ export default { this.checkCompareToOnDataLoad(); }, // 根据行索引更新数据 autoUpdateRecord 是否自动更新记录 - updateDataSourceByRowIndex(rowIndex, data) { + updateDataSourceByRowIndex(rowIndex, data,updateFieldsInfo={}) { + const {signData,updateFields = []} = updateFieldsInfo; this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource = [...this.localDataSource]; + console.log(signData,"signData") + if(signData && signData.remark){ + updateFields.map((key)=>{ + const ref = this.$refs[key+rowIndex]; + if(ref){ + ref[0].handleUpdateRecord(signData, { oldValue: this.oldLocalDataSource[rowIndex][key], inputValue: data[key] }); + } + }) + } + this.checkCompareToOnDataLoad(); // justUpdateFilledFormData(); }, diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 8c19bed..096ac34 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -6,6 +6,7 @@ { + filledRowData[item.prop] = row[item.prop]; + if (item.bodySubKey && (item.bodySubType !== "button")) { + filledRowData[item.bodySubKey] = row[item.bodySubKey]; + } + if (item.otherCode) { + filledRowData[item.otherCode] = row[item.otherCode]; + } + }) + const isFilled = Object.values(filledRowData).every((item) => !!item); this.deleteIndex = index; - if (this.templateFillType === "actFill") { + if (this.templateFillType === "actFill" && isFilled) { EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); } else { this.sureDelete(); diff --git a/src/views/business/comps/template/comps/dl/DL022.vue b/src/views/business/comps/template/comps/dl/DL022.vue index 41ef4f0..13e9306 100644 --- a/src/views/business/comps/template/comps/dl/DL022.vue +++ b/src/views/business/comps/template/comps/dl/DL022.vue @@ -14,19 +14,20 @@
+ :formConfig="stepFormConfig" @blur="onHandleBlur" :formData="formData" + @onRegentSubmit="onRegentSubmit" />
畸变类型以代号填写:断片(b)、裂隙(g)、互换及射体(t)、环状染色体(r)、多倍体(p)、双着丝点染色体(d)、内复制(e)、染色体碎化(z)、缺失(l)、粘着(s)、微小体(m)。
+ @onAddRow="onAddRow" @blur="handleClickButton" :showAddRow="fillType === 'actFill'" + :showOperation="fillType === 'actFill'"> @@ -66,13 +67,13 @@ export default { }, }, computed: { - // 表格数据 - tableFormData() { - return { - stepTableFormData: this.formData.stepTableFormData || [], - headerSelectFields: {} - } - }, + // 表格数据 + tableFormData() { + return { + stepTableFormData: this.formData.stepTableFormData || [], + headerSelectFields: {} + } + }, // 备注表单配置 remarkConig() { return [ @@ -175,7 +176,7 @@ export default { bodyFillType: 'actFill', width: 200, disabled: true, - bodyDisabled: true, + bodyDisabled: true, }, { label: 'template.dl.dl022.lxjbs', prop: 'lxjbs', @@ -183,7 +184,7 @@ export default { bodyFillType: 'actFill', width: 200, disabled: true, - bodyDisabled: true, + bodyDisabled: true, }, { label: 'template.dl.dl022.dbtjbs', prop: 'dbtjbs', @@ -191,7 +192,7 @@ export default { bodyFillType: 'actFill', width: 200, disabled: true, - bodyDisabled: true, + bodyDisabled: true, }, { label: 'template.dl.dl022.nfzjbs', prop: 'nfzjbs', @@ -199,7 +200,7 @@ export default { bodyFillType: 'actFill', width: 200, disabled: true, - bodyDisabled: true, + bodyDisabled: true, }, { label: 'template.dl.dl022.jblx', prop: 'jblx', @@ -213,96 +214,96 @@ export default { data() { return { formData: {}, - uuid:getuuid(),//事件id - currentItem: {}, - currentRowIndex: -1, + uuid: getuuid(),//事件id + currentItem: {}, + currentRowIndex: -1, }; }, - watch: { + watch: { formData: { immediate: true, handler(v) { - console.log('formData==============',v); + console.log('formData==============', v); } }, }, - mounted() { - EventBus.$on('onEditSignCallback', this.handleEditSignCallback); - }, - unmounted() { + mounted() { + EventBus.$on('onEditSignCallback', this.handleEditSignCallback); + }, + unmounted() { EventBus.$off('onEditSignCallback', this.handleEditSignCallback); }, methods: { - //畸变类型 - handleClickButton(e, rowIndex) { - console.log('formData==============',e,rowIndex,this.formData); - if(this.formData.stepTableFormData&&this.formData.stepTableFormData.length>0){ - const list = this.formData.stepTableFormData; - list.map((item, index) => { - let jblxList = item.jblx; - if(jblxList&&jblxList.length>0){ - item.jgjxjbs = this.calculateJgjxjbs(jblxList); - } - }) + //畸变类型 + handleClickButton(e, rowIndex) { + console.log('formData==============', e, rowIndex, this.formData); + if (this.formData.stepTableFormData && this.formData.stepTableFormData.length > 0) { + const list = this.formData.stepTableFormData; + list.map((item, index) => { + let jblxList = item.jblx; + if (jblxList && jblxList.length > 0) { + item.jgjxjbs = this.calculateJgjxjbs(jblxList); + } + }) - // 使用 $set 更新 formData,触发 CustomTable 的响应式更新 - this.$set(this.formData, this.formData) - } + // 使用 $set 更新 formData,触发 CustomTable 的响应式更新 + this.$set(this.formData, this.formData) + } }, - // 计算结构畸形畸变数 - calculateJgjxjbs(jblxList,countCodes) { - if (!jblxList || jblxList.length === 0) return 0 - // 需要计数的代号 - // const countCodes = ['b', 't', 'r', 'd', 'z', 'l', 's', 'm'] + // 计算结构畸形畸变数 + calculateJgjxjbs(jblxList, countCodes) { + if (!jblxList || jblxList.length === 0) return 0 + // 需要计数的代号 + // const countCodes = ['b', 't', 'r', 'd', 'z', 'l', 's', 'm'] - let count = 0 + let count = 0 - for (const it of jblxList) { - if (it.value) { - const val = String(it.value).toLowerCase() - // 同一输入框中,每个符合规则的代号都计1 - for (const code of countCodes) { - if (val.includes(code)) { - count++ - } - } - } - } - return count - }, - handleEditSignCallback(data){ + for (const it of jblxList) { + if (it.value) { + const val = String(it.value).toLowerCase() + // 同一输入框中,每个符合规则的代号都计1 + for (const code of countCodes) { + if (val.includes(code)) { + count++ + } + } + } + } + return count + }, + handleEditSignCallback(data) { if (data.uuid === this.uuid) { this.handleEdit(); } }, - handleEdit(){ - const {currentItem, currentRowIndex} = this; + handleEdit() { + const { currentItem, currentRowIndex } = this; currentItem.isComplete = !currentItem.isComplete; this.$refs.tableRef.updateDataSourceByRowIndex(currentRowIndex, currentItem) }, // 编辑/完成 onEditClick(item, rowIndex) { - const { jblx=[] } = item; + const { jblx = [] } = item; const flag = jblx.every(it => !!it.value) - if(!item.isComplete && !flag){ + if (!item.isComplete && !flag) { this.$message.error('畸变类型还未填写完,请填写完成后再操作') return } - item.jgjxjbs = this.calculateJgjxjbs(jblx,['b', 't', 'r', 'd', 'z', 'l', 's', 'm']) - item.lxjbs = this.calculateJgjxjbs(jblx,['g']) - item.dbtjbs = this.calculateJgjxjbs(jblx,['p']) - item.nfzjbs = this.calculateJgjxjbs(jblx,['e']) + item.jgjxjbs = this.calculateJgjxjbs(jblx, ['b', 't', 'r', 'd', 'z', 'l', 's', 'm']) + item.lxjbs = this.calculateJgjxjbs(jblx, ['g']) + item.dbtjbs = this.calculateJgjxjbs(jblx, ['p']) + item.nfzjbs = this.calculateJgjxjbs(jblx, ['e']) EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); this.currentItem = item; this.currentRowIndex = rowIndex; - this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex, item) + this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex, item) }, // 新增行 onAddRow() { this.$refs.tableRef.addRow({ - jblx: [{value: undefined}], + jblx: [{ value: undefined }], }) }, onFormSelect(fields) { @@ -386,14 +387,14 @@ export default { } diff --git a/src/views/business/comps/template/comps/sp/SP003.vue b/src/views/business/comps/template/comps/sp/SP003.vue index 0740fdf..c448464 100644 --- a/src/views/business/comps/template/comps/sp/SP003.vue +++ b/src/views/business/comps/template/comps/sp/SP003.vue @@ -277,7 +277,7 @@ export default { bodySubType: "span", bodySubKey: "subTargetSolutionCode", bodyFillType: "preFill", - width: 140, + width: 280, myCodeFields: ["targetSolutionCode", "subTargetSolutionCode"],//分装的母液编号字段 maxVolumeField: "actSolutionVolume",//分装的最大量字段 maxVolumeFieldUnit: "actSolutionVolumeUnit",//分装的最大量单位字段 diff --git a/src/views/business/comps/template/comps/yp/YP005.vue b/src/views/business/comps/template/comps/yp/YP005.vue index 996d8c6..486d7a9 100644 --- a/src/views/business/comps/template/comps/yp/YP005.vue +++ b/src/views/business/comps/template/comps/yp/YP005.vue @@ -206,7 +206,7 @@ export default { timeArr[0] = startTime this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex,{ qxsj: timeArr.join('~'), - }) + },{signData:data,updateFields:['qxsj']}) // this.$nextTick(() => { // //通知后端保存数据 @@ -219,12 +219,11 @@ export default { // }) } if(key === "endBtn"){ - debugger let endTime = moment().format("YYYY/MM/DD HH:mm") timeArr[1] = endTime this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex,{ qxsj: timeArr.join('~'), - }) + },{signData:data,updateFields:['qxsj']}) // this.$nextTick(() => { // //通知后端保存数据 diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index f9c0162..f1eb8a3 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -581,7 +581,9 @@ export default { } else { initNd = dataSource[rowIndex - 1].actSolutionConcentration; } + if (isValueEmpty(initNd)) { + console.log("initNd",initNd) this.$message.error('请先选择起始源溶液') return } else {