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