From 43715f9f89c50245c66e2305dd1f1e2445d2ef76 Mon Sep 17 00:00:00 2001 From: luojie <125330818@qq.com> Date: Mon, 23 Feb 2026 22:23:57 +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 | 20 +++ src/components/Template/HandleFormItem.vue | 154 ++++++++++++++------- .../business/comps/template/comps/sp/SP0019.vue | 9 +- .../comps/template/formConfig/sp/SP0019.js | 27 +++- 4 files changed, 159 insertions(+), 51 deletions(-) diff --git a/src/components/Template/BaseInfoFormPackage.vue b/src/components/Template/BaseInfoFormPackage.vue index 3d2fb4b..b9c1b81 100644 --- a/src/components/Template/BaseInfoFormPackage.vue +++ b/src/components/Template/BaseInfoFormPackage.vue @@ -232,6 +232,23 @@ + @@ -443,4 +460,7 @@ export default { font-size: 14px; margin-left: 5px; } +.mr-20{ + margin-right: 20px; +} \ No newline at end of file diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index c107545..7eb48a4 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -24,6 +24,16 @@ :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue" :disabled="getDisabled()" :placeholder="getPlaceholder()" @change="onItemCheckboxChange"> +
+ +
+ + {{ option.label }} + +
+
+
@@ -194,8 +201,8 @@ export default { }, data() { return { - inputValue: this.value, - oldValue: this.value, // 记录上一次的值 + inputValue: this.type === 'checkboxList' && !Array.isArray(this.value) ? [] : this.value, + oldValue: this.type === 'checkboxList' && !Array.isArray(this.value) ? [] : this.value, // 记录上一次的值 showModal: false, // 控制模态框显示 modificationRecords: [], // 存储修改记录 modalTimer: null, // 用于延迟隐藏模态框 @@ -206,11 +213,11 @@ export default { visible: false,//是否显示弹窗 checkboxValue: this.getChecked(),//是否选中 uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 - regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq','jcb'], //试剂/仪器/供试品等类型 + regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb'], //试剂/仪器/供试品等类型 selectRegentInfo: {},//选择的试剂/仪器/供试品等信息 fileList: [],//上传的文件列表 uploadFileUrl: process.env.VUE_APP_BASE_API + "/file/upload", - headers: { + headers: { Authorization: "Bearer " + getToken(), }, pendingUploadFile: null, // 用于存储待上传的文件 @@ -219,7 +226,7 @@ export default { }, watch: { value(newVal) { - this.inputValue = newVal; + this.inputValue = this.type === 'checkboxList' && !Array.isArray(newVal) ? [] : newVal; } }, filters: { @@ -227,10 +234,10 @@ export default { }, mounted() { - if(this.item.type === 'attachment'){ - try{ + if (this.item.type === 'attachment') { + try { this.fileList = JSON.parse(this.value); - }catch(e){ + } catch (e) { this.fileList = []; } } @@ -253,21 +260,21 @@ export default { EventBus.$off("onMixReagentSubmit", this.onMixReagentSubmit) }, methods: { - onInstrumentSubmit(data){ - if(data.uuid !== this.uuid) return; + onInstrumentSubmit(data) { + if (data.uuid !== this.uuid) return; this.selectRegentInfo = data; - console.log(data,"yq") + console.log(data, "yq") }, - + // 文件状态改变时的钩子,添加文件、上传成功、上传失败时都会被调用 handleChange(file, fileList) { // 如果是新添加的文件(status为ready),进行验证 if (file.status === 'ready') { - const isAllowedType = ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', - 'application/x-rar-compressed', 'application/zip', + const isAllowedType = ['image/jpeg', 'image/png', 'image/gif', 'application/pdf', + 'application/x-rar-compressed', 'application/zip', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'].includes(file.raw.type) const isLt2M = file.size / 1024 / 1024 < 2 - + if (!isAllowedType) { this.$message.error(`文件 ${file.name} 格式不支持!只能上传 JPG/PNG/GIF/PDF/RAR/ZIP/DOC/DOCX 格式的文件`) // 从fileList中移除该文件 @@ -288,25 +295,25 @@ export default { this.fileList = [...fileList]; return } - + // 如果已经有文件在列表中(不包括当前新添加的),需要验证电子签名 const existingFiles = fileList.filter(f => f !== file && f.status === 'success'); if (existingFiles.length > 0) { // 保存待上传的文件信息 this.pendingUploadFile = file; - + // 从fileList中暂时移除新文件,等待签名验证 const index = fileList.indexOf(file); if (index > -1) { fileList.splice(index, 1); } this.fileList = [...fileList]; - + // 触发电子签名弹窗 EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); return; } - + // 没有现有文件或验证通过,手动提交上传 this.$nextTick(() => { // 找到对应的upload组件并提交 @@ -316,16 +323,16 @@ export default { } }); } - + // 更新fileList this.fileList = fileList; }, handleSuccess(res, file, fileList) { - if(res.code == 200){ + if (res.code == 200) { this.fileList = fileList; // 更新inputValue为文件路径列表,方便后续保存 this.inputValue = JSON.stringify(this.getFileList(fileList)); - this.$emit("change",this.inputValue) + this.$emit("change", this.inputValue) this.onCommonHandleSaveRecord(); this.$message.success('文件上传成功'); } else { @@ -341,10 +348,10 @@ export default { getFileList(fileList) { const list = []; fileList.forEach(item => { - const o = {name:item.name}; - if(item.url){//回填的数据 + const o = { name: item.name }; + if (item.url) {//回填的数据 o.url = item.url - }else{//新上传的 + } else {//新上传的 o.url = item.response.data.url } list.push(o) @@ -410,7 +417,7 @@ export default { //试剂弹窗提交 onMixReagentSubmit(data) { if (data.uuid !== this.uuid) return; - + // 创建一个验证控制器,用于收集各级验证结果 const validationController = { isPrevented: false, @@ -420,11 +427,11 @@ export default { if (msg) this.errorMsg = msg; } }; - + // 触发自定义验证事件,让父组件判断是否满足需求 // 父组件可以通过validationController.prevent(msg)来阻止提交 this.$emit('beforeReagentSubmit', data, validationController); - + // 检查是否被阻止 if (validationController.isPrevented) { // 验证不通过,显示错误信息 @@ -433,11 +440,11 @@ export default { } return; } - + // 验证通过,继续执行 this.executeReagentSubmit(data); }, - + // 执行试剂提交的共同逻辑 executeReagentSubmit(data) { this.inputValue = data.selectedId; @@ -458,7 +465,7 @@ export default { let eventName = "showSelectMixReagentDialog"; if (type === "yq") { eventName = "showSelectInstrumentDialog"; - }else { + } else { const sjType = { sj: "1",//试剂 gsp: "7",//供试品 @@ -473,7 +480,7 @@ export default { ...params, type: sjType[type] }; - if(type === "mix"){ + if (type === "mix") { params.mixType = true; } } @@ -721,14 +728,14 @@ export default { } }, async onCommonHandleSaveRecord(val) { - + const isEmpty = this.isValueEmpty(this.inputValue); if (this.error && !isEmpty) { this.$emit('update:error', false); } else if (!this.error && isEmpty) { this.$emit('update:error', true); } - + // 创建验证控制器,让父组件可以在保存前进行验证 const validationController = { isPrevented: false, @@ -738,14 +745,14 @@ export default { if (msg) this.errorMsg = msg; } }; - + // 触发beforeSaveRecord事件,让父组件进行验证 this.$emit('beforeSaveRecord', { value: this.inputValue, oldValue: this.oldValue, fieldKey: this.fieldKey }, validationController); - + // 检查是否被阻止 if (validationController.isPrevented) { // 验证不通过,显示错误信息 @@ -757,7 +764,7 @@ export default { this.$emit('input', this.inputValue); return; } - + if (!this.isFieldsRecord) {//是否需要记录修改记录 this.$emit("blur", this.inputValue); this.$emit('input', this.inputValue); @@ -821,7 +828,7 @@ export default { if (this.templateFillType === "actFill") {//只有实际填报的时候才记录修改记录 this.updateZdxgjl(record); } - this.$nextTick(()=>{ + this.$nextTick(() => { EventBus.$emit('onModifyRecord', params,) if (this.regentType.includes(this.item.type)) { this.$emit("onRegentSubmit", this.selectRegentInfo); @@ -1213,6 +1220,7 @@ export default { } } + .error-border { .el-input-group__prepend, @@ -1356,9 +1364,61 @@ export default { display: flex; justify-content: flex-end; } + .atta-tips { color: #ff5d5d; font-size: 12px; margin-left: 5px; } + +.checkbox-list-container { + padding: 12px; + border: 1px solid #dcdfe6; + border-radius: 4px; + transition: all 0.3s; + + &.error-border { + border-color: #ff5d5d !important; + box-shadow: 0 0 6px #ffc3c3 !important; + } + + .checkbox-item { + margin-right: 16px; + &:not(:last-child) { + margin-bottom: 10px; + } + // display: inline-block; + } + + .el-checkbox { + &.is-checked { + .el-checkbox__label { + color: #606266; + } + + .el-checkbox__inner { + background-color: #f9c588; + border-color: #f9c588; + } + } + } +} + +.orange-border { + .checkbox-list-container { + border-color: #f9c588; + + &:hover { + border-color: #f79b31; + } + + } +} + +.orange-bg { + .checkbox-list-container { + background-color: #FFF1F1 !important; + border-color: #f9c588; + } +} \ No newline at end of file diff --git a/src/views/business/comps/template/comps/sp/SP0019.vue b/src/views/business/comps/template/comps/sp/SP0019.vue index 5e59814..8997336 100644 --- a/src/views/business/comps/template/comps/sp/SP0019.vue +++ b/src/views/business/comps/template/comps/sp/SP0019.vue @@ -34,6 +34,8 @@ + @@ -52,7 +54,7 @@ import templateMixin from "../../mixins/templateMixin"; import CustomTable from '@/components/Template/CustomTable.vue'; import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue" -import { getBaseInfoFormConfig, storageFormConfig, getYqColumns,getRyColumns } from "../../formConfig/sp/SP0019" +import { getBaseInfoFormConfig, storageFormConfig, getYqColumns,getRyColumns,getYqphFormConfig } from "../../formConfig/sp/SP0019" export default { name: "SP0019", @@ -65,6 +67,11 @@ export default { }, }, computed: { + //仪器平衡 + yqphFormConfig(){ + return getYqphFormConfig(this); + }, + //溶液 ryColumns(){ return getRyColumns(this); }, diff --git a/src/views/business/comps/template/formConfig/sp/SP0019.js b/src/views/business/comps/template/formConfig/sp/SP0019.js index a98a0bc..0a85f85 100644 --- a/src/views/business/comps/template/formConfig/sp/SP0019.js +++ b/src/views/business/comps/template/formConfig/sp/SP0019.js @@ -96,10 +96,10 @@ export const getRyColumns = () => { label: '溶液类型', prop: "rylx", bodyType: "select", - bodyOptions:[ + bodyOptions: [ { - label:'溶液', - value:'溶液' + label: '溶液', + value: '溶液' }, ], bodyFillType: 'preFill', @@ -126,3 +126,24 @@ export const getRyColumns = () => { }, ] } +//仪器平衡 +export const getYqphFormConfig = () => { + return [ + { + type: 'checkboxList', + config: { + yqph: { + label: '仪器平衡', + type: 'checkboxList', + fillType: 'actFill', + options: [ + { label: '流动相平衡', value: 1 }, + { label: '样品平衡', value: 2 }, + { label: '样品', value: 3 }, + { label: '未平衡', value: 4 } + ] + }, + } + } + ] +} \ No newline at end of file