diff --git a/src/api/api.js b/src/api/api.js index ce07197..548d25e 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -1,8 +1,15 @@ import request from "@/api/request"; import mm from "@/utlis/mm"; +import { Loading } from 'element-ui'; export async function getapi(url, params = {}, config) { return new Promise((resolve, reject) => { + let loading = Loading.service({ + lock: true, + text: "Loading...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); request .get(`${mm.apiurl}${url}`, { params: params, @@ -13,6 +20,9 @@ export async function getapi(url, params = {}, config) { }) .catch((err) => { reject(err.data); + }) + .finally(() => { + loading.close(); }); }); } @@ -20,6 +30,12 @@ export async function getapi(url, params = {}, config) { //axios封装post export async function postapi(url, paramsdata = {}, config) { return new Promise((resolve, reject) => { + let loading = Loading.service({ + lock: true, + text: "Loading...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); request .post(`${mm.apiurl}${url}`, paramsdata, config) .then((res) => { @@ -27,12 +43,21 @@ export async function postapi(url, paramsdata = {}, config) { }) .catch((err) => { reject(err.data); + }) + .finally(() => { + loading.close(); }); }); } //axios封装deleteapi export async function deletapi(url, params = {}, config) { return new Promise((resolve, reject) => { + let loading = Loading.service({ + lock: true, + text: "Loading...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); request .delete(`${mm.apiurl}${url}`, { params: params, @@ -43,12 +68,21 @@ export async function deletapi(url, params = {}, config) { }) .catch((err) => { reject(err.data); + }) + .finally(() => { + loading.close(); }); }); } //axios封装Put方法 export async function putapi(url, params = {}, config) { return new Promise((resolve, reject) => { + let loading = Loading.service({ + lock: true, + text: "Loading...", + spinner: "el-icon-loading", + background: "rgba(0, 0, 0, 0.7)", + }); request .put(`${mm.apiurl}${url}`, params, config) .then((res) => { @@ -56,6 +90,9 @@ export async function putapi(url, params = {}, config) { }) .catch((err) => { reject(err.data); + }) + .finally(() => { + loading.close(); }); }); } diff --git a/src/components/doctorCheck/PatientRegisterList.vue b/src/components/doctorCheck/PatientRegisterList.vue index b3b1c3b..4d94e7f 100644 --- a/src/components/doctorCheck/PatientRegisterList.vue +++ b/src/components/doctorCheck/PatientRegisterList.vue @@ -361,21 +361,22 @@ export default { // "maxResultCount": 0 console.log('/api/patientregister/getpeisrecordlist', body) - const loading = this.$loading({ - lock: true, - text: "Loading", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); + // const loading = this.$loading({ + // lock: true, + // text: "Loading", + // spinner: "el-icon-loading", + // background: "rgba(0, 0, 0, 0.7)", + // }); postapi('/api/patientregister/getpeisrecordlist', body) .then((res) => { if(res.code != -1){ this.dataList = res.data.items; - } - loading.close(); - }).catch(err =>{ - loading.close(); - }); + } + }) + // .finally(() =>{ + // loading.close(); + // }) + ; }, diff --git a/src/components/patientRegister/PatientRegisterList.vue b/src/components/patientRegister/PatientRegisterList.vue index b97b34b..a90a658 100644 --- a/src/components/patientRegister/PatientRegisterList.vue +++ b/src/components/patientRegister/PatientRegisterList.vue @@ -171,7 +171,7 @@ @close="close_dialogWin_PatientRegisterEdit"> + :editTimes="editTimes" :refreshRegister="refreshRegister" :refFuncSetData="refFuncSetData" /> @@ -591,11 +591,11 @@ export default { // this.getPatientRegisterAbs(); this.dataTransOpts.tableS.patient_register.id = '' - this.dialogWin.PatientRegisterEdit = true; + this.dialogWin.PatientRegisterEdit = true; this.dataTransOpts.plus.clearPatientRegisterQuery++ //触发清空人员登记界面的查询条件 setTimeout(() => { this.dataTransOpts.refresh.patient_register.S++ //触发人员信息刷新 - }, 10); + }, 10); }, @@ -659,32 +659,32 @@ export default { async close_dialogWin_PatientRegisterEdit() { // 如果 dataTransOpts.tableS.patient_register.id 为空(未增加),则不做处理 let id = this.dataTransOpts.tableS.patient_register.id - if (!id){ + if (!id) { id = this.tableDataCurrentRow.id } - if(!id) return + if (!id) return this.dataTransOpts.tableS.patient_register.id = id - + let res = await postapi(`/api/app/patientregister/getinfoorpatient?PatientRegisterId=${this.dataTransOpts.tableS.patient_register.id}`) if (res.code != 1) return let currentRow = res.data - + // this.tableData.forEach(e => { // e.choosed = false // }); let lfind = arrayExistObj(this.tableData, 'id', this.dataTransOpts.tableS.patient_register.id) - if (lfind > -1) { - objCopy(currentRow,this.tableData[lfind]) + if (lfind > -1) { + objCopy(currentRow, this.tableData[lfind]) } else { lfind = this.tableData.length currentRow.index = lfind currentRow.choosed = true - this.tableData.push(currentRow) + this.tableData.push(currentRow) } // 刷新 register_check_asbitem 表记录 if (lfind > -1) { - this.dataTransOpts.refresh.register_check_asbitem.M++ + this.dataTransOpts.refresh.register_check_asbitem.M++ } }, @@ -840,36 +840,33 @@ export default { }; console.log("/api/app/patientregister/getlistinfilter", body); - const loading = this.$loading({ - lock: true, - text: "Loading", - spinner: "el-icon-loading", - background: "rgba(0, 0, 0, 0.7)", - }); - let res = await postapi("/api/app/patientregister/getlistinfilter", body) - if (res.code != -1) { - // 刷新最大记录数 - this.loadOpts.totalCount = res.data.totalCount - let curLoad = res.data.items - let oldCount = 0 + postapi("/api/app/patientregister/getlistinfilter", body) + .then(res => { + if (res.code != -1) { + // 刷新最大记录数 + this.loadOpts.totalCount = res.data.totalCount + let curLoad = res.data.items + let oldCount = 0 + + if (body.skipCount == 0) { //查询 + this.tableData = []; + } else { + // 懒加载 ,原数据集不用清空 + oldCount = this.tableData.length + } + curLoad.forEach((e, index) => { + this.tableData.push(Object.assign({ index: Number(oldCount) + Number(index), choosed: false }, e)) + }) - if (body.skipCount == 0) { //查询 - this.tableData = []; - } else { - // 懒加载 ,原数据集不用清空 - oldCount = this.tableData.length - } - curLoad.forEach((e, index) => { - this.tableData.push(Object.assign({ index: Number(oldCount) + Number(index), choosed: false }, e)) + //如果 有选中 记录,则刷新其对应的组合项目 + if (this.dataTransOpts.tableS.patient_register.id) { + this.dataTransOpts.refresh.register_check_asbitem.M++ + } + } }) - //如果 有选中 记录,则刷新其对应的组合项目 - if (this.dataTransOpts.tableS.patient_register.id) { - this.dataTransOpts.refresh.register_check_asbitem.M++ - } - } - loading.close(); + }, //滚动加载数据 @@ -893,8 +890,6 @@ export default { } }) }, - - //右击菜单 onCellRightClick(row, column) { this.rClickRow = { ...row }; //右击的行记录 @@ -974,7 +969,7 @@ export default { if (this.multipleSelection.length < 1) { this.$message.info("请选择要操作的记录!"); return; - } + } this.dataTransOpts.plus.PatientRegisterEditGroupBatch++ this.dialogWin.PatientRegisterEditGroupBatch = true; @@ -1000,7 +995,7 @@ export default { } this.dataTransOpts.plus.PatientRegisterEditItemBatch++ //如果放在弹窗显示后面,在首次加载子组件时,会触发两次数据处理 - this.dialogWin.PatientRegisterEditItemBatch = true; + this.dialogWin.PatientRegisterEditItemBatch = true; },