Commit 6de1043a authored by 皮倩雯's avatar 皮倩雯

事件外部字段显示

parent b7d995e0
Pipeline #41848 skipped with stages
import React, { useState, useEffect} from 'react'; import React, { useState, useEffect } from 'react';
import { Drawer, Form, Input, notification, Row, Col, Select, Button, Dropdown, Menu, Space } from 'antd'; import {
import styles from './maintenance.less' Drawer,
Form,
Input,
notification,
Row,
Col,
Select,
Button,
Dropdown,
Menu,
Space,
} from 'antd';
import styles from './maintenance.less';
import ModalDrag from './ModalDrag'; import ModalDrag from './ModalDrag';
import { CM_XWBPlan_AccountTable, CM_XWBPlan_feedbackTable, CM_XWBPlan_DataEditORAdd, CM_XWBPlan_DataList } from '@/services/maintenance/api' import {
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api' CM_XWBPlan_AccountTable,
import { PlusOutlined, DownOutlined, StepForwardFilled } from '@ant-design/icons' CM_XWBPlan_feedbackTable,
import ChangeAdd from './ChangeAdd' CM_XWBPlan_DataEditORAdd,
CM_XWBPlan_DataList,
} from '@/services/maintenance/api';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import {
PlusOutlined,
DownOutlined,
StepForwardFilled,
} from '@ant-design/icons';
import ChangeAdd from './ChangeAdd';
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const [inputValue, setInputValue] = useState({ feedbackName: '', doRole: '' }); const [inputValue, setInputValue] = useState({
const { callBackSubmit = () => { }, visible, type, formObj } = props; feedbackName: '',
doRole: '',
});
const { callBackSubmit = () => {}, visible, type, formObj } = props;
const [Type1, setType1] = useState('') const [Type1, setType1] = useState('');
const [Type2, setType2] = useState('') const [Type2, setType2] = useState('');
const [selectValue, setSelectValue] = useState('') const [selectValue, setSelectValue] = useState('');
const [selectValue1, setSelectValue1] = useState('') const [selectValue1, setSelectValue1] = useState('');
const [treeData, setTreeData] = useState([]) const [treeData, setTreeData] = useState([]);
const [isVisible, setIsVisible] = useState(false) const [isVisible, setIsVisible] = useState(false);
const [filed, setFiled] = useState({}); // 传给子组件列表数据 const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据 const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [types, setTypes] = useState(''); // 弹窗类型 const [types, setTypes] = useState(''); // 弹窗类型
const [pickItem, setPickItem] = useState('')//复选框数据填入项 const [pickItem, setPickItem] = useState(''); //复选框数据填入项
const [checkedList1, setCheckedList1] = useState([])//最新选择数据 const [checkedList1, setCheckedList1] = useState([]); //最新选择数据
const [characterValue, setCharacterValue] = useState('')//打开弹框之前数据 const [characterValue, setCharacterValue] = useState(''); //打开弹框之前数据
const [ff, setFf] = useState([]) const [ff, setFf] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
const { Item } = Form; const { Item } = Form;
const { TextArea } = Input; const { TextArea } = Input;
useEffect(() => { useEffect(() => {
getRole() getRole();
if (type === 'add') { if (type === 'add') {
setType1('') setType1('');
setType2('') setType2('');
setInputValue({ feedbackName: '', doRole: '' }) setInputValue({ feedbackName: '', doRole: '' });
setFiled1({}) setFiled1({});
form.resetFields(); form.resetFields();
} else if (type === 'edit') { } else if (type === 'edit') {
CM_XWBPlan_DataList({id:formObj.id}).then(res =>{ CM_XWBPlan_DataList({ id: formObj.id }).then(res => {
let data = res.data[0] let data = res.data[0];
data && form.setFieldsValue({ ...data}); data && form.setFieldsValue({ ...data });
setInputValue({ ...data}) setInputValue({ ...data });
console.log(data.businessTypee) console.log(data.businessTypee);
setType1(data.businessType) setType1(data.businessType);
setType2(data.accountName) setType2(data.accountName);
}) });
} }
}, [visible]);
}, [visible])
useEffect(() => { useEffect(() => {
getRole() getRole();
getList() getList();
getFeedbackTable() getFeedbackTable();
}, []) }, []);
const getList = () => { const getList = () => {
CM_XWBPlan_AccountTable().then(res => { CM_XWBPlan_AccountTable().then(res => {
if (res.msg == 'Ok') { if (res.msg == 'Ok') {
let arr = [] let arr = [];
res.data.map((item, index) => { res.data.map((item, index) => {
arr.push(item.accountName) arr.push(item.accountName);
}) });
setTreeData(arr) setTreeData(arr);
}
})
} }
});
};
const onSubmit = () => { const onSubmit = () => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
obj.feedbackName = inputValue.feedbackName obj.feedbackName = inputValue.feedbackName;
obj.doRole = inputValue.doRole obj.doRole = inputValue.doRole;
console.log(obj.doRole) console.log(obj.doRole);
console.log(obj) console.log(obj);
if (type == 'add') { if (type == 'add') {
CM_XWBPlan_DataEditORAdd(obj).then(res => { CM_XWBPlan_DataEditORAdd(obj).then(res => {
if (res.msg == '') { if (res.msg == '') {
...@@ -86,19 +109,19 @@ const AddModal = props => { ...@@ -86,19 +109,19 @@ const AddModal = props => {
duration: 3, duration: 3,
description: '添加成功', description: '添加成功',
}); });
}else{ } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg, description: res.msg,
}); });
} }
}) });
} }
if (type == 'edit') { if (type == 'edit') {
CM_XWBPlan_DataEditORAdd({ CM_XWBPlan_DataEditORAdd({
...obj, ...obj,
id:formObj.id id: formObj.id,
}).then(res => { }).then(res => {
if (res.msg == '') { if (res.msg == '') {
form.resetFields(); form.resetFields();
...@@ -108,152 +131,148 @@ const AddModal = props => { ...@@ -108,152 +131,148 @@ const AddModal = props => {
duration: 3, duration: 3,
description: '添加成功', description: '添加成功',
}); });
}else{ } else {
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
description: res.msg, description: res.msg,
}); });
} }
}) });
}
} }
})
} }
});
};
const inputType1 = e => { const inputType1 = e => {
setType1(e.target.value) setType1(e.target.value);
form.setFieldsValue({ businessType: e.target.value }) form.setFieldsValue({ businessType: e.target.value });
} };
const inputType2 = e => { const inputType2 = e => {
setType2(e.target.value) setType2(e.target.value);
form.setFieldsValue({ accountName: e.target.value }) form.setFieldsValue({ accountName: e.target.value });
} };
const changeText = (e, type) => { const changeText = (e, type) => {
let inputText = { ...inputValue } let inputText = { ...inputValue };
inputText[type] = e.target.value inputText[type] = e.target.value;
setInputValue(inputText) setInputValue(inputText);
} };
const pickFiled = (fileds) => { const pickFiled = fileds => {
setTypes('add') setTypes('add');
setCharacterValue(inputValue[fileds]) setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(',')) setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds) setPickItem(fileds);
setIsVisible(true) setIsVisible(true);
} };
const pickFiled1 = (fileds) => { const pickFiled1 = fileds => {
setTypes('app') setTypes('app');
setCharacterValue(inputValue[fileds]) setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(',')) setCheckedList1(inputValue[fileds].split(','));
console.log(inputValue[fileds]) console.log(inputValue[fileds]);
console.log(inputValue[fileds].split(',')) console.log(inputValue[fileds].split(','));
setPickItem(fileds) setPickItem(fileds);
setIsVisible(true) setIsVisible(true);
} };
const getRole = () => { const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => { CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
setFiled1(formateArrDataA1(res.data, 'groupType')) setFiled1(formateArrDataA1(res.data, 'groupType'));
console.log(filed1) console.log(filed1);
console.log(filed1['角色']) console.log(filed1['角色']);
setFf(filed1['角色']) setFf(filed1['角色']);
console.log(ff) console.log(ff);
console.log(res.data) console.log(res.data);
}
})
} }
});
};
const getFeedbackTable = () => { const getFeedbackTable = () => {
CM_XWBPlan_feedbackTable().then(res => { CM_XWBPlan_feedbackTable().then(res => {
if (res.msg == 'Ok') { if (res.msg === 'Ok') {
let arr = [] let arr = [];
res.data.map((item, index) => { res.data.map((item, index) => {
arr.push(item.accountName) arr.push(item.accountName);
}) });
setFiled(arr) setFiled(arr);
}
})
} }
});
};
const formateArrDataA1 = (initialArr, name) => { const formateArrDataA1 = (initialArr, name) => {
let aa = [];
let aa = [] let a1 = [];
let a1 = [] let a2;
let a2 let a3 = [];
let a3 = [] initialArr.data.map(i => {
initialArr.map(i => {
// console.log(i.groupType) // console.log(i.groupType)
a2 = i.groupType a2 = i.groupType;
// console.log(a2) // console.log(a2)
// console.log(i.root) // console.log(i.root)
a1 = i.root a1 = i.root;
a1.map(j => { a1.map(j => {
j.group = a2 j.group = a2;
// console.log(j) // console.log(j)
});
}) aa.push(i.root);
aa.push(i.root) });
})
// console.log(aa) // console.log(aa)
aa.map(p => { aa.map(p => {
// console.log(p) // console.log(p)
p.map(o => { p.map(o => {
// console.log(o) // console.log(o)
a3.push(o) a3.push(o);
});
}) });
}) console.log(a3);
console.log(a3)
// 判定传参是否符合规则 // 判定传参是否符合规则
if (!(a3 instanceof Array)) { if (!(a3 instanceof Array)) {
return '请传入正确格式的数组' return '请传入正确格式的数组';
} }
if (!name) { if (!name) {
return '请传入对象属性' return '请传入对象属性';
} }
//先获取一下这个数组中有多少个"name" //先获取一下这个数组中有多少个"name"
let nameArr = [] let nameArr = [];
a3.map(i => { a3.map(i => {
if (nameArr.indexOf(i.group) === -1) { if (nameArr.indexOf(i.group) === -1) {
nameArr.push(i.group) nameArr.push(i.group);
} }
}) });
console.log(nameArr) console.log(nameArr);
//新建一个包含多个list的结果对象 //新建一个包含多个list的结果对象
let tempObj = {} let tempObj = {};
// 根据不同的"name"生成多个数组 // 根据不同的"name"生成多个数组
for (let k in nameArr) { for (let k in nameArr) {
for (let j in a3) { for (let j in a3) {
if (a3[j].group == nameArr[k]) { if (a3[j].group == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变 // 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || [] tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
tempObj[nameArr[k]].push(a3[j]) tempObj[nameArr[k]].push(a3[j]);
} }
} }
} }
console.log(tempObj); console.log(tempObj);
for (let key in tempObj) { for (let key in tempObj) {
let arr = [] let arr = [];
tempObj[key].map(item => { tempObj[key].map(item => {
tempObj[key] = arr; tempObj[key] = arr;
arr.push(item.Name) arr.push(item.Name);
}) });
}
return tempObj
} }
return tempObj;
};
const changTable = value => { const changTable = value => {
setSelectValue(value) setSelectValue(value);
} };
const changTable1 = value => { const changTable1 = value => {
setSelectValue1(value) setSelectValue1(value);
} };
const onOK = prop => { const onOK = prop => {
console.log(prop.isType) console.log(prop.isType);
setIsVisible(false) setIsVisible(false);
let inputText = { ...inputValue } let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.checkedList) setCheckedList1(prop.checkedList);
setInputValue(inputText) setInputValue(inputText);
} };
// const title = <ModalDrag title="巡维保计划配置" /> // const title = <ModalDrag title="巡维保计划配置" />
return ( return (
<Drawer <Drawer
...@@ -264,13 +283,13 @@ const AddModal = props => { ...@@ -264,13 +283,13 @@ const AddModal = props => {
{...props} {...props}
footer={ footer={
<Space> <Space>
<Button onClick={onSubmit} type="primary" > <Button onClick={onSubmit} type="primary">
确定 确定
</Button> </Button>
</Space> </Space>
} }
> >
<Form form={form} labelCol={{ span: 7 }} style={{overflowY: 'scroll' }}> <Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}>
<Row> <Row>
<Col span={23}> <Col span={23}>
<Item <Item
...@@ -288,7 +307,17 @@ const AddModal = props => { ...@@ -288,7 +307,17 @@ const AddModal = props => {
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> <span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="业务类型" label="业务类型"
name="businessType" name="businessType"
...@@ -297,31 +326,59 @@ const AddModal = props => { ...@@ -297,31 +326,59 @@ const AddModal = props => {
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (form.getFieldsValue().businessType == '') { if (form.getFieldsValue().businessType == '') {
return Promise.reject('业务类型必填') return Promise.reject('业务类型必填');
} }
return Promise.resolve(); return Promise.resolve();
} },
} },
]} ]}
> >
<div> <div>
<Input <Input
className="ue-editable-select-input" className="ue-editable-select-input"
onChange={inputType1} onChange={inputType1}
value={Type1} value={Type1}
placeholder="选择或手动输入业务类型" placeholder="选择或手动输入业务类型"
> />
</Input>
<Dropdown <Dropdown
placement='bottomRight' placement="bottomRight"
style={{ width: '430px' }} style={{ width: '430px' }}
overlay={<Menu> overlay={
<Menu.Item key="巡检" onClick={() => { setType1("巡检"); form.setFieldsValue({ businessType: "巡检" }) }} style={{ width: '430px', marginLeft: '-8px' }}>巡检</Menu.Item> <Menu>
<Menu.Item key="保养" onClick={() => { setType1("保养"); form.setFieldsValue({ businessType: "保养" }) }} style={{ width: '430px', marginLeft: '-8px' }}>保养</Menu.Item> <Menu.Item
</Menu>} > key="巡检"
<div className={styles.linkDrowp} onClick={e => e.preventDefault()}> onClick={() => {
<DownOutlined style={{ fontSize: '12px', color: 'rgba(0, 0, 0, 0.25)', marginLeft:'5px' }} /> setType1('巡检');
form.setFieldsValue({ businessType: '巡检' });
}}
style={{ width: '430px', marginLeft: '-8px' }}
>
巡检
</Menu.Item>
<Menu.Item
key="保养"
onClick={() => {
setType1('保养');
form.setFieldsValue({ businessType: '保养' });
}}
style={{ width: '430px', marginLeft: '-8px' }}
>
保养
</Menu.Item>
</Menu>
}
>
<div
className={styles.linkDrowp}
onClick={e => e.preventDefault()}
>
<DownOutlined
style={{
fontSize: '12px',
color: 'rgba(0, 0, 0, 0.25)',
marginLeft: '5px',
}}
/>
</div> </div>
</Dropdown> </Dropdown>
</div> </div>
...@@ -340,7 +397,6 @@ const AddModal = props => { ...@@ -340,7 +397,6 @@ const AddModal = props => {
]} ]}
> >
<Select <Select
placeholder="选择计划执行周期" placeholder="选择计划执行周期"
onChange={changTable} onChange={changTable}
value={selectValue} value={selectValue}
...@@ -355,7 +411,17 @@ const AddModal = props => { ...@@ -355,7 +411,17 @@ const AddModal = props => {
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> <span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="台账名称" label="台账名称"
name="accountName" name="accountName"
...@@ -364,37 +430,72 @@ const AddModal = props => { ...@@ -364,37 +430,72 @@ const AddModal = props => {
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (form.getFieldsValue().accountName == '') { if (form.getFieldsValue().accountName == '') {
return Promise.reject('台账名称必选') return Promise.reject('台账名称必选');
} }
return Promise.resolve(); return Promise.resolve();
} },
} },
]} ]}
> >
<div> <div>
<Input <Input
className="ue-editable-select-input" className="ue-editable-select-input"
onChange={inputType2} onChange={inputType2}
value={Type2} value={Type2}
placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备" placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备"
> />
</Input>
<Dropdown <Dropdown
placement='bottomRight' placement="bottomRight"
style={{ width: '430px' }} style={{ width: '430px' }}
overlay={<Menu> overlay={
{treeData.length ? treeData.map((item, index) => { return <Menu.Item onClick={() => { setType2(item); form.setFieldsValue({ accountName: item }) }} style={{ width: '430px', marginLeft: '-8px' }} key={index}>{item}</Menu.Item> }) : ''} <Menu>
</Menu>} > {treeData.length
<div className={styles.linkDrowp} onClick={e => e.preventDefault()}> ? treeData.map((item, index) => {
<DownOutlined style={{ fontSize: '12px', color: 'rgba(0, 0, 0, 0.25)', marginLeft:'5px'}} /> return (
<Menu.Item
onClick={() => {
setType2(item);
form.setFieldsValue({ accountName: item });
}}
style={{ width: '430px', marginLeft: '-8px' }}
key={index}
>
{item}
</Menu.Item>
);
})
: ''}
</Menu>
}
>
<div
className={styles.linkDrowp}
onClick={e => e.preventDefault()}
>
<DownOutlined
style={{
fontSize: '12px',
color: 'rgba(0, 0, 0, 0.25)',
marginLeft: '5px',
}}
/>
</div> </div>
</Dropdown> </Dropdown>
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> <span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="反馈名称" label="反馈名称"
name="feedbackName" name="feedbackName"
...@@ -402,23 +503,43 @@ const AddModal = props => { ...@@ -402,23 +503,43 @@ const AddModal = props => {
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.feedbackName == "") { if (inputValue.feedbackName == '') {
return Promise.reject('反馈名称必填') return Promise.reject('反馈名称必填');
} }
return Promise.resolve(); return Promise.resolve();
} },
} },
]} ]}
> >
<div className={styles.filed_listItem} > <div className={styles.filed_listItem}>
<Input style={{ width: '83%' }} placeholder="请选择反馈名称" onChange={(e) => changeText(e, 'feedbackName')} value={inputValue.feedbackName} allowClear /> <Input
<Button type="dashed" onClick={() => pickFiled('feedbackName')} icon={<PlusOutlined style={{marginTop:'5px'}}/>} style={{ marginLeft: '0.5rem', width: '4rem' }} /> style={{ width: '83%' }}
placeholder="请选择反馈名称"
onChange={e => changeText(e, 'feedbackName')}
value={inputValue.feedbackName}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled('feedbackName')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }}
/>
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> <span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="执行角色" label="执行角色"
name="doRole" name="doRole"
...@@ -426,17 +547,28 @@ const AddModal = props => { ...@@ -426,17 +547,28 @@ const AddModal = props => {
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.doRole == "") { if (inputValue.doRole == '') {
return Promise.reject('执行角色必填') return Promise.reject('执行角色必填');
} }
return Promise.resolve(); return Promise.resolve();
} },
}, },
]} ]}
> >
<div className={styles.filed_listItem} > <div className={styles.filed_listItem}>
<Input style={{ width: '83%' }} placeholder="请选择执行角色" onChange={(e) => changeText(e, 'doRole')} value={inputValue.doRole} allowClear /> <Input
<Button type="dashed" onClick={() => pickFiled1('doRole')} icon={<PlusOutlined style={{marginTop:'5px'}}/>} style={{ marginLeft: '0.5rem', width: '4rem' }} /> style={{ width: '83%' }}
placeholder="请选择执行角色"
onChange={e => changeText(e, 'doRole')}
value={inputValue.doRole}
allowClear
/>
<Button
type="dashed"
onClick={() => pickFiled1('doRole')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }}
/>
</div> </div>
</Item> </Item>
</Col> </Col>
...@@ -482,7 +614,6 @@ const AddModal = props => { ...@@ -482,7 +614,6 @@ const AddModal = props => {
]} ]}
> >
<Select <Select
placeholder="是否送审" placeholder="是否送审"
onChange={changTable1} onChange={changTable1}
value={selectValue1} value={selectValue1}
...@@ -497,7 +628,6 @@ const AddModal = props => { ...@@ -497,7 +628,6 @@ const AddModal = props => {
label="台账过滤条件" label="台账过滤条件"
name="filterCondition" name="filterCondition"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
> >
<TextArea placeholder="设备对应的Scada台账名称,可多选" /> <TextArea placeholder="设备对应的Scada台账名称,可多选" />
</Item> </Item>
...@@ -517,6 +647,6 @@ const AddModal = props => { ...@@ -517,6 +647,6 @@ const AddModal = props => {
characterValue={characterValue} characterValue={characterValue}
/> />
</Drawer> </Drawer>
) );
}; };
export default AddModal export default AddModal;
\ No newline at end of file
import React, { useState, useEffect, PureComponent } from 'react'; import React, { useState, useEffect, PureComponent } from 'react';
import { Modal, Divider, Checkbox, Space, Button } from 'antd'; import { Modal, Divider, Checkbox, Space, Button } from 'antd';
import styles from './maintenance.less' import styles from './maintenance.less';
const CheckboxGroup = Checkbox.Group; const CheckboxGroup = Checkbox.Group;
const ChangeAdd = props => { const ChangeAdd = props => {
const { callBackSubmit = () => { }, isType, visible, newCheckedList, filed1, filed, pickItem, characterValue, ff } = props; const {
const [checkedList, setCheckedList] = useState([]);//选中的复选框内容 callBackSubmit = () => {},
const [indeterminate, setIndeterminate] = useState(true);//全选样式控制 isType,
const [checkAll, setCheckAll] = useState(false);//全选 visible,
const [selectData, setSelectData] = useState([])//选中复选框的值集合 newCheckedList,
let objArr = [] filed1,
filed,
pickItem,
characterValue,
ff,
} = props;
const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
const [indeterminate, setIndeterminate] = useState(true); // 全选样式控制
const [checkAll, setCheckAll] = useState(false); // 全选
const [selectData, setSelectData] = useState([]); // 选中复选框的值集合
let objArr = [];
const onChangeList = list => {
const onChangeList = (list) => { let arr = [];
let arr = []
list.map((item, index) => { list.map((item, index) => {
arr.push(item) arr.push(item);
}) });
console.log(list) console.log(list);
console.log(arr) console.log(arr);
setCheckedList(arr) setCheckedList(arr);
setIndeterminate(!!list.length && list.length < filed.length) setIndeterminate(!!list.length && list.length < filed.length);
setCheckAll(list.length === filed.length) setCheckAll(list.length === filed.length);
}; };
const onChangeList1 = (list) => { const onChangeList1 = list => {
let arr = [] let arr = [];
list.map((item, index) => { list.map((item, index) => {
arr.push(item) arr.push(item);
}) });
console.log(list) console.log(list);
console.log(arr) console.log(arr);
setCheckedList(arr) setCheckedList(arr);
setIndeterminate(!!list.length && list.length < ff.length) setIndeterminate(!!list.length && list.length < ff.length);
setCheckAll(list.length === ff.length) setCheckAll(list.length === ff.length);
}; };
const onSubmit = () => { const onSubmit = () => {
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(","), pickItem, stt: selectData, filed22: filed1, isType: isType }); isType === 'rule'
} ? callBackSubmit(
`${
value === '无' || value === '' ? '' : `${value},`
}${checkValue.join(',')}`,
)
: callBackSubmit({
checkedList,
str: selectData.join(','),
pickItem,
stt: selectData,
filed22: filed1,
isType,
});
};
const onCheckAllChange = e => { const onCheckAllChange = e => {
setCheckedList(e.target.checked ? filed : []) setCheckedList(e.target.checked ? filed : []);
setIndeterminate(false) setIndeterminate(false);
setCheckAll(e.target.checked) setCheckAll(e.target.checked);
}; };
const onCheckAllChange1 = e => { const onCheckAllChange1 = e => {
setCheckedList(e.target.checked ? ff : []) setCheckedList(e.target.checked ? ff : []);
setIndeterminate(false) setIndeterminate(false);
setCheckAll(e.target.checked) setCheckAll(e.target.checked);
} };
useEffect(() => { useEffect(() => {
selectAll() selectAll();
}, [checkedList]); }, [checkedList]);
const selectAll = () => { const selectAll = () => {
objArr = [] objArr = [];
checkedList.map(item => { checkedList.map(item => {
objArr = objArr.concat(item) objArr = objArr.concat(item);
}) });
console.log(checkedList) console.log(checkedList);
setSelectData(objArr) setSelectData(objArr);
} };
useEffect(() => { useEffect(() => {
console.log(indeterminate) console.log(indeterminate);
if (isType != '' && isType === 'add') { if (isType != '' && isType === 'add') {
let checkArr = [] let checkArr = [];
console.log(newCheckedList); console.log(newCheckedList);
newCheckedList.map(checkItem => { newCheckedList.map(checkItem => {
if (filed.includes(checkItem)) { if (filed.includes(checkItem)) {
checkArr.push(checkItem) checkArr.push(checkItem);
} }
}) });
setCheckedList(checkArr) setCheckedList(checkArr);
setIndeterminate(!!newCheckedList.length && newCheckedList.length < filed.length) setIndeterminate(
setCheckAll(newCheckedList.length === filed.length) !!newCheckedList.length && newCheckedList.length < filed.length,
let newArr = characterValue.length ? characterValue.split(",") : [] );
setSelectData(newArr) setCheckAll(newCheckedList.length === filed.length);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
} else if (isType === 'app') { } else if (isType === 'app') {
let checkArr = [] let checkArr = [];
console.log(newCheckedList); console.log(newCheckedList);
newCheckedList.map(checkItem => { newCheckedList.map(checkItem => {
if (ff.includes(checkItem)) { if (ff.includes(checkItem)) {
checkArr.push(checkItem) checkArr.push(checkItem);
} }
}) });
setCheckedList(checkArr) setCheckedList(checkArr);
setIndeterminate(!!newCheckedList.length && newCheckedList.length < ff.length) setIndeterminate(
setCheckAll(newCheckedList.length === ff.length) !!newCheckedList.length && newCheckedList.length < ff.length,
let newArr = characterValue.length ? characterValue.split(",") : [] );
setSelectData(newArr) setCheckAll(newCheckedList.length === ff.length);
let newArr = characterValue.length ? characterValue.split(',') : [];
setSelectData(newArr);
} }
}, [visible]); }, [visible]);
if (isType != 'app') { if (isType != 'app') {
return ( return (
<div className={styles.ChangeAddContainer}> <div className={styles.ChangeAddContainer}>
...@@ -100,42 +125,73 @@ const ChangeAdd = props => { ...@@ -100,42 +125,73 @@ const ChangeAdd = props => {
title="反馈名称" title="反馈名称"
bodyStyle={{ width: '100%', minHeight: '100px' }} bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }} style={{ top: '10px' }}
width="450px" width="400px"
destroyOnClose destroyOnClose
centered={true} centered
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
{...props} {...props}
onOk={() => onSubmit()} onOk={() => onSubmit()}
forceRender={true} forceRender
getContainer={false} getContainer={false}
> >
{visible && ( {visible && (
<div className={styles.listCard}> <div className={styles.listCard}>
<div className={styles.cardItem}> <div className={styles.cardItem}>
{JSON.stringify(filed) == "{}" ? {JSON.stringify(filed) == '{}' ? (
<> <>
<div className={styles.cardContent}> <div className={styles.cardContent}>
<span style={{ color: 'red', fontSize: '1rem', marginLeft: '25px' }}>暂无数据请先配置台账管理台账名称为反馈</span> <span
style={{
color: 'red',
fontSize: '1rem',
marginLeft: '25px',
}}
>
暂无数据请先配置台账管理台账名称为反馈
</span>
</div> </div>
</> </>
: ) : (
<> <>
<div className={styles.cardContent}> <div className={styles.cardContent}>
<div className={styles.cardItemData}> <div className={styles.cardItemData}>
<Divider orientation="left" style={{ margin: '0 0 5px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>全选<Checkbox style={{ marginLeft: '10px' }} indeterminate={indeterminate} onChange={onCheckAllChange} checkvalue={filed} checked={checkAll}> </Checkbox></Divider> <Divider
<CheckboxGroup options={filed} value={checkedList} onChange={(e) => onChangeList(e)} /></div> orientation="left"
style={{
margin: '0 0 5px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
全选
<Checkbox
style={{ marginLeft: '10px' }}
indeterminate={indeterminate}
onChange={onCheckAllChange}
checkvalue={filed}
checked={checkAll}
>
{' '}
</Checkbox>
</Divider>
<CheckboxGroup
options={filed}
value={checkedList}
onChange={e => onChangeList(e)}
/>
</div>
</div> </div>
</> </>
} )}
</div> </div>
</div> </div>
) )}
}
</Modal> </Modal>
</div> </div>
); );
} else if (isType === 'app') { }
if (isType === 'app') {
return ( return (
<Modal <Modal
title="角色" title="角色"
...@@ -143,29 +199,51 @@ const ChangeAdd = props => { ...@@ -143,29 +199,51 @@ const ChangeAdd = props => {
style={{ top: '10px' }} style={{ top: '10px' }}
width="450px" width="450px"
destroyOnClose destroyOnClose
centered={true} centered
cancelText="取消" cancelText="取消"
okText="确认" okText="确认"
{...props} {...props}
onOk={() => onSubmit()} onOk={() => onSubmit()}
forceRender={true} forceRender
getContainer={false} getContainer={false}
> >
{visible && ( {visible && (
<div className={styles.listCard}> <div className={styles.listCard}>
<div className={styles.cardItem}> <div className={styles.cardItem}>
<div className={styles.cardContent}> <div className={styles.cardContent}>
<div className={styles.cardItemData} > <div className={styles.cardItemData}>
<Divider orientation="left" style={{ margin: '0 0 5px 0', color: '#15428b', borderTopColor: '#99bbe8' }}>全选<Checkbox style={{ marginLeft: '10px' }} indeterminate={indeterminate} onChange={onCheckAllChange1} checkvalue={ff} checked={checkAll}> </Checkbox></Divider> <Divider
<CheckboxGroup options={ff} value={checkedList} onChange={(e) => onChangeList1(e)} /></div> orientation="left"
style={{
margin: '0 0 5px 0',
color: '#15428b',
borderTopColor: '#99bbe8',
}}
>
全选
<Checkbox
style={{ marginLeft: '10px' }}
indeterminate={indeterminate}
onChange={onCheckAllChange1}
checkvalue={ff}
checked={checkAll}
>
{' '}
</Checkbox>
</Divider>
<CheckboxGroup
options={ff}
value={checkedList}
onChange={e => onChangeList1(e)}
/>
</div> </div>
</div> </div>
</div> </div>
) </div>
} )}
</Modal> </Modal>
); );
} }
}; };
export default ChangeAdd export default ChangeAdd;
\ No newline at end of file
...@@ -35,6 +35,7 @@ import { ...@@ -35,6 +35,7 @@ import {
Dropdown, Dropdown,
Menu, Menu,
Button, Button,
Tooltip,
} from 'antd'; } from 'antd';
import { import {
GetCM_Event_LoadEventTypeTable, GetCM_Event_LoadEventTypeTable,
...@@ -49,7 +50,11 @@ import ChangeAdd from './changeAdd'; ...@@ -49,7 +50,11 @@ import ChangeAdd from './changeAdd';
import ChangeEdit from './changeEdit'; import ChangeEdit from './changeEdit';
import ChangeImage from './ChangeImage'; import ChangeImage from './ChangeImage';
import ModalDrag from '../maintenance/ModalDrag'; import ModalDrag from '../maintenance/ModalDrag';
import { PlusOutlined, DownOutlined } from '@ant-design/icons'; import {
PlusOutlined,
DownOutlined,
InfoCircleOutlined,
} from '@ant-design/icons';
import { set } from 'immutable'; import { set } from 'immutable';
import { getRoleGroup } from '@/services/userCenter/roleManage/api'; import { getRoleGroup } from '@/services/userCenter/roleManage/api';
...@@ -497,6 +502,18 @@ const AddModal = props => { ...@@ -497,6 +502,18 @@ const AddModal = props => {
const [isVisible1, setIsVisible1] = useState(false); // 弹窗 const [isVisible1, setIsVisible1] = useState(false); // 弹窗
const [characterValue, setCharacterValue] = useState(''); const [characterValue, setCharacterValue] = useState('');
const [form] = Form.useForm(); const [form] = Form.useForm();
const [summaryIsShow, setSummaryIsShow] = useState('none'); // 摘要字段外部字段是否显示
const [reportIsShow, setReportIsShow] = useState('none'); // 上报字段外部字段是否显示
const [displayIsShow, setDisplayIsShow] = useState('none'); // 显示字段外部字段是否显示
const [editableIsShow, setEditableIsShow] = useState('none'); // 编辑字段外部字段是否显示
const [transitIsShow, setTransitIsShow] = useState('none'); // 转单字段外部字段是否显示
const [relatedEventIsShow, setRelatedEventIsShow] = useState('none'); // 关联字段外部字段是否显示
const [summaryValue, setSummaryValue] = useState(); // 保存摘要字段外部字段
const [reportValue, setReportValue] = useState(); // 保存上报字段外部字段
const [displayValue, setDisplayValue] = useState(); // 保存显示字段外部字段
const [editableValue, setEditableValue] = useState(); // 保存编辑字段外部字段
const [transitValue, setTransitValue] = useState(); // 保存转单字段外部字段
const [relatedEventValue, setRelatedEventValue] = useState(); // 保存关联字段外部字段
const { Item } = Form; const { Item } = Form;
const onSubmit = () => { const onSubmit = () => {
...@@ -505,23 +522,17 @@ const AddModal = props => { ...@@ -505,23 +522,17 @@ const AddModal = props => {
setLoading(true); setLoading(true);
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
obj.Code = obj.Code.toString(); obj.Code = obj.Code.toString();
console.log(obj);
console.log(obj.Reportable);
console.log(obj.ReportFromWeb);
console.log(obj.ReportFromMobile);
if (obj.BusinessType === undefined) { if (obj.BusinessType === undefined) {
obj.BusinessType = rember1; obj.BusinessType = rember1;
} }
if (obj.TableName === undefined) { if (obj.TableName === undefined) {
console.log(selectValue);
obj.TableName = selectValue; obj.TableName = selectValue;
} }
if (obj.CreateMode === undefined) { if (obj.CreateMode === undefined) {
console.log(1111);
obj.CreateMode = 0; obj.CreateMode = 0;
} }
// eslint-disable-next-line no-constant-condition
if (obj.CreateMode === 0 || 1) { if (obj.CreateMode === 0 || 1) {
console.log(2222);
obj.CreateMode = obj.CreateMode.toString(); obj.CreateMode = obj.CreateMode.toString();
} }
if (editable != true) { if (editable != true) {
...@@ -563,11 +574,6 @@ const AddModal = props => { ...@@ -563,11 +574,6 @@ const AddModal = props => {
inputValue.ReportFromMobile = ''; inputValue.ReportFromMobile = '';
inputValue.ReportFromWeb = ''; inputValue.ReportFromWeb = '';
} }
console.log(obj.BusinessType);
console.log(ReportFromWeb);
console.log(ReportFromMobile);
console.log(obj);
console.log(inputValue);
let data = { ...obj, ...inputValue, Order: maxLength }; let data = { ...obj, ...inputValue, Order: maxLength };
if (inputValue.Roles == '' && inputValue.Reportable != '否') { if (inputValue.Roles == '' && inputValue.Reportable != '否') {
notification.warning({ notification.warning({
...@@ -658,13 +664,10 @@ const AddModal = props => { ...@@ -658,13 +664,10 @@ const AddModal = props => {
}; };
useEffect(() => { useEffect(() => {
console.log(rember1);
console.log(selectData);
getRole(); getRole();
if (type === 'add') { if (type === 'add') {
setType1(rember1); setType1(rember1);
form.setFieldsValue({ BusinessType: rember1 }); form.setFieldsValue({ BusinessType: rember1 });
console.log(Type1);
setReportFromWeb(true); setReportFromWeb(true);
setCheckedList3(true); setCheckedList3(true);
setChee(0); setChee(0);
...@@ -690,16 +693,62 @@ const AddModal = props => { ...@@ -690,16 +693,62 @@ const AddModal = props => {
} else if (type === 'edit') { } else if (type === 'edit') {
getEventData1(); getEventData1();
GetCM_Event_QueryEventType({ eventTypeId: formObj.ID }).then(res => { GetCM_Event_QueryEventType({ eventTypeId: formObj.ID }).then(res => {
res.data.root && form.setFieldsValue({ ...res.data.root }); if (res.data.root) {
console.log(res.data.root); console.log(res.data.root);
console.log(res.data.root.Editable); form.setFieldsValue({ ...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);
setSummaryValue(res.data.root.outSummaryFields);
if (res.data.root.outSummaryFields != 0) {
setSummaryIsShow('inline');
} else {
setSummaryIsShow('none');
}
setReportValue(res.data.root.outReportFields);
if (res.data.root.outReportFields != 0) {
setReportIsShow('inline');
} else {
setReportIsShow('none');
}
setDisplayValue(res.data.root.outDisplayFields);
if (res.data.root.outDisplayFields != 0) {
setDisplayIsShow('inline');
} else {
setDisplayIsShow('none');
}
setEditableValue(res.data.root.outEditableFields);
if (res.data.root.outEditableFields != 0) {
setEditableIsShow('inline');
} else {
setEditableIsShow('none');
}
setTransitValue(res.data.root.outTransitFields);
if (res.data.root.outTransitFields != 0) {
setTransitIsShow('inline');
} else {
setTransitIsShow('none');
}
setRelatedEventValue(res.data.root.outRelatedEventFields);
if (res.data.root.outRelatedEventFields != 0) {
setRelatedEventIsShow('inline');
} else {
setRelatedEventIsShow('none');
}
setInputValue({ ...res.data.root }); setInputValue({ ...res.data.root });
setOrder(res.data.root.Order); setOrder(res.data.root.Order);
setType1(res.data.root.BusinessType); setType1(res.data.root.BusinessType);
changTable(res.data.root.TableName); LoadEventFields({
eventTableName: res.data.root.TableName,
distinctFields: '',
}).then(res => {
if (res.data.root) {
setNu(res.data.root);
setFiled(formateArrDataA(res.data.root, 'group'));
console.log(res.data.root);
}
});
}
}); });
} }
setFlag(0); setFlag(0);
...@@ -710,7 +759,6 @@ const AddModal = props => { ...@@ -710,7 +759,6 @@ const AddModal = props => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
setNu1(res.data); setNu1(res.data);
setFiled1(formateArrDataA1(res.data, 'groupType')); setFiled1(formateArrDataA1(res.data, 'groupType'));
console.log(res.data);
} }
}); });
}; };
...@@ -718,13 +766,11 @@ const AddModal = props => { ...@@ -718,13 +766,11 @@ const AddModal = props => {
const getEventData = () => { const getEventData = () => {
GetCM_Event_LoadEventTypeTable().then(res => { GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
console.log(res.data);
setStandingTable(res.data); setStandingTable(res.data);
let arr = []; let arr = [];
res.data.map((item, index) => { res.data.map((item, index) => {
arr.push(item.text); arr.push(item.text);
}); });
console.log(arr);
// setSelectValue(arr[0]) // setSelectValue(arr[0])
// changTable(arr[0]) // changTable(arr[0])
} }
...@@ -735,7 +781,6 @@ const AddModal = props => { ...@@ -735,7 +781,6 @@ const AddModal = props => {
setType1(''); setType1('');
GetCM_Event_LoadEventTypeTable().then(res => { GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
console.log(res.data);
setStandingTable(res.data); setStandingTable(res.data);
} }
}); });
...@@ -747,12 +792,186 @@ const AddModal = props => { ...@@ -747,12 +792,186 @@ 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(filed);
console.log(res.data.root); console.log(res.data.root);
ExternalSummaryField(res.data.root);
ExternalReportField(res.data.root);
ExternalDisplayField(res.data.root);
ExternalEditableField(res.data.root);
ExternalTransitField(res.data.root);
ExternalRelatedEventField(res.data.root);
} }
}); });
}; };
// 摘要字段外部字段
const ExternalSummaryField = e => {
let pp = formateArrDataA(e, 'group');
let ab = inputValue.SummaryFields.split(',');
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else {
a.push(item);
}
}
});
setSummaryValue(a.length);
if (a.length != 0) {
setSummaryIsShow('inline');
} else {
setSummaryIsShow('none');
}
};
// 上报字段外部字段
const ExternalReportField = e => {
let pp = formateArrDataA(e, 'group');
let ab = inputValue.ReportFields.split(',');
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else {
a.push(item);
}
}
});
setReportValue(a.length);
if (a.length != 0) {
setReportIsShow('inline');
} else {
setReportIsShow('none');
}
};
// 显示字段外部字段
const ExternalDisplayField = e => {
let pp = formateArrDataA(e, 'group');
let ab = inputValue.DisplayFields.split(',');
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else {
a.push(item);
}
}
});
setDisplayValue(a.length);
if (a.length != 0) {
setDisplayIsShow('inline');
} else {
setDisplayIsShow('none');
}
};
// 编辑字段外部字段
const ExternalEditableField = e => {
let pp = formateArrDataA(e, 'group');
let ab = inputValue.EditableFields.split(',');
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else {
a.push(item);
}
}
});
setEditableValue(a.length);
if (a.length != 0) {
setEditableIsShow('inline');
} else {
setEditableIsShow('none');
}
};
// 转单字段外部字段
const ExternalTransitField = e => {
let pp = formateArrDataA(e, 'group');
let ab = inputValue.TransitFields.split(',');
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else {
a.push(item);
}
}
});
setTransitValue(a.length);
if (a.length != 0) {
setTransitIsShow('inline');
} else {
setTransitIsShow('none');
}
};
// 关联字段外部字段
const ExternalRelatedEventField = e => {
let pp = formateArrDataA(e, 'group');
let ab = inputValue.RelatedEventFields.split(',');
let arr = Object.keys(pp);
let b = [];
let a = [];
arr.map((item, index) => {
pp[item].map((i, j) => {
b.push(i);
});
});
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
a = [];
} else {
a.push(item);
}
}
});
setRelatedEventValue(a.length);
if (a.length != 0) {
setRelatedEventIsShow('inline');
} else {
setRelatedEventIsShow('none');
}
};
const formateArrDataA = (initialArr, name) => { const formateArrDataA = (initialArr, name) => {
// 判定传参是否符合规则 // 判定传参是否符合规则
if (!(initialArr instanceof Array)) { if (!(initialArr instanceof Array)) {
...@@ -871,29 +1090,21 @@ const AddModal = props => { ...@@ -871,29 +1090,21 @@ const AddModal = props => {
}; };
const onChange1 = e => { const onChange1 = e => {
console.log(e.target.checked);
setEditable(e.target.checked); setEditable(e.target.checked);
setCheckedList2(e.target.checked); //true setCheckedList2(e.target.checked); //true
}; };
const onChange2 = e => { const onChange2 = e => {
console.log(e.target.value);
setValue(e.target.value); setValue(e.target.value);
}; };
const onChange3 = e => { const onChange3 = e => {
console.log(e.target.checked);
setReportFromWeb(e.target.checked); setReportFromWeb(e.target.checked);
setCheckedList3(e.target.checked); //true setCheckedList3(e.target.checked); //true
}; };
const onChange4 = e => { const onChange4 = e => {
console.log(e.target.checked);
setReportFromMobile(e.target.checked); setReportFromMobile(e.target.checked);
setCheckedList4(e.target.checked); //true setCheckedList4(e.target.checked); //true
}; };
const onOK = prop => { const onOK = prop => {
console.log(prop.isType);
console.log(prop.stt);
console.log(prop.filed22);
console.log(prop.title);
setIsVisible(false); setIsVisible(false);
let inputText = { ...inputValue }; let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
...@@ -948,22 +1159,70 @@ const AddModal = props => { ...@@ -948,22 +1159,70 @@ const AddModal = props => {
// } // }
}; };
const onOK1 = prop => { const onOK1 = prop => {
console.log(prop.isType);
console.log(prop.stt);
console.log(prop.title);
setIsVisibleEdit(false); setIsVisibleEdit(false);
let inputText = { ...inputValue }; let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str; inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.stt); setCheckedList1(prop.stt);
setInputValue(inputText); setInputValue(inputText);
// 外部字段提示
if (prop.pickItem == 'SummaryFields') {
setSummaryValue(prop.valueArr.length);
if (prop.valueArr.length != 0) {
setSummaryIsShow('inline');
} else {
setSummaryIsShow('none');
}
}
if (prop.pickItem == 'ReportFields') {
setReportValue(prop.valueArr.length);
if (prop.valueArr.length != 0) {
setReportIsShow('inline');
} else {
setReportIsShow('none');
}
}
if (prop.pickItem == 'DisplayFields') {
setDisplayValue(prop.valueArr.length);
if (prop.valueArr.length != 0) {
setDisplayIsShow('inline');
} else {
setDisplayIsShow('none');
}
}
if (prop.pickItem == 'EditableFields') {
setEditableValue(prop.valueArr.length);
if (prop.valueArr.length != 0) {
setEditableIsShow('inline');
} else {
setEditableIsShow('none');
}
}
if (prop.pickItem == 'TransitFields') {
setTransitValue(prop.valueArr.length);
if (prop.valueArr.length != 0) {
setTransitIsShow('inline');
} else {
setTransitIsShow('none');
}
}
if (prop.pickItem == 'RelatedEventFields') {
setRelatedEventValue(prop.valueArr.length);
if (prop.valueArr.length != 0) {
setRelatedEventIsShow('inline');
} else {
setRelatedEventIsShow('none');
}
}
}; };
const oKK = prop => { const oKK = prop => {
setIsVisible1(false); setIsVisible1(false);
}; };
const pickFiled = fileds => { const pickFiled = fileds => {
if (form.getFieldsValue().TableName) {
setFlag(flag + 1);
}
let pp = formateArrDataA(nu, 'group'); let pp = formateArrDataA(nu, 'group');
let ab = inputValue[fileds].split(','); let ab = inputValue[fileds].split(',');
console.log(pp);
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -972,7 +1231,6 @@ const AddModal = props => { ...@@ -972,7 +1231,6 @@ const AddModal = props => {
b.push(i); b.push(i);
}); });
}); });
console.log(ab);
ab.map((item, index) => { ab.map((item, index) => {
if (b.includes(item) == false) { if (b.includes(item) == false) {
if (item == '') { if (item == '') {
...@@ -984,10 +1242,8 @@ const AddModal = props => { ...@@ -984,10 +1242,8 @@ const AddModal = props => {
}); });
if (a.length > 0) { if (a.length > 0) {
pp.外部字段 = a; pp.外部字段 = a;
console.log(pp);
arr.push('外部字段'); arr.push('外部字段');
} }
console.log(a);
console.log(pp); console.log(pp);
setFiled(pp); setFiled(pp);
setTypes('add'); setTypes('add');
...@@ -999,7 +1255,6 @@ const AddModal = props => { ...@@ -999,7 +1255,6 @@ const AddModal = props => {
const pickFiled1 = fileds => { const pickFiled1 = fileds => {
let pp = formateArrDataA1(nu1, 'group'); let pp = formateArrDataA1(nu1, 'group');
let ab = inputValue[fileds].split(','); let ab = inputValue[fileds].split(',');
console.log(pp);
let arr = Object.keys(pp); let arr = Object.keys(pp);
let b = []; let b = [];
let a = []; let a = [];
...@@ -1008,7 +1263,6 @@ const AddModal = props => { ...@@ -1008,7 +1263,6 @@ const AddModal = props => {
b.push(i); b.push(i);
}); });
}); });
console.log(ab);
ab.map((item, index) => { ab.map((item, index) => {
if (b.includes(item) == false) { if (b.includes(item) == false) {
if (item == '') { if (item == '') {
...@@ -1023,8 +1277,6 @@ const AddModal = props => { ...@@ -1023,8 +1277,6 @@ const AddModal = props => {
// console.log(pp); // console.log(pp);
// arr.push('外部字段'); // arr.push('外部字段');
// } // }
console.log(a);
console.log(pp);
setFiled1(pp); setFiled1(pp);
setTypes('app'); setTypes('app');
setCharacterValue(inputValue[fileds]); setCharacterValue(inputValue[fileds]);
...@@ -1133,9 +1385,10 @@ const AddModal = props => { ...@@ -1133,9 +1385,10 @@ const AddModal = props => {
> >
<Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}> <Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}>
<Row> <Row>
<Col span={13}> <Col span={14}>
<Item <Item
label="事件名称" label="事件名称"
labelCol={{ span: 7 }}
name="Name" name="Name"
rules={[ rules={[
{ {
...@@ -1162,30 +1415,11 @@ const AddModal = props => { ...@@ -1162,30 +1415,11 @@ const AddModal = props => {
<Input value={prefixName} placeholder="请输入编码前缀" /> <Input value={prefixName} placeholder="请输入编码前缀" />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
{/* <Item
label="业务类型"
name="BusinessType"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择业务类型',
},
]}
>
<Select
style={{ width: '580px' }}
placeholder="选择业务类型"
showSearch
>
{treeData ? treeData.map((item, index) => { return <Option key={index} value={item}>{item}</Option> }) : ''}
</Select>
</Item> */}
<span <span
style={{ style={{
position: 'absolute', position: 'absolute',
left: '1%', left: '2%',
top: '9%', top: '9%',
color: 'red', color: 'red',
fontSize: '16px', fontSize: '16px',
...@@ -1254,7 +1488,7 @@ const AddModal = props => { ...@@ -1254,7 +1488,7 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item <Item
label="事件主表" label="事件主表"
name="TableName" name="TableName"
...@@ -1293,25 +1527,6 @@ const AddModal = props => { ...@@ -1293,25 +1527,6 @@ const AddModal = props => {
<Item /> <Item />
</Col> </Col>
<Col span={4}> <Col span={4}>
{/* <Item
name="Reportable"
>
<Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
客户端上报和配单(需配置事件权限、受理流程)
</Checkbox>
<CheckboxGroup value={checkedList} onChange={onChange}/>
<CheckboxGroup value={checkedList} onChange={onChange}>
<Checkbox value={'前端'}>前端</Checkbox>
<Checkbox value={'手持'}>手持</Checkbox>
</CheckboxGroup>
</Item>
*/}
{/* <Item
name="Reportable"
> */}
{/* <Checkbox indeterminate={indeterminate} onChange={onCheckAllChange} checked={checkAll}>
客户端上报和配单(需配置事件权限、受理流程)
</Checkbox> */}
<Item name="ReportFromWeb"> <Item name="ReportFromWeb">
<Checkbox onChange={onChange3} checked={ReportFromWeb}> <Checkbox onChange={onChange3} checked={ReportFromWeb}>
前端 前端
...@@ -1353,20 +1568,32 @@ const AddModal = props => { ...@@ -1353,20 +1568,32 @@ const AddModal = props => {
</Radio.Group> </Radio.Group>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item
label={
<div>
<Tooltip title={`存在${summaryValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: summaryIsShow,
}}
/>
</Tooltip>
<span <span
style={{ style={{
position: 'absolute', lineHeight: '12px',
left: '1%', verticalAlign: 'middle',
top: '5%',
color: 'red', color: 'red',
fontSize: '16px', fontSize: '16px',
}} }}
> >
* *
</span> </span>
<Item <span>摘要字段</span>
label="摘要字段" </div>
}
name="SummaryFields" name="SummaryFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[ rules={[
...@@ -1397,20 +1624,32 @@ const AddModal = props => { ...@@ -1397,20 +1624,32 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item
label={
<div>
<Tooltip title={`存在${reportValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: reportIsShow,
}}
/>
</Tooltip>
<span <span
style={{ style={{
position: 'absolute', lineHeight: '12px',
left: '1%', verticalAlign: 'middle',
top: '5%',
color: 'red', color: 'red',
fontSize: '16px', fontSize: '16px',
}} }}
> >
* *
</span> </span>
<Item <span>上报字段</span>
label="上报字段" </div>
}
name="ReportFields" name="ReportFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[ rules={[
...@@ -1441,20 +1680,32 @@ const AddModal = props => { ...@@ -1441,20 +1680,32 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item
label={
<div>
<Tooltip title={`存在${displayValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: displayIsShow,
}}
/>
</Tooltip>
<span <span
style={{ style={{
position: 'absolute', lineHeight: '12px',
left: '1%', verticalAlign: 'middle',
top: '5%',
color: 'red', color: 'red',
fontSize: '16px', fontSize: '16px',
}} }}
> >
* *
</span> </span>
<Item <span>显示字段</span>
label="显示字段" </div>
}
name="DisplayFields" name="DisplayFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[ rules={[
...@@ -1485,20 +1736,32 @@ const AddModal = props => { ...@@ -1485,20 +1736,32 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item
label={
<div>
<Tooltip title={`存在${editableValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: editableIsShow,
}}
/>
</Tooltip>
<span <span
style={{ style={{
position: 'absolute', lineHeight: '12px',
left: '1%', verticalAlign: 'middle',
top: '5%',
color: 'red', color: 'red',
fontSize: '16px', fontSize: '16px',
}} }}
> >
* *
</span> </span>
<Item <span>编辑字段</span>
label="编辑字段" </div>
}
name="EditableFields" name="EditableFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[ rules={[
...@@ -1529,8 +1792,25 @@ const AddModal = props => { ...@@ -1529,8 +1792,25 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item label="转单字段" name="TransitFields" labelCol={{ span: 4 }}> <Item
label={
<div>
<Tooltip title={`存在${transitValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginRight: '2px',
display: transitIsShow,
}}
/>
</Tooltip>
<span>转单字段</span>
</div>
}
name="TransitFields"
labelCol={{ span: 4 }}
>
<div className={styles.filed_listItem}> <div className={styles.filed_listItem}>
<Input <Input
style={{ width: '83%' }} style={{ width: '83%' }}
...@@ -1548,7 +1828,7 @@ const AddModal = props => { ...@@ -1548,7 +1828,7 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item label="事件权限" name="Roles" labelCol={{ span: 4 }}> <Item label="事件权限" name="Roles" labelCol={{ span: 4 }}>
<div className={styles.filed_listItem}> <div className={styles.filed_listItem}>
<Input <Input
...@@ -1567,29 +1847,42 @@ const AddModal = props => { ...@@ -1567,29 +1847,42 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item label="置顶条件" name="TopWhere" labelCol={{ span: 4 }}> <Item label="置顶条件" name="TopWhere" labelCol={{ span: 4 }}>
<Input placeholder="请输入置顶条件" allowClear /> <Input placeholder="请输入置顶条件" allowClear />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item label="上报视图" name="ReportPage" labelCol={{ span: 4 }}> <Item label="上报视图" name="ReportPage" labelCol={{ span: 4 }}>
<Input placeholder="请输入上报视图" allowClear /> <Input placeholder="请输入上报视图" allowClear />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item label="处理视图" name="DealPage" labelCol={{ span: 4 }}> <Item label="处理视图" name="DealPage" labelCol={{ span: 4 }}>
<Input placeholder="请输入处理视图" allowClear /> <Input placeholder="请输入处理视图" allowClear />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item label="关联事件" name="RelatedEvents" labelCol={{ span: 4 }}> <Item label="关联事件" name="RelatedEvents" labelCol={{ span: 4 }}>
<Input placeholder="请输入关联事件" allowClear /> <Input placeholder="请输入关联事件" allowClear />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item <Item
label="关联字段" label={
<div>
<Tooltip title={`存在${relatedEventValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginRight: '2px',
display: relatedEventIsShow,
}}
/>
</Tooltip>
<span>关联字段</span>
</div>
}
name="RelatedEventFields" name="RelatedEventFields"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
> >
...@@ -1610,7 +1903,7 @@ const AddModal = props => { ...@@ -1610,7 +1903,7 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item <Item
label="接口配置" label="接口配置"
name="InterfaceConfig" name="InterfaceConfig"
...@@ -1619,7 +1912,7 @@ const AddModal = props => { ...@@ -1619,7 +1912,7 @@ const AddModal = props => {
<Input placeholder="请输入接口配置" /> <Input placeholder="请输入接口配置" />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={24}>
<Item <Item
label="图片表达" label="图片表达"
name="ImageExpression" name="ImageExpression"
......
...@@ -251,7 +251,6 @@ const ChangeAdd = props => { ...@@ -251,7 +251,6 @@ const ChangeAdd = props => {
}, [filed1]); }, [filed1]);
const formateArrDataA1 = (initialArr, name) => { const formateArrDataA1 = (initialArr, name) => {
console.log(initialArr);
let aa = []; let aa = [];
let a1 = []; let a1 = [];
let a2; let a2;
...@@ -269,7 +268,6 @@ const ChangeAdd = props => { ...@@ -269,7 +268,6 @@ const ChangeAdd = props => {
a3.push(o); a3.push(o);
}); });
}); });
console.log(a3);
// 判定传参是否符合规则 // 判定传参是否符合规则
if (!(a3 instanceof Array)) { if (!(a3 instanceof Array)) {
...@@ -285,7 +283,6 @@ const ChangeAdd = props => { ...@@ -285,7 +283,6 @@ const ChangeAdd = props => {
nameArr.push(i.group); nameArr.push(i.group);
} }
}); });
console.log(nameArr);
// 新建一个包含多个list的结果对象 // 新建一个包含多个list的结果对象
let tempObj = {}; let tempObj = {};
// 根据不同的"name"生成多个数组 // 根据不同的"name"生成多个数组
...@@ -298,7 +295,6 @@ const ChangeAdd = props => { ...@@ -298,7 +295,6 @@ const ChangeAdd = props => {
} }
} }
} }
console.log(tempObj);
for (let key in tempObj) { for (let key in tempObj) {
let arr = []; let arr = [];
tempObj[key].map(item => { tempObj[key].map(item => {
......
...@@ -104,7 +104,18 @@ const EditModal = props => { ...@@ -104,7 +104,18 @@ const EditModal = props => {
} }
}); });
let newArr = selectData.map(item => item.name); let newArr = selectData.map(item => item.name);
console.log(newArr);
console.log(filed.外部字段);
let valueArr = [];
if (filed.外部字段) {
newArr.forEach(item => {
if (filed.外部字段.indexOf(item) != -1) {
valueArr.push(item);
}
});
}
callBackSubmit({ callBackSubmit({
valueArr,
checkedList, checkedList,
str: aRR.join(','), str: aRR.join(','),
pickItem, pickItem,
......
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