From cbc06063f00c2d300b77874f28e2ea350b9ed1b9 Mon Sep 17 00:00:00 2001 From: qzc Date: Tue, 15 Oct 2024 16:11:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=9B=91=E7=9D=A3=E8=80=83?= =?UTF-8?q?=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.js | 12 ++++++------ src/views/rcgl/jdkh/khrwgl/PfDetail.js | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index ef1850f2e..85be348c9 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -40,12 +40,12 @@ async function send(url, options) { } const { code } = res.data; - if (code === 401) { - //debugger; - //window.location.href = '/mgr/home';// /mgr/home /login - window.location.href = '/tsg/#/login'; - // window.location.hash = '#/login'; - } + // if (code === 401) { + // // debugger; + // //window.location.href = '/mgr/home';// /mgr/home /login + // window.location.href = '/tsg/#/login'; + // // window.location.hash = '#/login'; + // } return res.data; } catch (e) { //message.error(e); diff --git a/src/views/rcgl/jdkh/khrwgl/PfDetail.js b/src/views/rcgl/jdkh/khrwgl/PfDetail.js index 8681e893a..2636c553f 100644 --- a/src/views/rcgl/jdkh/khrwgl/PfDetail.js +++ b/src/views/rcgl/jdkh/khrwgl/PfDetail.js @@ -241,6 +241,23 @@ const EditableRow = ({ index, ...props }) => { }) return arr } + + const handleTableData2 = (obj) => { + const names = Object.values(obj)?.[0]?.map(o=>o.teamUserName) + const obj2 = {} + for(let key in obj){ + const arr = [] + names?.map((name)=>{ + obj?.[key]?.map((item)=>{ + if(name===item.teamUserName){ + arr.push(item) + } + }) + }) + obj2[key] = arr + } + return obj2 + } // 获取清单查看数据 const [qdColumns, setQdColumns] = useState(newcolumns) const [qdWidth, setQdWidth] = useState() @@ -248,7 +265,8 @@ const EditableRow = ({ index, ...props }) => { try { const res = await httpget2(apiurl.rcgl.jdkh.khrwgl.qdView + `/${id}`) if (res.code == 200) { - const result = handleTableData(res.data); + const linshi = handleTableData2(res.data)//将接口里用户的顺序统一 + const result = handleTableData(linshi); const insertCols = []; result.forEach((item, index, arr) => { const total = arr?.reduce((total, cur) => total + (cur["assessScore" + index] || 0), 0)