diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index c5567c8..6306137 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -12,9 +12,37 @@ @change="handleCheckAllChange"> -
-
+
+
+
+ + + +
+
+
+
{{ $t(col.label) }}
({{ @@ -247,7 +275,7 @@ export default { default: () => { return { stepTableFormData: [], - headerSelectFields: {} + headerSelectFields: {}, } } }, @@ -279,6 +307,7 @@ export default { return { localDataSource: [], headerSelectFields: {}, + headerFields: {}, // 存储 headerColumns 的数据 formErrors: [], // 表单错误状态管理 orangeBgCells: {}, // 存储需要橙色背景的单元格 {rowIndex-colIndex: true/false} isShowOther, @@ -294,9 +323,10 @@ export default { formData: { immediate: true, handler(newData) { - const { stepTableFormData = [], headerSelectFields = {} } = newData; + const { stepTableFormData = [], headerSelectFields = {}, headerFields = {} } = newData; this.updateDataSource(stepTableFormData); this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields)); + this.headerFields = JSON.parse(JSON.stringify(headerFields)); // 在数据加载后检查 compareTo 逻辑 this.checkCompareToOnDataLoad(); } @@ -318,6 +348,50 @@ export default { this.oldLocalDataSource = []; }, methods: { + getHeaderColumnItem(headerCol) { + return { + label: headerCol.label || '', + fillType: headerCol.fillType, + options: headerCol.options, + maxlength: headerCol.maxlength, + checkType: headerCol.checkType, + regentFillType: headerCol.regentFillType, + type:headerCol.type, + }; + }, + + onHeaderColumnChange(colIndex, headerIndex, headerCol, value) { + const fieldKey = `${colIndex}_${headerIndex}`; + this.headerFields[fieldKey] = value; + this.$emit('headerColumnChange', { + colIndex, + headerIndex, + key: fieldKey, + value, + headerFields: this.headerFields + }); + }, + + hasHeaderError(colIndex, headerIndex, key) { + return this.formErrors.some(error => + error.rowIndex === -1 && + error.colIndex === colIndex && + error.headerIndex === headerIndex && + error.field === key + ); + }, + + onHeaderColumnErrorUpdate(colIndex, headerIndex, key, isError) { + if (!isError) { + this.formErrors = this.formErrors.filter(error => + !(error.rowIndex === -1 && + error.colIndex === colIndex && + error.headerIndex === headerIndex && + error.field === key) + ); + } + }, + // 删除checkboxTag onDeleteCheckboxTag(rowIndex, col, tagIndex) { this.localDataSource[rowIndex][col.prop].splice(tagIndex, 1); @@ -408,10 +482,14 @@ export default { } this.$emit("beforeReagentSubmit", { selectData: data, callback, key: col.prop, rowData: row }) }, + onHeaderRegentSubmit(data, inputValue, colIndex, headerIndex) { + this.headerFields[`${colIndex}_${headerIndex}`] = inputValue; + this.$emit("onHeaderRegentSubmit", { selectInfo: data, key: col.prop, col, rowIndex, colIndex, rowData: row }) + }, onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row) { - if (this.templateFillType !== 'actFill') { - return - } + // if (this.templateFillType !== 'actFill') { + // return + // } this.updateDataSourceByRowIndex(rowIndex, { [col.prop]: inputValue }) this.$emit("onRegentSubmit", { selectInfo: data, key: col.prop, col, rowIndex, colIndex, rowData: row }) }, @@ -447,6 +525,7 @@ export default { return { stepTableFormData: [...this.localDataSource], headerSelectFields: this.headerSelectFields, + headerFields: this.headerFields, }; }, // 获取最新数据 @@ -461,6 +540,7 @@ export default { resolve({ stepTableFormData: [...this.localDataSource], headerSelectFields: this.headerSelectFields, + headerFields: this.headerFields, }) } else { // this.$message.error("表单内容未填完,请填写后再提交"); @@ -1045,6 +1125,17 @@ export default { justify-content: center; } +.header-columns-grid { + display: grid; + gap: 10px; +} + +.header-column-item { + display: flex; + align-items: center; + padding: 0 5px; +} + /* 共同行样式 */ .custom-table-row { display: table; @@ -1202,4 +1293,8 @@ export default { .c-cell { width: 50px; } +.span-content { + width: -webkit-fill-available; + text-align: center; +} \ No newline at end of file diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 06a47b7..f42f2ed 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -90,7 +90,7 @@
+ v-else-if="isRegent(item)" @click="onCommonHandleRegent(item, item.type)"> {{ inputValue }} {{ getPlaceholder() }}
@@ -216,7 +216,7 @@ import Question from "./icons/Question.vue"; import DecimalInput from "./DecimalInput.vue"; import { EventBus } from "@/utils/eventBus"; import moment from "moment"; -import { getuuid, isEqual, deepClone, getDefaultValueByOptions, isValueEmpty } from "@/utils/index.js"; +import { getuuid, isEqual, deepClone, getDefaultValueByOptions, isValueEmpty,isRegent } from "@/utils/index.js"; import { getToken } from "@/utils/auth"; import { isShowOtherByCheckboxTree } from "@/utils/formPackageCommon"; @@ -277,7 +277,6 @@ export default { }, data() { let initialValue = this.value; - console.log(this.value, "check value"); let initialOtherValues = {}, checkboxTagList = []; if (this.type === 'checkboxTag' && Array.isArray(this.value)) { @@ -309,7 +308,7 @@ export default { fqyqValue: initialValue, // fqyq类型的值 oldFqyqValue: { ...initialValue }, // 记录上一次的fqyq值 uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 - regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], //试剂/仪器/供试品等类型 + isRegent, //试剂/仪器/供试品等类型 selectRegentInfo: {},//选择的试剂/仪器/供试品等信息 fileList: [],//上传的文件列表 uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", @@ -340,8 +339,6 @@ export default { watch: { value(newVal) { - console.log(newVal, "newVal") - if (this.type === 'checkboxTag' && Array.isArray(newVal)) { // checkboxTag类型,value是数组格式 this.checkboxTagList = newVal.map(tag => ({ @@ -604,8 +601,8 @@ export default { }, //统一处理试剂/供试品等弹窗 onCommonHandleRegent(item, type) { - const {regentFillType = "actFill"} = item; - if (this.templateFillType !== regentFillType) { + const {fillType = "actFill"} = item; + if (this.templateFillType !== fillType) { return } let params = { @@ -1302,7 +1299,7 @@ export default { this.$nextTick(() => { EventBus.$emit('onModifyRecord', params,) console.log(params, "onModifyRecord") - if (this.regentType.includes(this.item.type)) { + if (isRegent(this.item)) { this.$emit("onRegentSubmit", this.selectRegentInfo, this.inputValue); } }) @@ -1381,7 +1378,7 @@ export default { if (this.getDisabled()) { return "" } - if (this.regentType.includes(type) || type === "clickable" || type === "fqyq") { + if (isRegent(this.item) || type === "clickable" || type === "fqyq") { return this.$t("template.common.pleaseSelect") } let prex = "template.common.pleaseFillIn" diff --git a/src/views/business/comps/template/comps/dl/DL006.vue b/src/views/business/comps/template/comps/dl/DL006.vue index 3742322..cb406fe 100644 --- a/src/views/business/comps/template/comps/dl/DL006.vue +++ b/src/views/business/comps/template/comps/dl/DL006.vue @@ -49,6 +49,20 @@
+ + + +