Commit c03a321b authored by 邓超's avatar 邓超

fix: 修改路由菜单,并修改各各菜单的路由跳转路径,测试推送页面添加分页

parent d983cf3d
Pipeline #39452 passed with stages
in 26 minutes 2 seconds
......@@ -57,7 +57,6 @@ const TableManager = props => {
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
useEffect(
record => {
console.log(343434)
loadTable(searchValue);
getField();
// if (props.history.location.query && selectTableName !== {}) {
......@@ -138,7 +137,7 @@ const TableManager = props => {
e.stopPropagation();
setFormObj(record);
history.push({
pathname: `/platformCenter/bsmanger/filedConfig/${record.tableName}`,
pathname: `/bsmanger/base/filedConfig/${record.tableName}`,
state: {
template: record,
tableScroll: document.querySelector('.ant-table-body').scrollTop,
......@@ -172,7 +171,7 @@ const TableManager = props => {
};
// 加载表
const loadTable = keyword => {
console.log(222)
console.log(222);
setTreeLoading(true);
CM_Table_LoadTable({
_version: 9999,
......@@ -350,18 +349,18 @@ const TableManager = props => {
];
// 模糊查询匹配的样式
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(searchValue, 'g'),
`<span style='color:red'>${searchValue}</span>`,
);
} else {
n = val;
}
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(searchValue, 'g'),
`<span style='color:red'>${searchValue}</span>`,
);
} else {
n = val;
}
return <div dangerouslySetInnerHTML={{ __html: n }} />;
};
return (
<Table
......@@ -373,9 +372,7 @@ const TableManager = props => {
onDoubleClick: event => {
event.stopPropagation();
history.push({
pathname: `/platformCenter/bsmanger/filedConfig/${
record.tableName
}`,
pathname: `/bsmanger/base/filedConfig/${record.tableName}`,
state: {
template: record,
tableScroll: document.querySelector('.ant-table-body')
......
......@@ -124,7 +124,7 @@ const Flow = () => {
// 跳转到对应的流程节点
const toNode = flowName => {
history.push({
pathname: '/platformCenter/bsmanger/flowNode',
pathname: '/bsmanger/workOrder/flowNode',
state: { flowName, pickItemIndex },
});
};
......
......@@ -312,7 +312,7 @@ const FlowNode = () => {
// 返回
const backFlow = () => {
history.push({
pathname: '/platformCenter/bsmanger/flow',
pathname: '/bsmanger/workOrder/flow',
state: { pickItemIndex },
});
};
......
......@@ -400,7 +400,7 @@ const incident = () => {
// }
const process1 = record => {
history.push({
pathname: '/platformCenter/bsmanger/incidentFlow',
pathname: '/bsmanger/workOrder/incidentFlow',
state: { formObj: record, title1: record.name, rember },
});
};
......@@ -411,7 +411,7 @@ const incident = () => {
// }
const auxiliaryView1 = record => {
history.push({
pathname: '/platformCenter/bsmanger/incidentView',
pathname: '/bsmanger/workOrder/incidentView',
state: { formObj: record, title2: record.name, rember },
});
};
......@@ -547,7 +547,7 @@ const incident = () => {
})}
columns={columns}
dataSource={tableData[pickItem]}
scroll={{ y: 'calc(100vh - 155px)', x: 'max-content' }}
// scroll={{ y: 'calc(100vh - 155px)', x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
......
......@@ -107,7 +107,7 @@ const incidentFlow = props => {
const back = () => {
let { rember } = props.location.state;
history.push({
pathname: '/platformCenter/bsmanger/incident',
pathname: '/bsmanger/workOrder/incident',
state: { rember },
});
};
......
......@@ -209,7 +209,7 @@ const incidentView = props => {
const back = () => {
let rember = props.location.state.rember;
history.push({
pathname: '/platformCenter/bsmanger/incident',
pathname: '/bsmanger/workOrder/incident',
state: { rember },
});
};
......
......@@ -358,7 +358,7 @@ const AddModal = props => {
const back = () => {
let { template, tableScroll } = props.location.state;
history.push({
pathname: '/platformCenter/bsmanger/tablemanger',
pathname: '/bsmanger/base/tablemanger',
query: {
template,
tableScroll,
......
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, useRef } from 'react';
import { Checkbox } from 'antd';
import styles from './PushTest.less';
const CheckboxGroup = Checkbox.Group;
const CardCheck = props => {
const { cardMsg, cardIndex, callback } = props;
const [checkedList, setCheckedList] = useState();
// 自定义获取改变后的值hooks
const usePrevious = value => {
const ref = useRef();
useEffect(() => {
ref.current = value;
});
return ref.current;
};
const { cardMsg, cardIndex, callback, checkList } = props;
const [checkedList, setCheckedList] = useState([]);
const [indeterminate, setIndeterminate] = useState(false);
const [checkAll, setCheckAll] = useState(false);
const [plainOptions, setPlainOptions] = useState([]);
const prevAmount = usePrevious({ checkedList });
useEffect(() => {
setPlainOptions(cardMsg.plainOptions);
setCheckedList(cardMsg.checkedList);
setIndeterminate(cardMsg.indeterminate);
setCheckAll(cardMsg.checkAll);
}, []);
useEffect(() => {
callback(checkedList, cardIndex);
if (prevAmount) {
let newCheckList = [...checkList];
// 当前选中的
let currentArr = checkedList;
// 上一次选中的
let preArr = prevAmount.checkedList;
currentArr = new Set(currentArr);
preArr = new Set(preArr);
// 找出相同的部分
let someArr = [...new Set([...currentArr].filter(x => preArr.has(x)))];
// 复选框事选中还是取消选中 add or del
let checkType;
if ([...currentArr].length > [...preArr].length) {
checkType = 'add';
} else if ([...currentArr].length < [...preArr].length) {
checkType = 'del';
}
if (checkType === 'add') {
// 添加新选中的元素
currentArr.forEach(item => {
if (someArr.indexOf(item) === -1) {
newCheckList.push(item);
}
});
} else if (checkType === 'del') {
// 删除取消勾选的元素
preArr.forEach(item => {
if (someArr.indexOf(item) === -1) {
newCheckList.splice(newCheckList.findIndex(ele => ele === item), 1);
}
});
}
callback(checkedList, newCheckList);
}
}, [checkedList]);
const onChange = list => {
console.log(list);
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
setCheckAll(list.length === plainOptions.length);
......
......@@ -4,38 +4,45 @@ import { GetGroupUserTree, TestPush } from '@/services/platform/messagemanage';
import styles from './PushTest.less';
import CardCheck from './CardCheck';
let checkList = [];
console.log(checkList, 'checkList');
const PushTest = props => {
const [form] = Form.useForm();
const { confirmModal, onCancel, visible, pushTestMsg } = props;
const [allList, setAllist] = useState([]);
const [allList, setAllist] = useState([]); // 用于展示得数据
const [checkList, setCheckList] = useState([]); // 选中得数据集合
const [loading, setLoading] = useState(false);
const [total, setTotal] = useState();
const [currentPage, setCurrentPage] = useState(1);
const [pageSize, setPageSize] = useState(10);
useEffect(() => {
if (visible) {
getData();
let username = form.getFieldValue('username');
getData(username, currentPage, pageSize);
} else {
checkList = [];
setCheckList([]);
setAllist([]);
form.setFieldsValue({ username: '' });
}
}, [visible]);
const checkCallBack = useCallback((val, index) => {
// 选中后得回调函数
const checkCallBack = useCallback((val, newCheckList) => {
if (val) {
checkList[index].checkedList = val;
setCheckList(newCheckList);
}
});
// 监听分页
const paginationChange = (page, pageSizes) => {
// 分页时清空复选框
setCurrentPage(page);
setPageSize(pageSizes);
let username = form.getFieldValue('username');
getData(username, page, pageSizes);
};
const onFinish = () => {
let newArr = checkList.reduce(
(total, currentValue) => [...total, ...currentValue.checkedList],
[],
);
if (pushTestMsg.ThemeName)
TestPush({
theme: pushTestMsg.ThemeName,
msgType: pushTestMsg.MsgType,
tousers: newArr,
tousers: checkList,
pushPath: pushTestMsg.item.AgentConfig
? pushTestMsg.item.AgentConfig.Url
: '',
......@@ -48,36 +55,58 @@ const PushTest = props => {
message.error(res.msg);
}
});
console.log(newArr, 'newArr');
};
const onSearch = () => {
getData({ key: form.getFieldsValue().username });
setCheckList([]);
let username = form.getFieldValue('username');
getData(username, currentPage, pageSize);
};
const getData = value => {
let obj = value ? value : {};
const getData = (username, page, pageSizes) => {
setLoading(true);
GetGroupUserTree(obj).then(res => {
console.log(res);
GetGroupUserTree({
key: username,
pageSize: pageSizes,
PageIndex: page,
}).then(res => {
setTotal(res.data.count);
let list = res.data.data.map(item => {
let indeterminate = false;
let checkedList = [];
let checkAll = false;
let options = item.users.map(val => {
checkList.forEach(ele => {
if (val.userId === ele) {
checkedList.push(ele);
}
});
return {
label: val.userName,
value: val.userId,
};
});
console.log(item.groupName, '名称');
console.log(checkList, '所有选择得列表');
console.log(checkedList, '当前组件勾选');
let list = res.data.map(item => {
let options = item.users.map(val => ({
label: val.userName,
value: val.userId,
}));
if (checkedList.length === options.length && checkedList.length > 0) {
checkAll = true;
}
if (checkedList.length < options.length && checkedList.length > 0) {
indeterminate = true;
}
return {
groupName: item.groupName,
groupId: item.groupId,
indeterminate: false,
checkAll: false,
indeterminate,
checkAll,
checkedList,
plainOptions: options,
checkedList: [],
};
});
checkList = list;
// checkList = list;
setAllist(list);
setTimeout(() => {
setLoading(false);
}, 0);
setLoading(false);
});
};
return (
......@@ -111,7 +140,8 @@ const PushTest = props => {
type="primary"
htmlType="submit"
onClick={() => {
getData();
setCheckList([]);
getData('', currentPage, pageSize);
form.setFieldsValue({ username: '' });
}}
>
......@@ -126,22 +156,26 @@ const PushTest = props => {
style={{ height: '500px', overflowY: 'scroll', margin: '20px 0' }}
>
{allList.map((item, index) => (
<div
className={styles.checkBoxContent}
key={item.groupId}
style={{
display: item.plainOptions.length > 0 ? 'block' : 'none',
}}
>
<div className={styles.checkBoxContent} key={item.groupId}>
<CardCheck
cardMsg={item}
cardIndex={index}
callback={(val, i) => checkCallBack(val, i)}
checkList={checkList}
/>
</div>
))}
</div>
</Spin>
<Pagination
total={total}
showTotal={item => `共 ${item} 条`}
defaultPageSize={pageSize}
defaultCurrent={1}
current={currentPage}
onChange={paginationChange}
style={{ marginBottom: '10px' }}
/>
</Modal>
</>
);
......
......@@ -269,76 +269,85 @@ export default {
},
{
path: '/platformCenter/bsmanger',
path: '/platformCenter/video',
name: '视频平台',
component: VideoManager,
},
],
},
{
path: '/bsmanger',
component: BlankLayout,
name: '业务中心',
icon: <CopyOutlined style={iconStyle} />,
routes: [
{
path: '/bsmanger/base',
name: '基础配置',
component: BlankLayout,
name: '业务平台',
icon: <CopyOutlined style={iconStyle} />,
routes: [
{
path: '/platformCenter/bsmanger/tablemanger',
path: '/bsmanger/base/tablemanger',
name: '表/字段',
component: TableManager,
},
{
path: '/platformCenter/bsmanger/filedConfig/:id',
path: '/bsmanger/base/filedConfig/:id',
name: '字段配置',
component: FiledConfig,
hideMenu: true,
},
{
path: '/platformCenter/bsmanger/standingBook',
path: '/bsmanger/base/standingBook',
name: '台账管理',
component: StandingBook,
},
],
},
{
path: '/bsmanger/workOrder',
name: '工单管理',
component: BlankLayout,
routes: [
{
path: '/platformCenter/bsmanger/incident',
path: '/bsmanger/workOrder/incident',
name: '事件',
component: Incident,
},
{
path: '/platformCenter/bsmanger/incidentFlow',
path: '/bsmanger/workOrder/incidentFlow',
name: '事件受理流程',
hideMenu: true,
component: IncidentFlow,
},
{
path: '/platformCenter/bsmanger/incidentView',
path: '/bsmanger/workOrder/incidentView',
name: '事件辅助视图',
hideMenu: true,
component: IncidentView,
},
{
path: '/platformCenter/bsmanger/flow',
path: '/bsmanger/workOrder/flow',
name: '流程',
component: Flow,
},
{
path: '/platformCenter/bsmanger/flowNode',
path: '/bsmanger/workOrder/flowNode',
name: '流程节点',
hideMenu: true,
component: FlowNode,
},
{
path: '/platformCenter/bsmanger/Workflow',
path: '/bsmanger/workOrder/Workflow',
name: '工作流编辑',
component: Workflow,
},
{
path: '/platformCenter/bsmanger/maintenance',
name: '巡维保',
component: Maintenance,
},
// {
// path: '/platformCenter/bsmanger/standbookmanager',
// name: '台账配置',
// component: TableManager,
// }
],
},
{
path: '/platformCenter/video',
name: '视频平台',
component: VideoManager,
path: '/bsmanger/maintenance',
name: '巡维保',
component: Maintenance,
},
],
},
......
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