diff --git a/src/components/patientRegister/PatientRegisterEdit.vue b/src/components/patientRegister/PatientRegisterEdit.vue index eb088bb..b0cbb12 100644 --- a/src/components/patientRegister/PatientRegisterEdit.vue +++ b/src/components/patientRegister/PatientRegisterEdit.vue @@ -1480,23 +1480,27 @@ export default { if (this.patientRegister.photo && this.patientRegister.photo.indexOf("data:image") > -1) savePeoplePhoto(res.data.id, this.patientRegister.photo); // 新增保存时,提示是否打条码 - // if (!body.id) { - // this.$confirm("是否打印 指引单、检验条码及 Pacs 条码?", "提示", { - // confirmButtonText: "是", - // cancelButtonText: "否", - // type: "warning", - // }) - // .then(() => { - // this.guidePrint('0001', false) - - // this.labelPrint(false) - // }) - // .catch((err) => { - // // if (err == "cancel") { - // // this.$message.info({ showClose: true, message: "已取消操作" }); - // // } - // }); - // } + if (!body.id) { + this.$confirm("是否打印 指引单、检验条码及 Pacs 条码?", "提示", { + confirmButtonText: "是", + cancelButtonText: "否", + type: "warning", + }) + .then(async () => { + try { + await this.guidePrint('0001', false) + await this.labelPrint(false) + } catch (error) { + // this.$message.info({ showClose: true, message: error }); + console.log(error) + } + }) + .catch((err) => { + // if (err == "cancel") { + // this.$message.info({ showClose: true, message: "已取消操作" }); + // } + }); + } } } ); @@ -1661,37 +1665,22 @@ export default { this.$message.warning({ showClose: true, message: err}); }); */ - this.$peisAPI.printPre(JSON.stringify(toOutShell)) - .then(res => { - // console.log('this.$peisAPI.printPre', res) - if (JSON.parse(res).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(res).message }); - } - }) - .catch((err) => { - // console.log('打印指引单错误', err) - this.$message.warning({ showClose: true, message: `${err}` }); - }); + try { + let lres = await this.$peisAPI.printPre(JSON.stringify(toOutShell)) + if (JSON.parse(lres).code < 0) { + this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); + } + } catch (error) { + this.$message.warning({ showClose: true, message: `${error}` }); + } } else { - - // postapi(`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${this.form.id}`) - // .then((res) => { - // if (res.code != -1) { - // toOutShell.ReportTable = res.data; - // // console.log('JSON.stringify(toOutShell)', JSON.stringify(toOutShell)); - // return this.$peisAPI.print(JSON.stringify(toOutShell)); - // } - // }) - this.$peisAPI.print(JSON.stringify(toOutShell)) - .then(res => { - if (JSON.parse(res).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(res).message }); - } else { - //更新打印次数 - return postapi('/api/app/patientregister/updatepatientregisterguideprinttimesmany', [this.form.id]) - } - }) - .then(res => { + try { + let lres = await this.$peisAPI.print(JSON.stringify(toOutShell)) + if (JSON.parse(lres).code < 0) { + this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); + return + } + postapi('/api/app/patientregister/updatepatientregisterguideprinttimesmany', [this.form.id]).then(res => { if (res && res.code > -1) { let lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id) if (lfind > -1) { @@ -1701,14 +1690,11 @@ export default { this.patientRegister.prList[lfind].guidePrintTimes = 1; } } - } else { - this.$message.warning({ showClose: true, message: res.message }); } }) - .catch(err => { - this.$message.warning({ showClose: true, message: err }); - }); - + } catch (error) { + this.$message.warning({ showClose: true, message: `${error}` }); + } } }, @@ -1759,7 +1745,7 @@ export default { }, //条码打印(lis + pacs) - labelPrint(isPreview) { + async labelPrint(isPreview) { if (!this.form.id) { this.$message.info({ showClose: true, message: "人员信息尚未保存,不可执行此操作!" }); return; @@ -1782,51 +1768,49 @@ export default { ], }; - // lis条码打印 - this.lisPrint('0002', isPreview, toOutShell) + try { + // lis条码打印 + await this.lisPrint('0002', isPreview, toOutShell) + + // pacs条码打印 + await this.pacsPrint('0004', isPreview, toOutShell) + + } catch (error) { + console.log(error) + } - // pacs条码打印 - this.pacsPrint('0004', isPreview, toOutShell) }, // lis条码打印 - lisPrint(ReportCode, isPreview, toOutShell) { + async lisPrint(ReportCode, isPreview, toOutShell) { toOutShell.ReportCode = ReportCode // console.log('this.$peisAPI.print', toOutShell) if (isPreview) { - this.$peisAPI.printPre(JSON.stringify(toOutShell)) - .then(res => { - let lres = JSON.parse(res) - // console.log('this.$peisAPI.printPre', lres) - if (lres.code < 0) { - // console.log('打印检验条码错误', lres.message) - this.$message.warning({ showClose: true, message: lres.message }); - } - }) - .catch((err) => { - // console.log('打印检验条码错误', err) - this.$message.warning({ showClose: true, message: `${err}` }); - }); + try { + let lres = await this.$peisAPI.printPre(JSON.stringify(toOutShell)) + if (JSON.parse(lres).code < 0) { + this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); + } + } catch (error) { + this.$message.warning({ showClose: true, message: `${error}` }); + } } else { - this.$peisAPI.print(JSON.stringify(toOutShell)) - .then(res => { - let lres = JSON.parse(res) - // console.log('打印检验条码', lres) - if (res && lres.code > -1) { - return postapi('/api/app/lisrequest/updatelisrequestisprint', { operateType: 1, patientRegisterId: this.form.id }) - } else { - this.$message.warning({ showClose: true, message: lres.message }); - } - }) - .then(res => { - if (res && res.code < 0) { - this.$message.error({ showClose: true, message: `更新条码打印状态失败,原因:${res.message}` }); - } - }) - .catch(err => { - this.$message.warning({ showClose: true, message: `${err}` }); - }); + try { + let lres = await this.$peisAPI.print(JSON.stringify(toOutShell)) + if (JSON.parse(lres).code < 0) { + this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); + return + } + postapi('/api/app/lisrequest/updatelisrequestisprint', { operateType: 1, patientRegisterId: this.form.id }) + .then(res => { + if (res && res.code < 0) { + this.$message.error({ showClose: true, message: `更新条码打印状态失败,原因:${res.message}` }); + } + }) + } catch (error) { + this.$message.warning({ showClose: true, message: error }); + } } },