Commit 621d0181 authored by 邓超's avatar 邓超

Merge branch 'master' of https://g.civnet.cn:8443/ReactWeb5/maintenance

# Conflicts: # src/pages/bsmanager/workOrder/incident/incident.jsx # src/pages/bsmanager/workOrder/incident/incident.less
parents c7b316cc 29a0ec69
Pipeline #43631 skipped with stages
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, Checkbox, Divider, notification, Row } from 'antd';
import {
createTable, loadTableFields, addFields
} from '@/services/tablemanager/tablemanager'
import { createTable, loadTableFields, addFields } from '@/services/tablemanager/tablemanager';
import styles from './index.less'
import styles from './index.less';
const { Option } = Select;
const CheckboxGroup = Checkbox.Group;
const editor = props => {
const { callBackSubmit = () => { }, type, visible } = props;
const [reminder, setReminder] = useState(' 事件表会默认创建如下字段:事件编号、事件状态、事件名称上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶')
const [loading, setLoading] = useState(false);
const [isModalVisible, setIsModalVisible] = useState(false);
const [form] = Form.useForm();
const { Item } = Form;
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容
const [plainOptions, setPlainOptions] = useState([]);//复选框所有内容
const [indeterminate, setIndeterminate] = useState(true);
const [isVisible, setIsVisible] = useState(true);
const [checkAll, setCheckAll] = useState(false);
const [chartName, setChartName] = useState('');//附加表名称
const { callBackSubmit = () => {}, type, visible } = props;
const [reminder, setReminder] = useState(
' 事件表会默认创建如下字段:事件编号、事件状态、事件名称上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶',
);
const [loading, setLoading] = useState(false);
const [isModalVisible, setIsModalVisible] = useState(false);
const [form] = Form.useForm();
const { Item } = Form;
const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
const [plainOptions, setPlainOptions] = useState([]); // 复选框所有内容
const [indeterminate, setIndeterminate] = useState(true);
const [isVisible, setIsVisible] = useState(true);
const [checkAll, setCheckAll] = useState(false);
const [chartName, setChartName] = useState(''); // 附加表名称
const onChange = list => {
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
setCheckAll(list.length === plainOptions.length);
};
const onChange = list => {
setCheckedList(list);
setIndeterminate(!!list.length && list.length < plainOptions.length);
setCheckAll(list.length === plainOptions.length);
};
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? plainOptions : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? plainOptions : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
obj.tableName = obj.tableType.substr(0, obj.tableType.length - 1) + '_' + obj.tableName;
createTable({
...obj
}).then(res => {
setLoading(false);
if (res.msg === "Ok") {
notification.success({
message: '提示',
duration: 1,
description: '建表成功',
});
setIsVisible(false)
setChartName(res.data.tableInfo.Name)
loadTableFields({ tableName: res.data.tableInfo.Name }).then(response => {
if (response.data.root.length) {
let arr = [], newArr = []
response.data.root.map(item => {
newArr.push(item.fieldName)
if (item.isCheck) {
arr.push(item.fieldName)
}
})
setPlainOptions(newArr)
setCheckedList(arr)
}
setIsModalVisible(true)
})
} else {
form.resetFields();
callBackSubmit();
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
setLoading(true);
let obj = form.getFieldsValue();
obj.tableName = obj.tableType.substr(0, obj.tableType.length - 1) + '_' + obj.tableName;
createTable({
...obj,
})
.then(res => {
setLoading(false);
if (res.msg === 'Ok') {
notification.success({
message: '提示',
duration: 1,
description: '建表成功',
});
setIsVisible(false);
setChartName(res.data.tableInfo.Name);
loadTableFields({ tableName: res.data.tableInfo.Name }).then(response => {
if (response.data.root.length) {
let arr = [],
newArr = [];
response.data.root.map(item => {
newArr.push(item.fieldName);
if (item.isCheck) {
arr.push(item.fieldName);
}
}).catch(err => {
console.log('err', err);
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
});
}
});
};
useEffect(() => {
if (type != '') {
form.setFieldsValue({ tableType: '事件表' });
}
}, [visible]);
const handleOk = () => {
if (chartName != '') {
addFields({
tableName: chartName,
fieldNames: checkedList.join(',')
}).then(res => {
if (res.msg === "Ok" || res.msg === "") {
notification.success({
message: '提示',
duration: 1,
description: '附加字段添加成功',
});
setIsModalVisible(false)
form.resetFields();
callBackSubmit();
}
else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
});
setPlainOptions(newArr);
setCheckedList(arr);
}
}).catch(err => {
console.log('err', err);
})
}
else {
notification.success({
setIsModalVisible(true);
});
} else {
form.resetFields();
callBackSubmit();
notification.error({
message: '提示',
duration: 1,
description: '表名称没添加',
duration: 3,
description: res.msg,
});
}
})
.catch(err => {
console.log('err', err);
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
}
setLoading(false);
});
}
});
};
useEffect(() => {
if (type != '') {
form.setFieldsValue({ tableType: '事件表' });
}
const handleCancel = () => {
setIsModalVisible(false)
}, [visible]);
const handleOk = () => {
if (chartName != '') {
addFields({
tableName: chartName,
fieldNames: checkedList.join(','),
})
.then(res => {
if (res.msg === 'Ok' || res.msg === '') {
notification.success({
message: '提示',
duration: 1,
description: '附加字段添加成功',
});
setIsModalVisible(false);
form.resetFields();
callBackSubmit();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
.catch(err => {
console.log('err', err);
});
} else {
notification.success({
message: '提示',
duration: 1,
description: '表名称没添加',
});
}
const changeChart = (value) => {
let str = ''
switch (value) {
case '事件表':
str = ' 事件表默认创建如下字段:事件编号、事件状态、事件名称、上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶';
break;
case '工单表':
str = '工单表默认创建如下字段:工单编号';
break;
case '台账表':
str = '台账表默认创建如下字段:所属站点、录入时间、是否删除';
break;
case '设备表':
str = '设备表默认创建如下字段:编码、父设备编码、GIS编号、设备名称、所属站点、坐标位置、风貌图、视频缩略图、第三方编码、录入时间、是否删除';
break;
case '反馈表':
str ='反馈表默认创建如下字段:编码、设备编码、录入时间、是否删除';
break;
default :
str = ' 事件表默认创建如下字段:事件编号、事件状态、事件名称、上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶';
}
setReminder(str)
};
const handleCancel = () => {
setIsModalVisible(false);
};
const changeChart = value => {
let str = '';
switch (value) {
case '事件表':
str =
' 事件表默认创建如下字段:事件编号、事件状态、事件名称、上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶';
break;
case '工单表':
str = '工单表默认创建如下字段:工单编号';
break;
case '台账表':
str = '台账表默认创建如下字段:所属站点、录入时间、是否删除';
break;
case '设备表':
str =
'设备表默认创建如下字段:编码、父设备编码、GIS编号、设备名称、所属站点、坐标位置、风貌图、视频缩略图、第三方编码、录入时间、是否删除';
break;
case '反馈表':
str = '反馈表默认创建如下字段:编码、设备编码、录入时间、是否删除';
break;
default:
str =
' 事件表默认创建如下字段:事件编号、事件状态、事件名称、上报站点、处理站点、上报人名称、上报人部分、上报时间、现场图片、现场录音、坐标位置、更新时间、更新状态、是否置顶';
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
},
};
return (
<>
<Modal
title='建表'
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
visible={isVisible}
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Form form={form} {...layout} >
<Item
label="【特别提示】"
>
<span>此处仅建立基础表和必要字段,额外字段需通过其他方式进行添加,比如使用Navicat工具等。</span>
</Item>
<Item
label="建表类型"
name="tableType"
rules={[{ required: true, message: '请输入表名' }]}
>
<Select onChange={changeChart}>
<Select.Option value='事件表'>事件表</Select.Option>
<Select.Option value='工单表'>工单表</Select.Option>
<Select.Option value='台账表'>台账表</Select.Option>
<Select.Option value='设备表'>设备表</Select.Option>
<Select.Option value='反馈表'>反馈表</Select.Option>
</Select>
</Item>
<Item
label="表名"
name="tableName"
rules={[{ required: true, message: '请以"模块_表名"的个数输入' }]}
>
<Input placeholder='请以"模块_表名"的个数输入' allowClear />
</Item>
<Item
label="别名"
name="alias"
>
<Input placeholder="请输入别名,通常用作该表的备注" allowClear />
</Item>
<Item
label=" "
colon={false}
>
<span>{reminder}</span>
</Item>
</Form>
</Modal>
<Modal title="附加字段" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
<Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
选择所有
</Checkbox>
<Divider />
<div className={styles.field}>
<Row>
{
plainOptions.length ? <CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} /> : ''
}
</Row>
</div>
setReminder(str);
};
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 19,
},
};
</Modal>
</>
);
return (
<>
<Modal
title="建表"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
visible={isVisible}
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Form form={form} {...layout}>
<Item label="【特别提示】">
<span>
此处仅建立基础表和必要字段,额外字段需通过其他方式进行添加,比如使用Navicat工具等。
</span>
</Item>
<Item
label="建表类型"
name="tableType"
rules={[{ required: true, message: '请输入表名' }]}
>
<Select onChange={changeChart}>
<Select.Option value="事件表">事件表</Select.Option>
<Select.Option value="工单表">工单表</Select.Option>
<Select.Option value="台账表">台账表</Select.Option>
<Select.Option value="设备表">设备表</Select.Option>
<Select.Option value="反馈表">反馈表</Select.Option>
</Select>
</Item>
<Item
label="表名"
name="tableName"
rules={[{ required: true, message: '请以"模块_表名"的个数输入' }]}
>
<Input placeholder='请以"模块_表名"的个数输入' allowClear />
</Item>
<Item label="别名" name="alias">
<Input placeholder="请输入别名,通常用作该表的备注" allowClear />
</Item>
<Item label=" " colon={false}>
<span>{reminder}</span>
</Item>
</Form>
</Modal>
<Modal title="附加字段" visible={isModalVisible} onOk={handleOk} onCancel={handleCancel}>
<Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
选择所有
</Checkbox>
<Divider />
<div className={styles.field}>
<Row>
{plainOptions.length ? (
<CheckboxGroup options={plainOptions} value={checkedList} onChange={onChange} />
) : (
''
)}
</Row>
</div>
</Modal>
</>
);
};
export default editor;
......@@ -11,8 +11,8 @@ const AddModal = props => {
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const { Item } = Form;
const [plainOptions, setPlainOptions] = useState([]); //复选框所有内容
const [checkedList, setCheckedList] = useState([]); //选中的复选框内容
const [plainOptions, setPlainOptions] = useState([]); // 复选框所有内容
const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
const [indeterminate, setIndeterminate] = useState(true);
const [checkAll, setCheckAll] = useState(false);
......@@ -115,10 +115,10 @@ const AddModal = props => {
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
span: 3,
},
wrapperCol: {
span: 18,
span: 20,
},
};
......
......@@ -49,10 +49,7 @@ const AddModal = props => {
if (res.data.root && res.data.root.length) {
form.setFieldsValue({
...res.data.root[0],
tableStyle:
res.data.root[0].tableStyle === ''
? '大'
: res.data.root[0].tableStyle,
tableStyle: res.data.root[0].tableStyle === '' ? '大' : res.data.root[0].tableStyle,
});
setTableID(res.data.root[0].tableID);
}
......@@ -67,10 +64,10 @@ const AddModal = props => {
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
span: 3,
},
wrapperCol: {
span: 17,
span: 20,
},
};
......@@ -82,7 +79,7 @@ const AddModal = props => {
width="700px"
destroyOnClose
maskClosable={false}
centered ={true}
centered={true}
cancelText="取消"
okText="确认"
{...props}
......@@ -93,21 +90,13 @@ const AddModal = props => {
>
{visible && (
<Form form={form} {...layout}>
<Item
label="表名"
name="tableName"
rules={[{ required: true, message: '请输入表名' }]}
>
<Item label="表名" name="tableName" rules={[{ required: true, message: '请输入表名' }]}>
<Input placeholder="请输入表名" allowClear />
</Item>
<Item label="别名" name="tableAlias">
<Input placeholder="请输入别名" allowClear />
</Item>
<Item
label="样式"
name="tableStyle"
rules={[{ required: true, message: '请选择样式' }]}
>
<Item label="样式" name="tableStyle" rules={[{ required: true, message: '请选择样式' }]}>
<Radio.Group>
<Radio value="大">大(3)</Radio>
<Radio value="中">中(4)</Radio>
......
.field{
width:100%;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
max-height: 20rem;
.field {
width: 100%;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
max-height: 20rem;
overflow-y: scroll;
.ant-card {
width: 90.5%;
margin-left: 40px;
}
.ant-card-head-title {
flex: none;
}
.ant-card-extra {
margin-left: 0.2rem;
}
.ant-card-body {
// padding: 0 ;
height: 15rem;
overflow-y: scroll;
.ant-card{
width: 83%;
margin-left: 4rem;
}
.ant-card-head-title{
flex: none;
}
.ant-card-extra{
margin-left: 0.2rem;
}
.ant-card-body{
// padding: 0 ;
height: 15rem;
overflow-y: scroll;
}
}
}
.paneTitle{
font-weight: bold;
font-size: 18px;
margin: 0 0 0.5rem 4rem;
.paneTitle {
font-weight: bold;
font-size: 18px;
margin: 0 0 0.5rem 38px;
}
.listEvent{
display: flex;
.listEvent {
display: flex;
}
.cardList{
.ant-card-body{
overflow-y:none !important;
}
.cardList {
.ant-card-body {
overflow-y: none !important;
}
}
.unit{
display: flex;
margin-left: 1.1rem;
align-items: center;
.unit {
display: flex;
margin-left: 1.1rem;
align-items: center;
}
.listCard{
display: flex;
.cardItem{
width: 50%;
padding: 0.5rem;
}
.cardContent{
height:35rem;
overflow-y: scroll;
width: 22rem;
}
.cardItemData{
padding: 1rem;
border: 1px solid #b5b8c8;
margin-bottom: 1rem;
}
.listCard {
display: flex;
.cardItem {
width: 50%;
padding: 0.5rem;
}
.cardContent {
height: 35rem;
overflow-y: scroll;
width: 22rem;
}
.cardItemData {
padding: 1rem;
border: 1px solid #b5b8c8;
margin-bottom: 1rem;
}
}
.sortable-ghost {
border-bottom: 2px dashed #1890ff;
}
.doctorTable {
margin-bottom: 16px;
table {
width: 100%;
td {
padding: 6px;
border: 1px solid #e8e8e8;
border-bottom: 2px dashed #1890ff;
}
.doctorTable {
margin-bottom: 16px;
table {
width: 100%;
td {
padding: 6px;
border: 1px solid #e8e8e8;
}
thead {
tr {
font-weight: 600;
background: #fafafa;
}
thead {
tr {
font-weight: 600;
background: #FAFAFA;
}
td{
width: 12rem;
}
td {
width: 12rem;
}
tbody{
tr:hover{
background-color:#ededed ;
}
}
tbody {
tr:hover {
background-color: #ededed;
}
}
}
.defaultTile{
background-color:transparent ;
}
.activeTile{
background-color:#dfe8f6 ;
}
.defaultTile {
background-color: transparent;
}
.activeTile {
background-color: #dfe8f6;
}
tr.drop-over-downward td {
border-bottom: 2px dashed #1890ff;
}
tr.drop-over-upward td {
border-top: 2px dashed #1890ff;
}
.clickRowStyle{
background: #cfe7fd;
}
\ No newline at end of file
tr.drop-over-downward td {
border-bottom: 2px dashed #1890ff;
}
tr.drop-over-upward td {
border-top: 2px dashed #1890ff;
}
.clickRowStyle {
background: #cfe7fd;
}
......@@ -120,7 +120,7 @@ const incident = () => {
title: '权限',
dataIndex: 'roles',
key: 'roles',
width: 50,
width: 80,
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
......@@ -131,7 +131,7 @@ const incident = () => {
title: '流程',
dataIndex: 'flowCount',
key: 'flowCount',
width: 50,
width: 80,
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
......@@ -188,17 +188,17 @@ const incident = () => {
dataIndex: 'outFields',
key: 'outFields',
align: 'center',
width: 100,
width: 80,
render: text => (
<span
style={{
display: 'inline-block',
width: '80px',
width: '60px',
color: Number(text) > 0 ? 'red' : '',
backgroundColor: Number(text) > 0 ? 'yellow' : '',
}}
>
{text}
{text == 0 ? '(无)' : text}
</span>
),
},
......
......@@ -39,8 +39,6 @@ import {
DataDictionaryChangeOrder,
} from '@/services/dataCenter/api';
import styles from './WebDic.less';
import { useHistory, Link } from 'react-router-dom';
import map from '@/pages/user/login/components/Login/map';
import { GetMetaData } from '@/services/gis/gis';
import DragTable from '@/components/DragTable/DragTable';
......@@ -62,14 +60,12 @@ const WebDic = () => {
const [editVisible, setEditVisible] = useState(false); // 编辑二级条目
const [editVisible1, setEditVisible1] = useState(false); // 编辑一级条目
const [editForm] = Form.useForm();
const [searchVisible, setSearchVisible] = useState(false);
const [searchWord, setSearchWord] = useState(''); // 关键字
const { Search } = Input;
const [files, setFiles] = useState('');
const [flag, setFlag] = useState(0);
const [flag1, setFlag1] = useState(0); // 搜索框数据是否刷新
const [isloading, setIsloading] = useState(false);
const history = useHistory();
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [InPutVisible, setInPutVisible] = useState(false);
......@@ -269,7 +265,6 @@ const WebDic = () => {
// 根据orderTable值改变flowIDs
useEffect(() => {
let ids = '';
console.log(data);
data.forEach((item, index) => {
if (index === data.length - 1) {
ids += `${item.nodeID}`;
......@@ -277,9 +272,7 @@ const WebDic = () => {
ids += `${item.nodeID},`;
}
});
console.log(ids);
let bb = ids.split(',');
console.log(bb);
setLoading(true);
DataDictionaryChangeOrder(bb).then(res => {
setLoading(false);
......@@ -287,7 +280,6 @@ const WebDic = () => {
}, [data]);
useEffect(() => {
let ids = '';
console.log(subData);
if (subData !== '') {
subData.forEach((item, index) => {
if (index === subData.length - 1) {
......@@ -297,9 +289,7 @@ const WebDic = () => {
}
});
}
console.log(ids);
let bb = ids.split(',');
console.log(bb);
setIsloading(true);
DataDictionaryChangeOrder(bb).then(res => {
setIsloading(false);
......@@ -307,7 +297,6 @@ const WebDic = () => {
}, [subData]);
// 根据父节点nodeID(即parentID)获取子节点数据,一级条目parentID = -1
const getData = value => {
console.log(value);
isLoadingShow(value, true);
GetDataDictionaryList({ nodeID: value }).then(resnew => {
if (resnew.code === 0) {
......@@ -322,10 +311,6 @@ const WebDic = () => {
// 是否首次加载
if (value === null || value === '-1') {
setData(res);
// setOd(res)
console.log(res);
console.log(first);
if (first) {
setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectColor(res[0]);
......@@ -334,7 +319,6 @@ const WebDic = () => {
getData(res[0].nodeID); // 拿到nodeID再次调用接口就回直接进入下面的循环,靠nodeID获取子节点二级条目
}
} else if (value) {
console.log(res);
setSubData(res); // 设置二级条目,res为空[]时也要设置
// setOd1(res)
}
......@@ -584,9 +568,6 @@ const WebDic = () => {
submitSearchUser();
}
if (select.parentID === '-1') {
// setSubData([]);
console.log(select);
console.log(selectID);
if (select.nodeID === selectID) {
setSelectID('');
setSubData([]);
......@@ -623,18 +604,15 @@ const WebDic = () => {
},
accept: 'application/vnd.ms-excel',
beforeUpload: file => {
console.log('filee', file);
setFiles(file.file);
},
onChange(info) {
let data;
let mse;
console.log(info, 'info');
setFiles(info.file);
if (info.file.status !== 'uploading') {
// eslint-disable-next-line array-callback-return
info.fileList.map(item => {
console.log(item.response);
data = item.response.code;
mse = item.response.msg;
});
......@@ -712,15 +690,11 @@ const WebDic = () => {
// 拖拽回调函数
const dragCallBack = value => {
console.log(data);
console.log(value);
if (value) {
setData(value);
}
};
const dragCallBack1 = e => {
console.log(e);
console.log(subData);
if (e) {
setSubData(e);
}
......@@ -919,7 +893,6 @@ const WebDic = () => {
});
}
arr.unshift(nodeName);
console.log(arr);
if (new Set(arr).size !== arr.length) {
// eslint-disable-next-line prefer-promise-reject-errors
return Promise.reject('用户名重复');
......@@ -956,7 +929,6 @@ const WebDic = () => {
validator: (rule, value, callback) => {
const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
const nodeName1 = addForm.getFieldsValue();
console.log(nodeName);
let result = nodeName1.users;
let arr = [];
// eslint-disable-next-line array-callback-return
......@@ -971,11 +943,8 @@ const WebDic = () => {
if (nodeName !== undefined) {
arr.unshift(nodeName);
}
console.log(arr);
if (new Set(arr).size !== arr.length) {
arr = [...new Set(arr)];
console.log(arr);
callback('用户名重复');
}
},
......
......@@ -50,13 +50,10 @@ const DatabaseConnectConfig = props => {
</Tabs> */}
<SQLServerTable />
<br />
<OracleTable />
<br />
<MongDBTable />
<br />
<MySQLTable />
</Card>
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification } from 'antd';
import {
AddConnString,
EditConnString
} from '@/services/database/api';
import { AddConnString, EditConnString } from '@/services/database/api';
const { Item } = Form;
const { Option } = Select;
......@@ -20,7 +17,7 @@ const AddModal = props => {
let obj = form.getFieldsValue();
if (type === 'add') {
AddConnString({
Type:'mongodb',
Type: 'mongodb',
...obj,
})
.then(res => {
......@@ -54,8 +51,8 @@ const AddModal = props => {
const handleEdit = () => {
let obj = form.getFieldsValue();
EditConnString({
Type:'mongodb',
MongoDbType:'mongodb',
Type: 'mongodb',
MongoDbType: 'mongodb',
...obj,
oldName: formObj.name,
})
......@@ -81,12 +78,12 @@ const AddModal = props => {
};
const onFinish = value => {};
const handleSelect = e => {
console.log(e)
if(e == '单实例'){
form.setFieldsValue({port:27017})
console.log(e);
if (e == '单实例') {
form.setFieldsValue({ port: 27017 });
}
if(e == '分片群'){
form.setFieldsValue({port:30000})
if (e == '分片群') {
form.setFieldsValue({ port: 30000 });
}
e === '复制集' ? setShowReplicaSet(true) : setShowReplicaSet(false);
};
......@@ -96,20 +93,16 @@ const AddModal = props => {
form.resetFields();
break;
case 'edit':
console.log(formObj.type)
formObj.type === '复制集'
? setShowReplicaSet(true)
: setShowReplicaSet(false);
console.log(formObj.type);
formObj.type === '复制集' ? setShowReplicaSet(true) : setShowReplicaSet(false);
form.setFieldsValue({ ...formObj });
form.setFieldsValue({MongoDbType:formObj.type});
form.setFieldsValue({ MongoDbType: formObj.type });
break;
default:
break;
}
return () => {
form.getFieldsValue().type === '复制集'
? setShowReplicaSet(true)
: setShowReplicaSet(false);
form.getFieldsValue().type === '复制集' ? setShowReplicaSet(true) : setShowReplicaSet(false);
};
}, [visible]);
useEffect(() => {}, [type === 'edit']);
......@@ -119,7 +112,7 @@ const AddModal = props => {
span: 4,
},
wrapperCol: {
span: 16,
span: 19,
},
};
const selectArr = [
......@@ -169,25 +162,13 @@ const AddModal = props => {
))}
</Select>
</Item>
<Item
label="标签"
name="name"
rules={[{ required: true, message: '请输入标签' }]}
>
<Item label="标签" name="name" rules={[{ required: true, message: '请输入标签' }]}>
<Input placeholder="请输入标签" allowClear />
</Item>
<Item
label="IP"
name="ip"
rules={[{ required: true, message: '请输入IP' }]}
>
<Item label="IP" name="ip" rules={[{ required: true, message: '请输入IP' }]}>
<Input placeholder="请输入IP" allowClear />
</Item>
<Item
label="端口"
name="port"
rules={[{ required: true, message: '请输入端口号' }]}
>
<Item label="端口" name="port" rules={[{ required: true, message: '请输入端口号' }]}>
<Input placeholder="请输入端口号" allowClear />
</Item>
<Item
......
import React, { useEffect, useState } from 'react';
import ProTable from '@ant-design/pro-table';
import { Button, Tag, Popconfirm, notification } from 'antd';
// import ProTable from '@ant-design/pro-table';
import { Button, Tag, Popconfirm, notification, Table } from 'antd';
import {
getMongoDBConnString,
deleteConnString,
......@@ -254,50 +254,53 @@ const MongDBTable = props => {
];
return (
<>
<ProTable
headerTitle="MongDB数据库"
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '10px' }}>
<div
style={{ fontWeight: 'bold', fontSize: '16px', marginLeft: '30x', marginBottom: '10px' }}
>
MongDB数据库
</div>
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>
</div>
<Table
rowKey="key"
search={false}
columns={columns}
bordered
loading={tableLoading}
dataSource={dataList}
options={false}
toolBarRender={() => [
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>,
// <Popconfirm
// title={
// <div>
// <p>
// 是否将confcenter、citytemp、buffile、log文件内容迁移至
// Mongodb数据库中(会覆盖重名文件)?
// </p>
// <p>(连接配置取标签mongodb)</p>
// </div>
// }
// cancelText="取消"
// okText="确认"
// onConfirm={handleConfirm}
// placement="rightTop"
// >
// <Button
// style={{
// color: '#fff',
// background: '#e6a23c',
// borderColor: '#f5dab1',
// }}
// >
// 文件迁移
// </Button>
// </Popconfirm>,
]}
scroll={{ y: 400 }}
// <Popconfirm
// title={
// <div>
// <p>
// 是否将confcenter、citytemp、buffile、log文件内容迁移至
// Mongodb数据库中(会覆盖重名文件)?
// </p>
// <p>(连接配置取标签mongodb)</p>
// </div>
// }
// cancelText="取消"
// okText="确认"
// onConfirm={handleConfirm}
// placement="rightTop"
// >
// <Button
// style={{
// color: '#fff',
// background: '#e6a23c',
// borderColor: '#f5dab1',
// }}
// >
// 文件迁移
// </Button>
// </Popconfirm>,
/>
<AddModal
visible={visible}
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification } from 'antd';
import {
AddConnString,
EditConnString
} from '@/services/database/api';
import { AddConnString, EditConnString } from '@/services/database/api';
const { Item } = Form;
const { Option } = Select;
......@@ -19,7 +16,7 @@ const AddModal = props => {
let obj = form.getFieldsValue();
if (type === 'add') {
AddConnString({
type:'mysql',
type: 'mysql',
...obj,
})
.then(res => {
......@@ -53,7 +50,7 @@ const AddModal = props => {
const handleEdit = () => {
let obj = form.getFieldsValue();
EditConnString({
type:'mysql',
type: 'mysql',
...obj,
oldName: formObj.name,
})
......@@ -96,7 +93,7 @@ const AddModal = props => {
span: 4,
},
wrapperCol: {
span: 16,
span: 19,
},
};
return (
......@@ -115,18 +112,10 @@ const AddModal = props => {
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="标签"
name="name"
rules={[{ required: true, message: '请输入标签' }]}
>
<Item label="标签" name="name" rules={[{ required: true, message: '请输入标签' }]}>
<Input placeholder="请输入标签" allowClear />
</Item>
<Item
label="IP"
name="ip"
rules={[{ required: true, message: '请输入IP' }]}
>
<Item label="IP" name="ip" rules={[{ required: true, message: '请输入IP' }]}>
<Input placeholder="请输入IP" allowClear />
</Item>
<Item
......@@ -143,11 +132,7 @@ const AddModal = props => {
>
<Input placeholder="请输入用户名" allowClear />
</Item>
<Item
label="密码"
name="password"
rules={[{ required: true, message: '请输入密码' }]}
>
<Item label="密码" name="password" rules={[{ required: true, message: '请输入密码' }]}>
<Input placeholder="请输入密码" allowClear />
</Item>
</Form>
......
import React, { useEffect, useState } from 'react';
import ProTable from '@ant-design/pro-table';
import { Button, Tag, Popconfirm, notification } from 'antd';
// import ProTable from '@ant-design/pro-table';
import { Button, Tag, Popconfirm, notification, Table } from 'antd';
import {
getMySQLConnString,
getMySQLConnectionTest,
......@@ -172,28 +172,29 @@ const MySQLTable = props => {
title: 'IP',
dataIndex: 'ip',
key: 'ip',
width: 150,
width: 300,
ellipsis: true,
},
{
title: '数据库名',
dataIndex: 'dbName',
key: 'dbName',
width: 200,
width: 300,
ellipsis: true,
},
{
title: '用户名',
dataIndex: 'userName',
key: 'userName',
width: 300,
ellipsis: true,
},
{
title: '密码',
dataIndex: 'password',
key: 'password',
ellipsis: true,
},
// {
// title: '密码',
// dataIndex: 'password',
// key: 'password',
// ellipsis: true,
// },
{
title: '操作',
dataIndex: 'options',
......@@ -231,25 +232,29 @@ const MySQLTable = props => {
];
return (
<>
<ProTable
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '10px' }}>
<div
style={{ fontWeight: 'bold', fontSize: '16px', marginLeft: '30x', marginBottom: '10px' }}
>
MySQL数据库
</div>
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>
</div>
<Table
headerTitle="MySQL数据库"
rowKey="key"
search={false}
columns={columns}
bordered
loading={tableLoading}
dataSource={dataList}
options={false}
toolBarRender={() => [
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>,
]}
scroll={{ y: 400 }}
/>
<AddModal
visible={visible}
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification } from 'antd';
import {
AddConnString,
EditConnString
} from '@/services/database/api';
import { AddConnString, EditConnString } from '@/services/database/api';
const { Item } = Form;
const { Option } = Select;
......@@ -20,7 +17,7 @@ const AddModal = props => {
if (type === 'add') {
AddConnString({
...obj,
type:'oracle'
type: 'oracle',
})
.then(res => {
setLoading(false);
......@@ -53,7 +50,7 @@ const AddModal = props => {
const handleEdit = () => {
let obj = form.getFieldsValue();
EditConnString({
type:'oracle',
type: 'oracle',
...obj,
oldName: formObj.name,
})
......@@ -96,7 +93,7 @@ const AddModal = props => {
span: 4,
},
wrapperCol: {
span: 16,
span: 19,
},
};
return (
......@@ -115,11 +112,7 @@ const AddModal = props => {
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="标签"
name="name"
rules={[{ required: true, message: '请输入标签' }]}
>
<Item label="标签" name="name" rules={[{ required: true, message: '请输入标签' }]}>
{/* <Select>
<Option value={item.value}>{item.title}</Option>
</Select> */}
......@@ -139,11 +132,7 @@ const AddModal = props => {
>
<Input placeholder="请输入用户名" allowClear />
</Item>
<Item
label="密码"
name="password"
rules={[{ required: true, message: '请输入密码' }]}
>
<Item label="密码" name="password" rules={[{ required: true, message: '请输入密码' }]}>
<Input placeholder="请输入密码" allowClear />
</Item>
</Form>
......
import React, { useEffect, useState } from 'react';
import ProTable from '@ant-design/pro-table';
import { Button, Tag, Popconfirm, notification } from 'antd';
// import ProTable from '@ant-design/pro-table';
import { Button, Tag, Popconfirm, notification, Table } from 'antd';
import {
getOracleConnString,
getOracleConnectionTest,
......@@ -172,7 +172,7 @@ const OracleTable = props => {
title: '网络服务名/(ip:port/实例名)',
dataIndex: 'dbName',
key: 'dbName',
width: 300,
width: 400,
ellipsis: true,
},
{
......@@ -181,12 +181,12 @@ const OracleTable = props => {
key: 'userName',
ellipsis: true,
},
{
title: '密码',
dataIndex: 'password',
key: 'password',
ellipsis: true,
},
// {
// title: '密码',
// dataIndex: 'password',
// key: 'password',
// ellipsis: true,
// },
{
title: '操作',
dataIndex: 'options',
......@@ -224,25 +224,28 @@ const OracleTable = props => {
];
return (
<>
<ProTable
headerTitle="Oracle数据库"
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '10px' }}>
<div
style={{ fontWeight: 'bold', fontSize: '16px', marginLeft: '30x', marginBottom: '10px' }}
>
Oracle数据库
</div>
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>
</div>
<Table
rowKey="key"
search={false}
columns={columns}
bordered
loading={tableLoading}
dataSource={dataList}
options={false}
toolBarRender={() => [
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>,
]}
scroll={{ y: 400 }}
/>
<AddModal
visible={visible}
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification } from 'antd';
import {
AddConnString,
EditConnString
} from '@/services/database/api';
import { AddConnString, EditConnString } from '@/services/database/api';
const { Item } = Form;
const { Option } = Select;
......@@ -20,11 +17,11 @@ const AddModal = props => {
if (type === 'add') {
AddConnString({
...obj,
type:'sqlserver'
type: 'sqlserver',
})
.then(res => {
setLoading(false);
if (res.code ==0) {
if (res.code == 0) {
form.resetFields();
callBackSubmit();
notification.success({
......@@ -36,7 +33,7 @@ const AddModal = props => {
notification.error({
message: '提示',
duration: 3,
description: res.msg ,
description: res.msg,
});
}
})
......@@ -55,11 +52,11 @@ const AddModal = props => {
EditConnString({
...obj,
oldName: formObj.name,
type:'sqlserver'
type: 'sqlserver',
})
.then(res => {
setLoading(false);
if (res.code ==0) {
if (res.code == 0) {
form.resetFields();
callBackSubmit();
notification.success({
......@@ -96,7 +93,7 @@ const AddModal = props => {
span: 4,
},
wrapperCol: {
span: 16,
span: 19,
},
};
return (
......@@ -115,21 +112,13 @@ const AddModal = props => {
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="标签"
name="name"
rules={[{ required: true, message: '请输入标签' }]}
>
<Item label="标签" name="name" rules={[{ required: true, message: '请输入标签' }]}>
{/* <Select>
<Option value={item.value}>{item.title}</Option>
</Select> */}
<Input placeholder="请输入标签" allowClear />
</Item>
<Item
label="IP"
name="ip"
rules={[{ required: true, message: '请输入IP' }]}
>
<Item label="IP" name="ip" rules={[{ required: true, message: '请输入IP' }]}>
<Input placeholder="请输入IP" allowClear />
</Item>
<Item
......@@ -146,11 +135,7 @@ const AddModal = props => {
>
<Input placeholder="请输入用户名" allowClear />
</Item>
<Item
label="密码"
name="password"
rules={[{ required: true, message: '请输入密码' }]}
>
<Item label="密码" name="password" rules={[{ required: true, message: '请输入密码' }]}>
<Input placeholder="请输入密码" allowClear />
</Item>
</Form>
......
import React, { useEffect, useState } from 'react';
import ProTable from '@ant-design/pro-table';
import { Button, Popconfirm, notification } from 'antd';
// import ProTable from '@ant-design/pro-table';
import { Button, Popconfirm, notification, Table } from 'antd';
import { GetConnString, DeleteConnString, GetConnTest } from '@/services/database/api';
import AddModal from './AddModal';
const SQLServerTable = props => {
......@@ -164,30 +164,30 @@ const SQLServerTable = props => {
title: 'ip',
dataIndex: 'ip',
key: 'ip',
width: 150,
width: 300,
ellipsis: true,
},
{
title: '数据库名',
dataIndex: 'dbName',
key: 'dbName',
width: 200,
width: 400,
ellipsis: true,
},
{
title: '用户名',
dataIndex: 'userName',
key: 'userName',
// width: 200,
ellipsis: true,
},
{
title: '密码',
dataIndex: 'password',
key: 'password',
// width: 200,
width: 200,
ellipsis: true,
},
// {
// title: '密码',
// dataIndex: 'password',
// key: 'password',
// // width: 200,
// ellipsis: true,
// },
{
title: '操作',
dataIndex: 'options',
......@@ -227,25 +227,29 @@ const SQLServerTable = props => {
];
return (
<>
<ProTable
headerTitle="SQL数据库"
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '10px' }}>
<div
style={{ fontWeight: 'bold', fontSize: '16px', marginLeft: '30x', marginBottom: '10px' }}
>
SQL数据库
</div>
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>
</div>
<Table
// title="SQL数据库"
rowKey="name"
search={false}
columns={columns}
bordered
loading={tableLoading}
dataSource={dataList}
options={false}
toolBarRender={() => [
<Button
type="primary"
onClick={() => {
handleAdd();
}}
>
添加连接
</Button>,
]}
scroll={{ y: 400 }}
/>
<AddModal
visible={visible}
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, Slider, InputNumber, Row, Col, Image, Radio, Button } from 'antd';
import styles from '../dimensionsConfig.less'
import {
Form,
Modal,
Input,
Select,
notification,
Slider,
InputNumber,
Row,
Col,
Image,
Radio,
Button,
} from 'antd';
import styles from '../dimensionsConfig.less';
import thumbnail_1 from '@/assets/images/thumbnail/thumbnail_1.jpg';
import thumbnail_2 from '@/assets/images/thumbnail/thumbnail_2.jpg';
import thumbnail_3 from '@/assets/images/thumbnail/thumbnail_3.jpg';
import thumbnail_4 from '@/assets/images/thumbnail/thumbnail_4.jpg';
import {
AddBaseMap, EditBaseMap
} from '@/services/webConfig/api';
import { AddBaseMap, EditBaseMap } from '@/services/webConfig/api';
import { number } from 'prop-types';
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, baseMap } = props;
const { callBackSubmit = () => {}, type, formObj, visible, baseMap } = props;
const [loading, setLoading] = useState(false);
const [radio, setRadio] = useState();
const [alpha, setAlpha] = useState(1);
const [mapType, setMapType] = useState(0);
const [form] = Form.useForm();
const arr = ['assets/images/thumbnail/thumbnail_1.jpg', 'assets/images/thumbnail/thumbnail_2.jpg', 'assets/images/thumbnail/thumbnail_3.jpg', 'assets/images/thumbnail/thumbnail_4.jpg']
const arr = [
'assets/images/thumbnail/thumbnail_1.jpg',
'assets/images/thumbnail/thumbnail_2.jpg',
'assets/images/thumbnail/thumbnail_3.jpg',
'assets/images/thumbnail/thumbnail_4.jpg',
];
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let str = type === 'add' ? AddBaseMap : EditBaseMap
let str = type === 'add' ? AddBaseMap : EditBaseMap;
let obj = form.getFieldsValue();
let arr = {
name: obj.name,
type: obj.type,
opacity: Number(alpha),
icon: obj.icon,
url: obj.url
}
url: obj.url,
};
str(arr)
.then(res => {
setLoading(false);
if (res.msg === "Ok" || res.msg === "") {
if (res.msg === 'Ok' || res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: res.message || type == 'add' ? '新增成功' : '编辑成功'
description: res.message || type == 'add' ? '新增成功' : '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || type == 'add' ? '新增失败' : '编辑失败'
description: res.message || type == 'add' ? '新增失败' : '编辑失败',
});
}
})
.catch(err => { setLoading(false); });
.catch(err => {
setLoading(false);
});
}
});
};
const onFinish = value => { };
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
setRadio('')
setAlpha(1)
setRadio('');
setAlpha(1);
form.resetFields();
form.setFieldsValue({
name: baseMap[0],
type: servicenameToType(baseMap[0])
})
type: servicenameToType(baseMap[0]),
});
break;
case 'edit':
form.setFieldsValue({ ...formObj });
setAlpha(formObj.opacity)
let index = formObj.icon.lastIndexOf("/")
setAlpha(formObj.opacity);
let index = formObj.icon.lastIndexOf('/');
let str = formObj.icon.substring(index + 1, formObj.icon.length);
let flag = ''
let flag = '';
let defaultIndex = arr.filter((item, index1) => {
if (item.indexOf(str) !== -1) {
flag = index1
flag = index1;
}
});
setRadio(arr[flag])
setRadio(arr[flag]);
break;
default:
break;
......@@ -95,86 +112,85 @@ const AddModal = props => {
// }
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
span: 18,
},
};
const onChange = (value) => {
let silderData = value == 100 ? 1 : (value / 100).toFixed(1)
setAlpha(silderData)
}
const tipFormatter = (value) => {
return (value / 100).toFixed(1)
}
const onChange = value => {
let silderData = value == 100 ? 1 : (value / 100).toFixed(1);
setAlpha(silderData);
};
const tipFormatter = value => {
return (value / 100).toFixed(1);
};
const imgURL = [
{
url: thumbnail_1
url: thumbnail_1,
},
{
url: thumbnail_2
url: thumbnail_2,
},
{
url: thumbnail_3
url: thumbnail_3,
},
{
url: thumbnail_4
url: thumbnail_4,
},
]
];
const radioChange = (e) => {
setRadio(e.target.value)
}
const handleChange = (value) => {
const radioChange = e => {
setRadio(e.target.value);
};
const handleChange = value => {
form.setFieldsValue({
type: servicenameToType(value)
})
type: servicenameToType(value),
});
// if (baseMap.indexOf(value) == 2 || baseMap.indexOf(value) == 3) {
// setMapType(1)
// }
// else {
// setMapType(0)
// }
}
};
//添加地图类型
const servicenameToType = (servicename) => {
const servicenameToType = servicename => {
// if (servicename.indexOf('地形图') > -1)
// servicename = '地形图'
// if (servicename.indexOf('自定义底图') > -1)
// servicename = '自定义底图'
switch (servicename) {
case "高德街道":
case '高德街道':
return 'amap-v';
case "高德影像":
case '高德影像':
return 'amap-i';
case "天地图街道":
case '天地图街道':
return 'tianditu-v';
case "天地图影像":
case '天地图影像':
return 'tianditu-i';
case "百度街道":
case '百度街道':
return 'baiduMapStreet';
case "百度影像":
case '百度影像':
return 'baiduMapImage';
case "mapBox地图" :
case 'mapBox地图':
return 'mapBoxImage';
case "arcgis地图" :
return "arcgisImage"
case 'arcgis地图':
return 'arcgisImage';
default:
return 'amap-v';
}
}
};
//选择坐标系
const handleCoordinate = () => { }
const handleCoordinate = () => {};
//选择图层
const handleLayer = () => { }
const handleLayer = () => {};
//选择工作空间
const handleWorkSpance = () => { }
const handleWorkSpance = () => {};
return (
<Modal
......@@ -194,30 +210,26 @@ const AddModal = props => {
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="名称"
name="name"
rules={[{ required: true, message: '请选择服务名' }]}
>
<Item label="名称" name="name" rules={[{ required: true, message: '请选择服务名' }]}>
<Select onChange={handleChange}>
{type === 'add' ? baseMap.map((item, index) => { return <Option value={item} key={index}>{item}</Option> }) : ''}
{type === 'add'
? baseMap.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label="类型"
name="type"
>
<Item label="类型" name="type">
<Input placeholder="请输入类型" allowClear disabled />
</Item>
<Item
label="URL"
name="url"
>
<Item label="URL" name="url">
<Input placeholder="请输入URL" allowClear />
</Item>
<Item
label="透明度"
>
<Item label="透明度">
<Row>
<Col span={12}>
<Slider
......@@ -242,39 +254,26 @@ const AddModal = props => {
</Col>
</Row>
</Item>
<Item
label="选择缩略图"
name="icon"
>
<Item label="选择缩略图" name="icon">
<div className={styles.imgList}>
{imgURL.map((item, index) => {
return <div key={index} className={styles.imgItem}>
<Image
width={100}
height={63}
src={item.url}
/>
<Radio.Group options={item} onChange={radioChange} value={radio}>
<Radio value={arr[index]}></Radio>
</Radio.Group>
</div>
return (
<div key={index} className={styles.imgItem}>
<Image width={100} height={63} src={item.url} />
<Radio.Group options={item} onChange={radioChange} value={radio}>
<Radio value={arr[index]} />
</Radio.Group>
</div>
);
})}
</div>
</Item>
<Item
label="缩略图"
name="icon"
rules={[{ required: true, message: '请选择缩略图' }]}
>
<Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
<Input placeholder="请输入URL" allowClear />
</Item>
{mapType === 1 ?
{mapType === 1 ? (
<>
<Item
label="ip地址"
name="IP"
rules={[{ required: true, message: '请输入ip地址' }]}
>
<Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}>
<Input placeholder="请输入ip地址" allowClear />
</Item>
<Item
......@@ -293,27 +292,21 @@ const AddModal = props => {
name="workSpance"
rules={[{ required: true, message: '请选择工作空间' }]}
>
<Select onChange={handleWorkSpance}>
</Select>
<Select onChange={handleWorkSpance} />
</Item>
<Item
label="图层名"
name="layer"
rules={[{ required: true, message: '请选择图层名' }]}
>
<Select onChange={handleLayer}>
</Select>
<Select onChange={handleLayer} />
</Item>
<Item
label="坐标系名"
name="coordinate"
rules={[{ required: true, message: '请选择坐标系名' }]}
>
<Select onChange={handleCoordinate}>
</Select>
<Select onChange={handleCoordinate} />
</Item>
<Item
......@@ -345,7 +338,9 @@ const AddModal = props => {
<Input placeholder="请输入URL" allowClear />
</Item>
</>
: ''}
) : (
''
)}
</Form>
)}
</Modal>
......
/* eslint-disable eqeqeq */
/* eslint-disable import/order */
/* eslint-disable react/jsx-boolean-value */
/* eslint-disable indent */
import React, { useState, useEffect } from 'react';
import {
......@@ -11,16 +14,14 @@ import {
message,
Card,
Space,
Tooltip,
Row,
Col,
} from 'antd';
import styles from '../dimensionsConfig.less';
import { AddVectorData, publisService, GetProjectNames } from '@/services/webConfig/api';
import {
PlusCircleOutlined,
CloseCircleOutlined,
PlusOutlined,
MinusCircleOutlined,
} from '@ant-design/icons';
import { AddVectorData, GetProjectNames } from '@/services/webConfig/api';
import { CloseCircleOutlined, MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
const { Option } = Select;
const AddModal = props => {
......@@ -42,10 +43,16 @@ const AddModal = props => {
setLoading(true);
let obj = form.getFieldsValue();
let attributesObj = {};
attributes.map((item, index) => {
let key = obj[`key${index}`];
attributesObj[`${key}`] = obj[`value${index}`];
});
if (obj.users) {
obj.users.map(item => {
attributesObj[item.nodeName] = item.nodeValue;
});
}
// attributes.map((item, index) => {
// let key = obj[`key${index}`];
// attributesObj[`${key}`] = obj[`value${index}`];
// });
if (type === 'add') {
let url = allData[obj.name].fileName
? `http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}/${
......@@ -123,7 +130,7 @@ const AddModal = props => {
}
}, [visible]);
//存储到localstorage
// 存储到localstorage
const handlelocalStorage = (type, gsIp, gisAppName) => {
if (!localStorage) return null;
let result = JSON.parse(localStorage.getItem('metaData'));
......@@ -160,7 +167,7 @@ const AddModal = props => {
span: 4,
},
wrapperCol: {
span: 17,
span: 18,
},
};
......@@ -218,8 +225,6 @@ const AddModal = props => {
GetProjectNames({ ip: obj.ip, port: obj.port, projectname: value }).then(response => {
let newArr = JSON.parse(response.data);
let workArr = Object.keys(newArr.data);
console.log('newArr', newArr);
console.log('workArr', workArr);
setAllData(newArr.data);
if (workArr.length) {
setWorkList(workArr);
......@@ -230,16 +235,16 @@ const AddModal = props => {
const selectName = value => {
form.setFieldsValue({ type: allData[value].type });
};
const addExtra = () => {
let attributesArr = [...attributes];
attributesArr.push({});
setAttributes(attributesArr);
};
const deleteExtr = index => {
let attributesArr = [...attributes];
attributesArr.splice(index, 1);
setAttributes(attributesArr);
};
// const addExtra = () => {
// let attributesArr = [...attributes];
// attributesArr.push({});
// setAttributes(attributesArr);
// };
// const deleteExtr = index => {
// let attributesArr = [...attributes];
// attributesArr.splice(index, 1);
// setAttributes(attributesArr);
// };
const inputPort = e => {
setPorts(e.target.value);
};
......@@ -279,7 +284,7 @@ const AddModal = props => {
name="projectName"
rules={[{ required: true, message: '请选择项目名' }]}
>
<Select onChange={selectProject} style={{ width: '351px' }}>
<Select onChange={selectProject} style={{ width: '379px' }}>
{projectNmme.length
? projectNmme.map((item, index) => {
return (
......@@ -290,7 +295,7 @@ const AddModal = props => {
})
: ''}
</Select>
<Button style={{ marginLeft: '0.5rem' }} onClick={getProject} loading={loadingProject}>
<Button style={{ marginLeft: '0.5rem' }} onClick={getProject}>
获取项目名
</Button>
</Item>
......@@ -318,7 +323,7 @@ const AddModal = props => {
>
<Input placeholder="请输入数据类型" allowClear disabled />
</Item>
<Button
{/* <Button
size="small"
style={{ width: '71%', marginLeft: '109px', lineHeight: '32px', height: '32px' }}
onClick={() => {
......@@ -326,17 +331,68 @@ const AddModal = props => {
}}
>
新增额外属性
</Button>
</Button> */}
<div
style={{
maxHeight: '14rem',
maxHeight: '200px',
overflowY: 'scroll',
marginTop: '0.2rem',
marginLeft: '66px',
width: '88%',
}}
>
{attributes.length
<Form.List name="users">
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, fieldKey, ...restField }) => (
<Space key={key} style={{ display: 'flex', marginBottom: 8 }}>
<div style={{ display: 'flex', alignItems: 'middle' }}>
<Form.Item
{...restField}
name={[name, 'nodeName']}
label="键"
fieldKey={[fieldKey, 'frist']}
>
<Input
placeholder="请输入名称"
style={{ marginLeft: '2px', width: '224px' }}
/>
</Form.Item>
<Form.Item
{...restField}
name={[name, 'nodeValue']}
label="值"
fieldKey={[fieldKey, 'last']}
style={{ marginLeft: '10px' }}
>
<Input
placeholder="请输入值"
style={{ marginLeft: '2px', width: '224px' }}
/>
</Form.Item>
<Tooltip title="移除额外属性">
<MinusCircleOutlined
onClick={() => remove(name)}
style={{ marginLeft: '20px', marginTop: '11px', fontSize: '20px' }}
/>
</Tooltip>
</div>
</Space>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => add()}
block
icon={<PlusOutlined />}
style={{ width: '489px', marginLeft: '43px' }}
>
新增额外属性
</Button>
</Form.Item>
</>
)}
</Form.List>
{/* {attributes.length
? attributes.map((item, index) => {
return (
<div key={index} className={styles.containerFileds}>
......@@ -367,7 +423,7 @@ const AddModal = props => {
</div>
);
})
: ''}
: ''} */}
</div>
</Form>
)}
......
......@@ -5,31 +5,31 @@ import {
AddSchemaBaseMap,
bindSchemeBaseMap,
GetBaseMapList,
GetVectorDataList
GetVectorDataList,
} from '@/services/webConfig/api';
import MapScope from '@/components/ThreeMapScope'
import MapScope from '@/components/ThreeMapScope';
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, serviceList } = props;
const { callBackSubmit = () => {}, type, formObj, visible, serviceList } = props;
const [loading, setLoading] = useState(false);
const [baseMap, setBaseMap] = useState([]);
const [pipeArr, setPipeArr] = useState([]);
const [data, setData] = useState([]);
const [mapSettings, setMapSettings] = useState({ areaName: '选择视角' });
const [mapScopeVisible, setMapScopeVisible] = useState(false)
const [baseMapData, setBaseMapData] = useState([])
const [mapScopeVisible, setMapScopeVisible] = useState(false);
const [baseMapData, setBaseMapData] = useState([]);
const [form] = Form.useForm();
const baseMapList = {
'amap-v': "高德街道",
'amap-i': "高德影像",
'tianditu-v': "天地图街道",
'tianditu-i': "天地图影像",
'baiduMapStreet': "百度街道",
'baiduMapImage': "百度影像",
"mapBoxImage" : "mapBox地图",
"arcgisImage" : "arcgis地图"
}
'amap-v': '高德街道',
'amap-i': '高德影像',
'tianditu-v': '天地图街道',
'tianditu-i': '天地图影像',
baiduMapStreet: '百度街道',
baiduMapImage: '百度影像',
mapBoxImage: 'mapBox地图',
arcgisImage: 'arcgis地图',
};
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
......@@ -38,18 +38,17 @@ const AddModal = props => {
if (type === 'add') {
AddSchemaBaseMap({
schemename: formObj.schemename,
type: obj.serverName
type: obj.serverName,
}).then(res => {
setLoading(false);
if (res.msg === '') {
form.resetFields();
callBackSubmit();
prompt('success', '瓦片新增成功')
}
else {
prompt('fail', '瓦片新增失败')
prompt('success', '瓦片新增成功');
} else {
prompt('fail', '瓦片新增失败');
}
})
});
} else {
handleEdit();
}
......@@ -63,31 +62,30 @@ const AddModal = props => {
duration: 3,
description: content,
});
}
else {
} else {
notification.error({
message: '提示',
duration: 3,
description: content,
});
}
}
};
const handleEdit = () => {
let obj = form.getFieldsValue();
AddSchema({
schemename: obj.schemename,
data,
mapSettings: mapSettings.areaName === '选择视角' ? {} : mapSettings,
baseMap: baseMapData
baseMap: baseMapData,
})
.then(res => {
setLoading(false);
if (res.msg === "") {
if (res.msg === '') {
form.resetFields();
callBackSubmit();
prompt('success', '方案新增成功')
prompt('success', '方案新增成功');
} else {
prompt('fail', res.msg)
prompt('fail', res.msg);
}
})
.catch(err => {
......@@ -95,157 +93,171 @@ const AddModal = props => {
});
};
const onFinish = value => {
};
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
console.log('serviceList', serviceList);
addTile()
addTile();
break;
case 'schemeAdd':
pipeNetwork()
pipeNetwork();
break;
default:
break;
}
}, [visible]);
//添加瓦片
// 添加瓦片
const addTile = () => {
form.setFieldsValue({
serverName: serviceList[0]
})
}
//获取管网及默认底图
serverName: serviceList[0],
});
};
// 获取管网及默认底图
const pipeNetwork = () => {
form.resetFields();
setMapSettings({ areaName: '选择视角' })
let req1 = GetBaseMapList()
let req2 = GetVectorDataList()
let pipeArr = [], baseMap = [];
setMapSettings({ areaName: '选择视角' });
let req1 = GetBaseMapList();
let req2 = GetVectorDataList();
let pipeArr = [],
baseMap = [];
Promise.all([req1, req2]).then(res => {
if (res[0].msg === 'Ok') {
setBaseMap(res[0].data)
setBaseMap(res[0].data);
}
if (res[1].msg === 'Ok') {
(res[1].data || []).map(item => {
pipeArr.push(item.id)
})
pipeArr.push(item.id);
});
}
setPipeArr(pipeArr)
setPipeArr(pipeArr);
form.setFieldsValue({
baseMap: res[0].data[0].name
})
})
}
baseMap: res[0].data[0].name,
});
});
};
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
span: 18,
},
};
//选择服务名
const handleChange = (value) => {
}
//选择管网
const handleService = (value) => {
setData(value)
}
// 选择服务名
const handleChange = value => {};
// 选择管网
const handleService = value => {
setData(value);
};
//选择底图
// 选择底图
const handleBaseMap = (value, option) => {
let baseMapDataArr = []
let baseMapDataArr = [];
value.map((item, index) => {
baseMapDataArr.push({ type: item, status: index == 0 ? 'active' : 'notActive' })
})
setBaseMapData(baseMapDataArr)
}
const submitExtent = (mapSettings) => {
setMapScopeVisible(false)
baseMapDataArr.push({ type: item, status: index == 0 ? 'active' : 'notActive' });
});
setBaseMapData(baseMapDataArr);
};
const submitExtent = mapSettings => {
setMapScopeVisible(false);
if (JSON.stringify(mapSettings) != '{}') {
setMapSettings(mapSettings)
setMapSettings(mapSettings);
form.setFieldsValue({
camera: mapSettings.areaName
})
camera: mapSettings.areaName,
});
}
}
};
return (
<><Modal
title={`${type === 'add' ? '添加底图' : '添加方案'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? <Item
label="服务名"
name="serverName"
>
<Select onChange={handleChange}>
{serviceList.length ? serviceList.map((item, index) => { return <Option key={index} value={item}>{baseMapList[item]}</Option>; }) : ''}
</Select>
</Item> :
<>
<Item
label="方案名"
name="schemename"
rules={[{ required: true, message: '请输入方案名' }]}
>
<Input placeholder="请输入方案名" allowClear />
</Item>
<Item
label="数据源"
>
<Select onChange={handleService} mode="multiple" >
{pipeArr.length ? pipeArr.map((item, index) => { return <Option key={index} value={item}>{item}</Option>; }) : ''}
</Select>
</Item>
<Item
label="瓦片"
name=''
rules={[{ required: true, message: '请选择瓦片' }]}
>
<Select onChange={handleBaseMap} mode="multiple">
{baseMap.length ? baseMap.map((item, index) => { return <Option key={index} value={item.type}>{item.name}</Option>; }) : ''}
<>
<Modal
title={`${type === 'add' ? '添加底图' : '添加方案'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? (
<Item label="服务名" name="serverName">
<Select onChange={handleChange}>
{serviceList.length
? serviceList.map((item, index) => {
return (
<Option key={index} value={item}>
{baseMapList[item]}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label="视角"
name="camera"
>
<Button style={{ width: '100%' }} onClick={() => setMapScopeVisible(true)}>{mapSettings.areaName}</Button>
</Item>
</>}
</Form>
)}
</Modal>
) : (
<>
<Item
label="方案名"
name="schemename"
rules={[{ required: true, message: '请输入方案名' }]}
>
<Input placeholder="请输入方案名" allowClear />
</Item>
<Item label="数据源">
<Select onChange={handleService} mode="multiple">
{pipeArr.length
? pipeArr.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item label="瓦片" name="" rules={[{ required: true, message: '请选择瓦片' }]}>
<Select onChange={handleBaseMap} mode="multiple">
{baseMap.length
? baseMap.map((item, index) => {
return (
<Option key={index} value={item.type}>
{item.name}
</Option>
);
})
: ''}
</Select>
</Item>
<Item label="视角" name="camera">
<Button style={{ width: '100%' }} onClick={() => setMapScopeVisible(true)}>
{mapSettings.areaName}
</Button>
</Item>
</>
)}
</Form>
)}
</Modal>
<MapScope
visible={mapScopeVisible}
onCancel={() => setMapScopeVisible(false)}
baseMapData = {baseMapData}
baseMap = {baseMap}
handleType = 'add'
confirmModal={submitExtent} /></>
baseMapData={baseMapData}
baseMap={baseMap}
handleType="add"
confirmModal={submitExtent}
/>
</>
);
};
export default AddModal;
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd';
import {
SetServiceConfig,AddWebSchema
} from '@/services/webConfig/api';
import { SetServiceConfig, AddWebSchema } from '@/services/webConfig/api';
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, listData } = props;
const { callBackSubmit = () => {}, type, formObj, visible, listData } = props;
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -18,11 +15,11 @@ const AddModal = props => {
setLoading(true);
let obj = form.getFieldsValue();
AddWebSchema({
schemename: obj.schemename
schemename: obj.schemename,
})
.then(res => {
setLoading(false);
if (res.msg === "") {
if (res.msg === '') {
form.resetFields();
callBackSubmit();
notification.success({
......@@ -30,12 +27,11 @@ const AddModal = props => {
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description:res.msg,
description: res.msg,
});
}
})
......@@ -47,39 +43,35 @@ const AddModal = props => {
});
setLoading(false);
});
}
});
};
const onFinish = value => { };
const onFinish = value => {};
useEffect(() => {
if(type!=''){
if (type != '') {
form.setFieldsValue({ schemename: listData[0] });
}
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
span: 3,
},
wrapperCol: {
span: 16,
span: 20,
},
};
const handleChange = (value) => {
form.setFieldsValue({ schemename: value});
}
const handleChange = value => {
form.setFieldsValue({ schemename: value });
};
return (
<Modal
title={`${type === 'add' ? '元数据发布' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
bodyStyle={{ width: '100%' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
......@@ -100,7 +92,13 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择服务名' }]}
>
<Select onChange={handleChange}>
{listData.map((item, index) => { return <Option value={item} key={index}>{item}</Option> }) }
{listData.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})}
</Select>
</Item>
</Form>
......
......@@ -149,7 +149,7 @@ const VectorData = props => {
// }
// ];
//获取选中的角色
// 获取选中的角色
const onPushSubmit = value => {
let id = [];
if (value.length) {
......@@ -174,11 +174,11 @@ const VectorData = props => {
});
}
};
//获取角色
// 获取角色
const pickRole = record => {
setRecord(record);
};
//设置web方案
// 设置web方案
const onChangeCheck = (e, record, index) => {
setCheckLoading(true);
IsActionWebSchema({ schemaname: record.scheme.schemename }).then(res => {
......@@ -192,7 +192,7 @@ const VectorData = props => {
});
};
//选择手持方案
// 选择手持方案
const onChangeHand = (e, record, index) => {
setCheckLoading(true);
const newLoadings = [...handStatus];
......@@ -280,7 +280,7 @@ const VectorData = props => {
setVisible(false);
setFlag(flag + 1);
};
//删除web配置方案
// 删除web配置方案
const delWebConfirm = record => {
DeleteWebSchema(record.scheme.schemename).then(res => {
if (res.msg === '') {
......@@ -291,7 +291,7 @@ const VectorData = props => {
}
});
};
//删除手持配置方案
// 删除手持配置方案
const delhandConfirm = record => {
deleteConfig({
schemename: record['schemename'],
......@@ -306,7 +306,7 @@ const VectorData = props => {
}
});
};
//添加方案
// 添加方案
const addType = type => {
setType(type);
let listData = [];
......@@ -349,12 +349,12 @@ const VectorData = props => {
// 获取瓦片数据配置数据
const renderTile = () => {
setCheckLoading(true);
//查询手持方案
// 查询手持方案
// var schemeConfigQueryRequest = GetMaplayerByTerminalType({
// terminalType: 'phone',
// isBaseMap: false
// })
//查询web方案
// 查询web方案
var webSchemeQueryRequest = GetWebSchemaList();
Promise.all([webSchemeQueryRequest])
.then(res => {
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, Slider, InputNumber, Row, Col, Image, Radio, Button } from 'antd';
import styles from '../SchemeConfig.less'
import {
Form,
Modal,
Input,
Select,
notification,
Slider,
InputNumber,
Row,
Col,
Image,
Radio,
Button,
} from 'antd';
import styles from '../SchemeConfig.less';
import thumbnail_1 from '@/assets/images/thumbnail/thumbnail_1.jpg';
import thumbnail_2 from '@/assets/images/thumbnail/thumbnail_2.jpg';
import thumbnail_3 from '@/assets/images/thumbnail/thumbnail_3.jpg';
import thumbnail_4 from '@/assets/images/thumbnail/thumbnail_4.jpg';
import {
SetServiceConfig
} from '@/services/webConfig/api';
import { SetServiceConfig } from '@/services/webConfig/api';
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, baseMap } = props;
const { callBackSubmit = () => {}, type, formObj, visible, baseMap } = props;
const [loading, setLoading] = useState(false);
const [radio, setRadio] = useState();
const [alpha, setAlpha] = useState(1);
const [mapType, setMapType] = useState(0);
const [form] = Form.useForm();
const arr = ['assets/images/thumbnail/thumbnail_1.jpg', 'assets/images/thumbnail/thumbnail_2.jpg', 'assets/images/thumbnail/thumbnail_3.jpg', 'assets/images/thumbnail/thumbnail_4.jpg']
const arr = [
'assets/images/thumbnail/thumbnail_1.jpg',
'assets/images/thumbnail/thumbnail_2.jpg',
'assets/images/thumbnail/thumbnail_3.jpg',
'assets/images/thumbnail/thumbnail_4.jpg',
];
// 提交
const onSubmit = () => {
......@@ -34,56 +50,57 @@ const AddModal = props => {
url: obj.url,
icon: obj.icon,
type: obj.type,
})
}
}),
};
SetServiceConfig(arr)
.then(res => {
setLoading(false);
if (res.msg === "Ok") {
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: res.message || type == 'add' ? '新增成功' : '编辑成功'
description: res.message || type == 'add' ? '新增成功' : '编辑成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.message || type == 'add' ? '新增失败' : '编辑失败'
description: res.message || type == 'add' ? '新增失败' : '编辑失败',
});
}
})
.catch(err => { setLoading(false); });
.catch(err => {
setLoading(false);
});
}
});
};
const onFinish = value => { };
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
setRadio('')
form.resetFields();
form.setFieldsValue({
servicename: baseMap[0],
label: baseMap[0],
type: servicenameToType(baseMap[0])
})
setRadio('');
form.resetFields();
form.setFieldsValue({
servicename: baseMap[0],
label: baseMap[0],
type: servicenameToType(baseMap[0]),
});
break;
case 'edit':
form.setFieldsValue({ ...formObj });
let index = formObj.icon.lastIndexOf("/")
let index = formObj.icon.lastIndexOf('/');
let str = formObj.icon.substring(index + 1, formObj.icon.length);
let defaultIndex = arr.filter((item, index) => {
if (item.indexOf(str) !== -1) {
return index
return index;
}
})
setRadio(defaultIndex[0])
});
setRadio(defaultIndex[0]);
break;
default:
break;
......@@ -96,89 +113,88 @@ const AddModal = props => {
// }
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
span: 18,
},
};
const onChange = (value) => {
let silderData = value == 100 ? 1 : (value / 100).toFixed(1)
setAlpha(silderData)
}
const tipFormatter = (value) => {
return (value / 100).toFixed(1)
}
const onChange = value => {
let silderData = value == 100 ? 1 : (value / 100).toFixed(1);
setAlpha(silderData);
};
const tipFormatter = value => {
return (value / 100).toFixed(1);
};
const imgURL = [
{
url: thumbnail_1
url: thumbnail_1,
},
{
url: thumbnail_2
url: thumbnail_2,
},
{
url: thumbnail_3
url: thumbnail_3,
},
{
url: thumbnail_4
url: thumbnail_4,
},
]
];
const radioChange = (e) => {
setRadio(e.target.value)
}
const handleChange = (value) => {
const radioChange = e => {
setRadio(e.target.value);
};
const handleChange = value => {
form.setFieldsValue({
type: servicenameToType(value)
})
type: servicenameToType(value),
});
// if (baseMap.indexOf(value) == 2 || baseMap.indexOf(value) == 3) {
// setMapType(1)
// }
// else {
// setMapType(0)
// }
}
};
//添加地图类型
const servicenameToType = (servicename) => {
const servicenameToType = servicename => {
// if (servicename.indexOf('地形图') > -1)
// servicename = '地形图'
// if (servicename.indexOf('自定义底图') > -1)
// servicename = '自定义底图'
switch (servicename) {
case "谷歌地形":
case '谷歌地形':
return 'google-v';
case "谷歌影像(注记)":
case '谷歌影像(注记)':
return 'google-i-a';
case "谷歌影像":
case '谷歌影像':
return 'google-i';
case "高德影像":
case '高德影像':
return 'amap-i';
case "高德地形":
case '高德地形':
return 'amap-v';
case "天地图影像":
case '天地图影像':
return 'tianditu-i-ia';
case "天地图地形":
case '天地图地形':
return 'tianditu-v-va';
case "自定义底图":
case '自定义底图':
return 'google-user';
case "地形图":
case "瓦片图":
return "pipenet-tile";
case '地形图':
case '瓦片图':
return 'pipenet-tile';
default:
return 'arcgis-tilelayer';
}
}
};
//选择坐标系
const handleCoordinate = () => { }
const handleCoordinate = () => {};
//选择图层
const handleLayer = () => { }
const handleLayer = () => {};
//选择工作空间
const handleWorkSpance = () => { }
const handleWorkSpance = () => {};
return (
<Modal
......@@ -204,32 +220,28 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择服务名' }]}
>
<Select onChange={handleChange}>
{type === 'add' ? baseMap.map((item, index) => { return <Option value={item} key={index}>{item}</Option> }) : ''}
{type === 'add'
? baseMap.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label="标签"
name="label"
rules={[{ required: true, message: '请输入标签' }]}
>
<Item label="标签" name="label" rules={[{ required: true, message: '请输入标签' }]}>
<Input placeholder="请输入IP" allowClear />
</Item>
<Item
label="类型"
name="type"
>
<Item label="类型" name="type">
<Input placeholder="请输入类型" allowClear disabled />
</Item>
<Item
label="URL"
name="url"
>
<Item label="URL" name="url">
<Input placeholder="请输入URL" allowClear />
</Item>
<Item
label="透明度"
>
<Item label="透明度">
<Row>
<Col span={12}>
<Slider
......@@ -254,39 +266,26 @@ const AddModal = props => {
</Col>
</Row>
</Item>
<Item
label="选择缩略图"
name="icon"
>
<Item label="选择缩略图" name="icon">
<div className={styles.imgList}>
{imgURL.map((item, index) => {
return <div key={index} className={styles.imgItem}>
<Image
width={100}
height={63}
src={item.url}
/>
<Radio.Group options={item} onChange={radioChange} value={radio}>
<Radio value={arr[index]}></Radio>
</Radio.Group>
</div>
return (
<div key={index} className={styles.imgItem}>
<Image width={100} height={63} src={item.url} />
<Radio.Group options={item} onChange={radioChange} value={radio}>
<Radio value={arr[index]} />
</Radio.Group>
</div>
);
})}
</div>
</Item>
<Item
label="缩略图"
name="icon"
rules={[{ required: true, message: '请选择缩略图' }]}
>
<Item label="缩略图" name="icon" rules={[{ required: true, message: '请选择缩略图' }]}>
<Input placeholder="请输入URL" allowClear />
</Item>
{mapType === 1 ?
{mapType === 1 ? (
<>
<Item
label="ip地址"
name="IP"
rules={[{ required: true, message: '请输入ip地址' }]}
>
<Item label="ip地址" name="IP" rules={[{ required: true, message: '请输入ip地址' }]}>
<Input placeholder="请输入ip地址" allowClear />
</Item>
<Item
......@@ -305,27 +304,21 @@ const AddModal = props => {
name="workSpance"
rules={[{ required: true, message: '请选择工作空间' }]}
>
<Select onChange={handleWorkSpance}>
</Select>
<Select onChange={handleWorkSpance} />
</Item>
<Item
label="图层名"
name="layer"
rules={[{ required: true, message: '请选择图层名' }]}
>
<Select onChange={handleLayer}>
</Select>
<Select onChange={handleLayer} />
</Item>
<Item
label="坐标系名"
name="coordinate"
rules={[{ required: true, message: '请选择坐标系名' }]}
>
<Select onChange={handleCoordinate}>
</Select>
<Select onChange={handleCoordinate} />
</Item>
<Item
......@@ -357,7 +350,9 @@ const AddModal = props => {
<Input placeholder="请输入URL" allowClear />
</Item>
</>
: ''}
) : (
''
)}
</Form>
)}
</Modal>
......
......@@ -10,7 +10,7 @@ const TileData = props => {
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({});
const [flag, setFlag] = useState(0); // 弹窗类型
const [baseMap, setBaseMap] = useState([]); //底图数据
const [baseMap, setBaseMap] = useState([]); // 底图数据
const columns = [
{
title: '服务名',
......
......@@ -96,7 +96,7 @@ const AddModal = props => {
}
}, [visible]);
//存储到localstorage
// 存储到localstorage
const handlelocalStorage = (type, gsIp, gisAppName) => {
if (!localStorage) return null;
let result = JSON.parse(localStorage.getItem('metaData'));
......@@ -133,11 +133,11 @@ const AddModal = props => {
span: 5,
},
wrapperCol: {
span: 16,
span: 18,
},
};
//选择工作空间
// 选择工作空间
const selectWorkspace = () => {
let obj = form.getFieldsValue();
form
......@@ -170,7 +170,7 @@ const AddModal = props => {
}
});
};
//选择工作空间
// 选择工作空间
const handleWorkspace = value => {
form.setFieldsValue({
workname: value,
......@@ -243,7 +243,7 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择工作空间名称' }]}
>
<div className={styles.imgList}>
<Select onChange={handleWorkspace} value={workSpace} style={{ width: '310px' }}>
<Select onChange={handleWorkspace} value={workSpace} style={{ width: '365px' }}>
{workList.length
? workList.map((item, index) => {
return (
......
......@@ -85,7 +85,7 @@ const VectorData = props => {
),
},
];
//更新
// 更新
const enterLoading = (record, index) => {
const newLoadings = [...loading];
newLoadings[index] = true;
......
......@@ -4,17 +4,16 @@ import {
GettMaplayer,
GetVectorService,
SetServiceConfig,
bindSchemeBaseMap
bindSchemeBaseMap,
} from '@/services/webConfig/api';
const { Item } = Form;
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, serviceList } = props;
const { callBackSubmit = () => {}, type, formObj, visible, serviceList } = props;
const [loading, setLoading] = useState(false);
const [baseMap, setBaseMap] = useState([]);
const [pipeArr, setPipeArr] = useState([]);
const [form] = Form.useForm();
// 提交
const onSubmit = () => {
......@@ -25,18 +24,17 @@ const AddModal = props => {
if (type === 'add') {
bindSchemeBaseMap({
schemename: formObj.schemename,
basemapName: obj.serverName
basemapName: obj.serverName,
}).then(res => {
setLoading(false);
if (res.code === 0) {
form.resetFields();
callBackSubmit();
prompt('success', '瓦片新增成功')
}
else {
prompt('fail', '瓦片新增失败')
prompt('success', '瓦片新增成功');
} else {
prompt('fail', '瓦片新增失败');
}
})
});
} else {
handleEdit();
}
......@@ -50,15 +48,14 @@ const AddModal = props => {
duration: 3,
description: content,
});
}
else {
} else {
notification.error({
message: '提示',
duration: 3,
description: content,
});
}
}
};
const handleEdit = () => {
let obj = form.getFieldsValue();
let query = {
......@@ -71,17 +68,17 @@ const AddModal = props => {
label: obj.label,
url: obj.url,
alpha: 1,
})
}
}),
};
SetServiceConfig(query)
.then(res => {
setLoading(false);
if (res.msg === "Ok") {
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
prompt('success', '方案新增成功')
prompt('success', '方案新增成功');
} else {
prompt('fail', '方案新增失败')
prompt('fail', '方案新增失败');
}
})
.catch(err => {
......@@ -89,74 +86,73 @@ const AddModal = props => {
});
};
const onFinish = value => {
};
const onFinish = value => {};
useEffect(() => {
switch (type) {
case 'add':
addTile()
addTile();
break;
case 'schemeAdd':
pipeNetwork()
pipeNetwork();
break;
default:
break;
}
}, [visible]);
//添加瓦片
// 添加瓦片
const addTile = () => {
form.setFieldsValue({
serverName: serviceList[0]
})
}
//获取管网及默认底图
serverName: serviceList[0],
});
};
// 获取管网及默认底图
const pipeNetwork = () => {
form.resetFields();
let req1 = GettMaplayer({ terminalType: 'base', isBaseMap: true })
let req2 = GetVectorService()
let pipeArr = [], baseMap = [];
let req1 = GettMaplayer({ terminalType: 'base', isBaseMap: true });
let req2 = GetVectorService();
let pipeArr = [],
baseMap = [];
Promise.all([req1, req2]).then(res => {
if (res[0].msg === 'Ok') {
(res[0].data.general.baseMap.layers || []).map(item => {
baseMap.push(item.servicename)
})
baseMap.push(item.servicename);
});
}
if (res[1].msg === 'Ok') {
(res[1].data.VectorList || []).map(item => {
pipeArr.push(item.ServiceName.split(".")[0])
})
pipeArr.push(item.ServiceName.split('.')[0]);
});
}
setPipeArr(pipeArr)
setBaseMap(baseMap)
setPipeArr(pipeArr);
setBaseMap(baseMap);
form.setFieldsValue({
baseMap: baseMap[0]
})
})
}
baseMap: baseMap[0],
});
});
};
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 16,
span: 18,
},
};
//选择服务名
const handleChange = () => { }
//选择管网
const handleService = (value) => {
// 选择服务名
const handleChange = () => {};
// 选择管网
const handleService = value => {
form.setFieldsValue({
label: value,
url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}`
})
}
url: `http://{IP}/CityInterface/rest/services/MapServer.svc/${value}`,
});
};
//选择底图
const handleBaseMap = () => { }
// 选择底图
const handleBaseMap = () => {};
return (
<Modal
title={`${type === 'add' ? '添加底图' : '添加方案'}`}
......@@ -175,14 +171,21 @@ const AddModal = props => {
>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
{type === 'add' ? <Item
label="服务名"
name="serverName"
>
<Select onChange={handleChange}>
{serviceList.length ? serviceList.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
</Select>
</Item> :
{type === 'add' ? (
<Item label="服务名" name="serverName">
<Select onChange={handleChange}>
{serviceList.length
? serviceList.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
) : (
<>
<Item
label="方案名"
......@@ -191,24 +194,23 @@ const AddModal = props => {
>
<Input placeholder="请输入方案名" allowClear />
</Item>
<Item
label="管网"
name="servicename"
>
<Item label="管网" name="servicename">
<Select onChange={handleService}>
{pipeArr.length ? pipeArr.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
{pipeArr.length
? pipeArr.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
<Item
label="标签"
name="label"
>
<Item label="标签" name="label">
<Input placeholder="请输入标签" allowClear />
</Item>
<Item
label="url"
name="url"
>
<Item label="url" name="url">
<Input placeholder="请输入url" allowClear />
</Item>
<Item
......@@ -217,13 +219,19 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择底图' }]}
>
<Select onChange={handleBaseMap}>
{baseMap.length ? baseMap.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
{baseMap.length
? baseMap.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select>
</Item>
</>
}
)}
</Form>
)}
</Modal>
......
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd';
import {
SetServiceConfig
} from '@/services/webConfig/api';
import { SetServiceConfig } from '@/services/webConfig/api';
const { Option } = Select;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, listData } = props;
const { callBackSubmit = () => {}, type, formObj, visible, listData } = props;
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const { Item } = Form;
......@@ -21,11 +18,14 @@ const AddModal = props => {
schemename: obj.schemename,
terminalType: type === 'add' ? 'web' : 'phone',
isBaseMap: 'false',
jsonCfg: type === 'add' ? JSON.stringify({ type: 'dynamic' }) : JSON.stringify({ isDefault: false })
jsonCfg:
type === 'add'
? JSON.stringify({ type: 'dynamic' })
: JSON.stringify({ isDefault: false }),
})
.then(res => {
setLoading(false);
if (res.msg === "Ok") {
if (res.msg === 'Ok') {
form.resetFields();
callBackSubmit();
notification.success({
......@@ -33,7 +33,6 @@ const AddModal = props => {
duration: 3,
description: '新增成功',
});
} else {
notification.error({
message: '提示',
......@@ -50,39 +49,35 @@ const AddModal = props => {
});
setLoading(false);
});
}
});
};
const onFinish = value => { };
const onFinish = value => {};
useEffect(() => {
if(type!=''){
if (type != '') {
form.setFieldsValue({ schemename: listData[0] });
}
}, [visible]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
span: 3,
},
wrapperCol: {
span: 16,
span: 20,
},
};
const handleChange = (value) => {
form.setFieldsValue({ schemename: value});
}
const handleChange = value => {
form.setFieldsValue({ schemename: value });
};
return (
<Modal
title={`${type === 'add' ? '元数据发布' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
bodyStyle={{ width: '100%' }}
style={{ top: '150px' }}
width="700px"
destroyOnClose
......@@ -103,7 +98,13 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择服务名' }]}
>
<Select onChange={handleChange}>
{listData.map((item, index) => { return <Option value={item} key={index}>{item}</Option> }) }
{listData.map((item, index) => {
return (
<Option value={item} key={index}>
{item}
</Option>
);
})}
</Select>
</Item>
</Form>
......
/* 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';
......@@ -14,11 +15,11 @@ import AddModal from './AddModal';
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [schemename, setSchemename] = useState([]);
const [record, setRecord] = useState({}); //选中关联角色的方案名
const [record, setRecord] = useState({}); // 选中关联角色的方案名
const [webCurrent, setWebCurrent] = useState(0); // web列表下标
const [handCurrent, setHandCurrent] = useState(0); // hand列表下标
const [webData, setWebData] = useState([]); // web数据
const [handData, setHandData] = useState([]); //手持数据
const [handData, setHandData] = useState([]); // 手持数据
const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 更新list
const [handStatus, setHandStatus] = useState([]); // 更新状态
......@@ -155,7 +156,7 @@ const VectorData = props => {
),
},
];
//获取选中的角色
// 获取选中的角色
const onPushSubmit = value => {
let id = [];
if (value.length) {
......@@ -184,12 +185,12 @@ const VectorData = props => {
});
}
};
//获取角色
// 获取角色
const pickRole = record => {
console.log('recird', record);
setRecord(record);
};
//设置web方案
// 设置web方案
const onChangeCheck = (e, record, index) => {
setCheckLoading(true);
const newLoadings = [...webStatus];
......@@ -199,6 +200,7 @@ const VectorData = props => {
: (newLoadings[loadIndex] = false);
});
setWebStatus(newLoadings);
console.log(newLoadings);
let query = {
schemename: record['schemename'],
type: 'dynamic',
......@@ -247,7 +249,7 @@ const VectorData = props => {
});
};
//选择手持方案
// 选择手持方案
const onChangeHand = (e, record, index) => {
setCheckLoading(true);
const newLoadings = [...handStatus];
......@@ -350,7 +352,7 @@ const VectorData = props => {
}
});
};
//删除手持配置方案
// 删除手持配置方案
const delhandConfirm = record => {
deleteConfig({
schemename: record['schemename'],
......@@ -365,7 +367,7 @@ const VectorData = props => {
}
});
};
//添加方案
// 添加方案
const addType = type => {
setType(type);
let listData = [];
......@@ -411,12 +413,12 @@ const VectorData = props => {
// 获取瓦片数据配置数据
const renderTile = () => {
setCheckLoading(true);
//查询手持方案
// 查询手持方案
var schemeConfigQueryRequest = GetMaplayerByTerminalType({
terminalType: 'phone',
isBaseMap: false,
});
//查询web方案
// 查询web方案
var webSchemeQueryRequest = GetMaplayerByTerminalType({
terminalType: 'web',
isBaseMap: false,
......@@ -481,6 +483,7 @@ const VectorData = props => {
columns={columns}
dataSource={webData}
bordered
style={{ minHeight: '210px' }}
pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8,
......@@ -489,7 +492,7 @@ const VectorData = props => {
},
}}
rowKey="schemename"
scroll={{ y: 400 }}
scroll={{ y: 210 }}
/>
</div>
<Divider orientation="left">
......@@ -508,7 +511,7 @@ const VectorData = props => {
dataSource={handData}
bordered
rowKey="schemename"
scroll={{ y: 600 }}
scroll={{ y: 210 }}
pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
defaultPageSize: 8,
......
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