diff --git a/src/api/business/public/public.js b/src/api/business/public/public.js index b344790..8055379 100644 --- a/src/api/business/public/public.js +++ b/src/api/business/public/public.js @@ -102,7 +102,15 @@ export function public_gspList(query) { // 细胞列表 export function public_xbList(query) { return request({ - url: '/system/business/public/xbList', + url: '/system/business/public/cellList', + method: 'get', + params: query + }) +} +// 细菌列表 +export function public_xjList(query) { + return request({ + url: '/system/business/public/bacteriaList', method: 'get', params: query }) diff --git a/src/components/Template/HandleFormItem.vue b/src/components/Template/HandleFormItem.vue index 223a7b6..d768dfc 100644 --- a/src/components/Template/HandleFormItem.vue +++ b/src/components/Template/HandleFormItem.vue @@ -109,7 +109,6 @@ 确 定 - @@ -119,13 +118,12 @@ import DecimalInput from "./DecimalInput.vue"; import { EventBus } from "@/utils/eventBus"; import moment from "moment"; import { deepClone } from "@/utils/index"; -import EditSign from "@/views/business/comps/template/dialog/EditSign.vue"; +import { getuuid } from "@/utils/index.js"; export default { inject: ['templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"], components: { Question, DecimalInput, - EditSign, }, props: { type: {//form类型 input/select等 @@ -185,6 +183,7 @@ export default { replyContent: '', // 回复内容 visible: false,//是否显示弹窗 checkboxValue: this.getChecked(),//是否选中 + uuid: getuuid(), // 唯一标识符,用于EventBus事件匹配 } }, watch: { @@ -203,6 +202,14 @@ export default { }, mounted() { + EventBus.$on('onExternalFieldUpdate', this.handleExternalFieldUpdate); + EventBus.$on('onEditSignCancel', this.handleEditSignCancel); + EventBus.$on('onEditSignCallback', this.handleEditSignCallback); + }, + unmounted() { + EventBus.$off('onExternalFieldUpdate', this.handleExternalFieldUpdate); + EventBus.$off('onEditSignCancel', this.handleEditSignCancel); + EventBus.$off('onEditSignCallback', this.handleEditSignCallback); }, methods: { // 点击按钮 @@ -221,6 +228,18 @@ export default { } return record.userNameEn; }, + // 处理电子签名取消事件 + handleEditSignCancel(data) { + if (data.uuid === this.uuid) { + this.resetRecord(); + } + }, + // 处理电子签名确认回调事件 + handleEditSignCallback(data) { + if (data.uuid === this.uuid) { + this.onEditSignSave(data.data); + } + }, onEditSignSave(data) { this.handleUpdateRecord(data) }, @@ -412,9 +431,8 @@ export default { return; } if (this.oldValue && !isSame && this.templateFillType === "actFill") { - - this.$refs.editSignRef.show() - // this.handleUpdateRecord(); + // 通过EventBus触发电子签名弹窗 + EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); }else{//如果是第一次填写,不需要密码验证 this.handleUpdateRecord() } @@ -457,9 +475,6 @@ export default { this.$emit("blur", this.inputValue); this.$emit('input', this.inputValue); this.$emit("change", this.inputValue,data?"save":""); - if(!this.isFieldsRecord){//是否需要记录修改记录 - return; - } if(this.templateFillType === "actFill"){//只有实际填报的时候才记录修改记录 this.updateZdxgjl(record); } @@ -483,7 +498,6 @@ export default { getCommonRecordInfo() { const { nickName, name } = this.$store.getters; //locale:zh-CN 中文 en-US 英文 - const lang = this.$i18n.locale === "zh_CN" ? "cn" : "en"; const { label, parentLabel } = this.item; let fieldLabelCn = this.$i18n.t(label,"zh_CN"),fieldLabelEn = this.$i18n.t(label,"en_US"); if (label === "template.common.other") { diff --git a/src/components/Template/StepFormPackage.vue b/src/components/Template/StepFormPackage.vue index cf984e2..349746f 100644 --- a/src/components/Template/StepFormPackage.vue +++ b/src/components/Template/StepFormPackage.vue @@ -115,7 +115,7 @@ export default { } }, methods: { - // 点击按钮 + // 点击按钮 handleClickButton(e,item){ const {buttonName = ""} = e; const {config} = item; diff --git a/src/components/Template/mixins/formPackageMixins.js b/src/components/Template/mixins/formPackageMixins.js index 33838cb..43dc017 100644 --- a/src/components/Template/mixins/formPackageMixins.js +++ b/src/components/Template/mixins/formPackageMixins.js @@ -1,4 +1,5 @@ import { isEqual } from "@/utils/index.js"; +import _ from "lodash"; export default { watch: { formData: { @@ -54,10 +55,11 @@ export default { } }, //更新表单数据 - updateFormData(key, value,oldKeys = []) { + updateFormData(key, value) { // 深拷贝当前表单数据,避免直接修改原数据 const cloneFormFields = JSON.parse(JSON.stringify(this.formFields)); this.oldFormFields[key] = cloneFormFields[key]; + this.updateRecord(); this.formFields[key] = value; // 清除该表单项的错误状态 @@ -65,6 +67,9 @@ export default { this.$set(this.errors, key, false); } }, + updateRecord:_.debounce(function(){ + console.log(this.oldFormFields,"oldFormFields") + }, 100), //批量更新表单数据 batchUpdateFormData(data) { Object.keys(data).forEach(key => { diff --git a/src/views/business/comps/template/TemplateTable.vue b/src/views/business/comps/template/TemplateTable.vue index 1ac0a7a..6d2bc01 100644 --- a/src/views/business/comps/template/TemplateTable.vue +++ b/src/views/business/comps/template/TemplateTable.vue @@ -7,6 +7,7 @@ + @@ -18,6 +19,7 @@ import TagPrintDialog from "./dialog/PrintTagDialog.vue";//标签打印弹窗 import SelectReagentDialog from "./dialog/SelectReagentDialog.vue";//选择试剂弹窗 import SelectInstrumentDialog from "./dialog/SelectInstrumentDialog.vue";//选择仪器弹窗 import SelectMixReagentDialog from "./dialog/SelectMixReagentDialog.vue";//选择试剂/供试品/给药制剂弹窗 +import EditSign from "./dialog/EditSign.vue";//电子签名弹窗 //色谱 import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue"; @@ -46,7 +48,7 @@ import MJYLQSQD from "./comps/gsp/MJYLQSQD.vue"; export default { name: "TemplateTable", components: { - SubPackageDialog,TagPrintDialog,SelectReagentDialog,SelectInstrumentDialog,SelectMixReagentDialog, + SubPackageDialog,TagPrintDialog,SelectReagentDialog,SelectInstrumentDialog,SelectMixReagentDialog,EditSign, //供试品 MJYLQSQD, SYWZPZJHB, //色谱 @@ -159,6 +161,7 @@ export default { zdxgjl: [], fhyjjl: [], fieldCheckObj: {}, + currentEditSignUuid: null, // 当前请求EditSign的HandleFormItem的uuid }; }, mounted() { @@ -185,6 +188,11 @@ export default { EventBus.$on("showSelectMixReagentDialog",(data)=>{ this.$refs.selectMixReagentDialogRef.show(data.studyFormId,data) }) + //显示电子签名弹窗 + EventBus.$on("showEditSignDialog",(data)=>{ + this.currentEditSignUuid = data.uuid; + this.$refs.editSignRef.show(); + }) }, beforeDestroy() { // 记得移除监听,避免内存泄漏 @@ -194,8 +202,23 @@ export default { EventBus.$off("showSelectReagentDialog"); EventBus.$off("showSelectInstrumentDialog"); EventBus.$off("showSelectMixReagentDialog"); + EventBus.$off("showEditSignDialog"); }, methods: { + // 处理电子签名取消事件 + handleEditSignCancel() { + if (this.currentEditSignUuid) { + EventBus.$emit('onEditSignCancel', { uuid: this.currentEditSignUuid }); + this.currentEditSignUuid = null; + } + }, + // 处理电子签名确认回调事件 + handleEditSignCallback(data) { + if (this.currentEditSignUuid) { + EventBus.$emit('onEditSignCallback', { uuid: this.currentEditSignUuid, data }); + this.currentEditSignUuid = null; + } + }, async getFormData() { if(this.fillType === "actFill"){ //检查是否有未填写的复核意见