Commit 9685d053 authored by 陈前坚's avatar 陈前坚

perf: log

parent 83d59719
...@@ -14,6 +14,7 @@ import { Chart, Interval, Tooltip, Axis } from 'bizcharts'; ...@@ -14,6 +14,7 @@ import { Chart, Interval, Tooltip, Axis } from 'bizcharts';
import { DataSet } from '@antv/data-set'; import { DataSet } from '@antv/data-set';
import moment from 'moment'; import moment from 'moment';
import { post, PUBLISH_SERVICE } from '@/services/index'; import { post, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less';
const ServiceLog = () => { const ServiceLog = () => {
const [loading, setLoading] = useState(false); // 源数据 const [loading, setLoading] = useState(false); // 源数据
...@@ -138,7 +139,8 @@ const ServiceLog = () => { ...@@ -138,7 +139,8 @@ const ServiceLog = () => {
return ( return (
<> <>
<Row style={{ padding: '10px', background: 'white' }}> <div className={styles.serviceLog}>
<Row className={styles.head}>
<Col span={24}> <Col span={24}>
<span style={{ lineHeight: 2 }}>时间:</span> <span style={{ lineHeight: 2 }}>时间:</span>
<DatePicker <DatePicker
...@@ -167,7 +169,7 @@ const ServiceLog = () => { ...@@ -167,7 +169,7 @@ const ServiceLog = () => {
</Col> </Col>
</Row> </Row>
<Spin spinning={loading} tip="loading"> <Spin spinning={loading} tip="loading">
<Row style={{ padding: '10px', background: 'white' }}> <Row className={styles.chart}>
<Col span={12}> <Col span={12}>
<Chart <Chart
height={316} height={316}
...@@ -188,6 +190,7 @@ const ServiceLog = () => { ...@@ -188,6 +190,7 @@ const ServiceLog = () => {
</Chart> </Chart>
</Col> </Col>
</Row> </Row>
<div className={styles.table}>
<Table <Table
size="small" size="small"
bordered bordered
...@@ -203,7 +206,9 @@ const ServiceLog = () => { ...@@ -203,7 +206,9 @@ const ServiceLog = () => {
showSizeChanger: true, showSizeChanger: true,
}} }}
/> />
</div>
</Spin> </Spin>
</div>
</> </>
); );
}; };
......
.serviceLog{
.head{
padding: 10px;
background: white;
margin-bottom: 2px;
min-width: 1030px;
}
.chart{
padding: 16px;
background: white;
}
.table{
border-top: 1px solid #f0eded;
// overflow: auto;//不要这个,pagination否则无法固定底部
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 518px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
}
\ No newline at end of file
...@@ -10,17 +10,27 @@ ...@@ -10,17 +10,27 @@
background: white; background: white;
} }
.table{ .table{
height:calc(100vh - 452px); border-top: 1px solid #f0eded;
overflow: auto; // overflow: auto;//不要这个,pagination否则无法固定底部
.ant-table-thead tr th{ .ant-table-thead tr th{
font-weight: 600; font-weight: 600;
color:rgba(0,0,0,0.85); color:rgba(0,0,0,0.85);
} }
.ant-table-content{
height:calc(100vh - 500px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{ .ant-pagination{
z-index: 999; z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white; background: white;
margin: 2px 0px; margin: 1px 0;
padding:6px 10px; padding:8px;
padding-right: 20px;
} }
} }
} }
\ No newline at end of file
...@@ -10,17 +10,27 @@ ...@@ -10,17 +10,27 @@
background: white; background: white;
} }
.table{ .table{
height:calc(100vh - 452px); border-top: 1px solid #f0eded;
overflow: auto; // overflow: auto;//不要这个,pagination否则无法固定底部
.ant-table-thead tr th{ .ant-table-thead tr th{
font-weight: 600; font-weight: 600;
color:rgba(0,0,0,0.85); color:rgba(0,0,0,0.85);
} }
.ant-table-content{
height:calc(100vh - 500px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{ .ant-pagination{
z-index: 999; z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white; background: white;
margin: 2px 0px; margin: 1px 0;
padding:6px 10px; padding:8px;
padding-right: 20px;
} }
} }
} }
\ No newline at end of file
import React from 'react'; import React, { useState, useEffect } from 'react';
import { Table, Row, Col } from 'antd'; import {
Table,
Spin,
Modal,
Form,
Input,
Space,
Button,
Popconfirm,
notification,
message,
} from 'antd';
import { get } from '@/services/index';
import styles from './AppDic.less';
const AppDic = () => {
const [loading, setLoading] = useState(false);
const [addVisible, setAddVisible] = useState(false);
const [editVisible, setEditVisible] = useState(false);
const [data, setData] = useState([]); // 表数据
const [select, setSelect] = useState({}); // 当前选中条目,修改/删除时设置
const [addForm] = Form.useForm();
const [editForm] = Form.useForm();
const columns = [
{
title: '名称',
dataIndex: 'Label',
key: 'Label',
},
{
title: '键名',
dataIndex: 'Key',
key: 'Key',
},
{
title: '值',
dataIndex: 'Value',
key: 'Value',
},
{
title: '描述',
dataIndex: 'Description',
key: 'Description',
render: record => {
if (!record) {
return '-';
}
return record;
},
},
{
title: '操作',
key: 'action',
width: 200,
render: record => (
<Space>
<Button
type="primary"
size="small"
onClick={() => {
setSelect(record);
setEditVisible(true);
editForm.setFieldsValue({
label: record.Label,
key: record.Key,
value: record.Value,
description: record.Description,
});
}}
>
修改
</Button>
<Popconfirm
title="是否删除该数据?"
okText="确认"
cancelText="取消"
onConfirm={submitDelete}
>
<Button
size="small"
danger
onClick={() => {
setSelect(record);
}}
>
删除
</Button>
</Popconfirm>
</Space>
),
},
];
useEffect(() => {
getData('-1');
}, []);
const getData = () => {
setLoading(true);
get(`/Cityinterface/rest/services/OMS.svc/M_GetKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
if (res) {
if (res.length > 0) {
res.map(item => {
item.key = item.id;
return item;
});
}
setData(res);
} else {
notification.error({
message: '获取失败',
description: res.message,
});
}
setLoading(false);
})
.catch(err => {
setLoading(false);
message.error(err);
});
};
// 提交-添加
const submitAdd = () => {
const label = addForm.getFieldValue('label');
const key = addForm.getFieldValue('key');
const value = addForm.getFieldValue('value');
const description = addForm.getFieldValue('description');
if (label && key && value) {
get(`/Cityinterface/rest/services/OMS.svc/M_AddKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
label,
key,
value,
desc: description,
})
.then(res => {
if (res.success) {
setAddVisible(false);
getData();
notification.success({
message: '提交成功',
});
} else {
notification.error({
message: '提交失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
} else {
notification.error({
message: '提交失败',
description: '名称/键名/值不能为空',
});
}
};
// 提交-重置
const submitReset = () => {
get(`/Cityinterface/rest/services/OMS.svc/M_ResetKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
})
.then(res => {
if (res.success) {
getData();
notification.success({
message: '重置成功',
});
} else {
notification.error({
message: '重置失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
// 提交-编辑
const submitEdit = () => {
const label = editForm.getFieldValue('label');
const key = editForm.getFieldValue('key');
const value = editForm.getFieldValue('value');
const description = editForm.getFieldValue('description');
if (label && key && value) {
get(`/Cityinterface/rest/services/OMS.svc/M_EditKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
id: select.id,
label,
key,
value,
desc: description,
})
.then(res => {
if (res.success) {
setEditVisible(false);
getData();
notification.success({
message: '提交成功',
});
} else {
notification.error({
message: '提交失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
} else {
notification.error({
message: '提交失败',
description: '名称/键名/值不能为空',
});
}
};
const submitDelete = () => {
get(`/Cityinterface/rest/services/OMS.svc/M_DeleteKeyValue`, {
_version: 9999,
_dc: new Date().getTime(),
key: select.Key,
})
.then(res => {
if (res.success) {
getData(select.parentID);
notification.success({
message: '删除成功',
});
} else {
notification.error({
message: '删除失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
const appDic = () => {
console.log('123');
return ( return (
<Row> <div className={styles.AppDic}>
<Col span={12}> <Spin spinning={loading} tip="loading...">
<Table <div
style={{
marginBottom: '10px',
fontSize: '16px',
height: 'calc(100vh-200px)',
}}
>
<span style={{ padding: '0 10px' }}>数据字典</span>
<Button
style={{ marginLeft: '10px' }}
type="primary"
size="small" size="small"
bordered onClick={() => {
// columns={columns} setAddVisible(true);
// dataSource={data0} addForm.resetFields();
scroll={{ x: 'max-content' }}
pagination={{
showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 10,
showQuickJumper: true,
showSizeChanger: true,
}} }}
/> >
</Col> 添加
<Col span={12}> </Button>
<Popconfirm
title="是否重置默认配置?"
okText="确认"
cancelText="取消"
onConfirm={submitReset}
>
<Button size="small" danger style={{ marginLeft: '10px' }}>
重置
</Button>
</Popconfirm>
</div>
<Table <Table
size="small" size="small"
bordered bordered
// columns={columns} columns={columns}
// dataSource={data0} dataSource={data}
scroll={{ x: 'max-content' }} scroll={{ x: 'max-content' }}
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) =>
`第${range[0]}-${range[1]} 条/共 ${total} 条`, `第${range[0]}-${range[1]} 条/共 ${total} 条`,
pageSizeOptions: [10, 20, 50, 100], pageSizeOptions: [10, 20, 50, 100],
defaultPageSize: 10, defaultPageSize: 20,
showQuickJumper: true, showQuickJumper: true,
showSizeChanger: true, showSizeChanger: true,
}} }}
/> />
</Col> </Spin>
</Row>
{/* 添加 */}
<Modal
title="添加数据字典"
visible={addVisible}
onOk={submitAdd}
onCancel={() => {
setAddVisible(false);
}}
okText="确认"
cancelText="取消"
>
<Form form={addForm} labelCol={{ span: 3 }}>
<Form.Item
name="label"
label="名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入名称" />
</Form.Item>
<Form.Item
name="key"
label="键名"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入键名" />
</Form.Item>
<Form.Item
name="value"
label="值"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入值" />
</Form.Item>
<Form.Item name="description" label="描述">
<Input placeholder="请输入相关描述" />
</Form.Item>
</Form>
</Modal>
{/* 修改 */}
<Modal
title="修改数据字典"
visible={editVisible}
onOk={submitEdit}
onCancel={() => {
setEditVisible(false);
}}
okText="确认"
cancelText="取消"
>
<Form form={editForm} labelCol={{ span: 3 }}>
<Form.Item
name="label"
label="名称"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入名称" />
</Form.Item>
<Form.Item name="key" label="键名">
<Input placeholder="请输入键名" />
</Form.Item>
<Form.Item
name="value"
label="值"
rules={[{ required: true, message: '不能为空' }]}
>
<Input placeholder="请输入值" />
</Form.Item>
<Form.Item name="description" label="描述">
<Input placeholder="请输入相关描述" />
</Form.Item>
</Form>
</Modal>
</div>
); );
}; };
export default appDic; export default AppDic;
.AppDic{
overflow: auto;
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-pagination{
z-index: 999;
background: white;
margin: 2px 0px;
padding:6px 10px;
}
.ant-table-tbody{
.clickRowStyle{
background: #cfe7fd;
}
.clickRowStyle:hover>td{
background: #aed8fa;
}
}
.ant-card-body{
padding: 10px !important;
}
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 258px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
\ No newline at end of file
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
Table, Table,
Spin,
Modal, Modal,
Form, Form,
Input, Input,
...@@ -12,7 +13,6 @@ import { ...@@ -12,7 +13,6 @@ import {
} from 'antd'; } from 'antd';
import { get } from '@/services/index'; import { get } from '@/services/index';
import styles from './WebDic.less'; import styles from './WebDic.less';
import AddForm from '@/pages/webConfig/menuconfig/AddForm';
const WebDic = () => { const WebDic = () => {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
...@@ -21,7 +21,8 @@ const WebDic = () => { ...@@ -21,7 +21,8 @@ const WebDic = () => {
const [editVisible, setEditVisible] = useState(false); const [editVisible, setEditVisible] = useState(false);
const [data, setData] = useState([]); // 一级条目 const [data, setData] = useState([]); // 一级条目
const [subData, setSubData] = useState([]); // 二级条目 const [subData, setSubData] = useState([]); // 二级条目
const [select, setSelect] = useState({}); // 当前选中条目 const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级条目,修改/删除时设置
const [selectID, setSelectID] = useState('-1'); // 当前选中一级条目的ID,添加条目时使用
const [addForm] = Form.useForm(); const [addForm] = Form.useForm();
const [editForm] = Form.useForm(); const [editForm] = Form.useForm();
...@@ -56,7 +57,6 @@ const WebDic = () => { ...@@ -56,7 +57,6 @@ const WebDic = () => {
e.stopPropagation(); e.stopPropagation();
setSelect(record); setSelect(record);
setEditVisible(true); setEditVisible(true);
console.log(record);
editForm.setFieldsValue({ editForm.setFieldsValue({
nodeName: record.nodeName, nodeName: record.nodeName,
nodeValue: record.nodeValue, nodeValue: record.nodeValue,
...@@ -90,6 +90,7 @@ const WebDic = () => { ...@@ -90,6 +90,7 @@ const WebDic = () => {
useEffect(() => { useEffect(() => {
getData('-1'); getData('-1');
}, []); }, []);
// 根据父节点nodeID(即parentID)获取数据,一级条目parentID = -1
const getData = value => { const getData = value => {
setLoading(true); setLoading(true);
get(`/Cityinterface/rest/services/OMS.svc/D_GetDataDictionaryList`, { get(`/Cityinterface/rest/services/OMS.svc/D_GetDataDictionaryList`, {
...@@ -99,18 +100,22 @@ const WebDic = () => { ...@@ -99,18 +100,22 @@ const WebDic = () => {
key: '', key: '',
}) })
.then(res => { .then(res => {
if (res && res.length > 0) { if (res) {
if (res.length > 0) {
res.map(item => { res.map(item => {
item.key = item.nodeID; item.key = item.nodeID;
return item; return item;
}); });
}
// value为 -1 时获取一级条目数据,否则获取二级条目数据
if (value === '-1') { if (value === '-1') {
setData(res); // 设置一级条目 setData(res); // 设置一级条目
setSelect(res[0]); // 默认当前选中一级条目第一条 setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
} else if (value) { } else if (value) {
setSubData(res); // 设置二级条目 setSubData(res); // 设置二级条目,res为空[]时也要设置
} }
// 获取二级条目 // 获取二级条目数据,默认一级条目第一条,递归一次(条件parentID === '-1')
if (res && res[0] && res[0].parentID === '-1') { if (res && res[0] && res[0].parentID === '-1') {
getData(res[0].nodeID); getData(res[0].nodeID);
} }
...@@ -134,6 +139,7 @@ const WebDic = () => { ...@@ -134,6 +139,7 @@ const WebDic = () => {
const submitAdd = value => { const submitAdd = value => {
const nodeName = addForm.getFieldValue('nodeName'); const nodeName = addForm.getFieldValue('nodeName');
const nodeValue = addForm.getFieldValue('nodeValue'); const nodeValue = addForm.getFieldValue('nodeValue');
if (nodeName) {
get(`/Cityinterface/rest/services/OMS.svc/D_AddDataDictionary`, { get(`/Cityinterface/rest/services/OMS.svc/D_AddDataDictionary`, {
_version: 9999, _version: 9999,
_dc: new Date().getTime(), _dc: new Date().getTime(),
...@@ -144,7 +150,11 @@ const WebDic = () => { ...@@ -144,7 +150,11 @@ const WebDic = () => {
.then(res => { .then(res => {
if (res.success) { if (res.success) {
setAddVisible(false); setAddVisible(false);
if (level === 1) {
getData('-1'); getData('-1');
} else {
getData(selectID);
}
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
}); });
...@@ -158,11 +168,18 @@ const WebDic = () => { ...@@ -158,11 +168,18 @@ const WebDic = () => {
.catch(err => { .catch(err => {
message.error(err); message.error(err);
}); });
} else {
notification.error({
message: '提交失败',
description: '名称不能为空',
});
}
}; };
// 提交-编辑 // 提交-编辑
const submitEdit = () => { const submitEdit = () => {
const nodeName = editForm.getFieldValue('nodeName'); const nodeName = editForm.getFieldValue('nodeName');
const nodeValue = editForm.getFieldValue('nodeValue'); const nodeValue = editForm.getFieldValue('nodeValue');
if (nodeName) {
get(`/Cityinterface/rest/services/OMS.svc/D_EditDataDictionary`, { get(`/Cityinterface/rest/services/OMS.svc/D_EditDataDictionary`, {
_version: 9999, _version: 9999,
_dc: new Date().getTime(), _dc: new Date().getTime(),
...@@ -187,6 +204,12 @@ const WebDic = () => { ...@@ -187,6 +204,12 @@ const WebDic = () => {
.catch(err => { .catch(err => {
message.error(err); message.error(err);
}); });
} else {
notification.error({
message: '提交失败',
description: '名称不能为空',
});
}
}; };
const submitDelete = () => { const submitDelete = () => {
...@@ -215,6 +238,7 @@ const WebDic = () => { ...@@ -215,6 +238,7 @@ const WebDic = () => {
return ( return (
<div className={styles.WebDic}> <div className={styles.WebDic}>
<Spin spinning={loading} tip="loading...">
<div style={{ marginBottom: '10px', fontSize: '16px' }}> <div style={{ marginBottom: '10px', fontSize: '16px' }}>
<span style={{ padding: '0 10px' }}>一级条目</span> <span style={{ padding: '0 10px' }}>一级条目</span>
<Button <Button
...@@ -223,11 +247,13 @@ const WebDic = () => { ...@@ -223,11 +247,13 @@ const WebDic = () => {
onClick={() => { onClick={() => {
setLevel(1); setLevel(1);
setAddVisible(true); setAddVisible(true);
addForm.resetFields();
}} }}
> >
添加 添加
</Button> </Button>
</div> </div>
{/* 一级条目 表格 */}
<Table <Table
size="small" size="small"
bordered bordered
...@@ -239,6 +265,7 @@ const WebDic = () => { ...@@ -239,6 +265,7 @@ const WebDic = () => {
onClick: () => { onClick: () => {
getData(record.nodeID); getData(record.nodeID);
setSelect(record); setSelect(record);
setSelectID(record.nodeID);
}, },
})} })}
pagination={{ pagination={{
...@@ -258,11 +285,13 @@ const WebDic = () => { ...@@ -258,11 +285,13 @@ const WebDic = () => {
onClick={() => { onClick={() => {
setLevel(2); setLevel(2);
setAddVisible(true); setAddVisible(true);
addForm.resetFields();
}} }}
> >
添加 添加
</Button> </Button>
</div> </div>
{/* 二级条目 表格 */}
<Table <Table
size="small" size="small"
bordered bordered
...@@ -277,6 +306,8 @@ const WebDic = () => { ...@@ -277,6 +306,8 @@ const WebDic = () => {
showSizeChanger: true, showSizeChanger: true,
}} }}
/> />
</Spin>
{/* 添加 */} {/* 添加 */}
<Modal <Modal
title={level === 1 ? '添加一级条目' : '添加二级条目'} title={level === 1 ? '添加一级条目' : '添加二级条目'}
...@@ -285,7 +316,7 @@ const WebDic = () => { ...@@ -285,7 +316,7 @@ const WebDic = () => {
if (level === 1) { if (level === 1) {
submitAdd('-1'); submitAdd('-1');
} else { } else {
// submitAdd(select.nodeID); submitAdd(selectID);
} }
}} }}
onCancel={() => { onCancel={() => {
......
.WebDic{ .WebDic{
overflow: auto; overflow: auto;
height:calc(100vh-200px);
.ant-table-thead tr th{ .ant-table-thead tr th{
font-weight: 600; font-weight: 600;
color:rgba(0,0,0,0.85); color:rgba(0,0,0,0.85);
...@@ -22,4 +21,24 @@ ...@@ -22,4 +21,24 @@
.ant-card-body{ .ant-card-body{
padding: 10px !important; padding: 10px !important;
} }
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
}
.ant-table-content{
height:calc(100vh - 488px);
border-right: white;
overflow: auto !important;
}
.ant-pagination{
z-index: 999;
border-top: 1px solid #f0eded;
}
.ant-table-pagination{
padding-right: 12px;
background: white;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
} }
\ No newline at end of file
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