Commit c96e49b6 authored by 皮倩雯's avatar 皮倩雯

fix: '修改地图配置关联角色功能'

parent 6c8ab0cb
Pipeline #50053 skipped with stages
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
.cardsList { .cardsList {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
height: 710px; height: calc(100vh - 120px);
overflow-y: scroll; overflow-y: scroll;
} }
.cardItem { .cardItem {
...@@ -112,6 +112,18 @@ ...@@ -112,6 +112,18 @@
height: 26rem; height: 26rem;
margin: 0 2rem; margin: 0 2rem;
} }
.tileContainer {
.ant-table-body {
height: calc(100vh - 330px) !important;
border-right: 1px solid #f0f0f0;
overflow: auto !important;
}
}
.solutionContainer {
.ant-table-body {
height: calc(100vh - 250px) !important;
}
}
// .solutionConfig { // .solutionConfig {
// height: calc(100% - 30px); // height: calc(100% - 30px);
// } // }
...@@ -37,7 +37,7 @@ import { ...@@ -37,7 +37,7 @@ import {
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name } = props; const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name, onCancel } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [radio, setRadio] = useState(); const [radio, setRadio] = useState();
const [alpha, setAlpha] = useState(1); const [alpha, setAlpha] = useState(1);
...@@ -63,8 +63,11 @@ const AddModal = props => { ...@@ -63,8 +63,11 @@ const AddModal = props => {
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let arr = {}; let arr = {};
console.log(obj.servicename);
// 连点
if (obj.servicename) { if (obj.servicename) {
if (mapType == 1) { if (mapType == 1) {
arr = { arr = {
...@@ -110,8 +113,9 @@ const AddModal = props => { ...@@ -110,8 +113,9 @@ const AddModal = props => {
SetServiceConfig(arr) SetServiceConfig(arr)
.then(res => { .then(res => {
setLoading(false);
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoading(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -120,6 +124,7 @@ const AddModal = props => { ...@@ -120,6 +124,7 @@ const AddModal = props => {
description: res.message || type == 'add' ? '新增成功' : '编辑成功', description: res.message || type == 'add' ? '新增成功' : '编辑成功',
}); });
} else { } else {
setLoading(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -130,12 +135,6 @@ const AddModal = props => { ...@@ -130,12 +135,6 @@ const AddModal = props => {
.catch(err => { .catch(err => {
setLoading(false); setLoading(false);
}); });
} else {
notification.warning({
message: '提示',
duration: 3,
description: '服务名称必填',
});
} }
} }
}); });
...@@ -143,6 +142,7 @@ const AddModal = props => { ...@@ -143,6 +142,7 @@ const AddModal = props => {
const onFinish = value => {}; const onFinish = value => {};
useEffect(() => { useEffect(() => {
setLoading(false);
setMapType(0); setMapType(0);
setAdvanced(0); setAdvanced(0);
setCurrent(false); setCurrent(false);
......
...@@ -37,7 +37,7 @@ import { ...@@ -37,7 +37,7 @@ import {
const { Item } = Form; const { Item } = Form;
const { Option } = Select; const { Option } = Select;
const NewEditModal = props => { const NewEditModal = props => {
const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name } = props; const { callBackSubmit = () => {}, type, formObj, visible, baseMap, name, onCancel } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [radio, setRadio] = useState(); const [radio, setRadio] = useState();
const [alpha, setAlpha] = useState(1); const [alpha, setAlpha] = useState(1);
...@@ -61,6 +61,7 @@ const NewEditModal = props => { ...@@ -61,6 +61,7 @@ const NewEditModal = props => {
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let arr = {}; let arr = {};
console.log(mapType); console.log(mapType);
...@@ -102,29 +103,30 @@ const NewEditModal = props => { ...@@ -102,29 +103,30 @@ const NewEditModal = props => {
url: obj.url, url: obj.url,
icon: obj.icon, icon: obj.icon,
type: obj.type, type: obj.type,
// extent: '', extent: null,
// baseLayer: '', baseLayer: null,
// proxyUrl: '', proxyUrl: null,
// levelStart: '', levelStart: null,
// origin: '', origin: null,
// resolution: '', resolution: null,
// tileMatrix: '', tileMatrix: null,
// levelEnd: '', levelEnd: null,
// levelEndEnlarge: '', levelEndEnlarge: false,
// m_Ip: '', m_Ip: null,
// m_Port: '', m_Port: null,
// m_User: '', m_User: null,
// m_Pwd: '', m_Pwd: null,
// gsAppName: '', gsAppName: null,
}), }),
}; };
} }
SetServiceConfig(arr) SetServiceConfig(arr)
.then(res => { .then(res => {
setLoading(false);
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
form.resetFields(); form.resetFields();
onCancel();
setLoading(false);
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
message: '提示', message: '提示',
...@@ -132,6 +134,7 @@ const NewEditModal = props => { ...@@ -132,6 +134,7 @@ const NewEditModal = props => {
description: res.message || type == 'add' ? '新增成功' : '编辑成功', description: res.message || type == 'add' ? '新增成功' : '编辑成功',
}); });
} else { } else {
setLoading(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -148,6 +151,11 @@ const NewEditModal = props => { ...@@ -148,6 +151,11 @@ const NewEditModal = props => {
const onFinish = value => {}; const onFinish = value => {};
useEffect(() => { useEffect(() => {
setLoading(false);
setSpaceData([]);
setKeyData([]);
setData([]);
setAreaData([]);
console.log(formObj); console.log(formObj);
setAlpha(formObj.alpha); setAlpha(formObj.alpha);
let aa; let aa;
......
...@@ -171,7 +171,7 @@ const TileData = props => { ...@@ -171,7 +171,7 @@ const TileData = props => {
}; };
return ( return (
<> <div className={styles.tileContainer}>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div className={styles.tileBtn}> <div className={styles.tileBtn}>
<Button <Button
...@@ -183,6 +183,7 @@ const TileData = props => { ...@@ -183,6 +183,7 @@ const TileData = props => {
新增 新增
</Button> </Button>
</div> </div>
<div style={{ height: 'calc(100vh - 220px)', width: '100%' }}>
<Table <Table
columns={columns} columns={columns}
dataSource={tileData} dataSource={tileData}
...@@ -193,6 +194,8 @@ const TileData = props => { ...@@ -193,6 +194,8 @@ const TileData = props => {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
}} }}
/> />
</div>
<AddModal <AddModal
visible={addVisible} visible={addVisible}
onCancel={() => setAddVisible(false)} onCancel={() => setAddVisible(false)}
...@@ -220,7 +223,7 @@ const TileData = props => { ...@@ -220,7 +223,7 @@ const TileData = props => {
name={name} name={name}
/> />
</Spin> </Spin>
</> </div>
); );
}; };
export default TileData; export default TileData;
...@@ -199,6 +199,7 @@ const VectorData = props => { ...@@ -199,6 +199,7 @@ const VectorData = props => {
return ( return (
<> <>
<div className={styles.tileContainer}>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div className={styles.tileBtn}> <div className={styles.tileBtn}>
<Button <Button
...@@ -210,6 +211,7 @@ const VectorData = props => { ...@@ -210,6 +211,7 @@ const VectorData = props => {
新增 新增
</Button> </Button>
</div> </div>
<div style={{ height: 'calc(100vh - 220px)', width: '100%' }}>
<Table <Table
columns={columns} columns={columns}
dataSource={tileData} dataSource={tileData}
...@@ -220,6 +222,7 @@ const VectorData = props => { ...@@ -220,6 +222,7 @@ const VectorData = props => {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
}} }}
/> />
</div>
<AddModal <AddModal
visible={visible} visible={visible}
onCancel={() => setVisible(false)} onCancel={() => setVisible(false)}
...@@ -234,6 +237,7 @@ const VectorData = props => { ...@@ -234,6 +237,7 @@ const VectorData = props => {
metaData={currentMetaData} metaData={currentMetaData}
/> />
</Spin> </Spin>
</div>
</> </>
); );
}; };
......
import React, { useEffect, useState } from 'react';
import { Modal, Checkbox } from 'antd';
import { RoleGroupList } from '@/services/messagemanage/messagemanage';
import styles from './RoleModal.less';
const CheckboxGroup = Checkbox.Group;
const RoleModal = porps => {
const { visible, rolCallBack, onCancel, selectValue } = porps;
const [roleList, setRoleList] = useState([]); // 角色列表
useEffect(() => {
if (visible) {
let hasCheckList = selectValue ? selectValue.split(',') : [];
RoleGroupList().then(res => {
if (res.code === 0) {
let roleListData = res.data.roleList;
// 给子角色分类放到外面来
roleListData.forEach((item, index) => {
if (item.child.length > 0) {
item.child.forEach((val, i) => {
val.visibleTitle = `${item.visibleTitle}(${val.visibleTitle})`;
roleListData.splice(index + 1 + i, 0, val);
});
}
});
console.log(roleListData, 'roleListData');
let list = roleListData.map(item => {
let checkedList = []; // 已选
let options = []; // 数据源
let indeterminate = false; // 有选中但没全选样式
let checkAll = false; // 全选样式
let arr = {};
let name = {};
let last = {};
options = item.roleList.map(val => {
hasCheckList.forEach(ele => {
if (val.roleID === ele) {
checkedList.push(val.roleName);
}
});
return val.roleName;
});
name = item.roleList.map(val => {
hasCheckList.forEach(ele => {
if (val.roleID === ele) {
last[val.roleID] = val.roleName;
}
});
arr[val.roleID] = val.roleName;
return arr;
});
if (checkedList.length === options.length && checkedList.length > 0) {
checkAll = true;
}
if (checkedList.length < options.length && checkedList.length > 0) {
indeterminate = true;
}
return {
options,
checkedList,
checkAll,
name,
last,
arr,
indeterminate,
visibleTitle: item.visibleTitle,
};
});
console.log(list, 'list');
setRoleList(list);
}
});
console.log(selectValue, 'selectValue');
}
}, [visible]);
// 多选change事件
const onCheckAllChange = (e, index) => {
let newCheckList = JSON.parse(JSON.stringify(roleList));
let aa = {};
if (e.target.checked) {
newCheckList[index].options.map(j => {
Object.keys(newCheckList[index].arr).forEach(i => {
if (newCheckList[index].arr[i] == j) {
aa[i] = j;
}
});
});
newCheckList[index].last = aa;
} else {
newCheckList[index].last = {};
}
newCheckList[index].checkedList = e.target.checked ? newCheckList[index].options : [];
newCheckList[index].indeterminate = false;
newCheckList[index].checkAll = e.target.checked;
setRoleList(newCheckList);
};
// 单选change事件
const onChange = (list, index) => {
let newCheckList = JSON.parse(JSON.stringify(roleList));
let aa = {};
list.map(j => {
Object.keys(newCheckList[index].arr).forEach(i => {
if (newCheckList[index].arr[i] == j) {
aa[i] = j;
}
});
});
newCheckList[index].last = aa;
newCheckList[index].checkedList = list;
newCheckList[index].indeterminate =
!!list.length && list.length < newCheckList[index].options.length;
newCheckList[index].checkAll = list.length === newCheckList[index].options.length;
setRoleList(newCheckList);
};
return (
<div>
<Modal
title="关联角色"
visible={visible}
onOk={() => rolCallBack(roleList)}
width="900px"
onCancel={onCancel}
maskClosable={false}
destroyOnClose
centered
>
<div className={styles.checkContainer}>
{roleList.map((item, index) => (
<div className={styles.checkContent} key={item.visibleTitle}>
<div className={styles.topCheckbox}>
<Checkbox
indeterminate={item.indeterminate}
onChange={e => onCheckAllChange(e, index)}
checked={item.checkAll}
>
{item.visibleTitle}
</Checkbox>
</div>
<div className={styles.bottomCheckbox}>
<CheckboxGroup
value={item.checkedList}
onChange={list => onChange(list, index)}
style={{ display: 'flex', flexWrap: 'wrap' }}
>
{item.options.map(val => (
<Checkbox key={val} value={val}>
{val}
</Checkbox>
))}
</CheckboxGroup>
</div>
</div>
))}
</div>
</Modal>
</div>
);
};
export default RoleModal;
.checkContainer {
height: 500px;
width: 90%;
overflow-y: scroll;
// margin: 20px 0;
margin-left: 50%;
margin-bottom: 20px;
transform: translateX(-50%);
padding-right: 5px;
.checkContent {
display: flex;
width: 100%;
flex-direction: column;
border: 1px solid #c2cdfd;
border-radius: 5px;
margin-top: 20px;
min-height: 50px;
padding: 0 10px 10px 20px;
.ant-checkbox-wrapper {
background-color: #fff;
}
.topCheckbox {
height: 20px;
margin: -10px 0 0 0px;
line-height: 20px;
}
.topCheckbox > label :hover {
font-weight: 600;
}
.bottomCheckbox {
margin-top: 10px;
.ant-checkbox-wrapper {
min-width: 200px;
margin-left: 0;
}
}
.checkdiv {
display: flex;
flex-wrap: wrap;
}
}
}
/* eslint-disable no-return-assign */ /* eslint-disable no-return-assign */
import { Space, Table, Button, Popconfirm, notification, Divider, Checkbox, Spin } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Divider, Checkbox, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect, useCallback } from 'react';
import styles from '../SchemeConfig.less';
import VisibleRoleModal from '@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal'; import VisibleRoleModal from '@/pages/platformCenter/messageManage/projectManage/components/RolseSelect/VisibleRoleModal';
import { PlusOutlined } from '@ant-design/icons';
import { PlusOutlined, UserAddOutlined } from '@ant-design/icons';
import RoleModal from './RoleModal';
import styles from '../SchemeConfig.less';
import { import {
deleteConfig, deleteConfig,
setServiceType, setServiceType,
SetServiceConfig, SetServiceConfig,
GetMaplayerByTerminalType, GetMaplayerByTerminalType,
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import { UserAddOutlined } from '@ant-design/icons'; import { RoleGroupList } from '@/services/messagemanage/messagemanage';
import AddModal from './AddModal'; import AddModal from './AddModal';
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
...@@ -27,6 +29,46 @@ const VectorData = props => { ...@@ -27,6 +29,46 @@ const VectorData = props => {
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [checkLoading, setCheckLoading] = useState(false); const [checkLoading, setCheckLoading] = useState(false);
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' }); const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [tree, setTree] = useState([]);
const [leafs, setLeafs] = useState([]);
const [addVisible, setAddVisible] = useState(false);
const [checkValue, setCheckValue] = useState([]);
// useEffect(() => {
// // RoleGroupList().then(async res => {
// // let dataArr = {};
// // let tree1 = [];
// // let leafs1 = [];
// // console.log(res.data.roleList);
// // // eslint-disable-next-line no-unused-expressions
// // res.data &&
// // res.data.roleList.map((item, index) => {
// // if (item.roleList.length > 0) {
// // tree1.push({
// // name: item.visibleTitle,
// // id: index,
// // children: item.roleList.map(roleItem => {
// // leafs1.push({
// // name: roleItem.roleName,
// // id: roleItem.roleID,
// // });
// // const leafNode = {
// // name: roleItem.roleName,
// // id: roleItem.roleID,
// // children: [],
// // };
// // return leafNode;
// // }),
// // });
// // }
// // });
// // setTree(tree1);
// // setLeafs(leafs1);
// // console.log(res.data.roleList);
// // console.log(tree1);
// // console.log(leafs1);
// // });
// }, []);
const columns = [ const columns = [
{ {
title: '默认方案', title: '默认方案',
...@@ -53,18 +95,12 @@ const VectorData = props => { ...@@ -53,18 +95,12 @@ const VectorData = props => {
title: '关联角色', title: '关联角色',
align: 'center', align: 'center',
key: 'type', key: 'type',
render: (text, record, index) => ( render: record => (
<Space> <Space size="middle">
<Space> <UserAddOutlined
<div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}> onClick={() => pickRole(record)}
<VisibleRoleModal style={{ fontSize: '18px', color: '#1890FF' }}
onSubmit={onPushSubmit}
title={'关联角色'}
initValues={record.roles != null ? record.roles.split(',') : []}
operate={<UserAddOutlined />}
/> />
</div>
</Space>
</Space> </Space>
), ),
}, },
...@@ -118,17 +154,12 @@ const VectorData = props => { ...@@ -118,17 +154,12 @@ const VectorData = props => {
title: '关联角色', title: '关联角色',
align: 'center', align: 'center',
key: 'type', key: 'type',
render: (text, record, index) => ( render: record => (
<Space> <Space size="middle">
<div onClick={() => pickRole(record)} style={{ cursor: 'pointer' }}> <UserAddOutlined
<VisibleRoleModal onClick={() => pickRole(record)}
onSubmit={onPushSubmit} style={{ fontSize: '18px', color: '#1890FF' }}
selectValue={[]}
title={'关联角色'}
initValues={record.roles != null ? record.roles.split(',') : []}
operate={<UserAddOutlined />}
/> />
</div>
</Space> </Space>
), ),
}, },
...@@ -158,17 +189,14 @@ const VectorData = props => { ...@@ -158,17 +189,14 @@ const VectorData = props => {
]; ];
// 获取选中的角色 // 获取选中的角色
const onPushSubmit = value => { const onPushSubmit = value => {
let id = []; setAddVisible(false);
if (value.length) { if (value.length) {
id = value.map(item => {
return item.id;
});
let query = { let query = {
schemename: record.schemename, schemename: record.schemename,
terminalType: record.isStatus, terminalType: record.isStatus,
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
roles: id.join(','), roles: value.join(','),
}), }),
}; };
SetServiceConfig(query) SetServiceConfig(query)
...@@ -185,24 +213,42 @@ const VectorData = props => { ...@@ -185,24 +213,42 @@ const VectorData = props => {
}); });
} }
}; };
const rolCallBack = useCallback(list => {
let strList = [];
if (list.length > 0) {
list.forEach(item => {
console.log(item, 'item');
Object.keys(item.last).forEach(i => {
strList.push(i);
});
});
console.log(strList);
onPushSubmit(strList);
}
});
// 获取角色 // 获取角色
const pickRole = record => { const pickRole = e => {
console.log('recird', record); setRecord(e);
setRecord(record); setAddVisible(true);
console.log(tree);
console.log(leafs);
let arr = e.roles != null ? e.roles.split(',') : [];
console.log(arr);
setCheckValue(arr);
}; };
// 设置web方案 // 设置web方案
const onChangeCheck = (e, record, index) => { const onChangeCheck = (e, record, index) => {
setCheckLoading(true); setCheckLoading(true);
const newLoadings = [...webStatus]; const newLoadings = [...webStatus];
newLoadings.map((item, loadIndex) => { newLoadings.map((item, loadIndex) =>
return loadIndex == index loadIndex == index
? (newLoadings[loadIndex] = !newLoadings[loadIndex]) ? (newLoadings[loadIndex] = !newLoadings[loadIndex])
: (newLoadings[loadIndex] = false); : (newLoadings[loadIndex] = false),
}); );
setWebStatus(newLoadings); setWebStatus(newLoadings);
console.log(newLoadings);
let query = { let query = {
schemename: record['schemename'], schemename: record.schemename,
type: 'dynamic', type: 'dynamic',
}; };
if (!newLoadings[index]) { if (!newLoadings[index]) {
...@@ -211,39 +257,102 @@ const VectorData = props => { ...@@ -211,39 +257,102 @@ const VectorData = props => {
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'dynamic'; changehandData[index].type = 'dynamic';
console.log(changehandData);
setWebData(changehandData); setWebData(changehandData);
prompt('success', '设置成功'); prompt('success', '设置成功');
} else { } else {
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message); prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
} }
}); });
return; return;
} }
var beforeDefault = webData.findIndex(item => item['type'] == 'pipenet'); let beforeDefault = webData.findIndex(item => item.type == 'pipenet');
setServiceType({ setServiceType({
schemename: record['schemename'], schemename: record.schemename,
type: 'pipenet', type: 'pipenet',
}).then(res => { }).then(res => {
setCheckLoading(false); setCheckLoading(false);
if (res.IsSuccess) { if (res.IsSuccess) {
const changehandData = [...webData]; const changehandData = [...webData];
changehandData[index].type = 'pipenet'; changehandData[index].type = 'pipenet';
console.log(changehandData);
setWebData(changehandData); setWebData(changehandData);
if (beforeDefault != -1) { if (beforeDefault != -1) {
setServiceType({ setServiceType({
schemename: changehandData[beforeDefault].schemename, schemename: changehandData[beforeDefault].schemename,
type: 'dynamic', type: 'dynamic',
}).then(res => { }).then(resdata => {
setCheckLoading(false); setCheckLoading(false);
if (res.IsSuccess) { if (resdata.IsSuccess) {
const changehandData1 = [...webData]; const changehandData1 = [...webData];
changehandData1[beforeDefault].type = 'dynamic'; changehandData1[beforeDefault].type = 'dynamic';
console.log(changehandData1);
setWebData(changehandData1); setWebData(changehandData1);
prompt('success', '设置成功'); prompt('success', '设置成功');
// return;
} else {
prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
}
});
} else {
prompt('success', '设置成功');
}
}
});
};
// 无选中值时的默认值
const onChangeCheck1 = (e, record, index, aa) => {
console.log(aa);
console.log(webStatus);
setCheckLoading(true);
const newLoadings = [...aa];
let query = {
schemename: record.schemename,
type: 'dynamic',
};
if (!newLoadings[index]) {
setServiceType(query).then(res => {
setCheckLoading(false);
if (res.IsSuccess) {
const changehandData = [...webData];
changehandData[index].type = 'dynamic';
// setWebData(changehandData);
prompt('success', '设置成功');
} else {
prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
}
});
return; return;
} }
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message); let beforeDefault = webData.findIndex(item => item.type == 'pipenet');
setServiceType({
schemename: record.schemename,
type: 'pipenet',
}).then(res => {
setCheckLoading(false);
if (res.IsSuccess) {
const changehandData = [...webData];
changehandData[index].type = 'pipenet';
// setWebData(changehandData);
if (beforeDefault != -1) {
setServiceType({
schemename: changehandData[beforeDefault].schemename,
type: 'dynamic',
}).then(resdata => {
setCheckLoading(false);
if (resdata.IsSuccess) {
const changehandData1 = [...webData];
changehandData1[beforeDefault].type = 'dynamic';
// setWebData(changehandData1);
prompt('success', '设置成功');
} else {
prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
}
}); });
} else {
prompt('success', '设置成功');
} }
} }
}); });
...@@ -253,14 +362,14 @@ const VectorData = props => { ...@@ -253,14 +362,14 @@ const VectorData = props => {
const onChangeHand = (e, record, index) => { const onChangeHand = (e, record, index) => {
setCheckLoading(true); setCheckLoading(true);
const newLoadings = [...handStatus]; const newLoadings = [...handStatus];
newLoadings.map((item, loadIndex) => { newLoadings.map((item, loadIndex) =>
return loadIndex == index loadIndex == index
? (newLoadings[loadIndex] = !newLoadings[loadIndex]) ? (newLoadings[loadIndex] = !newLoadings[loadIndex])
: (newLoadings[loadIndex] = false); : (newLoadings[loadIndex] = false),
}); );
setHandStatus(newLoadings); setHandStatus(newLoadings);
let query = { let query = {
schemename: record['schemename'], schemename: record.schemename,
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
...@@ -276,14 +385,14 @@ const VectorData = props => { ...@@ -276,14 +385,14 @@ const VectorData = props => {
setHandData(changehandData); setHandData(changehandData);
prompt('success', '设置成功'); prompt('success', '设置成功');
} else { } else {
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message); prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
} }
}); });
return; return;
} }
var beforeDefault = handData.findIndex(item => item['isDefault']); let beforeDefault = handData.findIndex(item => item.isDefault);
SetServiceConfig({ SetServiceConfig({
schemename: record['schemename'], schemename: record.schemename,
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
...@@ -303,17 +412,87 @@ const VectorData = props => { ...@@ -303,17 +412,87 @@ const VectorData = props => {
jsonCfg: JSON.stringify({ jsonCfg: JSON.stringify({
isDefault: false, isDefault: false,
}), }),
}).then(res => { }).then(resdata => {
setCheckLoading(false); setCheckLoading(false);
if (res.IsSuccess) { if (resdata.code === 0) {
const changehandData1 = [...handData]; const changehandData1 = [...handData];
changehandData1[beforeDefault].isDefault = false; changehandData1[beforeDefault].isDefault = false;
setHandData(changehandData1); setHandData(changehandData1);
prompt('success', '设置成功'); prompt('success', '设置成功');
// return;
} else {
prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
}
});
} else {
prompt('success', '设置成功');
}
}
});
};
// 选择手持方案
const onChangeHand1 = (e, record, index, aa) => {
setCheckLoading(true);
const newLoadings = [...aa];
let query = {
schemename: record.schemename,
terminalType: 'phone',
isBaseMap: false,
jsonCfg: JSON.stringify({
isDefault: newLoadings[index],
}),
};
if (!newLoadings[index]) {
SetServiceConfig(query).then(res => {
setCheckLoading(false);
if (res.msg === 'Ok') {
const changehandData = [...handData];
changehandData[index].isDefault = false;
// setHandData(changehandData);
prompt('success', '设置成功');
} else {
prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
}
});
return; return;
} }
prompt('fail', `${record['schemename']}默认设置时遇到错误:` + res.message); let beforeDefault = handData.findIndex(item => item.isDefault);
SetServiceConfig({
schemename: record.schemename,
terminalType: 'phone',
isBaseMap: false,
jsonCfg: JSON.stringify({
isDefault: true,
}),
}).then(res => {
setCheckLoading(false);
if (res.msg === 'Ok') {
const changehandData = [...handData];
changehandData[index].isDefault = true;
// setHandData(changehandData);
if (beforeDefault != -1) {
SetServiceConfig({
schemename: changehandData[beforeDefault].schemename,
terminalType: 'phone',
isBaseMap: false,
jsonCfg: JSON.stringify({
isDefault: false,
}),
}).then(resdata => {
setCheckLoading(false);
if (resdata.code === 0) {
const changehandData1 = [...handData];
changehandData1[beforeDefault].isDefault = false;
// setHandData(changehandData1);
prompt('success', '设置成功');
// return;
} else {
prompt('fail', `${record.schemename}默认设置时遇到错误:${res.message}`);
}
}); });
} else {
prompt('success', '设置成功');
} }
} }
}); });
...@@ -335,12 +514,17 @@ const VectorData = props => { ...@@ -335,12 +514,17 @@ const VectorData = props => {
}; };
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1); if (type == 'add') {
renderTileWeb();
} else {
renderTile();
}
// setFlag(flag + 1);
}; };
// 删除web配置方案 // 删除web配置方案
const delWebConfirm = record => { const delWebConfirm = record => {
deleteConfig({ deleteConfig({
schemename: record['schemename'], schemename: record.schemename,
terminalType: 'web', terminalType: 'web',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
...@@ -355,7 +539,7 @@ const VectorData = props => { ...@@ -355,7 +539,7 @@ const VectorData = props => {
// 删除手持配置方案 // 删除手持配置方案
const delhandConfirm = record => { const delhandConfirm = record => {
deleteConfig({ deleteConfig({
schemename: record['schemename'], schemename: record.schemename,
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
}).then(res => { }).then(res => {
...@@ -372,8 +556,8 @@ const VectorData = props => { ...@@ -372,8 +556,8 @@ const VectorData = props => {
setType(type); setType(type);
let listData = []; let listData = [];
type == 'add' ? (listData = webData) : (listData = handData); type == 'add' ? (listData = webData) : (listData = handData);
let webSchemenameArr = [], let webSchemenameArr = [];
schemeArr = []; let schemeArr = [];
setTreeLoading(true); setTreeLoading(true);
GetMaplayerByTerminalType({ GetMaplayerByTerminalType({
terminalType: 'scheme', terminalType: 'scheme',
...@@ -408,22 +592,19 @@ const VectorData = props => { ...@@ -408,22 +592,19 @@ const VectorData = props => {
}); });
}; };
useEffect(() => { useEffect(() => {
console.log(flag);
renderTile(); renderTile();
renderTileWeb();
}, [flag]); }, [flag]);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
const renderTile = () => { const renderTile = () => {
setCheckLoading(true); setCheckLoading(true);
// 查询手持方案 // 查询手持方案
var schemeConfigQueryRequest = GetMaplayerByTerminalType({ let schemeConfigQueryRequest = GetMaplayerByTerminalType({
terminalType: 'phone', terminalType: 'phone',
isBaseMap: false, isBaseMap: false,
}); });
// 查询web方案 Promise.all([schemeConfigQueryRequest])
var webSchemeQueryRequest = GetMaplayerByTerminalType({
terminalType: 'web',
isBaseMap: false,
});
Promise.all([schemeConfigQueryRequest, webSchemeQueryRequest])
.then(res => { .then(res => {
console.log('res', res); console.log('res', res);
if (res[0].msg === 'Ok' && res[0].data.phone) { if (res[0].msg === 'Ok' && res[0].data.phone) {
...@@ -434,16 +615,44 @@ const VectorData = props => { ...@@ -434,16 +615,44 @@ const VectorData = props => {
} else { } else {
arr.push(false); arr.push(false);
} }
item.isStatus = 'phone'; item.isStatus = 'phone';
return item; return item;
}); });
setHandData(res[0].data.phone.optionalLayer.layers); setHandData(res[0].data.phone.optionalLayer.layers);
if (arr.indexOf(true) == -1) {
arr[arr.length - 1] = true;
setHandStatus(arr); setHandStatus(arr);
onChangeHand1(
'',
res[0].data.phone.optionalLayer.layers[arr.length - 1],
arr.length - 1,
arr,
);
} else {
setHandStatus(arr);
}
} }
if (res[1].msg === 'Ok' && res[1].data.web) { setCheckLoading(false);
})
.catch(e => {
setCheckLoading(false);
});
};
// 获取瓦片数据配置数据
const renderTileWeb = () => {
setCheckLoading(true);
// 查询web方案
let webSchemeQueryRequest = GetMaplayerByTerminalType({
terminalType: 'web',
isBaseMap: false,
});
Promise.all([webSchemeQueryRequest])
.then(res => {
console.log('res', res);
if (res[0].msg === 'Ok' && res[0].data.web) {
let arr = []; let arr = [];
res[1].data.web.optionalLayer.layers.map((item, index) => { res[0].data.web.optionalLayer.layers.map((item, index) => {
if (item.type === 'pipenet') { if (item.type === 'pipenet') {
arr.push(true); arr.push(true);
} else { } else {
...@@ -452,9 +661,21 @@ const VectorData = props => { ...@@ -452,9 +661,21 @@ const VectorData = props => {
item.isStatus = 'web'; item.isStatus = 'web';
return item; return item;
}); });
setWebData(res[1].data.web.optionalLayer.layers); console.log(res[0].data.web.optionalLayer.layers);
setWebData(res[0].data.web.optionalLayer.layers);
if (arr.indexOf(true) == -1) {
arr[arr.length - 1] = true;
setWebStatus(arr);
onChangeCheck1(
'',
res[0].data.web.optionalLayer.layers[arr.length - 1],
arr.length - 1,
arr,
);
} else {
setWebStatus(arr); setWebStatus(arr);
} }
}
setCheckLoading(false); setCheckLoading(false);
}) })
.catch(e => { .catch(e => {
...@@ -463,9 +684,9 @@ const VectorData = props => { ...@@ -463,9 +684,9 @@ const VectorData = props => {
}; };
return ( return (
<> <div className={styles.solutionContainer}>
<Spin tip="loading..." spinning={checkLoading}> <Spin tip="loading..." spinning={checkLoading}>
<div> <div style={{ height: 'calc(100vh - 150px)', width: '100%', overflow: 'scroll' }}>
<Divider orientation="left"> <Divider orientation="left">
<div className={styles.divider}> <div className={styles.divider}>
{' '} {' '}
...@@ -482,7 +703,7 @@ const VectorData = props => { ...@@ -482,7 +703,7 @@ const VectorData = props => {
columns={columns} columns={columns}
dataSource={webData} dataSource={webData}
bordered bordered
style={{ height: 'calc(100vh - 610px)' }} // style={{ height: 'calc(100vh - 610px)' }}
pagination={{ pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8, defaultPageSize: 8,
...@@ -511,7 +732,7 @@ const VectorData = props => { ...@@ -511,7 +732,7 @@ const VectorData = props => {
bordered bordered
rowKey="schemename" rowKey="schemename"
scroll={{ y: 210 }} scroll={{ y: 210 }}
style={{ height: 'calc(100vh - 610px)' }} // style={{ height: 'calc(100vh - 610px)' }}
pagination={{ pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`, showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8, defaultPageSize: 8,
...@@ -530,7 +751,24 @@ const VectorData = props => { ...@@ -530,7 +751,24 @@ const VectorData = props => {
formObj={formObj} formObj={formObj}
listData={schemename} listData={schemename}
/> />
</> {/* <VisibleRoleModal
visible={addVisible}
onCancel={() => setAddVisible(false)}
onSubmit={onPushSubmit}
title="关联角色"
initValues={checkValue}
tree={tree}
leafs={leafs}
/> */}
<RoleModal
selectValue={checkValue.toString()}
visible={addVisible}
rolCallBack={roleList => rolCallBack(roleList)}
onCancel={() => {
setAddVisible(false);
}}
/>
</div>
); );
}; };
export default VectorData; export default VectorData;
...@@ -20,61 +20,40 @@ const VisibleRoleModal = props => { ...@@ -20,61 +20,40 @@ const VisibleRoleModal = props => {
const [dataTree, setDataTree] = useState([]); const [dataTree, setDataTree] = useState([]);
const [dataLeafs, setDataLeafs] = useState([]); const [dataLeafs, setDataLeafs] = useState([]);
const [selectValues, setSelectValues] = useState([]); const [selectValues, setSelectValues] = useState([]);
const { onSubmit, title, operate, initValues, selectValue } = props; const {
const [isUnmount, setIsUnmount] = useState(true); onSubmit,
title,
const GetRoleGroupList = () => {}; operate,
initValues,
selectValue,
tree,
leafs,
visible,
onCancel,
} = props;
useEffect(() => { useEffect(() => {
console.log(tree);
console.log(leafs);
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
let isUnmount = false;
console.log('selectValue', selectValue);
if (selectValue) { if (selectValue) {
setSelectRole(selectValue); setSelectRole(selectValue);
} }
RoleGroupList().then(async res => {
let tree = [];
let leafs = [];
// eslint-disable-next-line no-unused-expressions
res.data &&
res.data.roleList.map((item, index) => {
tree.push({
name: item.visibleTitle,
id: index,
children: item.roleList.map(roleItem => {
leafs.push({
name: roleItem.roleName,
id: roleItem.roleID,
});
const leafNode = {
name: roleItem.roleName,
id: roleItem.roleID,
children: [],
};
return leafNode;
}),
});
});
if (!isUnmount) {
setDataTree(tree); setDataTree(tree);
setDataLeafs(leafs); setDataLeafs(leafs);
// eslint-disable-next-line no-return-assign }, [visible]);
return () => (isUnmount = true);
}
});
}, [selectValue]);
const handleCancel = () => { const handleCancel = () => {
setPreviewVisible(false); onCancel();
}; };
const handleOk = () => { const handleOk = () => {
setPreviewVisible(false);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
console.log(selectValues);
onSubmit && onSubmit(selectValues); onSubmit && onSubmit(selectValues);
}; };
const handleClick = () => { // const handleClick = () => {
setPreviewVisible(true); // setPreviewVisible(true);
}; // };
const onChange2 = value => { const onChange2 = value => {
console.log(value); console.log(value);
const strArr = []; const strArr = [];
...@@ -87,7 +66,7 @@ const VisibleRoleModal = props => { ...@@ -87,7 +66,7 @@ const VisibleRoleModal = props => {
}; };
return ( return (
<div className={styles.role_container}> <div className={styles.role_container}>
{operate ? ( {/* {operate ? (
<div onClick={handleClick}>{operate}</div> <div onClick={handleClick}>{operate}</div>
) : ( ) : (
<div style={{ display: 'flex', flexDirection: 'row', width: '100%' }}> <div style={{ display: 'flex', flexDirection: 'row', width: '100%' }}>
...@@ -96,7 +75,7 @@ const VisibleRoleModal = props => { ...@@ -96,7 +75,7 @@ const VisibleRoleModal = props => {
{title || '选择角色'} {title || '选择角色'}
</div> </div>
</div> </div>
)} )} */}
<SiteModal <SiteModal
{...props} {...props}
...@@ -113,7 +92,7 @@ const VisibleRoleModal = props => { ...@@ -113,7 +92,7 @@ const VisibleRoleModal = props => {
okText="确认" okText="确认"
onOk={() => handleOk()} onOk={() => handleOk()}
confirmLoading={loading} confirmLoading={loading}
visible={previewVisible} visible={visible}
onCancel={handleCancel} onCancel={handleCancel}
> >
<div className={styles.list_card}> <div className={styles.list_card}>
...@@ -123,18 +102,14 @@ const VisibleRoleModal = props => { ...@@ -123,18 +102,14 @@ const VisibleRoleModal = props => {
data={dataTree} data={dataTree}
dataLeafs={dataLeafs} dataLeafs={dataLeafs}
initValues={initValues} initValues={initValues}
selectValue={selectValue}
/> />
</div> </div>
</SiteModal> </SiteModal>
</div> </div>
); );
}; };
const checkChildrenByCondition = ( const checkChildrenByCondition = (item, fn, withGroup = true, method = 'every') => {
item,
fn,
withGroup = true,
method = 'every',
) => {
if (item.children && item.children.length > 0) { if (item.children && item.children.length > 0) {
return fn(item); return fn(item);
} }
...@@ -144,13 +119,18 @@ const checkChildrenByCondition = ( ...@@ -144,13 +119,18 @@ const checkChildrenByCondition = (
return withGroup ? [fn(item), ...childrenResults] : [...childrenResults]; return withGroup ? [fn(item), ...childrenResults] : [...childrenResults];
}; };
const ListCard = props => { const ListCard = props => {
const { onChange, onChange2, data, dataLeafs, initValues } = props; const { onChange, onChange2, data, dataLeafs, initValues, selectValue } = props;
const [changedItem, setChangedItem] = useState({ item: {} }); const [changedItem, setChangedItem] = useState({ item: {} });
const [indeterminateAll, setIndeterminateAll] = useState(false);
const [checkValue, setCheckValue] = useState(false);
const [valueList, setValueList] = useState([]); const [valueList, setValueList] = useState([]);
const checkAll = e => { const checkAll = e => {
setIndeterminateAll(false);
if (e.target.checked) { if (e.target.checked) {
setCheckValue(true);
const result = data.map(item => getAllID(item)).flat(Infinity); const result = data.map(item => getAllID(item)).flat(Infinity);
console.log(result);
setValueList(result); setValueList(result);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
const fliterResult = filterChildren(result); const fliterResult = filterChildren(result);
...@@ -164,6 +144,7 @@ const ListCard = props => { ...@@ -164,6 +144,7 @@ const ListCard = props => {
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult); onChange2 && onChange2(fliterResult);
} else { } else {
setCheckValue(false);
setValueList([]); setValueList([]);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
const fliterResult = filterChildren(result); const fliterResult = filterChildren(result);
...@@ -176,8 +157,7 @@ const ListCard = props => { ...@@ -176,8 +157,7 @@ const ListCard = props => {
const getAllID = item => { const getAllID = item => {
let result = []; let result = [];
const haveChildren = const haveChildren = Array.isArray(item.children) && item.children.length > 0;
Array.isArray(item.children) && item.children.length > 0;
// 统一使用 getId // 统一使用 getId
result.push(getId(item)); result.push(getId(item));
if (haveChildren) { if (haveChildren) {
...@@ -203,6 +183,7 @@ const ListCard = props => { ...@@ -203,6 +183,7 @@ const ListCard = props => {
const removekeys = _.difference(childrenKeys, checkedKeys); const removekeys = _.difference(childrenKeys, checkedKeys);
let result = _.uniq(_.union(checkedKeys, valueList)); let result = _.uniq(_.union(checkedKeys, valueList));
_.remove(result, v => removekeys.includes(v)); _.remove(result, v => removekeys.includes(v));
console.log(result);
setValueList(result); setValueList(result);
if (sourceItem) setChangedItem(sourceItem); if (sourceItem) setChangedItem(sourceItem);
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
...@@ -219,15 +200,43 @@ const ListCard = props => { ...@@ -219,15 +200,43 @@ const ListCard = props => {
onChange && onChange(strArr.toString()); onChange && onChange(strArr.toString());
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
onChange2 && onChange2(fliterResult); onChange2 && onChange2(fliterResult);
console.log(fliterResult);
console.log(strArr.toString());
}; };
useEffect(() => { useEffect(() => {
// eslint-disable-next-line no-unused-expressions // eslint-disable-next-line no-unused-expressions
initValues && setValueList(initValues); initValues && setValueList(initValues);
}, []); }, []);
useEffect(() => {
console.log(initValues);
console.log(initValues.length);
let dataaa = [];
data.map(i => {
i.children.map(j => {
dataaa.push(j);
});
});
console.log(dataaa);
if (initValues.length === 0) {
setIndeterminateAll(false);
setCheckValue(false);
} else if (initValues.length < dataaa.length) {
setIndeterminateAll(true);
setCheckValue(false);
} else {
setIndeterminateAll(false);
setCheckValue(true);
}
}, [selectValue]);
return ( return (
<div> <div>
<Checkbox onChange={checkAll}>全选/全不选</Checkbox> <Checkbox onChange={checkAll} indeterminate={indeterminateAll} checked={checkValue}>
全选/全不选
</Checkbox>
{data.map((item, i) => ( {data.map((item, i) => (
<ListCardItem <ListCardItem
key={i} key={i}
......
/* eslint-disable react/jsx-boolean-value */
/* eslint-disable indent */ /* eslint-disable indent */
/* eslint-disable prettier/prettier */ /* eslint-disable prettier/prettier */
/* eslint-disable default-case */ /* eslint-disable default-case */
...@@ -17,6 +18,7 @@ const AddModal = props => { ...@@ -17,6 +18,7 @@ const AddModal = props => {
const [selectChange, setSelectChange] = useState('轻应用'); const [selectChange, setSelectChange] = useState('轻应用');
const [selectChange1, setSelectChange1] = useState('否'); const [selectChange1, setSelectChange1] = useState('否');
const [selectChange2, setSelectChange2] = useState('主码流'); const [selectChange2, setSelectChange2] = useState('主码流');
const [load, setLoad] = useState(false); // 提交加载
const [configurationType, setConfigurationType] = useState('1'); const [configurationType, setConfigurationType] = useState('1');
...@@ -33,12 +35,14 @@ const AddModal = props => { ...@@ -33,12 +35,14 @@ const AddModal = props => {
}; };
useEffect(() => { useEffect(() => {
setLoad(false);
form.setFieldsValue({ VideoManufacturer: type }); form.setFieldsValue({ VideoManufacturer: type });
setType(type); setType(type);
}, [visible]); }, [visible]);
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoad(true);
let getValue = form.getFieldsValue(); let getValue = form.getFieldsValue();
console.log(getValue); console.log(getValue);
if (getValue.PlayModel === undefined) { if (getValue.PlayModel === undefined) {
...@@ -54,6 +58,8 @@ const AddModal = props => { ...@@ -54,6 +58,8 @@ const AddModal = props => {
addInsertVideoConfig(getValue).then(res => { addInsertVideoConfig(getValue).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -62,6 +68,7 @@ const AddModal = props => { ...@@ -62,6 +68,7 @@ const AddModal = props => {
description: '新增成功', description: '新增成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -96,6 +103,7 @@ const AddModal = props => { ...@@ -96,6 +103,7 @@ const AddModal = props => {
width="1000px" width="1000px"
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
confirmLoading={load}
onCancel={onCancel} onCancel={onCancel}
onOk={onSubmit} onOk={onSubmit}
> >
......
...@@ -13,6 +13,7 @@ const AddModal = props => { ...@@ -13,6 +13,7 @@ const AddModal = props => {
const [selectChange, setSelectChange] = useState('轻应用'); const [selectChange, setSelectChange] = useState('轻应用');
const [selectChange1, setSelectChange1] = useState('否'); const [selectChange1, setSelectChange1] = useState('否');
const [selectChange2, setSelectChange2] = useState('主码流'); const [selectChange2, setSelectChange2] = useState('主码流');
const [load, setLoad] = useState(false); // 提交加载
const onChange = value => { const onChange = value => {
setSelectChange(value); setSelectChange(value);
...@@ -27,6 +28,7 @@ const AddModal = props => { ...@@ -27,6 +28,7 @@ const AddModal = props => {
}; };
useEffect(() => { useEffect(() => {
setLoad(false);
if (kind === 'add') { if (kind === 'add') {
form.resetFields(); form.resetFields();
} else { } else {
...@@ -36,6 +38,7 @@ const AddModal = props => { ...@@ -36,6 +38,7 @@ const AddModal = props => {
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoad(true);
let getValue = form.getFieldsValue(); let getValue = form.getFieldsValue();
console.log(getValue); console.log(getValue);
if (getValue.PlayModel === undefined) { if (getValue.PlayModel === undefined) {
...@@ -51,6 +54,8 @@ const AddModal = props => { ...@@ -51,6 +54,8 @@ const AddModal = props => {
if (kind === 'add') { if (kind === 'add') {
addInsertVideoConfig(getValue).then(res => { addInsertVideoConfig(getValue).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -59,6 +64,7 @@ const AddModal = props => { ...@@ -59,6 +64,7 @@ const AddModal = props => {
description: '新增成功', description: '新增成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -73,6 +79,8 @@ const AddModal = props => { ...@@ -73,6 +79,8 @@ const AddModal = props => {
Id: obj.Id, Id: obj.Id,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -81,6 +89,7 @@ const AddModal = props => { ...@@ -81,6 +89,7 @@ const AddModal = props => {
description: '编辑成功', description: '编辑成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -108,6 +117,7 @@ const AddModal = props => { ...@@ -108,6 +117,7 @@ const AddModal = props => {
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
onCancel={onCancel} onCancel={onCancel}
confirmLoading={load}
onOk={onSubmit} onOk={onSubmit}
> >
<p style={{ fontSize: '16px', marginLeft: '16px' }}>基本信息</p> <p style={{ fontSize: '16px', marginLeft: '16px' }}>基本信息</p>
...@@ -307,6 +317,7 @@ const AddModal = props => { ...@@ -307,6 +317,7 @@ const AddModal = props => {
} }
width="1000px" width="1000px"
destroyOnClose destroyOnClose
confirmLoading={load}
maskClosable={false} maskClosable={false}
onCancel={onCancel} onCancel={onCancel}
onOk={onSubmit} onOk={onSubmit}
......
...@@ -13,6 +13,7 @@ const AddDHModal = props => { ...@@ -13,6 +13,7 @@ const AddDHModal = props => {
const [selectChange, setSelectChange] = useState('轻应用'); const [selectChange, setSelectChange] = useState('轻应用');
const [selectChange1, setSelectChange1] = useState('否'); const [selectChange1, setSelectChange1] = useState('否');
const [selectChange2, setSelectChange2] = useState('主码流'); const [selectChange2, setSelectChange2] = useState('主码流');
const [load, setLoad] = useState(false); // 提交加载
const onChange = value => { const onChange = value => {
setSelectChange(value); setSelectChange(value);
...@@ -27,6 +28,7 @@ const AddDHModal = props => { ...@@ -27,6 +28,7 @@ const AddDHModal = props => {
}; };
useEffect(() => { useEffect(() => {
setLoad(false);
if (kind === 'add') { if (kind === 'add') {
form.resetFields(); form.resetFields();
} else { } else {
...@@ -36,6 +38,7 @@ const AddDHModal = props => { ...@@ -36,6 +38,7 @@ const AddDHModal = props => {
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoad(true);
let getValue = form.getFieldsValue(); let getValue = form.getFieldsValue();
console.log(getValue); console.log(getValue);
if (getValue.PlayModel === undefined) { if (getValue.PlayModel === undefined) {
...@@ -51,6 +54,8 @@ const AddDHModal = props => { ...@@ -51,6 +54,8 @@ const AddDHModal = props => {
if (kind === 'add') { if (kind === 'add') {
addInsertVideoConfig(getValue).then(res => { addInsertVideoConfig(getValue).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -59,6 +64,7 @@ const AddDHModal = props => { ...@@ -59,6 +64,7 @@ const AddDHModal = props => {
description: '新增成功', description: '新增成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -73,6 +79,8 @@ const AddDHModal = props => { ...@@ -73,6 +79,8 @@ const AddDHModal = props => {
Id: obj.Id, Id: obj.Id,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -81,6 +89,7 @@ const AddDHModal = props => { ...@@ -81,6 +89,7 @@ const AddDHModal = props => {
description: '编辑成功', description: '编辑成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -106,6 +115,7 @@ const AddDHModal = props => { ...@@ -106,6 +115,7 @@ const AddDHModal = props => {
width="1000px" width="1000px"
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
confirmLoading={load}
onCancel={onCancel} onCancel={onCancel}
onOk={onSubmit} onOk={onSubmit}
> >
......
...@@ -12,6 +12,7 @@ const AddHKModal = props => { ...@@ -12,6 +12,7 @@ const AddHKModal = props => {
const [selectChange, setSelectChange] = useState('轻应用'); const [selectChange, setSelectChange] = useState('轻应用');
const [selectChange1, setSelectChange1] = useState('否'); const [selectChange1, setSelectChange1] = useState('否');
const [selectChange2, setSelectChange2] = useState('主码流'); const [selectChange2, setSelectChange2] = useState('主码流');
const [load, setLoad] = useState(false); // 提交加载
const onChange = value => { const onChange = value => {
setSelectChange(value); setSelectChange(value);
...@@ -26,6 +27,7 @@ const AddHKModal = props => { ...@@ -26,6 +27,7 @@ const AddHKModal = props => {
}; };
useEffect(() => { useEffect(() => {
setLoad(false);
if (kind === 'add') { if (kind === 'add') {
form.resetFields(); form.resetFields();
} else { } else {
...@@ -35,6 +37,7 @@ const AddHKModal = props => { ...@@ -35,6 +37,7 @@ const AddHKModal = props => {
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
setLoad(true);
let getValue = form.getFieldsValue(); let getValue = form.getFieldsValue();
console.log(getValue); console.log(getValue);
if (getValue.PlayModel === undefined) { if (getValue.PlayModel === undefined) {
...@@ -50,6 +53,8 @@ const AddHKModal = props => { ...@@ -50,6 +53,8 @@ const AddHKModal = props => {
if (kind === 'add') { if (kind === 'add') {
addInsertVideoConfig(getValue).then(res => { addInsertVideoConfig(getValue).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -58,6 +63,7 @@ const AddHKModal = props => { ...@@ -58,6 +63,7 @@ const AddHKModal = props => {
description: '新增成功', description: '新增成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -72,6 +78,8 @@ const AddHKModal = props => { ...@@ -72,6 +78,8 @@ const AddHKModal = props => {
Id: obj.Id, Id: obj.Id,
}).then(res => { }).then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
onCancel();
setLoad(false);
form.resetFields(); form.resetFields();
callBackSubmit(); callBackSubmit();
notification.success({ notification.success({
...@@ -80,6 +88,7 @@ const AddHKModal = props => { ...@@ -80,6 +88,7 @@ const AddHKModal = props => {
description: '编辑成功', description: '编辑成功',
}); });
} else { } else {
setLoad(false);
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -105,6 +114,7 @@ const AddHKModal = props => { ...@@ -105,6 +114,7 @@ const AddHKModal = props => {
width="1000px" width="1000px"
destroyOnClose destroyOnClose
maskClosable={false} maskClosable={false}
confirmLoading={load}
onCancel={onCancel} onCancel={onCancel}
onOk={onSubmit} onOk={onSubmit}
> >
......
...@@ -89,11 +89,15 @@ ...@@ -89,11 +89,15 @@
} }
.ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-node-content-wrapper { .ant-tree.ant-tree-block-node .ant-tree-list-holder-inner .ant-tree-node-content-wrapper {
line-height: 28px !important; line-height: 28px !important;
width: 0;
} }
.ant-tree-drop-indicator { .ant-tree-drop-indicator {
bottom: 3px !important; bottom: 3px !important;
margin-left: 6px; margin-left: 6px;
} }
.ant-tree-draggable-icon {
display: none;
}
// .modal{ // .modal{
// .ant-modal-body{ // .ant-modal-body{
// padding: 0 !important; // padding: 0 !important;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
.ant-tree-node-content-wrapper { .ant-tree-node-content-wrapper {
width: 100%; width: 100%;
overflow: hidden !important; // overflow: hidden !important;
.ant-tree-title { .ant-tree-title {
overflow: hidden; overflow: hidden;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
.ant-tree-node-content-wrapper { .ant-tree-node-content-wrapper {
width: 100%; width: 100%;
overflow: hidden !important; // overflow: hidden !important;
.ant-tree-title { .ant-tree-title {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
......
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