Browse Source

(fixed)9572 列表字段固定展示有误

master
Archer_cdm 2 years ago
parent
commit
3cf5860127
  1. 18
      web/client/src/components/setup.jsx
  2. 16
      web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx

18
web/client/src/components/setup.jsx

@ -15,10 +15,9 @@ 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();
}, []);
@ -73,7 +72,20 @@ function Setup (props) {
defaultValue={check}
aria-label="表格属性设置"
onChange={(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}
</Checkbox>

16
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(() => {

Loading…
Cancel
Save