Commit 2bdca006 authored by 皮倩雯's avatar 皮倩雯

修改数据字典搜索状态编辑删除未保存搜索状态问题

parent 3cd24a36
Pipeline #38903 skipped with stages
/* eslint-disable react-hooks/rules-of-hooks */
/* /*
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2021-05-27 16:31:05 * @Date: 2021-05-27 16:31:05
* @LastEditTime: 2021-11-02 11:41:28 * @LastEditTime: 2021-11-26 16:43:17
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -20,7 +21,6 @@ import { ...@@ -20,7 +21,6 @@ import {
Button, Button,
Upload, Upload,
Search, Search,
} from 'antd'; } from 'antd';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import { import {
...@@ -31,21 +31,23 @@ import { ...@@ -31,21 +31,23 @@ import {
import { import {
SearchDataDictionaryList, SearchDataDictionaryList,
EditDataDictionary, EditDataDictionary,
DeleteDataDictionary DeleteDataDictionary,
} from '@/services/dataCenter/api'; } from '@/services/dataCenter/api';
import styles from './index.less';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import styles from './index.less';
const dictionary = () => { const dictionary = () => {
const [searchData, setSearchData] = useState([]); // 搜索框表格数据 const [searchData, setSearchData] = useState([]); // 搜索框表格数据
// eslint-disable-next-line react-hooks/rules-of-hooks
const [treeLoading, setTreeLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false);
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
const [editVisible, setEditVisible] = useState(false);//编辑二级条目 const [editVisible, setEditVisible] = useState(false); // 编辑二级条目
const [editVisible1, setEditVisible1] = useState(false);//编辑一级条目 const [editVisible1, setEditVisible1] = useState(false); // 编辑一级条目
const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级,修改/删除时设置 const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级,修改/删除时设置
const history = useHistory(); const history = useHistory();
const [editForm] = Form.useForm(); const [editForm] = Form.useForm();
const [title, setTitle] = useState('') const [title, setTitle] = useState('');
// eslint-disable-next-line no-shadow
const { Search } = Input; const { Search } = Input;
const columns2 = [ const columns2 = [
...@@ -104,12 +106,13 @@ const dictionary = () => { ...@@ -104,12 +106,13 @@ const dictionary = () => {
onClick={() => { onClick={() => {
setSelect(record); setSelect(record);
if (record.parentID === '-1' || record.parentID === null) { if (record.parentID === '-1' || record.parentID === null) {
setTitle('确认删除一级目录数据,删除一级目录数据会将其二级目录子数据一起删除'); setTitle(
'确认删除一级目录数据,删除一级目录数据会将其二级目录子数据一起删除',
);
} else { } else {
setTitle('确认删除二级条目数据'); setTitle('确认删除二级条目数据');
} }
} }}
}
style={{ style={{
fontSize: '16px', fontSize: '16px',
margin: '0px 10px', margin: '0px 10px',
...@@ -124,19 +127,19 @@ const dictionary = () => { ...@@ -124,19 +127,19 @@ const dictionary = () => {
}, },
]; ];
//修改 // 修改
const submitEdit = () => { const submitEdit = () => {
const nodeName = editForm.getFieldValue('nodeName'); const nodeName = editForm.getFieldValue('nodeName');
const nodeValue = editForm.getFieldValue('nodeValue'); const nodeValue = editForm.getFieldValue('nodeValue');
if (nodeName) { if (nodeName) {
EditDataDictionary({ EditDataDictionary({
nodeID: select.nodeID, nodeID: select.nodeID,
nodeName: nodeName, nodeName,
nodeValue: nodeValue nodeValue,
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
setEditVisible(false); setEditVisible(false);
sumbitSearch() sumbitSearch();
// getData(select.parentID === '-1' ? null : select.parentID); // getData(select.parentID === '-1' ? null : select.parentID);
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
...@@ -144,8 +147,6 @@ const dictionary = () => { ...@@ -144,8 +147,6 @@ const dictionary = () => {
// if (flag1 === 1) { // if (flag1 === 1) {
// sumbitSearch() // sumbitSearch()
// } // }
} else { } else {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
...@@ -159,18 +160,18 @@ const dictionary = () => { ...@@ -159,18 +160,18 @@ const dictionary = () => {
description: '名称不能为空', description: '名称不能为空',
}); });
} }
} };
const submitEdit1 = () => { const submitEdit1 = () => {
const nodeName = editForm.getFieldValue('nodeName'); const nodeName = editForm.getFieldValue('nodeName');
if (nodeName) { if (nodeName) {
EditDataDictionary({ EditDataDictionary({
nodeID: select.nodeID, nodeID: select.nodeID,
nodeName: nodeName, nodeName,
nodeValue: '-' nodeValue: '-',
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
setEditVisible1(false); setEditVisible1(false);
sumbitSearch() sumbitSearch();
// getData(select.parentID === '-1' ? null : select.parentID); // getData(select.parentID === '-1' ? null : select.parentID);
notification.success({ notification.success({
...@@ -192,7 +193,7 @@ const dictionary = () => { ...@@ -192,7 +193,7 @@ const dictionary = () => {
description: '名称不能为空', description: '名称不能为空',
}); });
} }
} };
const sumbitSearch = () => { const sumbitSearch = () => {
SearchDataDictionaryList({ key: searchWord }).then(res => { SearchDataDictionaryList({ key: searchWord }).then(res => {
...@@ -209,15 +210,16 @@ const dictionary = () => { ...@@ -209,15 +210,16 @@ const dictionary = () => {
}; };
const submitDelete = () => { const submitDelete = () => {
console.log(select) console.log(select);
DeleteDataDictionary({ DeleteDataDictionary({
nodeID: select.nodeID, nodeID: select.nodeID,
}).then(res => { })
.then(res => {
if (res.code === 0) { if (res.code === 0) {
// if (flag1 === 1) { // if (flag1 === 1) {
// sumbitSearch() // sumbitSearch()
// } // }
sumbitSearch() sumbitSearch();
notification.success({ notification.success({
message: '删除成功', message: '删除成功',
}); });
...@@ -230,8 +232,8 @@ const dictionary = () => { ...@@ -230,8 +232,8 @@ const dictionary = () => {
}) })
.catch(err => { .catch(err => {
message.error(err); message.error(err);
}) });
} };
// 获取搜索框的值 // 获取搜索框的值
const handleSearch = e => { const handleSearch = e => {
setSearchWord(e.target.value); setSearchWord(e.target.value);
...@@ -246,7 +248,7 @@ const dictionary = () => { ...@@ -246,7 +248,7 @@ const dictionary = () => {
}; };
const back = () => { const back = () => {
history.push({ history.push({
pathname: '/dataCenter/dictionary1' pathname: '/dataCenter/dictionary1',
}); });
}; };
...@@ -265,13 +267,17 @@ const dictionary = () => { ...@@ -265,13 +267,17 @@ const dictionary = () => {
/> />
</div> </div>
<div className={styles.btn}> <div className={styles.btn}>
<Button type="primary" icon={<RollbackOutlined />} onClick={() => back()}> <Button
type="primary"
icon={<RollbackOutlined />}
onClick={() => back()}
>
返回 返回
</Button> </Button>
</div> </div>
</div> </div>
<Table <Table
size='small' size="small"
bordered bordered
key="" key=""
columns={columns2} columns={columns2}
...@@ -281,14 +287,13 @@ const dictionary = () => { ...@@ -281,14 +287,13 @@ const dictionary = () => {
onRow={record => ({ onRow={record => ({
onClick: () => { onClick: () => {
setSelect(record); setSelect(record);
}, },
})} })}
/> />
</div> </div>
{/*修改一级条目 */} {/* 修改一级条目 */}
<Modal <Modal
title={'修改一级条目'} title="修改一级条目"
visible={editVisible1} visible={editVisible1}
onOk={submitEdit1} onOk={submitEdit1}
onCancel={() => { onCancel={() => {
...@@ -307,10 +312,10 @@ const dictionary = () => { ...@@ -307,10 +312,10 @@ const dictionary = () => {
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
{/*修改二级条目 */} {/* 修改二级条目 */}
<Modal <Modal
title={'修改二级条目'} title="修改二级条目"
visible={editVisible} visible={editVisible}
onOk={submitEdit} onOk={submitEdit}
onCancel={() => { onCancel={() => {
......
...@@ -140,7 +140,7 @@ const AppDic = () => { ...@@ -140,7 +140,7 @@ const AppDic = () => {
// message.error(err); // message.error(err);
// }); // });
GetKeyValue({}).then(resnew => { GetKeyValue({}).then(resnew => {
if (resnew.code == 0) { if (resnew.code === 0) {
let res = resnew.data; let res = resnew.data;
if (res.length > 0) { if (res.length > 0) {
res.map(item => { res.map(item => {
...@@ -152,6 +152,7 @@ const AppDic = () => { ...@@ -152,6 +152,7 @@ const AppDic = () => {
} else { } else {
notification.error({ notification.error({
message: '获取失败', message: '获取失败',
// eslint-disable-next-line no-undef
description: res.msg, description: res.msg,
}); });
} }
...@@ -196,7 +197,7 @@ const AppDic = () => { ...@@ -196,7 +197,7 @@ const AppDic = () => {
value, value,
desc: description, desc: description,
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code === 0) {
setAddVisible(false); setAddVisible(false);
getData(); getData();
notification.success({ notification.success({
...@@ -276,7 +277,7 @@ const AppDic = () => { ...@@ -276,7 +277,7 @@ const AppDic = () => {
value, value,
desc: description, desc: description,
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code === 0) {
setEditVisible(false); setEditVisible(false);
getData(); getData();
notification.success({ notification.success({
...@@ -354,8 +355,7 @@ const AppDic = () => { ...@@ -354,8 +355,7 @@ const AppDic = () => {
height: 'calc(100vh-200px)', height: 'calc(100vh-200px)',
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
justifyContent:'space-between' justifyContent: 'space-between',
}} }}
> >
<span>数据字典</span> <span>数据字典</span>
...@@ -370,7 +370,6 @@ const AppDic = () => { ...@@ -370,7 +370,6 @@ const AppDic = () => {
color: '#1890FF', color: '#1890FF',
fontSize: '20px', fontSize: '20px',
marginRight: '22px', marginRight: '22px',
}} }}
/> />
</Tooltip> </Tooltip>
...@@ -392,7 +391,6 @@ const AppDic = () => { ...@@ -392,7 +391,6 @@ const AppDic = () => {
</Tooltip> </Tooltip>
</Popconfirm> </Popconfirm>
</div> </div>
</div> </div>
<Table <Table
size="small" size="small"
......
...@@ -13,72 +13,85 @@ import { ...@@ -13,72 +13,85 @@ import {
Row, Row,
Col, Col,
Button, Button,
Upload Upload,
} from 'antd'; } from 'antd';
import { EditTwoTone, DeleteOutlined, CloudSyncOutlined, SearchOutlined, PlusSquareFilled, MinusCircleOutlined, PlusOutlined, LogoutOutlined, DownloadOutlined, UploadOutlined, SyncOutlined } from '@ant-design/icons'; import {
EditTwoTone,
DeleteOutlined,
PlusSquareFilled,
MinusCircleOutlined,
PlusOutlined,
DownloadOutlined,
UploadOutlined,
SyncOutlined,
} from '@ant-design/icons';
import { GetDataDictionaryList, EditDataDictionary, AddDataDictionary, DeleteDataDictionary, AddDataDictionaryList, SearchDataDictionaryList, ExportDataDictionary, ImportDataDictionary, DataDictionaryChangeOrder } from '@/services/dataCenter/api' import {
GetDataDictionaryList,
EditDataDictionary,
AddDataDictionary,
DeleteDataDictionary,
AddDataDictionaryList,
SearchDataDictionaryList,
DataDictionaryChangeOrder,
} from '@/services/dataCenter/api';
import styles from './WebDic.less'; import styles from './WebDic.less';
import { useHistory } from 'react-router-dom'; import { useHistory, Link } from 'react-router-dom';
import map from '@/pages/user/login/components/Login/map'; import map from '@/pages/user/login/components/Login/map';
import { Link } from 'react-router-dom';
import { GetMetaData } from '@/services/platform/gis'; import { GetMetaData } from '@/services/platform/gis';
import DragTable from '@/components/DragTable/DragTable'; import DragTable from '@/components/DragTable/DragTable';
const WebDic = () => { const WebDic = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [level, setLevel] = useState(0); // 设置级别,一级1,二级2,添加条目时使用 const [level, setLevel] = useState(0); // 设置级别,一级1,二级2,添加条目时使用
const [data, setData] = useState([]); // 一级条目数据 const [data, setData] = useState([]); // 一级条目数据
const [subData, setSubData] = useState([]); // 二级条目数据 const [subData, setSubData] = useState([]); // 二级条目数据
const [searchData, setSearchData] = useState([]);// 搜索框表格数据 const [searchData, setSearchData] = useState([]); // 搜索框表格数据
const [first, setFirst] = useState(true); // 是否第一次加载 const [first, setFirst] = useState(true); // 是否第一次加载
const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级,修改/删除时设置 const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级,修改/删除时设置
const [twoSelectColor, setTwoSelectColor] = useState({}); const [twoSelectColor, setTwoSelectColor] = useState({});
const [selectColor, setSelectColor] = useState({}); // 当前选中一级条目颜色,修改/删除时设置 const [selectColor, setSelectColor] = useState({}); // 当前选中一级条目颜色,修改/删除时设置
const [selectID, setSelectID] = useState('-1'); // 当前选中一级条目的ID,添加二级条目时使用 const [selectID, setSelectID] = useState('-1'); // 当前选中一级条目的ID,添加二级条目时使用
const [addVisible, setAddVisible] = useState(false);//添加二级条目 const [addVisible, setAddVisible] = useState(false); // 添加二级条目
const [addVisible1, setAddVisible1] = useState(false);//添加一级条目 const [addVisible1, setAddVisible1] = useState(false); // 添加一级条目
const [addForm] = Form.useForm(); const [addForm] = Form.useForm();
const [editVisible, setEditVisible] = useState(false);//编辑二级条目 const [editVisible, setEditVisible] = useState(false); // 编辑二级条目
const [editVisible1, setEditVisible1] = useState(false);//编辑一级条目 const [editVisible1, setEditVisible1] = useState(false); // 编辑一级条目
const [editForm] = Form.useForm(); const [editForm] = Form.useForm();
const [searchVisible, setSearchVisible] = useState(false); const [searchVisible, setSearchVisible] = useState(false);
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
const { Search } = Input; const { Search } = Input;
const [files, setFiles] = useState(''); const [files, setFiles] = useState('');
const [flag, setFlag] = useState(0); const [flag, setFlag] = useState(0);
const [flag1, setFlag1] = useState(0);//搜索框数据是否刷新 const [flag1, setFlag1] = useState(0); // 搜索框数据是否刷新
const [isloading, setIsloading] = useState(false) const [isloading, setIsloading] = useState(false);
const history = useHistory(); const history = useHistory();
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [orderTable, setOrderTable] = useState([]);
const [orderTable1, setOrderTable1] = useState([]);
const [fgg, setFgg] = useState(0);
const [InPutVisible, setInPutVisible] = useState(false); const [InPutVisible, setInPutVisible] = useState(false);
const columns = [ const columns = [
{ {
title: () => (<span className={styles.font}>序号</span>), title: () => <span className={styles.font}>序号</span>,
key: 'nodeID ', key: 'nodeID ',
dataIndex: 'nodeID', dataIndex: 'nodeID',
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<span>{(index + 1)}</span> <span>{index + 1}</span>
</Space> </Space>
), ),
width: 60, width: 60,
align: 'center' align: 'center',
}, },
{ {
title: () => (<span className={styles.font}>名称</span>), title: () => <span className={styles.font}>名称</span>,
dataIndex: 'nodeName', dataIndex: 'nodeName',
key: 'nodeName', key: 'nodeName',
render: item => searchStyle(item), render: item => searchStyle(item),
}, },
{ {
title: () => (<span className={styles.font}>操作</span>), title: () => <span className={styles.font}>操作</span>,
key: 'action', key: 'action',
width: 100, width: 100,
align: 'center', align: 'center',
...@@ -114,8 +127,7 @@ const WebDic = () => { ...@@ -114,8 +127,7 @@ const WebDic = () => {
if (record.parentID === '-1') { if (record.parentID === '-1') {
setSelectColor(record); setSelectColor(record);
} }
} }}
}
style={{ style={{
fontSize: '16px', fontSize: '16px',
margin: '0px 10px', margin: '0px 10px',
...@@ -132,24 +144,24 @@ const WebDic = () => { ...@@ -132,24 +144,24 @@ const WebDic = () => {
const columns1 = [ const columns1 = [
{ {
title: () => (<span className={styles.font}>序号</span>), title: () => <span className={styles.font}>序号</span>,
dataIndex: 'nodeID', dataIndex: 'nodeID',
key: 'nodeID', key: 'nodeID',
width: 60, width: 60,
align: 'center', align: 'center',
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<span>{(index + 1)}</span> <span>{index + 1}</span>
</Space> </Space>
), ),
}, },
{ {
title: () => (<span className={styles.font}>名称</span>), title: () => <span className={styles.font}>名称</span>,
dataIndex: 'nodeName', dataIndex: 'nodeName',
key: 'nodeName', key: 'nodeName',
}, },
{ {
title: () => (<span className={styles.font}></span>), title: () => <span className={styles.font}></span>,
dataIndex: 'nodeValue', dataIndex: 'nodeValue',
key: 'nodeValue', key: 'nodeValue',
render: record => { render: record => {
...@@ -160,7 +172,7 @@ const WebDic = () => { ...@@ -160,7 +172,7 @@ const WebDic = () => {
}, },
}, },
{ {
title: () => (<span className={styles.font}>操作</span>), title: () => <span className={styles.font}>操作</span>,
key: 'action', key: 'action',
width: 100, width: 100,
align: 'center', align: 'center',
...@@ -211,81 +223,79 @@ const WebDic = () => { ...@@ -211,81 +223,79 @@ const WebDic = () => {
}, },
]; ];
const columns2 = [ // const columns2 = [
{ // {
title: () => (<span className={styles.font}>名称</span>), // title: () => <span className={styles.font}>名称</span>,
dataIndex: 'nodeName', // dataIndex: 'nodeName',
key: 'nodeName', // key: 'nodeName',
}, // },
{ // {
title: () => (<span className={styles.font}></span>), // title: () => <span className={styles.font}>值</span>,
dataIndex: 'nodeValue', // dataIndex: 'nodeValue',
width: 400, // width: 400,
key: 'nodeValue', // key: 'nodeValue',
render: record => { // render: record => {
if (!record) { // if (!record) {
return '-'; // return '-';
} // }
return record; // return record;
}, // },
}, // },
{ // {
title: () => (<span className={styles.font}>操作</span>), // title: () => <span className={styles.font}>操作</span>,
key: 'action', // key: 'action',
width: 100, // width: 100,
align: 'center', // align: 'center',
render: record => ( // render: record => (
<Space> // <Space>
<Tooltip title="编辑"> // <Tooltip title="编辑">
<EditTwoTone // <EditTwoTone
onClick={() => { // onClick={() => {
setSelect(record); // setSelect(record);
if (record.parentID === '-1') { // if (record.parentID === '-1') {
setSelectColor(record); // setSelectColor(record);
} // }
if (record.parentID === '-1' || record.parentID === null) { // if (record.parentID === '-1' || record.parentID === null) {
setEditVisible1(true); // setEditVisible1(true);
} else { // } else {
setEditVisible(true); // setEditVisible(true);
} // }
editForm.setFieldsValue({ // editForm.setFieldsValue({
nodeName: record.nodeName, // nodeName: record.nodeName,
nodeValue: record.nodeValue, // nodeValue: record.nodeValue,
}); // });
}} // }}
style={{ fontSize: '16px' }} // style={{ fontSize: '16px' }}
/> // />
</Tooltip> // </Tooltip>
<div onClick={e => e.stopPropagation()}> // <div onClick={e => e.stopPropagation()}>
<Tooltip title="删除"> // <Tooltip title="删除">
<Popconfirm // <Popconfirm
title="是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?" // title="是否确认删除该数据,删除一级目录数据会将其二级目录子数据一起删除?"
okText="确认" // okText="确认"
cancelText="取消" // cancelText="取消"
onConfirm={submitDelete} // onConfirm={submitDelete}
> // >
<DeleteOutlined // <DeleteOutlined
onClick={() => { // onClick={() => {
setSelect(record); // setSelect(record);
if (record.parentID === '-1') { // if (record.parentID === '-1') {
setSelectColor(record); // setSelectColor(record);
} // }
// }}
} // style={{
} // fontSize: '16px',
style={{ // margin: '0px 10px',
fontSize: '16px', // color: '#e86060',
margin: '0px 10px', // }}
color: '#e86060', // />
}} // </Popconfirm>
/> // </Tooltip>
</Popconfirm> // </div>
</Tooltip> // </Space>
</div> // ),
</Space> // },
), // ];
}
]
// 模糊查询匹配的样式 // 模糊查询匹配的样式
const searchStyle = val => { const searchStyle = val => {
...@@ -301,13 +311,11 @@ const WebDic = () => { ...@@ -301,13 +311,11 @@ const WebDic = () => {
return <div dangerouslySetInnerHTML={{ __html: n }} />; return <div dangerouslySetInnerHTML={{ __html: n }} />;
}; };
const setRowClassName = record => { const setRowClassName = record =>
return record.nodeID === selectColor.nodeID ? styles.clickRowStyle : ''; record.nodeID === selectColor.nodeID ? styles.clickRowStyle : '';
}
const setRowClassName1 = record => { const setRowClassName1 = record =>
return record.nodeID === twoSelectColor.nodeID ? styles.clickRowStyle : ''; record.nodeID === twoSelectColor.nodeID ? styles.clickRowStyle : '';
}
// 获取搜索框的值 // 获取搜索框的值
const handleSearch = e => { const handleSearch = e => {
...@@ -315,10 +323,9 @@ const WebDic = () => { ...@@ -315,10 +323,9 @@ const WebDic = () => {
}; };
useEffect(() => { useEffect(() => {
getData(null);//首次加载可以为空 getData(null); // 首次加载可以为空
}, [flag]); }, [flag]);
// const setOd = e => { // const setOd = e => {
// setOrderTable(e) // setOrderTable(e)
// setFgg(fgg + 1) // setFgg(fgg + 1)
...@@ -336,7 +343,7 @@ const WebDic = () => { ...@@ -336,7 +343,7 @@ const WebDic = () => {
// 根据orderTable值改变flowIDs // 根据orderTable值改变flowIDs
useEffect(() => { useEffect(() => {
let ids = ''; let ids = '';
console.log(data) console.log(data);
data.forEach((item, index) => { data.forEach((item, index) => {
if (index === data.length - 1) { if (index === data.length - 1) {
ids += `${item.nodeID}`; ids += `${item.nodeID}`;
...@@ -344,19 +351,18 @@ const WebDic = () => { ...@@ -344,19 +351,18 @@ const WebDic = () => {
ids += `${item.nodeID},`; ids += `${item.nodeID},`;
} }
}); });
console.log(ids) console.log(ids);
let bb = ids.split(",") let bb = ids.split(',');
console.log(bb) console.log(bb);
setLoading(true) setLoading(true);
DataDictionaryChangeOrder(bb).then(res => { DataDictionaryChangeOrder(bb).then(res => {
setLoading(false) setLoading(false);
});
})
}, [data]); }, [data]);
useEffect(() => { useEffect(() => {
let ids = ''; let ids = '';
console.log(subData) console.log(subData);
if(subData != ''){ if (subData !== '') {
subData.forEach((item, index) => { subData.forEach((item, index) => {
if (index === subData.length - 1) { if (index === subData.length - 1) {
ids += `${item.nodeID}`; ids += `${item.nodeID}`;
...@@ -365,18 +371,18 @@ const WebDic = () => { ...@@ -365,18 +371,18 @@ const WebDic = () => {
} }
}); });
} }
console.log(ids) console.log(ids);
let bb = ids.split(",") let bb = ids.split(',');
console.log(bb) console.log(bb);
setIsloading(true) setIsloading(true);
DataDictionaryChangeOrder(bb).then(res => { DataDictionaryChangeOrder(bb).then(res => {
setIsloading(false) setIsloading(false);
}) });
}, [subData]); }, [subData]);
// 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1 // 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1
const getData = value => { const getData = value => {
console.log(value); console.log(value);
isLoadingShow(value, true) isLoadingShow(value, true);
GetDataDictionaryList({ nodeID: value }).then(resnew => { GetDataDictionaryList({ nodeID: value }).then(resnew => {
if (resnew.code === 0) { if (resnew.code === 0) {
// if (resnew.data.length > 0) { // if (resnew.data.length > 0) {
...@@ -386,61 +392,59 @@ const WebDic = () => { ...@@ -386,61 +392,59 @@ const WebDic = () => {
item.key = item.nodeID; item.key = item.nodeID;
return item; return item;
}); });
} }
//是否首次加载 // 是否首次加载
if (value === null || value === '-1') { if (value === null || value === '-1') {
setData(res); setData(res);
// setOd(res) // setOd(res)
console.log(res) console.log(res);
console.log(first) console.log(first);
if (first) { if (first) {
setSelect(res[0]); // 默认当前选中一级条目第一条 setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectColor(res[0]); setSelectColor(res[0]);
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目 setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
setFirst(false); setFirst(false);
getData(res[0].nodeID);//拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目 getData(res[0].nodeID); // 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
} }
} else if (value) { } else if (value) {
console.log(res); console.log(res);
setSubData(res);//设置二级条目,res为空[]时也要设置 setSubData(res); // 设置二级条目,res为空[]时也要设置
// setOd1(res) // setOd1(res)
} }
isLoadingShow(value, false) isLoadingShow(value, false);
// } else { // } else {
// console.log(3) // console.log(3)
// isLoadingShow(value, false) // isLoadingShow(value, false)
// } // }
} else { } else {
isLoadingShow(value, false) isLoadingShow(value, false);
notification.error({ notification.error({
message: '获取失败', message: '获取失败',
description: resnew.msg, description: resnew.msg,
}); });
} }
}); });
}; };
// eslint-disable-next-line no-shadow
const isLoadingShow = (value, data) => { const isLoadingShow = (value, data) => {
if (!value || value == -1) { if (!value || value === -1) {
setLoading(data); setLoading(data);
} else {
setIsloading(data);
} }
else { };
setIsloading(data)
}
}
// const onSearch = () => { // const onSearch = () => {
// setSearchVisible(true) // setSearchVisible(true)
// setFlag1(1) // setFlag1(1)
// } // }
const onSearch = () => { // const onSearch = () => {
history.push({ // history.push({
pathname: '/dataCenter/dictionary' // pathname: '/dataCenter/dictionary',
}); // });
} // };
//搜索 // 搜索
const sumbitSearch = () => { const sumbitSearch = () => {
SearchDataDictionaryList({ key: searchWord }).then(res => { SearchDataDictionaryList({ key: searchWord }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -452,16 +456,16 @@ const WebDic = () => { ...@@ -452,16 +456,16 @@ const WebDic = () => {
// description: res.message, // description: res.message,
// }) // })
// } // }
}) });
} };
const resetSearch = () => { // const resetSearch = () => {
setFlag1(0) // setFlag1(0);
setSearchVisible(false); // setSearchVisible(false);
setSearchWord(''); // 搜索框置空 // setSearchWord(''); // 搜索框置空
setSearchData([]); // setSearchData([]);
} // };
//上传 // 上传
// const submitInPut = () => { // const submitInPut = () => {
// ImportDataDictionary({ file: files }).then((res) => { // ImportDataDictionary({ file: files }).then((res) => {
// if (res.code === 0) { // if (res.code === 0) {
...@@ -477,7 +481,7 @@ const WebDic = () => { ...@@ -477,7 +481,7 @@ const WebDic = () => {
// }) // })
// } // }
//导出 // 导出
// const submitOutPut = () => { // const submitOutPut = () => {
// ExportDataDictionary().then((res) => { // ExportDataDictionary().then((res) => {
// notification.success({ // notification.success({
...@@ -490,7 +494,7 @@ const WebDic = () => { ...@@ -490,7 +494,7 @@ const WebDic = () => {
// } // }
const setItem = value => { const setItem = value => {
setLevel(value) setLevel(value);
if (value === 1) { if (value === 1) {
setAddVisible1(true); setAddVisible1(true);
} }
...@@ -498,35 +502,37 @@ const WebDic = () => { ...@@ -498,35 +502,37 @@ const WebDic = () => {
setAddVisible(true); setAddVisible(true);
} }
addForm.resetFields(); addForm.resetFields();
} };
//添加二级条目 // 添加二级条目
const submitAdd = value => { const submitAdd = value => {
console.log(value) console.log(value);
if (value.length === 0) { if (value.length === 0) {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
description: '请先选择一级条目', description: '请先选择一级条目',
}); });
} else { } else {
const nodeName1 = addForm.getFieldsValue() const nodeName1 = addForm.getFieldsValue();
const nodeName = addForm.getFieldsValue().nodeName1; const nodeName = addForm.getFieldsValue().nodeName1;
const nodeValue = addForm.getFieldsValue().nodeValue1; const nodeValue = addForm.getFieldsValue().nodeValue1;
console.log(nodeName1); console.log(nodeName1);
console.log(nodeName); console.log(nodeName);
let arr = [] let arr = [];
let result = nodeName1.users let result = nodeName1.users;
if (result) { if (result) {
// eslint-disable-next-line array-callback-return
result.map((item, index) => { result.map((item, index) => {
if (item === undefined) { if (item) {
arr.push({
} else { nodeName: item.nodeName,
arr.push({ nodeName: item.nodeName, nodeValue: item.nodeValue, parentID: Number(value) }) nodeValue: item.nodeValue,
parentID: Number(value),
});
} }
});
})
} }
arr.unshift({ nodeName, nodeValue, parentID: Number(value) }) arr.unshift({ nodeName, nodeValue, parentID: Number(value) });
AddDataDictionaryList([...arr]).then(res => { AddDataDictionaryList([...arr]).then(res => {
if (res.code === 0) { if (res.code === 0) {
setAddVisible(false); setAddVisible(false);
...@@ -540,19 +546,18 @@ const WebDic = () => { ...@@ -540,19 +546,18 @@ const WebDic = () => {
description: res.msg, description: res.msg,
}); });
} }
}) });
}
} }
//添加一级条目 };
// 添加一级条目
const submitAdd1 = value => { const submitAdd1 = value => {
const nodeName = addForm.getFieldValue('nodeName'); const nodeName = addForm.getFieldValue('nodeName');
AddDataDictionary({ AddDataDictionary({
nodeID: value, nodeID: value,
nodeName: nodeName, nodeName,
nodeValue: '-', nodeValue: '-',
}).then(res => { }).then(res => {
console.log(res.msg) console.log(res.msg);
if (res.code === 0) { if (res.code === 0) {
setAddVisible1(false); setAddVisible1(false);
getData(null); getData(null);
...@@ -572,29 +577,29 @@ const WebDic = () => { ...@@ -572,29 +577,29 @@ const WebDic = () => {
}); });
} }
}); });
} };
//修改 // 修改
const submitEdit = () => { const submitEdit = () => {
const nodeName = editForm.getFieldValue('nodeName'); const nodeName = editForm.getFieldValue('nodeName');
const nodeValue = editForm.getFieldValue('nodeValue'); const nodeValue = editForm.getFieldValue('nodeValue');
if (nodeName) { if (nodeName) {
EditDataDictionary({ EditDataDictionary({
nodeID: select.nodeID, nodeID: select.nodeID,
nodeName: nodeName, nodeName,
nodeValue: nodeValue nodeValue,
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
setEditVisible(false); setEditVisible(false);
getData(select.parentID === '-1' ? null : select.parentID); getData(select.parentID === '-1' ? null : select.parentID);
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
}); });
if (flag1 === 1) { if (flag1 === 1) {
sumbitSearch() sumbitSearch();
} }
} else { } else {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
...@@ -608,23 +613,27 @@ const WebDic = () => { ...@@ -608,23 +613,27 @@ const WebDic = () => {
description: '名称不能为空', description: '名称不能为空',
}); });
} }
} };
const submitEdit1 = () => { const submitEdit1 = () => {
const nodeName = editForm.getFieldValue('nodeName'); const nodeName = editForm.getFieldValue('nodeName');
if (nodeName) { if (nodeName) {
EditDataDictionary({ EditDataDictionary({
nodeID: select.nodeID, nodeID: select.nodeID,
nodeName: nodeName, nodeName,
nodeValue: '-' nodeValue: '-',
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
setEditVisible1(false); setEditVisible1(false);
if (flag1 === 0) {
getData(select.parentID === '-1' ? null : select.parentID); getData(select.parentID === '-1' ? null : select.parentID);
} else {
submitSearchUser();
}
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
}); });
if (flag1 === 1) { if (flag1 === 1) {
sumbitSearch() sumbitSearch();
} }
} else { } else {
notification.error({ notification.error({
...@@ -639,17 +648,19 @@ const WebDic = () => { ...@@ -639,17 +648,19 @@ const WebDic = () => {
description: '名称不能为空', description: '名称不能为空',
}); });
} }
} };
//删除 // 删除
const submitDelete = () => { const submitDelete = () => {
DeleteDataDictionary({ DeleteDataDictionary({
nodeID: select.nodeID, nodeID: select.nodeID,
}).then(res => { })
.then(res => {
if (res.code === 0) { if (res.code === 0) {
if (flag1 === 1) { if (flag1 === 0) {
sumbitSearch()
}
getData(select.parentID === '-1' ? null : select.parentID); getData(select.parentID === '-1' ? null : select.parentID);
} else {
submitSearchUser();
}
if (select.parentID === '-1') { if (select.parentID === '-1') {
setSubData([]); setSubData([]);
} }
...@@ -665,8 +676,8 @@ const WebDic = () => { ...@@ -665,8 +676,8 @@ const WebDic = () => {
}) })
.catch(err => { .catch(err => {
message.error(err); message.error(err);
}) });
} };
const pagenation = { const pagenation = {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100], pageSizeOptions: [10, 20, 50, 100],
...@@ -681,7 +692,7 @@ const WebDic = () => { ...@@ -681,7 +692,7 @@ const WebDic = () => {
headers: { headers: {
authorization: 'authorization-text', authorization: 'authorization-text',
}, },
beforeUpload: (file) => { beforeUpload: file => {
console.log('filee', file); console.log('filee', file);
// setFiles(file.file) // setFiles(file.file)
}, },
...@@ -694,7 +705,7 @@ const WebDic = () => { ...@@ -694,7 +705,7 @@ const WebDic = () => {
if (info.file.status === 'done') { if (info.file.status === 'done') {
console.log(1); console.log(1);
message.success(`${info.file.name} 导入成功`); message.success(`${info.file.name} 导入成功`);
setFirst(true) setFirst(true);
} else if (info.file.status === 'error') { } else if (info.file.status === 'error') {
message.error(`${info.file.name} 导入失败.`); message.error(`${info.file.name} 导入失败.`);
} }
...@@ -702,42 +713,43 @@ const WebDic = () => { ...@@ -702,42 +713,43 @@ const WebDic = () => {
}; };
const input1 = () => { const input1 = () => {
setFlag(flag + 1) setFlag(flag + 1);
setInPutVisible(false); setInPutVisible(false);
} };
const submitInput = () => { const submitInput = () => {
setInPutVisible(true); setInPutVisible(true);
} };
const submitSearchUser = () => { const submitSearchUser = () => {
setFlag1(1);
SearchDataDictionaryList({ key: searchWord, type: 1 }).then(res => { SearchDataDictionaryList({ key: searchWord, type: 1 }).then(res => {
if (res.code === 0) { if (res.code === 0) {
setShowSearchStyle(true); setShowSearchStyle(true);
if (res.data.length == 0) { if (res.data.length === 0) {
setData(res.data) setData(res.data);
setSubData([]) setSubData([]);
} else { } else {
setData(res.data) setData(res.data);
getData(res.data[0].nodeID) getData(res.data[0].nodeID);
}
} }
else { } else {
notification.error({ notification.error({
message: '提交失败', message: '提交失败',
description: res.msg, description: res.msg,
}) });
}
})
} }
});
};
const handleReset = () => { const handleReset = () => {
setFlag1(0);
setSearchWord(''); setSearchWord('');
setLoading(true) setLoading(true);
setIsloading(true) setIsloading(true);
GetDataDictionaryList({ nodeID: null }).then(resnew => { GetDataDictionaryList({ nodeID: null }).then(resnew => {
if (resnew.code === 0) { if (resnew.code === 0) {
setLoading(false) setLoading(false);
setIsloading(false) setIsloading(false);
let res = resnew.data; let res = resnew.data;
if (res.length > 0) { if (res.length > 0) {
res.map(item => { res.map(item => {
...@@ -749,21 +761,20 @@ const WebDic = () => { ...@@ -749,21 +761,20 @@ const WebDic = () => {
setSelect(res[0]); // 默认当前选中一级条目第一条 setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectColor(res[0]); setSelectColor(res[0]);
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目 setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
getData(res[0].nodeID);//拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目 getData(res[0].nodeID); // 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
setShowSearchStyle(false); setShowSearchStyle(false);
} }
setLoading(false) setLoading(false);
setIsloading(false) setIsloading(false);
}); });
} };
// 拖拽回调函数 // 拖拽回调函数
const dragCallBack = value => { const dragCallBack = value => {
// console.log(value) // console.log(value)
// console.log(orderTable) // console.log(orderTable)
if (value) { if (value) {
setData(value) setData(value);
} }
}; };
const dragCallBack1 = e => { const dragCallBack1 = e => {
...@@ -790,17 +801,50 @@ const WebDic = () => { ...@@ -790,17 +801,50 @@ const WebDic = () => {
enterButton enterButton
value={searchWord} value={searchWord}
/> />
<Button style={{ marginRight: '40px' }} icon={<SyncOutlined />} onClick={handleReset}> <Button
style={{ marginRight: '40px' }}
icon={<SyncOutlined />}
onClick={handleReset}
>
重置 重置
</Button> </Button>
</span> </span>
<span> <span>
<DownloadOutlined /><span style={{ verticalAlign: 'middle', marginLeft: '6px', marginRight: "40px", cursor: "pointer" }}><a style={{ color: 'rgba(0, 0, 0, 0.85)' }} href="/PandaOMS/OMS/DataManger/ExportDataDictionary">导出数据</a></span> <DownloadOutlined />
<span
style={{
verticalAlign: 'middle',
marginLeft: '6px',
marginRight: '40px',
cursor: 'pointer',
}}
>
<a
style={{ color: 'rgba(0, 0, 0, 0.85)' }}
href="/PandaOMS/OMS/DataManger/ExportDataDictionary"
>
导出数据
</a>
</span>
</span> </span>
<span> <span>
<UploadOutlined /><span style={{ verticalAlign: 'middle', marginLeft: '6px', marginRight: "40px", cursor: "pointer" }}><span style={{ color: 'rgba(0, 0, 0, 0.85)' }} onClick={() => submitInput()}>导入数据</span></span> <UploadOutlined />
<span
style={{
verticalAlign: 'middle',
marginLeft: '6px',
marginRight: '40px',
cursor: 'pointer',
}}
>
<span
style={{ color: 'rgba(0, 0, 0, 0.85)' }}
onClick={() => submitInput()}
>
导入数据
</span>
</span>
</span> </span>
</div> </div>
<Row style={{ background: 'white' }}> <Row style={{ background: 'white' }}>
<Col span={8} className={styles.left}> <Col span={8} className={styles.left}>
...@@ -814,8 +858,8 @@ const WebDic = () => { ...@@ -814,8 +858,8 @@ const WebDic = () => {
bordered bordered
dragCallBack={dragCallBack} dragCallBack={dragCallBack}
className={styles.pab} className={styles.pab}
title={() => { title={() => (
return <div > <div>
<span>一级条目</span> <span>一级条目</span>
<Tooltip title="添加一级条目配置"> <Tooltip title="添加一级条目配置">
<PlusSquareFilled <PlusSquareFilled
...@@ -829,7 +873,7 @@ const WebDic = () => { ...@@ -829,7 +873,7 @@ const WebDic = () => {
/> />
</Tooltip> </Tooltip>
</div> </div>
}} )}
rowClassName={setRowClassName} rowClassName={setRowClassName}
onClick={record => { onClick={record => {
getData(record.nodeID); getData(record.nodeID);
...@@ -837,7 +881,7 @@ const WebDic = () => { ...@@ -837,7 +881,7 @@ const WebDic = () => {
setSelectColor(record); setSelectColor(record);
setSelectID(record.nodeID); setSelectID(record.nodeID);
}} }}
ItemTypes='first' ItemTypes="first"
pagination={pagenation} pagination={pagenation}
/> />
</Col> </Col>
...@@ -846,7 +890,7 @@ const WebDic = () => { ...@@ -846,7 +890,7 @@ const WebDic = () => {
<Spin spinning={isloading} tip="loading..."> <Spin spinning={isloading} tip="loading...">
<DragTable <DragTable
size="small" size="small"
ItemTypes='second' ItemTypes="second"
bordered bordered
rowKey={record => record.nodeID} rowKey={record => record.nodeID}
columns={columns1} columns={columns1}
...@@ -859,8 +903,8 @@ const WebDic = () => { ...@@ -859,8 +903,8 @@ const WebDic = () => {
setSelect(record); setSelect(record);
setTwoSelectColor(record); setTwoSelectColor(record);
}} }}
title={() => { title={() => (
return <div> <div>
<span>二级条目</span> <span>二级条目</span>
<Tooltip title="添加二级条目配置"> <Tooltip title="添加二级条目配置">
<PlusSquareFilled <PlusSquareFilled
...@@ -874,16 +918,16 @@ const WebDic = () => { ...@@ -874,16 +918,16 @@ const WebDic = () => {
/> />
</Tooltip> </Tooltip>
</div> </div>
}} )}
pagination={pagenation} pagination={pagenation}
/> />
</Spin> </Spin>
</Col> </Col>
</Row> </Row>
</Spin> </Spin>
{/*添加一级*/} {/* 添加一级 */}
<Modal <Modal
title={'添加一级条目'} title="添加一级条目"
visible={addVisible1} visible={addVisible1}
width="500px" width="500px"
onOk={() => { onOk={() => {
...@@ -905,9 +949,9 @@ const WebDic = () => { ...@@ -905,9 +949,9 @@ const WebDic = () => {
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
{/*添加二级*/} {/* 添加二级 */}
<Modal <Modal
title='添加二级条目' title="添加二级条目"
visible={addVisible} visible={addVisible}
width="500px" width="500px"
onOk={() => { onOk={() => {
...@@ -923,44 +967,43 @@ const WebDic = () => { ...@@ -923,44 +967,43 @@ const WebDic = () => {
<Row> <Row>
<Col span={11}> <Col span={11}>
<Form.Item <Form.Item
name='nodeName1' name="nodeName1"
label="名称" label="名称"
rules={[ rules={[
{ required: true, message: '不能为空' }, { required: true, message: '不能为空' },
{ {
validator: (rule, value) => { validator: (rule, value) => {
const nodeName = addForm.getFieldsValue().nodeName1;//第一项的nodeName const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
const nodeName1 = addForm.getFieldsValue(); const nodeName1 = addForm.getFieldsValue();
let result = nodeName1.users; let result = nodeName1.users;
let arr = []; let arr = [];
if (result) { if (result) {
// eslint-disable-next-line array-callback-return
result.map(item => { result.map(item => {
if (item === undefined) { if (item) {
let a = item.nodeName;
} else {
let a = item.nodeName
if (a !== '') { if (a !== '') {
arr.push(a) arr.push(a);
} }
} }
}) });
} }
arr.unshift(nodeName) arr.unshift(nodeName);
console.log(arr) console.log(arr);
if (new Set(arr).size !== arr.length) { if (new Set(arr).size !== arr.length) {
return Promise.reject('用户名重复') // eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('用户名重复');
} }
return Promise.resolve(); return Promise.resolve();
} },
} },
]} ]}
> >
<Input placeholder="请输入名称" /> <Input placeholder="请输入名称" />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={11}> <Col span={11}>
<Form.Item name='nodeValue1' label="值"> <Form.Item name="nodeValue1" label="值">
<Input placeholder="请输入值" /> <Input placeholder="请输入值" />
</Form.Item> </Form.Item>
</Col> </Col>
...@@ -969,7 +1012,7 @@ const WebDic = () => { ...@@ -969,7 +1012,7 @@ const WebDic = () => {
{(fields, { add, remove }) => ( {(fields, { add, remove }) => (
<> <>
{fields.map(({ key, name, fieldKey, ...restField }) => ( {fields.map(({ key, name, fieldKey, ...restField }) => (
<Space key={key} style={{ display: 'flex', marginBottom: 8 }} > <Space key={key} style={{ display: 'flex', marginBottom: 8 }}>
<Row> <Row>
<Col span={11}> <Col span={11}>
<Form.Item <Form.Item
...@@ -977,40 +1020,37 @@ const WebDic = () => { ...@@ -977,40 +1020,37 @@ const WebDic = () => {
name={[name, 'nodeName']} name={[name, 'nodeName']}
label="名称" label="名称"
fieldKey={[fieldKey, 'frist']} fieldKey={[fieldKey, 'frist']}
rules={ rules={[
[
{ required: true, message: '不能为空' }, { required: true, message: '不能为空' },
{ {
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
const nodeName = addForm.getFieldsValue().nodeName1;//第一项的nodeName const nodeName = addForm.getFieldsValue()
.nodeName1; // 第一项的nodeName
const nodeName1 = addForm.getFieldsValue(); const nodeName1 = addForm.getFieldsValue();
let result = nodeName1.users; let result = nodeName1.users;
let arr = []; let arr = [];
// eslint-disable-next-line array-callback-return
result.map(item => { result.map(item => {
if (item === undefined) { if (item) {
let a = item.nodeName;
} else {
let a = item.nodeName
if (a !== '') { if (a !== '') {
arr.push(a) arr.push(a);
} }
} }
}) });
if (nodeName !== undefined) { if (nodeName !== undefined) {
arr.unshift(nodeName) arr.unshift(nodeName);
} }
console.log(arr) console.log(arr);
if (new Set(arr).size !== arr.length) { if (new Set(arr).size !== arr.length) {
arr = [...new Set(arr)] arr = [...new Set(arr)];
console.log(arr) console.log(arr);
callback('用户名重复') callback('用户名重复');
}
}
}
]
} }
},
},
]}
> >
<Input placeholder="请输入名称" /> <Input placeholder="请输入名称" />
</Form.Item> </Form.Item>
...@@ -1027,14 +1067,23 @@ const WebDic = () => { ...@@ -1027,14 +1067,23 @@ const WebDic = () => {
</Col> </Col>
<Col span={2}> <Col span={2}>
<Tooltip title="移除条目项"> <Tooltip title="移除条目项">
<MinusCircleOutlined onClick={() => remove(name)} style={{ marginLeft: '20px', fontSize: '20px' }} /> <MinusCircleOutlined
onClick={() => remove(name)}
style={{ marginLeft: '20px', fontSize: '20px' }}
/>
</Tooltip> </Tooltip>
</Col> </Col>
</Row> </Row>
</Space> </Space>
))} ))}
<Form.Item> <Form.Item>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />} style={{ width: '353px', marginLeft: '61px' }}> <Button
type="dashed"
onClick={() => add()}
block
icon={<PlusOutlined />}
style={{ width: '353px', marginLeft: '61px' }}
>
新增条目项 新增条目项
</Button> </Button>
</Form.Item> </Form.Item>
...@@ -1043,9 +1092,9 @@ const WebDic = () => { ...@@ -1043,9 +1092,9 @@ const WebDic = () => {
</Form.List> </Form.List>
</Form> </Form>
</Modal> </Modal>
{/*修改一级条目 */} {/* 修改一级条目 */}
<Modal <Modal
title={'修改一级条目'} title="修改一级条目"
visible={editVisible1} visible={editVisible1}
onOk={submitEdit1} onOk={submitEdit1}
onCancel={() => { onCancel={() => {
...@@ -1064,10 +1113,10 @@ const WebDic = () => { ...@@ -1064,10 +1113,10 @@ const WebDic = () => {
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
{/*修改二级条目 */} {/* 修改二级条目 */}
<Modal <Modal
title={'修改二级条目'} title="修改二级条目"
visible={editVisible} visible={editVisible}
onOk={submitEdit} onOk={submitEdit}
onCancel={() => { onCancel={() => {
...@@ -1090,10 +1139,10 @@ const WebDic = () => { ...@@ -1090,10 +1139,10 @@ const WebDic = () => {
</Form> </Form>
</Modal> </Modal>
<Modal {/* <Modal
title={'查找条目'} title="查找条目"
visible={searchVisible} visible={searchVisible}
width='700px' width="700px"
onOk={resetSearch} onOk={resetSearch}
onCancel={() => { onCancel={() => {
setSearchVisible(false); setSearchVisible(false);
...@@ -1114,7 +1163,7 @@ const WebDic = () => { ...@@ -1114,7 +1163,7 @@ const WebDic = () => {
<Table <Table
size="small" size="small"
bordered bordered
key='' key=""
columns={columns2} columns={columns2}
dataSource={searchData} dataSource={searchData}
scroll={{ x: 'max-content', y: 'calc(100vh - 700px)' }} scroll={{ x: 'max-content', y: 'calc(100vh - 700px)' }}
...@@ -1128,18 +1177,31 @@ const WebDic = () => { ...@@ -1128,18 +1177,31 @@ const WebDic = () => {
})} })}
pagination={pagenation} pagination={pagenation}
/> />
</Modal> </Modal> */}
<Modal <Modal
title={'导入数据'} title="导入数据"
visible={InPutVisible} visible={InPutVisible}
onOk={input1} onOk={input1}
onCancel={() => { onCancel={() => {
setInPutVisible(false) setInPutVisible(false);
}} }}
okText="确认" okText="确认"
cancelText="取消"> cancelText="取消"
>
<Upload {...props}> <Upload {...props}>
<UploadOutlined /><span style={{ verticalAlign: 'middle', marginLeft: '6px', marginRight: "40px", cursor: "pointer" }}><a style={{ color: 'rgb(24 144 255)' }}>请选择将要导入的数据文件(仅支持Excel文件)</a></span> <UploadOutlined />
<span
style={{
verticalAlign: 'middle',
marginLeft: '6px',
marginRight: '40px',
cursor: 'pointer',
}}
>
<a style={{ color: 'rgb(24 144 255)' }}>
请选择将要导入的数据文件(仅支持Excel文件)
</a>
</span>
</Upload> </Upload>
</Modal> </Modal>
</div> </div>
......
import React, { useState, useEffect, useRef } from 'react' /* eslint-disable radix */
/* eslint-disable camelcase */
import React, { useState, useEffect, useRef } from 'react';
import SiteModal from '@/components/Modal/SiteModa'; import SiteModal from '@/components/Modal/SiteModa';
import { Form, Input, notification, Select, Checkbox, message, Button, Card, Switch as Switchs } from 'antd' import {
Form,
Input,
notification,
Select,
Checkbox,
message,
Button,
Card,
Switch as Switchs,
} from 'antd';
import BaseForm from '@/components/BaseForm/index'; import BaseForm from '@/components/BaseForm/index';
import { Switch } from 'react-router'; import { Switch } from 'react-router';
import { iteratee } from 'lodash'; import { iteratee } from 'lodash';
import styles from './schemeDetail.less';
import v from 'voca'; import v from 'voca';
import { UsergroupDeleteOutlined } from '@ant-design/icons'; import { UsergroupDeleteOutlined } from '@ant-design/icons';
import VisibleRoleModal from '../messageManage/projectManage/components/RolseSelect/VisibleRoleModal' import moment from 'moment';
import VisibleIISAgentConfig from '../messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig'
import { GetMessageTemplate } from '@/services/platform/messagemanage'
import moment from 'moment'
import { UpdateMessageConfig, InsertMessageConfig, AddIISAgentConfig } from '@/services/platform/messagemanage'
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
import VisibleRoleModal from '../messageManage/projectManage/components/RolseSelect/VisibleRoleModal';
import VisibleIISAgentConfig from '../messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig';
import {
GetMessageTemplate,
UpdateMessageConfig,
InsertMessageConfig,
AddIISAgentConfig,
// eslint-disable-next-line import/no-duplicates
} from '@/services/platform/messagemanage';
import styles from './schemeDetail.less';
const { Item } = Form; const { Item } = Form;
const { TextArea } = Input; const { TextArea } = Input;
const EditModal = props => { const EditModal = props => {
const history = useHistory(); const history = useHistory();
const [form] = Form.useForm(); const [form] = Form.useForm();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [plan, setPlan] = useState(''); const [plan, setPlan] = useState('');
const [isStart, setIsStart] = useState(false); const [isStart, setIsStart] = useState(false);
const [IISConfig, setIISConfig] = useState(null) const [IISConfig, setIISConfig] = useState(null);
const [isUse, setIsUse] = useState("0") const [isUse, setIsUse] = useState('0');
const [btnType, setBtnType] = useState("定时推送") const [btnType, setBtnType] = useState('定时推送');
const { template, confirmModal } = props.location.state const { template, confirmModal } = props.location.state;
const [currentTrench, setCurrentTrench] = useState({ const [currentTrench, setCurrentTrench] = useState({
isMessageShow: false, isMessageShow: false,
isAPPShow: false, isAPPShow: false,
isWEBShow: false, isWEBShow: false,
isWXShow: false, isWXShow: false,
isEnterpriseWXShow: false, isEnterpriseWXShow: false,
}) });
const [APP_ITEMS, setAPP_ITEMS] = useState([]) // eslint-disable-next-line camelcase
const [WEB_ITEMS, setWEB_ITEMS] = useState([]) const [APP_ITEMS, setAPP_ITEMS] = useState([]);
const [WX_ITEMS, setWX_ITEMS] = useState([]) const [WEB_ITEMS, setWEB_ITEMS] = useState([]);
const [MES_ITEMS, setMES_ITEMS] = useState([]) const [WX_ITEMS, setWX_ITEMS] = useState([]);
const [EN_ITEMS, setEN_ITEMS] = useState([]) const [MES_ITEMS, setMES_ITEMS] = useState([]);
const [listType, setListType] = useState([{ title: '定时推送', desc: '用于周期性简报的定时推送,如智能巡检、运行周报。' }, { title: '监控报警', desc: '设备硬件故障,阈值超限,状态突变,采集超时等异常情况报警。' }, { title: '工单办理', desc: '在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。' }, { title: '平台公告', desc: '由运维人员向所有用户或特定用户发送的事务公告,如系统升级、维护。' }]) const [EN_ITEMS, setEN_ITEMS] = useState([]);
const [listType, setListType] = useState([
{
title: '定时推送',
desc: '用于周期性简报的定时推送,如智能巡检、运行周报。',
},
{
title: '监控报警',
desc: '设备硬件故障,阈值超限,状态突变,采集超时等异常情况报警。',
},
{
title: '工单办理',
desc:
'在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。',
},
{
title: '平台公告',
desc: '由运维人员向所有用户或特定用户发送的事务公告,如系统升级、维护。',
},
]);
useEffect(() => { useEffect(() => {
GetMessageTemplate().then( GetMessageTemplate().then(res => {
res => {
if (res.code === 0) { if (res.code === 0) {
let arr1 = [] let arr1 = [];
let arr2 = [] let arr2 = [];
let arr3 = [] let arr3 = [];
let arr4 = [] let arr4 = [];
let arr5 = [] let arr5 = [];
// eslint-disable-next-line array-callback-return
res.data.map((item, index) => { res.data.map((item, index) => {
if (item.Type === "公众号") { if (item.Type === '公众号') {
arr1.push(item) arr1.push(item);
}
if (item.Type === "短信") {
arr2.push(item)
} }
if (item.Type === "APP") { if (item.Type === '短信') {
arr3.push(item) arr2.push(item);
} }
if (item.Type === "WEB") { if (item.Type === 'APP') {
arr4.push(item) arr3.push(item);
} }
if (item.Type === "企业微信") { if (item.Type === 'WEB') {
arr5.push(item) arr4.push(item);
} }
}) if (item.Type === '企业微信') {
setAPP_ITEMS(arr3) arr5.push(item);
setMES_ITEMS(arr2)
setWX_ITEMS(arr1)
setWEB_ITEMS(arr4)
setEN_ITEMS(arr5)
} }
});
setAPP_ITEMS(arr3);
setMES_ITEMS(arr2);
setWX_ITEMS(arr1);
setWEB_ITEMS(arr4);
setEN_ITEMS(arr5);
} }
) });
}, []) }, []);
useEffect(() => { useEffect(() => {
console.log('template', template); console.log('template', template);
console.log(template.WorkWeiXinTemplateId) console.log(template.WorkWeiXinTemplateId);
let aa let aa;
if (template.WorkWeiXinTemplateId == null||template.WorkWeiXinTemplateId=='') { if (
aa = '' template.WorkWeiXinTemplateId == null ||
template.WorkWeiXinTemplateId === ''
) {
aa = '';
} else { } else {
aa = parseInt(template.WorkWeiXinTemplateId) // eslint-disable-next-line radix
aa = parseInt(template.WorkWeiXinTemplateId);
} }
if (template.ThemeName) { if (template.ThemeName) {
form.setFieldsValue({ form.setFieldsValue({
name: template.MsgType, name: template.MsgType,
isStart: template.IsStarted === "0" ? "关闭" : "开启", isStart: template.IsStarted === '0' ? '关闭' : '开启',
to_person: template.PushGroup, to_person: template.PushGroup,
push_mode: template.PushMode === null ? '' : template.PushMode.split(","), push_mode:
template.PushMode === null ? '' : template.PushMode.split(','),
app_template: template.AppTemplateID, app_template: template.AppTemplateID,
app_path: template.AppFunctionPath, app_path: template.AppFunctionPath,
wx_template: template.PublicTemplateID ? parseInt(template.PublicTemplateID) : '', wx_template: template.PublicTemplateID
? parseInt(template.PublicTemplateID)
: '',
h5_path: template.PublicPath, h5_path: template.PublicPath,
miniprogram_path: template.MiniAppRoute, miniprogram_path: template.MiniAppRoute,
web_template: template.WebTemplateID, web_template: template.WebTemplateID,
web_path: template.WebFunctionPath, web_path: template.WebFunctionPath,
message_template: template.MsgTemplateID, message_template: template.MsgTemplateID,
enterprise_template: aa, enterprise_template: aa,
}) });
setPlan(template.MsgType) setPlan(template.MsgType);
setBtnType(template.type) setBtnType(template.type);
setIsUse(template.IsStarted) setIsUse(template.IsStarted);
setCurrentTrench({ setCurrentTrench({
isAPPShow: template.PushMode && template.PushMode.split(",").indexOf("平台弹框") > -1 ? true : false, isAPPShow: !!(
isWXShow: template.PushMode && template.PushMode.split(",").indexOf("公众号推送") > -1 ? true : false, template.PushMode &&
isWEBShow: template.PushMode && template.PushMode.split(",").indexOf("平台弹框") > -1 ? true : false, template.PushMode.split(',').indexOf('平台弹框') > -1
isMessageShow: template.PushMode && template.PushMode.split(",").indexOf("短信推送") > -1 ? true : false, ),
isEnterpriseWXShow: template.PushMode && template.PushMode.split(",").indexOf("企业微信推送") > -1 ? true : false, isWXShow: !!(
}) template.PushMode &&
} template.PushMode.split(',').indexOf('公众号推送') > -1
else { ),
console.log(111) isWEBShow: !!(
setBtnType('定时推送') template.PushMode &&
} template.PushMode.split(',').indexOf('平台弹框') > -1
}, [props]) ),
const onNameChange = (e) => { isMessageShow: !!(
setPlan(e.target.value) template.PushMode &&
template.PushMode.split(',').indexOf('短信推送') > -1
),
isEnterpriseWXShow: !!(
template.PushMode &&
template.PushMode.split(',').indexOf('企业微信推送') > -1
),
});
} else {
console.log(111);
setBtnType('定时推送');
} }
}, [props]);
const onNameChange = e => {
setPlan(e.target.value);
};
const onSubmit = () => { const onSubmit = () => {
let fv = form.getFieldValue();
let fv = form.getFieldValue() console.log(fv.enterprise_template);
console.log(fv.enterprise_template) let aa;
let aa if (fv.enterprise_template === undefined) {
if (fv.enterprise_template == undefined) { aa = '';
aa = ''
} else { } else {
aa = fv.enterprise_template.toString() aa = fv.enterprise_template.toString();
} }
console.log(fv) console.log(fv);
let push_mode = ((currentTrench.isAPPShow || currentTrench.isWEBShow) ? '平台弹框' : '') + (currentTrench.isWXShow ? ',公众号推送' : '') + (currentTrench.isMessageShow ? ',短信推送' : '') + (currentTrench.isEnterpriseWXShow ? ',企业微信推送' : '') let push_mode =
(currentTrench.isAPPShow || currentTrench.isWEBShow ? '平台弹框' : '') +
(currentTrench.isWXShow ? ',公众号推送' : '') +
(currentTrench.isMessageShow ? ',短信推送' : '') +
(currentTrench.isEnterpriseWXShow ? ',企业微信推送' : '');
if (template.ThemeName) { if (template.ThemeName) {
let a = { let a = {
ID: template.ID, ID: template.ID,
...@@ -151,7 +210,7 @@ const EditModal = props => { ...@@ -151,7 +210,7 @@ const EditModal = props => {
WebFunctionPath: fv.web_path, WebFunctionPath: fv.web_path,
WebConfig: template.WebConfig, WebConfig: template.WebConfig,
IsDelete: template.IsDelete, IsDelete: template.IsDelete,
InputTime: moment().format("YYYY-MM-DD HH:mm:ss"), InputTime: moment().format('YYYY-MM-DD HH:mm:ss'),
Pusher: template.Pusher, Pusher: template.Pusher,
PushMode: push_mode, PushMode: push_mode,
PushPath: template.PushPath, PushPath: template.PushPath,
...@@ -161,17 +220,15 @@ const EditModal = props => { ...@@ -161,17 +220,15 @@ const EditModal = props => {
WebTemplateID: fv.web_template, WebTemplateID: fv.web_template,
PushGroup: fv.to_person ? fv.to_person.toString() : '', PushGroup: fv.to_person ? fv.to_person.toString() : '',
WorkWeiXinTemplateId: aa, WorkWeiXinTemplateId: aa,
} };
UpdateMessageConfig(a).then( UpdateMessageConfig(a).then(res => {
res => {
if (res.code === 0) { if (res.code === 0) {
if (IISConfig) { if (IISConfig) {
AddIISAgentConfig(IISConfig).then( // eslint-disable-next-line no-shadow
res => { AddIISAgentConfig(IISConfig).then(res => {
if (res.code === 0) { if (res.code === 0) {
message.success("保存成功") message.success('保存成功');
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -179,33 +236,28 @@ const EditModal = props => { ...@@ -179,33 +236,28 @@ const EditModal = props => {
description: res.msg, description: res.msg,
}); });
} }
} });
)
} else { } else {
message.success("保存成功") message.success('保存成功');
}
} }
else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg, description: res.msg,
}); });
} }
} });
)
} else { } else {
let bb let bb;
if (fv.enterprise_template == undefined) { if (fv.enterprise_template === undefined) {
bb = '' bb = '';
} else { } else {
bb = fv.enterprise_template.toString() bb = fv.enterprise_template.toString();
} }
console.log(fv.enterprise_template) console.log(fv.enterprise_template);
let b = { let b = {
ThemeName: "定时推送", ThemeName: '定时推送',
MsgType: fv.name, MsgType: fv.name,
PublicTemplateID: fv.wx_template ? fv.wx_template.toString() : null, PublicTemplateID: fv.wx_template ? fv.wx_template.toString() : null,
PublicConfig: template.PublicConfig, PublicConfig: template.PublicConfig,
...@@ -219,7 +271,7 @@ const EditModal = props => { ...@@ -219,7 +271,7 @@ const EditModal = props => {
WebFunctionPath: fv.web_path, WebFunctionPath: fv.web_path,
WebConfig: template.WebConfig, WebConfig: template.WebConfig,
IsDelete: template.IsDelete, IsDelete: template.IsDelete,
InputTime: moment().format("YYYY-MM-DD HH:mm:ss"), InputTime: moment().format('YYYY-MM-DD HH:mm:ss'),
Pusher: template.Pusher, Pusher: template.Pusher,
PushMode: push_mode, PushMode: push_mode,
PushPath: template.PushPath, PushPath: template.PushPath,
...@@ -229,53 +281,44 @@ const EditModal = props => { ...@@ -229,53 +281,44 @@ const EditModal = props => {
WebTemplateID: fv.web_template, WebTemplateID: fv.web_template,
PushGroup: fv.to_person ? fv.to_person.toString() : '', PushGroup: fv.to_person ? fv.to_person.toString() : '',
WorkWeiXinTemplateId: bb, WorkWeiXinTemplateId: bb,
} };
InsertMessageConfig(b).then( InsertMessageConfig(b).then(res => {
res => {
if (res.code === 0) { if (res.code === 0) {
if (IISConfig) { if (IISConfig) {
AddIISAgentConfig(IISConfig).then( // eslint-disable-next-line no-shadow
res => { AddIISAgentConfig(IISConfig).then(res => {
if (res.code === 0) { if (res.code === 0) {
message.success("保存成功") message.success('保存成功');
} else {
}
else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg, description: res.msg,
}); });
} }
} });
)
} else { } else {
message.success("保存成功") message.success('保存成功');
}
} }
else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg, description: res.msg,
}); });
} }
});
} }
) };
}
}
const onIISAgentSubmit = (value) => { const onIISAgentSubmit = value => {
console.log('value', value); console.log('value', value);
setIISConfig(value) setIISConfig(value);
};
}
const onPushSubmit = (value) => { const onPushSubmit = value => {
console.log(value, "onPushSubmit") console.log(value, 'onPushSubmit');
} };
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
labelCol: { labelCol: {
...@@ -285,22 +328,21 @@ const EditModal = props => { ...@@ -285,22 +328,21 @@ const EditModal = props => {
span: 24, span: 24,
}, },
}; };
const onChange = (value) => { const onChange = value => {
setIsUse(value ? '1' : '0') setIsUse(value ? '1' : '0');
} };
const back = () => { const back = () => {
history.push('/platformCenter/notify') history.push('/platformCenter/notify');
} };
const tailLayout = { const tailLayout = {
wrapperCol: { offset: 21, span: 24 }, wrapperCol: { offset: 21, span: 24 },
}; };
const onTypeChange = (value, type) => { const onTypeChange = (value, type) => {
let data = { ...currentTrench } let data = { ...currentTrench };
data[type] = value data[type] = value;
setCurrentTrench(data) setCurrentTrench(data);
} };
return ( return (
<div className={styles.editModal_container}> <div className={styles.editModal_container}>
<Form form={form} {...layout} onFinish={onSubmit}> <Form form={form} {...layout} onFinish={onSubmit}>
<div className={styles.content}> <div className={styles.content}>
...@@ -315,22 +357,31 @@ const EditModal = props => { ...@@ -315,22 +357,31 @@ const EditModal = props => {
}, },
]} ]}
> >
<Input style={{ width: '25rem' }} placeholder="请输入方案名称" disabled={template.ThemeName ? true : false} onChange={onNameChange} /> <Input
style={{ width: '25rem' }}
placeholder="请输入方案名称"
disabled={!!template.ThemeName}
onChange={onNameChange}
/>
</Item> </Item>
<Item <Item label="方案类型">
label="方案类型"
>
<div className={styles.cardList}> <div className={styles.cardList}>
{listType.map(item => { {listType.map(item => (
return <div key={item.title} className={styles.cardListItem}><Button type={item.title === btnType ? 'primary' : 'default'} style={{ cursor: 'not-allowed', marginRight: '1rem' }} >{item.title}</Button> <span>{item.desc}</span></div> <div key={item.title} className={styles.cardListItem}>
})} <Button
type={item.title === btnType ? 'primary' : 'default'}
style={{ cursor: 'not-allowed', marginRight: '1rem' }}
>
{item.title}
</Button>{' '}
<span>{item.desc}</span>
</div>
))}
</div> </div>
</Item> </Item>
</Card> </Card>
{btnType === '定时推送' && (<Card title="推送信息" style={{ width: '100%', marginTop: '1rem' }}> {btnType === '定时推送' && (
<Card title="推送信息" style={{ width: '100%', marginTop: '1rem' }}>
<div style={{ display: 'flex', alignItems: 'center' }}> <div style={{ display: 'flex', alignItems: 'center' }}>
<Item <Item
label="推送组" label="推送组"
...@@ -339,201 +390,254 @@ const EditModal = props => { ...@@ -339,201 +390,254 @@ const EditModal = props => {
style={{ paddingTop: '1.6rem', width: '35rem' }} style={{ paddingTop: '1.6rem', width: '35rem' }}
> >
<VisibleRoleModal <VisibleRoleModal
style={{ display: 'flex', width: '35rem', alignItems: 'center' }} style={{
display: 'flex',
width: '35rem',
alignItems: 'center',
}}
onSubmit={onPushSubmit} onSubmit={onPushSubmit}
selectValue={template && template.PushGroup ? template.PushGroup : []} selectValue={
title={<UsergroupDeleteOutlined style={{ fontSize: '18px' }} />} /> template && template.PushGroup ? template.PushGroup : []
}
title={
<UsergroupDeleteOutlined style={{ fontSize: '18px' }} />
}
/>
</Item> </Item>
<div style={{ display: 'flex', width: '30rem', margin: '0 2rem', alignItems: 'center' }}> <div
推送计划: <VisibleIISAgentConfig agentConfig={template.item && template.item.AgentConfig} value={plan} onIISAgentSubmit={onIISAgentSubmit} /> style={{
display: 'flex',
width: '30rem',
margin: '0 2rem',
alignItems: 'center',
}}
>
推送计划:{' '}
<VisibleIISAgentConfig
agentConfig={template.item && template.item.AgentConfig}
value={plan}
onIISAgentSubmit={onIISAgentSubmit}
/>
</div> </div>
<span> <span>
是否启用:<Switchs checked={isUse === '0' ? false : true} onChange={onChange} /> 是否启用:
<Switchs checked={isUse !== '0'} onChange={onChange} />
</span> </span>
</div> </div>
</Card>
</Card>)} )}
<div className={styles.push_trench}> <div className={styles.push_trench}>
{ {
<div className={styles.trench_card}> <div className={styles.trench_card}>
<div className={styles.card_title}> <div className={styles.card_title}>
<div className={styles.lable}>APP</div> <div className={styles.lable}>APP</div>
<Switchs onChange={e => onTypeChange(e, 'isAPPShow')} checked={currentTrench.isAPPShow} /> <Switchs
onChange={e => onTypeChange(e, 'isAPPShow')}
checked={currentTrench.isAPPShow}
/>
</div> </div>
<div className={styles.card_body}> <div className={styles.card_body}>
<Item <Item
label="模板" label="模板"
labelAlign='left' labelAlign="left"
name="app_template" name="app_template"
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
> >
<Select style={{ width: '97%' }} disabled={!currentTrench.isAPPShow} > <Select
{ style={{ width: '97%' }}
APP_ITEMS.map((item, idx) => { disabled={!currentTrench.isAPPShow}
return ( >
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option> {APP_ITEMS.map((item, idx) => (
) <Select.Option value={item.Id} key={idx}>
}) {item.LikeName}
} </Select.Option>
))}
</Select> </Select>
</Item> </Item>
<Item <Item
label="功能路径" label="功能路径"
name="app_path" name="app_path"
labelAlign='left' labelAlign="left"
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
> >
<TextArea rows={4} style={{ width: '97%' }} disabled={!currentTrench.isAPPShow} placeholder="请输入功能路径" /> <TextArea
rows={4}
style={{ width: '97%' }}
disabled={!currentTrench.isAPPShow}
placeholder="请输入功能路径"
/>
</Item> </Item>
</div> </div>
</div> </div>
} }
{ {
<div className={styles.trench_card}> <div className={styles.trench_card}>
<div className={styles.card_title}> <div className={styles.card_title}>
<div className={styles.lable}>公众号</div> <div className={styles.lable}>公众号</div>
<Switchs onChange={e => onTypeChange(e, 'isWXShow')} checked={currentTrench.isWXShow} /> <Switchs
onChange={e => onTypeChange(e, 'isWXShow')}
checked={currentTrench.isWXShow}
/>
</div> </div>
<div className={styles.card_body}> <div className={styles.card_body}>
<Item <Item
label="模板" label="模板"
name="wx_template" name="wx_template"
labelAlign='left' labelAlign="left"
labelCol={{ span: 3 }} labelCol={{ span: 3 }}
> >
<Select style={{ width: '97%' }} disabled={!currentTrench.isWXShow} > <Select
{ style={{ width: '97%' }}
WX_ITEMS.map((item, idx) => { disabled={!currentTrench.isWXShow}
return ( >
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option> {WX_ITEMS.map((item, idx) => (
) <Select.Option value={item.Id} key={idx}>
}) {item.LikeName}
} </Select.Option>
))}
</Select> </Select>
</Item> </Item>
<Item <Item
label="H5路由" label="H5路由"
name="h5_path" name="h5_path"
labelAlign='left' labelAlign="left"
labelCol={{ span: 3 }} labelCol={{ span: 3 }}
> >
<Input style={{ width: '97%' }} disabled={!currentTrench.isWXShow} placeholder="请输入功能路径" /> <Input
style={{ width: '97%' }}
disabled={!currentTrench.isWXShow}
placeholder="请输入功能路径"
/>
</Item> </Item>
<Item <Item
label="小程序路由" label="小程序路由"
name="miniprogram_path" name="miniprogram_path"
labelAlign='left' labelAlign="left"
labelCol={{ span: 3 }} labelCol={{ span: 3 }}
> >
<Input style={{ width: '97%' }} disabled={!currentTrench.isWXShow} placeholder="请输入功能路径" /> <Input
style={{ width: '97%' }}
disabled={!currentTrench.isWXShow}
placeholder="请输入功能路径"
/>
</Item> </Item>
</div> </div>
</div> </div>
} }
{ {
<div className={styles.trench_card}> <div className={styles.trench_card}>
<div className={styles.card_title}> <div className={styles.card_title}>
<div className={styles.lable}>WEB</div> <div className={styles.lable}>WEB</div>
<Switchs onChange={e => onTypeChange(e, 'isWEBShow')} checked={currentTrench.isWEBShow} /> <Switchs
onChange={e => onTypeChange(e, 'isWEBShow')}
checked={currentTrench.isWEBShow}
/>
</div> </div>
<div className={styles.card_body}> <div className={styles.card_body}>
<Item <Item
label="模板" label="模板"
name="web_template" name="web_template"
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
labelAlign='left' labelAlign="left"
> >
<Select style={{ width: '97%' }} disabled={!currentTrench.isWEBShow}> <Select
{ style={{ width: '97%' }}
WEB_ITEMS.map((item, idx) => { disabled={!currentTrench.isWEBShow}
return ( >
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option> {WEB_ITEMS.map((item, idx) => (
) <Select.Option value={item.Id} key={idx}>
}) {item.LikeName}
} </Select.Option>
))}
</Select> </Select>
</Item> </Item>
<Item <Item
label="功能路径" label="功能路径"
name="web_path" name="web_path"
labelAlign='left' labelAlign="left"
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
> >
<TextArea rows={4} style={{ width: '97%' }} disabled={!currentTrench.isWEBShow} placeholder="请输入功能路径" /> <TextArea
rows={4}
style={{ width: '97%' }}
disabled={!currentTrench.isWEBShow}
placeholder="请输入功能路径"
/>
</Item> </Item>
</div> </div>
</div> </div>
} }
{ {
<div className={styles.trench_card}> <div className={styles.trench_card}>
<div className={styles.card_title}> <div className={styles.card_title}>
<div className={styles.lable}>短信推送</div> <div className={styles.lable}>短信推送</div>
<Switchs onChange={e => onTypeChange(e, 'isMessageShow')} checked={currentTrench.isMessageShow} /> <Switchs
onChange={e => onTypeChange(e, 'isMessageShow')}
checked={currentTrench.isMessageShow}
/>
</div> </div>
<div className={styles.card_body}> <div className={styles.card_body}>
<Item <Item
label="模板" label="模板"
labelAlign='left' labelAlign="left"
name="message_template" name="message_template"
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
> >
<Select style={{ width: '97%' }} disabled={!currentTrench.isMessageShow} > <Select
{ style={{ width: '97%' }}
MES_ITEMS.map((item, idx) => { disabled={!currentTrench.isMessageShow}
return ( >
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option> {MES_ITEMS.map((item, idx) => (
) <Select.Option value={item.Id} key={idx}>
}) {item.LikeName}
} </Select.Option>
))}
</Select> </Select>
</Item> </Item>
</div> </div>
</div> </div>
} }
{ {
<div className={styles.trench_card}> <div className={styles.trench_card}>
<div className={styles.card_title}> <div className={styles.card_title}>
<div className={styles.lable}>企业微信</div> <div className={styles.lable}>企业微信</div>
<Switchs onChange={e => onTypeChange(e, 'isEnterpriseWXShow')} checked={currentTrench.isEnterpriseWXShow} /> <Switchs
onChange={e => onTypeChange(e, 'isEnterpriseWXShow')}
checked={currentTrench.isEnterpriseWXShow}
/>
</div> </div>
<div className={styles.card_body}> <div className={styles.card_body}>
<Item <Item
label="模板" label="模板"
labelAlign='left' labelAlign="left"
name="enterprise_template" name="enterprise_template"
labelCol={{ span: 2 }} labelCol={{ span: 2 }}
> >
<Select style={{ width: '97%' }} disabled={!currentTrench.isEnterpriseWXShow} > <Select
{ style={{ width: '97%' }}
EN_ITEMS.map((item, idx) => { disabled={!currentTrench.isEnterpriseWXShow}
return ( >
<Select.Option value={item.Id} key={idx}>{item.LikeName}</Select.Option> {EN_ITEMS.map((item, idx) => (
) <Select.Option value={item.Id} key={idx}>
}) {item.LikeName}
} </Select.Option>
))}
</Select> </Select>
</Item> </Item>
</div> </div>
</div> </div>
} }
</div> </div>
</div> </div>
<Item {...tailLayout} style={{ marginTop: '1rem' }}> <Item {...tailLayout} style={{ marginTop: '1rem' }}>
<Button htmlType="button" onClick={back} style={{ marginRight: '2rem' }}> <Button
htmlType="button"
onClick={back}
style={{ marginRight: '2rem' }}
>
返回 返回
</Button> </Button>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
...@@ -541,9 +645,8 @@ const EditModal = props => { ...@@ -541,9 +645,8 @@ const EditModal = props => {
</Button> </Button>
</Item> </Item>
</Form> </Form>
<div> <div />
</div>
</div> </div>
) );
} };
export default EditModal; export default EditModal;
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2021-07-08 16:18:14 * @Date: 2021-07-08 16:18:14
* @LastEditTime: 2021-11-26 15:53:25 * @LastEditTime: 2021-11-26 16:28:39
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import { post, postForm, get, PUBLISH_SERVICE } from '../index'; import { post, postForm, get, PUBLISH_SERVICE } from '../index';
...@@ -16,6 +16,6 @@ export const getSysConfigurate = params => ...@@ -16,6 +16,6 @@ export const getSysConfigurate = params =>
); );
export const gateWayConfig = params => export const gateWayConfig = params =>
get(`/PandaCore/GCK/Basis/GateWayConfig`, params); get(`/PandaCore/GCK/Basis/GateWayConfig`, params);
//获取网关配置 // 获取网关配置
export const GetGateWay = param => export const GetGateWay = param =>
get(`${PUBLISH_SERVICE}/HostManager/GetGateWay`, param); get(`${PUBLISH_SERVICE}/HostManager/GetGateWay`, param);
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