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
.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