Browse Source

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

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

22
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) => {
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>

26
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) => {
</span>
),
width: 200,
fixed:true,
fixed: true,
dataIndex: "userCode",
key: "userCode",
sorter: (a, b) => { },
@ -118,7 +118,7 @@ const leaveStatistics = (props) => {
</div>
),
width: 100,
fixed:true,
fixed: true,
dataIndex: "userName",
key: "userName",
render: (_, r, index) => {
@ -131,7 +131,7 @@ const leaveStatistics = (props) => {
</div>
),
width: 200,
fixed:true,
fixed: true,
dataIndex: "departmrnt",
key: "departmrnt",
render: (_, r, index) => {
@ -174,7 +174,7 @@ const leaveStatistics = (props) => {
</div>
),
width: 150,
fixed:true,
fixed: true,
dataIndex: "roleName",
key: "roleName",
render: (_, r, index) => {
@ -213,7 +213,7 @@ const leaveStatistics = (props) => {
</div>
),
width: 120,
fixed:true,
fixed: true,
dataIndex: "inStatus",
key: "inStatus",
render: (_, r, index) => {

Loading…
Cancel
Save