Commit d0fecb90 authored by 皮倩雯's avatar 皮倩雯

fix: '人员选择器,选择器交互优化'

parent a05f547a
Pipeline #55153 passed with stages
...@@ -48,6 +48,7 @@ import { ...@@ -48,6 +48,7 @@ import {
InfoCircleOutlined, InfoCircleOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import Tree from '@/components/ExpendableTree'; import Tree from '@/components/ExpendableTree';
import { convertLegacyProps } from 'antd/lib/button/button';
const AddModal = props => { const AddModal = props => {
const { const {
callBackSubmit = () => {}, callBackSubmit = () => {},
...@@ -169,6 +170,9 @@ const AddModal = props => { ...@@ -169,6 +170,9 @@ const AddModal = props => {
const [timeData, setTimeData] = useState(''); const [timeData, setTimeData] = useState('');
const { Option } = Select; const { Option } = Select;
const [synchronization, setSynchronization] = useState(''); const [synchronization, setSynchronization] = useState('');
const [popeleShape, setPopeleShape] = useState('');
const [gl, setGl] = useState('');
const [cse, setCse] = useState('');
// 提交 // 提交
const onSubmit = () => { const onSubmit = () => {
// 不切换树 // 不切换树
...@@ -281,8 +285,16 @@ const AddModal = props => { ...@@ -281,8 +285,16 @@ const AddModal = props => {
data[0].Config = `${data[0].Config}?${obj.filterName}`; data[0].Config = `${data[0].Config}?${obj.filterName}`;
} }
break; break;
case '选择器':
if (cse) {
let str = `${obj.farter}.${obj.farterData}`;
data[0].Config = str;
} else {
data[0].Config = obj.Config ? obj.Config : '';
}
break;
case '人员选择器': case '人员选择器':
if (checkboxAll1 == true) { if (popeleShape == '分组模态') {
if (checkboxAllID1 == true) { if (checkboxAllID1 == true) {
if (obj.ConfigName) { if (obj.ConfigName) {
let str = cho ? `全部ID.${obj.ConfigName}` : `全部ID.${obj.ConfigName}.n`; let str = cho ? `全部ID.${obj.ConfigName}` : `全部ID.${obj.ConfigName}.n`;
...@@ -300,10 +312,18 @@ const AddModal = props => { ...@@ -300,10 +312,18 @@ const AddModal = props => {
data[0].Config = str; data[0].Config = str;
} }
} }
} else { } else if (popeleShape == '下拉框') {
let str = cho ? `${obj.Config}` : `${obj.Config}.n`; let str = cho ? `${obj.Config}` : `${obj.Config}.n`;
console.log(str); console.log(str);
data[0].Config = str; data[0].Config = str;
} else if (popeleShape == '树形模态') {
if (gl) {
let str = cho ? `tree.单选|非站点` : `tree.多选|非站点`;
data[0].Config = str;
} else {
let str = cho ? `tree.单选|站点` : `tree.多选|站点`;
data[0].Config = str;
}
} }
break; break;
default: default:
...@@ -555,6 +575,26 @@ const AddModal = props => { ...@@ -555,6 +575,26 @@ const AddModal = props => {
setRadio(0); setRadio(0);
} }
break; break;
case '选择器':
let sele = res[0].data.root.Config.split('.');
console.log(sele[0]);
console.log(sele[1]);
if (sele[1]) {
form.setFieldsValue({
Association: true,
farter: sele[0],
farterData: sele[1],
});
setCse(true);
} else {
console.log(sele[0]);
form.setFieldsValue({
Association: false,
Config: sele[0],
});
setCse(false);
}
break;
case '人员选择器': case '人员选择器':
let pepole = res[0].data.root.Config.split('.'); let pepole = res[0].data.root.Config.split('.');
console.log(pepole); console.log(pepole);
...@@ -565,17 +605,27 @@ const AddModal = props => { ...@@ -565,17 +605,27 @@ const AddModal = props => {
setCheckboxAll1(true); setCheckboxAll1(true);
if (pepole[1] != 'n') { if (pepole[1] != 'n') {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: false, AllID1: false,
ConfigName: pepole[1], ConfigName: pepole[1],
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: false, AllID1: false,
ConfigName: '', ConfigName: '',
}); });
} }
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('分组模态');
} else if (pepole[0] == '全部ID') { } else if (pepole[0] == '全部ID') {
setHide(false); setHide(false);
setFlag(true); setFlag(true);
...@@ -583,17 +633,79 @@ const AddModal = props => { ...@@ -583,17 +633,79 @@ const AddModal = props => {
setCheckboxAllID1(true); setCheckboxAllID1(true);
if (pepole[1] != 'n') { if (pepole[1] != 'n') {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: true, AllID1: true,
ConfigName: pepole[1], ConfigName: pepole[1],
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: true, AllID1: true,
ConfigName: '', ConfigName: '',
}); });
} }
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('分组模态');
} else if (pepole[0] == 'tree') {
setCheckboxAll1(false);
setCheckboxAllID1(false);
setHide(true);
setFlag(1);
let tree = pepole[1].split('|');
if (tree[0] == '多选') {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: false,
});
setGl(true);
setCho(false);
}
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: true,
});
setGl(false);
setCho(true);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: true,
});
setGl(true);
setCho(true);
}
}
setPopeleShape('树形模态');
} else { } else {
setCheckboxAll1(false); setCheckboxAll1(false);
setCheckboxAllID1(false); setCheckboxAllID1(false);
...@@ -601,17 +713,20 @@ const AddModal = props => { ...@@ -601,17 +713,20 @@ const AddModal = props => {
setFlag(false); setFlag(false);
form.setFieldsValue({ form.setFieldsValue({
All1: false, All1: false,
PeShape: '下拉框',
AllID1: false, AllID1: false,
Config: pepole[0], Config: pepole[0],
}); });
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('下拉框');
} }
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
break; break;
} }
setPramData({ ...res[0].data.root, coordinates, must, picture }); setPramData({ ...res[0].data.root, coordinates, must, picture });
...@@ -642,6 +757,9 @@ const AddModal = props => { ...@@ -642,6 +757,9 @@ const AddModal = props => {
}); });
} }
} else { } else {
setPopeleShape('');
setGl('');
setCse('');
setPramData([]); setPramData([]);
form.resetFields(); form.resetFields();
setChee(''); setChee('');
...@@ -653,6 +771,7 @@ const AddModal = props => { ...@@ -653,6 +771,7 @@ const AddModal = props => {
setCheckboxAll1(''); setCheckboxAll1('');
setCheckboxAllID1(''); setCheckboxAllID1('');
setFlag(false); setFlag(false);
setPopeleShape('下拉框');
setHide(true); setHide(true);
setSynchronization(false); setSynchronization(false);
} }
...@@ -783,6 +902,7 @@ const AddModal = props => { ...@@ -783,6 +902,7 @@ const AddModal = props => {
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
Config: '', Config: '',
guolv: '',
ConfigName: '', ConfigName: '',
tableName: '', tableName: '',
fieldName: '', fieldName: '',
...@@ -797,17 +917,24 @@ const AddModal = props => { ...@@ -797,17 +917,24 @@ const AddModal = props => {
ShowConfig: '', ShowConfig: '',
pepole: '', pepole: '',
choose: '', choose: '',
PeShape: '',
Association: '',
farter: '',
farterData: '',
}); });
} }
setCse('');
setPopeleShape('');
setRadio(0); setRadio(0);
setRadio3('0'); setRadio3('0');
setRadio1('0'); setRadio1('0');
setGl('');
setPep(''); setPep('');
setCho(''); setCho('');
setCheckboxAll1(''); setCheckboxAll1('');
setCheckboxAllID1(''); setCheckboxAllID1('');
setFlag(false); setFlag(false);
setPopeleShape('下拉框');
setHide(true); setHide(true);
console.log(value); console.log(value);
if (value == '文本') { if (value == '文本') {
...@@ -1166,6 +1293,25 @@ const AddModal = props => { ...@@ -1166,6 +1293,25 @@ const AddModal = props => {
setRadio(0); setRadio(0);
} }
break; break;
case '选择器':
console.log(aa.Config);
let sele = aa.Config.split('.');
if (sele[1]) {
form.setFieldsValue({
Association: true,
farter: sele[0],
farterData: sele[1],
});
setCse(true);
} else {
console.log(sele[0]);
form.setFieldsValue({
Association: false,
Config: sele[0],
});
setCse(false);
}
break;
case '人员选择器': case '人员选择器':
let pepole = aa.Config.split('.'); let pepole = aa.Config.split('.');
console.log(pepole); console.log(pepole);
...@@ -1176,17 +1322,27 @@ const AddModal = props => { ...@@ -1176,17 +1322,27 @@ const AddModal = props => {
setCheckboxAll1(true); setCheckboxAll1(true);
if (pepole[1] != 'n') { if (pepole[1] != 'n') {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: false, AllID1: false,
ConfigName: pepole[1], ConfigName: pepole[1],
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: false, AllID1: false,
ConfigName: '', ConfigName: '',
}); });
} }
if (aa.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('分组模态');
} else if (pepole[0] == '全部ID') { } else if (pepole[0] == '全部ID') {
setHide(false); setHide(false);
setFlag(true); setFlag(true);
...@@ -1194,17 +1350,79 @@ const AddModal = props => { ...@@ -1194,17 +1350,79 @@ const AddModal = props => {
setCheckboxAllID1(true); setCheckboxAllID1(true);
if (pepole[1] != 'n') { if (pepole[1] != 'n') {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: true, AllID1: true,
ConfigName: pepole[1], ConfigName: pepole[1],
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: true, AllID1: true,
ConfigName: '', ConfigName: '',
}); });
} }
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('分组模态');
} else if (pepole[0] == 'tree') {
setCheckboxAll1(false);
setCheckboxAllID1(false);
setHide(true);
setFlag(1);
let tree = pepole[1].split('|');
if (tree[0] == '多选') {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: false,
});
setGl(true);
setCho(false);
}
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: true,
});
setGl(false);
setCho(true);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: true,
});
setGl(true);
setCho(true);
}
}
setPopeleShape('树形模态');
} else { } else {
setCheckboxAll1(false); setCheckboxAll1(false);
setCheckboxAllID1(false); setCheckboxAllID1(false);
...@@ -1212,17 +1430,20 @@ const AddModal = props => { ...@@ -1212,17 +1430,20 @@ const AddModal = props => {
setFlag(false); setFlag(false);
form.setFieldsValue({ form.setFieldsValue({
All1: false, All1: false,
PeShape: '下拉框',
AllID1: false, AllID1: false,
Config: pepole[0], Config: pepole[0],
}); });
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('下拉框');
} }
if (aa.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
break; break;
} }
setValue1(); setValue1();
...@@ -1415,6 +1636,24 @@ const AddModal = props => { ...@@ -1415,6 +1636,24 @@ const AddModal = props => {
setRadio(0); setRadio(0);
} }
break; break;
case '选择器':
let sele = res[0].data.root.Config.split('.');
if (sele[1]) {
form.setFieldsValue({
Association: true,
farter: sele[0],
farterData: sele[1],
});
setCse(true);
} else {
console.log(sele[0]);
form.setFieldsValue({
Association: false,
Config: sele[0],
});
setCse(false);
}
break;
case '人员选择器': case '人员选择器':
let pepole = res[0].data.root.Config.split('.'); let pepole = res[0].data.root.Config.split('.');
console.log(pepole); console.log(pepole);
...@@ -1425,17 +1664,27 @@ const AddModal = props => { ...@@ -1425,17 +1664,27 @@ const AddModal = props => {
setCheckboxAll1(true); setCheckboxAll1(true);
if (pepole[1] != 'n') { if (pepole[1] != 'n') {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: false, AllID1: false,
ConfigName: pepole[1], ConfigName: pepole[1],
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: false, AllID1: false,
ConfigName: '', ConfigName: '',
}); });
} }
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('分组模态');
} else if (pepole[0] == '全部ID') { } else if (pepole[0] == '全部ID') {
setHide(false); setHide(false);
setFlag(true); setFlag(true);
...@@ -1443,17 +1692,79 @@ const AddModal = props => { ...@@ -1443,17 +1692,79 @@ const AddModal = props => {
setCheckboxAllID1(true); setCheckboxAllID1(true);
if (pepole[1] != 'n') { if (pepole[1] != 'n') {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: true, AllID1: true,
ConfigName: pepole[1], ConfigName: pepole[1],
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态',
All1: true, All1: true,
AllID1: true, AllID1: true,
ConfigName: '', ConfigName: '',
}); });
} }
if (res[0].data.root.Config.endsWith('.n')) {
form.setFieldsValue({ choose: false });
setCho(false);
} else {
form.setFieldsValue({ choose: true });
setCho(true);
}
setPopeleShape('分组模态');
} else if (pepole[0] == 'tree') {
setCheckboxAll1(false);
setCheckboxAllID1(false);
setHide(true);
setFlag(1);
let tree = pepole[1].split('|');
if (tree[0] == '多选') {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: false,
});
setGl(false);
setCho(false);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: false,
});
setGl(true);
setCho(false);
}
} else {
if (tree[1] == '站点') {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: false,
choose: true,
});
setGl(false);
setCho(true);
} else {
form.setFieldsValue({
PeShape: '树形模态',
All1: true,
AllID1: true,
guolv: true,
choose: true,
});
setGl(true);
setCho(true);
}
}
setPopeleShape('树形模态');
} else { } else {
setCheckboxAll1(false); setCheckboxAll1(false);
setCheckboxAllID1(false); setCheckboxAllID1(false);
...@@ -1461,18 +1772,18 @@ const AddModal = props => { ...@@ -1461,18 +1772,18 @@ const AddModal = props => {
setFlag(false); setFlag(false);
form.setFieldsValue({ form.setFieldsValue({
All1: false, All1: false,
PeShape: '下拉框',
AllID1: false, AllID1: false,
Config: pepole[0], Config: pepole[0],
}); });
} if (res[0].data.root.Config.endsWith('.n')) {
if (res[0].data.root.Config.endsWith('.n')) { form.setFieldsValue({ choose: false });
console.log(111); setCho(false);
form.setFieldsValue({ choose: false }); } else {
setCho(false); form.setFieldsValue({ choose: true });
} else { setCho(true);
console.log(222); }
form.setFieldsValue({ choose: true }); setPopeleShape('下拉框');
setCho(true);
} }
break; break;
} }
...@@ -1590,8 +1901,16 @@ const AddModal = props => { ...@@ -1590,8 +1901,16 @@ const AddModal = props => {
data[0].Config = `${data[0].Config}?${obj.filterName}`; data[0].Config = `${data[0].Config}?${obj.filterName}`;
} }
break; break;
case '选择器':
if (cse) {
let str = `${obj.farter}.${obj.farterData}`;
data[0].Config = str;
} else {
data[0].Config = obj.Config ? obj.Config : '';
}
break;
case '人员选择器': case '人员选择器':
if (checkboxAll1 == true) { if (popeleShape == '分组模态') {
if (checkboxAllID1 == true) { if (checkboxAllID1 == true) {
if (obj.ConfigName) { if (obj.ConfigName) {
let str = cho ? `全部ID.${obj.ConfigName}` : `全部ID.${obj.ConfigName}.n`; let str = cho ? `全部ID.${obj.ConfigName}` : `全部ID.${obj.ConfigName}.n`;
...@@ -1609,10 +1928,18 @@ const AddModal = props => { ...@@ -1609,10 +1928,18 @@ const AddModal = props => {
data[0].Config = str; data[0].Config = str;
} }
} }
} else { } else if (popeleShape == '下拉框') {
let str = cho ? `${obj.Config}` : `${obj.Config}.n`; let str = cho ? `${obj.Config}` : `${obj.Config}.n`;
console.log(str); console.log(str);
data[0].Config = str; data[0].Config = str;
} else if (popeleShape == '树形模态') {
if (gl) {
let str = cho ? `tree.单选|非站点` : `tree.多选|非站点`;
data[0].Config = str;
} else {
let str = cho ? `tree.单选|站点` : `tree.多选|站点`;
data[0].Config = str;
}
} }
break; break;
default: default:
...@@ -1639,7 +1966,9 @@ const AddModal = props => { ...@@ -1639,7 +1966,9 @@ const AddModal = props => {
} }
} }
form.setFieldsValue({ form.setFieldsValue({
Association: '',
Config: '', Config: '',
guolv: '',
ConfigName: '', ConfigName: '',
tableName: '', tableName: '',
fieldName: '', fieldName: '',
...@@ -1655,16 +1984,23 @@ const AddModal = props => { ...@@ -1655,16 +1984,23 @@ const AddModal = props => {
pepole: '', pepole: '',
choose: '', choose: '',
SyncEvent: '', SyncEvent: '',
PeShape: '',
farter: '',
farterData: '',
}); });
setCse('');
setPopeleShape('');
setRadio(0); setRadio(0);
setRadio3('0'); setRadio3('0');
setRadio1('0'); setRadio1('0');
setGl('');
setPep(''); setPep('');
setCho(''); setCho('');
setCheckboxAll1(''); setCheckboxAll1('');
setCheckboxAllID1(''); setCheckboxAllID1('');
setSynchronization(false); setSynchronization(false);
setFlag(false); setFlag(false);
setPopeleShape('下拉框');
setHide(true); setHide(true);
if (i == 1.14) { if (i == 1.14) {
console.log(valueData); console.log(valueData);
...@@ -1854,6 +2190,11 @@ const AddModal = props => { ...@@ -1854,6 +2190,11 @@ const AddModal = props => {
setCho(e.target.checked); setCho(e.target.checked);
}; };
const changeGl = e => {
console.log(e);
setGl(e.target.checked);
};
const changeAll1 = e => { const changeAll1 = e => {
let aa = form.getFieldsValue().ConfigName; let aa = form.getFieldsValue().ConfigName;
let bb = form.getFieldsValue().Config; let bb = form.getFieldsValue().Config;
...@@ -1882,6 +2223,35 @@ const AddModal = props => { ...@@ -1882,6 +2223,35 @@ const AddModal = props => {
setSynchronization(e.target.checked); setSynchronization(e.target.checked);
}; };
const popeleShapeOnChange = e => {
console.log(e);
setPopeleShape(e.target.value);
let aa = form.getFieldsValue().ConfigName;
let bb = form.getFieldsValue().Config;
if (e.target.value == '分组模态') {
if (bb || bb == '' || bb == undefined) {
form.setFieldsValue({ ConfigName: bb });
}
setHide(false);
setFlag(true);
} else if (e.target.value == '下拉框') {
if (aa || aa == '' || bb == undefined) {
form.setFieldsValue({ Config: aa });
}
setHide(true);
setFlag(false);
setCheckboxAllID1(false);
} else if (e.target.value == '树形模态') {
setHide(true);
setFlag(1);
setCheckboxAllID1(false);
}
};
const changeCse = e => {
setCse(e.target.checked);
};
return ( return (
<> <>
<Drawer <Drawer
...@@ -2195,19 +2565,53 @@ const AddModal = props => { ...@@ -2195,19 +2565,53 @@ const AddModal = props => {
<> <>
<Item <Item
label="配置" label="配置"
name="Config" name="Association"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
// rules={[{ required: true, message: '请输入数据字典名称' }]} // rules={[{ required: true, message: '请输入数据字典名称' }]}
> >
<TextArea allowClear placeholder="请输入数据字典名称" /> <Checkbox
checked={cse}
onChange={changeCse}
style={{ marginBottom: '0' }}
>
关联选择器
</Checkbox>
</Item> </Item>
{cse ? (
<Row>
<Col span={12}>
<Item
label="父字段名"
name="farter"
labelCol={{ span: 8 }}
rules={[{ required: true, message: '请输入父字段名' }]}
>
<Input placeholder="请输入父字段名称" />
</Item>
</Col>
<Col span={12}>
<Item
label="数据字典"
name="farterData"
labelCol={{ span: 7 }}
rules={[{ required: true, message: '请输入数据字典名称' }]}
>
<Input placeholder="请输入数据字典名称" />
</Item>
</Col>
</Row>
) : (
<Item label="数据字典" name="Config" labelCol={{ span: 4 }}>
<TextArea allowClear placeholder="请输入数据字典名称" />
</Item>
)}
</> </>
); );
case '搜索选择器': case '搜索选择器':
return ( return (
<> <>
<Item <Item
label="数据字典名称" label="数据字典"
name="Config" name="Config"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
// rules={[{ required: true, message: '请输入数据字典名称' }]} // rules={[{ required: true, message: '请输入数据字典名称' }]}
...@@ -2324,28 +2728,66 @@ const AddModal = props => { ...@@ -2324,28 +2728,66 @@ const AddModal = props => {
<> <>
<Item <Item
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
label={ label="展示形态"
<div> name="PeShape"
<Tooltip // label={
title={ // <div>
<> // <Tooltip
<span>弹窗显示人员所属机构</span> // title={
<Image width={200} src={AllImage} /> // <>
</> // <span>弹窗显示人员所属机构</span>
} // <Image width={200} src={AllImage} />
> // </>
<InfoCircleOutlined // }
style={{ // >
color: 'rgb(24 144 255)', // <InfoCircleOutlined
marginRight: '5px', // style={{
}} // color: 'rgb(24 144 255)',
/> // marginRight: '5px',
</Tooltip> // }}
<span>配置</span> // />
</div> // </Tooltip>
} // <span>人员选择器形态</span>
// </div>
// }
> >
<div style={{ display: 'inline-block', marginRight: '10px' }}> <div style={{ display: 'inline-block', marginRight: '10px' }}>
<Radio.Group
style={{ marginTop: '0.3rem' }}
value={popeleShape}
onChange={popeleShapeOnChange}
>
<Radio value="下拉框">下拉框</Radio>
<Radio value="分组模态">分组模态</Radio>
<Radio value="树形模态">树形模态</Radio>
</Radio.Group>
</div>
</Item>
<Item
labelCol={{ span: 4 }}
// label={
// <div>
// <Tooltip
// title={
// <>
// <span>弹窗显示人员所属机构</span>
// <Image width={200} src={AllImage} />
// </>
// }
// >
// <InfoCircleOutlined
// style={{
// color: 'rgb(24 144 255)',
// marginRight: '5px',
// }}
// />
// </Tooltip>
// <span>配置</span>
// </div>
// }
label="配置"
>
{/* <div style={{ display: 'inline-block', marginRight: '10px' }}>
<Item name="All1" style={{ marginBottom: '0' }}> <Item name="All1" style={{ marginBottom: '0' }}>
<Checkbox <Checkbox
checked={checkboxAll1} checked={checkboxAll1}
...@@ -2355,7 +2797,7 @@ const AddModal = props => { ...@@ -2355,7 +2797,7 @@ const AddModal = props => {
弹窗 弹窗
</Checkbox> </Checkbox>
</Item> </Item>
</div> </div> */}
<div style={{ display: 'inline-block', marginRight: '10px' }}> <div style={{ display: 'inline-block', marginRight: '10px' }}>
<Item name="choose" style={{ marginBottom: '0' }}> <Item name="choose" style={{ marginBottom: '0' }}>
<Checkbox <Checkbox
...@@ -2409,6 +2851,22 @@ const AddModal = props => { ...@@ -2409,6 +2851,22 @@ const AddModal = props => {
</Item> </Item>
</> </>
); );
case 1:
return (
<>
<Item label="过滤" name="Config" labelCol={{ span: 4 }}>
<Item name="guolv" style={{ marginBottom: '0' }}>
<Checkbox
checked={gl}
onChange={changeGl}
style={{ marginBottom: '0' }}
>
非站点
</Checkbox>
</Item>
</Item>
</>
);
case false: case false:
return ( return (
<> <>
......
...@@ -2,8 +2,11 @@ import React, { useState, useEffect } from 'react'; ...@@ -2,8 +2,11 @@ import React, { useState, useEffect } from 'react';
import { DatePicker, Table, Row, Col, Button, notification, message, Spin } from 'antd'; import { DatePicker, Table, Row, Col, Button, notification, message, Spin } from 'antd';
import { SwapRightOutlined, SyncOutlined } from '@ant-design/icons'; import { SwapRightOutlined, SyncOutlined } from '@ant-design/icons';
import moment from 'moment'; import moment from 'moment';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import { post, PUBLISH_SERVICE } from '@/services/index'; import { post, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less'; import styles from './index.less';
const { RangePicker } = DatePicker;
const LoginLog = () => { const LoginLog = () => {
const [loading, setLoading] = useState(false); // 源数据 const [loading, setLoading] = useState(false); // 源数据
...@@ -16,6 +19,10 @@ const LoginLog = () => { ...@@ -16,6 +19,10 @@ const LoginLog = () => {
const [endTime, setEndTime] = useState( const [endTime, setEndTime] = useState(
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'), // 默认值当前时间 moment(new Date(), 'YYYY-MM-DD HH:mm:ss'), // 默认值当前时间
); );
const [allTime, setAllTime] = useState([
moment().startOf('month'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
]);
const [filteredValue, setFilteredValue] = useState([]); const [filteredValue, setFilteredValue] = useState([]);
const columns = [ const columns = [
...@@ -64,15 +71,15 @@ const LoginLog = () => { ...@@ -64,15 +71,15 @@ const LoginLog = () => {
]; ];
// 在起止时间任意一个变化后获取数据 // 在起止时间任意一个变化后获取数据
useEffect(() => { useEffect(() => {
if (startTime && endTime) { if (allTime) {
setLoading(true); setLoading(true);
getData(); getData();
} }
}, [startTime, endTime]); }, [allTime]);
const getData = () => { const getData = () => {
post(`${PUBLISH_SERVICE}/LogCenter/GetLoginLog`, { post(`${PUBLISH_SERVICE}/LogCenter/GetLoginLog`, {
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'), DateFrom: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'), DateTo: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
IP: '', IP: '',
Module: '', Module: '',
Description: '', Description: '',
...@@ -114,15 +121,24 @@ const LoginLog = () => { ...@@ -114,15 +121,24 @@ const LoginLog = () => {
const changeEndTime = time => { const changeEndTime = time => {
setEndTime(time); setEndTime(time);
}; };
const changeTime = time => {
setAllTime(time);
};
// 近1/6/12/24小时 // 近1/6/12/24小时
const setTime = time => { const setTime = time => {
setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss')); setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss'));
setStartTime( setStartTime(
moment(new Date(new Date().getTime() - time * 60 * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'), moment(new Date(new Date().getTime() - time * 60 * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'),
); );
setAllTime([
moment(new Date(new Date().getTime() - time * 60 * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
]);
}; };
const handleReset = () => { const handleReset = () => {
setStartTime(moment().startOf('week')); setStartTime(moment().startOf('week'));
setAllTime([moment().startOf('week'), moment(new Date(), 'YYYY-MM-DD HH:mm:ss')]);
setFilteredValue([]); setFilteredValue([]);
}; };
const onChangeInput = filters => { const onChangeInput = filters => {
...@@ -135,7 +151,15 @@ const LoginLog = () => { ...@@ -135,7 +151,15 @@ const LoginLog = () => {
<Row className={styles.head}> <Row className={styles.head}>
<Col span={24}> <Col span={24}>
<span style={{ lineHeight: 2 }}>时间:</span> <span style={{ lineHeight: 2 }}>时间:</span>
<DatePicker <RangePicker
locale={locale}
showTime
format="YYYY-MM-DD HH:mm:ss"
onChange={changeTime}
value={allTime}
allowClear={false}
/>
{/* <DatePicker
showTime showTime
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
placeholder="起始时间" placeholder="起始时间"
...@@ -152,8 +176,10 @@ const LoginLog = () => { ...@@ -152,8 +176,10 @@ const LoginLog = () => {
onChange={changeEndTime} onChange={changeEndTime}
style={{ marginRight: '10px' }} style={{ marginRight: '10px' }}
allowClear={false} allowClear={false}
/> /> */}
<Button onClick={() => setTime(1)}>近1小时</Button> <Button onClick={() => setTime(1)} style={{ marginLeft: '20px' }}>
近1小时
</Button>
<Button onClick={() => setTime(6)}>近6小时</Button> <Button onClick={() => setTime(6)}>近6小时</Button>
<Button onClick={() => setTime(24)}>近1天</Button> <Button onClick={() => setTime(24)}>近1天</Button>
<Button onClick={() => setTime(24 * 7)}>近1周</Button> <Button onClick={() => setTime(24 * 7)}>近1周</Button>
......
...@@ -14,9 +14,13 @@ import { ...@@ -14,9 +14,13 @@ import {
} from 'antd'; } from 'antd';
import { SwapRightOutlined, SyncOutlined } from '@ant-design/icons'; import { SwapRightOutlined, SyncOutlined } from '@ant-design/icons';
import moment from 'moment'; import moment from 'moment';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import { get, PUBLISH_SERVICE } from '@/services/index'; import { get, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less'; import styles from './index.less';
const { RangePicker } = DatePicker;
const OmsLog = () => { const OmsLog = () => {
const [loading, setLoading] = useState(false); // 源数据 const [loading, setLoading] = useState(false); // 源数据
const [data, setData] = useState([]); // 源数据 const [data, setData] = useState([]); // 源数据
...@@ -28,6 +32,10 @@ const OmsLog = () => { ...@@ -28,6 +32,10 @@ const OmsLog = () => {
const [endTime, setEndTime] = useState( const [endTime, setEndTime] = useState(
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'), // 默认值当前时间 moment(new Date(), 'YYYY-MM-DD HH:mm:ss'), // 默认值当前时间
); );
const [allTime, setAllTime] = useState([
moment().startOf('month'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
]);
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
const [total, setTotal] = useState(); const [total, setTotal] = useState();
const [pageSize, setPageSize] = useState(20); const [pageSize, setPageSize] = useState(20);
...@@ -57,9 +65,21 @@ const OmsLog = () => { ...@@ -57,9 +65,21 @@ const OmsLog = () => {
title: '标签', title: '标签',
dataIndex: 'Label', dataIndex: 'Label',
key: 'Label', key: 'Label',
ellipsis: 'true', // width: 300,
width: 300, onCell: () => ({
render: item => searchStyle1(item), style: {
maxWidth: 300,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
render: record => (
<Tooltip placement="topLeft" title={record}>
{searchStyle1(record)}
</Tooltip>
),
}, },
{ {
title: '操作信息', title: '操作信息',
...@@ -129,16 +149,16 @@ const OmsLog = () => { ...@@ -129,16 +149,16 @@ const OmsLog = () => {
// 在起止时间任意一个变化后获取数据 // 在起止时间任意一个变化后获取数据
useEffect(() => { useEffect(() => {
if (startTime && endTime) { if (allTime) {
setLoading(true); setLoading(true);
getData(); getData();
} }
}, [startTime, endTime]); }, [allTime]);
const getData = () => { const getData = () => {
get(`${PUBLISH_SERVICE}/LogCenter/GetOmsCustomerLog`, { get(`${PUBLISH_SERVICE}/LogCenter/GetOmsCustomerLog`, {
logType: 'operationLog', logType: 'operationLog',
StartDateTime: startTime.format('YYYY-MM-DD HH:mm:ss'), StartDateTime: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
EndDate: endTime.format('YYYY-MM-DD HH:mm:ss'), EndDate: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
function: functionName, function: functionName,
label, label,
PageIndex: 1, PageIndex: 1,
...@@ -183,8 +203,8 @@ const OmsLog = () => { ...@@ -183,8 +203,8 @@ const OmsLog = () => {
const getData1 = (page, size) => { const getData1 = (page, size) => {
get(`${PUBLISH_SERVICE}/LogCenter/GetOmsCustomerLog`, { get(`${PUBLISH_SERVICE}/LogCenter/GetOmsCustomerLog`, {
logType: 'operationLog', logType: 'operationLog',
StartDateTime: startTime.format('YYYY-MM-DD HH:mm:ss'), StartDateTime: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
EndDate: endTime.format('YYYY-MM-DD HH:mm:ss'), EndDate: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
function: functionName, function: functionName,
label, label,
PageIndex: page, PageIndex: page,
...@@ -230,16 +250,24 @@ const OmsLog = () => { ...@@ -230,16 +250,24 @@ const OmsLog = () => {
const changeEndTime = time => { const changeEndTime = time => {
setEndTime(time); setEndTime(time);
}; };
const changeTime = time => {
setAllTime(time);
};
// 近1/6/12/24小时 // 近1/6/12/24小时
const setTime = time => { const setTime = time => {
setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss')); setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss'));
setStartTime( setStartTime(
moment(new Date(new Date().getTime() - time * 60 * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'), moment(new Date(new Date().getTime() - time * 60 * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'),
); );
setAllTime([
moment(new Date(new Date().getTime() - time * 60 * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
]);
}; };
const handleReset = () => { const handleReset = () => {
setStartTime(moment().startOf('month')); setStartTime(moment().startOf('month'));
setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss')); setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss'));
setAllTime([moment().startOf('month'), moment(new Date(), 'YYYY-MM-DD HH:mm:ss')]);
setFunctionName(''); setFunctionName('');
setFilteredValue([]); setFilteredValue([]);
setLabel(''); setLabel('');
...@@ -261,7 +289,15 @@ const OmsLog = () => { ...@@ -261,7 +289,15 @@ const OmsLog = () => {
<Row className={styles.head}> <Row className={styles.head}>
<Col span={24}> <Col span={24}>
<span style={{ lineHeight: 2 }}>时间:</span> <span style={{ lineHeight: 2 }}>时间:</span>
<DatePicker <RangePicker
locale={locale}
showTime
format="YYYY-MM-DD HH:mm:ss"
onChange={changeTime}
value={allTime}
allowClear={false}
/>
{/* <DatePicker
showTime showTime
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
placeholder="起始时间" placeholder="起始时间"
...@@ -278,8 +314,10 @@ const OmsLog = () => { ...@@ -278,8 +314,10 @@ const OmsLog = () => {
onChange={changeEndTime} onChange={changeEndTime}
style={{ marginRight: '10px' }} style={{ marginRight: '10px' }}
allowClear={false} allowClear={false}
/> /> */}
<Button onClick={() => setTime(1)}>近1小时</Button> <Button onClick={() => setTime(1)} style={{ marginLeft: '20px' }}>
近1小时
</Button>
{/* <Button onClick={() => setTime(6)}>近6小时</Button> */} {/* <Button onClick={() => setTime(6)}>近6小时</Button> */}
<Button onClick={() => setTime(24)}>近1天</Button> <Button onClick={() => setTime(24)}>近1天</Button>
<Button onClick={() => setTime(24 * 7)}>近1周</Button> <Button onClick={() => setTime(24 * 7)}>近1周</Button>
......
.omsLog{ .omsLog {
.head{ .head {
padding: 10px; padding: 10px;
background: white; background: white;
margin-bottom: 2px; margin-bottom: 2px;
min-width: 1030px; 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);
background-color: #f6f9fe;
} }
.chart{ .ant-table-body {
padding: 16px; height: calc(100vh - 208px);
background: white; border-right: white;
overflow: auto !important;
// .ant-table-tbody{
// overflow: scroll !important;
// }
} }
.table{ .ant-table-cell {
border-top: 1px solid #f0eded; overflow: hidden;
// overflow: auto;//不要这个,pagination否则无法固定底部 text-overflow: ellipsis;
.ant-table-thead tr th{ white-space: nowrap;
font-weight: 600; }
color:rgba(0,0,0,0.85); .ant-pagination {
background-color:#F6F9FE; z-index: 999;
} border-top: 1px solid #f0eded;
.ant-table-body{ }
height:calc(100vh - 208px); .ant-table.ant-table-small {
border-right: white; width: 99%;
overflow: auto !important; margin: 10px auto;
// .ant-table-tbody{ }
// overflow: scroll !important; .ant-table-pagination {
// } padding-right: 12px;
} background: white;
.ant-pagination{ margin: 1px 0;
z-index: 999; padding: 8px;
border-top: 1px solid #f0eded; padding-right: 20px;
} }
.ant-table.ant-table-small { }
width: 99%; .ant-spin-container {
margin: 10px auto; background-color: white;
} }
.ant-table-pagination{ .icon {
padding-right: 12px; margin-top: -5px !important;
background: white; vertical-align: text-bottom;
margin: 1px 0; }
padding:8px; }
padding-right: 20px;
}
}
.ant-spin-container {
background-color: white;
}
.icon{
margin-top: -5px !important;
vertical-align: text-bottom;
}
}
\ No newline at end of file
...@@ -15,11 +15,15 @@ import { ...@@ -15,11 +15,15 @@ import {
} from 'antd'; } from 'antd';
import { SwapRightOutlined, SyncOutlined, CaretUpFilled, CaretDownFilled } from '@ant-design/icons'; import { SwapRightOutlined, SyncOutlined, CaretUpFilled, CaretDownFilled } from '@ant-design/icons';
import { Chart, Interval, Line, Axis } from 'bizcharts'; import { Chart, Interval, Line, Axis } from 'bizcharts';
import moment from 'moment';
import { post, PUBLISH_SERVICE } from '@/services/index'; import { post, PUBLISH_SERVICE } from '@/services/index';
import moment from 'moment';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import styles from './index.less'; import styles from './index.less';
const { Option } = Select; const { Option } = Select;
const { Search } = Input; const { Search } = Input;
const { RangePicker } = DatePicker;
const ServiceLog = () => { const ServiceLog = () => {
const [loading, setLoading] = useState(false); // 源数据 const [loading, setLoading] = useState(false); // 源数据
...@@ -32,6 +36,10 @@ const ServiceLog = () => { ...@@ -32,6 +36,10 @@ const ServiceLog = () => {
const [endTime, setEndTime] = useState( const [endTime, setEndTime] = useState(
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'), // 默认值,当前时间 moment(new Date(), 'YYYY-MM-DD HH:mm:ss'), // 默认值,当前时间
); );
const [allTime, setAllTime] = useState([
moment().startOf('month'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
]);
const [logType, setLogType] = useState('9999'); // 请求参数,日志类型,默认是正常,0:成功 -1:异常 9999:全部 const [logType, setLogType] = useState('9999'); // 请求参数,日志类型,默认是正常,0:成功 -1:异常 9999:全部
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式 const [showSearchStyle, setShowSearchStyle] = useState(false); // 是否显示模糊查询样式
...@@ -45,8 +53,8 @@ const ServiceLog = () => { ...@@ -45,8 +53,8 @@ const ServiceLog = () => {
const [keepOrder, setKeepOrder] = useState(''); const [keepOrder, setKeepOrder] = useState('');
// 计算时间间隔(分钟) // 计算时间间隔(分钟)
const start = new Date(startTime).getTime(); const start = new Date(allTime[0]).getTime();
const end = new Date(endTime).getTime(); const end = new Date(allTime[1]).getTime();
const minuteInterval = (end - start) / (60 * 1000); // 相隔多少分钟 const minuteInterval = (end - start) / (60 * 1000); // 相隔多少分钟
const countInterval = () => { const countInterval = () => {
if (minuteInterval > 0 && minuteInterval <= 30) { if (minuteInterval > 0 && minuteInterval <= 30) {
...@@ -60,11 +68,16 @@ const ServiceLog = () => { ...@@ -60,11 +68,16 @@ const ServiceLog = () => {
} }
}; };
// 计算时间间隔(月份),禁止跨月份查询 // 计算时间间隔(月份),禁止跨月份查询
const startMonth = new Date(startTime).getMonth(); const startMonth = new Date(allTime[0]).getMonth();
const endMonth = new Date(endTime).getMonth(); const endMonth = new Date(allTime[1]).getMonth();
const startYear = new Date(startTime).getYear(); const startYear = new Date(allTime[0]).getYear();
const endYear = new Date(endTime).getYear(); const endYear = new Date(allTime[1]).getYear();
if (minuteInterval <= 0) { if (minuteInterval <= 0) {
console.log(start);
console.log(end);
console.log(allTime[0]);
console.log(allTime[1]);
console.log(minuteInterval);
notification.error({ notification.error({
message: '时间设置有误', message: '时间设置有误',
description: '起始时间应该早于结束时间', description: '起始时间应该早于结束时间',
...@@ -82,7 +95,7 @@ const ServiceLog = () => { ...@@ -82,7 +95,7 @@ const ServiceLog = () => {
dataIndex: 'Path', dataIndex: 'Path',
key: 'Path', key: 'Path',
fixed: 'left', fixed: 'left',
width: 400, width: 300,
render: item => searchStyle(item), render: item => searchStyle(item),
}, },
{ {
...@@ -207,8 +220,8 @@ const ServiceLog = () => { ...@@ -207,8 +220,8 @@ const ServiceLog = () => {
// 获取日志表数据时PageSize设置为200,其他接口默认值20 // 获取日志表数据时PageSize设置为200,其他接口默认值20
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'), DateFrom: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'), DateTo: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
IP: '', IP: '',
Module: searchWord, Module: searchWord,
LogType: +logType, LogType: +logType,
...@@ -258,8 +271,8 @@ const ServiceLog = () => { ...@@ -258,8 +271,8 @@ const ServiceLog = () => {
// 获取日志表数据时PageSize设置为200,其他接口默认值20 // 获取日志表数据时PageSize设置为200,其他接口默认值20
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'), DateFrom: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'), DateTo: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
IP: '', IP: '',
Module: searchWord, Module: searchWord,
LogType: +logType, LogType: +logType,
...@@ -310,42 +323,24 @@ const ServiceLog = () => { ...@@ -310,42 +323,24 @@ const ServiceLog = () => {
}; };
// 在起止时间任意一个变化后获取数据,且起止时间应该早于结束时间,且不允许跨月查询 // 在起止时间任意一个变化后获取数据,且起止时间应该早于结束时间,且不允许跨月查询
useEffect(() => { useEffect(() => {
if ( if (allTime && end - start > 0 && startMonth === endMonth && startYear === endYear) {
startTime &&
endTime &&
end - start > 0 &&
startMonth === endMonth &&
startYear === endYear
) {
countInterval(); // 根据起止时间计算时间间隔 countInterval(); // 根据起止时间计算时间间隔
} }
}, [startTime, endTime]); }, [allTime]);
useEffect(() => { useEffect(() => {
if ( if (allTime && end - start > 0 && startMonth === endMonth && startYear === endYear) {
startTime &&
endTime &&
end - start > 0 &&
startMonth === endMonth &&
startYear === endYear
) {
setLoading(true); setLoading(true);
getData('/TrafficStatistics', setVisitedCount); // 访问量统计 getData('/TrafficStatistics', setVisitedCount); // 访问量统计
} }
}, [startTime, endTime, logType, timeInterval]); }, [allTime, logType, timeInterval]);
useEffect(() => { useEffect(() => {
if ( if (allTime && end - start > 0 && startMonth === endMonth && startYear === endYear) {
startTime &&
endTime &&
end - start > 0 &&
startMonth === endMonth &&
startYear === endYear
) {
setLoading(true); setLoading(true);
getData('/TopCountList', setPathCount); // 接口调用频次统计 getData('/TopCountList', setPathCount); // 接口调用频次统计
getData('/TopConsumeList', setReponseTime); // 接口平均耗时统计 getData('/TopConsumeList', setReponseTime); // 接口平均耗时统计
getData('/GetOMSLog', setDataTable); // 接口调用记录 getData('/GetOMSLog', setDataTable); // 接口调用记录
} }
}, [startTime, endTime, logType]); }, [allTime, logType]);
// 封装接口请求,参数url/设置方法set // 封装接口请求,参数url/设置方法set
const getData = (url, set) => { const getData = (url, set) => {
...@@ -353,8 +348,8 @@ const ServiceLog = () => { ...@@ -353,8 +348,8 @@ const ServiceLog = () => {
// 获取日志表数据时PageSize设置为200,其他接口默认值20 // 获取日志表数据时PageSize设置为200,其他接口默认值20
PageIndex: 1, PageIndex: 1,
PageSize: 20, PageSize: 20,
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'), DateFrom: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'), DateTo: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
IP: '', IP: '',
Module: url === '/GetOMSLog' ? searchWord : '', Module: url === '/GetOMSLog' ? searchWord : '',
LogType: +logType, LogType: +logType,
...@@ -408,8 +403,8 @@ const ServiceLog = () => { ...@@ -408,8 +403,8 @@ const ServiceLog = () => {
data = { data = {
PageIndex: page, PageIndex: page,
PageSize: size, PageSize: size,
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'), DateFrom: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'), DateTo: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
IP: '', IP: '',
Module: searchWord, Module: searchWord,
LogType: +logType, LogType: +logType,
...@@ -424,8 +419,8 @@ const ServiceLog = () => { ...@@ -424,8 +419,8 @@ const ServiceLog = () => {
data = { data = {
PageIndex: page, PageIndex: page,
PageSize: size, PageSize: size,
DateFrom: startTime.format('YYYY-MM-DD HH:mm:ss'), DateFrom: allTime[0].format('YYYY-MM-DD HH:mm:ss'),
DateTo: endTime.format('YYYY-MM-DD HH:mm:ss'), DateTo: allTime[1].format('YYYY-MM-DD HH:mm:ss'),
IP: '', IP: '',
Module: searchWord, Module: searchWord,
LogType: +logType, LogType: +logType,
...@@ -466,16 +461,26 @@ const ServiceLog = () => { ...@@ -466,16 +461,26 @@ const ServiceLog = () => {
// DatePicker改变点击确定时 // DatePicker改变点击确定时
const changeStartTime = time => { const changeStartTime = time => {
console.log(time);
setStartTime(time); setStartTime(time);
}; };
const changeEndTime = time => { const changeEndTime = time => {
console.log(time);
setEndTime(time); setEndTime(time);
}; };
const changeTime = time => {
console.log(time);
setAllTime(time);
};
// 近1/6/12/24小时,同时设置对应的时间间隔 // 近1/6/12/24小时,同时设置对应的时间间隔
const setTime = (time, value) => { const setTime = (time, value) => {
setTimeInterval(value); setTimeInterval(value);
setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss'));
setStartTime(moment(new Date(new Date().getTime() - time * 60 * 1000), 'YYYY-MM-DD HH:mm:ss')); setStartTime(moment(new Date(new Date().getTime() - time * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'));
setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss'));
setAllTime([
moment(new Date(new Date().getTime() - time * 60 * 1000), 'YYYY-MM-DD HH:mm:ss'),
moment(new Date(), 'YYYY-MM-DD HH:mm:ss'),
]);
}; };
// 设置返回状态 // 设置返回状态
const changeStatus = value => { const changeStatus = value => {
...@@ -494,6 +499,7 @@ const ServiceLog = () => { ...@@ -494,6 +499,7 @@ const ServiceLog = () => {
setTimeInterval('4'); setTimeInterval('4');
setStartTime(moment().startOf('month')); setStartTime(moment().startOf('month'));
setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss')); setEndTime(moment(new Date(), 'YYYY-MM-DD HH:mm:ss'));
setAllTime([moment().startOf('month'), moment(new Date(), 'YYYY-MM-DD HH:mm:ss')]);
setSearchWord(''); setSearchWord('');
setShowSearchStyle(false); setShowSearchStyle(false);
}; };
...@@ -515,7 +521,16 @@ const ServiceLog = () => { ...@@ -515,7 +521,16 @@ const ServiceLog = () => {
<Row className={styles.head}> <Row className={styles.head}>
<Col span={24}> <Col span={24}>
<span>时间:</span> <span>时间:</span>
<DatePicker <RangePicker
locale={locale}
showTime
format="YYYY-MM-DD HH:mm:ss"
onChange={changeTime}
value={allTime}
allowClear={false}
/>
{/* <DatePicker
locale={locale}
showTime showTime
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
placeholder="起始时间" placeholder="起始时间"
...@@ -525,6 +540,7 @@ const ServiceLog = () => { ...@@ -525,6 +540,7 @@ const ServiceLog = () => {
/> />
<SwapRightOutlined style={{ verticalAlign: '0.125em' }} /> <SwapRightOutlined style={{ verticalAlign: '0.125em' }} />
<DatePicker <DatePicker
locale={locale}
showTime showTime
format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss"
placeholder="结束时间" placeholder="结束时间"
...@@ -532,8 +548,10 @@ const ServiceLog = () => { ...@@ -532,8 +548,10 @@ const ServiceLog = () => {
onChange={changeEndTime} onChange={changeEndTime}
style={{ marginRight: '10px' }} style={{ marginRight: '10px' }}
allowClear={false} allowClear={false}
/> /> */}
<Button onClick={() => setTime(15, '1')}>近15分钟</Button> <Button onClick={() => setTime(15, '1')} style={{ marginLeft: '10px' }}>
近15分钟
</Button>
<Button onClick={() => setTime(60, '2')}>近1小时</Button> <Button onClick={() => setTime(60, '2')}>近1小时</Button>
<Button onClick={() => setTime(12 * 60, '3')}>近12小时</Button> <Button onClick={() => setTime(12 * 60, '3')}>近12小时</Button>
<Button onClick={() => setTime(24 * 60, '3')}>近1天</Button> <Button onClick={() => setTime(24 * 60, '3')}>近1天</Button>
......
...@@ -65,3 +65,7 @@ ...@@ -65,3 +65,7 @@
.ant-select-arrow .anticon > svg { .ant-select-arrow .anticon > svg {
vertical-align: middle; vertical-align: middle;
} }
.ant-picker-separator {
display: flex;
align-items: center;
}
/* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */
/* eslint-disable prefer-template */ /* eslint-disable prefer-template */
/* eslint-disable react/jsx-boolean-value */ /* eslint-disable react/jsx-boolean-value */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
...@@ -294,8 +296,12 @@ const AddModal = props => { ...@@ -294,8 +296,12 @@ const AddModal = props => {
{ {
validator: (rule, value) => { validator: (rule, value) => {
let aa = form.getFieldValue().systemName; let aa = form.getFieldValue().systemName;
let regEn = /[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im;
let regCn = /[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im;
if (keepSystemName.indexOf(aa) != -1) { if (keepSystemName.indexOf(aa) != -1) {
return Promise.reject('名称已存在'); return Promise.reject('名称已存在');
} else if (regEn.test(aa) || regCn.test(aa)) {
return Promise.reject('名称不能包含特殊字符');
} }
return Promise.resolve(); return Promise.resolve();
}, },
......
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