Commit 1242a8be authored by 邓超's avatar 邓超

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

# Conflicts: # src/pages/dataCenter/dictionary/index.js # src/pages/dataCenter/dictionary/index.less # src/routes/config.js
parents b9cdf6ca d0f77ef8
Pipeline #42522 skipped with stages
...@@ -21,11 +21,7 @@ import { ...@@ -21,11 +21,7 @@ import {
CM_XWBPlan_DataList, CM_XWBPlan_DataList,
} from '@/services/maintenance/api'; } from '@/services/maintenance/api';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import { import { PlusOutlined, DownOutlined, StepForwardFilled } from '@ant-design/icons';
PlusOutlined,
DownOutlined,
StepForwardFilled,
} from '@ant-design/icons';
import ChangeAdd from './ChangeAdd'; import ChangeAdd from './ChangeAdd';
const { Option } = Select; const { Option } = Select;
...@@ -45,9 +41,9 @@ const AddModal = props => { ...@@ -45,9 +41,9 @@ const AddModal = props => {
const [filed, setFiled] = useState({}); // 传给子组件列表数据 const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据 const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [types, setTypes] = useState(''); // 弹窗类型 const [types, setTypes] = useState(''); // 弹窗类型
const [pickItem, setPickItem] = useState(''); //复选框数据填入项 const [pickItem, setPickItem] = useState(''); // 复选框数据填入项
const [checkedList1, setCheckedList1] = useState([]); //最新选择数据 const [checkedList1, setCheckedList1] = useState([]); // 最新选择数据
const [characterValue, setCharacterValue] = useState(''); //打开弹框之前数据 const [characterValue, setCharacterValue] = useState(''); // 打开弹框之前数据
const [ff, setFf] = useState([]); const [ff, setFf] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -368,10 +364,7 @@ const AddModal = props => { ...@@ -368,10 +364,7 @@ const AddModal = props => {
</Menu> </Menu>
} }
> >
<div <div className={styles.linkDrowp} onClick={e => e.preventDefault()}>
className={styles.linkDrowp}
onClick={e => e.preventDefault()}
>
<DownOutlined <DownOutlined
style={{ style={{
fontSize: '12px', fontSize: '12px',
...@@ -396,11 +389,7 @@ const AddModal = props => { ...@@ -396,11 +389,7 @@ const AddModal = props => {
}, },
]} ]}
> >
<Select <Select placeholder="选择计划执行周期" onChange={changTable} value={selectValue}>
placeholder="选择计划执行周期"
onChange={changTable}
value={selectValue}
>
<Option value="一周一次">一周一次</Option> <Option value="一周一次">一周一次</Option>
<Option value="半月一次">半月一次</Option> <Option value="半月一次">半月一次</Option>
<Option value="一月一次">一月一次</Option> <Option value="一月一次">一月一次</Option>
...@@ -468,10 +457,7 @@ const AddModal = props => { ...@@ -468,10 +457,7 @@ const AddModal = props => {
</Menu> </Menu>
} }
> >
<div <div className={styles.linkDrowp} onClick={e => e.preventDefault()}>
className={styles.linkDrowp}
onClick={e => e.preventDefault()}
>
<DownOutlined <DownOutlined
style={{ style={{
fontSize: '12px', fontSize: '12px',
...@@ -613,22 +599,14 @@ const AddModal = props => { ...@@ -613,22 +599,14 @@ const AddModal = props => {
}, },
]} ]}
> >
<Select <Select placeholder="是否送审" onChange={changTable1} value={selectValue1}>
placeholder="是否送审"
onChange={changTable1}
value={selectValue1}
>
<Option value="否"></Option> <Option value="否"></Option>
<Option value="是"></Option> <Option value="是"></Option>
</Select> </Select>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={23}>
<Item <Item label="台账过滤条件" name="filterCondition" labelCol={{ span: 4 }}>
label="台账过滤条件"
name="filterCondition"
labelCol={{ span: 4 }}
>
<TextArea placeholder="设备对应的Scada台账名称,可多选" /> <TextArea placeholder="设备对应的Scada台账名称,可多选" />
</Item> </Item>
</Col> </Col>
...@@ -641,6 +619,7 @@ const AddModal = props => { ...@@ -641,6 +619,7 @@ const AddModal = props => {
newCheckedList={checkedList1} newCheckedList={checkedList1}
isType={types} isType={types}
filed={filed} filed={filed}
type={type}
filed1={filed1} filed1={filed1}
ff={ff} ff={ff}
pickItem={pickItem} pickItem={pickItem}
......
/* eslint-disable no-lonely-if */
/* eslint-disable eqeqeq */
import React, { useState, useEffect, PureComponent } from 'react'; import React, { useState, useEffect, PureComponent } from 'react';
import { Modal, Divider, Checkbox, Space, Button } from 'antd'; import { Modal, Divider, Checkbox, Space, Button } from 'antd';
import styles from './maintenance.less'; import styles from './maintenance.less';
...@@ -14,6 +16,7 @@ const ChangeAdd = props => { ...@@ -14,6 +16,7 @@ const ChangeAdd = props => {
pickItem, pickItem,
characterValue, characterValue,
ff, ff,
type,
} = props; } = props;
const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容 const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
const [indeterminate, setIndeterminate] = useState(true); // 全选样式控制 const [indeterminate, setIndeterminate] = useState(true); // 全选样式控制
...@@ -47,9 +50,7 @@ const ChangeAdd = props => { ...@@ -47,9 +50,7 @@ const ChangeAdd = props => {
const onSubmit = () => { const onSubmit = () => {
isType === 'rule' isType === 'rule'
? callBackSubmit( ? callBackSubmit(
`${ `${value === '无' || value === '' ? '' : `${value},`}${checkValue.join(',')}`,
value === '无' || value === '' ? '' : `${value},`
}${checkValue.join(',')}`,
) )
: callBackSubmit({ : callBackSubmit({
checkedList, checkedList,
...@@ -85,36 +86,62 @@ const ChangeAdd = props => { ...@@ -85,36 +86,62 @@ const ChangeAdd = props => {
useEffect(() => { useEffect(() => {
console.log(indeterminate); console.log(indeterminate);
if (isType != '' && isType === 'add') { if (type == 'edit') {
let checkArr = []; if (isType != '' && isType === 'add') {
console.log(newCheckedList); let checkArr = [];
newCheckedList.map(checkItem => { console.log(newCheckedList);
if (filed.includes(checkItem)) { newCheckedList.map(checkItem => {
checkArr.push(checkItem); if (filed.includes(checkItem)) {
} checkArr.push(checkItem);
}); }
setCheckedList(checkArr); });
setIndeterminate( setCheckedList(checkArr);
!!newCheckedList.length && newCheckedList.length < filed.length, setIndeterminate(!!newCheckedList.length && newCheckedList.length < filed.length);
); setCheckAll(newCheckedList.length === filed.length);
setCheckAll(newCheckedList.length === filed.length); let newArr = characterValue.length ? characterValue.split(',') : [];
let newArr = characterValue.length ? characterValue.split(',') : []; setSelectData(newArr);
setSelectData(newArr); } else if (isType === 'app') {
} else if (isType === 'app') { let checkArr = [];
let checkArr = []; console.log(newCheckedList);
console.log(newCheckedList); newCheckedList.map(checkItem => {
newCheckedList.map(checkItem => { if (ff.includes(checkItem)) {
if (ff.includes(checkItem)) { checkArr.push(checkItem);
checkArr.push(checkItem); }
} });
}); setCheckedList(checkArr);
setCheckedList(checkArr); setIndeterminate(!!newCheckedList.length && newCheckedList.length < ff.length);
setIndeterminate( setCheckAll(newCheckedList.length === ff.length);
!!newCheckedList.length && newCheckedList.length < ff.length, let newArr = characterValue.length ? characterValue.split(',') : [];
); setSelectData(newArr);
setCheckAll(newCheckedList.length === ff.length); }
let newArr = characterValue.length ? characterValue.split(',') : []; } else {
setSelectData(newArr); if (isType != '' && isType === 'add') {
let checkArr = [];
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (filed.includes(checkItem)) {
checkArr.push(checkItem);
}
});
setCheckedList(checkArr);
setIndeterminate(false);
setCheckAll(false);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
} else if (isType === 'app') {
let checkArr = [];
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (ff.includes(checkItem)) {
checkArr.push(checkItem);
}
});
setCheckedList(checkArr);
setIndeterminate(false);
setCheckAll(false);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
}
} }
}, [visible]); }, [visible]);
......
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
/* eslint-disable camelcase */ /* eslint-disable camelcase */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Space, Table, Popconfirm, Tooltip, Button, notification } from 'antd'; import { Space, Table, Popconfirm, Tooltip, Button, notification } from 'antd';
import { import { CM_XWBPlan_DataList, CM_XWBPlan_RemovePlan } from '@/services/maintenance/api';
CM_XWBPlan_DataList,
CM_XWBPlan_RemovePlan,
} from '@/services/maintenance/api';
import { EditTwoTone, DeleteOutlined, PlusOutlined } from '@ant-design/icons'; import { EditTwoTone, DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import styles from './maintenance.less'; import styles from './maintenance.less';
import AddModal from './AddModal'; import AddModal from './AddModal';
...@@ -24,82 +21,231 @@ const maintenance = () => { ...@@ -24,82 +21,231 @@ const maintenance = () => {
dataIndex: 'businessName', dataIndex: 'businessName',
key: 'businessName', key: 'businessName',
width: 100, width: 100,
onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '业务类型', title: '业务类型',
dataIndex: 'businessType', dataIndex: 'businessType',
key: 'businessType', key: 'businessType',
width: 100, width: 100,
ellipsis: true, onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '执行周期', title: '执行周期',
dataIndex: 'docycle', dataIndex: 'docycle',
key: 'docycle', key: 'docycle',
width: 100, width: 100,
onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '台账名称', title: '台账名称',
dataIndex: 'accountName', dataIndex: 'accountName',
key: 'accountName', key: 'accountName',
width: 200, width: 100,
ellipsis: true, onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '反馈名称', title: '反馈名称',
dataIndex: 'feedbackName', dataIndex: 'feedbackName',
key: 'feedbackName', key: 'feedbackName',
width: 200, width: 100,
onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '台账过滤条件', title: '台账过滤条件',
dataIndex: 'filterCondition', dataIndex: 'filterCondition',
key: 'filterCondition', key: 'filterCondition',
width: 200, width: 200,
ellipsis: true, onCell: () => ({
style: {
maxWidth: 200,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '是否送审', title: '是否送审',
dataIndex: 'isSubmit', dataIndex: 'isSubmit',
key: 'isSubmit', key: 'isSubmit',
width: 100, width: 100,
onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '执行角色', title: '执行角色',
dataIndex: 'doRole', dataIndex: 'doRole',
key: 'doRole', key: 'doRole',
width: 200, width: 300,
ellipsis: true, onCell: () => ({
style: {
maxWidth: 300,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '预生成天数', title: '预生成天数',
dataIndex: 'produceDays', dataIndex: 'produceDays',
key: 'produceDays', key: 'produceDays',
width: 100, width: 100,
onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '在线任务量', title: '在线任务量',
dataIndex: 'onLines', dataIndex: 'onLines',
key: 'onLines', key: 'onLines',
width: 100, width: 100,
ellipsis: true, onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '启停', title: '启停',
dataIndex: 'doNot', dataIndex: 'doNot',
key: 'doNot', key: 'doNot',
width: 100, width: 100,
onCell: () => ({
style: {
maxWidth: 100,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
align: 'center', align: 'center',
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '操作', title: '操作',
...@@ -109,10 +255,7 @@ const maintenance = () => { ...@@ -109,10 +255,7 @@ const maintenance = () => {
render: (text, record) => ( render: (text, record) => (
<Space> <Space>
<Tooltip title="修改"> <Tooltip title="修改">
<EditTwoTone <EditTwoTone onClick={() => editEventType(record)} style={{ fontSize: '16px' }} />
onClick={() => editEventType(record)}
style={{ fontSize: '16px' }}
/>
</Tooltip> </Tooltip>
<Tooltip title="删除"> <Tooltip title="删除">
<Popconfirm <Popconfirm
...@@ -206,8 +349,7 @@ const maintenance = () => { ...@@ -206,8 +349,7 @@ const maintenance = () => {
dataSource={tableData} dataSource={tableData}
scroll={{ y: 'calc(100vh - 215px)', x: 'max-content' }} scroll={{ y: 'calc(100vh - 215px)', x: 'max-content' }}
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100], pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20, defaultPageSize: 20,
showQuickJumper: true, showQuickJumper: true,
......
.maintenanceContainer{ .maintenanceContainer {
.ant-card-body { .ant-card-body {
padding: 12px 24px 24px 24px; padding: 12px 24px 24px 24px;
} }
.pickItem{ .pickItem {
background-color: #F5F6F9; background-color: #f5f6f9;
} }
} }
.formData{ .formData {
height: 38rem; height: 38rem;
overflow-y: scroll; overflow-y: scroll;
.ant-form-item-label > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before{ .ant-form-item-label
display: none; > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
} display: none;
.formData_label{ }
display: flex; .formData_label {
align-items: center;
}
.filed_listItem{
display: flex;
height: 3.6rem;
.ant-btn-icon-only {
width: 32px;
height: 32px;
/* padding: 2.4px 0; */
font-size: 16px;
border-radius: 2px;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.linkDrowp{
position: absolute;
top: 0px;
left: 93.5%;
width: 1rem;
height: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.listItem{ .filed_listItem {
display: flex; display: flex;
justify-content: space-between; height: 3.6rem;
font-size: 14px; .ant-btn-icon-only {
font-weight: 400; width: 32px;
color: #414E65; height: 32px;
cursor: pointer; /* padding: 2.4px 0; */
line-height: 28px; font-size: 16px;
align-items: center; border-radius: 2px;
padding: 8px 14px;
display: flex;
align-items: center;
justify-content: center;
}
}
}
.linkDrowp {
position: absolute;
top: 0px;
left: 93.5%;
width: 1rem;
height: 100%;
display: flex;
align-items: center;
}
.listItem {
display: flex;
justify-content: space-between;
font-size: 14px;
font-weight: 400;
color: #414e65;
cursor: pointer;
line-height: 28px;
align-items: center;
padding: 8px 14px;
} }
.ant-select-arrow .anticon { .ant-select-arrow .anticon {
vertical-align: middle; vertical-align: middle;
} }
.listCard{ .listCard {
display: flex; display: flex;
.cardItem{ .cardItem {
padding: 0.5rem; padding: 0.5rem;
} }
.cardContent{ .cardContent {
height: 30rem; height: 30rem;
overflow-y: scroll; overflow-y: scroll;
width: 100%; width: 100%;
} }
.cardItemData{ .cardItemData {
display:inline-block; display: inline-block;
padding: 0.5rem; padding: 0.5rem;
border: 1px solid #b5b8c8; border: 1px solid #b5b8c8;
width:100%; width: 100%;
// height: 30rem; // height: 30rem;
overflow-y: scroll; overflow-y: scroll;
} }
} }
.ant-modal-body { .ant-modal-body {
padding: 10px 24px 0px 24px; padding: 10px 24px 0px 24px;
} }
.ant-modal-footer { .ant-modal-footer {
padding: 0px 48px 10px 40px; padding: 0px 48px 10px 40px;
} }
.ant-table-pagination.ant-pagination { .ant-table-pagination.ant-pagination {
margin: 5px 0; margin: 5px 0;
} }
...@@ -231,15 +231,6 @@ const FlowNode = () => { ...@@ -231,15 +231,6 @@ const FlowNode = () => {
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span> <span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
), ),
}, },
{
title: '发送短信',
dataIndex: 'IsSendMessage',
align: 'center',
width: 80,
render: (text, record) => (
<span style={{ color: record.colorType === 2 ? 'red' : '#000000D9' }}>{text}</span>
),
},
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
...@@ -389,11 +380,6 @@ const FlowNode = () => { ...@@ -389,11 +380,6 @@ const FlowNode = () => {
align: 'center', align: 'center',
width: 80, width: 80,
}, },
{
title: '发送短信',
align: 'center',
width: 80,
},
{ {
title: '操作', title: '操作',
align: 'center', align: 'center',
......
...@@ -948,34 +948,34 @@ const WebDic = () => { ...@@ -948,34 +948,34 @@ const WebDic = () => {
fieldKey={[fieldKey, 'frist']} fieldKey={[fieldKey, 'frist']}
rules={[ rules={[
{ required: true, message: '不能为空' }, { required: true, message: '不能为空' },
// { {
// validator: (rule, value, callback) => { validator: (rule, value, callback) => {
// const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName const nodeName = addForm.getFieldsValue().nodeName1; // 第一项的nodeName
// const nodeName1 = addForm.getFieldsValue(); const nodeName1 = addForm.getFieldsValue();
// console.log(nodeName); console.log(nodeName);
// let result = nodeName1.users; let result = nodeName1.users;
// let arr = []; let arr = [];
// // eslint-disable-next-line array-callback-return // eslint-disable-next-line array-callback-return
// result.map(item => { result.map(item => {
// if (item) { if (item) {
// let a = item.nodeName; let a = item.nodeName;
// if (a !== '') { if (a !== '') {
// arr.push(a); arr.push(a);
// } }
// } }
// }); });
// if (nodeName !== undefined) { if (nodeName !== undefined) {
// arr.unshift(nodeName); arr.unshift(nodeName);
// } }
// console.log(arr); console.log(arr);
// if (new Set(arr).size !== arr.length) { if (new Set(arr).size !== arr.length) {
// arr = [...new Set(arr)]; arr = [...new Set(arr)];
// console.log(arr); console.log(arr);
// callback('用户名重复'); callback('用户名重复');
// } }
// }, },
// }, },
]} ]}
> >
<Input placeholder="请输入名称" /> <Input placeholder="请输入名称" />
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Author: leizhe * @Author: leizhe
* @Date: 2021-07-13 16:32:28 * @Date: 2021-07-13 16:32:28
* @LastEditTime: 2021-10-26 16:38:27 * @LastEditTime: 2022-01-11 15:57:28
* @LastEditors: leizhe * @LastEditors: leizhe
*/ */
import React from 'react'; import React from 'react';
...@@ -13,10 +13,10 @@ import AppDic from './AppDic'; ...@@ -13,10 +13,10 @@ import AppDic from './AppDic';
import styles from './index.less'; import styles from './index.less';
// import VersionPublish from './VersionPublish'; // import VersionPublish from './VersionPublish';
const dictionary1 = () => { const dictionary = () => {
const { TabPane } = Tabs; const { TabPane } = Tabs;
return ( return (
<PageContainer className={styles.dictionary1Container}> <PageContainer className={styles.dictionaryContainer}>
<Card> <Card>
<Tabs defaultActiveKey="1"> <Tabs defaultActiveKey="1">
<TabPane tab="通用数据字典" key="1"> <TabPane tab="通用数据字典" key="1">
...@@ -31,4 +31,4 @@ const dictionary1 = () => { ...@@ -31,4 +31,4 @@ const dictionary1 = () => {
); );
}; };
export default dictionary1; export default dictionary;
.dictionary1Container{ .dictionaryContainer {
.ant-card-body { .ant-card-body {
padding: 0px 24px 24px 17px; padding: 0px 24px 24px 17px;
} }
} }
\ No newline at end of file
/* eslint-disable indent */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification, message, Card } from 'antd';
import styles from '../dimensionsConfig.less'
import { import {
AddVectorData, Form,
publisService, GetProjectNames Modal,
} from '@/services/webConfig/api'; Input,
Select,
AutoComplete,
Button,
notification,
message,
Card,
Space,
} from 'antd';
import styles from '../dimensionsConfig.less';
import { AddVectorData, publisService, GetProjectNames } from '@/services/webConfig/api';
import { import {
PlusCircleOutlined, CloseCircleOutlined PlusCircleOutlined,
CloseCircleOutlined,
PlusOutlined,
MinusCircleOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible } = props; const { callBackSubmit = () => {}, type, formObj, visible } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [attributes, setAttributes] = useState([]) const [attributes, setAttributes] = useState([]);
const [workList, setWorkList] = useState([]); const [workList, setWorkList] = useState([]);
const [allData, setAllData] = useState([]); const [allData, setAllData] = useState([]);
const [gsIp, setGsIp] = useState([]); const [gsIp, setGsIp] = useState([]);
const [ports,setPorts]= useState(''); const [ports, setPorts] = useState('');
const [projectNmme, setProjectNmme] = useState([]); const [projectNmme, setProjectNmme] = useState([]);
const [loadingProject,setLoadingProject] =useState(false) const [loadingProject, setLoadingProject] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
const { Item } = Form; const { Item } = Form;
// 提交 // 提交
...@@ -29,22 +41,26 @@ const AddModal = props => { ...@@ -29,22 +41,26 @@ const AddModal = props => {
if (validate) { if (validate) {
setLoading(true); setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let attributesObj = {} let attributesObj = {};
attributes.map((item, index) => { attributes.map((item, index) => {
let key = obj[`key${index}`] let key = obj[`key${index}`];
attributesObj[`${key}`] = obj[`value${index}`] attributesObj[`${key}`] = obj[`value${index}`];
}) });
if (type === 'add') { if (type === 'add') {
let url =allData[obj.name].fileName?`http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}/${allData[obj.name].fileName}`:`http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}` let url = allData[obj.name].fileName
? `http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}/${
allData[obj.name].fileName
}`
: `http://${obj.ip}:${obj.port}/${obj.projectName}/${obj.name}`;
let query = { let query = {
type: obj.type, type: obj.type,
projectName: obj.projectName, projectName: obj.projectName,
name: obj.name, name: obj.name,
url, url,
attributes: attributesObj ||{}, attributes: attributesObj || {},
ip: obj.ip, ip: obj.ip,
port: obj.port port: obj.port,
} };
AddVectorData(query) AddVectorData(query)
.then(res => { .then(res => {
setLoading(false); setLoading(false);
...@@ -56,7 +72,7 @@ const AddModal = props => { ...@@ -56,7 +72,7 @@ const AddModal = props => {
duration: 3, duration: 3,
description: '新增成功', description: '新增成功',
}); });
handlelocalStorage('add', obj.ip, obj.projectName) handlelocalStorage('add', obj.ip, obj.projectName);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -78,9 +94,7 @@ const AddModal = props => { ...@@ -78,9 +94,7 @@ const AddModal = props => {
}); });
}; };
const onFinish = value => {};
const onFinish = value => { };
useEffect(() => { useEffect(() => {
switch (type) { switch (type) {
case 'add': case 'add':
...@@ -89,16 +103,16 @@ const AddModal = props => { ...@@ -89,16 +103,16 @@ const AddModal = props => {
if (localStorageData) { if (localStorageData) {
gsIp = localStorageData.map(item => ({ gsIp = localStorageData.map(item => ({
value: item.gsIp, value: item.gsIp,
item: item.gsIp item: item.gsIp,
})); }));
} }
setGsIp(gsIp) setGsIp(gsIp);
setAttributes([]) setAttributes([]);
setProjectNmme([]) setProjectNmme([]);
setWorkList([]) setWorkList([]);
setPorts('') setPorts('');
let localIps = ['192.168.12.97'] let localIps = ['192.168.12.97'];
let port = localIps.includes(gsIp) ? '8083' : '8088' let port = localIps.includes(gsIp) ? '8083' : '8088';
form.resetFields(); form.resetFields();
break; break;
case 'edit': case 'edit':
...@@ -112,7 +126,7 @@ const AddModal = props => { ...@@ -112,7 +126,7 @@ const AddModal = props => {
//存储到localstorage //存储到localstorage
const handlelocalStorage = (type, gsIp, gisAppName) => { const handlelocalStorage = (type, gsIp, gisAppName) => {
if (!localStorage) return null; if (!localStorage) return null;
let result = JSON.parse(localStorage.getItem('metaData')) let result = JSON.parse(localStorage.getItem('metaData'));
if (type == 'get') { if (type == 'get') {
return result; return result;
} }
...@@ -120,22 +134,24 @@ const AddModal = props => { ...@@ -120,22 +134,24 @@ const AddModal = props => {
if (!result) result = []; if (!result) result = [];
result.push({ result.push({
gsIp, gsIp,
gisAppName: [{ gisAppName: [
value: gisAppName, {
item: gisAppName value: gisAppName,
}] item: gisAppName,
}) },
localStorage.setItem('metaData', JSON.stringify(result)) ],
return });
localStorage.setItem('metaData', JSON.stringify(result));
return;
} }
let data = result.find(item => item.gsIp == gsIp) let data = result.find(item => item.gsIp == gsIp);
let isHasGisAppName = data.gisAppName.find(item => item.value == gisAppName); let isHasGisAppName = data.gisAppName.find(item => item.value == gisAppName);
if (isHasGisAppName) return; if (isHasGisAppName) return;
data.gisAppName.push({ data.gisAppName.push({
value: gisAppName, value: gisAppName,
item: gisAppName item: gisAppName,
}) });
localStorage.setItem('metaData', JSON.stringify(result)) localStorage.setItem('metaData', JSON.stringify(result));
}; };
const layout = { const layout = {
...@@ -144,92 +160,89 @@ const AddModal = props => { ...@@ -144,92 +160,89 @@ const AddModal = props => {
span: 4, span: 4,
}, },
wrapperCol: { wrapperCol: {
span: 16, span: 17,
}, },
}; };
const selectIp = (value) => { const selectIp = value => {
let localIps = ['192.168.12.97'] let localIps = ['192.168.12.97'];
let port = localIps.includes(value) ? '8083' : '8088' let port = localIps.includes(value) ? '8083' : '8088';
form.setFieldsValue({ port, serviceadress: value }); form.setFieldsValue({ port, serviceadress: value });
setPorts(port) setPorts(port);
};
}
// 获取项目名 // 获取项目名
const getProject = () => { const getProject = () => {
const obj = form.getFieldsValue(); const obj = form.getFieldsValue();
if (obj.ip && obj.port) { if (obj.ip && obj.port) {
setLoadingProject(true) setLoadingProject(true);
GetProjectNames({ ip: obj.ip, port: obj.port }).then(res => { GetProjectNames({ ip: obj.ip, port: obj.port })
setLoadingProject(false) .then(res => {
if (res.msg === 'Ok') { setLoadingProject(false);
if(res.data=='{}'){ if (res.msg === 'Ok') {
notification.info({ if (res.data == '{}') {
message: '提示', notification.info({
duration: 3, message: '提示',
description: '该地址下项目为空', duration: 3,
}); description: '该地址下项目为空',
} });
else{ } else {
notification.success({ notification.success({
message: '提示',
duration: 3,
description: '获取成功',
});
let data = Object.values(JSON.parse(res.data));
setProjectNmme(data);
if (data.length) {
form.setFieldsValue({ projectName: data[0] });
selectProject(data[0]);
}
}
} else {
notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '获取成功', description: '获取失败',
}); });
let data = Object.values(JSON.parse(res.data))
setProjectNmme(data)
if (data.length) {
form.setFieldsValue({ projectName: data[0] });
selectProject(data[0])
}
} }
})
} else { .catch(e => {
notification.error({ console.log('e', e);
message: '提示', });
duration: 3,
description: '获取失败',
});
}
}).catch(e => {
console.log('e', e);
})
} else { } else {
message.warning("未输入ip或port") message.warning('未输入ip或port');
} }
} };
const selectProject = (value) => { const selectProject = value => {
const obj = form.getFieldsValue(); const obj = form.getFieldsValue();
GetProjectNames({ ip: obj.ip, port: obj.port, projectname: value }).then(response => { GetProjectNames({ ip: obj.ip, port: obj.port, projectname: value }).then(response => {
let newArr = JSON.parse(response.data) let newArr = JSON.parse(response.data);
let workArr = Object.keys(newArr.data) let workArr = Object.keys(newArr.data);
console.log('newArr',newArr); console.log('newArr', newArr);
console.log('workArr',workArr); console.log('workArr', workArr);
setAllData(newArr.data) setAllData(newArr.data);
if (workArr.length) { if (workArr.length) {
setWorkList(workArr) setWorkList(workArr);
form.setFieldsValue({ name: workArr[0], type: newArr.data[workArr[0]].type }); form.setFieldsValue({ name: workArr[0], type: newArr.data[workArr[0]].type });
} }
});
}) };
} const selectName = value => {
const selectName = (value) => {
form.setFieldsValue({ type: allData[value].type }); form.setFieldsValue({ type: allData[value].type });
} };
const addExtra = () => { const addExtra = () => {
let attributesArr = [...attributes] let attributesArr = [...attributes];
attributesArr.push({}) attributesArr.push({});
setAttributes(attributesArr) setAttributes(attributesArr);
} };
const deleteExtr = (index) => { const deleteExtr = index => {
let attributesArr = [...attributes] let attributesArr = [...attributes];
attributesArr.splice(index, 1); attributesArr.splice(index, 1);
setAttributes(attributesArr) setAttributes(attributesArr);
} };
const inputPort =(e)=>{ const inputPort = e => {
setPorts(e.target.value) setPorts(e.target.value);
} };
return ( return (
<Modal <Modal
title={`${type === 'add' ? '元数据发布' : '编辑'}`} title={`${type === 'add' ? '元数据发布' : '编辑'}`}
...@@ -247,27 +260,18 @@ const AddModal = props => { ...@@ -247,27 +260,18 @@ const AddModal = props => {
getContainer={false} getContainer={false}
> >
{visible && ( {visible && (
<Form form={form} {...layout} onFinish={onFinish}> <Form form={form} {...layout} onFinish={onFinish} style={{ marginBottom: '20px' }}>
<Item <Item label="IP" name="ip" rules={[{ required: true, message: '请选择ip地址' }]}>
label="IP" <AutoComplete placeholder="请输入IP" options={gsIp} onSelect={selectIp} />
name="ip"
rules={[{ required: true, message: '请选择ip地址' }]}
>
<AutoComplete
placeholder="请输入IP"
options={gsIp}
onSelect={selectIp}
/>
</Item> </Item>
<Item <Item label="端口" name="port" rules={[{ required: true, message: '请输入端口' }]}>
label="端口"
name="port"
rules={[{ required: true, message: '请输入端口' }]}
>
<div className={styles.imgList}> <div className={styles.imgList}>
<Input placeholder="请输入GIS服务器端口" allowClear value={ports} onChange={inputPort} /> <Input
<Button style={{ marginLeft: '0.5rem' }} onClick={getProject} loading={loadingProject}>获取项目名</Button> placeholder="请输入GIS服务器端口"
allowClear
value={ports}
onChange={inputPort}
/>
</div> </div>
</Item> </Item>
<Item <Item
...@@ -275,9 +279,20 @@ const AddModal = props => { ...@@ -275,9 +279,20 @@ const AddModal = props => {
name="projectName" name="projectName"
rules={[{ required: true, message: '请选择项目名' }]} rules={[{ required: true, message: '请选择项目名' }]}
> >
<Select onChange={selectProject}> <Select onChange={selectProject} style={{ width: '351px' }}>
{projectNmme.length ? projectNmme.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} {projectNmme.length
? projectNmme.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select> </Select>
<Button style={{ marginLeft: '0.5rem' }} onClick={getProject} loading={loadingProject}>
获取项目名
</Button>
</Item> </Item>
<Item <Item
label="数据源名" label="数据源名"
...@@ -285,7 +300,15 @@ const AddModal = props => { ...@@ -285,7 +300,15 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择数据源名' }]} rules={[{ required: true, message: '请选择数据源名' }]}
> >
<Select onChange={selectName}> <Select onChange={selectName}>
{workList.length ? workList.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} {workList.length
? workList.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select> </Select>
</Item> </Item>
<Item <Item
...@@ -295,34 +318,56 @@ const AddModal = props => { ...@@ -295,34 +318,56 @@ const AddModal = props => {
> >
<Input placeholder="请输入数据类型" allowClear disabled /> <Input placeholder="请输入数据类型" allowClear disabled />
</Item> </Item>
<Button size="small" onClick={() => { addExtra() }}> <Button
size="small"
style={{ width: '71%', marginLeft: '109px', lineHeight: '32px', height: '32px' }}
onClick={() => {
addExtra();
}}
>
新增额外属性 新增额外属性
</Button> </Button>
<div style={{ maxHeight: '14rem', overflowY: 'scroll', marginTop: '0.2rem' }}> <div
{attributes.length ? attributes.map((item, index) => { style={{
return <div key={index} className={styles.containerFileds}> maxHeight: '14rem',
<Item overflowY: 'scroll',
label="键" marginTop: '0.2rem',
name={`key${index}`} marginLeft: '66px',
style={{ width: '45%', marginTop: '24px' }} width: '88%',
> }}
<Input placeholder="" allowClear /> >
</Item> {attributes.length
<Item ? attributes.map((item, index) => {
label="值" return (
name={`value${index}`} <div key={index} className={styles.containerFileds}>
style={{ width: '45%', marginTop: '24px' }} <Item
> label="键"
<Input placeholder="" allowClear /> name={`key${index}`}
</Item> style={{ width: '100%', marginTop: '24px' }}
<CloseCircleOutlined >
onClick={() => { deleteExtr(index) }} <Input placeholder="" allowClear />
style={{ </Item>
fontSize: '16px', color: 'red', <Item
cursor: 'pointer' label="值"
}} /> name={`value${index}`}
</div> style={{ width: '100%', marginTop: '24px' }}
}) : ''} >
<Input placeholder="" allowClear />
</Item>
<CloseCircleOutlined
onClick={() => {
deleteExtr(index);
}}
style={{
fontSize: '16px',
color: 'red',
cursor: 'pointer',
}}
/>
</div>
);
})
: ''}
</div> </div>
</Form> </Form>
)} )}
......
import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../dimensionsConfig.less' import styles from '../dimensionsConfig.less';
import { import { GetVectorDataList, DeleteVectorData, RefreshVectorData } from '@/services/webConfig/api';
GetVectorDataList,DeleteVectorData,RefreshVectorData import AddModal from './AddModal';
} from '@/services/webConfig/api';
import AddModal from './AddModal'
// import PreviewModal from './VectorPreviewModal' // import PreviewModal from './VectorPreviewModal'
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据 const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [flag, setFlag] = useState(0); // 更新list const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态 const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' }); const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const columns = [ const columns = [
{ {
title: '项目名', title: '项目名',
dataIndex: 'projectName', dataIndex: 'projectName',
key: 'projectName', key: 'projectName',
align: 'center' align: 'center',
}, },
{ {
title: 'IP', title: 'IP',
dataIndex: 'ip', dataIndex: 'ip',
key: 'ip', key: 'ip',
align: 'center' align: 'center',
}, },
{ {
title: '端口', title: '端口',
dataIndex: 'port', dataIndex: 'port',
key: 'port', key: 'port',
align: 'center' align: 'center',
}, },
{ {
title: '数据源名', title: '数据源名',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
align: 'center' align: 'center',
}, },
{ {
title: '类型', title: '类型',
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
align: 'center' align: 'center',
}, },
{ {
title: '发布时间', title: '发布时间',
dataIndex: 'publishDatetime', dataIndex: 'publishDatetime',
key: 'publishDatetime', key: 'publishDatetime',
align: 'center' align: 'center',
}, },
{ {
title: '编辑', title: '编辑',
align: 'center', align: 'center',
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<Button
<Button type="primary" size="small" loading={loading[index]} onClick={() => enterLoading(record, index)}> type="primary"
更新 size="small"
</Button> loading={loading[index]}
<div onClick={e => e.stopPropagation()}> onClick={() => enterLoading(record, index)}
<Popconfirm >
title="是否删除该矢量数据?" 更新
okText="确认" </Button>
cancelText="取消" <div onClick={e => e.stopPropagation()}>
onConfirm={() => { <Popconfirm
delConfirm(record); title="是否删除该矢量数据?"
}} okText="确认"
> cancelText="取消"
<Button size="small" danger> onConfirm={() => {
删除 delConfirm(record);
</Button> }}
</Popconfirm> >
</div> <Button size="small" danger>
</Space> 删除
), </Button>
}, </Popconfirm>
</div>
</Space>
),
},
];
// 更新
const enterLoading = (record, index) => {
const newLoadings = [...loading];
newLoadings[index] = true;
setLoading(newLoadings);
let query = {
id: record.id,
};
]; RefreshVectorData(query)
//更新 .then(res => {
const enterLoading = (record, index) => {
const newLoadings = [...loading]; const newLoadings = [...loading];
newLoadings[index] = true newLoadings[index] = false;
setLoading(newLoadings) setLoading(newLoadings);
let query = { if (res.msg === '') {
id: record.id, setFlag(flag + 1);
notification.success({
message: '提示',
duration: 3,
description: '更新元数据成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
} }
})
.catch(err => {
const newLoadings = [...loading];
newLoadings[index] = false;
setLoading(newLoadings);
notification.error({
message: '提示',
duration: 3,
description: '服务无法访问',
});
});
};
RefreshVectorData(query).then(res => { const onSubmit = prop => {
const newLoadings = [...loading]; setVisible(false);
newLoadings[index] = false setFlag(flag + 1);
setLoading(newLoadings) };
if (res.msg==='') { const delConfirm = record => {
setFlag(flag + 1) DeleteVectorData(record.id).then(res => {
notification.success({ if (res.msg === '') {
message: '提示', setFlag(flag + 1);
duration: 3, notification.success({
description: '更新元数据成功', message: '提示',
}); duration: 3,
} else { description: '删除元数据成功',
notification.error({ });
message: '提示', } else {
duration: 3, notification.error({
description: res.msg, message: '提示',
}); duration: 3,
}; description: '删除元数据失败',
}).catch(err => { });
const newLoadings = [...loading]; }
newLoadings[index] = false });
setLoading(newLoadings) };
notification.error({ const handleAdd = () => {
message: '提示', setType('add');
duration: 3, setVisible(true);
description: '服务无法访问', };
}); useEffect(() => {
}) renderTile();
}, [flag]);
} // 获取瓦片数据配置数据
const renderTile = () => {
setTreeLoading(true);
GetVectorDataList().then(res => {
const onSubmit = prop => { if (res.msg === 'Ok') {
setVisible(false); let arr = [];
setFlag(flag + 1) res.data.map(item => {
}; arr.push(false);
const delConfirm = (record) => { });
DeleteVectorData(record.id).then(res => { setLoading(arr);
if (res.msg==='') { setTreeLoading(false);
setFlag(flag + 1) setTileData(res.data);
notification.success({ } else {
message: '提示', setTreeLoading(false);
duration: 3, notification.error({
description: '删除元数据成功', message: '获取失败',
}); description: res.message,
} else { });
notification.error({ }
message: '提示', });
duration: 3, };
description: '删除元数据失败',
});
};
})
}
const handleAdd = () => {
setType('add');
setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取瓦片数据配置数据
const renderTile = () => {
setTreeLoading(true);
GetVectorDataList().then(
res => {
if (res.msg === 'Ok') {
let arr = []
res.data.map(item => {
arr.push(false)
})
setLoading(arr)
setTreeLoading(false);
setTileData(res.data);
} else {
setTreeLoading(false);
notification.error({
message: '获取失败',
description: res.message,
});
}
}
)
};
return (
<>
<Spin tip="loading..." spinning={treeLoading}>
<div className={styles.tileBtn}>
<Button type="primary" onClick={() => {
handleAdd();
}} >
新增
</Button>
</div>
<Table
columns={columns}
dataSource={tileData}
bordered
rowKey='id'
scroll={{ y: 400 }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
/>
</Spin> return (
</> <>
) <Spin tip="loading..." spinning={treeLoading}>
} <div className={styles.tileBtn}>
export default VectorData <Button
\ No newline at end of file type="primary"
onClick={() => {
handleAdd();
}}
>
新增
</Button>
</div>
<Table
columns={columns}
dataSource={tileData}
bordered
rowKey="id"
scroll={{ y: 400 }}
pagination={{
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
}}
/>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
/>
</Spin>
</>
);
};
export default VectorData;
import { Tabs, Button } from 'antd'; import { Tabs, Button } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import styles from './dimensionsConfig.less' import styles from './dimensionsConfig.less';
import TileConfig from './TileConfig/TileConfig'; import TileConfig from './TileConfig/TileConfig';
import VectorData from './VectorData/VectorData'; import VectorData from './VectorData/VectorData';
import ProjectMessage from './projectMessage/projectMessage'; import ProjectMessage from './projectMessage/projectMessage';
...@@ -10,32 +10,30 @@ import SolutionConfig from './solutionConfig/solutionConfig'; ...@@ -10,32 +10,30 @@ import SolutionConfig from './solutionConfig/solutionConfig';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const SchemeConfig = () => { const SchemeConfig = () => {
const [activekey,setActiveKey] =useState('1') const [activekey, setActiveKey] = useState('1');
const callback = (index) => { const callback = index => {
setActiveKey(index) setActiveKey(index);
} };
return ( return (
<PageContainer> <PageContainer>
<div className={styles.container3d} activekey={activekey}> <div className={styles.container3d} activekey={activekey}>
<Tabs onChange={callback} type="card"> <Tabs onChange={callback} type="card">
<TabPane tab="瓦片数据配置" key="1"> <TabPane tab="瓦片数据配置" key="1">
{activekey==='1'?<TileConfig />:''} {activekey === '1' ? <TileConfig /> : ''}
</TabPane> </TabPane>
<TabPane tab="数据源配置" key="2"> <TabPane tab="数据源配置" key="2">
{activekey==='2'?<VectorData />:''} {activekey === '2' ? <VectorData /> : ''}
</TabPane> </TabPane>
<TabPane tab="方案管理" key="3"> <TabPane tab="方案管理" key="3">
{activekey==='3'?<ProjectMessage />:''} {activekey === '3' ? <ProjectMessage /> : ''}
</TabPane> </TabPane>
<TabPane tab="方案配置" key="4"> <TabPane tab="方案配置" key="4">
{activekey==='4'?<SolutionConfig />:''} {activekey === '4' ? <SolutionConfig /> : ''}
</TabPane> </TabPane>
</Tabs> </Tabs>
</div> </div>
</PageContainer>
</PageContainer> );
) };
export default SchemeConfig;
}
export default SchemeConfig;
\ No newline at end of file
.container3d{ .container3d {
width: 100%; width: 100%;
background-color: #ffffff;
display: flex;
.ant-table {
min-height: 15rem !important;
}
padding: 0.8rem;
.ant-table-thead tr th {
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
}
overflow-y: scroll;
.ant-input-number-input {
background-color: #ffffff; background-color: #ffffff;
display: flex; color: #000000;
.ant-table { }
min-height: 15rem !important; .ant-card-body {
} padding: 12px 24px 24px 25px;
padding: 0.8rem; }
.ant-table-thead tr th { }
font-weight: 600; .imgList {
color: rgba(0, 0, 0, 0.85); display: flex;
} flex-wrap: wrap;
overflow-y: scroll; }
.ant-input-number-input{ .imgItem {
background-color: #ffffff; display: flex;
color: #000000; flex-direction: column;
} align-items: center;
.ant-card-body { margin: 0 1rem 1rem 0;
padding: 12px 24px 24px 25px; }
} .tileBtn {
} display: flex;
.imgList{ justify-content: flex-end;
display: flex; width: 100%;
flex-wrap: wrap; padding: 0 0 2rem;
} }
.imgItem{ .schemeName {
display: flex; margin-right: 0.8rem;
flex-direction: column; font-weight: bold;
align-items: center;
margin:0 1rem 1rem 0;
}
.tileBtn{
display: flex;
justify-content: flex-end;
width: 100%;
padding: 0 0 2rem
}
.schemeName{
margin-right: 0.8rem;
font-weight: bold;
} }
.schemeItem,.schemeBtn{ .schemeItem,
display: flex; .schemeBtn {
align-items: center; display: flex;
} align-items: center;
.schemeBtn{
width: 12rem;
justify-content: center;
}
.mapItem{
display: flex;
border: 1px solid #ccc;
border-radius: 4px;
height: 2.2rem;
align-items: center;
margin: 0.5rem 0;
width: 14.5rem;
}
.defaultTile{
background: #ccc;
color: white;
cursor: pointer;
height: 100%;
display: flex;
align-items: center;
width: 3rem;
justify-content: center;
} }
.mapText{ .schemeBtn {
width: 10rem; width: 12rem;
text-align: center; justify-content: center;
} }
.mapIcon{ .mapItem {
display: flex; display: flex;
justify-content: center; border: 1px solid #ccc;
align-items: center; border-radius: 4px;
cursor: pointer; height: 2.2rem;
align-items: center;
margin: 0.5rem 0;
width: 14.5rem;
} }
.activeTile{ .defaultTile {
background-color: #4699f4 background: #ccc;
color: white;
cursor: pointer;
height: 100%;
display: flex;
align-items: center;
width: 3rem;
justify-content: center;
}
.mapText {
width: 10rem;
text-align: center;
}
.mapIcon {
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.activeTile {
background-color: #4699f4;
} }
.dropList { .dropList {
position: absolute; position: absolute;
right: 2%; right: 2%;
top: 25%; top: 25%;
color: rgba(0, 0, 0, 0.25); color: rgba(0, 0, 0, 0.25);
z-index: 99; z-index: 99;
}
.divider{
display: flex;
align-items: center;
line-height: 100%;
padding: 0.5rem;
.dividerIcon{
margin-left: 0.8rem;
color: #4699f4;
cursor: pointer;
}
} }
.divider {
.cardsList{ display: flex;
display: flex; align-items: center;
flex-wrap: wrap; line-height: 100%;
} padding: 0.5rem;
.cardItem{ .dividerIcon {
width: 18rem; margin-left: 0.8rem;
height: 26rem; color: #4699f4;
margin: 0 2rem; cursor: pointer;
} }
.containerFileds{ }
display: flex;
justify-content: space-between; .cardsList {
width: 98%; display: flex;
border:1px solid #f0f0f0; flex-wrap: wrap;
margin-top: 1rem; }
} .cardItem {
\ No newline at end of file width: 18rem;
height: 26rem;
margin: 0 2rem;
}
.containerFileds {
display: flex;
justify-content: space-between;
width: 98%;
border: 1px solid #f0f0f0;
margin-top: 0.5rem;
}
import { Tabs, Button } from 'antd'; import { Tabs, Button } from 'antd';
import React from 'react'; import React from 'react';
import PageContainer from '@/components/BasePageContainer'; import PageContainer from '@/components/BasePageContainer';
import styles from './SchemeConfig.less' import styles from './SchemeConfig.less';
import TileConfig from './TileConfig/TileConfig'; import TileConfig from './TileConfig/TileConfig';
import VectorData from './VectorData/VectorData'; import VectorData from './VectorData/VectorData';
import ProjectMessage from './projectMessage/projectMessage'; import ProjectMessage from './projectMessage/projectMessage';
...@@ -10,32 +10,27 @@ import SolutionConfig from './solutionConfig/solutionConfig'; ...@@ -10,32 +10,27 @@ import SolutionConfig from './solutionConfig/solutionConfig';
const { TabPane } = Tabs; const { TabPane } = Tabs;
const SchemeConfig = () => { const SchemeConfig = () => {
const callback = () => {};
const callback = () => { return (
<PageContainer>
} <div className={styles.container}>
<Tabs onChange={callback} type="card">
return ( <TabPane tab="瓦片数据配置" key="1">
<PageContainer> <TileConfig />
<div className={styles.container}> </TabPane>
<Tabs onChange={callback} type="card"> <TabPane tab="矢量数据配置" key="2">
<TabPane tab="瓦片数据配置" key="1"> <VectorData />
<TileConfig /> </TabPane>
</TabPane> <TabPane tab="方案管理" key="3">
<TabPane tab="矢量数据配置" key="2"> <ProjectMessage />
<VectorData /> </TabPane>
</TabPane> <TabPane tab="方案配置" key="4">
<TabPane tab="方案管理" key="3"> <SolutionConfig />
<ProjectMessage /> </TabPane>
</TabPane> </Tabs>
<TabPane tab="方案配置" key="4"> </div>
<SolutionConfig/> </PageContainer>
</TabPane> );
</Tabs> };
</div> export default SchemeConfig;
</PageContainer>
)
}
export default SchemeConfig;
\ No newline at end of file
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd'; import { Form, Modal, Input, Select, AutoComplete, Button, notification } from 'antd';
import styles from '../SchemeConfig.less' import styles from '../SchemeConfig.less';
import {
GetGISServerMapList,
publisService
} from '@/services/webConfig/api';
import { GetGISServerMapList, publisService } from '@/services/webConfig/api';
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible,solutionNames } = props; const { callBackSubmit = () => {}, type, formObj, visible, solutionNames } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [workSpace, setWorkSpace] = useState(''); const [workSpace, setWorkSpace] = useState('');
const [serviceName, setServicename] = useState([{ const [serviceName, setServicename] = useState([
value: 'geoserver', {
item: 'geoserver' value: 'geoserver',
}]); item: 'geoserver',
},
]);
const [workList, setWorkList] = useState([]); const [workList, setWorkList] = useState([]);
const [gsIp, setGsIp] = useState([]); const [gsIp, setGsIp] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
...@@ -28,18 +26,18 @@ const AddModal = props => { ...@@ -28,18 +26,18 @@ const AddModal = props => {
setLoading(true); setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
if (type === 'add') { if (type === 'add') {
let query = { let query = {
_version: 9999, _version: 9999,
gsIP: obj.serviceadress, gsIP: obj.serviceadress,
gsPort: obj.port, gsPort: obj.port,
gsAppName: obj.servicename, gsAppName: obj.servicename,
gsUser: obj.user, gsUser: obj.user,
gsWorkspaceName: obj.workname, gsWorkspaceName: obj.workname,
gsPwd: obj.password, gsPwd: obj.password,
serviceName: obj.name, serviceName: obj.name,
solution: solutionNames, solution: solutionNames,
} };
publisService(query,{timeout:120000}) publisService(query, { timeout: 120000 })
.then(res => { .then(res => {
setLoading(false); setLoading(false);
if (res.success) { if (res.success) {
...@@ -48,15 +46,15 @@ const AddModal = props => { ...@@ -48,15 +46,15 @@ const AddModal = props => {
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '新增成功', description: '新增成功',
}); });
setWorkList([]) setWorkList([]);
handlelocalStorage('add',obj.serviceadress, obj.servicename) handlelocalStorage('add', obj.serviceadress, obj.servicename);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '新增失败', description: '新增失败',
}); });
} }
}) })
...@@ -64,7 +62,7 @@ const AddModal = props => { ...@@ -64,7 +62,7 @@ const AddModal = props => {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '新增失败', description: '新增失败',
}); });
setLoading(false); setLoading(false);
}); });
...@@ -73,9 +71,7 @@ const AddModal = props => { ...@@ -73,9 +71,7 @@ const AddModal = props => {
}); });
}; };
const onFinish = value => {};
const onFinish = value => { };
useEffect(() => { useEffect(() => {
switch (type) { switch (type) {
case 'add': case 'add':
...@@ -84,12 +80,12 @@ const AddModal = props => { ...@@ -84,12 +80,12 @@ const AddModal = props => {
if (localStorageData) { if (localStorageData) {
gsIp = localStorageData.map(item => ({ gsIp = localStorageData.map(item => ({
value: item.gsIp, value: item.gsIp,
item: item.gsIp item: item.gsIp,
})); }));
} }
setGsIp(gsIp) setGsIp(gsIp);
let localIps = ['192.168.12.7', '192.168.19.100'] let localIps = ['192.168.12.7', '192.168.19.100'];
let port = localIps.includes(gsIp) ? 8080 : 8088 let port = localIps.includes(gsIp) ? 8080 : 8088;
form.setFieldsValue({ servicename: serviceName[0].value, port, ...formObj }); form.setFieldsValue({ servicename: serviceName[0].value, port, ...formObj });
break; break;
case 'edit': case 'edit':
...@@ -103,7 +99,7 @@ const AddModal = props => { ...@@ -103,7 +99,7 @@ const AddModal = props => {
//存储到localstorage //存储到localstorage
const handlelocalStorage = (type, gsIp, gisAppName) => { const handlelocalStorage = (type, gsIp, gisAppName) => {
if (!localStorage) return null; if (!localStorage) return null;
let result = JSON.parse(localStorage.getItem('metaData')) let result = JSON.parse(localStorage.getItem('metaData'));
if (type == 'get') { if (type == 'get') {
return result; return result;
} }
...@@ -111,22 +107,24 @@ const AddModal = props => { ...@@ -111,22 +107,24 @@ const AddModal = props => {
if (!result) result = []; if (!result) result = [];
result.push({ result.push({
gsIp, gsIp,
gisAppName: [{ gisAppName: [
value: gisAppName, {
item: gisAppName value: gisAppName,
}] item: gisAppName,
}) },
localStorage.setItem('metaData', JSON.stringify(result)) ],
return });
localStorage.setItem('metaData', JSON.stringify(result));
return;
} }
let data = result.find(item => item.gsIp == gsIp) let data = result.find(item => item.gsIp == gsIp);
let isHasGisAppName = data.gisAppName.find(item => item.value == gisAppName); let isHasGisAppName = data.gisAppName.find(item => item.value == gisAppName);
if (isHasGisAppName) return; if (isHasGisAppName) return;
data.gisAppName.push({ data.gisAppName.push({
value: gisAppName, value: gisAppName,
item: gisAppName item: gisAppName,
}) });
localStorage.setItem('metaData', JSON.stringify(result)) localStorage.setItem('metaData', JSON.stringify(result));
}; };
const layout = { const layout = {
...@@ -139,55 +137,52 @@ const AddModal = props => { ...@@ -139,55 +137,52 @@ const AddModal = props => {
}, },
}; };
//选择工作空间 //选择工作空间
const selectWorkspace = () => { const selectWorkspace = () => {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
form.validateFields(['serviceadress', 'port', 'servicename', 'user', 'password']).then(validate => { form
if (validate) { .validateFields(['serviceadress', 'port', 'servicename', 'user', 'password'])
let query = { .then(validate => {
GISServerIP: obj.serviceadress, if (validate) {
GISServerPort: obj.port, let query = {
gsAppName: obj.servicename, GISServerIP: obj.serviceadress,
gsUser: obj.user, GISServerPort: obj.port,
gsPwd: obj.password, gsAppName: obj.servicename,
isGeoServer: true, gsUser: obj.user,
_version: 9999, gsPwd: obj.password,
isGeoServer: true,
_version: 9999,
};
GetGISServerMapList(query).then(res => {
if (Array.isArray(res.data)) {
const defaultValue = res.data[0] || '';
form.setFieldsValue({ name: defaultValue, workname: defaultValue });
setWorkList(res.data);
setWorkSpace(defaultValue);
} else {
notification.error({
message: '提示',
duration: 3,
description: '获取工作空间失败',
});
}
});
} }
GetGISServerMapList(query).then(res => { });
if (Array.isArray(res.data)) {
const defaultValue= res.data[0]||''
form.setFieldsValue({ name:defaultValue,workname:defaultValue});
setWorkList(res.data)
setWorkSpace(defaultValue)
}
else {
notification.error({
message: '提示',
duration: 3,
description: '获取工作空间失败',
});
}
})
}
})
}; };
//选择工作空间 //选择工作空间
const handleWorkspace = (value) => { const handleWorkspace = value => {
form.setFieldsValue({ form.setFieldsValue({
workname: value, workname: value,
name:value name: value,
}) });
setWorkSpace(value) setWorkSpace(value);
} };
const selectIp = (value)=>{ const selectIp = value => {
let localIps = ['192.168.12.7', '192.168.19.100'] let localIps = ['192.168.12.7', '192.168.19.100'];
let port = localIps.includes(value) ? 8080 : 8088 let port = localIps.includes(value) ? 8080 : 8088;
form.setFieldsValue({ port,serviceadress:value }); form.setFieldsValue({ port, serviceadress: value });
};
}
return ( return (
<Modal <Modal
title={`${type === 'add' ? '元数据发布' : '编辑'}`} title={`${type === 'add' ? '元数据发布' : '编辑'}`}
...@@ -211,11 +206,7 @@ const AddModal = props => { ...@@ -211,11 +206,7 @@ const AddModal = props => {
name="serviceadress" name="serviceadress"
rules={[{ required: true, message: '请选择服务名' }]} rules={[{ required: true, message: '请选择服务名' }]}
> >
<AutoComplete <AutoComplete placeholder="请输入GIS服务器地址" options={gsIp} onSelect={selectIp} />
placeholder="请输入GIS服务器地址"
options={gsIp}
onSelect={selectIp}
/>
</Item> </Item>
<Item <Item
label="GIS服务器端口" label="GIS服务器端口"
...@@ -230,10 +221,7 @@ const AddModal = props => { ...@@ -230,10 +221,7 @@ const AddModal = props => {
name="servicename" name="servicename"
rules={[{ required: true, message: '请输入GIS服务器名' }]} rules={[{ required: true, message: '请输入GIS服务器名' }]}
> >
<AutoComplete <AutoComplete placeholder="Email" options={serviceName} />
placeholder="Email"
options={serviceName}
/>
</Item> </Item>
<Item <Item
label="用户名称" label="用户名称"
...@@ -255,10 +243,25 @@ const AddModal = props => { ...@@ -255,10 +243,25 @@ const AddModal = props => {
rules={[{ required: true, message: '请选择工作空间名称' }]} rules={[{ required: true, message: '请选择工作空间名称' }]}
> >
<div className={styles.imgList}> <div className={styles.imgList}>
<Select onChange={handleWorkspace} value ={workSpace}> <Select onChange={handleWorkspace} value={workSpace} style={{ width: '310px' }}>
{workList.length ? workList.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''} {workList.length
? workList.map((item, index) => {
return (
<Option key={index} value={item}>
{item}
</Option>
);
})
: ''}
</Select> </Select>
<Button style={{ marginLeft: '0.5rem' }} onClick={() => { selectWorkspace() }}>选择工作空间</Button> <Button
style={{ marginLeft: '0.5rem' }}
onClick={() => {
selectWorkspace();
}}
>
选择工作空间
</Button>
</div> </div>
</Item> </Item>
<Item <Item
......
import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../SchemeConfig.less' import styles from '../SchemeConfig.less';
import { import {
GetVectorService, deleteVectorService, getSolutionList, updatePublishedMetaData GetVectorService,
deleteVectorService,
getSolutionList,
updatePublishedMetaData,
} from '@/services/webConfig/api'; } from '@/services/webConfig/api';
import AddModal from './AddModal' import AddModal from './AddModal';
import PreviewModal from './VectorPreviewModal' import PreviewModal from './VectorPreviewModal';
const VectorData = props => { const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据 const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [previewVisible, setPreviewVisible] = useState(false); // 预览弹窗 const [previewVisible, setPreviewVisible] = useState(false); // 预览弹窗
const [flag, setFlag] = useState(0); // 更新list const [flag, setFlag] = useState(0); // 更新list
const [loading, setLoading] = useState([]); // 更新状态 const [loading, setLoading] = useState([]); // 更新状态
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [solutionNames, setSolutionNames] = useState(''); const [solutionNames, setSolutionNames] = useState('');
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' }); const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [currentMetaData, setCurrentMetaData] = useState(null) const [currentMetaData, setCurrentMetaData] = useState(null);
const columns = [ const columns = [
{ {
title: '服务名', title: '服务名',
dataIndex: 'ServiceName', dataIndex: 'ServiceName',
key: 'ServiceName', key: 'ServiceName',
align: 'center' align: 'center',
}, },
{ {
title: 'IP', title: 'IP',
dataIndex: 'GISServerIP', dataIndex: 'GISServerIP',
key: 'GISServerIP', key: 'GISServerIP',
align: 'center' align: 'center',
}, },
{ {
title: '端口', title: '端口',
dataIndex: 'GISServerPort', dataIndex: 'GISServerPort',
key: 'GISServerPort', key: 'GISServerPort',
align: 'center' align: 'center',
}, },
{ {
title: '工程名', title: '工程名',
dataIndex: 'GISServerProjectName', dataIndex: 'GISServerProjectName',
key: 'GISServerProjectName', key: 'GISServerProjectName',
align: 'center' align: 'center',
}, },
{ {
title: '发布时间', title: '发布时间',
dataIndex: 'publishTime', dataIndex: 'publishTime',
key: 'publishTime', key: 'publishTime',
align: 'center' align: 'center',
}, },
{ {
title: '编辑', title: '编辑',
align: 'center', align: 'center',
render: (text, record, index) => ( render: (text, record, index) => (
<Space> <Space>
<Button type="primary" size="small" onClick={() => previewMetaData(record, index)}> <Button type="primary" size="small" onClick={() => previewMetaData(record, index)}>
预览 预览
</Button> </Button>
<Button type="primary" size="small" loading={loading[index]} onClick={() => enterLoading(record, index)}> <Button
更新 type="primary"
</Button> size="small"
<div onClick={e => e.stopPropagation()}> loading={loading[index]}
<Popconfirm onClick={() => enterLoading(record, index)}
title="是否删除该矢量数据?" >
okText="确认" 更新
cancelText="取消" </Button>
onConfirm={() => { <div onClick={e => e.stopPropagation()}>
delConfirm(record); <Popconfirm
}} title="是否删除该矢量数据?"
> okText="确认"
<Button size="small" danger> cancelText="取消"
删除 onConfirm={() => {
</Button> delConfirm(record);
</Popconfirm> }}
</div> >
</Space> <Button size="small" danger>
), 删除
}, </Button>
</Popconfirm>
</div>
</Space>
),
},
];
//更新
const enterLoading = (record, index) => {
const newLoadings = [...loading];
newLoadings[index] = true;
setLoading(newLoadings);
let query = {
serviceName: record.ServiceName,
_version: 9999,
solution: solutionNames,
};
]; updatePublishedMetaData(query)
//更新 .then(res => {
const enterLoading = (record, index) => {
const newLoadings = [...loading]; const newLoadings = [...loading];
newLoadings[index] = true newLoadings[index] = false;
setLoading(newLoadings) setLoading(newLoadings);
let query = { if (res.success) {
serviceName: record.ServiceName, setFlag(flag + 1);
_version: 9999, notification.success({
solution: solutionNames message: '提示',
duration: 3,
description: '更新元数据成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: '更新元数据失败',
});
} }
})
.catch(err => {
const newLoadings = [...loading];
newLoadings[index] = false;
setLoading(newLoadings);
notification.error({
message: '提示',
duration: 3,
description: '服务无法访问',
});
});
};
const previewMetaData = record => {
setCurrentMetaData(record);
setPreviewVisible(true);
};
updatePublishedMetaData(query).then(res => { const solutionName = () => {
const newLoadings = [...loading]; getSolutionList({
newLoadings[index] = false _version: 9999,
setLoading(newLoadings) }).then(res => {
if (res.success) { setSolutionNames(res.currentSolution);
setFlag(flag + 1) });
notification.success({ };
message: '提示', const onSubmit = prop => {
duration: 3, setVisible(false);
description: '更新元数据成功', setFlag(flag + 1);
}); };
} else { const delConfirm = record => {
notification.error({ console.log(' record.ServiceName', record.ServiceName.split('.'));
message: '提示', let query = {
duration: 3, serviceName: record.ServiceName.split('.')[0],
description: '更新元数据失败', _version: 9999,
}); solution: solutionNames,
};
}).catch(err => {
const newLoadings = [...loading];
newLoadings[index] = false
setLoading(newLoadings)
notification.error({
message: '提示',
duration: 3,
description: '服务无法访问',
});
})
}
const previewMetaData = (record) => {
setCurrentMetaData(record)
setPreviewVisible(true)
}
const solutionName = () => {
getSolutionList({
_version: 9999
}).then(res => {
setSolutionNames(res.currentSolution)
})
}
const onSubmit = prop => {
setVisible(false);
setFlag(flag + 1)
}; };
const delConfirm = (record) => { deleteVectorService(query).then(res => {
console.log(' record.ServiceName', record.ServiceName.split(".")); if (res.success) {
let query = { setFlag(flag + 1);
serviceName: record.ServiceName.split(".")[0], notification.success({
_version: 9999, message: '提示',
solution: solutionNames duration: 3,
} description: '删除元数据成功',
deleteVectorService(query).then(res => { });
if (res.success) { } else {
setFlag(flag + 1) notification.error({
notification.success({ message: '提示',
message: '提示', duration: 3,
duration: 3, description: '删除元数据失败',
description: '删除元数据成功', });
}); }
} else { });
notification.error({ };
message: '提示', const handleAdd = () => {
duration: 3, setType('add');
description: '删除元数据失败', setVisible(true);
}); };
}; useEffect(() => {
}) renderTile();
} }, [flag]);
const handleAdd = () => { // 获取瓦片数据配置数据
setType('add'); const renderTile = () => {
setVisible(true); setTreeLoading(true);
} solutionName();
useEffect(() => { GetVectorService().then(res => {
renderTile(); if (res.msg === 'Ok') {
}, [flag]); let arr = [];
// 获取瓦片数据配置数据 res.data.VectorList.map(item => {
const renderTile = () => { arr.push(false);
setTreeLoading(true); });
solutionName(); setLoading(arr);
GetVectorService().then( setTreeLoading(false);
res => { setTileData(res.data.VectorList);
if (res.msg==='Ok') { } else {
let arr = [] setTreeLoading(false);
res.data.VectorList.map(item => { notification.error({
arr.push(false) message: '获取失败',
}) description: res.message,
setLoading(arr) });
setTreeLoading(false); }
setTileData(res.data.VectorList); });
} else { };
setTreeLoading(false);
notification.error({
message: '获取失败',
description: res.message,
});
}
}
)
};
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: 400 }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}} return (
> <>
</Table> <Spin tip="loading..." spinning={treeLoading}>
<AddModal <div className={styles.tileBtn}>
visible={visible} <Button
onCancel={() => setVisible(false)} type="primary"
callBackSubmit={onSubmit} onClick={() => {
type={type} handleAdd();
formObj={formObj} }}
solutionNames={solutionNames} >
/> 新增
<PreviewModal </Button>
visible={previewVisible} </div>
onCancel={() => setPreviewVisible(false)} <Table
metaData={currentMetaData} columns={columns}
/> dataSource={tileData}
</Spin> bordered
</> rowKey="CreateTime"
) scroll={{ y: 400 }}
} pagination={{
export default VectorData showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
\ No newline at end of file }}
/>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
formObj={formObj}
solutionNames={solutionNames}
/>
<PreviewModal
visible={previewVisible}
onCancel={() => setPreviewVisible(false)}
metaData={currentMetaData}
/>
</Spin>
</>
);
};
export default VectorData;
...@@ -69,7 +69,6 @@ const BaseConfig = () => { ...@@ -69,7 +69,6 @@ const BaseConfig = () => {
</div> </div>
)} )}
<br /> <br />
<Button style={{ marginLeft: '116px', marginTop: '10px' }}>生成编号</Button>
<div style={{ marginTop: '50px', display: 'flex', alignItems: 'center' }}> <div style={{ marginTop: '50px', display: 'flex', alignItems: 'center' }}>
<img src={servie} style={{ height: '16px' }} alt="" /> <img src={servie} style={{ height: '16px' }} alt="" />
<span style={{ marginLeft: '10px', fontWeight: 'bold' }}>服务器链接</span> <span style={{ marginLeft: '10px', fontWeight: 'bold' }}>服务器链接</span>
......
...@@ -17,11 +17,7 @@ import { ...@@ -17,11 +17,7 @@ import {
notification, notification,
Spin, Spin,
} from 'antd'; } from 'antd';
import { import { PlusCircleOutlined, EditTwoTone, DeleteOutlined } from '@ant-design/icons';
PlusCircleOutlined,
EditTwoTone,
DeleteOutlined,
} from '@ant-design/icons';
const { Search } = Input; const { Search } = Input;
const { Option } = Select; const { Option } = Select;
...@@ -148,6 +144,21 @@ const TemplateManage = () => { ...@@ -148,6 +144,21 @@ const TemplateManage = () => {
dataIndex: 'third_id', dataIndex: 'third_id',
key: 'third_id', key: 'third_id',
align: 'center', align: 'center',
width: 150,
onCell: () => ({
style: {
maxWidth: 150,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '模板参数1.0', title: '模板参数1.0',
...@@ -172,6 +183,21 @@ const TemplateManage = () => { ...@@ -172,6 +183,21 @@ const TemplateManage = () => {
dataIndex: 'analysis_params', dataIndex: 'analysis_params',
key: 'analysis_params', key: 'analysis_params',
align: 'center', align: 'center',
width: 150,
onCell: () => ({
style: {
maxWidth: 150,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
}, },
{ {
title: '操作', title: '操作',
...@@ -203,9 +229,7 @@ const TemplateManage = () => { ...@@ -203,9 +229,7 @@ const TemplateManage = () => {
delTemplate(record); delTemplate(record);
}} }}
> >
<DeleteOutlined <DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Popconfirm> </Popconfirm>
</div> </div>
</Tooltip> </Tooltip>
...@@ -218,10 +242,7 @@ const TemplateManage = () => { ...@@ -218,10 +242,7 @@ const TemplateManage = () => {
const searchStyle = val => { const searchStyle = val => {
let n; let n;
if (showSearchStyle) { if (showSearchStyle) {
n = val.replace( n = val.replace(new RegExp(value, 'g'), `<span style='color:red'>${value}</span>`);
new RegExp(value, 'g'),
`<span style='color:red'>${value}</span>`,
);
} else { } else {
n = val; n = val;
} }
......
import React, { useState, useEffect } from 'react' import React, { useState, useEffect } from 'react';
import SiteModal from '@/components/Modal/SiteModa'; import SiteModal from '@/components/Modal/SiteModa';
import { Form, Input, notification, Select, Row, Col } from 'antd' import { Form, Input, notification, Select, Row, Col } from 'antd';
const { Item } = Form; const { Item } = Form;
const { TextArea } = Input; const { TextArea } = Input;
const AddModal = props => { const AddModal = props => {
const { option } = props; const { option } = props;
const [form] = Form.useForm();
const [loading, setLoading] = useState(false);
const [templateName, setTemplateName] = useState([]);
const onSubmit = () => {
form.submit()
}
const onSubmitSuccess = () => {
const result = form.getFieldValue()
props.onSubmit & props.onSubmit({ Id: props.template.Id, ...result })
form.resetFields()
}
useEffect(() => {
if (option) {
setTemplateName(option.filter(item => item.Type === '公众号'))
form.setFieldsValue({
type: '公众号'
})
}
}, [props])
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 19,
},
};
// useEffect(()=>{
// },[props.template]) const [form] = Form.useForm();
const onChange = (value, option) => { const [loading, setLoading] = useState(false);
form.setFieldsValue({ const [templateName, setTemplateName] = useState([]);
third_id: option.code const onSubmit = () => {
}) form.submit();
// setTemplateName(option.filter(item => item.Type === value)) };
const onSubmitSuccess = () => {
}; const result = form.getFieldValue();
const onChangeType = (value) => { props.onSubmit & props.onSubmit({ Id: props.template.Id, ...result });
setTemplateName(option.filter(item => item.Type === value)) form.resetFields();
console.log(option.filter(item => item.Type === value)) };
} useEffect(() => {
if (option) {
const onChangeType1 = (value) => { setTemplateName(option.filter(item => item.Type === '公众号'));
form.setFieldsValue({ form.setFieldsValue({
third_id: value type: '公众号',
}) });
} }
}, [props]);
const layout = {
layout: 'horizontal',
labelCol: {
span: 4,
},
wrapperCol: {
span: 19,
},
};
// useEffect(()=>{
return ( // },[props.template])
<SiteModal const onChange = (value, option) => {
{...props} form.setFieldsValue({
title="模板添加" third_id: option.code,
bodyStyle={{ width: '100%', minHeight: '100px' }} });
style={{ top: 200, borderRadius: '20px' }} // setTemplateName(option.filter(item => item.Type === value))
width="820px" };
destroyOnClose const onChangeType = value => {
cancelText="取消" setTemplateName(option.filter(item => item.Type === value));
okText="确认" console.log(option.filter(item => item.Type === value));
onOk={() => onSubmit()} };
confirmLoading={loading}
>
<div style={{ width: "750px", height: "500px", overflowY: "scroll", overflowX: "hidden" }}>
<Form form={form} {...layout} onFinish={onSubmitSuccess}>
<Item
label="模板名称"
wrapperCol={{ span: 17 }}
labelCol={{ span: 6 }}
style={{ marginBottom: '0' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Item
label=""
name="name"
rules={[
{
required: true,
message: '请输入模板名称',
},
]}
>
<Input style={{ width: '12rem' }} placeholder="请输入模板名称" />
</Item>
<Item
label="模板类型"
name="type"
rules={[
{
required: true,
message: '请选择模板类型',
},
]}
>
<Select style={{ width: '10rem' }} onChange={(value) => onChangeType(value)} >
<Select.Option value="公众号">公众号</Select.Option>
<Select.Option value="短信">短信</Select.Option>
<Select.Option value="企业微信">企业微信</Select.Option>
</Select>
</Item>
</div>
</Item>
{form.getFieldsValue().type !== '企业微信' ?
<>
<Item
label="请选择第三方模板名称"
wrapperCol={{ span: 17 }}
labelCol={{ span: 6 }}
style={{ marginBottom: '0' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Item
label=""
name="third_name"
rules={[
{
required: true,
message: '请选择第三方模板名称',
},
]}
>
{/* <Input placeholder="请输入模板名称" /> */}
<Select
placeholder="请选择模板名称"
style={{ width: '12rem' }}
onChange={(value, option) => onChange(value, option)}
>
{templateName &&
templateName.length > 0 &&
templateName.map((item, index) => (
<Select.Option value={item.Name} key={index} code={item.Code}>
{item.Name}
</Select.Option>
))}
</Select>
</Item>
<Item
label="第三方模板编号"
name="third_id"
rules={[
{
required: true,
message: '请输入第三方模板编号',
},
]}
>
<Input disabled placeholder="请输入第三方模板编号" />
</Item>
</div>
</Item>
</> :
<>
<Item
label="请选择第三方模板名称"
wrapperCol={{ span: 17 }}
labelCol={{ span: 6 }}
style={{ marginBottom: '0' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Item
label=""
name="third_name"
rules={[
{
required: true,
message: '请选择第三方模板名称',
},
]}
>
<Select style={{width:'12rem'}} onChange={(value) => onChangeType1(value)} placeholder="请选择模板名称" >
<Select.Option value="普通文本">普通文本</Select.Option>
<Select.Option value="文字卡片">文字卡片</Select.Option>
<Select.Option value="图片消息">图片消息</Select.Option>
<Select.Option value="图片">图片</Select.Option>
</Select>
</Item>
<Item
label="企业微信应用id"
labelCol={{ span: 11 }}
name="weixin"
rules={[
{
required: true,
message: '请输入企业微信号',
},
]}
>
<Input placeholder="请输入企业微信号" />
</Item>
</div>
</Item>
</>
}
const onChangeType1 = value => {
form.setFieldsValue({
third_id: value,
});
};
return (
<SiteModal
{...props}
title="模板添加"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: 200, borderRadius: '20px' }}
width="820px"
destroyOnClose
cancelText="取消"
okText="确认"
onOk={() => onSubmit()}
confirmLoading={loading}
>
<div style={{ width: '750px', height: '500px', overflowY: 'scroll', overflowX: 'hidden' }}>
<Form form={form} {...layout} onFinish={onSubmitSuccess}>
<Item
label="模板名称"
wrapperCol={{ span: 17 }}
labelCol={{ span: 6 }}
style={{ marginBottom: '0' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Item
label=""
name="name"
rules={[
{
required: true,
message: '请输入模板名称',
},
]}
>
<Input style={{ width: '12rem' }} placeholder="请输入模板名称" />
</Item>
<Item
label="模板类型"
name="type"
rules={[
{
required: true,
message: '请选择模板类型',
},
]}
>
<Select style={{ width: '10rem' }} onChange={value => onChangeType(value)}>
<Select.Option value="公众号">公众号</Select.Option>
<Select.Option value="短信">短信</Select.Option>
<Select.Option value="企业微信">企业微信</Select.Option>
</Select>
</Item>
</div>
</Item>
<Item {form.getFieldsValue().type !== '企业微信' ? (
label="模板参数1.0" <>
labelCol={{ span: 6 }} <Item
name="params" label="请选择第三方模板名称"
wrapperCol={{ span: 17 }}
labelCol={{ span: 6 }}
style={{ marginBottom: '0' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Item
label=""
name="third_name"
rules={[
{
required: true,
message: '请选择第三方模板名称',
},
]}
>
{/* <Input placeholder="请输入模板名称" /> */}
<Select
placeholder="请选择模板名称"
style={{ width: '12rem' }}
onChange={(value, option) => onChange(value, option)}
> >
<TextArea rows={2} style={{ width: '96%' }} placeholder="first|Second|Third|Four" /> {templateName &&
</Item> templateName.length > 0 &&
<Item templateName.map((item, index) => (
label="模板参数2.0" <Select.Option value={item.Name} key={index} code={item.Code}>
labelCol={{ span: 6 }} {item.Name}
name="param1" </Select.Option>
))}
</Select>
</Item>
<Item
label="第三方模板编号"
name="third_id"
rules={[
{
required: true,
message: '请输入第三方模板编号',
},
]}
>
<Input disabled placeholder="请输入第三方模板编号" />
</Item>
</div>
</Item>
</>
) : (
<>
<Item
label="请选择第三方模板名称"
wrapperCol={{ span: 17 }}
labelCol={{ span: 6 }}
style={{ marginBottom: '0' }}
>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<Item
label=""
name="third_name"
rules={[
{
required: true,
message: '请选择第三方模板名称',
},
]}
>
<Select
style={{ width: '12rem' }}
onChange={value => onChangeType1(value)}
placeholder="请选择模板名称"
> >
<TextArea rows={2} style={{ width: '96%' }} placeholder="first|Second|Third|Four" /> <Select.Option value="普通文本">普通文本</Select.Option>
</Item> <Select.Option value="文字卡片">文字卡片</Select.Option>
<Item <Select.Option value="图片消息">图片消息</Select.Option>
label="参数说明" <Select.Option value="图片">图片</Select.Option>
name="desc" </Select>
labelCol={{ span: 6 }} </Item>
> <Item
<TextArea style={{ width: '96%' }} rows={4} placeholder="first: 标题信息|Second: 展示内容|Third: 时间|Four: 备注信息" /> label="企业微信应用id"
</Item> labelCol={{ span: 11 }}
<Item name="weixin"
label="解析规则" rules={[
name="analysis_params" {
labelCol={{ span: 6 }} required: true,
> message: '请输入企业微信号',
<TextArea rows={2} style={{ width: '96%' }} placeholder="param1|param2|param3|param4" /> },
</Item> ]}
</Form> >
</div> <Input placeholder="请输入企业微信号" />
</Item>
</div>
</Item>
</>
)}
</SiteModal> <Item label="模板参数1.0" labelCol={{ span: 6 }} name="params">
) <TextArea rows={2} style={{ width: '96%' }} placeholder="first|Second|Third|Four" />
} </Item>
export default AddModal; <Item label="模板参数2.0" labelCol={{ span: 6 }} name="param1">
\ No newline at end of file <TextArea rows={2} style={{ width: '96%' }} placeholder="first|Second|Third|Four" />
</Item>
<Item label="参数说明" name="desc" labelCol={{ span: 6 }}>
<TextArea
style={{ width: '96%' }}
rows={4}
placeholder="first: 标题信息|Second: 展示内容|Third: 时间|Four: 备注信息"
/>
</Item>
<Item label="解析规则" name="analysis_params" labelCol={{ span: 6 }}>
<TextArea rows={2} style={{ width: '96%' }} placeholder="param1|param2|param3|param4" />
</Item>
</Form>
</div>
</SiteModal>
);
};
export default AddModal;
...@@ -2,22 +2,30 @@ import React, { useEffect, useState } from 'react'; ...@@ -2,22 +2,30 @@ import React, { useEffect, useState } from 'react';
import { Form, Modal, Row, Col, Input, Select, notification } from 'antd'; import { Form, Modal, Row, Col, Input, Select, notification } from 'antd';
const VideoModal = props => { const VideoModal = props => {
const { callBackSubmit = () => { }, visible, onCancel, obj } = props; const { callBackSubmit = () => {}, visible, onCancel, obj } = props;
return ( return (
<Modal <Modal
visible={visible} visible={visible}
title={obj.Name} title={obj.Name}
onCancel={onCancel} onCancel={onCancel}
destroyOnClose destroyOnClose
width="1000px" width="1000px"
maskClosable={false} maskClosable={false}
footer={[]} footer={[]}
> >
<div className="pp"> <div className="pp">
< iframe style={{ border: 0, width: "100%", height: 630, }} src={window.location.origin + `/web4/video/indexAll.html?ID=${obj.EquipmentCode}&skipCheck=true&name=${obj.Name}&disk=${obj.RecorderName}&site=null`} /> <iframe
</div> style={{ border: 0, width: '100%', height: 630 }}
</Modal> src={
) window.location.origin +
} `/web4/video/indexAll.html?ID=${obj.EquipmentCode}&skipCheck=true&name=${
export default VideoModal obj.Name
\ No newline at end of file }&disk=${obj.RecorderName}&site=null`
}
/>
</div>
</Modal>
);
};
export default VideoModal;
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