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 [check, setCheck] = useState([]);
const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" }; const checkboxcss = { width: "25%", height: 16, margin: "0 0 20px 0" };
const checkItem = localStorage.getItem(tableType);
useEffect(() => { useEffect(() => {
// //
const checkItem = localStorage.getItem(tableType);
setCheck(checkItem ? JSON.parse(checkItem) : []) setCheck(checkItem ? JSON.parse(checkItem) : [])
ischeck(); ischeck();
}, []); }, []);
@ -73,7 +72,20 @@ function Setup (props) {
defaultValue={check} defaultValue={check}
aria-label="表格属性设置" aria-label="表格属性设置"
onChange={(check) => { 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); setCheck(check);
}
ischeck(); ischeck();
}} }}
> >
@ -105,7 +117,7 @@ function Setup (props) {
key={itm.value} key={itm.value}
value={itm.value} value={itm.value}
style={checkboxcss} style={checkboxcss}
disabled={ischeck(itm.value)} disabled={itm.disabled ? itm.disabled : ischeck(itm.value)}
> >
{itm.name} {itm.name}
</Checkbox> </Checkbox>

16
web/client/src/sections/humanAffairs/containers/leaveStatistics.jsx

@ -33,14 +33,14 @@ const leaveStatistics = (props) => {
const [tableList, setTableList] = useState([{ const [tableList, setTableList] = useState([{
title: '展示信息', title: '展示信息',
list: [ list: [
{ name: "姓名", value: "userName" }, { name: "姓名", value: "userName", disabled: true },
{ name: "所属部门", value: "departmrnt" }, { name: "所属部门", value: "departmrnt", disabled: true },
{ name: "职位", value: "roleName" }, { name: "职位", value: "roleName", disabled: true },
{ name: "在职状态", value: "inStatus" }, { name: "在职状态", value: "inStatus", disabled: true },
{ name: "合计请假时长", value: "vacateDayStatisticDuration" }, { name: "合计请假时长", value: "vacateDayStatisticDuration", disabled: true },
{ name: "合计请假次数", value: "vacateCount" }, { name: "合计请假次数", value: "vacateCount", disabled: true },
{ name: "备注", value: "remark" }, { name: "备注", value: "remark", disabled: true },
{ name: "操作", value: "operate" }, { name: "操作", value: "operate", disabled: true },
] ]
}]);// }]);//
useEffect(() => { useEffect(() => {

Loading…
Cancel
Save