From 3cf586012701bb1e7d598f9b94e24919d33400e7 Mon Sep 17 00:00:00 2001 From: Archer_cdm Date: Tue, 28 Mar 2023 13:58:18 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=88fixed=EF=BC=899572=20=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=AD=97=E6=AE=B5=E5=9B=BA=E5=AE=9A=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E6=9C=89=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/components/setup.jsx | 24 ++++++++++++----- .../containers/leaveStatistics.jsx | 26 +++++++++---------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/web/client/src/components/setup.jsx b/web/client/src/components/setup.jsx index 41d8792..356c008 100644 --- a/web/client/src/components/setup.jsx +++ b/web/client/src/components/setup.jsx @@ -5,7 +5,7 @@ import { Checkbox, } from "@douyinfe/semi-ui"; -function Setup (props) { +function Setup(props) { const { close, tableType, @@ -15,14 +15,13 @@ function Setup (props) { const [check, setCheck] = useState([]); const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" }; - + const checkItem = localStorage.getItem(tableType); useEffect(() => { //获取是否勾选信息 - const checkItem = localStorage.getItem(tableType); setCheck(checkItem ? JSON.parse(checkItem) : []) ischeck(); }, []); - function ischeck (value) { + function ischeck(value) { if (check.length >= length) { if (check.includes(value)) { return false; @@ -73,7 +72,20 @@ function Setup (props) { defaultValue={check} aria-label="表格属性设置" onChange={(check) => { - setCheck(check); + const flag = tableList[0].list.filter(t => t.disabled); + if (flag.length > 0) { + const some = check.filter((e) => !JSON.parse(checkItem).some((e2) => e2 === e)) + let newArr = [] + JSON.parse(checkItem).forEach((e, index) => { + if (index == JSON.parse(checkItem).length - 2) { + newArr = newArr.concat(some) + } + newArr.push(e) + }) + setCheck(JSON.stringify(newArr) == checkItem ? check : newArr); + } else { + setCheck(check); + } ischeck(); }} > @@ -105,7 +117,7 @@ function Setup (props) { key={itm.value} value={itm.value} style={checkboxcss} - disabled={ischeck(itm.value)} + disabled={itm.disabled ? itm.disabled : ischeck(itm.value)} > {itm.name} diff --git a/web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx b/web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx index 4fbfa9f..6dc8776 100644 --- a/web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx +++ b/web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx @@ -33,14 +33,14 @@ const leaveStatistics = (props) => { const [tableList, setTableList] = useState([{ title: '展示信息', list: [ - { name: "姓名", value: "userName" }, - { name: "所属部门", value: "departmrnt" }, - { name: "职位", value: "roleName" }, - { name: "在职状态", value: "inStatus" }, - { name: "合计请假时长", value: "vacateDayStatisticDuration" }, - { name: "合计请假次数", value: "vacateCount" }, - { name: "备注", value: "remark" }, - { name: "操作", value: "operate" }, + { name: "姓名", value: "userName", disabled: true }, + { name: "所属部门", value: "departmrnt", disabled: true }, + { name: "职位", value: "roleName", disabled: true }, + { name: "在职状态", value: "inStatus", disabled: true }, + { name: "合计请假时长", value: "vacateDayStatisticDuration", disabled: true }, + { name: "合计请假次数", value: "vacateCount", disabled: true }, + { name: "备注", value: "remark", disabled: true }, + { name: "操作", value: "operate", disabled: true }, ] }]);//表格属性 useEffect(() => { @@ -95,7 +95,7 @@ const leaveStatistics = (props) => { ), width: 200, - fixed:true, + fixed: true, dataIndex: "userCode", key: "userCode", sorter: (a, b) => { }, @@ -118,7 +118,7 @@ const leaveStatistics = (props) => { ), width: 100, - fixed:true, + fixed: true, dataIndex: "userName", key: "userName", render: (_, r, index) => { @@ -131,7 +131,7 @@ const leaveStatistics = (props) => { ), width: 200, - fixed:true, + fixed: true, dataIndex: "departmrnt", key: "departmrnt", render: (_, r, index) => { @@ -174,7 +174,7 @@ const leaveStatistics = (props) => { ), width: 150, - fixed:true, + fixed: true, dataIndex: "roleName", key: "roleName", render: (_, r, index) => { @@ -213,7 +213,7 @@ const leaveStatistics = (props) => { ), width: 120, - fixed:true, + fixed: true, dataIndex: "inStatus", key: "inStatus", render: (_, r, index) => {