From 21fe2968337eb8eab97adc88750b71c4057e98f8 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期三, 17 七月 2024 15:39:46 +0800 Subject: [PATCH] 11 --- src/views/project/donatefinish/index.vue | 259 +++++++++++++++++++++++++++++---------------------- 1 files changed, 146 insertions(+), 113 deletions(-) diff --git a/src/views/project/donatefinish/index.vue b/src/views/project/donatefinish/index.vue index 08e21c7..fc5c30a 100644 --- a/src/views/project/donatefinish/index.vue +++ b/src/views/project/donatefinish/index.vue @@ -8,7 +8,6 @@ label-width="70px" > <el-row :gutter="8"> - <el-col :span="6"> <el-form-item label="濮撳悕" prop="name"> <el-input @@ -51,13 +50,13 @@ <el-col :span="6"> <el-form-item label="鎹愮尞杩涘害" prop="recordstate"> <el-select - v-model="queryParams.recordstate" + v-model="queryParams.workflow" placeholder="璇烽�夋嫨璁板綍鐘舵��" clearable size="small" > <el-option - v-for="dict in dict.type.sys_DonationStatus" + v-for="dict in dict.type.sys_donornode" :key="dict.value" :label="dict.label" :value="dict.value" @@ -69,7 +68,10 @@ <el-row :gutter="8"> <el-col :span="6"> <el-form-item label="鎶ュ憡浜�"> - <el-select v-model="queryParams.reporterno" placeholder="璇烽�夋嫨鎶ュ憡浜�"> + <el-select + v-model="queryParams.reporterno" + placeholder="璇烽�夋嫨鎶ュ憡浜�" + > <el-option v-for="item in reportlist" :key="item.index" @@ -111,7 +113,6 @@ > </el-form-item> </el-col> - </el-row> <!-- <el-row> <el-col :span="14"> @@ -136,18 +137,16 @@ :data="donatebaseinfoList" > <el-table-column - label="鎶ュ憡鏃堕棿" + label="妗堜緥鏃堕棿" align="center" - prop="reporttime" + prop="donatetime" width="120" > <template slot-scope="scope"> - <span>{{ parseTime(scope.row.reporttime, "{y}-{m}-{d}") }}</span> + <span>{{ parseTime(scope.row.donatetime, "{y}-{m}-{d}") }}</span> </template> </el-table-column> - <el-table-column label="濮撳悕" align="center" prop="name" width="100" /> - <el-table-column label="鎬у埆" align="center" prop="sex" width="100"> <template slot-scope="scope"> <dict-tag @@ -162,13 +161,13 @@ align="center" prop="treatmenthospitalname" /> - <el-table-column + <el-table-column label="瀹屾垚鏃堕棿" align="center" prop="completetime" width="200" > - <template slot-scope="scope"> + <template slot-scope="scope"> <span>{{ parseTime(scope.row.createtime, "{y}-{m}-{d}") }}</span> </template> </el-table-column> @@ -183,13 +182,17 @@ <el-table-column label="鎹愮尞杩涘害" align="center" - prop="recordstate" + prop="workflow" + width="120" > <template slot-scope="scope"> - <dict-tag - :options="dict.type.sys_DonationStatus" - :value="scope.row.recordstate" - /> + <div v-if="!scope.row.terminationCase"> + <dict-tag + :options="dict.type.sys_donornode" + :value="scope.row.workflow" + /> + </div> + <div v-else>浠诲姟缁堟</div> </template> </el-table-column> @@ -494,31 +497,32 @@ </el-row> </el-form> <div slot="footer" class="dialog-footer"> - <el-button :disabled="loading" type="primary" @click="submitForm">淇� 瀛�</el-button> + <el-button :disabled="loading" type="primary" @click="submitForm" + >淇� 瀛�</el-button + > <el-button @click="cancel">鍙� 娑�</el-button> </div> </el-dialog> </div> </template> -<style scoped> -</style> +<style scoped></style> <script> import { listOrganization, listReportname, - listUser, + listUser } from "@/api/project/organization"; import { listDonatebaseinfo, getDonatebaseinfo, addDonatebaseinfo, - updateDonatebaseinfo, + updateDonatebaseinfo // exportProvincemessage, } from "@/api/project/donatebaseinfo"; import { updatedonatorno, - updateDonateNumber, + updateDonateNumber } from "@/api/project/relativesconfirmation"; import { getDonatecompletioninfo, @@ -526,25 +530,27 @@ addDonatecompletioninfo, updateDonatecompletioninfo, listDonatecompletioninfo, - downloadcompletioninfo, + downloadcompletioninfo } from "@/api/project/donatecompletioninfo"; import Li_area_select from "@/components/Address"; import OrgSelecter from "@/views/project/components/orgselect"; import AnnexUpload from "@/views/project/components/annexupload"; +import { getToken } from "@/utils/auth"; + import { listDonateorgan, addDonateorgan, delDonateorgan, updateDonateorgan, - getDonateorgan, + getDonateorgan } from "@/api/project/donateorgan"; export default { components: { Li_area_select, OrgSelecter, - AnnexUpload, + AnnexUpload }, name: "Donatefinish", dicts: [ @@ -563,12 +569,12 @@ "sys_Infectious", "sys_InfoSources", "sys_OtherCases", - "sys_DonationStatus", + "sys_donornode", "sys_DiseaseType", "sys_SelfWill", "sys_FamilyRelation", "sys_Organ", - "sys_organstate", + "sys_organstate" ], data() { return { @@ -592,7 +598,7 @@ { label: "琛㈠窞甯�", value: "8" }, { label: "鑸熷北甯�", value: "9" }, { label: "鍙板窞甯�", value: "A" }, - { label: "涓芥按甯�", value: "B" }, + { label: "涓芥按甯�", value: "B" } ], //鐪佸競鍖� @@ -601,17 +607,17 @@ sheng: "", shi: "", qu: "", - organizationname: null, + organizationname: null }, residenceAddresss: { sheng: "娴欐睙鐪�", shi: "", - qu: "", + qu: "" }, registerAddresss: { sheng: "娴欐睙鐪�", shi: "", - qu: "", + qu: "" }, //鐢ㄦ埛琛� @@ -644,6 +650,9 @@ open: false, // 鑾峰彇缁勭粐鍚嶇О鏃堕棿鑼冨洿 daterangeReporttime: [], + headers: { + Authorization: "Bearer " + getToken() + }, // 鏌ヨ鍙傛暟 queryParams: { pageNum: 1, @@ -659,30 +668,30 @@ donorno: null, reportername: null, reporttime: null, - city: null, + city: null }, // 琛ㄥ崟鍙傛暟 form: {}, // 琛ㄥ崟鏍¢獙 rules: { completetime: [ - { required: true, message: "璇疯緭鍏ュ畬鎴愭椂闂�", trigger: "blur" }, + { required: true, message: "璇疯緭鍏ュ畬鎴愭椂闂�", trigger: "blur" } ], coordinatedusernameo: [ - { required: true, message: "璇烽�夋嫨鍗忚皟鍛樹竴", trigger: "blur" }, + { required: true, message: "璇烽�夋嫨鍗忚皟鍛樹竴", trigger: "blur" } ], coordinatedusernamet: [ - { required: true, message: "璇烽�夋嫨鍗忚皟鍛樹簩", trigger: "blur" }, + { required: true, message: "璇烽�夋嫨鍗忚皟鍛樹簩", trigger: "blur" } ], responsibleusername: [ - { required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "blur" }, - ], + { required: true, message: "璇烽�夋嫨璐熻矗浜�", trigger: "blur" } + ] }, curCase: { donorno: "", name: "", registerAddresss: "", - infoid: "", + infoid: "" }, //鍣ㄥ畼鍒楄〃 // donateorganList: [], @@ -692,13 +701,14 @@ //娴佺▼鍚嶇О flowname: "鎹愮尞瀹屾垚鐧昏", //娴佺▼鍚嶇О-浼︾悊瀹℃煡 - annexno: "", + annexno: "" }; }, created() { - // this.getDicts('country').then(res=>{ - // this.nationality =res.data - // }) + if (sessionStorage.getItem("donatefinish")) { + this.queryParams = JSON.parse(sessionStorage.getItem("donatefinish")); + console.log(this.queryParams, "queryParams"); + } }, activated() { this.selecttime = ""; @@ -711,9 +721,7 @@ if (this.$route.params.starttime != null && this.$route.params.endtime) { this.selecttime = [ this.$moment(this.$route.params.starttime).format("YYYY-MM-DD"), - this.$moment(this.$route.params.endtime) - .add(-1, "month") - .format("YYYY-MM-DD"), + this.$moment(this.$route.params.endtime).format("YYYY-MM-DD") ]; } if (this.$route.params.reporterno != "") { @@ -750,14 +758,14 @@ }, methods: { LoadReportList() { - listDonatebaseinfo().then((res) => { + listDonatebaseinfo().then(res => { console.log("娼滃湪鎹愮尞琛�", res); let list = res.rows; let reportlist = []; - list.forEach((element) => { + list.forEach(element => { reportlist.push({ reporterno: element.reporterno, - reportername: element.reportername, + reportername: element.reportername }); }); console.log("dwada", reportlist); @@ -769,7 +777,7 @@ }, resetArr(Arr) { var hash = {}; - Arr = Arr.reduce(function (arr, current) { + Arr = Arr.reduce(function(arr, current) { hash[current.reporterno] ? "" : (hash[current.reporterno] = true && arr.push(current)); @@ -836,7 +844,7 @@ }, updatedonorno(row) { console.log("row", row); - updatedonatorno(row.infoid).then((res) => { + updatedonatorno(row.infoid).then(res => { console.log("1221212", res); this.getList(); }); @@ -847,7 +855,7 @@ if (e.organstate === 99) { this.$prompt("璇疯緭鍏ュ惎鐢ㄥ師鍥�", "鎻愮ず", { confirmButtonText: "纭畾", - cancelButtonText: "鍙栨秷", + cancelButtonText: "鍙栨秷" }) .then(({ value }) => { console.log("鍚敤鍘熷洜", value); @@ -856,7 +864,7 @@ .catch(() => { this.$message({ type: "info", - message: "鍙栨秷", + message: "鍙栨秷" }); }); } @@ -864,28 +872,28 @@ //鑾峰彇鐢ㄦ埛琛� getuserlist() { - listUser().then((res) => { + listUser().then(res => { this.users = res.data; }); }, //鑾峰彇璐熻矗浜� getLeaderList() { - listReportname("fzr").then((res) => { + listReportname("fzr").then(res => { this.leaderlist = res.data; }); }, //鑾峰彇鍗忚皟鍛樹竴 getCoordinatorList1() { - listReportname("xty1").then((res) => { + listReportname("xty1").then(res => { this.coordinatorlist1 = res.data; }); }, //鑾峰彇鍗忚皟鍛樹簩 getCoordinatorList2() { - listReportname("xty2").then((res) => { + listReportname("xty2").then(res => { this.coordinatorlist2 = res.data; }); }, @@ -949,9 +957,12 @@ getList() { this.loading = true; this.queryParams.params = {}; + sessionStorage.removeItem("donatefinish"); + sessionStorage.setItem("donatefinish", JSON.stringify(this.queryParams)); if (null != this.daterangeReporttime && "" != this.daterangeReporttime) { - this.queryParams.params["beginReporttime"] = - this.daterangeReporttime[0]; + this.queryParams.params[ + "beginReporttime" + ] = this.daterangeReporttime[0]; this.queryParams.params["endReporttime"] = this.daterangeReporttime[1]; } @@ -967,7 +978,7 @@ // this.queryParams.residenceprovince = this.$refs.areaSelect.getSheng(); // this.queryParams.residencecity = this.$refs.areaSelect.getShi(); // this.queryParams.residencetown = this.$refs.areaSelect.getQu(); - listnewDonatecompletioninfo(this.queryParams).then((response) => { + listnewDonatecompletioninfo(this.queryParams).then(response => { this.donatebaseinfoList = response.rows; this.total = response.total; this.loading = false; @@ -1003,7 +1014,7 @@ coordinatedusernamet: null, assessannex: null, donateorgan: "", - donateorganList: [], + donateorganList: [] }; this.resetForm("form"); }, @@ -1029,7 +1040,7 @@ reportername: null, reporttime: null, city: null, - treatmenthospitalno: null, + treatmenthospitalno: null }; this.selecttime = []; this.getTimeList(); @@ -1037,7 +1048,7 @@ sheng: "", shi: "", qu: "", - organizationname: null, + organizationname: null }; //this.$refs.areaSelect.clean(); @@ -1057,7 +1068,7 @@ path: "/organ/donationdetails/", query: { id: row.id, - organType: "edit", + organType: "edit" } }); // this.reset(); @@ -1136,15 +1147,15 @@ //鏌ヨ let searchParam = { - id: row.id, + id: row.id }; let oraganqueryParam = { - infoid: row.id, + infoid: row.id // donorname: this.curCase.name, // donorno: this.curCase.donorno, // registeraddress: this.curCase.registeraddresss, }; - listDonateorgan(oraganqueryParam).then((response) => { + listDonateorgan(oraganqueryParam).then(response => { if (response.code == 200) { console.log("2", response); this.tableData = response.rows; @@ -1155,7 +1166,7 @@ //鑾峰彇鍣ㄥ畼鍒嗛厤淇℃伅 // this.GetDonortedList(); }); - listnewDonatecompletioninfo(searchParam).then((response) => { + listnewDonatecompletioninfo(searchParam).then(response => { if (response.code == 200 && response.rows.length == 1) { this.open = true; this.form = response.rows[0]; @@ -1175,7 +1186,7 @@ /** 鎻愪氦鎸夐挳 */ submitForm() { this.loading = true; - this.$refs["form"].validate((valid) => { + this.$refs["form"].validate(valid => { if (valid) { this.form.donorno = this.curCase.donorno; this.form.infoid = this.curCase.id; @@ -1184,33 +1195,36 @@ //璐熻矗浜� //leaderlist let responsibleuseridIndex = this.leaderlist.findIndex( - (item) => this.form.responsibleuserid == item.reportNo + item => this.form.responsibleuserid == item.reportNo ); if (responsibleuseridIndex > -1) { - this.form.responsibleusername = - this.leaderlist[responsibleuseridIndex].reportName; + this.form.responsibleusername = this.leaderlist[ + responsibleuseridIndex + ].reportName; } //鍗忚皟鍛�1 let coordinatedusernameIndex = this.coordinatorlist1.findIndex( - (item) => this.form.coordinateduserido == item.reportNo + item => this.form.coordinateduserido == item.reportNo ); if (coordinatedusernameIndex > -1) { - this.form.coordinatedusernameo = - this.coordinatorlist1[coordinatedusernameIndex].reportName; + this.form.coordinatedusernameo = this.coordinatorlist1[ + coordinatedusernameIndex + ].reportName; } //鍗忚皟鍛�2 let coordinatedusernametIndex = this.coordinatorlist1.findIndex( - (item) => this.form.coordinateduseridt == item.reportNo + item => this.form.coordinateduseridt == item.reportNo ); if (coordinatedusernametIndex > -1) { - this.form.coordinatedusernamet = - this.coordinatorlist1[coordinatedusernametIndex].reportName; + this.form.coordinatedusernamet = this.coordinatorlist1[ + coordinatedusernametIndex + ].reportName; } - + if (this.form.id != null) { console.log("鏇存柊form", this.form); - - updateDonatecompletioninfo(this.form).then((response) => { + + updateDonatecompletioninfo(this.form).then(response => { this.$modal.msgSuccess("淇敼鎴愬姛"); this.loading = false; this.open = false; @@ -1218,15 +1232,16 @@ //鏇存柊鍣ㄥ畼琛� for (let k = 0; k < this.tableData.length; k++) { try { - this.tableData[k].transplanthospitalname = - this.$refs.transplanthosselect.getOptionByValue( - this.tableData[k].transplanthospitalno - ).organizationname; + this.tableData[ + k + ].transplanthospitalname = this.$refs.transplanthosselect.getOptionByValue( + this.tableData[k].transplanthospitalno + ).organizationname; } catch { console.log("鑾峰彇鏈烘瀯鍚嶇О澶辫触锛�"); } - updateDonateorgan(this.tableData[k]).then((response1) => { + updateDonateorgan(this.tableData[k]).then(response1 => { if (response1.code == 200) { // this.$modal.msgSuccess("鍣ㄥ畼璁板綍淇敼鎴愬姛"); } @@ -1235,10 +1250,10 @@ //鏇存柊鎹愮尞鐘舵�� this.curCase.recordstate = 12; - getDonatebaseinfo(this.curCase.infoid).then((res) => { + getDonatebaseinfo(this.curCase.infoid).then(res => { let donatebasedata = res.data; donatebasedata.recordstate = 12; - updateDonatebaseinfo(donatebasedata).then((response) => { + updateDonatebaseinfo(donatebasedata).then(response => { //this.$modal.msgSuccess("瀹℃牳鎴愬姛"); //this.isShowReviewDialog = false; this.getList(); @@ -1246,22 +1261,23 @@ }); }); } else { - addDonatecompletioninfo(this.form).then((response) => { - this.loading=false + addDonatecompletioninfo(this.form).then(response => { + this.loading = false; this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; //鏇存柊鍣ㄥ畼琛� for (let k = 0; k < this.tableData.length; k++) { try { - this.tableData[k].transplanthospitalname = - this.$refs.transplanthosselect.getOptionByValue( - this.tableData[k].transplanthospitalno - ).organizationname; + this.tableData[ + k + ].transplanthospitalname = this.$refs.transplanthosselect.getOptionByValue( + this.tableData[k].transplanthospitalno + ).organizationname; } catch { console.log("鑾峰彇鏈烘瀯鍚嶇О澶辫触"); } - updateDonateorgan(this.tableData[k]).then((response1) => { + updateDonateorgan(this.tableData[k]).then(response1 => { if (response1.code == 200) { this.$modal.msgSuccess("鍣ㄥ畼璁板綍淇敼鎴愬姛"); } @@ -1270,15 +1286,14 @@ //鏇存柊鎹愮尞鐘舵�� this.curCase.recordstate = 12; - updateDonatebaseinfo(this.curCase).then((response) => { + updateDonatebaseinfo(this.curCase).then(response => { //this.$modal.msgSuccess("瀹℃牳鎴愬姛"); //this.isShowReviewDialog = false; this.getList(); }); }); } - } - else{ + } else { this.loading = false; } }); @@ -1289,32 +1304,32 @@ this.$confirm("鏄惁纭灏嗙櫥璁拌褰曚笂鎶ワ紵", "鎻愮ず", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", - type: "warning", + type: "warning" }) .then(() => { //鏌ユ壘鏄惁瀛樺湪鐧昏瀹屾垚璁板綍 //鍒ゆ柇鏄惁瀛樺湪涓婃姤璁板綍 let searchParam = { - infoid: row.id, + infoid: row.id }; console.log("涓婃姤鍙傛暟", searchParam); - listDonatecompletioninfo(searchParam).then((response) => { + listDonatecompletioninfo(searchParam).then(response => { console.log("涓婃姤", response); if (response.code == 200 && response.rows.length == 1) { row.recordstate = 13; row.birthday = this.$moment(row.birthday).format( "YYYY-MM-DD HH:mm:ss" ); - updateDonatebaseinfo(row).then((response1) => { + updateDonatebaseinfo(row).then(response1 => { this.$message({ type: "success", - message: "涓婃姤鎴愬姛", + message: "涓婃姤鎴愬姛" }); }); } else { this.$message({ type: "error", - message: "鎹愮尞瀹屾垚鐧昏璁板綍涓嶅瓨鍦紒", + message: "鎹愮尞瀹屾垚鐧昏璁板綍涓嶅瓨鍦紒" }); } this.loading = false; @@ -1323,7 +1338,7 @@ .catch(() => { this.$message({ type: "info", - message: "宸插彇娑堜笂鎶�", + message: "宸插彇娑堜笂鎶�" }); }); }, @@ -1332,18 +1347,36 @@ handledownload(row) { const id = row.id || this.ids; console.log("22222", row); - downloadcompletioninfo(row.dcid).then((response) => { - var fileUrl = response; + downloadcompletioninfo(row.dcid).then(res => { + var fileUrl = res; //鑾峰彇褰撳墠缃戝潃 var urlBase = process.env.VUE_APP_BASE_API; var curWWWPath = window.document.location.href; var pos = curWWWPath.indexOf(window.document.location.pathname); - // 鍒涘缓a鏍囩 var aEle = document.createElement("a"); aEle.href = curWWWPath.substring(0, pos) + urlBase + fileUrl["downloadUrl"]; - aEle.click(); + console.log(aEle.href); + // 娣诲姞Authorization澶撮儴 + fetch(aEle.href, { + headers: this.headers + }) + .then(response => { + // 灏嗘枃浠朵笅杞介摼鎺ヤ綔涓篵lob瀵硅薄杩涜涓嬭浇 + return response.blob(); + }) + .then(blob => { + const url = window.URL.createObjectURL(new Blob([blob])); + console.log(url); + const link = document.createElement("a"); + link.href = url; + const name = fileUrl["downloadName"]; + link.setAttribute("download", name); // 鏇挎崲file.pdf涓哄疄闄呯殑鏂囦欢鍚� + document.body.appendChild(link); + link.click(); + link.parentNode.removeChild(link); + }); }); }, @@ -1351,9 +1384,9 @@ GetDonortedList(row) { this.loading = true; let oraganqueryParam = { - infoid: row.infoid, + infoid: row.infoid }; - listDonateorgan(oraganqueryParam).then((response) => { + listDonateorgan(oraganqueryParam).then(response => { this.loading = false; if (response.code == 200) { this.form.donateorganList = []; @@ -1366,7 +1399,7 @@ // this.$modal.msgError("鑾峰彇鎹愮尞鍣ㄥ畼澶辫触锛�" + response.msg); } }); - }, - }, + } + } }; </script> -- Gitblit v1.9.3