diff --git a/src/components/Template/operation/TableOpertaion.vue b/src/components/Template/operation/TableOpertaion.vue index fa02457..dbc61be 100644 --- a/src/components/Template/operation/TableOpertaion.vue +++ b/src/components/Template/operation/TableOpertaion.vue @@ -11,7 +11,7 @@ 分装 开始配置 配置完成 - 打印标签 + 打印标签 @@ -45,7 +45,14 @@ export default { EventBus.$on("dialogSubPackageSubmit", (data) => { this.onSubPackageSubmit(data) }) + EventBus.$on("subPackageDialogPrintTag", (data) => { + this.onPrintTag(data) + }) }, + destroyed() { + EventBus.$off("dialogSubPackageSubmit") + EventBus.$off("subPackageDialogPrintTag") + }, watch: { row: { handler(newVal, oldVal) { @@ -69,8 +76,14 @@ export default { this.$emit("configComplete", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) }, // 打印标签 - onPrintLabel() { - this.$emit("printLabel", { rowData: this.innerRow, rowIndex: this.rowIndex, headerSelectFields: this.columns.headerSelectFields }) + onPrintTag(data) { + if(data) { + if(data.rowIndex === this.rowIndex){ + this.$emit("printTag", { printCode: data.printCode,type:"subPackage" }) + } + }else{ + this.$emit("printTag", { row: this.innerRow,type:"row" }) + } }, // 分装 onSubPackage() { diff --git a/src/views/business/comps/template/TemplateTable.vue b/src/views/business/comps/template/TemplateTable.vue index 838d9de..d1b5ca0 100644 --- a/src/views/business/comps/template/TemplateTable.vue +++ b/src/views/business/comps/template/TemplateTable.vue @@ -31,7 +31,7 @@ import Demo from "./comps/sp/Demo.vue"; import SYWZPZJHB from "./comps/gsp/SYWZPZJHB.vue"; import MJYLQSQD from "./comps/gsp/MJYLQSQD.vue"; import SubPackageDialog from "./dialog/SubPackageDialog.vue";//分装弹窗 -import TagPrintDialog from "./dialog/TagPrintDialog.vue";//标签打印弹窗 +import TagPrintDialog from "./dialog/PrintTagDialog.vue";//标签打印弹窗 export default { name: "TemplateTable", diff --git a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue index 165e694..ecb69a3 100644 --- a/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue +++ b/src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue @@ -10,8 +10,8 @@ :formData="formData" /> - +
@@ -47,6 +47,7 @@ import CustomTable from '@/components/Template/CustomTable.vue'; import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue'; import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue"; import { EventBus } from "@/utils/eventBus"; +import moment from 'moment'; export default { name: "SWYPBQGZYZBB", @@ -75,12 +76,12 @@ export default { { type: "conditionItem", config: { - storageCondition1: { + storageCondition: { label: "存储条件", type: "select", fillType: "preFill", options: this.getDictOptions('business_cctj'), - otherCode: "other1", + otherCode: "storageConditionOther", }, } @@ -416,6 +417,11 @@ export default { mounted() { }, methods: { + //打印标签回调 + printTag(data) { + const printConfig = this.getBasePrintConfig(data); + EventBus.$emit('showTagPrintDialog', {printConfig}) + }, //分装回调 subPackageSubmit(data) { const { fzsj, rowData } = data; @@ -448,7 +454,7 @@ export default { }, //获取已填写的表单数据 getFilledFormData() { - return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"]) + return this.getFilledFormDataByRefs(["baseInfoRef", "stepFormPackageRef", "stepRef", "remarkRef", "stepTableRef"]) }, handleClickable(item) { if (this.fillType === "preFill") { @@ -492,11 +498,11 @@ export default { this.$refs.stepTableRef.updateDataSource(newStepTableData); }, async getFormData() { - return await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]); + return await this.validFormFields(["baseInfoRef", , "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]); }, async onSave() { // const formData = await this.getFormData(); - const formData = await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]); + const formData = await this.validFormFields(["baseInfoRef", , "stepFormPackageRef", "stepTableRef", "stepRef", "remarkRef"]); console.log(formData, "formData") } diff --git a/src/views/business/comps/template/dialog/PrintTagDialog.vue b/src/views/business/comps/template/dialog/PrintTagDialog.vue new file mode 100644 index 0000000..752ddb8 --- /dev/null +++ b/src/views/business/comps/template/dialog/PrintTagDialog.vue @@ -0,0 +1,80 @@ + + + + + \ No newline at end of file diff --git a/src/views/business/comps/template/dialog/SubPackageDialog.vue b/src/views/business/comps/template/dialog/SubPackageDialog.vue index a1b30e5..b276d3d 100644 --- a/src/views/business/comps/template/dialog/SubPackageDialog.vue +++ b/src/views/business/comps/template/dialog/SubPackageDialog.vue @@ -33,7 +33,7 @@
{{ formData.mybh }}-set{{ item.subCode }}
- 打印 + 打印
@@ -255,7 +255,9 @@ export default { // 清除相关字段的错误状态 this.formErrors.mfbzl = false; }, - onPrint() { }, + onPrint(item) { + EventBus.$emit('subPackageDialogPrintTag', {...this.formData, printCode: `${this.formData.mybh}-set${item.subCode}`}); + }, onCommonBlur(e, field) { if (this.formData[field]) { this.formErrors[field] = false; diff --git a/src/views/business/comps/template/dialog/TagPrintDialog.vue b/src/views/business/comps/template/dialog/TagPrintDialog.vue deleted file mode 100644 index 731339b..0000000 --- a/src/views/business/comps/template/dialog/TagPrintDialog.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/views/business/comps/template/mixins/templateMixin.js b/src/views/business/comps/template/mixins/templateMixin.js index 7eb1989..0833ac3 100644 --- a/src/views/business/comps/template/mixins/templateMixin.js +++ b/src/views/business/comps/template/mixins/templateMixin.js @@ -129,6 +129,24 @@ export default { this.setTemplateData({}) }, methods: { + //获取打印配置 + getBasePrintConfig (data){ + const { printCode,type,row } = data; + const {stepStorageCondition,startDate,expireDate} = this.formData; + const { nickName, name } = this.$store.getters; + const lang = this.$i18n.locale; + const printConfig = { + "品名":"暂时还不知道品名是哪个字段", + "存储条件":stepStorageCondition, + "配制日期":moment(startDate).format("YYYY-MM-DD"), + "有效期至":moment(expireDate).format("YYYY-MM-DD HH:mm"), + "配置者":lang === "zh_CN" ? nickName : name, + //type==="subPackage"从分装打印过来的, + //type==="row" 从列表上点过来的 + "编号":type === "subPackage" ? printCode : (row.targetSolutionCode+row.subTargetSolutionCode), + } + return printConfig + }, async getLatestSn(count = 1) { const res = await getLatestSn({ count }) if (res.code === 200) {