From 2a1d89929776971da8582a0444f1d718ceefc582 Mon Sep 17 00:00:00 2001 From: chenglb Date: Mon, 29 Jan 2024 15:43:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=97=AE=E9=A2=98=E5=8D=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/TableModule/index.jsx | 2 +- src/config/ajax.js | 23 ++++++++++++---------- .../ParkingBusinessAly/CarTypeAly/loadable.jsx | 8 +++++--- .../InRoadMgm/PersonMgm/PersonInfo/loadable.jsx | 10 ++++------ .../OffPeak/OffPeakParkMgm/BreakInfo/loadable.jsx | 10 +++++----- .../OffPeakParkingRecords/loadable.jsx | 2 ++ .../BusinessConfig/HotCbdConf/loadable.jsx | 8 ++++++-- .../SystemMgm/BusinessConfig/PageConf/loadable.jsx | 3 +++ src/services/OperationCenter/AppMgm/index.js | 1 + 9 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/components/TableModule/index.jsx b/src/components/TableModule/index.jsx index 0403a84..13e65ee 100644 --- a/src/components/TableModule/index.jsx +++ b/src/components/TableModule/index.jsx @@ -1027,7 +1027,7 @@ const TableModule = forwardRef((props, ref) => { if (res.status === 20000) { setAreaList(res.data); } else { - res.message(res.data) + message.error(res.message) } }) .catch((err) => { diff --git a/src/config/ajax.js b/src/config/ajax.js index 204bac0..f3a7dac 100644 --- a/src/config/ajax.js +++ b/src/config/ajax.js @@ -7,8 +7,11 @@ import qs from 'qs' axios.defaults.baseURL = baseApi axios.defaults.timeout = 5 * 60 * 1000 axios.defaults.headers.common['Authorization'] = getToken() -window.queryRecord = {} // 临时方案, 对于查询比较慢的接口, 先统一在这里处理, todo, 后期每个接口再加loading, -// axios.defaults.headers.common['Authorization'] = `Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTk2MzAwNzUsInN1YiI6Inlpc2Ffand0IiwibmJmIjo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NDYsNDksNTAsNTEsNTIsNTMsNSw1Nyw1OCw1NCw1NSw1Niw3MSw3Miw1OSw2MCw2MSw2Miw2OSw3MCw3Myw3NCw3NSw3Niw3Nyw2NSw2Niw2Nyw2OCw2Myw2NCwyMywyNCwyNSwyNiwzNCwzNSwyOSwzMCwzMSwzMiw0Nyw0OCw3OCw3OSw4MCw4MSw4Miw4Myw4NCw4NSw4Niw4NyIsInBpZCI6MCwiaWRfbmFtZSI6IuiuuOe-pCJ9fQ.mYH-k_uKUDxysOiytBSRzOj4hWjKSxkTBVEpy4FnLe8` +window.queryRecord = {} // 临时方案, 对于查询比较慢的接口, 先统一在这里处理, todo, + +const createHash = ()=>{ + return location.hash.replace(/\?.*/, '').replace('#/',"").replace('/', '_') +} /** * @description 请求全局拦截 * @param {boolean} transFormData post方法 true转form提交表单方式 @@ -46,7 +49,7 @@ function ajax(ajaxData = {}) { // message.error('建议不要快速切换') }else{ // message.error('请勿重复操作') // todo 直接组织重复操作, 不提示 - console.error('重复操作') + console.log('重复操作') // 返回一个promise防止语法错误 return new Promise((resolve, reject)=>{ new Error(1) @@ -61,7 +64,9 @@ function ajax(ajaxData = {}) { } } // 新增逻辑 用于判断发起该请求的页面是否已经销毁 - ajaxData.data = {...ajaxData.data, pageHash: location.hash.replace(/\?.*/, '').replace('#/',"").replace('/', '_')} + if(!ajaxData.noPageHash){ + ajaxData.data = {...ajaxData.data, pageHash: createHash()} + } return new Promise((resolve, reject) => { if (!utils.isObject(ajaxData)) { return reject(new Error('ajax请求配置错误')) @@ -69,7 +74,6 @@ function ajax(ajaxData = {}) { let method = ajaxData.type || 'GET' method = method.toLowerCase() let url = ajaxData.mock && isDevelopment ? `/mock` + ajaxData.url : ajaxData.url - // let data = method === 'get' ? { params: ajaxData.data } : ajaxData.data let data = method === "get" || method === 'delete' ? { params: ajaxData.data }: ajaxData.data; axios[method](url, data) @@ -81,7 +85,7 @@ function ajax(ajaxData = {}) { window.queryRecord[res.config.url].ing = false } } - // if(location.hash.replace(/\?.*/, '') != JSON.parse(res.config.data)?.pageHash){ + // if(createHash() != JSON.parse(res.config.data)?.pageHash){ // console.log('页面已销毁') // resolve({message: "",status: 20000,data: [] }) // return @@ -93,7 +97,7 @@ function ajax(ajaxData = {}) { window.queryRecord[res.config.url].ing = false } } - // if(location.hash.replace(/\?.*/, '') != res.config.params.pageHash){ + // if(createHash() != res.config.params.pageHash){ // console.log('页面已销毁') // resolve({message: "", status: 20000,data: [] }) // return @@ -114,7 +118,7 @@ function ajax(ajaxData = {}) { if(JSON.parse(err.config.data)?.guard){ window.queryRecord[err.config.url].ing = false } - if(location.hash.replace(/\?.*/, '').replace('#/',"").replace('/', '_') != JSON.parse(err.config.data)?.pageHash){ + if(JSON.parse(err.config.data)?.pageHash && createHash() != JSON.parse(err.config.data)?.pageHash){ console.log('接口异常,但页面已销毁') reject(new Error(1)) return @@ -126,7 +130,7 @@ function ajax(ajaxData = {}) { window.queryRecord[err.config.url].ing = false } } - if(location.hash.replace(/\?.*/, '').replace('#/',"").replace('/', '_') != err.config.params.pageHash){ + if(err.config.params.pageHash && createHash() != err.config.params.pageHash){ console.log('接口异常,但页面已销毁') reject(new Error(1)) return @@ -138,7 +142,6 @@ function ajax(ajaxData = {}) { case 401: removeToken() window.location.replace(sysConfig.logout_url) - // window.location.replace("/#/login") message.error('登录失效') break case 500: diff --git a/src/pages/DataAnalysisPrediction/ParkingBusinessAly/CarTypeAly/loadable.jsx b/src/pages/DataAnalysisPrediction/ParkingBusinessAly/CarTypeAly/loadable.jsx index 05f0b93..ac30113 100644 --- a/src/pages/DataAnalysisPrediction/ParkingBusinessAly/CarTypeAly/loadable.jsx +++ b/src/pages/DataAnalysisPrediction/ParkingBusinessAly/CarTypeAly/loadable.jsx @@ -306,9 +306,9 @@ function CarTypeAly() { getParkingOption(res.data.energy) getCarTypeOption(res.data.car_type) } - // else { - // message.error('暂无数据') - // } + else { + message.error(res.message) + } }) .catch((err) => console.error(err)); } @@ -438,6 +438,8 @@ function CarTypeAly() { .then((res) => { if (res.status === 20000) { setAreaList(res.data); + }else{ + message.error(res.message) } }) .catch((err) => { diff --git a/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx b/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx index 473210c..45d85af 100644 --- a/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx +++ b/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx @@ -319,8 +319,6 @@ function PersonInfo() { }) }) setTranferAllData(temparr) - currentPersonInfo.good_ids = '', - currentPersonInfo.depart_id = '' } else { message.error(res.message) } @@ -332,8 +330,8 @@ function PersonInfo() { setTranferAllData([]) setDepartEditOptions([]) setAssetsEditOptions([]) - currentPersonInfo.good_ids = '', - currentPersonInfo.depart_id = '' + // currentPersonInfo.good_ids = '', + // currentPersonInfo.depart_id = '' } }, [getPersonId]) /** @@ -359,7 +357,7 @@ function PersonInfo() { const search = () => { setPageData({ pn: 1, - page_size: 20 + page_size: dictionary?.pageSizeOptions[0] }) } @@ -391,7 +389,7 @@ function PersonInfo() { property_id: '', road_name: '', pn: 1, - page_size: 20 + page_size:dictionary?.pageSizeOptions[0] } getData(params.current) setGetOperatorId('0') diff --git a/src/pages/OffPeak/OffPeakParkMgm/BreakInfo/loadable.jsx b/src/pages/OffPeak/OffPeakParkMgm/BreakInfo/loadable.jsx index a94b351..8180a14 100644 --- a/src/pages/OffPeak/OffPeakParkMgm/BreakInfo/loadable.jsx +++ b/src/pages/OffPeak/OffPeakParkMgm/BreakInfo/loadable.jsx @@ -19,6 +19,7 @@ function BreakInfo() { const tableRef = useRef() //搜索的总结果数 const [total, setTotal] = useState(0); + const [historyNum, setHistoryNum] = useState(0) const columns = [ { title: "姓名", @@ -97,11 +98,8 @@ function BreakInfo() { ]; //搜索参数初始化 const initFormData = { - merchantName: "0", - road_name: "", - parking_num: "", - operator: "", - exceedTime: "", + name: "", + tel: "" }; function search(params) { @@ -109,6 +107,7 @@ function BreakInfo() { if (res.status === 20000) { setTableData(res.data.list); setTotal(res.data.total); + setHistoryNum(res.data.set_nums ? res.data.set_nums : 0) }else{ message.error(res.message) } @@ -120,6 +119,7 @@ function BreakInfo() { const countSetting=()=>{ setVisible(true) setCurrentRecord({}) + setCount(historyNum) } const save = ()=>{ diff --git a/src/pages/OffPeak/OffPeakParkMgm/OffPeakParkingRecords/loadable.jsx b/src/pages/OffPeak/OffPeakParkMgm/OffPeakParkingRecords/loadable.jsx index dacb92b..9c13952 100644 --- a/src/pages/OffPeak/OffPeakParkMgm/OffPeakParkingRecords/loadable.jsx +++ b/src/pages/OffPeak/OffPeakParkMgm/OffPeakParkingRecords/loadable.jsx @@ -139,6 +139,8 @@ function OffPeakParkingRecords() { if (res.status === 20000) { setTableData(res.data.list); setTotal(res.data.total); + }else{ + message.error(res.message) } }); } diff --git a/src/pages/SystemMgm/BusinessConfig/HotCbdConf/loadable.jsx b/src/pages/SystemMgm/BusinessConfig/HotCbdConf/loadable.jsx index 6efd85f..c80539c 100644 --- a/src/pages/SystemMgm/BusinessConfig/HotCbdConf/loadable.jsx +++ b/src/pages/SystemMgm/BusinessConfig/HotCbdConf/loadable.jsx @@ -29,6 +29,7 @@ function HotCbdConf() { const [detailVisible, setDetailVisible] = useState(false); // const [tabKey, setTabKey] = useState("1"); const [treeData, setTreeData] = useState([]) + const [treeEditData, setTreeEditData] = useState([]) const [defaultParams, setDefaultParams] = useSessionStorageState('hotCbdConf_formData',{ defaultValue:{} }) @@ -283,8 +284,11 @@ function HotCbdConf() { ajax.getAreaTree() .then(res=>{ if(res.status == 20000){ - // tranverseTreeData(res.data) setTreeData(res.data) + if(res.data?.length){ + let newarr = res.data.slice(1, res.data.length) + setTreeEditData(newarr) + } }else{ message.error(res.message) } @@ -450,7 +454,7 @@ function HotCbdConf() { } return false }} - treeData={treeData} + treeData={treeEditData} /> diff --git a/src/pages/SystemMgm/BusinessConfig/PageConf/loadable.jsx b/src/pages/SystemMgm/BusinessConfig/PageConf/loadable.jsx index 0e108b1..853caf8 100644 --- a/src/pages/SystemMgm/BusinessConfig/PageConf/loadable.jsx +++ b/src/pages/SystemMgm/BusinessConfig/PageConf/loadable.jsx @@ -20,6 +20,9 @@ function PageConf() { dataIndex: "id", key: "id", align: "center", + render:(_,record, index)=>{ + return index + 1 + } }, { title: "数据项名称", diff --git a/src/services/OperationCenter/AppMgm/index.js b/src/services/OperationCenter/AppMgm/index.js index 52bf478..3dc0b36 100644 --- a/src/services/OperationCenter/AppMgm/index.js +++ b/src/services/OperationCenter/AppMgm/index.js @@ -15,6 +15,7 @@ const publishMenu = (params) => { url: "/api/ope/app_manage/publish_menu", type: "post", data: params, + noPageHash: true }); }; // 移动端管理配置 获取移动端管理数据