Commit 7e05b273 authored by 皮倩雯's avatar 皮倩雯

fix: 'web配置售后服务优化'

parent bbf5260e
Pipeline #75884 passed with stages
/* eslint-disable no-unused-expressions */
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Modal, Input, Button, message, Spin, Pagination, Table, Tooltip, Space } from 'antd';
import { GetGroupUserTree } from '@/services/messagemanage/messagemanage';
......@@ -7,7 +8,7 @@ import styles from './index.less';
import CardCheck from './CardCheck';
const SelectUser = props => {
const { callBackSubmit, onCancel, visible, itemObj, aftercare } = props;
const { callBackSubmit, onCancel, visible, itemObj, aftercare, checkValueList } = props;
const [allList, setAllist] = useState([]); // 用于展示得数据
const [checkList, setCheckList] = useState([]); // 选中得数据集合
const [loading, setLoading] = useState(false);
......@@ -53,19 +54,19 @@ const SelectUser = props => {
Promise.all([p2]).then(res => {
if (res[0].code === 0) {
setTotal(res[0].data.count);
let checkedListAll = [];
console.log(itemObj);
if (aftercare !== '请勾选不显示售后服务的用户') {
itemObj.length > 0 &&
itemObj.forEach((i, j) => {
checkedListAll.push({
label: aftercare.split(',')[j],
value: i,
});
});
}
// let checkedListAll = [];
// if (aftercare !== '请勾选不显示售后服务的用户') {
// itemObj.length > 0 &&
// checkValueList.forEach((i, j) => {
// checkedListAll.push({
// label: i.userName,
// value: i.userId,
// groupName: i.groupName,
// });
// });
// }
setCheckList(checkedListAll);
// setCheckList(checkedListAll);
// if (itemObj) {
// res[0].data.data.map(item => {
// item.users.map(val => {
......@@ -84,6 +85,20 @@ const SelectUser = props => {
// });
// setCheckList(checkedListAll);
// }
// console.log(checkValueList);
let listCheck = [];
console.log(checkValueList);
debugger
checkValueList &&
checkValueList.map(item => {
let data = item.userId || item.value;
listCheck.push({
label: item.userName || item.label,
value: data.toString(),
groupName: item.groupName,
});
});
setCheckList(listCheck);
// 数据处理成checkbox组件需要得形式
let list = res[0].data.data.map(item => {
......@@ -91,7 +106,7 @@ const SelectUser = props => {
let checkedList = [];
let checkAll = false;
let options = item.users.map(val => {
checkedListAll.forEach(ele => {
listCheck.forEach(ele => {
if (val.userId === ele.value) {
checkedList.push(ele.value);
}
......@@ -131,6 +146,7 @@ const SelectUser = props => {
callBackSubmit({
text,
ids,
checkList,
});
};
// 搜索
......@@ -210,6 +226,7 @@ const SelectUser = props => {
const deleteRol = key => {
const dataSource = [...checkList];
setCheckList(dataSource.filter(item => item.value !== key));
console.log();
setDeleKey(key);
setDelFlag(delFlag + 1);
};
......@@ -225,7 +242,7 @@ const SelectUser = props => {
render: (text, record) => (
<span>
<Tooltip placement="topLeft" title={`${record.label}`}>
{record.label}
{record.label}{record.groupName}
</Tooltip>
</span>
),
......
......@@ -95,6 +95,7 @@ export default props => {
const homepageConfigRef = useRef();
const [addVisible, setAddVisible] = useState(false);
const [checkValue, setCheckValue] = useState([]);
const [checkValueList, setCheckValueList] = useState([]);
const [aftercare, setAftercare] = useState('请勾选不显示售后服务的用户');
useEffect(() => {
onGetLoginPages();
......@@ -189,6 +190,8 @@ export default props => {
: 'linear-gradient(0deg, #0066D6 0%, #39A9FF 100%)',
);
setCheckValue(config.afterSales);
debugger
setCheckValueList(config.afterSalesInfo);
if (!config.afterSales || config.afterSales === '') {
setAftercare('请勾选不显示售后服务的用户');
}
......@@ -240,6 +243,7 @@ export default props => {
setVisibleChecked5('');
setHomePageConfig([]);
setCheckValue([]);
setCheckValueList([]);
setAftercare('');
}
}, [visible]);
......@@ -402,6 +406,9 @@ export default props => {
};
const rolCallBack = useCallback(list => {
console.log(list);
debugger
setCheckValueList(list.checkList);
setAddVisible(false);
setAftercare(list.text === '' ? '请勾选不显示售后服务的用户' : list.text);
setCheckValue(list.ids);
......@@ -798,6 +805,7 @@ export default props => {
callBackSubmit={roleList => rolCallBack(roleList)}
itemObj={checkValue && checkValue.toString().split(',')} // 单选框中的值
aftercare={aftercare}
checkValueList={checkValueList}
/>
</Drawer>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment