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";
// 通报期数下拉选项,仅返回报告ID和名称
export function getReportOptions(query) {
return request.get({
url: '/supervise/report/options',
query
});
}
/**
* 获取数据
* */

34
src/views/work/BatchDistribute.vue

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

Loading…
Cancel
Save