Commit 187c5ce4 authored by 皮倩雯's avatar 皮倩雯

fix: '重构事件模块代码'

parent 651866fa
Pipeline #42958 skipped with stages
...@@ -25,7 +25,6 @@ import { ...@@ -25,7 +25,6 @@ import {
Form, Form,
Input, Input,
notification, notification,
message,
Space, Space,
Row, Row,
Col, Col,
...@@ -45,27 +44,13 @@ import { ...@@ -45,27 +44,13 @@ import {
GetCM_Event_QueryEventType, GetCM_Event_QueryEventType,
CM_Event_AddEventTable, CM_Event_AddEventTable,
} from '@/services/standingBook/api'; } from '@/services/standingBook/api';
import { PlusOutlined, DownOutlined, InfoCircleOutlined } from '@ant-design/icons';
import styles from './incident.less'; import styles from './incident.less';
import ChangeAdd from './changeAdd'; import ChangeAdd from './changeAdd';
import ChangeEdit from './changeEdit'; import ChangeEdit from './changeEdit';
import ChangeImage from './ChangeImage';
import ModalDrag from '../../maintenance/ModalDrag';
import { PlusOutlined, DownOutlined, InfoCircleOutlined } from '@ant-design/icons';
import { set } from 'immutable';
import { getRoleGroup } from '@/services/RoleManage/api';
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const [inputValue, setInputValue] = useState({
SummaryFields: '',
ReportFields: '',
DisplayFields: '',
EditableFields: '',
TransitFields: '',
Roles: '',
RelatedEventFields: '',
pictureFields: '',
});
const { const {
callBackSubmit = () => {}, callBackSubmit = () => {},
visible, visible,
...@@ -456,47 +441,26 @@ const AddModal = props => { ...@@ -456,47 +441,26 @@ const AddModal = props => {
'40840': 'YK', '40840': 'YK',
'40863': 'QJG', '40863': 'QJG',
}); });
const CheckboxGroup = Checkbox.Group;
const defaultCheckedList = ['前端', '手持'];
// const plainOptions = ['前端', '手持']
const [checkedList, setCheckedList] = useState(defaultCheckedList);
const [checkedList1, setCheckedList1] = useState([]); const [checkedList1, setCheckedList1] = useState([]);
const [checkedList2, setCheckedList2] = useState([]);
const [checkedList3, setCheckedList3] = useState([]);
const [checkedList4, setCheckedList4] = useState([]);
const [nu, setNu] = useState([]); const [nu, setNu] = useState([]);
const [nu1, setNu1] = useState([]); const [nu1, setNu1] = useState([]);
const [editable, setEditable] = useState(false); const [editable, setEditable] = useState(false);
const [ReportFromMobile, setReportFromMobile] = useState(false); const [ReportFromMobile, setReportFromMobile] = useState(false);
const [ReportFromWeb, setReportFromWeb] = useState(false); const [ReportFromWeb, setReportFromWeb] = useState(false);
const [chee, setChee] = useState(0); const [chee, setChee] = useState(0);
const [indeterminate, setIndeterminate] = useState(true);
const [checkAll, setCheckAll] = useState(true);
const [pickItem, setPickItem] = useState(''); const [pickItem, setPickItem] = useState('');
const [prefixName, setPrefixName] = useState(''); const [prefixName, setPrefixName] = useState('');
const [selectValue, setSelectValue] = useState(''); const [selectValue, setSelectValue] = useState('');
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [standingTable, setStandingTable] = useState([]); const [standingTable, setStandingTable] = useState([]);
const [filed, setFiled] = useState({}); // 传给子组件列表数据 const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据 const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [flag, setFlag] = useState(0); const [flag, setFlag] = useState(0);
const [value, setValue] = useState(''); // 单选 const [value, setValue] = useState(''); // 单选
const [types, setTypes] = useState(''); // 弹窗类型
const [Order, setOrder] = useState(''); // 弹窗类型 const [Order, setOrder] = useState(''); // 弹窗类型
const [Type1, setType1] = useState(''); const [Type1, setType1] = useState('');
const [number, setNumber] = useState('');
const [isVisible, setIsVisible] = useState(false); // 事件权限弹窗 const [isVisible, setIsVisible] = useState(false); // 事件权限弹窗
const [isVisibleEdit, setIsVisibleEdit] = useState(false); // 字段弹框 const [isVisibleEdit, setIsVisibleEdit] = useState(false); // 字段弹框
const [isVisible1, setIsVisible1] = useState(false); // 弹窗
const [characterValue, setCharacterValue] = useState('');
const [form] = Form.useForm(); const [form] = Form.useForm();
const [summaryIsShow, setSummaryIsShow] = useState('none'); // 摘要字段外部字段是否显示 const [summaryIsShow, setSummaryIsShow] = useState('none'); // 摘要字段外部字段是否显示
const [reportIsShow, setReportIsShow] = useState('none'); // 上报字段外部字段是否显示 const [reportIsShow, setReportIsShow] = useState('none'); // 上报字段外部字段是否显示
...@@ -532,19 +496,19 @@ const AddModal = props => { ...@@ -532,19 +496,19 @@ const AddModal = props => {
obj.CreateMode = obj.CreateMode.toString(); obj.CreateMode = obj.CreateMode.toString();
} }
if (editable != true) { if (editable != true) {
inputValue.Editable = false; obj.Editable = false;
} else { } else {
inputValue.Editable = editable; obj.Editable = editable;
} }
if (checkedList3 === true && checkedList4 === true) { if (ReportFromWeb === true && ReportFromMobile === true) {
obj.Reportable = '均可'; obj.Reportable = '均可';
obj.ReportFromMobile = '手持'; obj.ReportFromMobile = '手持';
obj.ReportFromWeb = '前端'; obj.ReportFromWeb = '前端';
} else if (checkedList3 === true) { } else if (ReportFromWeb === true) {
obj.Reportable = '前端'; obj.Reportable = '前端';
obj.ReportFromMobile = ''; obj.ReportFromMobile = '';
obj.ReportFromWeb = '前端'; obj.ReportFromWeb = '前端';
} else if (checkedList4 === true) { } else if (ReportFromMobile === true) {
obj.Reportable = '手持'; obj.Reportable = '手持';
obj.ReportFromMobile = '手持'; obj.ReportFromMobile = '手持';
obj.ReportFromWeb = ''; obj.ReportFromWeb = '';
...@@ -553,25 +517,7 @@ const AddModal = props => { ...@@ -553,25 +517,7 @@ const AddModal = props => {
obj.ReportFromMobile = ''; obj.ReportFromMobile = '';
obj.ReportFromWeb = ''; obj.ReportFromWeb = '';
} }
if (ReportFromWeb === true && ReportFromMobile === true) { if ((obj.Roles == '' || obj.Roles == undefined) && obj.Reportable != '否') {
inputValue.Reportable = '均可';
inputValue.ReportFromMobile = '手持';
inputValue.ReportFromWeb = '前端';
} else if (ReportFromWeb === true) {
inputValue.Reportable = '前端';
inputValue.ReportFromMobile = '';
inputValue.ReportFromWeb = '前端';
} else if (ReportFromMobile === true) {
inputValue.Reportable = '手持';
inputValue.ReportFromMobile = '手持';
inputValue.ReportFromWeb = '';
} else {
inputValue.Reportable = '否';
inputValue.ReportFromMobile = '';
inputValue.ReportFromWeb = '';
}
let data = { ...obj, ...inputValue, Order: maxLength };
if (inputValue.Roles == '' && inputValue.Reportable != '否') {
notification.warning({ notification.warning({
message: '提示', message: '提示',
description: '当允许客户端上报时,须填写事件权限', description: '当允许客户端上报时,须填写事件权限',
...@@ -579,24 +525,10 @@ const AddModal = props => { ...@@ -579,24 +525,10 @@ const AddModal = props => {
} else { } else {
if (type == 'edit') { if (type == 'edit') {
CM_Event_EditEventTable({ CM_Event_EditEventTable({
...inputValue,
ID: formObj.ID, ID: formObj.ID,
Name: obj.Name, ...obj,
Code: obj.Code, Order,
BusinessType: obj.BusinessType, }).then(res => {
TableName: obj.TableName,
Reportable: inputValue.Reportable,
ReportFromWeb: inputValue.ReportFromWeb,
ReportFromMobile: inputValue.ReportFromMobile,
Editable: inputValue.Editable,
CreateMode: obj.CreateMode,
TopWhere: obj.TopWhere,
ReportPage: obj.ReportPage,
DealPage: obj.DealPage,
RelatedEvents: obj.RelatedEvents,
InterfaceConfig: obj.InterfaceConfig,
})
.then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
form.resetFields(); form.resetFields();
...@@ -614,20 +546,17 @@ const AddModal = props => { ...@@ -614,20 +546,17 @@ const AddModal = props => {
description: res.msg, description: res.msg,
}); });
} }
})
.catch(error => {
notification.error({
message: '提示',
duration: 3,
description: '编辑失败',
});
setLoading(false);
}); });
setFlag(0); setFlag(0);
} }
if (type == 'add') { if (type == 'add') {
CM_Event_AddEventTable(data) if (obj.TransitFields == undefined) {
.then(res => { obj.TransitFields = '';
}
if (obj.Roles == undefined) {
obj.Roles = '';
}
CM_Event_AddEventTable({ ...obj, Order: maxLength }).then(res => {
setLoading(false); setLoading(false);
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
form.resetFields(); form.resetFields();
...@@ -645,14 +574,6 @@ const AddModal = props => { ...@@ -645,14 +574,6 @@ const AddModal = props => {
description: res.msg, description: res.msg,
}); });
} }
})
.catch(error => {
notification.error({
message: '提示',
duration: 3,
description: '新增失败',
});
setLoading(false);
}); });
setFlag(0); setFlag(0);
} }
...@@ -670,21 +591,10 @@ const AddModal = props => { ...@@ -670,21 +591,10 @@ const AddModal = props => {
setType1(rember1); setType1(rember1);
form.setFieldsValue({ BusinessType: rember1 }); form.setFieldsValue({ BusinessType: rember1 });
setReportFromWeb(true); setReportFromWeb(true);
setCheckedList3(true);
setChee(0); setChee(0);
setValue(0); setValue(0);
getEventData(); getEventData();
setSelectValue(selectData[0]); setSelectValue(selectData[0]);
setInputValue({
SummaryFields: '',
ReportFields: '',
DisplayFields: '',
EditableFields: '',
TransitFields: '',
Roles: '',
RelatedEventFields: '',
pictureFields: '',
});
setFiled({}); setFiled({});
setFiled1({}); setFiled1({});
form.resetFields(); form.resetFields();
...@@ -695,12 +605,10 @@ const AddModal = props => { ...@@ -695,12 +605,10 @@ const AddModal = props => {
getEventData1(); getEventData1();
GetCM_Event_QueryEventType({ eventTypeId: formObj.ID }).then(res => { GetCM_Event_QueryEventType({ eventTypeId: formObj.ID }).then(res => {
if (res.data.root) { if (res.data.root) {
console.log(res.data.root);
setEditable(res.data.root.Editable); setEditable(res.data.root.Editable);
setReportFromMobile(res.data.root.ReportFromMobile); setReportFromMobile(res.data.root.ReportFromMobile);
setReportFromWeb(res.data.root.ReportFromWeb); setReportFromWeb(res.data.root.ReportFromWeb);
setType1(res.data.root.BusinessType); setType1(res.data.root.BusinessType);
setInputValue({ ...res.data.root });
setOrder(res.data.root.Order); setOrder(res.data.root.Order);
form.setFieldsValue({ ...res.data.root }); form.setFieldsValue({ ...res.data.root });
LoadEventFields({ LoadEventFields({
...@@ -759,16 +667,19 @@ const AddModal = props => { ...@@ -759,16 +667,19 @@ const AddModal = props => {
setReportFromWeb(false); setReportFromWeb(false);
form.resetFields(); form.resetFields();
setValue(''); setValue('');
setInputValue({ setSummaryIsShow('none');
SummaryFields: '', setReportIsShow('none');
ReportFields: '', setDisplayIsShow('none');
DisplayFields: '', setEditableIsShow('none');
EditableFields: '', setTransitIsShow('none');
TransitFields: '', setRelatedEventIsShow('none');
Roles: '', } else if (type == 'add') {
RelatedEventFields: '', setSummaryIsShow('none');
pictureFields: '', setReportIsShow('none');
}); setDisplayIsShow('none');
setEditableIsShow('none');
setTransitIsShow('none');
setRelatedEventIsShow('none');
} }
}, [visible]); }, [visible]);
...@@ -810,7 +721,6 @@ const AddModal = props => { ...@@ -810,7 +721,6 @@ const AddModal = props => {
if (res.data.root) { if (res.data.root) {
setNu(res.data.root); setNu(res.data.root);
setFiled(formateArrDataA(res.data.root, 'group')); setFiled(formateArrDataA(res.data.root, 'group'));
console.log(res.data.root);
ExternalSummaryField(res.data.root); ExternalSummaryField(res.data.root);
ExternalReportField(res.data.root); ExternalReportField(res.data.root);
ExternalDisplayField(res.data.root); ExternalDisplayField(res.data.root);
...@@ -823,8 +733,9 @@ const AddModal = props => { ...@@ -823,8 +733,9 @@ const AddModal = props => {
// 摘要字段外部字段 // 摘要字段外部字段
const ExternalSummaryField = e => { const ExternalSummaryField = e => {
if (form.getFieldValue().SummaryFields) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = inputValue.SummaryFields.split(','); let ab = form.getFieldValue().SummaryFields.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -848,11 +759,15 @@ const AddModal = props => { ...@@ -848,11 +759,15 @@ const AddModal = props => {
} else { } else {
setSummaryIsShow('none'); setSummaryIsShow('none');
} }
} else {
setSummaryIsShow('none');
}
}; };
// 上报字段外部字段 // 上报字段外部字段
const ExternalReportField = e => { const ExternalReportField = e => {
if (form.getFieldValue().ReportFields) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = inputValue.ReportFields.split(','); let ab = form.getFieldValue().ReportFields.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -876,11 +791,15 @@ const AddModal = props => { ...@@ -876,11 +791,15 @@ const AddModal = props => {
} else { } else {
setReportIsShow('none'); setReportIsShow('none');
} }
} else {
setReportIsShow('none');
}
}; };
// 显示字段外部字段 // 显示字段外部字段
const ExternalDisplayField = e => { const ExternalDisplayField = e => {
if (form.getFieldValue().DisplayFields) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = inputValue.DisplayFields.split(','); let ab = form.getFieldValue().DisplayFields.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -904,11 +823,15 @@ const AddModal = props => { ...@@ -904,11 +823,15 @@ const AddModal = props => {
} else { } else {
setDisplayIsShow('none'); setDisplayIsShow('none');
} }
} else {
setDisplayIsShow('none');
}
}; };
// 编辑字段外部字段 // 编辑字段外部字段
const ExternalEditableField = e => { const ExternalEditableField = e => {
if (form.getFieldValue().EditableFields) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = inputValue.EditableFields.split(','); let ab = form.getFieldValue().EditableFields.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -932,11 +855,15 @@ const AddModal = props => { ...@@ -932,11 +855,15 @@ const AddModal = props => {
} else { } else {
setEditableIsShow('none'); setEditableIsShow('none');
} }
} else {
setEditableIsShow('none');
}
}; };
// 转单字段外部字段 // 转单字段外部字段
const ExternalTransitField = e => { const ExternalTransitField = e => {
if (form.getFieldValue().TransitFields) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = inputValue.TransitFields.split(','); let ab = form.getFieldValue().TransitFields.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -960,11 +887,15 @@ const AddModal = props => { ...@@ -960,11 +887,15 @@ const AddModal = props => {
} else { } else {
setTransitIsShow('none'); setTransitIsShow('none');
} }
} else {
setTransitIsShow('none');
}
}; };
// 关联字段外部字段 // 关联字段外部字段
const ExternalRelatedEventField = e => { const ExternalRelatedEventField = e => {
if (form.getFieldValue().RelatedEventFields) {
let pp = formateArrDataA(e, 'group'); let pp = formateArrDataA(e, 'group');
let ab = inputValue.RelatedEventFields.split(','); let ab = form.getFieldValue().RelatedEventFields.split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -988,6 +919,9 @@ const AddModal = props => { ...@@ -988,6 +919,9 @@ const AddModal = props => {
} else { } else {
setRelatedEventIsShow('none'); setRelatedEventIsShow('none');
} }
} else {
setRelatedEventIsShow('none');
}
}; };
const formateArrDataA = (initialArr, name) => { const formateArrDataA = (initialArr, name) => {
...@@ -1094,94 +1028,32 @@ const AddModal = props => { ...@@ -1094,94 +1028,32 @@ const AddModal = props => {
} }
return tempObj; return tempObj;
}; };
const onChange = list => {
console.log(list);
setCheckedList(list);
setIndeterminate(!!list.length && list.length < ['前端', '手持'].length);
setCheckAll(list.length === ['前端', '手持'].length);
};
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? ['前端', '手持'] : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
const onChange1 = e => { const onChange1 = e => {
setEditable(e.target.checked); setEditable(e.target.checked);
setCheckedList2(e.target.checked); //true
}; };
const onChange2 = e => { const onChange2 = e => {
setValue(e.target.value); setValue(e.target.value);
}; };
const onChange3 = e => { const onChange3 = e => {
setReportFromWeb(e.target.checked); setReportFromWeb(e.target.checked);
setCheckedList3(e.target.checked); //true
}; };
const onChange4 = e => { const onChange4 = e => {
setReportFromMobile(e.target.checked); setReportFromMobile(e.target.checked);
setCheckedList4(e.target.checked); //true
}; };
const onOK = prop => { const onOK = prop => {
setIsVisible(false); setIsVisible(false);
let inputText = { ...inputValue }; let inputText = {};
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.stt); setCheckedList1(prop.stt);
setInputValue(inputText); form.setFieldsValue(inputText);
// if (prop.isType == 'app') {
// let title = prop.title;
// let selectData = prop.stt;
// let ff = prop.filed22;
// let aa = [];
// let bb = 0;
// title.map((item, index) => {
// console.log(ff[item]);
// aa = [];
// selectData.map((item1, index1) => {
// console.log(item1);
// if (ff[item].indexOf(item1) != -1) {
// aa.push(item1);
// }
// });
// console.log(aa);
// if (item == '外部字段' && aa.length == 0) {
// bb = 0;
// } else {
// // eslint-disable-next-line no-lonely-if
// if (aa.length == 0) {
// bb = 1;
// }
// }
// });
// console.log(aa);
// if (bb == 1) {
// notification.error({
// message: '提示',
// description: '部门站点角色必须都选至少一项',
// });
// } else {
// setIsVisible(false);
// let inputText = { ...inputValue };
// console.log(inputText);
// console.log(prop.str);
// inputText[prop.pickItem] = prop.str;
// setCheckedList1(prop.stt);
// setInputValue(inputText);
// }
// } else {
// setIsVisible(false);
// let inputText = { ...inputValue };
// inputText[prop.pickItem] = prop.str;
// setCheckedList1(prop.stt);
// setInputValue(inputText);
// }
}; };
const onOK1 = prop => { const onOK1 = prop => {
setIsVisibleEdit(false); setIsVisibleEdit(false);
let inputText = { ...inputValue }; let inputText = {};
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.stt); setCheckedList1(prop.stt);
setInputValue(inputText); form.setFieldsValue(inputText);
// 外部字段提示 // 外部字段提示
if (prop.pickItem == 'SummaryFields') { if (prop.pickItem == 'SummaryFields') {
setSummaryValue(prop.valueArr.length); setSummaryValue(prop.valueArr.length);
...@@ -1232,15 +1104,14 @@ const AddModal = props => { ...@@ -1232,15 +1104,14 @@ const AddModal = props => {
} }
} }
}; };
const oKK = prop => {
setIsVisible1(false);
};
const pickFiled = fileds => { const pickFiled = fileds => {
if (form.getFieldsValue().TableName) { if (form.getFieldsValue().TableName) {
setFlag(flag + 1); setFlag(flag + 1);
} }
let pp = formateArrDataA(nu, 'group'); let pp = formateArrDataA(nu, 'group');
let ab = inputValue[fileds].split(','); if (form.getFieldValue(fileds)) {
let ab = form.getFieldValue(fileds).split(',');
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -1262,57 +1133,33 @@ const AddModal = props => { ...@@ -1262,57 +1133,33 @@ const AddModal = props => {
pp.外部字段 = a; pp.外部字段 = a;
arr.push('外部字段'); arr.push('外部字段');
} }
console.log(pp);
setFiled(pp); setFiled(pp);
setTypes('add'); setCheckedList1(form.getFieldValue(fileds).split(','));
setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds); setPickItem(fileds);
setIsVisibleEdit(true); setIsVisibleEdit(true);
} else {
setFiled(pp);
setCheckedList1([]);
setPickItem(fileds);
setIsVisibleEdit(true);
}
}; };
const pickFiled1 = fileds => { const pickFiled1 = fileds => {
let pp = formateArrDataA1(nu1, 'group'); let pp = formateArrDataA1(nu1, 'group');
let ab = inputValue[fileds].split(','); if (form.getFieldValue(fileds)) {
let arr = Object.keys(pp); setFiled1(pp);
let b = []; setCheckedList1(form.getFieldValue(fileds).split(','));
let a = []; setPickItem(fileds);
arr.map((item, index) => { setIsVisible(true);
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else { } else {
a.push(item);
}
}
});
// if (a.length > 0) {
// pp.外部字段 = a;
// console.log(pp);
// arr.push('外部字段');
// }
setFiled1(pp); setFiled1(pp);
setTypes('app'); setCheckedList1([]);
setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds); setPickItem(fileds);
setIsVisible(true); setIsVisible(true);
}
}; };
const pickFiled2 = fileds => {
// setCharacterValue(inputValue[fileds])
// setCheckedList1(inputValue[fileds].split(','))
// setPickItem(fileds)
setIsVisible1(true);
};
const changeText = (e, type) => {
let inputText = { ...inputValue };
inputText[type] = e.target.value;
setInputValue(inputText);
};
const prefix = e => { const prefix = e => {
let str = e.target.value; let str = e.target.value;
if (typeof str != 'string') { if (typeof str != 'string') {
...@@ -1380,20 +1227,12 @@ const AddModal = props => { ...@@ -1380,20 +1227,12 @@ const AddModal = props => {
const onCancel11 = () => { const onCancel11 = () => {
setIsVisibleEdit(false); setIsVisibleEdit(false);
}; };
const onCancel1 = () => {
setIsVisible1(false);
};
// const title = <ModalDrag title={type === 'add' ? '添加事件类型' : '编辑事件类型'} />
return ( return (
<Drawer <Drawer
title={type === 'add' ? '添加事件类型' : '编辑事件类型'} title={type === 'add' ? '添加事件类型' : '编辑事件类型'}
width="600px" width="600px"
destroyOnClose destroyOnClose
// afterClose={() => {
// setEditable(false);
// setReportFromMobile(false);
// setReportFromWeb(false);
// }}
{...props} {...props}
footer={ footer={
<Space> <Space>
...@@ -1515,11 +1354,7 @@ const AddModal = props => { ...@@ -1515,11 +1354,7 @@ const AddModal = props => {
}, },
]} ]}
> >
<Select <Select placeholder="选择事件主表" onChange={changTable}>
placeholder="选择事件主表"
onChange={changTable}
// defaultValue={selectValue}
>
{standingTable {standingTable
? standingTable.map((item, index) => ( ? standingTable.map((item, index) => (
<Option key={index} value={item.text}> <Option key={index} value={item.text}>
...@@ -1610,7 +1445,7 @@ const AddModal = props => { ...@@ -1610,7 +1445,7 @@ const AddModal = props => {
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.SummaryFields == '') { if (form.getFieldValue().SummaryFields == '') {
return Promise.reject('摘要字段必选'); return Promise.reject('摘要字段必选');
} }
return Promise.resolve(); return Promise.resolve();
...@@ -1618,19 +1453,15 @@ const AddModal = props => { ...@@ -1618,19 +1453,15 @@ const AddModal = props => {
}, },
]} ]}
> >
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="SummaryFields" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择摘要字段" allowClear />
placeholder="请选择摘要字段" </Form.Item>
onChange={e => changeText(e, 'SummaryFields')}
value={inputValue.SummaryFields}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('SummaryFields')} onClick={() => pickFiled('SummaryFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
...@@ -1666,7 +1497,7 @@ const AddModal = props => { ...@@ -1666,7 +1497,7 @@ const AddModal = props => {
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.ReportFields == '') { if (form.getFieldValue().ReportFields == '') {
return Promise.reject('上报字段必选'); return Promise.reject('上报字段必选');
} }
return Promise.resolve(); return Promise.resolve();
...@@ -1674,19 +1505,15 @@ const AddModal = props => { ...@@ -1674,19 +1505,15 @@ const AddModal = props => {
}, },
]} ]}
> >
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="ReportFields" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择上报字段" allowClear />
placeholder="请选择上报字段" </Form.Item>
onChange={e => changeText(e, 'ReportFields')}
value={inputValue.ReportFields}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('ReportFields')} onClick={() => pickFiled('ReportFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
...@@ -1722,7 +1549,7 @@ const AddModal = props => { ...@@ -1722,7 +1549,7 @@ const AddModal = props => {
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.DisplayFields == '') { if (form.getFieldValue().DisplayFields == '') {
return Promise.reject('显示字段必选'); return Promise.reject('显示字段必选');
} }
return Promise.resolve(); return Promise.resolve();
...@@ -1730,19 +1557,15 @@ const AddModal = props => { ...@@ -1730,19 +1557,15 @@ const AddModal = props => {
}, },
]} ]}
> >
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="DisplayFields" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择显示字段" allowClear />
placeholder="请选择显示字段" </Form.Item>
onChange={e => changeText(e, 'DisplayFields')}
value={inputValue.DisplayFields}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('DisplayFields')} onClick={() => pickFiled('DisplayFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
...@@ -1778,7 +1601,7 @@ const AddModal = props => { ...@@ -1778,7 +1601,7 @@ const AddModal = props => {
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.EditableFields == '') { if (form.getFieldValue().EditableFields == '') {
return Promise.reject('编辑字段必选'); return Promise.reject('编辑字段必选');
} }
return Promise.resolve(); return Promise.resolve();
...@@ -1786,19 +1609,15 @@ const AddModal = props => { ...@@ -1786,19 +1609,15 @@ const AddModal = props => {
}, },
]} ]}
> >
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="EditableFields" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择编辑字段" allowClear />
placeholder="请选择编辑字段" </Form.Item>
onChange={e => changeText(e, 'EditableFields')}
value={inputValue.EditableFields}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('EditableFields')} onClick={() => pickFiled('EditableFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
...@@ -1822,38 +1641,30 @@ const AddModal = props => { ...@@ -1822,38 +1641,30 @@ const AddModal = props => {
name="TransitFields" name="TransitFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
> >
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="TransitFields" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择转单字段" allowClear />
placeholder="请选择转单字段" </Form.Item>
onChange={e => changeText(e, 'TransitFields')}
value={inputValue.TransitFields}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('TransitFields')} onClick={() => pickFiled('TransitFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={24}> <Col span={24}>
<Item label="事件权限" name="Roles" labelCol={{ span: 4 }}> <Item label="事件权限" name="Roles" labelCol={{ span: 4 }}>
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="Roles" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择事件权限" allowClear />
placeholder="请选择事件权限" </Form.Item>
onChange={e => changeText(e, 'Roles')}
value={inputValue.Roles}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled1('Roles')} onClick={() => pickFiled1('Roles')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
...@@ -1897,19 +1708,15 @@ const AddModal = props => { ...@@ -1897,19 +1708,15 @@ const AddModal = props => {
name="RelatedEventFields" name="RelatedEventFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
> >
<div className={styles.filed_listItem}> <div style={{ display: 'flex' }}>
<Input <Form.Item name="RelatedEventFields" style={{ marginBottom: 0, width: '100%' }}>
style={{ width: '83%' }} <Input placeholder="请选择关联字段" allowClear />
placeholder="请选择关联字段" </Form.Item>
onChange={e => changeText(e, 'RelatedEventFields')}
value={inputValue.RelatedEventFields}
allowClear
/>
<Button <Button
type="dashed" type="dashed"
onClick={() => pickFiled('RelatedEventFields')} onClick={() => pickFiled('RelatedEventFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />} icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }} style={{ marginLeft: '10px', width: '70px' }}
/> />
</div> </div>
</Item> </Item>
...@@ -1919,25 +1726,6 @@ const AddModal = props => { ...@@ -1919,25 +1726,6 @@ const AddModal = props => {
<Input placeholder="请输入接口配置" /> <Input placeholder="请输入接口配置" />
</Item> </Item>
</Col> </Col>
<Col span={24}>
<Item label="图片表达" name="ImageExpression" labelCol={{ span: 4 }}>
<div className={styles.filed_listItem}>
<Input
style={{ width: '83%' }}
placeholder="请选择图片表达"
onChange={e => changeText(e, 'pictureFields')}
value={inputValue.pictureFields}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled2('pictureFields')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }}
/>
</div>
</Item>
</Col>
</Row> </Row>
</Form> </Form>
<ChangeAdd <ChangeAdd
...@@ -1945,13 +1733,8 @@ const AddModal = props => { ...@@ -1945,13 +1733,8 @@ const AddModal = props => {
onCancel={onCancel} onCancel={onCancel}
callBackSubmit={onOK} callBackSubmit={onOK}
newCheckedList={checkedList1} newCheckedList={checkedList1}
isType={types}
filed={filed}
flag={flag}
filed11={filed1} filed11={filed1}
pickItem={pickItem} pickItem={pickItem}
characterValue={characterValue}
formObj={formObj}
/> />
<ChangeEdit <ChangeEdit
visible={isVisibleEdit} visible={isVisibleEdit}
...@@ -1960,12 +1743,9 @@ const AddModal = props => { ...@@ -1960,12 +1743,9 @@ const AddModal = props => {
newCheckedList={checkedList1} newCheckedList={checkedList1}
filed={filed} filed={filed}
flag={flag} flag={flag}
filed11={filed1}
pickItem={pickItem} pickItem={pickItem}
characterValue={characterValue}
formObj={formObj} formObj={formObj}
/> />
<ChangeImage visible={isVisible1} callBackSubmit={oKK} onCancel={onCancel1} />
</Drawer> </Drawer>
); );
}; };
......
...@@ -22,7 +22,7 @@ import styles from './incident.less'; ...@@ -22,7 +22,7 @@ import styles from './incident.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const { TabPane } = Tabs; const { TabPane } = Tabs;
const ChangeAdd = props => { const ChangeAdd = props => {
const { callBackSubmit = () => {}, isType, pickItem, visible, filed11, newCheckedList } = props; const { callBackSubmit = () => {}, pickItem, visible, filed11, newCheckedList } = props;
const [title, setTitle] = useState([]); const [title, setTitle] = useState([]);
const [checkedList, setCheckedList] = useState([]); // 选中复选框内容 const [checkedList, setCheckedList] = useState([]); // 选中复选框内容
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
...@@ -77,7 +77,6 @@ const ChangeAdd = props => { ...@@ -77,7 +77,6 @@ const ChangeAdd = props => {
stt: data, stt: data,
title, title,
filed22: filed1, filed22: filed1,
isType,
}); });
setKeyValue('0'); setKeyValue('0');
setSearchWord(''); setSearchWord('');
......
...@@ -18,15 +18,7 @@ import DragTable from '@/components/DragTable/DragTable'; ...@@ -18,15 +18,7 @@ import DragTable from '@/components/DragTable/DragTable';
import styles from './incident.less'; import styles from './incident.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const EditModal = props => { const EditModal = props => {
const { const { callBackSubmit = () => {}, pickItem, visible, filed, newCheckedList, flag } = props;
callBackSubmit = () => {},
pickItem,
visible,
filed,
characterValue,
newCheckedList,
flag,
} = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [checkValue, setCheckValue] = useState([]); const [checkValue, setCheckValue] = useState([]);
...@@ -86,8 +78,7 @@ const EditModal = props => { ...@@ -86,8 +78,7 @@ const EditModal = props => {
setCheckedList(checkedListArr); setCheckedList(checkedListArr);
const indeterminateArr = [...indeterminate]; const indeterminateArr = [...indeterminate];
const checkAllArr = [...checkAll]; const checkAllArr = [...checkAll];
indeterminateArr[index] = indeterminateArr[index] = !!list.length && list.length < filed[title].length;
!!list.length && list.length < filed[title].length;
checkAllArr[index] = list.length === filed[title].length; checkAllArr[index] = list.length === filed[title].length;
setIndeterminate(indeterminateArr); setIndeterminate(indeterminateArr);
setCheckAll(checkAllArr); setCheckAll(checkAllArr);
...@@ -239,8 +230,7 @@ const EditModal = props => { ...@@ -239,8 +230,7 @@ const EditModal = props => {
} }
}); });
indeterminateArr.push( indeterminateArr.push(
!!checkArr[index].length && !!checkArr[index].length && checkArr[index].length < filed[item].length,
checkArr[index].length < filed[item].length,
); );
checkAllArr.push(checkArr[index].length === filed[item].length); checkAllArr.push(checkArr[index].length === filed[item].length);
}); });
...@@ -292,10 +282,7 @@ const EditModal = props => { ...@@ -292,10 +282,7 @@ const EditModal = props => {
> >
{visible && ( {visible && (
<div className={styles.listCard}> <div className={styles.listCard}>
<div <div className={styles.cardItem} style={{ borderRight: '1px solid #99bbe8' }}>
className={styles.cardItem}
style={{ borderRight: '1px solid #99bbe8' }}
>
{flag === 0 ? ( {flag === 0 ? (
<> <>
<div className={styles.cardContent}> <div className={styles.cardContent}>
......
...@@ -396,23 +396,14 @@ const incident = () => { ...@@ -396,23 +396,14 @@ const incident = () => {
console.log(tableData[pickItem]); console.log(tableData[pickItem]);
setSortData(tableData[pickItem]); setSortData(tableData[pickItem]);
}; };
// const process = record => {
// setProcessVisible(true);
// setFormObj(record);
// setTitle1(record.name)
// }
const process1 = record => { const process1 = record => {
history.push({ history.push({
pathname: '/bsmanger/workOrder/incidentFlow', pathname: '/bsmanger/workOrder/incidentFlow',
state: { formObj: record, title1: record.name, rember }, state: { formObj: record, title1: record.name, rember },
}); });
}; };
// const auxiliaryView = record => {
// setFormObj(record);
// setViewVisible(true)
// setTitle2(record.name)
// }
const auxiliaryView1 = record => { const auxiliaryView1 = record => {
history.push({ history.push({
pathname: '/bsmanger/workOrder/incidentView', pathname: '/bsmanger/workOrder/incidentView',
...@@ -444,13 +435,6 @@ const incident = () => { ...@@ -444,13 +435,6 @@ const incident = () => {
} }
}); });
}; };
const onOK1 = () => {
setProcessVisible(false);
setFlag(flag + 1);
};
const onOK11 = () => {
setViewVisible(false);
};
return ( return (
<div className={styles.incidentContainer}> <div className={styles.incidentContainer}>
<div className={styles.contentContainers}> <div className={styles.contentContainers}>
...@@ -467,6 +451,7 @@ const incident = () => { ...@@ -467,6 +451,7 @@ const incident = () => {
style={{ style={{
fontSize: '15px ', fontSize: '15px ',
fontWeight: 'bold', fontWeight: 'bold',
marginLeft: '14px',
}} }}
> >
事件列表 事件列表
...@@ -478,7 +463,7 @@ const incident = () => { ...@@ -478,7 +463,7 @@ const incident = () => {
color: '#1890FF', color: '#1890FF',
fontSize: '25px', fontSize: '25px',
verticalAlign: 'middle', verticalAlign: 'middle',
marginLeft: '58%', marginLeft: '51%',
}} }}
/> />
</Tooltip> </Tooltip>
...@@ -582,14 +567,6 @@ const incident = () => { ...@@ -582,14 +567,6 @@ const incident = () => {
callBackSubmit={onSubmit} callBackSubmit={onSubmit}
placement="right" placement="right"
/> />
{/* <ProcessModal
visible={processVisible}
formObj={formObj}
title1={title1}
maxLength={maxLength}
onCancel={() => setProcessVisible(false)}
callBackSubmit={onOK1}
/> */}
<SortModal <SortModal
title="调整顺序" title="调整顺序"
visible={sortVisible} visible={sortVisible}
...@@ -598,13 +575,6 @@ const incident = () => { ...@@ -598,13 +575,6 @@ const incident = () => {
onCancel={() => setSortVisible(false)} onCancel={() => setSortVisible(false)}
callBackSubmit={onOK} callBackSubmit={onOK}
/> />
{/* <ViewModal
formObj={formObj}
visible={viewVisible}
onCancel={() => setViewVisible(false)}
title2={title2}
callBackSubmit={onOK11}
/> */}
</div> </div>
</div> </div>
); );
......
...@@ -589,6 +589,7 @@ const WebDic = () => { ...@@ -589,6 +589,7 @@ const WebDic = () => {
console.log(selectID); console.log(selectID);
if (select.nodeID === selectID) { if (select.nodeID === selectID) {
setSelectID(''); setSelectID('');
setSubData([]);
} }
} }
......
import { Space, Table, Button, Popconfirm, notification, Spin, Modal } from 'antd'; import { Space, Table, Button, Popconfirm, notification, Spin, Modal, Tooltip } from 'antd';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import styles from '../dimensionsConfig.less' import styles from '../dimensionsConfig.less';
import { import { GetBaseMapList, DeleteBaseMap, GetSchemaBaseMapIsLast } from '@/services/webConfig/api';
GetBaseMapList, import AddModal from './AddModal';
DeleteBaseMap,
GetSchemaBaseMapIsLast
} from '@/services/webConfig/api';
import AddModal from './AddModal'
const TileData = props => { const TileData = props => {
const [treeLoading, setTreeLoading] = useState(false);// 弹窗显示 const [treeLoading, setTreeLoading] = useState(false); // 弹窗显示
const [tileData, setTileData] = useState([]); // table表格数据 const [tileData, setTileData] = useState([]); // table表格数据
const [visible, setVisible] = useState(false); // 弹窗 const [visible, setVisible] = useState(false); // 弹窗
const [type, setType] = useState(''); // 弹窗类型 const [type, setType] = useState(''); // 弹窗类型
const [formObj, setFormObj] = useState({}); const [formObj, setFormObj] = useState({});
const [flag, setFlag] = useState(0); // 弹窗类型 const [flag, setFlag] = useState(0); // 弹窗类型
const [baseMap, setBaseMap] = useState([]); //底图数据 const [baseMap, setBaseMap] = useState([]); // 底图数据
const [delVisible, setDelVisible] = useState(false); // 弹窗 const [delVisible, setDelVisible] = useState(false); // 弹窗
const [records, setRecords] = useState({}); // 弹窗 const [records, setRecords] = useState({}); // 弹窗
const columns = [ const columns = [
...@@ -22,26 +18,40 @@ const TileData = props => { ...@@ -22,26 +18,40 @@ const TileData = props => {
title: '名称', title: '名称',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
align: 'center' align: 'center',
}, },
{ {
title: '类型', title: '类型',
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
align: 'center' align: 'center',
}, },
{ {
title: '透明度', title: '透明度',
dataIndex: 'opacity', dataIndex: 'opacity',
key: 'opacity', key: 'opacity',
align: 'center' align: 'center',
}, },
{ {
title: 'url', title: 'url',
dataIndex: 'url', dataIndex: 'url',
key: 'url', key: 'url',
align: 'center', align: 'center',
with: 400 with: 400,
render: record => (
<Tooltip placement="topLeft" title={record}>
{record}
</Tooltip>
),
onCell: () => ({
style: {
maxWidth: 400,
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
cursor: 'pointer',
},
}),
}, },
{ {
title: '编辑', title: '编辑',
...@@ -74,28 +84,28 @@ const TileData = props => { ...@@ -74,28 +84,28 @@ const TileData = props => {
</Space> </Space>
), ),
}, },
]; ];
const changebaseMap = (record) => { const changebaseMap = record => {
setType('edit'); setType('edit');
setFormObj(record); setFormObj(record);
setVisible(true); setVisible(true);
} };
const onSubmit = prop => { const onSubmit = prop => {
setVisible(false); setVisible(false);
setFlag(flag + 1) setFlag(flag + 1);
}; };
const delConfirm = (record) => { const delConfirm = record => {
setRecords(record) setRecords(record);
GetSchemaBaseMapIsLast({ type: record.type }).then(res => { GetSchemaBaseMapIsLast({ type: record.type }).then(res => {
if (res.code === 0 && !res.data) { if (res.code === 0 && !res.data) {
setTreeLoading(true); setTreeLoading(true);
DeleteBaseMap({ DeleteBaseMap({
type: record.type type: record.type,
}).then(res => { })
setFlag(flag + 1) .then(res => {
setFlag(flag + 1);
setTreeLoading(false); setTreeLoading(false);
if (res.msg === '') { if (res.msg === '') {
// form.resetFields(); // form.resetFields();
...@@ -112,51 +122,56 @@ const TileData = props => { ...@@ -112,51 +122,56 @@ const TileData = props => {
description: res.message || '删除失败', description: res.message || '删除失败',
}); });
} }
}).catch(err => {
setFlag(flag + 1)
setTreeLoading(false);
}) })
.catch(err => {
setFlag(flag + 1);
setTreeLoading(false);
});
} else if (res.code === 0 && res.data) {
setDelVisible(true);
} }
else if (res.code === 0 && res.data) { });
setDelVisible(true) };
}
})
}
const handleAdd = () => { const handleAdd = () => {
if (baseMap.length) { if (baseMap.length) {
setType('add'); setType('add');
setVisible(true); setVisible(true);
} } else {
else {
notification.warning({ notification.warning({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: '地图类型已都存在,可编辑修改', description: '地图类型已都存在,可编辑修改',
}); });
} }
};
}
useEffect(() => { useEffect(() => {
renderTile(); renderTile();
}, [flag]); }, [flag]);
// 获取瓦片数据配置数据 // 获取瓦片数据配置数据
const renderTile = () => { const renderTile = () => {
setTreeLoading(true); setTreeLoading(true);
const baseMapData = ['高德街道', '高德影像', '天地图街道', '天地图影像','百度街道','百度影像', 'mapBox地图', 'arcgis地图'] const baseMapData = [
GetBaseMapList().then( '高德街道',
res => { '高德影像',
if (res.msg === "Ok") { '天地图街道',
'天地图影像',
'百度街道',
'百度影像',
'mapBox地图',
'arcgis地图',
];
GetBaseMapList().then(res => {
if (res.msg === 'Ok') {
console.log('res', res.data); console.log('res', res.data);
setTreeLoading(false); setTreeLoading(false);
setTileData(res.data); setTileData(res.data);
res.data.map((item) => { res.data.map(item => {
let index = baseMapData.indexOf(item.name); let index = baseMapData.indexOf(item.name);
if (index != -1) { if (index != -1) {
baseMapData.splice(index, 1); baseMapData.splice(index, 1);
} }
}) });
setBaseMap(baseMapData) setBaseMap(baseMapData);
} else { } else {
setTreeLoading(false); setTreeLoading(false);
notification.error({ notification.error({
...@@ -164,19 +179,19 @@ const TileData = props => { ...@@ -164,19 +179,19 @@ const TileData = props => {
description: res.message, description: res.message,
}); });
} }
} });
)
}; };
const handleOk = () => { const handleOk = () => {
DeleteBaseMap({ DeleteBaseMap({
type: records.type type: records.type,
}).then(res => { })
setFlag(flag + 1) .then(res => {
setFlag(flag + 1);
setTreeLoading(false); setTreeLoading(false);
if (res.msg === '') { if (res.msg === '') {
// form.resetFields(); // form.resetFields();
// callBackSubmit(); // callBackSubmit();
setDelVisible(false) setDelVisible(false);
notification.success({ notification.success({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -189,18 +204,22 @@ const TileData = props => { ...@@ -189,18 +204,22 @@ const TileData = props => {
description: res.message || '删除失败', description: res.message || '删除失败',
}); });
} }
}).catch(err => {
setFlag(flag + 1)
setTreeLoading(false);
}) })
} .catch(err => {
setFlag(flag + 1);
setTreeLoading(false);
});
};
return ( return (
<> <>
<Spin tip="loading..." spinning={treeLoading}> <Spin tip="loading..." spinning={treeLoading}>
<div className={styles.tileBtn}> <div className={styles.tileBtn}>
<Button type="primary" onClick={() => { <Button
type="primary"
onClick={() => {
handleAdd(); handleAdd();
}} > }}
>
新增 新增
</Button> </Button>
</div> </div>
...@@ -211,12 +230,9 @@ const TileData = props => { ...@@ -211,12 +230,9 @@ const TileData = props => {
rowKey="type" rowKey="type"
scroll={{ y: 400 }} scroll={{ y: 400 }}
pagination={{ pagination={{
showTotal: (total, range) => showTotal: (total, range) => `第${range[0]}-${range[1]} 条/共 ${total} 条`,
`第${range[0]}-${range[1]} 条/共 ${total} 条`
}} }}
> />
</Table>
<Modal <Modal
title="删除" title="删除"
visible={delVisible} visible={delVisible}
...@@ -235,6 +251,6 @@ const TileData = props => { ...@@ -235,6 +251,6 @@ const TileData = props => {
/> />
</Spin> </Spin>
</> </>
) );
} };
export default TileData export default TileData;
\ 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