diff --git a/src/components/Template/BaseInfoFormPackage.vue b/src/components/Template/BaseInfoFormPackage.vue index 4c4e536..96487f6 100644 --- a/src/components/Template/BaseInfoFormPackage.vue +++ b/src/components/Template/BaseInfoFormPackage.vue @@ -290,7 +290,24 @@ @update:error="errors[key] = false" :item="getRegentItem(sItem)" :value="formFields[key]" /> {{ $t(sItem.subText) }} - + + + + @@ -394,7 +411,15 @@ export default { return { ...sItem, key: sItem.subKey, - fillType: sItem.subFillType || sItem.fillType + fillType: sItem.fourthFillType || sItem.fillType + } + }, + getFourthButtonItem(sItem) { + return { + ...sItem, + key: sItem.fourthKey, + buttonName:sItem.fourthButtonName, + fillType: sItem.fourthFillType || sItem.fillType } }, // 处理fqyq变化 diff --git a/src/components/Template/CustomTable.vue b/src/components/Template/CustomTable.vue index 76281a3..e9013dd 100644 --- a/src/components/Template/CustomTable.vue +++ b/src/components/Template/CustomTable.vue @@ -12,9 +12,41 @@ @change="handleCheckAllChange"> -
-
+
+
+
+ + + +
+
+
+
{{ $t(col.label) }}
({{ @@ -203,7 +235,7 @@ import HandleFormItem from "./HandleFormItem.vue"; import { isEqual } from "@/utils/index.js"; import { isShowOther } from "@/utils/formPackageCommon.js"; import { EventBus } from "@/utils/eventBus"; -import { getuuid } from "@/utils/index.js"; +import { getuuid, justUpdateFilledFormData } from "@/utils/index.js"; import { isRegent } from "@/utils/index.js"; import { isValueEmpty } from '@/utils/index.js'; @@ -247,7 +279,7 @@ export default { default: () => { return { stepTableFormData: [], - headerSelectFields: {} + headerSelectFields: {}, } } }, @@ -279,6 +311,7 @@ export default { return { localDataSource: [], headerSelectFields: {}, + headerFields: {}, // 存储 headerColumns 的数据 formErrors: [], // 表单错误状态管理 orangeBgCells: {}, // 存储需要橙色背景的单元格 {rowIndex-colIndex: true/false} isShowOther, @@ -294,9 +327,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,11 +352,56 @@ 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) { + console.log(colIndex, headerIndex, key,this.formErrors,"headerError") + 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); this.$emit("onDeleteTag", rowIndex, col, tagIndex); - this.justUpdateFilledFormData(); + justUpdateFilledFormData(); }, onCheckboxTagChange(rowIndex, colIndex, col, value) { // value 现在是整个数组 @@ -349,7 +428,7 @@ export default { error.field === col.prop) ); this.$emit("onCheckboxChange", rowIndex, col, value); - this.justUpdateFilledFormData(); + justUpdateFilledFormData(); }, handleClickButton(e, data, key, rowIndex, colIndex) { this.$emit("clickButton", key, rowIndex, colIndex, e, data,) @@ -408,10 +487,16 @@ export default { } this.$emit("beforeReagentSubmit", { selectData: data, callback, key: col.prop, rowData: row }) }, + 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 }) + }, 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 +532,7 @@ export default { return { stepTableFormData: [...this.localDataSource], headerSelectFields: this.headerSelectFields, + headerFields: this.headerFields, }; }, // 获取最新数据 @@ -461,6 +547,7 @@ export default { resolve({ stepTableFormData: [...this.localDataSource], headerSelectFields: this.headerSelectFields, + headerFields: this.headerFields, }) } else { // this.$message.error("表单内容未填完,请填写后再提交"); @@ -478,6 +565,7 @@ export default { // 校验表头的 HandleFormItem this.columns.forEach((col, colIndex) => { + console.log(col.headerColumns, col, "ttt") if (col.headerSelectKey && col.headerOptions && col.fillType === this.templateFillType) { const headerValue = this.headerSelectFields[col.headerSelectKey]; if (isValueEmpty(headerValue)) { @@ -491,6 +579,26 @@ export default { errors.push(errorItem); this.formErrors.push(errorItem); } + } else if (col.headerColumns && col.headerColumns.length > 0) { + col.headerColumns.forEach((headerCol, headerColIndex) => { + const headerValue = this.headerFields[`${colIndex}_${headerColIndex}`]; + if (headerCol.fillType === this.templateFillType) { + if (isValueEmpty(headerValue) && headerCol.type !== "span") { + const errorItem = { + rowIndex: -1, // 表头特殊标记 + colIndex, + field: headerCol.key, + label: this.$t(headerCol.label), + headerIndex: headerColIndex, + error: `请选择${this.$t(headerCol.label)}` + }; + errors.push(errorItem); + this.formErrors.push(errorItem); + } + } + + }); + } }); @@ -819,6 +927,12 @@ export default { }); }, + deleteSelectedRows(rowsIndex){ + this.deleteRows(rowsIndex); + this.selectedRows = []; + this.isIndeterminate = false; + this.$emit('selectionChange', this.selectedRows); + }, // 更新数据方法,可在formData变更时调用,也可由父组件调用 updateDataSource(dataSource = []) { this.oldLocalDataSource = JSON.parse(JSON.stringify(this.localDataSource)); @@ -836,7 +950,7 @@ export default { this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data }; this.localDataSource = [...this.localDataSource]; this.checkCompareToOnDataLoad(); - this.justUpdateFilledFormData(); + justUpdateFilledFormData(); }, // 比较newData和oldData的值是否相等,只要有一对不相等就返回false compareOldAndCurrentFormFields(newData, oldData) { @@ -852,15 +966,6 @@ export default { return true; }, - // 只是更新已填写的表单数据,不触发校验 - justUpdateFilledFormData() { - const params = { - type: "fieldChanged", - newRecord: null, - resourceList: null, - } - EventBus.$emit('onModifyRecord', params,) - }, // 处理全选 handleCheckAllChange(val) { this.localDataSource.forEach(row => { @@ -898,7 +1003,7 @@ export default { targetDiluentVolumePrecision: 3,//小数点精度默认为3 targetStartSolutionVolumePrecision: 3,//小数点精度默认为3 }); - this.justUpdateFilledFormData() + justUpdateFilledFormData() }, // 添加行 @@ -1054,6 +1159,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; @@ -1211,4 +1327,9 @@ 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/DecimalInput.vue b/src/components/Template/DecimalInput.vue index 90b5275..e5adbd9 100644 --- a/src/components/Template/DecimalInput.vue +++ b/src/components/Template/DecimalInput.vue @@ -35,29 +35,52 @@ export default { }, data() { return { - internalValue: this.value !== null && this.value !== undefined ? String(this.value) : '' + internalValue: this.value !== null && this.value !== undefined ? String(this.value) : '', + oldValue: null, + oldPattern: null, + patternRules: [ + { name: 'NA', pattern: /^NA$/i, inputPattern: /^N?A?$/i }, + { name: 'FRACTION', pattern: /^\d+(\/\d+)*$/, inputPattern: /^(\d+\/?)*$/ } + ] }; }, watch: { - value(newVal) { - // 外部值变化时同步到内部(但不做格式化,避免干扰用户输入) - if (newVal === '' || newVal == null) { - this.internalValue = ''; - } else { - // 如果当前值是 "NA" 或 "20/30/40" 格式,保持不变 - if ((this.internalValue && this.internalValue.toUpperCase() === 'NA') || (this.internalValue && /^\d+(\/\d+)*$/.test(this.internalValue))) { - return; - } - // 检查是否为 "NA" 或其输入过程,或类似 "20/30/40" 的格式 - if (String(newVal).toUpperCase() === 'NA' || /^[Nn]?[Aa]?$/.test(String(newVal)) || /^\d+(\/\d*)*$/.test(String(newVal))) { - this.internalValue = String(newVal); + value: { + handler(newVal) { + if (newVal === '' || newVal == null) { + this.internalValue = ''; + this.oldValue = null; + this.oldPattern = null; } else { - this.internalValue = this.handleDecimalDigits(String(newVal)); + const strVal = String(newVal); + this.internalValue = strVal; + this.updateOldValue(strVal); } - } + }, + immediate: true } }, methods: { + updateOldValue(val) { + for (const rule of this.patternRules) { + if (rule.pattern.test(val)) { + this.oldValue = val; + this.oldPattern = rule; + return true; + } + } + return false; + }, + + getMatchingRule(val) { + for (const rule of this.patternRules) { + if (rule.inputPattern.test(val)) { + return rule; + } + } + return null; + }, + handleInput(val) { if (val === '') { this.internalValue = ''; @@ -65,117 +88,142 @@ export default { return; } - // 检查是否为 "NA" 或其输入过程 - if (val.toUpperCase() === 'NA' || /^[Nn]?[Aa]?$/.test(val)) { - this.internalValue = val; - this.$emit('input', val); - return; - } - - // 检查是否为 "20/30/40" 或其输入过程 - if (/^\d+(\/\d*)*$/.test(val)) { - this.internalValue = val; - this.$emit('input', val); - return; - } + const upperVal = val.toUpperCase(); + let cleaned = val; + let matchedRule = null; + if (this.oldPattern) { + // 检查是否是旧模式的延续(以oldValue开头) + if (val.startsWith(this.oldValue)) { + // 是旧模式的延续,检查是否符合inputPattern + if (this.oldPattern.inputPattern.test(val)) { + matchedRule = this.oldPattern; + cleaned = val; + } else { + // 不符合,但如果是FRACTION类型,尝试特殊处理 + if (this.oldPattern.name === 'FRACTION') { + cleaned = val.replace(/[^\d/]/g, ''); + const parts = cleaned.split('/'); + const validParts = []; + for (let i = 0; i < parts.length; i++) { + if (parts[i] !== '') { + validParts.push(parts[i]); + } + } + cleaned = validParts.join('/'); + matchedRule = this.oldPattern; + } else { + cleaned = this.oldValue || ''; + this.internalValue = cleaned; + return; + } + } + } else if (this.oldPattern.inputPattern.test(val)) { + // 不是延续,但符合inputPattern(可能是清空后重新输入) + matchedRule = this.oldPattern; + cleaned = val; + } else { + // 尝试匹配新规则 + matchedRule = this.getMatchingRule(val); + if (!matchedRule) { + cleaned = this.oldValue || ''; + this.internalValue = cleaned; + return; + } + } + } else { + matchedRule = this.getMatchingRule(val); + + if (matchedRule) { + if (matchedRule.name === 'FRACTION') { + cleaned = val.replace(/[^\d/]/g, ''); + const parts = cleaned.split('/'); + const validParts = []; + for (let i = 0; i < parts.length; i++) { + if (parts[i] !== '') { + validParts.push(parts[i]); + } + } + cleaned = validParts.join('/'); + } else { + cleaned = upperVal; + } + } else { + cleaned = val + .replace(/[^\d.-]/g, '') + .replace(/^(-)\1+/, '$1'); - // 如果当前值是 "NA" 或 "20/30/40" 格式,不允许输入其他字符 - if ((this.internalValue && this.internalValue.toUpperCase() === 'NA') || (this.internalValue && /^\d+(\/\d+)*$/.test(this.internalValue))) { - // 保持当前值不变 - this.$emit('input', this.internalValue); - return; - } + const firstDotIndex = cleaned.indexOf('.'); + if (firstDotIndex !== -1) { + const before = cleaned.slice(0, firstDotIndex); + const after = cleaned.slice(firstDotIndex + 1).replace(/\./g, ''); + cleaned = before + '.' + after; + } - // 1. 只保留数字、小数点、开头的负号 - let cleaned = val - .replace(/[^\d.-]/g, '') - .replace(/^(-)\1+/, '$1'); // 合并多个负号 - - // 2. 只保留第一个小数点 - const firstDotIndex = cleaned.indexOf('.'); - if (firstDotIndex !== -1) { - const before = cleaned.slice(0, firstDotIndex); - const after = cleaned.slice(firstDotIndex + 1).replace(/\./g, ''); - cleaned = before + '.' + after; - } + if (this.decimalDigits > 0 && cleaned.includes('.')) { + const [intPart, decPart = ''] = cleaned.split('.'); + cleaned = intPart + '.' + decPart.slice(0, this.decimalDigits); + } else if (this.decimalDigits === 0) { + cleaned = cleaned.split('.')[0]; + } - // 3. 限制小数位数(仅当允许小数时) - if (this.decimalDigits > 0 && cleaned.includes('.')) { - const [intPart, decPart = ''] = cleaned.split('.'); - cleaned = intPart + '.' + decPart.slice(0, this.decimalDigits); - } else if (this.decimalDigits === 0) { - cleaned = cleaned.split('.')[0]; // 移除小数部分 - } + if (cleaned === '.') cleaned = '0.'; + else if (cleaned === '-.') cleaned = '-0.'; + else if (cleaned.startsWith('.')) cleaned = '0' + cleaned; + else if (cleaned.startsWith('-.')) cleaned = '-0.' + cleaned.slice(2); - // 4. 处理以 . 或 -. 开头 - if (cleaned === '.') cleaned = '0.'; - else if (cleaned === '-.') cleaned = '-0.'; - else if (cleaned.startsWith('.')) cleaned = '0' + cleaned; - else if (cleaned.startsWith('-.')) cleaned = '-0.' + cleaned.slice(2); - - // 5. 【关键】安全去除前导零,但保留单个 0 - if (cleaned.includes('.')) { - // 有小数点:处理整数部分 - const [int, dec] = cleaned.split('.'); - // 整数部分:-0012 → -12,00 → 0,0 → 0,-0 → 0(或保留 -0) - let newInt = int; - if (/^-?0+\d/.test(int)) { - newInt = int.replace(/^-?0+(\d)/, '$1'); - } else if (int === '' || int === '-') { - newInt = int + '0'; - } else if (int === '00' || /^-00+$/.test(int)) { - newInt = int.startsWith('-') ? '-0' : '0'; - } - cleaned = newInt + '.' + dec; - } else { - // 无小数点 - if (/^-?0+\d/.test(cleaned)) { - cleaned = cleaned.replace(/^-?0+(\d)/, '$1'); - } else if (cleaned === '00' || /^-00+$/.test(cleaned)) { - cleaned = cleaned.startsWith('-') ? '-0' : '0'; + if (cleaned.includes('.')) { + const [int, dec] = cleaned.split('.'); + let newInt = int; + if (/^-?0+\d/.test(int)) { + newInt = int.replace(/^-?0+(\d)/, '$1'); + } else if (int === '' || int === '-') { + newInt = int + '0'; + } else if (int === '00' || /^-00+$/.test(int)) { + newInt = int.startsWith('-') ? '-0' : '0'; + } + cleaned = newInt + '.' + dec; + } else { + if (/^-?0+\d/.test(cleaned)) { + cleaned = cleaned.replace(/^-?0+(\d)/, '$1'); + } else if (cleaned === '00' || /^-00+$/.test(cleaned)) { + cleaned = cleaned.startsWith('-') ? '-0' : '0'; + } + } } - // 注意:不要把单独的 '0' 变成 '' } + this.internalValue = cleaned; - // emit if (cleaned === '' || cleaned === '-') { this.$emit('input', cleaned === '-' ? '-' : ''); + } else if (matchedRule && matchedRule.name !== 'FRACTION') { + this.$emit('input', cleaned); + } else if (cleaned.includes('/')) { + this.$emit('input', cleaned); } else { const num = parseFloat(cleaned); this.$emit('input', isNaN(num) ? '' : num); } }, + handleDecimalDigits(val) { const actVal = val || this.internalValue; let finalValue = actVal.trim(); - // 检查是否为 "NA" 或类似 "20/30/40" 的格式 - if (finalValue.toUpperCase() === 'NA' || /^\d+(\/\d+)+$/.test(finalValue)) { - return finalValue; - } - if (finalValue === '' || finalValue === '-') { - this.internalValue = ''; - this.$emit('input', ''); - return; + return ''; } const num = parseFloat(finalValue); if (isNaN(num)) { - this.internalValue = ''; - this.$emit('input', ''); - return; + return ''; } - // 只保留用户输入的有效小数位数,不强制补零 let formatted = String(num); - // 如果用户输入的是整数,直接显示整数 if (!finalValue.includes('.')) { formatted = String(Math.floor(num)); } else { - // 保留用户输入的小数位数,但不超过设定的最大值 const decPart = finalValue.split('.')[1]; const actualDecimalDigits = decPart.length; const displayDecimalDigits = Math.min(actualDecimalDigits, this.decimalDigits); @@ -185,19 +233,80 @@ export default { }, handleBlur() { - // 检查是否为 "NA" 或类似 "20/30/40" 的格式 - if ((this.internalValue && this.internalValue.toUpperCase() === 'NA') || (this.internalValue && /^\d+(\/\d+)*$/.test(this.internalValue))) { - this.$emit('input', this.internalValue); - this.$emit('blur', this.internalValue); + const val = this.internalValue.trim(); + + if (val === '') { + this.oldValue = null; + this.oldPattern = null; + this.$emit('input', ''); + this.$emit('blur', ''); return; } - let formatted = this.handleDecimalDigits(this.internalValue); + const upperVal = val.toUpperCase(); + + for (const rule of this.patternRules) { + if (rule.pattern.test(upperVal)) { + this.oldValue = upperVal; + this.oldPattern = rule; + this.internalValue = upperVal; + this.$emit('input', upperVal); + this.$emit('blur', upperVal); + return; + } + } + + if (val.includes('/')) { + const parts = val.split('/'); + const validParts = parts.filter(part => part !== ''); + + if (validParts.length === 0) { + if (this.oldValue) { + this.internalValue = this.oldValue; + this.$emit('input', this.oldValue); + this.$emit('blur', this.oldValue); + } else { + this.internalValue = ''; + this.$emit('input', ''); + this.$emit('blur', ''); + } + return; + } + + if (validParts.length === 1) { + const result = validParts[0]; + this.oldValue = result; + this.oldPattern = this.patternRules.find(r => r.name === 'FRACTION'); + this.internalValue = result; + this.$emit('input', result); + this.$emit('blur', result); + return; + } + + const formattedValue = validParts.join('/'); + this.oldValue = formattedValue; + this.oldPattern = this.patternRules.find(r => r.name === 'FRACTION'); + this.internalValue = formattedValue; + this.$emit('input', formattedValue); + this.$emit('blur', formattedValue); + return; + } + + if (this.oldValue && this.oldPattern) { + const partialMatch = this.oldPattern.inputPattern && this.oldPattern.inputPattern.test(val); + if (!partialMatch) { + this.internalValue = this.oldValue; + this.$emit('input', this.oldValue); + this.$emit('blur', this.oldValue); + return; + } + } + + let formatted = this.handleDecimalDigits(val); this.internalValue = formatted; - // emit 数字类型(也可 emit 字符串,根据需求) this.$emit('input', parseFloat(formatted)); this.$emit('blur', parseFloat(formatted)); } } }; - \ No newline at end of file + diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 06a47b7..4e4a368 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 => ({ @@ -594,8 +591,8 @@ export default { this.inputValue = data.selectedId; const { filledCodes = [] } = this.item; console.log(filledCodes, "filledCodes") - const { selectInfo, row } = data; - if (filledCodes.length > 0) { + const { selectInfo, row,checkType } = data; + if (filledCodes.length > 0 && checkType !=="checkbox") { this.inputValue = row[filledCodes[0]] + "(" + row[filledCodes[1]] + ")"; } this.selectRegentInfo = data; @@ -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 = { @@ -634,9 +631,11 @@ export default { }; if (type === "mix") { params.mixType = true; - } else if (item.qxbdType) { + } + if (item.qxbdType) { params.qxbdType = item.qxbdType; - } else if (item.checkType) { + } + if (item.checkType) { params.checkType = item.checkType; } } @@ -1302,7 +1301,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 +1380,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" @@ -1805,7 +1804,7 @@ export default { font-weight: normal; color: #606266; flex: 1; - + background-color: #fff; &.disabled { cursor: not-allowed; color: #c0c4cc; diff --git a/src/components/Template/Step.vue b/src/components/Template/Step.vue index 34b75cf..ccbd164 100644 --- a/src/components/Template/Step.vue +++ b/src/components/Template/Step.vue @@ -2,36 +2,36 @@
添加步骤
-
- - -
- {{ index + 1 }} - - - - - - -
- - - + +
+
+ + {{ index + 1 }} + + + + +
+ + + +
-
+
+ \ No newline at end of file diff --git a/src/views/business/comps/template/comps/sp/SP001.vue b/src/views/business/comps/template/comps/sp/SP001.vue index f4e8766..31d669e 100644 --- a/src/views/business/comps/template/comps/sp/SP001.vue +++ b/src/views/business/comps/template/comps/sp/SP001.vue @@ -129,7 +129,7 @@ export default { versionNum: { label: 'template.common.versionNumber', type: "inputNumber", - fillType: "actFill", + fillType: "preFill", prepend: "V", maxlength: 50 }, diff --git a/src/views/business/comps/template/comps/sp/SP003.vue b/src/views/business/comps/template/comps/sp/SP003.vue index f4cbc95..825aacf 100644 --- a/src/views/business/comps/template/comps/sp/SP003.vue +++ b/src/views/business/comps/template/comps/sp/SP003.vue @@ -131,7 +131,7 @@ export default { versionNum: { label: "template.common.versionNumber", type: "inputNumber", - fillType: "actFill", + fillType: "preFill", prepend: "V", maxlength: 50, }, diff --git a/src/views/business/comps/template/comps/sp/SP008.vue b/src/views/business/comps/template/comps/sp/SP008.vue index 4c1c256..4ab8cbf 100644 --- a/src/views/business/comps/template/comps/sp/SP008.vue +++ b/src/views/business/comps/template/comps/sp/SP008.vue @@ -140,7 +140,7 @@ export default { versionNum: { label: 'template.common.versionNumber', type: "inputNumber", - fillType: "actFill", + fillType: "preFill", prepend: "V", maxlength: 50 }, diff --git a/src/views/business/comps/template/comps/sp/SP009.vue b/src/views/business/comps/template/comps/sp/SP009.vue index 9c3b8bb..bcb6f8e 100644 --- a/src/views/business/comps/template/comps/sp/SP009.vue +++ b/src/views/business/comps/template/comps/sp/SP009.vue @@ -144,7 +144,7 @@ export default { versionNum: { label: 'template.common.versionNumber', type: "inputNumber", - fillType: "actFill", + fillType: "preFill", prepend: "V", maxlength: 50 }, diff --git a/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue b/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue index 0e075c4..12aebcd 100644 --- a/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue +++ b/src/views/business/comps/template/dialog/SelectMixReagentDialog.vue @@ -188,16 +188,29 @@ export default { ndz: (row.nd||"")+(row.nddw||""), type: Number(this.selectType), } - if(this.qxbdType && row.templateSn !== this.qxbdType){ - this.$message.error(`请选择正确前序表单`); - return + const {qxbdType,checkType} = this; + if(qxbdType){ + if(checkType === "radio"&& row.templateSn !== qxbdType){ + this.$message.error(`请选择正确前序表单`); + return + } + if(checkType === "checkbox" ){ + const isAllType = row.every((item)=>item.templateSn === qxbdType) + if(!isAllType){ + this.$message.error(`请选择正确前序表单`); + return + } + } + } this.$emit('submit', selectedValue, row); - let callbackData = { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType }; + let callbackData = { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType,checkType }; if(this.checkType === "checkbox"){ callbackData = { uuid: this.uuid, selectedRows: row, + selectedId:row.map((item)=>item.bdbh).join(","), + checkType } } // 触发eventBus事件 diff --git a/src/views/business/comps/template/formConfig/PCRTableConfig.js b/src/views/business/comps/template/formConfig/PCRTableConfig.js index 57c0de1..51e3074 100644 --- a/src/views/business/comps/template/formConfig/PCRTableConfig.js +++ b/src/views/business/comps/template/formConfig/PCRTableConfig.js @@ -453,7 +453,7 @@ export const getBaseInfoFormConfig = ($this) => { versionNum: { label: 'template.common.versionNumber', type: 'inputNumber', - fillType: 'actFill', + fillType: 'preFill', prepend: 'V', maxlength: 50 } @@ -758,6 +758,107 @@ export const getPCR007Config = ($this) => { ] } + +// PCR008 +export const getPCR008Config = ($this) => { + return [ + { + label: 'template.pcr.pcr008.ypmc', + prop: 'ypmc', + width: 280, + bodyType: 'input', + fillType: 'preFill', + otherCode: 'bhOther', + bodyFillType: 'preFill', + }, + { + label: 'template.pcr.pcr008.cjgz', + prop: 'cjgz', + width: 280, + showWidth: 180, + fillType: 'preFill', + headerSelectKey: 'cjgzUnit', + headerOptions: $this.getDictOptions('business_tjdw'), + bodyType: 'inputNumber', + bodyFillType: 'preFill', + bodyMaxlength: 10, + }, + { + label: 'template.pcr.pcr008.lzzcz', + prop: 'lzzcz', + width: 280, + showWidth: 180, + fillType: 'preFill', + headerSelectKey: 'lzzczUnit', + headerOptions: $this.getDictOptions('business_tjdw'), + bodyType: 'inputNumber', + bodyFillType: 'actFill', + bodyMaxlength: 10, + bodySubType: 'inputNumber', + bodyFillType: 'actFill', + bodySubType: 'button', + bodySubButtonName: 'form.hqz', + }, + { + label: 'template.pcr.pcr008.zzzl', + prop: 'zzzl', + width: 280, + showWidth: 180, + fillType: 'preFill', + headerSelectKey: 'zzzlUnit', + headerOptions: $this.getDictOptions('business_tjdw'), + bodyType: 'inputNumber', + bodyFillType: 'actFill', + bodyMaxlength: 10, + bodySubType: 'inputNumber', + bodySubKey: 'targetStartSolutionVolumePrecision', + bodySubFillType: 'preFill', + showBodySub: $this.fillType === 'preFill', + bodyPrecisionKey: 'targetStartSolutionVolumePrecision', + bodyMaxlength: 10, + bodyDisabled: $this.fillType === 'preFill', + bodySubPlaceholder: 'template.common.xswsPlaceholder', + headerSelectTo:"actStartSolutionVolumeUnit", + }, + { + label: 'template.pcr.pcr008.ysyjrybjrl', + prop: 'ysyjrybjrl', + width: 280, + showWidth: 180, + fillType: 'preFill', + headerSelectKey: 'ysyjrybjrlUnit', + headerOptions: $this.getDictOptions('business_tjdw'), + bodyType: 'inputNumber', + bodyFillType: 'actFill', + bodyMaxlength: 10, + bodySubType: 'inputNumber', + bodySubKey: 'targetDiluentVolumePrecision', + bodySubFillType: 'preFill', + showBodySub: $this.fillType === 'preFill', + bodyPrecisionKey: 'targetDiluentVolumePrecision', + bodyMaxlength: 10, + bodyDisabled: $this.fillType === 'preFill', + bodySubPlaceholder: 'template.common.xswsPlaceholder', + headerSelectTo:"actStartSolutionVolumeUnit", + }, + { + label: 'template.pcr.pcr008.sjyjrybjrl', + prop: 'sjyjrybjrl', + width: 280, + showWidth: 180, + fillType: 'preFill', + headerSelectKey: 'sjyjrybjrlUnit', + headerOptions: $this.getDictOptions('business_tjdw'), + bodyType: 'inputNumber', + bodyFillType: 'actFill', + copyFrom: 'ysyjrybjrl', //复制哪个字段 + bodyMaxlength: 10, + } + ] +} + + + // PCR009 export const getPCR009Config = ($this) => { return [ diff --git a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js index ea61661..bfb54d9 100644 --- a/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js +++ b/src/views/business/comps/template/formConfig/paralleAndLadderConfig.js @@ -498,7 +498,7 @@ export const getBaseInfoFormConfig = ($this) => { versionNum: { label: 'template.common.versionNumber', type: 'inputNumber', - fillType: 'actFill', + fillType: 'preFill', prepend: 'V', maxlength: 50 } diff --git a/src/views/business/comps/template/formConfig/sp/SP0019.js b/src/views/business/comps/template/formConfig/sp/SP0019.js index f1b40ab..1325f6c 100644 --- a/src/views/business/comps/template/formConfig/sp/SP0019.js +++ b/src/views/business/comps/template/formConfig/sp/SP0019.js @@ -22,7 +22,7 @@ export const getBaseInfoFormConfig = (formType) => { versionNum: { label: 'template.common.versionNumber', type: 'inputNumber', - fillType: 'actFill', + fillType: 'preFill', prepend: 'V', maxlength: 50 }, diff --git a/src/views/business/comps/template/formConfig/sp/SP007.js b/src/views/business/comps/template/formConfig/sp/SP007.js index 15648b6..520bac4 100644 --- a/src/views/business/comps/template/formConfig/sp/SP007.js +++ b/src/views/business/comps/template/formConfig/sp/SP007.js @@ -22,7 +22,7 @@ export const getBaseInfoFormConfig = ($this) => { versionNum: { label: 'template.common.versionNumber', type: 'inputNumber', - fillType: 'actFill', + fillType: 'preFill', prepend: 'V', maxlength: 50 }, diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index 1b51fd8..36602b9 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -42,6 +42,8 @@ export default { 'business_dl_amescltj', // 毒理-Ames处理条件 'business_dl_amesbjjt', // 毒理-Ames背景菌苔 'business_dl_amescdqk', // 毒理-Ames沉淀情况 + 'business_dl_xbmc', // 毒理-Ames细胞名称 + 'business_dl_qsxjbltj', // 毒理-暴露条件 'business_rylx', // 溶液类型 'business_xbzb', // 细胞组别 'business_xblx', // 细胞类型 @@ -176,10 +178,13 @@ export default { yqResource: [], //仪器信息 jcbList: [], //检测板信息 + xbxj: [], //细胞细菌信息 + resourceTmp: [],//试验试剂信息提交用 yqResourceTmp: [], //仪器信息提交用 jcbListTmp: [], //检测板信息提交用 + xbxjTmp:[],//细胞细菌信息提交用 sjColumns: [ { label: 'template.common.reagentName', prop: "mc" },//名称 { label: 'template.common.reagentCode', prop: "bh" },//编号 @@ -336,6 +341,9 @@ export default { getJcbList() { return this.jcbListTmp }, + getXbxj() { + return this.xbxjTmp + }, //根据ref数组获取直接formData getFilledFormDataByRefs(refArr = []) { let result = {} @@ -529,11 +537,17 @@ export default { targetStartSolutionUnit:subTargetAcSolutionUnit, headerSelectFields } - if (isValueEmpty(targetAcSolution)) { + let initNd = 0; + if(rowIndex === 0){ + initNd = targetAcSolution; + }else{ + initNd = dataSource[rowIndex - 1].actSolutionConcentration; + } + if (isValueEmpty(initNd)) { this.$message.error('请先选择起始源溶液') return } else { - const volResult = this.updateSjmbrynd(item, targetAcSolution,p) + const volResult = this.updateSjmbrynd(item, initNd,p) if (!volResult) { return } diff --git a/src/views/business/study/comp/edit.vue b/src/views/business/study/comp/edit.vue index 39969d8..6af6032 100644 --- a/src/views/business/study/comp/edit.vue +++ b/src/views/business/study/comp/edit.vue @@ -26,7 +26,7 @@ - + @@ -42,6 +42,7 @@