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

perf: log

parent 83d59719
......@@ -14,6 +14,7 @@ import { Chart, Interval, Tooltip, Axis } from 'bizcharts';
import { DataSet } from '@antv/data-set';
import moment from 'moment';
import { post, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less';
const ServiceLog = () => {
const [loading, setLoading] = useState(false); // 源数据
......@@ -138,7 +139,8 @@ const ServiceLog = () => {
return (
<>
<Row style={{ padding: '10px', background: 'white' }}>
<div className={styles.serviceLog}>
<Row className={styles.head}>
<Col span={24}>
<span style={{ lineHeight: 2 }}>时间:</span>
<DatePicker
......@@ -167,7 +169,7 @@ const ServiceLog = () => {
</Col>
</Row>
<Spin spinning={loading} tip="loading">
<Row style={{ padding: '10px', background: 'white' }}>
<Row className={styles.chart}>
<Col span={12}>
<Chart
height={316}
......@@ -188,6 +190,7 @@ const ServiceLog = () => {
</Chart>
</Col>
</Row>
<div className={styles.table}>
<Table
size="small"
bordered
......@@ -203,7 +206,9 @@ const ServiceLog = () => {
showSizeChanger: true,
}}
/>
</div>
</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 @@
background: white;
}
.table{
height:calc(100vh - 452px);
overflow: auto;
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 - 500px);
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: 2px 0px;
padding:6px 10px;
margin: 1px 0;
padding:8px;
padding-right: 20px;
}
}
}
\ No newline at end of file
......@@ -10,17 +10,27 @@
background: white;
}
.table{
height:calc(100vh - 452px);
overflow: auto;
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 - 500px);
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: 2px 0px;
padding:6px 10px;
margin: 1px 0;
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 {
Table,
Spin,
Modal,
Form,
Input,
......@@ -12,7 +13,6 @@ import {
} from 'antd';
import { get } from '@/services/index';
import styles from './WebDic.less';
import AddForm from '@/pages/webConfig/menuconfig/AddForm';
const WebDic = () => {
const [loading, setLoading] = useState(false);
......@@ -21,7 +21,8 @@ const WebDic = () => {
const [editVisible, setEditVisible] = useState(false);
const [data, setData] = useState([]); // 一级条目
const [subData, setSubData] = useState([]); // 二级条目
const [select, setSelect] = useState({}); // 当前选中条目
const [select, setSelect] = useState({}); // 当前选中条目,可以是一级/二级条目,修改/删除时设置
const [selectID, setSelectID] = useState('-1'); // 当前选中一级条目的ID,添加条目时使用
const [addForm] = Form.useForm();
const [editForm] = Form.useForm();
......@@ -56,7 +57,6 @@ const WebDic = () => {
e.stopPropagation();
setSelect(record);
setEditVisible(true);
console.log(record);
editForm.setFieldsValue({
nodeName: record.nodeName,
nodeValue: record.nodeValue,
......@@ -90,6 +90,7 @@ const WebDic = () => {
useEffect(() => {
getData('-1');
}, []);
// 根据父节点nodeID(即parentID)获取数据,一级条目parentID = -1
const getData = value => {
setLoading(true);
get(`/Cityinterface/rest/services/OMS.svc/D_GetDataDictionaryList`, {
......@@ -99,18 +100,22 @@ const WebDic = () => {
key: '',
})
.then(res => {
if (res && res.length > 0) {
if (res) {
if (res.length > 0) {
res.map(item => {
item.key = item.nodeID;
return item;
});
}
// value为 -1 时获取一级条目数据,否则获取二级条目数据
if (value === '-1') {
setData(res); // 设置一级条目
setSelect(res[0]); // 默认当前选中一级条目第一条
setSelectID(res[0].nodeID); // 设置选中的一级条目ID,用于添加二级条目
} else if (value) {
setSubData(res); // 设置二级条目
setSubData(res); // 设置二级条目,res为空[]时也要设置
}
// 获取二级条目
// 获取二级条目数据,默认一级条目第一条,递归一次(条件parentID === '-1')
if (res && res[0] && res[0].parentID === '-1') {
getData(res[0].nodeID);
}
......@@ -134,6 +139,7 @@ const WebDic = () => {
const submitAdd = value => {
const nodeName = addForm.getFieldValue('nodeName');
const nodeValue = addForm.getFieldValue('nodeValue');
if (nodeName) {
get(`/Cityinterface/rest/services/OMS.svc/D_AddDataDictionary`, {
_version: 9999,
_dc: new Date().getTime(),
......@@ -144,7 +150,11 @@ const WebDic = () => {
.then(res => {
if (res.success) {
setAddVisible(false);
if (level === 1) {
getData('-1');
} else {
getData(selectID);
}
notification.success({
message: '提交成功',
});
......@@ -158,11 +168,18 @@ const WebDic = () => {
.catch(err => {
message.error(err);
});
} else {
notification.error({
message: '提交失败',
description: '名称不能为空',
});
}
};
// 提交-编辑
const submitEdit = () => {
const nodeName = editForm.getFieldValue('nodeName');
const nodeValue = editForm.getFieldValue('nodeValue');
if (nodeName) {
get(`/Cityinterface/rest/services/OMS.svc/D_EditDataDictionary`, {
_version: 9999,
_dc: new Date().getTime(),
......@@ -187,6 +204,12 @@ const WebDic = () => {
.catch(err => {
message.error(err);
});
} else {
notification.error({
message: '提交失败',
description: '名称不能为空',
});
}
};
const submitDelete = () => {
......@@ -215,6 +238,7 @@ const WebDic = () => {
return (
<div className={styles.WebDic}>
<Spin spinning={loading} tip="loading...">
<div style={{ marginBottom: '10px', fontSize: '16px' }}>
<span style={{ padding: '0 10px' }}>一级条目</span>
<Button
......@@ -223,11 +247,13 @@ const WebDic = () => {
onClick={() => {
setLevel(1);
setAddVisible(true);
addForm.resetFields();
}}
>
添加
</Button>
</div>
{/* 一级条目 表格 */}
<Table
size="small"
bordered
......@@ -239,6 +265,7 @@ const WebDic = () => {
onClick: () => {
getData(record.nodeID);
setSelect(record);
setSelectID(record.nodeID);
},
})}
pagination={{
......@@ -258,11 +285,13 @@ const WebDic = () => {
onClick={() => {
setLevel(2);
setAddVisible(true);
addForm.resetFields();
}}
>
添加
</Button>
</div>
{/* 二级条目 表格 */}
<Table
size="small"
bordered
......@@ -277,6 +306,8 @@ const WebDic = () => {
showSizeChanger: true,
}}
/>
</Spin>
{/* 添加 */}
<Modal
title={level === 1 ? '添加一级条目' : '添加二级条目'}
......@@ -285,7 +316,7 @@ const WebDic = () => {
if (level === 1) {
submitAdd('-1');
} else {
// submitAdd(select.nodeID);
submitAdd(selectID);
}
}}
onCancel={() => {
......
.WebDic{
overflow: auto;
height:calc(100vh-200px);
.ant-table-thead tr th{
font-weight: 600;
color:rgba(0,0,0,0.85);
......@@ -22,4 +21,24 @@
.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 - 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