Commit b9cdf6ca authored by 邓超's avatar 邓超

fix: 整合文件目录跟路由匹配上

parent 4ebbd5bb
......@@ -3,7 +3,7 @@ import PageContainer from '@/components/BasePageContainer';
import { Tabs } from 'antd';
import React from 'react';
import styles from './index.less';
import SevenParams from '@/pages/mobileConfig/menuconfig/SevenParams';
import SevenParams from '@/pages/productCenter/mobileConfig/menuconfig/SevenParams';
const { TabPane } = Tabs;
/**
* 嵌套iframe的组件
......
import React, { useEffect, useState } from 'react';
import { Modal, Card, Empty } from 'antd';
import { useHistory } from 'react-router-dom';
import classnames from 'classnames';
import styles from './index.less';
import weixiu from '@/assets/images/logo/weixiu.svg';
import jumpImg from '@/assets/images/logo/jumpImg.png';
const JumpContainer = props => {
const [url, setUrl] = useState('');
const jumpTo = useHistory();
useEffect(() => {
const jumpUrl = window.location.origin;
const address = `${jumpUrl}/cityoms3/4.0.html`;
setUrl(address);
// openInNewTab(address);
}, []);
const openInNewTab = address => {
jumpTo.goBack();
window.open(address, '_blank');
console.table(jumpTo);
};
return (
<>
<div className={classnames(`${styles.box}`)}>
<img
src={jumpImg}
alt=""
className={classnames({
[styles.imgs]: true,
})}
/>
<p className={styles.desc}>
业务平台建设中,点击链接跳转
{url && (
<a
target="_blank"
href={url}
rel="noopener noreferer"
className={classnames({
[styles.link]: true,
})}
>
运维平台4.0
</a>
)}
</p>
</div>
</>
);
};
export default JumpContainer;
.box{
position: relative;
top:40%;
left: 50%;
transform: translate(-50%,-50%);
width: 400px;
height:250px;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.imgs{
width: 800px;
height: 600px;
}
.desc{
margin-top: 10px;
color: gray;
font-size: 16px;
}
.link{
// display: flex;
// justify-content: center ;
// align-items: center;
// padding: 5px;
color: #1890ff;
}
\ No newline at end of file
import React from 'react';
import { HeartTwoTone, SmileTwoTone } from '@ant-design/icons';
import { Card, Typography, Alert } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
export default () => (
<PageHeaderWrapper content=" 这个页面只有 admin 权限才能查看">
<Card>
<Alert
message="umi ui 现已发布,欢迎使用 npm run ui 启动体验。"
type="success"
showIcon
banner
style={{
margin: -12,
marginBottom: 48,
}}
/>
<Typography.Title level={2} style={{ textAlign: 'center' }}>
<SmileTwoTone /> Ant Design Pro <HeartTwoTone twoToneColor="#eb2f96" />{' '}
You
</Typography.Title>
</Card>
<p style={{ textAlign: 'center', marginTop: 24 }}>
Want to add more pages? Please refer to{' '}
<a
href="https://pro.ant.design/docs/block-cn"
target="_blank"
rel="noopener noreferrer"
>
use block
</a>
</p>
</PageHeaderWrapper>
);
import React from 'react';
import { Alert, Card, Typography } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import { connect } from 'react-redux';
import styles from './Welcome.less';
// eslint-disable-next-line no-unused-vars
const CodePreview = ({ children }) => (
<pre className={styles.pre}>
<code>
<Typography.Text copyable>{children}</Typography.Text>
</code>
</pre>
);
const mapState = store => store;
export default connect(mapState)(() => (
<PageContainer>
<Card>
<Alert
message="更快更强的重型组件,已经发布。"
type="success"
showIcon
banner
style={{
margin: -12,
marginBottom: 24,
}}
/>
</Card>
</PageContainer>
));
@import '~antd/lib/style/themes/default.less';
.pre {
margin: 12px 0;
padding: 12px 20px;
background: @input-bg;
box-shadow: @card-shadow;
}
\ No newline at end of file
import { Tabs } from 'antd';
import React from 'react';
import PageContainer from '@/components/BasePageContainer';
import styles from './policiesIssued.less'
import PredictionConfig from './predictionConfig/predictionConfig';
import StrategyConfig from './strategyConfig/strategyConfig';
const { TabPane } = Tabs;
const SchemeConfig = () => {
return (
<PageContainer>
<div className={styles.container}>
<Tabs type="card">
<TabPane tab="预测方案" key="1">
<PredictionConfig />
</TabPane>
<TabPane tab="策略下发" key="2">
<StrategyConfig />
</TabPane>
</Tabs>
</div>
</PageContainer>
)
}
export default SchemeConfig;
\ No newline at end of file
.container{
width: 100%;
height: calc(100vh - 100px) ;
background-color: #ffffff;
display: flex;
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;
color: #000000;
}
.ant-card-body{
padding-bottom: 0 !important;
}
}
.predict{
display: flex;
align-items: flex-end;
justify-content: space-between;
width: 100%;
}
.tileBtn{
display: flex;
justify-content: flex-end;
width: 100%;
padding: 0 0 2rem
}
.corn{
cursor: pointer;
margin-left:1rem;
text-decoration: underline;
width: 8rem;
}
.deviceList{
max-height: 20rem;
overflow-y: scroll;
}
.deleteItem{
position:relative;
right: -100%;
top: -8.6rem;
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, Spin, Button, Card, Row, Col } from 'antd';
import styles from '../policiesIssued.less'
import {
getEquipmentInfo, getQutaList, addPredictOptions, getSceneNameInfo, editPredictOptions
} from '@/services/intelligence/api';
import { DeleteOutlined } from '@ant-design/icons';
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, deviceType } = props;
const [loading, setLoading] = useState(false);
const [isloading, setIsLoading] = useState(false);
const [deviceCodes, setDeviceCode] = useState([]); //设备编码列表
const [deviceList, setDeviceList] = useState([]); //设备列表
const [card, setCard] = useState([]); //卡片列表值
const [timeType, setTimeType] = useState(['分钟', '小时', '天']);
const [PredictType, setPredictType] = useState(['日', '周', '月']);
const [showTime, setShowTime] = useState(true);
const [commonType, setCommonType] = useState(['自定义', '同周日', '同月日']);
const [intervalType, setIntervalType] = useState('分钟')
const [CycleValue, setCycleValue] = useState('')
const [sceneList, setSceneList] = useState([])
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let api = addPredictOptions
let query = {
SceneName: obj.SceneName,
Cycle: intervalType,
CycleValue: CycleValue,
DeviceType: obj.DeviceType,
PredictName: obj.PredictName,
Remarks: obj.Remarks,
DeviceDetails: card,
PredictCycle: obj.PredictCycle ? obj.PredictCycle : '',
PredictCycleValue: obj.PredictCycleValue,
StatisticCycle: obj.StatisticCycle,
PredictType: obj.PredictType,
StatisticCycleValue: obj.StatisticCycleValue
}
// card.length ? query.DeviceDetails = card : delete query.DeviceDetails
type === 'edit' ? (query.ID = formObj.ID) && (api = editPredictOptions) : delete query.ID && (api = addPredictOptions)
setLoading(true);
api(query).then(res => {
setLoading(false);
if (res.errMsg === '') {
form.resetFields();
callBackSubmit();
prompt('success', `${type === 'add' ? "增加成功" : "编辑成功"}`)
} else {
prompt('fail', res.errMsg)
}
})
}
});
};
const prompt = (type, content) => {
if (type == 'success') {
notification.success({
message: '提示',
duration: 3,
description: content,
});
}
else {
notification.error({
message: '提示',
duration: 3,
description: content,
});
}
}
const onFinish = value => { };
useEffect(() => {
switch (type) {
case 'add':
initData()
break;
case 'edit':
initData()
break;
default:
break;
}
}, [visible]);
//页面初始化
const initData = () => {
if (type === 'add') {
form.resetFields();
setCycleValue('');
setIntervalType('小时');
setCard([])
setDeviceList([])
}
else {
setDeviceList([])
formObj.PredictType === '日' ? setShowTime(true) : setShowTime(false)
form.setFieldsValue({ ...formObj });
setCycleValue(formObj.CycleValue);
setIntervalType(formObj.Cycle);
if (formObj.DeviceDetails.length) {
getEquipmentInfo(formObj.DeviceType).then(respone => {
respone.getMe.length && respone.getMe[0].DeviceList.length && setDeviceCode(respone.getMe[0].DeviceList)
let arr = [...deviceList]
formObj.DeviceDetails.map((item, index) => {
arr[index] = {}
arr[index].code = respone.getMe.length ? respone.getMe[0].DeviceList : []
form.setFieldsValue({
[`deviceCode${index}`]: item.DeviceCode,
[`indextr${index}`]: item.PointAddress,
[`max${index}`]: item.MaxValue,
[`min${index}`]: item.MinValue
})
})
setCard(formObj.DeviceDetails)
setDeviceList(arr)
setLoading(false)
})
}
}
getSceneNameInfo().then(res => {
res.getMe.length && setSceneList(res.getMe)
})
}
//获取设备编码
const getDeviceCode = () => {
setLoading(false)
let obj = form.getFieldsValue();
getEquipmentInfo(obj.DeviceType).then(respone => {
respone.getMe.length && respone.getMe[0].DeviceList.length && setDeviceCode(respone.getMe[0].DeviceList)
if (deviceList.length) {
let arr = [...deviceList]
arr.map((item, index) => {
arr[index].code = respone.getMe.length ? respone.getMe[0].DeviceList : []
arr[index].indexStr = ''
clearInput(index)
})
setDeviceList(arr)
}
setLoading(false)
})
}
//选择设备类型
const handleDeviceType = (value) => {
getDeviceCode()
}
const handleIntervalType = (value) => {
setIntervalType(value)
}
//选择设备编码
const handleChange = (value, option) => {
let cardList = [...card]
cardList[+option.index].DeviceCode = value
setCard(cardList)
let obj = form.getFieldsValue();
getQutaList({ accountName: obj.DeviceType, AddrSchemeID: option.pointid }).then(res => {
if (res.getMe && res.getMe.length) {
let arr = [...deviceList]
arr[+option.index].indexStr = res.getMe
setDeviceList(arr)
}
})
}
//选择设备指标
const handleChangeIndex = (value, option) => {
let cardList = [...card]
cardList[+option.index].PointAddress = value
setCard(cardList)
}
//最大值
const inputMax = (e, option) => {
e.persist();
let cardList = [...card]
cardList[option].MaxValue = e.target.value
setCard(cardList)
}
//最小值
const inputMin = (e, option) => {
e.persist();
let cardList = [...card]
cardList[option].MinValue = e.target.value
setCard(cardList)
}
const add = () => {
let obj = form.getFieldsValue();
if (!obj.DeviceType) {
notification.error({
message: '提示',
duration: 3,
description: '请选择设备类型',
});
} else {
let cardList = [...card]
let arr = [...deviceList]
cardList.push({})
setCard(cardList)
arr.push({ code: deviceCodes })
setDeviceList(arr)
}
}
//删除卡片
const deleteDevice = (index) => {
let cardList = [...card]
let arr = [...deviceList]
cardList.splice(index, 1);
arr.splice(index, 1);
clearInput(index)
setCard(cardList)
setDeviceList(arr)
}
const clearInput = (index) => {
form.setFieldsValue({
[`deviceCode${index}`]: undefined,
[`indextr${index}`]: undefined,
[`max${index}`]: undefined,
[`min${index}`]: undefined
})
}
const selectPredictType = (value) => {
value === '日' ? setShowTime(true) : setShowTime(false)
}
//选择小时,分,天
const selectCycleValue = (e) => {
setCycleValue(e.target.value)
}
return (
<Modal
title={`${type === 'add' ? '预测方案新增' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="800px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Spin spinning={isloading} delay={300}>
{visible && (
<Form form={form} onFinish={onFinish}>
<Item
label="方案名称"
name="PredictName"
rules={[{ required: true, message: '请输入方案名称' }]}
>
<Input placeholder="请输入方案名称" allowClear />
</Item>
<Item
label="场景名称"
name="SceneName"
rules={[{ required: true, message: '请输入算法名称' }]}
>
<Select >
{sceneList.length ? sceneList.map((item, index) => { return <Select.Option key={index} value={item.scenename}>{item.scenename}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="设备类型"
name="DeviceType"
rules={[{ required: true, message: '请输入设备类型' }]}
>
<Select onChange={handleDeviceType} >
{deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="预测间隔"
name="Cycle"
rules={[{ required: true, message: '请输入预测间隔' }]}
>
<div>
<div className={styles.predict}></div>
<Input style={{ width: '67.2%' }} placeholder="请输入预测间隔" value={CycleValue} onChange={(value) => selectCycleValue(value)} allowClear />
<Select style={{marginLeft:'1.5rem', width: '29%' }} onChange={handleIntervalType} value={intervalType}>
{timeType.length ? timeType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</div>
</Item>
<Row gutter='24' >
<Item
label="预测维度"
name="PredictType"
style={{ marginLeft: '0.8rem' }}
rules={[{ required: true, message: '请选择预测维度' }]}
>
<Select onChange={selectPredictType} style={{ width: '8.4rem' }}>
{PredictType.length ? PredictType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
{showTime ? <Item
label="维度类别"
name="PredictCycle"
style={{ marginLeft: '0.8rem' }}
rules={[{ required: true, message: '请选择维度类别' }]}
>
<Select style={{ width: '9rem' }}>
{commonType.length ? commonType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item> : ''}
<Item
label="预测维度值"
style={{ marginLeft: '0.8rem' }}
name="PredictCycleValue"
rules={[{ required: true, message: '请输入预测维度值' }]}
>
<Input placeholder="请输入预测维度值" style={{ width: '12rem' }} allowClear />
</Item>
</Row>
<Row gutter='24' >
<Item
label="统计维度"
style={{ marginLeft: '0.8rem' }}
name="StatisticCycle"
rules={[{ required: true, message: '请选择预测维度' }]}
>
<Select style={{ width: '18rem' }}>
{PredictType.length ? PredictType.map((item, index) => { return <Select.Option key={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="统计维度值"
style={{ marginLeft: '0.8rem' }}
name="StatisticCycleValue"
rules={[{ required: true, message: '请输入统计维度值' }]}
>
<Input style={{ width: '17.2rem' }} placeholder="请输入统计维度值" allowClear />
</Item>
</Row>
<Item
label="描述"
name="Remarks"
style={{ marginLeft: '2.4rem' }}
>
<TextArea placeholder="可输入描述信息" rows={4} allowClear />
</Item>
<Button size="small" onClick={() => { add() }}>
新增
</Button>
<div className={styles.deviceList}>
{deviceList.length ? deviceList.map((item, index) => {
return <Card key={index} style={{ marginTop: '0.5rem' }}>
<Row gutter='36' >
<Col span={12}>
<Item
label="设备编码"
name={'deviceCode' + index}
rules={[{ required: true, message: '请选择设备编码' }]}
>
<Select
placeholder="请选择设备编码"
onChange={(value, option) => handleChange(value, option)}
>
{item.code.length ? item.code.map((item, codeIndex) => { return <Select.Option index={index} key={codeIndex} value={item.Code} pointid={item.PointAddressID}>{item.Code}</Select.Option> }) : ''}
</Select>
</Item>
</Col>
<Col span={12}>
<Item
label="指标名称"
name={'indextr' + index}
rules={[{ required: true, message: '请选择指标名称' }]}
>
<Select
placeholder="请选择指标"
onChange={(value, option) => handleChangeIndex(value, option)}
>
{item.indexStr && item.indexStr.length ? item.indexStr.map((item, zindex) => { return <Select.Option key={zindex} index={index} value={item.Name}>{item.Name}</Select.Option> }) : ''}
</Select>
</Item>
</Col>
</Row>
<Row gutter='24' >
<Col span={12}>
<Item
label="最小值"
style={{ marginLeft: '1.5rem' }}
name={'min' + index}
>
<Input placeholder="请输入最小值" style={{ width: '98%' }} onChange={(value) => inputMin(value, index)} index={index} allowClear />
</Item>
</Col>
<Col span={12}>
<Item
label="最大值"
style={{ marginLeft: '1.6rem' }}
name={'max' + index}
>
<Input style={{ width: '98%', marginLeft: '0.4rem' }} placeholder="请输入最大值" onChange={(value) => inputMax(value, index)} index={index} allowClear />
</Item>
</Col>
</Row>
<DeleteOutlined
className={styles.deleteItem}
onClick={() => deleteDevice(index)}
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Card>
}) : ''}
</div>
</Form>
)}
</Spin>
</Modal>
);
};
export default AddModal;
import { Space, Table, Button, Popconfirm, notification, Spin } from 'antd';
import React, { useState, useEffect } from 'react';
import styles from '../policiesIssued.less'
import {
getIotDeviceType, getPredictInfo, deletePredictOptions
} from '@/services/intelligence/api';
import AddModal from './AddModal'
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示
const [flag, setFlag] = useState(0); // 更新list
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗
const [deviceType, setDeviceType] = useState([]); //设备类型列表
const columns = [
{
title: '序号',
align: 'center',
render: (text, record, index) => (
<Space>
<span>{(index + 1)}</span>
</Space>
)
},
{
title: '方案名称',
dataIndex: 'PredictName',
key: 'PredictName',
align: 'center'
},
{
title: '场景名称',
dataIndex: 'SceneName',
key: 'SceneName',
align: 'center'
},
{
title: '设备类型',
dataIndex: 'DeviceType',
key: 'DeviceType',
align: 'center'
},
{
title: '预测间隔',
align: 'center',
render: (record) => (
<Space>
{record.CycleValue + record.Cycle}
</Space>
)
},
{
title: '描述',
dataIndex: 'Remarks',
key: 'Remarks',
align: 'center'
},
{
title: '编辑',
align: 'center',
render: (text, record, index) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
changeRecord(record);
}}
>
编辑
</Button>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该方案?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const onSubmit = prop => {
setVisible(false);
setFlag(flag + 1)
};
const delConfirm = (record) => {
deletePredictOptions(record.ID).then(res => {
if (res.errMsg === '') {
setFlag(flag + 1)
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.errMsg,
});
};
})
}
const handleAdd = () => {
setFormObj({});
setType('add');
setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取瓦片数据配置数据
const renderTile = () => {
setTreeLoading(true)
const getIotDevice = getIotDeviceType()
const getPredictList = getPredictInfo()
Promise.all([getIotDevice, getPredictList]).then(res => {
res[0].getMe && res[0].getMe.length && setDeviceType(res[0].getMe)
res[1].getMe && res[1].getMe.length && setTileData(res[1].getMe)
setTreeLoading(false)
}).catch(err => {
setTreeLoading(false)
})
};
const changeRecord = (record) => {
setType('edit');
setFormObj(record);
setVisible(true);
}
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: 700 }}
pagination={{
pageSize: '10',
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
deviceType={deviceType}
formObj={formObj}
/>
</Spin>
</>
)
}
export default VectorData
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, DatePicker, Spin, Button, Card, Row, Col } from 'antd';
import styles from '../policiesIssued.less'
// import moment from 'moment';
// import locale from 'antd/es/date-picker/locale/zh_CN';
// import 'moment/locale/zh-cn';
import moment from 'moment'
import locale from 'antd/lib/date-picker/locale/zh_CN'
import 'moment/locale/zh-cn'
moment.locale('zh-cn')
import {
getEquipmentInfo, getQutaList, addStrategyOptions, editStrategyOptions, getPredictDevice, getPredictDevicePoint, getPredictInfo
} from '@/services/intelligence/api';
import { DeleteOutlined } from '@ant-design/icons';
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, deviceType } = props;
const [loading, setLoading] = useState(false);
const [isloading, setIsLoading] = useState(false);
const [deviceCodes, setDeviceCode] = useState([]); //设备编码列表
const [predictCode, setPredictCode] = useState([]); //预测编码列表
const [deviceList, setDeviceList] = useState([]); //设备列表
const [card, setCard] = useState([]); //卡片列表值
const [dateArr, setDateArr] = useState({ DeviationType: '秒', DeviationValue: 0, DurationType: '秒', DurationValue: 0}); //偏移量,时段时长
const [source, setSource] = useState([])
const [showTime, setShowTime] = useState(true)
const [PredictID, setPredictID] = useState()
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let api = addStrategyOptions
let query = {
DeviceType: obj.DeviceType,
StrategyDes: obj.StrategyDes,
StrategyName: obj.StrategyName,
StrategyType: obj.StrategyType,
DeviationType: dateArr.DeviationType,
DeviationValue: dateArr.DeviationValue,
DurationType: dateArr.DurationType,
DurationValue: dateArr.DurationValue,
DetailInfos: card,
CreateTime: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
PredictID
}
type === 'edit' ? (query.ID = formObj.ID) && (api = editStrategyOptions) : delete query.ID && (api = addStrategyOptions)
setLoading(true);
api(query).then(res => {
setLoading(false);
if (res.errMsg === '') {
form.resetFields();
callBackSubmit();
prompt('success', `${type === 'add' ? "增加成功" : res.errMsg}`)
} else {
prompt('fail', res.errMsg)
}
}).catch(e => {
setLoading(false);
})
}
});
};
const prompt = (type, content) => {
if (type == 'success') {
notification.success({
message: '提示',
duration: 3,
description: content,
});
}
else {
notification.error({
message: '提示',
duration: 3,
description: content,
});
}
}
const onFinish = value => { };
useEffect(() => {
switch (type) {
case 'add':
initData()
break;
case 'edit':
initData()
break;
default:
break;
}
}, [visible]);
//页面初始化
const initData = () => {
getPredictInfo().then(res => {
res.getMe && res.getMe.length && setSource(res.getMe)
})
if (type === 'add') {
form.resetFields();
setCard([])
setDeviceList([])
setShowTime(true)
setDateArr({ DeviationType: '秒', DeviationValue: 0, DurationType: '秒', DurationValue: 0})
}
else {
let { DeviationType, DeviationValue, DurationType, DurationValue } = formObj
formObj.StrategyType === '时段控制' ? setShowTime(true) : setShowTime(false)
setDateArr({ DeviationType, DeviationValue, DurationType, DurationValue })
form.setFieldsValue({ time: moment(formObj.CreateTime, "YYYYMMDDHHmmss"), ...formObj });
if (formObj.DetailInfos.length) {
let req1 = getEquipmentInfo(formObj.DeviceType)
let req2 = getPredictDevice(formObj.DeviceType)
Promise.all([req1, req2]).then(respone => {
console.log('respone', respone);
respone[0].getMe.length && respone[0].getMe[0].DeviceList.length && setDeviceCode(respone[0].getMe[0].DeviceList)
respone[1].getMe.length && setPredictCode(respone[1].getMe)
let arr = []
formObj.DetailInfos.map((item, index) => {
arr[index] = {}
arr[index].code = respone[0].getMe.length ? respone[0].getMe[0].DeviceList : []
arr[index].predictCode = respone[1].getMe.length ? respone[1].getMe : []
form.setFieldsValue({
[`deviceCode${index}`]: item.ControlCode,
[`indextr${index}`]: item.ControlPoint,
[`max${index}`]: item.PredictCode,
[`min${index}`]: item.PredictPoint
})
})
setCard(formObj.DetailInfos)
setDeviceList(arr)
setLoading(false)
})
}
}
}
//获取设备编码
const getDeviceCode = () => {
setLoading(false)
let obj = form.getFieldsValue();
let req1 = getEquipmentInfo(obj.DeviceType)
let req2 = getPredictDevice(obj.DeviceType)
Promise.all([req1, req2]).then(respone => {
respone[0].getMe.length && respone[0].getMe[0].DeviceList.length && setDeviceCode(respone[0].getMe[0].DeviceList)
respone[1].getMe.length && setPredictCode(respone[1].getMe)
if (deviceList.length) {
let arr = [...deviceList]
arr.map((item, index) => {
arr[index].code = respone[0].getMe.length ? respone[0].getMe[0].DeviceList : []
arr[index].predictCode = respone[1].getMe.length ? respone[1].getMe : []
arr[index].indexStr = ''
arr[index].predictStr = ''
clearInput(index)
})
setDeviceList(arr)
}
setLoading(false)
})
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 6,
},
wrapperCol: {
span: 16,
},
};
//选择设备类型
const handleDeviceType = (value) => {
getDeviceCode()
}
//选择设备编码
const handleChange = (value, option) => {
let cardList = [...card]
cardList[+option.index].ControlCode = value
setCard(cardList)
let obj = form.getFieldsValue();
getQutaList({ accountName: obj.DeviceType, AddrSchemeID: option.pointid }).then(res => {
if (res.getMe && res.getMe.length) {
let arr = [...deviceList]
arr[+option.index].indexStr = res.getMe
setDeviceList(arr)
}
})
}
//选择预测编码
const handleChange1 = (value, option) => {
let cardList = [...card]
cardList[+option.index].PredictCode = value
setCard(cardList)
let obj = form.getFieldsValue();
getPredictDevicePoint({ deviceType: obj.DeviceType, DeviceCode: value }).then(res => {
console.log('res', res);
if (res.getMe && res.getMe.length) {
let arr = [...deviceList]
arr[+option.index].predictStr = res.getMe
setDeviceList(arr)
}
})
}
//选择设备指标
const handleChangeIndex = (value, option) => {
let cardList = [...card]
cardList[+option.index].ControlPoint = value
setCard(cardList)
}
//选择预测指标
const handleChangeIndex1 = (value, option) => {
let cardList = [...card]
cardList[+option.index].PredictPoint = value
setCard(cardList)
}
const add = () => {
let obj = form.getFieldsValue();
if (!obj.DeviceType) {
notification.error({
message: '提示',
duration: 3,
description: '请选择设备类型',
});
} else {
let cardList = [...card]
let arr = [...deviceList]
cardList.push({})
setCard(cardList)
arr.push({ code: deviceCodes, predictCode })
setDeviceList(arr)
}
}
//清除卡片删除一项的值
const clearInput = (index) => {
form.setFieldsValue({
[`deviceCode${index}`]: undefined,
[`indextr${index}`]: undefined,
[`max${index}`]: undefined,
[`min${index}`]: undefined
})
}
//删除卡片
const deleteDevice = (index) => {
let cardList = [...card]
let arr = [...deviceList]
cardList.splice(index, 1)
arr.splice(index, 1)
clearInput(index)
setCard(cardList)
setDeviceList(arr)
}
const handleOrgin = (value, option) => {
setPredictID(option.id)
}
const changeDeviationValue = (e) => {
const newArr = { ...dateArr }
newArr.DeviationValue = e.target.value
setDateArr(newArr)
}
const changeDeviationType = (value) => {
const newArr = { ...dateArr }
newArr.DeviationType = value
setDateArr(newArr)
}
const changeDurationValue = (e) => {
const newArr = { ...dateArr }
newArr.DurationValue = e.target.value
setDateArr(newArr)
}
const changeDurationType = (value) => {
const newArr = { ...dateArr }
newArr.DurationType = value
setDateArr(newArr)
}
const hangleTime = (value) => {
value === '时段控制' ? setShowTime(true) : setShowTime(false)
const newArr = { ...dateArr }
newArr.DurationValue = 0
newArr.DurationType = '秒'
setDateArr(newArr)
}
return (
<Modal
title={`${type === 'add' ? '策略下发新增' : '编辑'}`}
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '150px' }}
width="800px"
destroyOnClose
maskClosable={false}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
confirmLoading={loading}
forceRender={true}
getContainer={false}
>
<Spin spinning={isloading} delay={300}>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="策略名称"
name="StrategyName"
rules={[{ required: true, message: '请输入策略名称' }]}
>
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="策略类型"
name="StrategyType"
rules={[{ required: true, message: '请选择策略类型' }]}
>
<Select onChange={hangleTime} >
<Select.Option value='实时控制'>实时控制</Select.Option>
<Select.Option value='时段控制'>时段控制</Select.Option>
</Select>
</Item>
<Item
label="数据来源"
name="PredictName"
rules={[{ required: true, message: '请选择数据来源' }]}
>
<Select onChange={(value, option) => handleOrgin(value, option)}>
{source.length ? source.map((item, index) => { return <Select.Option key={index} id={item.ID} value={item.PredictName}>{item.PredictName}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="设备类型"
name="DeviceType"
>
<Select onChange={handleDeviceType} >
{deviceType.length ? deviceType.map((item, index) => { return <Select.Option key={index} value={item.DeviceType}>{item.DeviceType}</Select.Option> }) : ''}
</Select>
</Item>
<Item
label="偏移量"
name="Cycle"
rules={[{ required: true, message: '请输入偏移量' }]}
>
<div>
<div className={styles.predict}></div>
<Input style={{ width: '64%' }} placeholder="请输入偏移量" value={dateArr.DeviationValue} onChange={changeDeviationValue} allowClear />
<Select style={{ marginLeft: '2rem', width: '28%' }} onChange={changeDeviationType} value={dateArr.DeviationType}>
<Select.Option value='秒'></Select.Option>
<Select.Option value='分'></Select.Option>
<Select.Option value='时'></Select.Option>
<Select.Option value='日'></Select.Option>
</Select>
</div>
</Item>
{showTime ? <Item
label="时段时长"
name="Cycle"
rules={[{ required: true, message: '请输入时段时长' }]}
>
<div>
<div className={styles.predict}></div>
<Input style={{ width: '64%' }} placeholder="请输入时段时长" value={dateArr.DurationValue} onChange={changeDurationValue} allowClear />
<Select style={{ marginLeft: '2rem', width: '28%' }} onChange={changeDurationType} value={dateArr.DurationType}>
<Select.Option value='秒'></Select.Option>
<Select.Option value='分'></Select.Option>
<Select.Option value='时'></Select.Option>
<Select.Option value='日'></Select.Option>
</Select>
</div>
</Item> : ''}
<Item
label="描述"
name="StrategyDes"
>
<TextArea placeholder="可输入描述信息" rows={4} allowClear />
</Item>
<Button size="small" onClick={() => { add() }}>
新增
</Button>
<div className={styles.deviceList}>
{deviceList.length ? deviceList.map((item, index) => {
return <Card key={index} style={{ marginTop: '0.5rem' }}>
<Row gutter='36' justify='space-between'>
<Col span={12}>
<Item
label="控制编码"
name={'deviceCode' + index}
rules={[{ required: true, message: '请选择设备编码' }]}
>
<Select
placeholder="请选择控制编码"
onChange={(value, option) => handleChange(value, option)}
>
{item.code.length ? item.code.map((item, codeIndex) => { return <Select.Option index={index} key={codeIndex} value={item.Code} pointid={item.PointAddressID}>{item.Code}</Select.Option> }) : ''}
</Select>
</Item>
</Col>
<Col span={12}>
<Item
label="控制指标"
name={'indextr' + index}
rules={[{ required: true, message: '请选择指标名称' }]}
>
<Select
placeholder="请选择控制指标"
onChange={(value, option) => handleChangeIndex(value, option)}
>
{item.indexStr && item.indexStr.length ? item.indexStr.map((item, zindex) => { return <Select.Option key={zindex} index={index} value={item.Name}>{item.Name}</Select.Option> }) : ''}
</Select>
</Item>
</Col>
</Row>
<Row gutter='24' justify='space-between'>
<Col span={12}>
<Item
label="预测编码"
name={'max' + index}
rules={[{ required: true, message: '请输入预测编码' }]}
>
<Select
placeholder="请选择预测编码"
onChange={(value, option) => handleChange1(value, option)}
>
{item.predictCode.length ? item.predictCode.map((item, codeIndex) => { return <Select.Option index={index} key={codeIndex} value={item} >{item}</Select.Option> }) : ''}
</Select>
{/* <Input placeholder="请输入最大值" onChange={(value) => inputMax(value, index)} index={index} allowClear /> */}
</Item>
</Col>
<Col span={12}>
<Item
label="预测指标"
name={'min' + index}
rules={[{ required: true, message: '请输入预测指标' }]}
>
<Select
placeholder="请选择预测指标"
style={{ width: '98%', marginLeft: '0.4rem' }}
onChange={(value, option) => handleChangeIndex1(value, option)}
>
{item.predictStr && item.predictStr.length ? item.predictStr.map((item, zindex) => { return <Select.Option key={zindex} index={index} value={item}>{item}</Select.Option> }) : ''}
</Select>
</Item>
</Col>
</Row>
<DeleteOutlined
className={styles.deleteItem}
onClick={() => deleteDevice(index)}
style={{ fontSize: '16px', color: '#e86060' }}
/>
</Card>
}) : ''}
</div>
</Form>
)}
</Spin>
</Modal>
);
};
export default AddModal;
import { Space, Table, Button, Popconfirm, notification ,Spin} from 'antd';
import React, { useState, useEffect } from 'react';
import styles from '../policiesIssued.less'
import {
getIotDeviceType, getStrategyInfo, deleteStrategyOptions
} from '@/services/intelligence/api';
import AddModal from './AddModal'
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示
const [flag, setFlag] = useState(0); // 更新list
const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({ user: 'admin', password: 'geoserver' });
const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗
const [deviceType, setDeviceType] = useState([]); //设备类型列表
const columns = [
{
title: '序号',
align: 'center',
render: (text, record, index) => (
<Space>
<span>{(index + 1)}</span>
</Space>
)
},
{
title: '策略名称',
dataIndex: 'StrategyName',
key: 'StrategyName',
align: 'center'
},
{
title: '策略类型',
dataIndex: 'StrategyType',
key: 'StrategyType',
align: 'center'
},
{
title: '创建时间',
dataIndex: 'CreateTime',
key: 'CreateTime',
align: 'center'
},
{
title: '设备类型',
dataIndex: 'DeviceType',
key: 'DeviceType',
align: 'center'
},
{
title: '描述',
dataIndex: 'StrategyDes',
key: 'StrategyDes',
align: 'center'
},
{
title: '编辑',
align: 'center',
render: (text, record, index) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
changeRecord(record);
}}
>
编辑
</Button>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该方案?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const onSubmit = prop => {
setVisible(false);
setFlag(flag + 1)
};
const delConfirm = (record) => {
deleteStrategyOptions(record.ID).then(res => {
if (res.errMsg==='') {
setFlag(flag + 1)
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.errMsg,
});
};
})
}
const handleAdd = () => {
setFormObj({});
setType('add');
setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取瓦片数据配置数据
const renderTile = () => {
setTreeLoading(true)
const getIotDevice = getIotDeviceType()
const getStrategy = getStrategyInfo()
Promise.all([getIotDevice,getStrategy]).then(res => {
console.log('res[3].getMe',res[1].getMe);
res[0].getMe && res[0].getMe.length && setDeviceType(res[0].getMe)
res[1].getMe && res[1].getMe.length && setTileData(res[1].getMe)
setTreeLoading(false)
}).catch(err => {
setTreeLoading(false)
})
};
const changeRecord =(record)=>{
setType('edit');
setFormObj(record);
setVisible(true);
}
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: 700 }}
pagination={{
pageSize: '10' ,
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
deviceType={deviceType}
formObj={formObj}
/>
</Spin>
</>
)
}
export default VectorData
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Form, Modal, Input, Select, notification, DatePicker, Spin } from 'antd';
import styles from './taskScheduling.less'
// import moment from 'moment';
// import locale from 'antd/es/date-picker/locale/zh_CN';
// import 'moment/locale/zh-cn';
import moment from 'moment'
import locale from 'antd/lib/date-picker/locale/zh_CN'
import 'moment/locale/zh-cn'
moment.locale('zh-cn')
import {
addTaskOptions, getPredictInfo, getStrategyInfo, updateTaskOptions
} from '@/services/intelligence/api';
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => { }, type, formObj, visible, deviceType } = props;
const [loading, setLoading] = useState(false);
const [isloading, setIsLoading] = useState(false);
const [urlType, setUrlType] = useState('');
const [scenarioList, setScenarioList] = useState([]);
const [Intervals, setIntervals] = useState('')
const [StrategyId, setStrategyId] = useState(0)
const [form] = Form.useForm();
const { Item } = Form;
// 提交
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let apiUrl = type === 'add' ? addTaskOptions : updateTaskOptions
setLoading(true);
apiUrl([{
...obj, StrategyId
}]).then(res => {
setLoading(false);
if (res.errMsg === '') {
form.resetFields();
callBackSubmit();
prompt('success', `${type === 'add' ? "增加成功" : "编辑成功"}`)
}
else {
prompt('fail', res.errMsg)
}
}).catch(err => {
setLoading(false);
})
}
});
};
//提示框
const prompt = (type, content) => {
if (type == 'success') {
notification.success({
message: '提示',
duration: 3,
description: content,
});
}
else {
notification.error({
message: '提示',
duration: 3,
description: content,
});
}
}
const onFinish = value => { };
useEffect(() => {
switch (type) {
case 'add':
setIntervals()
form.resetFields();
break;
case 'edit':
setUrlType(formObj.TaskType)
setStrategyId(formObj.AlgorithmId)
handleTaskType(formObj.TaskType)
setIntervals(formObj.Interval)
form.setFieldsValue({ ...formObj, AlgorithmName: formObj.Name });
break;
default:
break;
}
}, [visible]);
//选择任务类型
const handleTaskType = (value) => {
switch (value) {
case '预测':
setUrlType('predict')
getPredictInfo().then(res => {
res.getMe.length && setScenarioList(res.getMe)
})
break;
case '控制':
setUrlType('control')
getStrategyInfo().then(res => {
res.getMe.length && setScenarioList(res.getMe)
})
break;
case 'http':
setUrlType('url')
break;
default:
setUrlType('predict')
}
}
const inputInterval = (e) => {
setIntervals(e.target.value)
}
const layout = {
layout: 'horizontal',
labelCol: {
span: 5,
},
wrapperCol: {
span: 16,
},
};
const handleChange = (value, option) => {
setStrategyId(option.id)
}
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}
>
<Spin spinning={isloading} delay={300}>
{visible && (
<Form form={form} {...layout} onFinish={onFinish}>
<Item
label="任务名称"
name="TaskName"
rules={[{ required: true, message: '请输入任务名称' }]}
>
<Input placeholder="请输入任务名称" allowClear />
</Item>
<Item
label="任务类型"
name="TaskType"
rules={[{ required: true, message: '请选择类型' }]}
>
<Select onChange={handleTaskType}>
<Select.Option value='预测'>预测</Select.Option>
<Select.Option value='控制'>控制</Select.Option>
<Select.Option value='http'>http</Select.Option>
</Select>
</Item>
{urlType === 'predict' || urlType === 'control' || urlType === '' ? <Item
label="方案名称"
name="AlgorithmName"
>
<Select onChange={(value, option) => handleChange(value, option)}>
{scenarioList.length ? scenarioList.map((item, index) => { return <Select.Option key={index} id={item.ID} value={urlType === 'predict' ? item.PredictName : item.StrategyName}>{urlType === 'predict' ? item.PredictName : item.StrategyName}</Select.Option> }) : ''}
</Select>
</Item> : <Item
label="ApiUrl"
name="ApiUrl"
>
<Input placeholder="请输入URL" allowClear />
</Item>}
<Item
label="调度间隔(Cron)"
name="Interval"
rules={[{ required: true, message: '请输入间隔' }]}
>
<div className={styles.predict}>
<Input placeholder="请输入间隔" allowClear onChange={(value) => inputInterval(value)} value={Intervals} />
<a className={styles.corn} target="view_window" href="https://cron.qqe2.com/">cron在线生成</a>
</div>
</Item>
<Item
label="描述"
name="Describe"
>
<TextArea placeholder="可输入描述信息" rows={4} allowClear />
</Item>
</Form>
)}
</Spin>
</Modal>
);
};
export default AddModal;
import { Space, Table, Button, Popconfirm, notification ,Spin} from 'antd';
import React, { useState, useEffect } from 'react';
import styles from './taskScheduling.less'
import {
deleteTaskOptions, taskOptionsList, getIotDeviceType
} from '@/services/intelligence/api';
import AddModal from './AddModal'
const VectorData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗
const [deviceType, setDeviceType] = useState([]); //设备类型列表
const [flag, setFlag] = useState(0); // 更新list
const [type, setType] = useState(''); // 弹窗类型
const [solutionNames, setSolutionNames] = useState('');
const [formObj, setFormObj] = useState({});
const columns = [
{
title: '序号',
align: 'center',
render: (text, record, index) => (
<Space>
<span>{(index + 1)}</span>
</Space>
)
},
{
title: '任务名称',
dataIndex: 'TaskName',
key: 'TaskName',
align: 'center'
},
{
title: '状态',
dataIndex: 'Status',
key: 'Status',
align: 'center'
},
{
title: '任务类型',
dataIndex: 'TaskType',
key: 'TaskType',
align: 'center'
},
{
title: '间隔',
dataIndex: 'Interval',
key: 'Interval',
align: 'center'
},
{
title: '描述',
dataIndex: 'Describe',
key: 'Describe',
align: 'center'
},
{
title: '编辑',
align: 'center',
render: (text, record, index) => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
changeRecord(record);
}}
>
编辑
</Button>
<div onClick={e => e.stopPropagation()}>
<Popconfirm
title="是否删除该任务?"
okText="确认"
cancelText="取消"
onConfirm={() => {
delConfirm(record);
}}
>
<Button size="small" danger>
删除
</Button>
</Popconfirm>
</div>
</Space>
),
},
];
const onSubmit = prop => {
setVisible(false);
setFlag(flag + 1)
};
const delConfirm = (record) => {
deleteTaskOptions([record]).then(res => {
if (res.errMsg === '') {
setFlag(flag + 1)
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.errMsg,
});
};
})
}
//编辑任务调度
const changeRecord = (record) => {
setType('edit');
setFormObj(record);
setVisible(true);
}
const handleAdd = () => {
setType('add');
setVisible(true);
}
useEffect(() => {
renderTile();
}, [flag]);
// 获取任务列表及设备类型及编码数据
const renderTile = () => {
setTreeLoading(true)
const getIotDevice = getIotDeviceType()
const taskOption = taskOptionsList()
Promise.all([getIotDevice, taskOption]).then(res => {
res[0].getMe && res[0].getMe.length && setDeviceType(res[0].getMe)
res[1].getMe && res[1].getMe.length && setTileData(res[1].getMe)
setTreeLoading(false)
}).catch(err => {
setTreeLoading(false)
})
}
return (
<>
<Spin tip="loading..." spinning={treeLoading}>
<div className={styles.container}>
<div className={styles.tileBtn}>
<Button type="primary" onClick={() => {
handleAdd();
}} >
新增
</Button>
</div>
<Table
columns={columns}
dataSource={tileData}
bordered
rowKey="TaskName"
scroll={{ y: 600 }}
pagination={{
pageSize: '10' ,
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}}
>
</Table>
<AddModal
visible={visible}
onCancel={() => setVisible(false)}
callBackSubmit={onSubmit}
type={type}
deviceType={deviceType}
formObj={formObj}
solutionNames={solutionNames}
/>
</div>
</Spin>
</>
)
}
export default VectorData
\ No newline at end of file
.container{
width: 100%;
height: 100%;
background-color: #ffffff;
}
.predict{
display: flex;
align-items: flex-end;
justify-content: space-between;
width: 100%;
}
.tileBtn{
display: flex;
justify-content: flex-end;
width: 100%;
padding: 2rem 1rem 2rem 0;
}
.corn{
cursor: pointer;
margin-left:1rem;
text-decoration: underline;
width: 8rem;
}
\ No newline at end of file
import React, { useEffect, useState } from 'react'
import PageContainer from '@/components/BasePageContainer';
import { Card, Form, Input, Button, Switch, message } from 'antd'
import { GetAuthSet, AuthSetting } from '@/services/database/api'
import styles from './index.less'
const AuthControl = () => {
const [flag,setFlag] = useState(0)
const [auChecked, setAuChecked] = useState()
const [cacheChecked, setCacheAuChecked] = useState()
useEffect(() => {
GetAuthSet().then(
res => {
if (res.code === 0) {
setAuChecked(res.data.IsOpenAuth)
setCacheAuChecked(res.data.IsUseCache)
}
}
)
}, [flag])
const loadConfig = () => {
}
const operateControl = value => {
AuthSetting({
IsOpenAuth:value
}).then(
res =>{
if(res.code === 0){
setFlag(flag + 1)
message.success("设置成功!")
}
}
)
}
return (
<>
<PageContainer>
<div style={{display:"flex",flexWrap:"wrap"}}>
<Card title="数据管理" style={{ width: 350, marginLeft: 15 }}>
<div className={styles.auth_container}>
<div className={styles.operate_item}>
<div>数据库鉴权</div>
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={auChecked} onChange={operateControl} />
</div>
</div>
</Card>
<Card title="缓存管理" style={{ width: 350, marginLeft: 15 }}>
<div className={styles.auth_container}>
<div className={styles.operate_item}>
<div>开启缓存</div>
<Switch checkedChildren='开启' unCheckedChildren='关闭' checked={cacheChecked} disabled={true} />
</div>
</div>
</Card>
</div>
</PageContainer>
</>
)
}
export default AuthControl;
\ No newline at end of file
.auth_container {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 100%;
height: 100%;
.operate_item {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 50px;
border-width: 1px;
border-color: #EEEEEE;
border-bottom-style: solid;
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import {
Form,
Modal,
Space,
Table,
Button,
Popconfirm,
Spin,
notification,
Tooltip,
} from 'antd';
import { Form, Modal, Space, Table, Button, Popconfirm, Spin, notification, Tooltip } from 'antd';
import {
EditOutlined,
DeleteOutlined,
......@@ -17,16 +7,12 @@ import {
PlusSquareOutlined,
RollbackOutlined,
} from '@ant-design/icons';
import {
reloadTableFields,
removeFields,
loadUnattachedTables,
} from '@/services/platform/bs';
import { reloadTableFields, removeFields, loadUnattachedTables } from '@/services/platform/bs';
import { useHistory } from 'react-router-dom';
import FieldEditor from './fieldEditor';
import styles from './index.less';
import AffiliateAdd from '../bsmanager/tablemanager/components/Field/affiliateAdd';
import LoadGroup from '../bsmanager/tablemanager/components/Field/loadGroupNew';
import AffiliateAdd from '../components/Field/affiliateAdd';
import LoadGroup from '../components/Field/loadGroupNew';
const AddModal = props => {
const history = useHistory();
const [allData, setAllData] = useState([]);
......@@ -78,9 +64,7 @@ const AddModal = props => {
width: 190,
align: 'left',
render: (text, record) => (
<div style={{ paddingLeft: '2rem', color: styleConfig(record) }}>
{text}
</div>
<div style={{ paddingLeft: '2rem', color: styleConfig(record) }}>{text}</div>
),
},
{
......@@ -89,9 +73,7 @@ const AddModal = props => {
key: 'alias',
align: 'center',
width: 200,
render: (text, record) => (
<span style={{ color: styleConfig(record) }}>{text} </span>
),
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>,
},
{
title: '字段类型',
......@@ -99,9 +81,7 @@ const AddModal = props => {
key: 'storeType',
align: 'center',
width: 200,
render: (text, record) => (
<span style={{ color: styleConfig(record) }}>{text} </span>
),
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>,
},
{
title: '形态',
......@@ -109,9 +89,7 @@ const AddModal = props => {
key: 'shape',
align: 'center',
width: 200,
render: (text, record) => (
<span style={{ color: styleConfig(record) }}>{text} </span>
),
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>,
},
{
title: '配置',
......@@ -119,9 +97,7 @@ const AddModal = props => {
key: 'config',
align: 'center',
width: 200,
render: (text, record) => (
<span style={{ color: styleConfig(record) }}>{text} </span>
),
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>,
},
{
......@@ -130,9 +106,7 @@ const AddModal = props => {
key: 'readOnly',
align: 'center',
width: 200,
render: (text, record) => (
<span style={{ color: styleConfig(record) }}>{text} </span>
),
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>,
},
{
title: '同步',
......@@ -140,9 +114,7 @@ const AddModal = props => {
key: 'syncEvent',
align: 'center',
width: 200,
render: (text, record) => (
<span style={{ color: styleConfig(record) }}>{text} </span>
),
render: (text, record) => <span style={{ color: styleConfig(record) }}>{text} </span>,
},
{
title: '操作',
......@@ -171,9 +143,7 @@ const AddModal = props => {
}}
>
<Tooltip title="删除">
<DeleteOutlined
style={{ fontSize: '16px', color: '#e86060' }}
>
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }}>
删除
</DeleteOutlined>
</Tooltip>
......@@ -206,8 +176,7 @@ const AddModal = props => {
);
};
const setRowClassName = record =>
Object.entries(record).toString() ===
Object.entries(selectTableName).toString()
Object.entries(record).toString() === Object.entries(selectTableName).toString()
? styles.clickRowStyle
: '';
const columns = [
......@@ -398,18 +367,10 @@ const AddModal = props => {
<div className={styles.config}>
<div className={styles.title}>{formObj}(字段配置)</div>
<div className={styles.btn}>
<Button
type="primary"
icon={<PlusSquareOutlined />}
onClick={add}
>
<Button type="primary" icon={<PlusSquareOutlined />} onClick={add}>
附加
</Button>
<Button
type="primary"
icon={<SortDescendingOutlined />}
onClick={sort}
>
<Button type="primary" icon={<SortDescendingOutlined />} onClick={sort}>
分组排序
</Button>
<Button type="primary" icon={<RollbackOutlined />} onClick={back}>
......
......@@ -49,7 +49,7 @@ import styles from './incident.less';
import ChangeAdd from './changeAdd';
import ChangeEdit from './changeEdit';
import ChangeImage from './ChangeImage';
import ModalDrag from '../maintenance/ModalDrag';
import ModalDrag from '../../maintenance/ModalDrag';
import { PlusOutlined, DownOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { set } from 'immutable';
import { getRoleGroup } from '@/services/userCenter/roleManage/api';
......
/* eslint-disable react-hooks/rules-of-hooks */
/*
* @Description:
* @Author: leizhe
* @Date: 2021-05-27 16:31:05
* @LastEditTime: 2021-11-26 16:43:17
* @Date: 2021-07-13 16:32:28
* @LastEditTime: 2021-10-26 16:38:27
* @LastEditors: leizhe
*/
import React, { useState, useEffect } from 'react';
import {
Table,
Tooltip,
Spin,
Modal,
Form,
Input,
Space,
Popconfirm,
notification,
message,
Button,
Upload,
Search,
} from 'antd';
import React from 'react';
import { Tabs, Card } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import {
EditTwoTone,
RollbackOutlined,
DeleteOutlined,
} from '@ant-design/icons';
import {
SearchDataDictionaryList,
EditDataDictionary,
DeleteDataDictionary,
} from '@/services/dataCenter/api';
import { useHistory } from 'react-router-dom';
import WebDic from './WebDic';
import AppDic from './AppDic';
import styles from './index.less';
// import VersionPublish from './VersionPublish';
const dictionary = () => {
const [searchData, setSearchData] = useState([]); // 搜索框表格数据
// eslint-disable-next-line react-hooks/rules-of-hooks
const [treeLoading, setTreeLoading] = useState(false);
const [searchWord, setSearchWord] = useState(''); // 关键字
const [editVisible, setEditVisible] = useState(false); // 编辑二级条目
const [editVisible1, setEditVisible1] = useState(false); // 编辑一级条目
const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级,修改/删除时设置
const history = useHistory();
const [editForm] = Form.useForm();
const [title, setTitle] = useState('');
// eslint-disable-next-line no-shadow
const { Search } = Input;
const columns2 = [
{
title: () => <span className={styles.font}>名称</span>,
dataIndex: 'nodeName',
key: 'nodeName',
width: '45%',
},
{
title: () => <span className={styles.font}></span>,
dataIndex: 'nodeValue',
key: 'nodeValue',
render: record => {
if (!record) {
return '-';
}
return record;
},
},
{
title: () => <span className={styles.font}>操作</span>,
key: 'action',
width: 100,
align: 'center',
render: record => (
<Space>
<Tooltip title="编辑">
<EditTwoTone
onClick={() => {
setSelect(record);
if (record.parentID === '-1' || record.parentID === null) {
setEditVisible1(true);
} else {
setEditVisible(true);
}
editForm.setFieldsValue({
nodeName: record.nodeName,
nodeValue: record.nodeValue,
});
}}
style={{ fontSize: '16px' }}
/>
</Tooltip>
<div onClick={e => e.stopPropagation()}>
<Tooltip title="删除">
<Popconfirm
title={title}
okText="确认"
cancelText="取消"
onConfirm={submitDelete}
placement="left"
>
<DeleteOutlined
onClick={() => {
setSelect(record);
if (record.parentID === '-1' || record.parentID === null) {
setTitle(
'确认删除一级目录数据,删除一级目录数据会将其二级目录子数据一起删除',
);
} else {
setTitle('确认删除二级条目数据');
}
}}
style={{
fontSize: '16px',
margin: '0px 10px',
color: '#e86060',
}}
/>
</Popconfirm>
</Tooltip>
</div>
</Space>
),
},
];
// 修改
const submitEdit = () => {
const nodeName = editForm.getFieldValue('nodeName');
const nodeValue = editForm.getFieldValue('nodeValue');
if (nodeName) {
EditDataDictionary({
nodeID: select.nodeID,
nodeName,
nodeValue,
}).then(res => {
if (res.code === 0) {
setEditVisible(false);
sumbitSearch();
// getData(select.parentID === '-1' ? null : select.parentID);
notification.success({
message: '提交成功',
});
// if (flag1 === 1) {
// sumbitSearch()
// }
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
});
} else {
notification.error({
message: '提交失败',
description: '名称不能为空',
});
}
};
const submitEdit1 = () => {
const nodeName = editForm.getFieldValue('nodeName');
if (nodeName) {
EditDataDictionary({
nodeID: select.nodeID,
nodeName,
nodeValue: '-',
}).then(res => {
if (res.code === 0) {
setEditVisible1(false);
sumbitSearch();
// getData(select.parentID === '-1' ? null : select.parentID);
notification.success({
message: '提交成功',
});
// if (flag1 === 1) {
// sumbitSearch()
// }
} else {
notification.error({
message: '提交失败',
description: res.msg,
});
}
});
} else {
notification.error({
message: '提交失败',
description: '名称不能为空',
});
}
};
const sumbitSearch = () => {
SearchDataDictionaryList({ key: searchWord }).then(res => {
if (res.code === 0) {
setSearchData(res.data);
}
// else {
// notification.error({
// message: '提交失败',
// description: res.message,
// })
// }
});
};
const submitDelete = () => {
console.log(select);
DeleteDataDictionary({
nodeID: select.nodeID,
})
.then(res => {
if (res.code === 0) {
// if (flag1 === 1) {
// sumbitSearch()
// }
sumbitSearch();
notification.success({
message: '删除成功',
});
} else {
notification.error({
message: '删除失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
// 获取搜索框的值
const handleSearch = e => {
setSearchWord(e.target.value);
};
const pagenation = {
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: '20',
showQuickJumper: true,
showSizeChanger: true,
};
const back = () => {
history.push({
pathname: '/dataCenter/dictionary1',
});
};
const dictionary1 = () => {
const { TabPane } = Tabs;
return (
<PageContainer className={styles.dictionaryContainer}>
<div className={styles.containerBox}>
<div className={styles.config}>
<div className={styles.title}>
<Search
style={{ width: 500, marginBottom: 25 }}
placeholder="输入关键字"
onSearch={sumbitSearch}
onChange={e => handleSearch(e)}
enterButton
value={searchWord}
/>
</div>
<div className={styles.btn}>
<Button
type="primary"
icon={<RollbackOutlined />}
onClick={() => back()}
>
返回
</Button>
</div>
</div>
<Table
size="small"
bordered
key=""
columns={columns2}
dataSource={searchData}
scroll={{ y: 'calc(100vh - 280px)' }}
pagination={pagenation}
onRow={record => ({
onClick: () => {
setSelect(record);
},
})}
/>
</div>
{/* 修改一级条目 */}
<Modal
title="修改一级条目"
visible={editVisible1}
onOk={submitEdit1}
onCancel={() => {
setEditVisible1(false);
}}
okText="确认"
cancelText="取消"
>
<Form form={editForm} labelCol={{ span: 3 }}>
<Form.Item
name="nodeName"
label="名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入名称" style={{ width: '90%' }} />
</Form.Item>
</Form>
</Modal>
{/* 修改二级条目 */}
<Modal
title="修改二级条目"
visible={editVisible}
onOk={submitEdit}
onCancel={() => {
setEditVisible(false);
}}
okText="确认"
cancelText="取消"
>
<Form form={editForm} labelCol={{ span: 3 }}>
<Form.Item
name="nodeName"
label="名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入名称" style={{ width: '90%' }} />
</Form.Item>
<Form.Item name="nodeValue" label="值">
<Input placeholder="请输入值" style={{ width: '90%' }} />
</Form.Item>
</Form>
</Modal>
<PageContainer className={styles.dictionary1Container}>
<Card>
<Tabs defaultActiveKey="1">
<TabPane tab="通用数据字典" key="1">
<WebDic />
</TabPane>
<TabPane tab="App数据字典" key="2">
<AppDic />
</TabPane>
</Tabs>
</Card>
</PageContainer>
);
};
export default dictionary;
export default dictionary1;
.dictionaryContainer{
.font {
font-weight: bold;
}
.containerBox {
width: 100vm;
height: calc(100vh - 70px) ;
background: #ffffff;
.ant-table.ant-table-small .ant-table-tbody .ant-table-wrapper:only-child .ant-table{
margin-left: 0;
}
.ant-table.ant-table-bordered > .ant-table-container{
border: none;
}
.clickRowStyle{
background: #cfe7fd;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
}
.config{
display: flex;
padding: 1rem 0 0.5rem 0.5rem;
justify-content: space-between;
width: calc(100% - 10px);
.title{
font-size: 18px;
color: rgba(0, 114, 255, 1);
font-weight: bold;
}
.btn{
display: flex;
justify-content: flex-end;
width: 20rem;
}
.ant-btn{
display: flex;
align-items: center;
margin-left: 20px;
}
}
}
\ No newline at end of file
.dictionary1Container{
.ant-card-body {
padding: 0px 24px 24px 17px;
}
}
\ No newline at end of file
/*
* @Description:
* @Author: leizhe
* @Date: 2021-07-13 16:32:28
* @LastEditTime: 2021-10-26 16:38:27
* @LastEditors: leizhe
*/
import React from 'react';
import { Tabs, Card } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import WebDic from './WebDic';
import AppDic from './AppDic';
import styles from './index.less';
// import VersionPublish from './VersionPublish';
const dictionary1 = () => {
const { TabPane } = Tabs;
return (
<PageContainer className={styles.dictionary1Container}>
<Card>
<Tabs defaultActiveKey="1">
<TabPane tab="通用数据字典" key="1">
<WebDic />
</TabPane>
<TabPane tab="App数据字典" key="2">
<AppDic />
</TabPane>
</Tabs>
</Card>
</PageContainer>
);
};
export default dictionary1;
.dictionary1Container{
.ant-card-body {
padding: 0px 24px 24px 17px;
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { Card, TreeSelect, Space, Button, Table, Input, Row, Col } from 'antd';
import PageContainer from '@/components/BasePageContainer';
import { connect } from 'react-redux';
import TestModal from './ModalComponent';
import ListCard from './ListCard';
import { get, post, CITY_SERVICE } from '../../services';
import { orgGet, orgTest } from '../../services/orgnazation/api';
import styles from './DefaultComponent.less';
const { Search } = Input;
const { TreeNode } = TreeSelect;
// const treeData = [
// {
// title: 'Node1',
// value: '0-0',
// children: [
// {
// title: 'Child Node1',
// value: '0-0-1',
// },
// {
// title: 'Child Node2',
// value: '0-0-2',
// },
// ],
// },
// {
// title: 'Node2',
// value: '0-1',
// },
// ];
const DefaultComponent = () => {
const [treeValue, setTreeValue] = useState(null); // 树节点选中的值
const [tableData, setTableData] = useState([]); // table的值
const [selectedRowKeys, setSelectedRowKeys] = useState([]); // table表格checkbox配置
const [modalVisible, setModalVisible] = useState(false); // 展示Modal弹窗
const [testPeoList, setTestPeoList] = useState([]); // 测试card数组
const [treeData, setTreeData] = useState([]);
// 树节点选中的值
const treeChange = e => {
setTreeValue(e);
};
// 用户搜索
const handleSearch = () => {
console.log('handleSearch');
setModalVisible(true);
};
// 导入
const handleImport = () => {
setModalVisible(true);
};
// 搜索框时间
const inputSearch = e => {
console.log(e, 'inputSearch');
};
const columns = [
{
title: '用户ID',
dataIndex: 'userID',
key: 'userID',
},
{
title: '登录名',
dataIndex: 'loginName',
key: 'loginName',
},
{
title: '用户姓名',
dataIndex: 'userName',
key: 'userName',
},
{
title: '手机号码',
dataIndex: 'phone',
key: 'phone',
},
{
title: '钉钉账户',
dataIndex: 'ddid',
key: 'ddid',
},
{
title: '微信账户',
dataIndex: 'wxid',
key: 'wxid',
ellipsis: true,
},
];
useEffect(() => {
orgGet().then(res => {
console.log(res, 'orgGet');
if (res) {
let arr = transTree(res);
console.log(transTree(res), 'arr');
setTreeData(arr);
}
});
}, []);
// 处理返回的树形结构
const transTree = (value, isChild = false) => {
let arr = value;
if (arr.length < 0) {
return;
}
let obj = {};
return arr.map(item => {
if (isChild) {
item.title = item.userName;
item.value = item.userID;
} else {
item.title = item.text;
item.value = item.id;
}
if (item.children && item.children.length > 0) {
transTree(item.children, false);
return (obj = item);
}
return item;
});
};
useEffect(() => {
get('${CITY_SERVICE}/OMS.svc/U_GetOneOUUserListNew', {
OUID: 24,
_version: 9999,
_dc: new Date().getTime(),
}).then(res => {
if (res.success) {
setTableData(res.root);
}
});
const testData = [];
const test2list = [];
for (let i = 1; i < 10; i++) {
testData.push({
key: i,
ID: i,
});
test2list.push({
label: `${i}测试`,
value: `${i}测试`,
});
}
console.log(test2list);
setTestPeoList(test2list);
}, []);
// table选中框的值
const selectChange = e => {
console.log(e, 'e');
setSelectedRowKeys(e);
};
const confirmModal = () => {
setModalVisible(false);
};
// table复选的配置
const rowSelection = {
selectedRowKeys,
onChange: selectChange,
};
const btnLable = [
{
label: '查找用户',
handle: handleSearch,
config: { type: 'primary', danger: true },
},
{ label: '用户导入', handle: handleImport, config: { type: 'info' } },
];
return (
<>
<PageContainer>
<Card>
<Row>
<Col span={1}>
<div style={{ height: '30px', lineHeight: '30px' }}>机构选择</div>
</Col>
<Col span={12}>
<TreeSelect
style={{ width: '50%' }}
treeData={treeData}
value={treeValue}
onChange={e => {
treeChange(e);
}}
/>
</Col>
<Col span={8} />
</Row>
<div style={{ marginTop: '20px', textAlign: 'center' }}>
<Space>
{btnLable &&
btnLable.map((item, index) => {
const { config } = item;
return (
<Button
key={index}
{...config}
onClick={() => {
item.handle &&
typeof item.handle === 'function' &&
item.handle();
}}
>
{item.label}
</Button>
);
})}
</Space>
</div>
<TestModal
title="用户选择"
visible={modalVisible}
maskClosable
onOk={() => confirmModal()}
onCancel={() => setModalVisible(false)}
bodyStyle={{ width: '100%', height: '100%' }}
style={{ top: 20 }}
width="1000px"
destroyOnClose
cancelText="取消"
okText="确认选择"
>
<ListCard optionsList={testPeoList} />
</TestModal>
</Card>
<Card className={styles.mgTop20}>
<div classNam={styles.tableTitle}>一般用户的用户列表</div>
<Table
className={styles.mgTop20}
rowSelection={rowSelection}
columns={columns}
dataSource={tableData}
bordered
rowKey="userID"
scroll={{ y: 400 }}
/>
</Card>
</PageContainer>
</>
);
};
export default connect()(DefaultComponent);
.tableTitle{
font-size: 16px;
}
.mgTop20{
margin-top: 20px !important;
}
import React, { useState, useEffect, useCallback } from 'react';
import { Spin, Button } from 'antd';
import ListCardItem from './listCardItem';
import { get, post, CITY_SERVICE } from '../../services';
import styles from './listCardItem.less';
const tip = 'loading...';
const ListCard = props => {
const {
ouid,
searchWord,
valueCallback,
onCommit = () => {},
btnLoading = false,
} = props;
const [valueList, setValueList] = useState({});
const [dataList, setdataList] = useState([]);
const [loading, setLoading] = useState(true);
const getValueCallback = useCallback((value, index) => {
valueList[index] = value;
setValueList({ ...valueList });
valueCallback({ ...valueList });
}, []);
useEffect(() => {
setLoading(true);
const defaultConfig = {
optionsList: [],
title: '默认组',
id: '',
};
// ${CITY_SERVICE}/OMS.svc/U_GetUserListForBatchOper
get(`${CITY_SERVICE}/OMS.svc/P_GetUserByStation`, {
// OUID:ouid||'',
stationID: ouid || '',
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
setLoading(false);
const list = [];
// eslint-disable-next-line no-unused-expressions
res &&
res.forEach(item => {
list.push({ ...defaultConfig, ...item });
});
setdataList(list);
})
.catch(err => {
console.error(err);
setLoading(false);
});
}, [ouid]);
return (
<div>
{loading ? (
<Spin
size="large"
spinning={loading}
tip={tip}
style={{
position: 'absolute',
top: '30%',
left: '0',
right: '0',
bottom: '0',
}}
/>
) : (
dataList &&
dataList.length > 0 &&
dataList.map((item, index) => (
<ListCardItem
{...item}
itemid={index}
key={`item${index}key`}
getValueCallback={getValueCallback}
searchWord={searchWord}
{...props}
/>
))
)}
{true && !loading && dataList && (
<div className={styles.btnBox}>
<Button
type="primary"
onClick={() => onCommit()}
loading={btnLoading}
>
提交
</Button>
</div>
)}
</div>
);
};
export default ListCard;
import React from 'react'
import {
Modal
} from 'antd'
const CardModal = (props) =>{
console.log(props)
const defaultCofig = {
title:'测试',
visible:false,
}
const config = { ...defaultCofig, ...props}
return (
<Modal
{...config}
style={{width:"1000px"}}
>
{props.children}
</Modal>
)
}
export default CardModal
\ No newline at end of file
import React,{ useState, useEffect, } from 'react'
import {
Card,
Input,
Button
} from 'antd';
import PageContainer from '@/components/BasePageContainer';
import { connect } from 'react-redux';
import ProTable from '@ant-design/pro-table';
import { get, post } from '../../services';
const TestTable = ()=> {
const [data,setData] = useState([])
//搜索框时间
useEffect(() =>{
get(`/Cityinterface/rest/services/OMS.svc/S_GetConnRecord`, {
_version: 9999,
dc: 1603334559186,
}).then( res =>{
if(res){
setData(res)
}
console.log(res)
}).catch( err =>{
console.error(err)
})
},[])
const columns = [
{
title: '服务器名或IP地址',
dataIndex: 'ip',
key: 'ip',
},
{
title: '数据库名称',
dataIndex: 'dbName',
key: 'dbName',
},
{
title: '数据库用户名称',
dataIndex: 'userName',
key: 'userName',
},
{
title: '保存时间',
dataIndex: 'saveTime',
key: 'saveTime',
},
{
title: '描述',
dataIndex: 'desc',
key: 'desc',
},
{
title: '修改描述',
dataIndex: 'name',
key: 'name',
filters:true,
valueType: 'dateTime'
// render: () => {
// return <Button type='primary' onClick={ ()=>{changeDesc()}}>修改描述</Button>;
// },
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
render: (_, record) => (
<>
<Button
>
修改描述
</Button>
<Button href="">删除</Button>
</>
),
},
];
return (
<>
<PageContainer>
<Card></Card>
<ProTable
style={{marginTop:'20px'}}
headerTitle='表格'
rowKey="key"
search={{labelWidth:100}}
columns={columns}
bordered
dataSource={data}
/>
</PageContainer>
</>
)
}
export default connect()(TestTable)
\ No newline at end of file
......@@ -21,9 +21,9 @@ import v from 'voca';
import { UsergroupDeleteOutlined, IdcardOutlined } from '@ant-design/icons';
import moment from 'moment';
import { useHistory } from 'react-router-dom';
import VisibleRoleModal from '../messageManage/projectManage/components/RolseSelect/VisibleRoleModal';
import VisibleIISAgentConfig from '../messageManage/projectManage/components/IISAgentConfig/VisibleIISAgentConfig';
import RoleModal from '../messageManage/projectManage/components/RolseSelect/RoleModal';
import VisibleRoleModal from '../projectManage/components/RolseSelect/VisibleRoleModal';
import VisibleIISAgentConfig from '../projectManage/components/IISAgentConfig/VisibleIISAgentConfig';
import RoleModal from '../projectManage/components/RolseSelect/RoleModal';
import {
GetMessageTemplate,
UpdateMessageConfig,
......@@ -70,8 +70,7 @@ const EditModal = props => {
},
{
title: '工单办理',
desc:
'在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。',
desc: '在工单系统中,针对特定人员的通知,包括工作办理、审核、会签、回退等操作。',
},
{
title: '平台公告',
......@@ -117,10 +116,7 @@ const EditModal = props => {
console.log('template', template);
console.log(template.WorkWeiXinTemplateId);
let aa;
if (
template.WorkWeiXinTemplateId == null ||
template.WorkWeiXinTemplateId === ''
) {
if (template.WorkWeiXinTemplateId == null || template.WorkWeiXinTemplateId === '') {
aa = '';
} else {
// eslint-disable-next-line radix
......@@ -131,14 +127,11 @@ const EditModal = props => {
name: template.MsgType,
isStart: template.IsStarted === '0' ? '关闭' : '开启',
to_person: template.PushGroup,
push_mode:
template.PushMode === null ? '' : template.PushMode.split(','),
push_mode: template.PushMode === null ? '' : template.PushMode.split(','),
app_template: template.AppTemplateID,
app_path: template.AppFunctionPath,
wx_template: template.PublicTemplateID
? parseInt(template.PublicTemplateID)
: '',
wx_template: template.PublicTemplateID ? parseInt(template.PublicTemplateID) : '',
h5_path: template.PublicPath,
miniprogram_path: template.MiniAppRoute,
web_template: template.WebTemplateID,
......@@ -150,25 +143,14 @@ const EditModal = props => {
setBtnType(template.type);
setIsUse(template.IsStarted);
setCurrentTrench({
isAPPShow: !!(
template.PushMode &&
template.PushMode.split(',').indexOf('平台弹框') > -1
),
isWXShow: !!(
template.PushMode &&
template.PushMode.split(',').indexOf('公众号推送') > -1
),
isWEBShow: !!(
template.PushMode &&
template.PushMode.split(',').indexOf('平台弹框') > -1
),
isAPPShow: !!(template.PushMode && template.PushMode.split(',').indexOf('平台弹框') > -1),
isWXShow: !!(template.PushMode && template.PushMode.split(',').indexOf('公众号推送') > -1),
isWEBShow: !!(template.PushMode && template.PushMode.split(',').indexOf('平台弹框') > -1),
isMessageShow: !!(
template.PushMode &&
template.PushMode.split(',').indexOf('短信推送') > -1
template.PushMode && template.PushMode.split(',').indexOf('短信推送') > -1
),
isEnterpriseWXShow: !!(
template.PushMode &&
template.PushMode.split(',').indexOf('企业微信推送') > -1
template.PushMode && template.PushMode.split(',').indexOf('企业微信推送') > -1
),
});
} else {
......@@ -443,11 +425,7 @@ const EditModal = props => {
<div style={{ display: 'flex', alignItems: 'center' }}>
<Item labelCol={{ span: 6 }}>
<div style={{ display: 'flex' }}>
<Item
label="推送组"
name="to_person"
style={{ marginTop: '50px' }}
>
<Item label="推送组" name="to_person" style={{ marginTop: '50px' }}>
<Input disabled />
</Item>
<IdcardOutlined
......@@ -512,16 +490,8 @@ const EditModal = props => {
/>
</div>
<div className={styles.card_body}>
<Item
label="模板"
labelAlign="left"
name="app_template"
labelCol={{ span: 3 }}
>
<Select
style={{ width: '97%' }}
disabled={!currentTrench.isAPPShow}
>
<Item label="模板" labelAlign="left" name="app_template" labelCol={{ span: 3 }}>
<Select style={{ width: '97%' }} disabled={!currentTrench.isAPPShow}>
{APP_ITEMS.map((item, idx) => (
<Select.Option value={item.Id} key={idx}>
{item.LikeName}
......@@ -529,12 +499,7 @@ const EditModal = props => {
))}
</Select>
</Item>
<Item
label="功能路径"
name="app_path"
labelAlign="left"
labelCol={{ span: 3 }}
>
<Item label="功能路径" name="app_path" labelAlign="left" labelCol={{ span: 3 }}>
<TextArea
rows={4}
style={{ width: '97%' }}
......@@ -555,16 +520,8 @@ const EditModal = props => {
/>
</div>
<div className={styles.card_body}>
<Item
label="模板"
name="wx_template"
labelAlign="left"
labelCol={{ span: 4 }}
>
<Select
style={{ width: '97%' }}
disabled={!currentTrench.isWXShow}
>
<Item label="模板" name="wx_template" labelAlign="left" labelCol={{ span: 4 }}>
<Select style={{ width: '97%' }} disabled={!currentTrench.isWXShow}>
{WX_ITEMS.map((item, idx) => (
<Select.Option value={item.Id} key={idx}>
{item.LikeName}
......@@ -572,12 +529,7 @@ const EditModal = props => {
))}
</Select>
</Item>
<Item
label="H5路由"
name="h5_path"
labelAlign="left"
labelCol={{ span: 4 }}
>
<Item label="H5路由" name="h5_path" labelAlign="left" labelCol={{ span: 4 }}>
<Input
style={{ width: '97%' }}
disabled={!currentTrench.isWXShow}
......@@ -609,16 +561,8 @@ const EditModal = props => {
/>
</div>
<div className={styles.card_body}>
<Item
label="模板"
name="web_template"
labelCol={{ span: 3 }}
labelAlign="left"
>
<Select
style={{ width: '97%' }}
disabled={!currentTrench.isWEBShow}
>
<Item label="模板" name="web_template" labelCol={{ span: 3 }} labelAlign="left">
<Select style={{ width: '97%' }} disabled={!currentTrench.isWEBShow}>
{WEB_ITEMS.map((item, idx) => (
<Select.Option value={item.Id} key={idx}>
{item.LikeName}
......@@ -626,12 +570,7 @@ const EditModal = props => {
))}
</Select>
</Item>
<Item
label="功能路径"
name="web_path"
labelAlign="left"
labelCol={{ span: 3 }}
>
<Item label="功能路径" name="web_path" labelAlign="left" labelCol={{ span: 3 }}>
<TextArea
rows={4}
style={{ width: '97%' }}
......@@ -659,10 +598,7 @@ const EditModal = props => {
name="message_template"
labelCol={{ span: 2 }}
>
<Select
style={{ width: '97%' }}
disabled={!currentTrench.isMessageShow}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isMessageShow}>
{MES_ITEMS.map((item, idx) => (
<Select.Option value={item.Id} key={idx}>
{item.LikeName}
......@@ -690,10 +626,7 @@ const EditModal = props => {
name="enterprise_template"
labelCol={{ span: 2 }}
>
<Select
style={{ width: '97%' }}
disabled={!currentTrench.isEnterpriseWXShow}
>
<Select style={{ width: '97%' }} disabled={!currentTrench.isEnterpriseWXShow}>
{EN_ITEMS.map((item, idx) => (
<Select.Option value={item.Id} key={idx}>
{item.LikeName}
......@@ -707,11 +640,7 @@ const EditModal = props => {
</div>
</div>
<Item {...tailLayout} style={{ marginTop: '1rem' }}>
<Button
htmlType="button"
onClick={back}
style={{ marginRight: '2rem' }}
>
<Button htmlType="button" onClick={back} style={{ marginRight: '2rem' }}>
返回
</Button>
<Button type="primary" htmlType="submit">
......
import React, { useState, useEffect } from 'react';
import { Form, Select, Input, Button, Radio, notification, Spin } from 'antd';
import {
editWebsite,
getWebsite,
addWebsite,
} from '@/services/mobileConfig/api';
import { editWebsite, getWebsite, addWebsite } from '@/services/mobileConfig/api';
import PicturesWall from '@/components/Upload/index';
const { Item } = Form;
const { Option } = Select;
const SiteConfig = props => {
const {
miniTitle,
submitCallback,
addCallback,
parentKey,
clientName,
} = props;
const { miniTitle, submitCallback, addCallback, parentKey, clientName } = props;
const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([
{ text: '默认界面', value: 'default' },
]); // 系统登陆页
const [loginList, setLoginList] = useState([{ text: '默认界面', value: 'default' }]); // 系统登陆页
const [styleList, setStyleList] = useState([
{ text: '熊猫产品', value: 'default' },
{ text: '通用项目', value: 'project' },
]); // 系统风格
const [themeList, setThemeList] = useState([
{ text: '默认皮肤', value: 'default' },
]); // 系统皮肤
const [themeList, setThemeList] = useState([{ text: '默认皮肤', value: 'default' }]); // 系统皮肤
const [loading, setLoading] = useState(false);
const [form] = Form.useForm();
const layout = {
......
import React, { useState, useEffect } from 'react';
import { Form, Select, Input, Button, Radio, notification, Spin } from 'antd';
import {
editWebsite,
getWebsite,
addWebsite,
} from '@/services/mobileConfig/api';
import { editWebsite, getWebsite, addWebsite } from '@/services/mobileConfig/api';
import PicturesWall from '@/components/Upload/index';
const { Item } = Form;
const { Option } = Select;
......@@ -12,16 +8,12 @@ const AddConfig = props => {
const { miniTitle, submitCallback, subType, addCallback, singleList } = props;
console.log(subType, 'ubType');
const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([
{ text: '默认界面', value: 'default' },
]); // 系统登陆页
const [loginList, setLoginList] = useState([{ text: '默认界面', value: 'default' }]); // 系统登陆页
const [styleList, setStyleList] = useState([
{ text: '熊猫产品', value: 'default' },
{ text: '通用项目', value: 'project' },
]); // 系统风格
const [themeList, setThemeList] = useState([
{ text: '默认皮肤', value: 'default' },
]); // 系统皮肤
const [themeList, setThemeList] = useState([{ text: '默认皮肤', value: 'default' }]); // 系统皮肤
const [clientList, setClientList] = useState([
{ text: 'miniapp', value: 'miniapp' },
{ text: '手持系统', value: '手持系统' },
......@@ -41,10 +33,7 @@ const AddConfig = props => {
form.validateFields().then(valid => {
if (valid) {
if (
singleList.some(
item =>
item.text === valid.title || item.id.slice(6) === valid.client,
)
singleList.some(item => item.text === valid.title || item.id.slice(6) === valid.client)
) {
notification.error({
message: '提示',
......
import React, { useState, useEffect, useMemo } from 'react';
import {
Card,
Tabs,
Button,
Popconfirm,
notification,
Spin,
Modal,
Drawer,
} from 'antd';
import { Card, Tabs, Button, Popconfirm, notification, Spin, Modal, Drawer } from 'antd';
import ProCard from '@ant-design/pro-card';
import PageContainer from '@/components/BasePageContainer';
import SevenParams from './menuconfig/SevenParams';
import VersionPublish from './menuconfig/VersionPublish';
import {
getMiniAppModuleTree,
deleteWebsite,
deleteMiniMenu,
} from '@/services/mobileConfig/api';
import { getMiniAppModuleTree, deleteWebsite, deleteMiniMenu } from '@/services/mobileConfig/api';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import SiteConfig from './SiteConfig';
import MiniMenu from './menuconfig/miniMenu';
......@@ -44,8 +31,7 @@ const MobileConfigPage = props => {
setLoading(false);
if (res.code === 0) {
const { data } = res;
let array =
(data[0].children.length > 0 && [...data[0].children]) || [];
let array = (data[0].children.length > 0 && [...data[0].children]) || [];
let arr = [];
array.map(item => {
arr.push({
......@@ -208,13 +194,7 @@ const MobileConfigPage = props => {
{
title: '菜单管理',
key: '1',
component: (
<MiniMenu
clientName={clientName}
userMode={userMode}
parentKey={parentKey}
/>
),
component: <MiniMenu clientName={clientName} userMode={userMode} parentKey={parentKey} />,
},
{
title: '应用配置',
......
......@@ -4,7 +4,7 @@ import {
getSevenParams,
getSevenParamsByTransType,
postSevenParams,
} from '../../../services/appConfig/api';
} from '@/services/appConfig/api';
import styles from './otherConfig.less';
const SevenParams = props => {
......@@ -80,59 +80,23 @@ const SevenParams = props => {
if (transType === '3') {
sevenFormData.append('x_off', sevenForm.getFieldValue('x_off'));
sevenFormData.append('y_off', sevenForm.getFieldValue('y_off'));
sevenFormData.append(
'seven_x_off',
sevenForm.getFieldValue('seven_x_off'),
);
sevenFormData.append(
'seven_y_off',
sevenForm.getFieldValue('seven_y_off'),
);
sevenFormData.append(
'seven_z_off',
sevenForm.getFieldValue('seven_z_off'),
);
sevenFormData.append(
'seven_x_angle',
sevenForm.getFieldValue('seven_x_angle'),
);
sevenFormData.append(
'seven_y_angle',
sevenForm.getFieldValue('seven_y_angle'),
);
sevenFormData.append(
'seven_z_angle',
sevenForm.getFieldValue('seven_z_angle'),
);
sevenFormData.append('seven_x_off', sevenForm.getFieldValue('seven_x_off'));
sevenFormData.append('seven_y_off', sevenForm.getFieldValue('seven_y_off'));
sevenFormData.append('seven_z_off', sevenForm.getFieldValue('seven_z_off'));
sevenFormData.append('seven_x_angle', sevenForm.getFieldValue('seven_x_angle'));
sevenFormData.append('seven_y_angle', sevenForm.getFieldValue('seven_y_angle'));
sevenFormData.append('seven_z_angle', sevenForm.getFieldValue('seven_z_angle'));
sevenFormData.append('seven_m', sevenForm.getFieldValue('seven_m'));
}
if (transType === '4') {
sevenFormData.append('x_off', sevenForm.getFieldValue('x_off'));
sevenFormData.append('y_off', sevenForm.getFieldValue('y_off'));
sevenFormData.append(
'seven_x_off',
sevenForm.getFieldValue('seven_x_off'),
);
sevenFormData.append(
'seven_y_off',
sevenForm.getFieldValue('seven_y_off'),
);
sevenFormData.append(
'seven_z_off',
sevenForm.getFieldValue('seven_z_off'),
);
sevenFormData.append(
'seven_x_angle',
sevenForm.getFieldValue('seven_x_angle'),
);
sevenFormData.append(
'seven_y_angle',
sevenForm.getFieldValue('seven_y_angle'),
);
sevenFormData.append(
'seven_z_angle',
sevenForm.getFieldValue('seven_z_angle'),
);
sevenFormData.append('seven_x_off', sevenForm.getFieldValue('seven_x_off'));
sevenFormData.append('seven_y_off', sevenForm.getFieldValue('seven_y_off'));
sevenFormData.append('seven_z_off', sevenForm.getFieldValue('seven_z_off'));
sevenFormData.append('seven_x_angle', sevenForm.getFieldValue('seven_x_angle'));
sevenFormData.append('seven_y_angle', sevenForm.getFieldValue('seven_y_angle'));
sevenFormData.append('seven_z_angle', sevenForm.getFieldValue('seven_z_angle'));
sevenFormData.append('seven_m', sevenForm.getFieldValue('seven_m'));
sevenFormData.append('four_x_off', sevenForm.getFieldValue('four_x_off'));
sevenFormData.append('four_y_off', sevenForm.getFieldValue('four_y_off'));
......@@ -144,30 +108,12 @@ const SevenParams = props => {
sevenFormData.append('y_off', sevenForm.getFieldValue('y_off'));
}
if (transType === '6') {
sevenFormData.append(
'seven_x_off',
sevenForm.getFieldValue('seven_x_off'),
);
sevenFormData.append(
'seven_y_off',
sevenForm.getFieldValue('seven_y_off'),
);
sevenFormData.append(
'seven_z_off',
sevenForm.getFieldValue('seven_z_off'),
);
sevenFormData.append(
'seven_x_angle',
sevenForm.getFieldValue('seven_x_angle'),
);
sevenFormData.append(
'seven_y_angle',
sevenForm.getFieldValue('seven_y_angle'),
);
sevenFormData.append(
'seven_z_angle',
sevenForm.getFieldValue('seven_z_angle'),
);
sevenFormData.append('seven_x_off', sevenForm.getFieldValue('seven_x_off'));
sevenFormData.append('seven_y_off', sevenForm.getFieldValue('seven_y_off'));
sevenFormData.append('seven_z_off', sevenForm.getFieldValue('seven_z_off'));
sevenFormData.append('seven_x_angle', sevenForm.getFieldValue('seven_x_angle'));
sevenFormData.append('seven_y_angle', sevenForm.getFieldValue('seven_y_angle'));
sevenFormData.append('seven_z_angle', sevenForm.getFieldValue('seven_z_angle'));
sevenFormData.append('seven_m', sevenForm.getFieldValue('seven_m'));
sevenFormData.append('x_off', sevenForm.getFieldValue('x_off'));
sevenFormData.append('y_off', sevenForm.getFieldValue('y_off'));
......@@ -246,11 +192,7 @@ const SevenParams = props => {
>
<Input placeholder="请输入中央经线" />
</Form.Item>
<Form.Item
name="rev"
label="rev"
rules={[{ required: true, message: '不能为空' }]}
>
<Form.Item name="rev" label="rev" rules={[{ required: true, message: '不能为空' }]}>
<Input placeholder="请输入rev" />
</Form.Item>
{(transType === '1' || transType === '2') && (
......@@ -263,10 +205,7 @@ const SevenParams = props => {
</Form.Item>
</>
)}
{(transType === '1' ||
transType === '3' ||
transType === '5' ||
transType === '6') && (
{(transType === '1' || transType === '3' || transType === '5' || transType === '6') && (
<>
<Form.Item name="x_off" label="x_off">
<Input placeholder="请输入x坐标平移量" />
......
......@@ -149,8 +149,7 @@ export default props => {
getMobileFiles({ client: clientName }).then(res => {
if (res.code === 0) {
const { data } = res;
let fileName =
data.apkPath.split('\\')[data.apkPath.split('\\').length - 1] || '';
let fileName = data.apkPath.split('\\')[data.apkPath.split('\\').length - 1] || '';
let apkUrl = `${hurl}/${data.apkPath.replace(/\\/g, '/')}` || '';
setFileData({
...data,
......@@ -170,9 +169,7 @@ export default props => {
<p className={styles.title}>apk版本管理:</p>
<div className={styles.row}>
<div className={styles.label}>当前包名:</div>
<div className="value">
{fileData.fileName || '未找到对应的包名'}
</div>
<div className="value">{fileData.fileName || '未找到对应的包名'}</div>
</div>
<div className={styles.row}>
<div className={styles.label}>更新时间:</div>
......@@ -218,9 +215,7 @@ export default props => {
<Spin spinning={progress} tip="loading...">
<BaseForm items={items} getForm={handleGetForm} />
<div className={styles.row}>
<div className={`${styles.label2} ${styles.required}`}>
apk文件:
</div>
<div className={`${styles.label2} ${styles.required}`}>apk文件:</div>
<input
ref={f => {
fileEntity.current = f;
......
import React, { useState, useEffect } from 'react';
import {
Card,
List,
Drawer,
Button,
Empty,
Spin,
notification,
Switch,
message,
} from 'antd';
import {
modifyProduct,
getProductList,
delProductList,
} from '@/services/webConfig/api';
import { Card, List, Drawer, Button, Empty, Spin, notification, Switch, message } from 'antd';
import { modifyProduct, getProductList, delProductList } from '@/services/webConfig/api';
import classnames from 'classnames';
import AddForm from './components/productForm';
import EditForm from './components/editForm';
import styles from './productConfig.less';
const ProductConfig = props => {
......@@ -180,9 +166,7 @@ const ProductConfig = props => {
}}
/>
</div>
<span className={classnames({ [styles.itemspan]: true })}>
{item.ProductName}
</span>
<span className={classnames({ [styles.itemspan]: true })}>{item.ProductName}</span>
</List.Item>
));
return (
......@@ -201,19 +185,12 @@ const ProductConfig = props => {
{productList && productList.length > 0 ? (
<List>{renderListItem(productList)}</List>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无数据" />
)}
</Card>
<Card className={styles.rightForm}>
{productList && productList.length > 0 && productObj ? (
<EditForm
productObj={productObj}
editCallback={editCallback}
handleDel={handleDel}
/>
<EditForm productObj={productObj} editCallback={editCallback} handleDel={handleDel} />
) : (
<Empty
style={{ marginTop: '60px' }}
......
......@@ -22,7 +22,7 @@ import SiteConfig from './components/siteConfigDrawer';
import { appConnector } from '@/containers/App/store';
import { defaultWebConfigObj, webMode } from './utils';
import MenuConfig from './menuconfig/MenuConfig';
import ProductConfig from './productConfig';
const { TabPane } = Tabs;
const WebConfigPage = props => {
......
import React, { useState } from 'react';
import { Form, Input, Button, Space, Select, Col } from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import { get, post } from '../../services';
const methods = [{ label: 'get', value: 'get' }, { label: 'post', value: 'post' }];
const RequestTest = () => {
const [protocal, setprotocal] = useState('http://');
const [form] = Form.useForm();
const onFinish = values => {
const url = protocal + values.url;
const methodMap = { get, post };
const { method } = values;
const params =
values.params &&
values.params.reduce((param, { key, value }) => {
// eslint-disable-next-line no-param-reassign
param[key.trim()] = value.trim();
return param;
}, {});
if (window.location.host === values.url) {
methodMap[method](url, params).catch(err => {
// eslint-disable-next-line no-console
console.error(err);
});
} else {
const proxyUrl = url.replace(
// eslint-disable-next-line no-useless-escape
/^https?:\/\/([^\/]+)/,
() => `${window.location.origin}`,
);
methodMap[method](proxyUrl, params).catch(err => {
// eslint-disable-next-line no-console
console.error(err);
});
}
};
const handleProtoSelectChange = v => {
setprotocal(v);
};
const protocalBefore = (
<Select defaultValue="http://" className="select-before" onChange={handleProtoSelectChange}>
<Select.Option value="http://">http://</Select.Option>
<Select.Option value="https://">https://</Select.Option>
</Select>
);
const formItemLayout = {
labelCol: { span: 6 },
wrapperCol: { span: 14 },
};
const paramItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 24 },
};
return (
<Form
form={form}
name="dynamic_form_nest_item"
onFinish={onFinish}
{...formItemLayout}
autoComplete="off"
>
<Form.Item
name="url"
label="url"
rules={[{ required: true, message: 'Missing url' }]}
initialValue={window.location.host}
>
<Input addonBefore={protocalBefore} />
</Form.Item>
<Form.Item
name="method"
label="method"
rules={[{ required: true, message: 'Missing method' }]}
initialValue="get"
>
<Select options={methods} />
</Form.Item>
<Form.List name="params">
{(fields, { add, remove }) => (
<>
{fields.map(field => (
<Col span={14} offset={5} key={field.key}>
<Space align="start">
<Form.Item
{...field}
label="key"
name={[field.name, 'key']}
fieldKey={[field.fieldKey, 'key']}
{...paramItemLayout}
rules={[{ required: true, message: 'Missing key' }]}
>
<Input />
</Form.Item>
<Form.Item
{...field}
label="value"
{...paramItemLayout}
fieldKey={[field.fieldKey, 'value']}
name={[field.name, 'value']}
>
<Input />
</Form.Item>
<MinusCircleOutlined onClick={() => remove(field.name)} />
</Space>
</Col>
))}
<Form.Item
wrapperCol={{
span: 14,
offset: 5,
}}
>
<Button
type="dashed"
onClick={() => {
add();
}}
block
>
<PlusOutlined /> Add params
</Button>
</Form.Item>
</>
)}
</Form.List>
<Form.Item wrapperCol={{ span: 5, offset: 10 }}>
<Button type="primary" htmlType="submit" block>
Submit
</Button>
</Form.Item>
</Form>
);
};
export default RequestTest;
import React, { useState, useCallback, useEffect } from 'react';
import {
Modal,
Spin,
Tabs,
notification,
message,
Checkbox,
Divider,
} from 'antd';
import { Modal, Spin, Tabs, notification, message, Checkbox, Divider } from 'antd';
import {
SetUserRelationList,
setUserRelation,
setUserRelations,
} from '@/services/userCenter/userManage/api';
import ListCardItem from '../../orgnazation/listCardItem';
import ListCardItem from './components/listCardItem';
const CheckboxGroup = Checkbox.Group;
const RelateRoleModal = props => {
......
......@@ -202,9 +202,7 @@ const UserManage = () => {
if (record) {
return (
<Tooltip title={record}>
<span style={{ color: '#50aefc', cursor: 'pointer' }}>
已绑定
</span>
<span style={{ color: '#50aefc', cursor: 'pointer' }}>已绑定</span>
</Tooltip>
);
}
......@@ -220,9 +218,7 @@ const UserManage = () => {
if (record) {
return (
<Tooltip title={record}>
<span style={{ color: '#50aefc', cursor: 'pointer' }}>
已绑定
</span>
<span style={{ color: '#50aefc', cursor: 'pointer' }}>已绑定</span>
</Tooltip>
);
}
......@@ -256,10 +252,7 @@ const UserManage = () => {
/>
</Tooltip>
<Tooltip title="编辑用户">
<EditTwoTone
onClick={() => editUser(record)}
style={{ fontSize: '16px' }}
/>
<EditTwoTone onClick={() => editUser(record)} style={{ fontSize: '16px' }} />
</Tooltip>
{(record.state == 0 || record.state == null) && (
<>
......@@ -270,9 +263,7 @@ const UserManage = () => {
title={
<p>
即将冻结用户{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认冻结?
</p>
}
......@@ -280,9 +271,7 @@ const UserManage = () => {
cancelText="取消"
onConfirm={() => freezeUser(record)}
>
<StopOutlined
style={{ fontSize: '16px', color: '#e86060' }}
/>
<StopOutlined style={{ fontSize: '16px', color: '#e86060' }} />
</Popconfirm>
</Tooltip>
</>
......@@ -296,9 +285,7 @@ const UserManage = () => {
title={
<p>
即将解冻用户{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认解冻?
</p>
}
......@@ -306,9 +293,7 @@ const UserManage = () => {
cancelText="取消"
onConfirm={() => freezeUser(record)}
>
<UserOutlined
style={{ fontSize: '16px', color: '#1890ff' }}
/>
<UserOutlined style={{ fontSize: '16px', color: '#1890ff' }} />
</Popconfirm>
</Tooltip>
</>
......@@ -348,9 +333,7 @@ const UserManage = () => {
title={
<p>
即将删除用户{' '}
<span className={styles.redText}>
{voca.stripTags(record.loginName)}
</span>
<span className={styles.redText}>{voca.stripTags(record.loginName)}</span>
,是否确认删除?
</p>
}
......@@ -370,10 +353,7 @@ const UserManage = () => {
const searchStyle = val => {
let n;
if (showSearchStyle) {
n = val.replace(
new RegExp(searchWord, 'g'),
`<span style='color:red'>${searchWord}</span>`,
);
n = val.replace(new RegExp(searchWord, 'g'), `<span style='color:red'>${searchWord}</span>`);
} else {
n = val;
}
......@@ -637,8 +617,7 @@ const UserManage = () => {
item.OUName = orgObj.GroupName;
return item;
});
if (orgObj.Childs.length > 0)
result = [...result, ...orgObj.Childs.map(o => getUsers(o))];
if (orgObj.Childs.length > 0) result = [...result, ...orgObj.Childs.map(o => getUsers(o))];
return result;
};
const flatten = arr => {
......@@ -749,9 +728,7 @@ const UserManage = () => {
if (res.code === 0) {
// 重新获取用户表
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
currentSelectOrg === '-1' ? submitSearchUser() : onSelect([currentSelectOrg]);
notification.success({
message: '提交成功',
duration: 2,
......@@ -784,9 +761,7 @@ const UserManage = () => {
duration: 2,
});
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
currentSelectOrg === '-1' ? submitSearchUser() : onSelect([currentSelectOrg]);
} else {
notification.error({
message: '提交失败',
......@@ -1167,9 +1142,7 @@ const UserManage = () => {
duration: 2,
});
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
currentSelectOrg === '-1' ? submitSearchUser() : onSelect([currentSelectOrg]);
} else {
notification.error({
message: '提交失败',
......@@ -1194,9 +1167,7 @@ const UserManage = () => {
});
// 重新获取用户表,查找用户时currentSelectOrg为'-1',无需跳转
// eslint-disable-next-line no-unused-expressions
currentSelectOrg === '-1'
? submitSearchUser()
: onSelect([currentSelectOrg]);
currentSelectOrg === '-1' ? submitSearchUser() : onSelect([currentSelectOrg]);
} else {
notification.error({
message: '提交失败',
......@@ -1287,8 +1258,7 @@ const UserManage = () => {
const dropKey = infos.node.key;
const dragKey = infos.dragNode.key;
const dropPos = infos.node.pos.split('-');
const dropPosition =
infos.dropPosition - Number(dropPos[dropPos.length - 1]);
const dropPosition = infos.dropPosition - Number(dropPos[dropPos.length - 1]);
const datas = JSON.parse(JSON.stringify(treeData));
console.log(dropKey, 'dropKey');
......@@ -1366,11 +1336,7 @@ const UserManage = () => {
<Menu.Item key="4" onClick={deleteOrg} icon={<DeleteOutlined />}>
删除当前机构
</Menu.Item>
<Menu.Item
key="5"
onClick={EditOrgScope}
icon={<BorderlessTableOutlined />}
>
<Menu.Item key="5" onClick={EditOrgScope} icon={<BorderlessTableOutlined />}>
编辑机构范围
</Menu.Item>
</Menu>
......@@ -1426,13 +1392,9 @@ const UserManage = () => {
}}
/>
</Tooltip>
<hr
style={{ width: '95%', color: '#eeecec', marginLeft: '15px' }}
/>
<hr style={{ width: '95%', color: '#eeecec', marginLeft: '15px' }} />
{treeData.length > 0 && (
<div
style={{ height: 'calc(100vh - 130px)', overflowY: 'scroll' }}
>
<div style={{ height: 'calc(100vh - 130px)', overflowY: 'scroll' }}>
<Tree
showIcon="true"
blockNode
......@@ -1471,9 +1433,7 @@ const UserManage = () => {
<div style={{ height: '50px' }}>
<span
className={styles.title}
title={`${orgTitle}(已选${
selectedRowKeys.length
}/共${tableLength}人)`}
title={`${orgTitle}(已选${selectedRowKeys.length}/共${tableLength}人)`}
>
{orgTitle}(已选{selectedRowKeys.length}/共{tableLength}人
</span>
......@@ -1514,8 +1474,7 @@ const UserManage = () => {
scroll={{ x: 'max-content', y: 'calc(100vh - 210px)' }}
// scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 20,
showQuickJumper: true,
......
......@@ -6,67 +6,64 @@ import {
SettingOutlined,
HomeOutlined,
SolutionOutlined,
// AndroidOutlined,
// CommentOutlined,
TableOutlined,
CopyOutlined,
} from '@ant-design/icons';
import UserLayout from '../layouts/UserLayout';
import Login from '../pages/user/login';
import BasicLayout from '../layouts/BasicLayout';
import BlankLayout from '../layouts/BlankLayout';
import RequestTest from '../pages/testPages/request';
import InitDataBase from '../pages/database/InitDataBase';
import ManagementDataBase from '../pages/database/ManagementDataBase';
import DatabaseConnectConfig from '@/pages/database/databaseConfig/DatabaseConfig';
// 菜单
import UserLayout from '@/layouts/UserLayout';
import BasicLayout from '@/layouts/BasicLayout';
import BlankLayout from '@/layouts/BlankLayout';
// 登录
import Login from '@/pages/user/login';
// 解决方案管理
import CurrentSolution from '@/pages/currentSolution/CurrentSolution';
import UserManage from '../pages/userCenter/userManage/UserManage';
// 数据库管理
import InitDataBase from '@/pages/database/InitDataBase/InitDataBase';
import ManagementDataBase from '@/pages/database/ManagementDataBase/ManagementDataBase';
import DatabaseConnectConfig from '@/pages/database/databaseConfig/DatabaseConfig';
// 用户中心
import UserManage from '@/pages/userCenter/userManage/UserManage';
import RoleManage from '@/pages/userCenter/roleManage/RoleManage';
import SiteManage from '../pages/userCenter/siteManage/SiteManage';
import SiteManage from '@/pages/userCenter/siteManage/SiteManage';
// 数据中心
import Dictionary from '@/pages/dataCenter/dictionary';
import Dictionary from '../pages/dataCenter/dictionary';
import Dictionary1 from '../pages/dataCenter/dictionary1';
// import Search from '../pages/dataCenter/search';
import ServiceLog from '../pages/log/serviceLog';
import LoginLog from '../pages/log/loginLog';
import OmsLog from '../pages/log/omsLog';
// import DefaultComponent from '../pages/orgnazation/DefaultComponent';
import TestTable from '../pages/orgnazation/TestTable';
import WebConfigPage from '@/pages/webConfig';
// import AppConfigPage from '@/pages/appConfig';
import MobileConfigPage from '@/pages/mobileConfig';
import ProductConfig from '@/pages/webConfig/productConfig';
import { USER_MODE } from '@/utils/constants';
// 组态平台
import BaseFrameContainer from '@/components/BaseFrameContainer';
import JumpContainer from '@/components/JumpContainer';
import HostManager from '@/pages/platformCenter/hostmanager';
// 平台中心
import SchemeConfig from '@/pages/platformCenter/gis/schemeConfig/SchemeConfig';
import DimensionsConfig from '@/pages/platformCenter/gis/dimensionsConfig/dimensionsConfig';
import MessageManager from '@/pages/platformCenter/messageManage';
import SchemeDetail from '@/pages/platformCenter/messageManage/schemeDetail/schemeDetail';
import HostManager from '@/pages/platformCenter/hostmanager';
import VideoManager from '@/pages/platformCenter/videoManager';
import SchemeDetail from '@/pages/platformCenter/schemeDetail/schemeDetail';
import SchemeConfig from '@/pages/platformCenter/schemeConfig/SchemeConfig';
import DimensionsConfig from '@/pages/platformCenter/dimensionsConfig/dimensionsConfig';
// 业务中心
import TableManager from '@/pages/bsmanager/base/tablemanager';
import FiledConfig from '@/pages/bsmanager/base/tablemanager/filedConfig/filedConfig';
import StandingBook from '@/pages/bsmanager/base/standingBook/standingBook';
import Incident from '@/pages/bsmanager/workOrder/incident/incident';
import IncidentFlow from '@/pages/bsmanager/workOrder/incident/incidentFlow';
import IncidentView from '@/pages/bsmanager/workOrder/incident/incidentView';
import Flow from '@/pages/bsmanager/workOrder/workFlow/flow';
import FlowNode from '@/pages/bsmanager/workOrder/workFlow/flowNode/flowNode';
import Workflow from '@/pages/bsmanager/workOrder/workflowEdit/Workflow';
import Maintenance from '@/pages/bsmanager/maintenance/maintenance';
import TaskScheduling from '@/pages/artificial/taskScheduling/taskScheduling';
import PoliciesIssued from '@/pages/artificial/policiesIssued/policiesIssued';
import AuthControl from '@/pages/authcontrol';
import TableManager from '@/pages/platformCenter/bsmanager/tablemanager';
import StandingBook from '@/pages/platformCenter/standingBook/standingBook';
import FiledConfig from '@/pages/platformCenter/filedConfig/filedConfig';
import Incident from '@/pages/platformCenter/bsmanager/workOrder/incident';
import IncidentFlow from '@/pages/platformCenter/bsmanager/workOrder/incidentFlow';
import IncidentView from '@/pages/platformCenter/bsmanager/workOrder/incidentView';
import Maintenance from '@/pages/platformCenter/bsmanager/maintenance/maintenance';
import Flow from '@/pages/platformCenter/bsmanager/workFlow/flow';
import FlowNode from '@/pages/platformCenter/bsmanager/workFlow/flowNode/flowNode';
import Workflow from '@/pages/platformCenter/bsmanager/workflowEdit/Workflow';
// import ColConen from '@/components/Colophon/colContent';
// 应用中心
import ProductConfig from '@/pages/productCenter/productConfig/productConfig';
import WebConfigPage from '@/pages/productCenter/webConfig';
import MobileConfigPage from '@/pages/productCenter/mobileConfig';
const iconStyle = { verticalAlign: '0.125em' };
// 系统日志
import ServiceLog from '@/pages/log/serviceLog';
import LoginLog from '@/pages/log/loginLog';
import OmsLog from '@/pages/log/omsLog';
import { USER_MODE } from '@/utils/constants';
const superAuthority = [USER_MODE.SUPER];
const adminAuthority = [...superAuthority, USER_MODE.ADMIN];
// const commonAuthority = [...adminAuthority, USER_MODE.COMMON];
const iconStyle = { verticalAlign: '0.125em' };
export default {
routes: [
{
......@@ -81,11 +78,6 @@ export default {
},
],
},
{
path: '/test/request',
hideMenu: true,
component: RequestTest,
},
{
path: '/',
component: BasicLayout,
......@@ -122,15 +114,8 @@ export default {
authority: adminAuthority,
component: DatabaseConnectConfig,
},
// {
// path: '/dbm/authcontrol',
// name: '数据鉴权',
// authority: superAuthority,
// component: AuthControl,
// },
],
},
{
path: '/userCenter',
name: '用户中心',
......@@ -154,12 +139,6 @@ export default {
},
],
},
{
path: '/userCenter/testTable',
name: '测试表格',
hideMenu: true,
component: TestTable,
},
{
path: '/platformCenter',
component: BlankLayout,
......@@ -226,29 +205,7 @@ export default {
// },
// ],
// },
// {
// path: '/platformCenter/order',
// name: '业务平台',
// component: JumpContainer,
// },
// {
// path: '/platformCenter/artificial',
// component: BlankLayout,
// name: '智能平台',
// icon: <CopyOutlined style={iconStyle} />,
// routes: [
// {
// path: '/platformCenter/artificial/policiesIssued',
// name: '方案管理',
// component: PoliciesIssued,
// },
// {
// path: '/platformCenter/artificial/taskScheduling',
// name: '任务调度',
// component: TaskScheduling,
// },
// ],
// },
{
path: '/platformCenter/notify',
name: '消息平台',
......@@ -381,27 +338,9 @@ export default {
routes: [
{
path: '/dataCenter/dictionary',
name: '数据字典1',
hideMenu: true,
component: Dictionary,
},
{
path: '/dataCenter/dictionary1',
name: '数据字典',
component: Dictionary1,
component: Dictionary,
},
// {
// path: '/dataCenter/search',
// name: '数据字典',
// component: Search,
// },
// {
// path: '/dataCenter/video',
// name: '视频管理',
// url:
// '/web4/?widget=product/oms/VideoConfig/VideoConfig|hideMap=true&videoType=萤石云',
// component: BaseFrameContainer,
// },
],
},
{
......
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