Browse Source

fix: 优化批量下发选择通报期数慢问题

master
buaixuexideshitongxue 2 weeks ago
parent
commit
623fd6d947
  1. 8
      src/api/superviseReport/superviseReport.ts
  2. 34
      src/views/work/BatchDistribute.vue

8
src/api/superviseReport/superviseReport.ts

@ -1,5 +1,13 @@
import request from "@/api/request"; import request from "@/api/request";
// 通报期数下拉选项,仅返回报告ID和名称
export function getReportOptions(query) {
return request.get({
url: '/supervise/report/options',
query
});
}
/** /**
* 获取数据 * 获取数据
* */ * */

34
src/views/work/BatchDistribute.vue

@ -210,6 +210,7 @@
clearable clearable
reserve-keyword reserve-keyword
@change="setReportNameFun(row)" @change="setReportNameFun(row)"
@visible-change="visible => visible && getReportListDataFun()"
placeholder="请选择通报期数" placeholder="请选择通报期数"
:remote-method="getReportListDataFun" :remote-method="getReportListDataFun"
:loading="reportLoading" :loading="reportLoading"
@ -725,7 +726,7 @@ import {
import feedback from "@/utils/feedback"; import feedback from "@/utils/feedback";
import useCatchStore from "@/stores/modules/catch"; import useCatchStore from "@/stores/modules/catch";
import { BASE_PATH } from "@/api/request"; import { BASE_PATH } from "@/api/request";
import {getListData,getReportDetailFun} from "@/api/superviseReport/superviseReport"; import {getReportOptions} from "@/api/superviseReport/superviseReport";
const catchStore = useCatchStore(); const catchStore = useCatchStore();
const dict = catchStore.getDicts([ const dict = catchStore.getDicts([
@ -907,32 +908,31 @@ watch(auditImportShow, (val) => {
}); });
const reportQuery = ref({
current: 1,
size: 100,
departBranch:false
})
const reportList = ref([]); const reportList = ref([]);
const reportLoading = ref(false); const reportLoading = ref(false);
let reportRequestId = 0;
const getReportListDataFun = async (val=null)=>{ const getReportListDataFun = async (val=null)=>{
const requestId = ++reportRequestId;
reportLoading.value=true; reportLoading.value=true;
try{ try{
if(val){ const res = await getReportOptions({reportName: val || undefined});
reportQuery.value.reportName = val; if(requestId === reportRequestId){
}else{ reportList.value=res;
reportQuery.value.reportName =null;
} }
const res = await getListData(reportQuery.value);
reportList.value=res.records;
reportLoading.value=false;
}catch (e){ }catch (e){
reportLoading.value=false; if(requestId === reportRequestId){
reportList.value=[];
}
}finally{
if(requestId === reportRequestId){
reportLoading.value=false;
}
} }
} }
const setReportNameFun = async(row)=>{ const setReportNameFun = (row)=>{
let res = await getReportDetailFun(row.reportId); const report = reportList.value.find(item => item.id === row.reportId);
row.reportNumber=res?.reportName; row.reportNumber=report?.reportName || "";
} }

Loading…
Cancel
Save