Browse Source

print

master
pengjun 2 years ago
parent
commit
3c99194cc5
  1. 8
      src/components/patientRegister/PatientRegisterEdit.vue
  2. 94
      src/components/patientRegister/PatientRegisterList.vue

8
src/components/patientRegister/PatientRegisterEdit.vue

@ -883,7 +883,7 @@ export default {
return
}
this.$peisAPI.peopleIcCard().then(res => {
//console.log('peopleIcCard',res)
console.log('peopleIcCard',res)
let lres = JSON.parse(res)
if (lres.code >= 0) {
let idNos = parsIcCardtoLocal(lres.data, this.dict.sex, this.dict.nation)
@ -1447,7 +1447,6 @@ export default {
if (isPreview) {
//
//this.multipleSelection.forEach((item,index) =>{
postapi(`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${this.form.id}`)
.then((res) => {
if (res.code != -1) {
@ -1471,14 +1470,15 @@ export default {
}
})
.then(res => {
if (res.code != -1) {
//console.log('this.$peisAPI.print',res)
if (JSON.parse(res).code >= 0) {
//
return postapi('/api/app/patientregister/updatepatientregisterguideprinttimesmany', [this.form.id])
}
})
.then(res => {
if (res.code != -1) {
lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id)
let lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id)
if (lfind > -1) {
if (this.patientRegister.prList[lfind].guidePrintTimes) {
this.patientRegister.prList[lfind].guidePrintTimes = Number(this.patientRegister.prList[lfind].guidePrintTimes) + 1;

94
src/components/patientRegister/PatientRegisterList.vue

@ -607,8 +607,17 @@ export default {
};
let lfind = -1;
//start -------------------------
this.multipleSelection = []
this.patientRegister.prList.forEach(e =>{
if(e.choosed){
this.multipleSelection.push(deepCopy(e))
}
})
// end  -------------------------
if (this.multipleSelection.length < 1) {
this.$message.info("请勾选要打印指引单的人员记录!");
this.$message.info("请选要打印指引单的人员记录!");
return;
}
@ -629,57 +638,50 @@ export default {
return this.$peisAPI.printPre(JSON.stringify(toOutShell));
}
})
.then(res =>{
console.log('this.$peisAPI.printPre',res)
if(JSON.parse(res).code < 0){
this.$message.warning(JSON.parse(res).message);
}
})
.catch((err) => {
this.$message.warning(err);
});
// });
} else {
this.multipleSelection.forEach((item, index) => {
postapi(
`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${item.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));
}
})
.then((res) => {
if (JSON.parse(res).code >= 0) {
//
return postapi(
"api/app/patientregister/updatepatientregisterguideprinttimesmany",
[item.id]
);
}
})
.then((res) => {
if (res.code != -1) {
lfind = arrayExistObj(
this.patientRegister.prList,
"id",
item.id
);
if (lfind > -1) {
if (this.patientRegister.prList[lfind].guidePrintTimes) {
this.patientRegister.prList[lfind].guidePrintTimes =
Number(
this.patientRegister.prList[lfind].guidePrintTimes
) + 1;
} else {
this.patientRegister.prList[lfind].guidePrintTimes = 1;
}
}
this.elProgress.display = true;
this.elProgress.percentage = 0;
let resPrintData,resPeisAPI,resPrintTimes;
for(let i=0;i<this.multipleSelection.length;i++){
try {
resPrintData = await postapi(`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${this.multipleSelection[i].id}`)
if(resPrintData.code == -1) continue
toOutShell.ReportTable = resPrintData.data
resPeisAPI = await this.$peisAPI.print(JSON.stringify(toOutShell));
if (JSON.parse(resPeisAPI).code < 0) continue
resPrintTimes = postapi("api/app/patientregister/updatepatientregisterguideprinttimesmany",[this.multipleSelection[i].id]);
if(resPrintTimes.code == -1) continue
lfind = arrayExistObj(this.patientRegister.prList,"id",this.multipleSelection[i].id);
if (lfind > -1) {
if (this.patientRegister.prList[lfind].guidePrintTimes) {
this.patientRegister.prList[lfind].guidePrintTimes =
Number(
this.patientRegister.prList[lfind].guidePrintTimes
) + 1;
} else {
this.patientRegister.prList[lfind].guidePrintTimes = 1;
}
})
.catch((err) => {
this.$message.warning(err);
});
});
}
} catch (error) {
this.$message.error(error)
}
this.elProgress.percentage = Math.floor(
((i + 1) * 100) / this.multipleSelection.length
);
}
}
},

Loading…
Cancel
Save