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

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

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