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])
useEffect(() => {
getRole()
getList()
getFeedbackTable()
}, [])
const getList = () => {
CM_XWBPlan_AccountTable().then(res => {
if (res.msg == 'Ok') {
let arr = []
res.data.map((item, index) => {
arr.push(item.accountName)
})
setTreeData(arr)
}
})
} }
}, [visible]);
const onSubmit = () => { useEffect(() => {
form.validateFields().then(validate => { getRole();
if (validate) { getList();
let obj = form.getFieldsValue(); getFeedbackTable();
obj.feedbackName = inputValue.feedbackName }, []);
obj.doRole = inputValue.doRole const getList = () => {
console.log(obj.doRole) CM_XWBPlan_AccountTable().then(res => {
console.log(obj) if (res.msg == 'Ok') {
if (type == 'add') { let arr = [];
CM_XWBPlan_DataEditORAdd(obj).then(res => { res.data.map((item, index) => {
if (res.msg == '') { arr.push(item.accountName);
form.resetFields(); });
callBackSubmit(); setTreeData(arr);
notification.success({ }
message: '提示', });
duration: 3, };
description: '添加成功',
});
}else{
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
if (type == 'edit') {
CM_XWBPlan_DataEditORAdd({
...obj,
id:formObj.id
}).then(res => {
if (res.msg == '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '添加成功',
});
}else{
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
})
}
}
})
}
const inputType1 = e => {
setType1(e.target.value)
form.setFieldsValue({ businessType: e.target.value })
}
const inputType2 = e => {
setType2(e.target.value)
form.setFieldsValue({ accountName: e.target.value })
}
const changeText = (e, type) => {
let inputText = { ...inputValue }
inputText[type] = e.target.value
setInputValue(inputText)
}
const pickFiled = (fileds) => {
setTypes('add')
setCharacterValue(inputValue[fileds])
setCheckedList1(inputValue[fileds].split(','))
setPickItem(fileds)
setIsVisible(true)
}
const pickFiled1 = (fileds) => {
setTypes('app')
setCharacterValue(inputValue[fileds])
setCheckedList1(inputValue[fileds].split(','))
console.log(inputValue[fileds])
console.log(inputValue[fileds].split(','))
setPickItem(fileds)
setIsVisible(true)
}
const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setFiled1(formateArrDataA1(res.data, 'groupType'))
console.log(filed1)
console.log(filed1['角色'])
setFf(filed1['角色'])
console.log(ff)
console.log(res.data)
const onSubmit = () => {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
obj.feedbackName = inputValue.feedbackName;
obj.doRole = inputValue.doRole;
console.log(obj.doRole);
console.log(obj);
if (type == 'add') {
CM_XWBPlan_DataEditORAdd(obj).then(res => {
if (res.msg == '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '添加成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
} }
}) });
}
const getFeedbackTable = () => {
CM_XWBPlan_feedbackTable().then(res => {
if (res.msg == 'Ok') {
let arr = []
res.data.map((item, index) => {
arr.push(item.accountName)
})
setFiled(arr)
}
})
}
const formateArrDataA1 = (initialArr, name) => {
let aa = []
let a1 = []
let a2
let a3 = []
initialArr.map(i => {
// console.log(i.groupType)
a2 = i.groupType
// console.log(a2)
// console.log(i.root)
a1 = i.root
a1.map(j => {
j.group = a2
// console.log(j)
})
aa.push(i.root)
})
// console.log(aa)
aa.map(p => {
// console.log(p)
p.map(o => {
// console.log(o)
a3.push(o)
})
})
console.log(a3)
// 判定传参是否符合规则
if (!(a3 instanceof Array)) {
return '请传入正确格式的数组'
}
if (!name) {
return '请传入对象属性'
} }
//先获取一下这个数组中有多少个"name" if (type == 'edit') {
let nameArr = [] CM_XWBPlan_DataEditORAdd({
a3.map(i => { ...obj,
if (nameArr.indexOf(i.group) === -1) { id: formObj.id,
nameArr.push(i.group) }).then(res => {
if (res.msg == '') {
form.resetFields();
callBackSubmit();
notification.success({
message: '提示',
duration: 3,
description: '添加成功',
});
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
} }
}) });
console.log(nameArr)
//新建一个包含多个list的结果对象
let tempObj = {}
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in a3) {
if (a3[j].group == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || []
tempObj[nameArr[k]].push(a3[j])
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = []
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.Name)
})
} }
return tempObj }
});
};
const inputType1 = e => {
setType1(e.target.value);
form.setFieldsValue({ businessType: e.target.value });
};
const inputType2 = e => {
setType2(e.target.value);
form.setFieldsValue({ accountName: e.target.value });
};
const changeText = (e, type) => {
let inputText = { ...inputValue };
inputText[type] = e.target.value;
setInputValue(inputText);
};
const pickFiled = fileds => {
setTypes('add');
setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(','));
setPickItem(fileds);
setIsVisible(true);
};
const pickFiled1 = fileds => {
setTypes('app');
setCharacterValue(inputValue[fileds]);
setCheckedList1(inputValue[fileds].split(','));
console.log(inputValue[fileds]);
console.log(inputValue[fileds].split(','));
setPickItem(fileds);
setIsVisible(true);
};
const getRole = () => {
CM_Event_LoadDepartmentAndRoles().then(res => {
if (res.msg === 'Ok') {
setFiled1(formateArrDataA1(res.data, 'groupType'));
console.log(filed1);
console.log(filed1['角色']);
setFf(filed1['角色']);
console.log(ff);
console.log(res.data);
}
});
};
const getFeedbackTable = () => {
CM_XWBPlan_feedbackTable().then(res => {
if (res.msg === 'Ok') {
let arr = [];
res.data.map((item, index) => {
arr.push(item.accountName);
});
setFiled(arr);
}
});
};
const formateArrDataA1 = (initialArr, name) => {
let aa = [];
let a1 = [];
let a2;
let a3 = [];
initialArr.data.map(i => {
// console.log(i.groupType)
a2 = i.groupType;
// console.log(a2)
// console.log(i.root)
a1 = i.root;
a1.map(j => {
j.group = a2;
// console.log(j)
});
aa.push(i.root);
});
// console.log(aa)
aa.map(p => {
// console.log(p)
p.map(o => {
// console.log(o)
a3.push(o);
});
});
console.log(a3);
// 判定传参是否符合规则
if (!(a3 instanceof Array)) {
return '请传入正确格式的数组';
} }
const changTable = value => { if (!name) {
setSelectValue(value) return '请传入对象属性';
} }
const changTable1 = value => { //先获取一下这个数组中有多少个"name"
setSelectValue1(value) let nameArr = [];
a3.map(i => {
if (nameArr.indexOf(i.group) === -1) {
nameArr.push(i.group);
}
});
console.log(nameArr);
//新建一个包含多个list的结果对象
let tempObj = {};
// 根据不同的"name"生成多个数组
for (let k in nameArr) {
for (let j in a3) {
if (a3[j].group == nameArr[k]) {
// 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
tempObj[nameArr[k]].push(a3[j]);
}
}
} }
const onOK = prop => { console.log(tempObj);
console.log(prop.isType) for (let key in tempObj) {
setIsVisible(false) let arr = [];
let inputText = { ...inputValue } tempObj[key].map(item => {
inputText[prop.pickItem] = prop.str tempObj[key] = arr;
setCheckedList1(prop.checkedList) arr.push(item.Name);
setInputValue(inputText) });
} }
// const title = <ModalDrag title="巡维保计划配置" /> return tempObj;
return ( };
<Drawer const changTable = value => {
title="巡维保计划配置" setSelectValue(value);
visible={visible} };
destroyOnClose const changTable1 = value => {
width="600px" setSelectValue1(value);
{...props} };
footer={ const onOK = prop => {
<Space> console.log(prop.isType);
<Button onClick={onSubmit} type="primary" > setIsVisible(false);
确定 let inputText = { ...inputValue };
</Button> inputText[prop.pickItem] = prop.str;
</Space> setCheckedList1(prop.checkedList);
} setInputValue(inputText);
> };
<Form form={form} labelCol={{ span: 7 }} style={{overflowY: 'scroll' }}> // const title = <ModalDrag title="巡维保计划配置" />
<Row> return (
<Col span={23}> <Drawer
<Item title="巡维保计划配置"
label="业务名称" visible={visible}
name="businessName" destroyOnClose
labelCol={{ span: 4 }} width="600px"
rules={[ {...props}
{ footer={
required: true, <Space>
message: '请输入业务名称', <Button onClick={onSubmit} type="primary">
}, 确定
]} </Button>
> </Space>
<Input placeholder="业务名称不可重复" /> }
</Item> >
</Col> <Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}>
<Col span={23}> <Row>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> <Col span={23}>
<Item <Item
label="业务类型" label="业务名称"
name="businessType" name="businessName"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[ rules={[
{ {
validator: (rule, value) => { required: true,
if (form.getFieldsValue().businessType == '') { message: '请输入业务名称',
return Promise.reject('业务类型必填') },
} ]}
return Promise.resolve(); >
} <Input placeholder="业务名称不可重复" />
} </Item>
]} </Col>
> <Col span={23}>
<div> <span
<Input style={{
className="ue-editable-select-input" position: 'absolute',
left: '1%',
onChange={inputType1} top: '9%',
value={Type1} color: 'red',
placeholder="选择或手动输入业务类型" fontSize: '16px',
> }}
</Input> >
<Dropdown *
placement='bottomRight' </span>
style={{ width: '430px' }} <Item
overlay={<Menu> label="业务类型"
<Menu.Item key="巡检" onClick={() => { setType1("巡检"); form.setFieldsValue({ businessType: "巡检" }) }} style={{ width: '430px', marginLeft: '-8px' }}>巡检</Menu.Item> name="businessType"
<Menu.Item key="保养" onClick={() => { setType1("保养"); form.setFieldsValue({ businessType: "保养" }) }} style={{ width: '430px', marginLeft: '-8px' }}>保养</Menu.Item> labelCol={{ span: 4 }}
</Menu>} > rules={[
<div className={styles.linkDrowp} onClick={e => e.preventDefault()}> {
<DownOutlined style={{ fontSize: '12px', color: 'rgba(0, 0, 0, 0.25)', marginLeft:'5px' }} /> validator: (rule, value) => {
</div> if (form.getFieldsValue().businessType == '') {
</Dropdown> return Promise.reject('业务类型必填');
</div> }
</Item> return Promise.resolve();
</Col> },
<Col span={23}> },
<Item ]}
label="执行周期" >
name="docycle" <div>
labelCol={{ span: 4 }} <Input
rules={[ className="ue-editable-select-input"
{ onChange={inputType1}
required: true, value={Type1}
message: '请选择执行周期', placeholder="选择或手动输入业务类型"
}, />
]} <Dropdown
> placement="bottomRight"
<Select style={{ width: '430px' }}
overlay={
placeholder="选择计划执行周期" <Menu>
onChange={changTable} <Menu.Item
value={selectValue} key="巡检"
> onClick={() => {
<Option value="一周一次">一周一次</Option> setType1('巡检');
<Option value="半月一次">半月一次</Option> form.setFieldsValue({ businessType: '巡检' });
<Option value="一月一次">一月一次</Option> }}
<Option value="季度一次">季度一次</Option> style={{ width: '430px', marginLeft: '-8px' }}
<Option value="半年一次">半年一次</Option> >
<Option value="一年一次">一年一次</Option> 巡检
</Select> </Menu.Item>
</Item> <Menu.Item
</Col> key="保养"
<Col span={23}> onClick={() => {
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> setType1('保养');
<Item form.setFieldsValue({ businessType: '保养' });
label="台账名称" }}
name="accountName" style={{ width: '430px', marginLeft: '-8px' }}
labelCol={{ span: 4 }} >
rules={[ 保养
{ </Menu.Item>
validator: (rule, value) => { </Menu>
if (form.getFieldsValue().accountName == '') { }
return Promise.reject('台账名称必选') >
} <div
return Promise.resolve(); className={styles.linkDrowp}
} onClick={e => e.preventDefault()}
} >
]} <DownOutlined
> style={{
<div> fontSize: '12px',
<Input color: 'rgba(0, 0, 0, 0.25)',
className="ue-editable-select-input" marginLeft: '5px',
}}
onChange={inputType2} />
value={Type2} </div>
placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备" </Dropdown>
> </div>
</Input> </Item>
<Dropdown </Col>
placement='bottomRight' <Col span={23}>
style={{ width: '430px' }} <Item
overlay={<Menu> label="执行周期"
{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> }) : ''} name="docycle"
</Menu>} > labelCol={{ span: 4 }}
<div className={styles.linkDrowp} onClick={e => e.preventDefault()}> rules={[
<DownOutlined style={{ fontSize: '12px', color: 'rgba(0, 0, 0, 0.25)', marginLeft:'5px'}} /> {
</div> required: true,
</Dropdown> message: '请选择执行周期',
</div> },
</Item> ]}
</Col> >
<Col span={23}> <Select
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> placeholder="选择计划执行周期"
<Item onChange={changTable}
label="反馈名称" value={selectValue}
name="feedbackName" >
labelCol={{ span: 4 }} <Option value="一周一次">一周一次</Option>
rules={[ <Option value="半月一次">半月一次</Option>
{ <Option value="一月一次">一月一次</Option>
validator: (rule, value) => { <Option value="季度一次">季度一次</Option>
if (inputValue.feedbackName == "") { <Option value="半年一次">半年一次</Option>
return Promise.reject('反馈名称必填') <Option value="一年一次">一年一次</Option>
} </Select>
return Promise.resolve(); </Item>
} </Col>
} <Col span={23}>
]} <span
> style={{
<div className={styles.filed_listItem} > position: 'absolute',
<Input style={{ width: '83%' }} placeholder="请选择反馈名称" onChange={(e) => changeText(e, 'feedbackName')} value={inputValue.feedbackName} allowClear /> left: '1%',
<Button type="dashed" onClick={() => pickFiled('feedbackName')} icon={<PlusOutlined style={{marginTop:'5px'}}/>} style={{ marginLeft: '0.5rem', width: '4rem' }} /> top: '9%',
</div> color: 'red',
fontSize: '16px',
</Item> }}
</Col> >
<Col span={23}> *
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span> </span>
<Item <Item
label="执行角色" label="台账名称"
name="doRole" name="accountName"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[ rules={[
{ {
validator: (rule, value) => { validator: (rule, value) => {
if (inputValue.doRole == "") { if (form.getFieldsValue().accountName == '') {
return Promise.reject('执行角色必填') return Promise.reject('台账名称必选');
} }
return Promise.resolve(); return Promise.resolve();
} },
}, },
]} ]}
> >
<div className={styles.filed_listItem} > <div>
<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' }} /> className="ue-editable-select-input"
</div> onChange={inputType2}
</Item> value={Type2}
</Col> placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备"
<Col span={13}> />
<Item <Dropdown
label="预生成天数" placement="bottomRight"
name="produceDays" style={{ width: '430px' }}
rules={[ overlay={
{ <Menu>
required: true, {treeData.length
message: '请输入预生成天数', ? treeData.map((item, index) => {
}, return (
]} <Menu.Item
> onClick={() => {
<Input placeholder="请输入预生成天数" /> setType2(item);
</Item> form.setFieldsValue({ accountName: item });
</Col> }}
<Col span={10}> style={{ width: '430px', marginLeft: '-8px' }}
<Item key={index}
label="在线任务量" >
name="onLines" {item}
labelCol={{ span: 10 }} </Menu.Item>
rules={[ );
{ })
required: true, : ''}
message: '请输入在线任务量', </Menu>
}, }
]} >
> <div
<Input placeholder="请输入在线任务量" /> className={styles.linkDrowp}
</Item> onClick={e => e.preventDefault()}
</Col> >
<Col span={23}> <DownOutlined
<Item style={{
label="是否送审" fontSize: '12px',
name="isSubmit" color: 'rgba(0, 0, 0, 0.25)',
labelCol={{ span: 4 }} marginLeft: '5px',
rules={[ }}
{ />
required: true, </div>
message: '请选择是否送审', </Dropdown>
}, </div>
]} </Item>
> </Col>
<Select <Col span={23}>
<span
placeholder="是否送审" style={{
onChange={changTable1} position: 'absolute',
value={selectValue1} left: '1%',
> top: '9%',
<Option value="否"></Option> color: 'red',
<Option value="是"></Option> fontSize: '16px',
</Select> }}
</Item> >
</Col> *
<Col span={23}> </span>
<Item <Item
label="台账过滤条件" label="反馈名称"
name="filterCondition" name="feedbackName"
labelCol={{ span: 4 }} labelCol={{ span: 4 }}
rules={[
> {
<TextArea placeholder="设备对应的Scada台账名称,可多选" /> validator: (rule, value) => {
</Item> if (inputValue.feedbackName == '') {
</Col> return Promise.reject('反馈名称必填');
</Row> }
</Form> return Promise.resolve();
<ChangeAdd },
visible={isVisible} },
onCancel={() => setIsVisible(false)} ]}
callBackSubmit={onOK} >
newCheckedList={checkedList1} <div className={styles.filed_listItem}>
isType={types} <Input
filed={filed} style={{ width: '83%' }}
filed1={filed1} placeholder="请选择反馈名称"
ff={ff} onChange={e => changeText(e, 'feedbackName')}
pickItem={pickItem} value={inputValue.feedbackName}
characterValue={characterValue} allowClear
/> />
</Drawer> <Button
) type="dashed"
onClick={() => pickFiled('feedbackName')}
icon={<PlusOutlined style={{ marginTop: '5px' }} />}
style={{ marginLeft: '0.5rem', width: '4rem' }}
/>
</div>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item
label="执行角色"
name="doRole"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (inputValue.doRole == '') {
return Promise.reject('执行角色必填');
}
return Promise.resolve();
},
},
]}
>
<div className={styles.filed_listItem}>
<Input
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>
</Item>
</Col>
<Col span={13}>
<Item
label="预生成天数"
name="produceDays"
rules={[
{
required: true,
message: '请输入预生成天数',
},
]}
>
<Input placeholder="请输入预生成天数" />
</Item>
</Col>
<Col span={10}>
<Item
label="在线任务量"
name="onLines"
labelCol={{ span: 10 }}
rules={[
{
required: true,
message: '请输入在线任务量',
},
]}
>
<Input placeholder="请输入在线任务量" />
</Item>
</Col>
<Col span={23}>
<Item
label="是否送审"
name="isSubmit"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择是否送审',
},
]}
>
<Select
placeholder="是否送审"
onChange={changTable1}
value={selectValue1}
>
<Option value="否"></Option>
<Option value="是"></Option>
</Select>
</Item>
</Col>
<Col span={23}>
<Item
label="台账过滤条件"
name="filterCondition"
labelCol={{ span: 4 }}
>
<TextArea placeholder="设备对应的Scada台账名称,可多选" />
</Item>
</Col>
</Row>
</Form>
<ChangeAdd
visible={isVisible}
onCancel={() => setIsVisible(false)}
callBackSubmit={onOK}
newCheckedList={checkedList1}
isType={types}
filed={filed}
filed1={filed1}
ff={ff}
pickItem={pickItem}
characterValue={characterValue}
/>
</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 => {
let arr = [];
list.map((item, index) => {
arr.push(item);
});
console.log(list);
console.log(arr);
setCheckedList(arr);
setIndeterminate(!!list.length && list.length < filed.length);
setCheckAll(list.length === filed.length);
};
const onChangeList1 = list => {
let arr = [];
list.map((item, index) => {
arr.push(item);
});
console.log(list);
console.log(arr);
setCheckedList(arr);
setIndeterminate(!!list.length && list.length < ff.length);
setCheckAll(list.length === ff.length);
};
const onChangeList = (list) => { const onSubmit = () => {
let arr = [] isType === 'rule'
list.map((item, index) => { ? callBackSubmit(
arr.push(item) `${
}) value === '无' || value === '' ? '' : `${value},`
console.log(list) }${checkValue.join(',')}`,
console.log(arr) )
setCheckedList(arr) : callBackSubmit({
setIndeterminate(!!list.length && list.length < filed.length) checkedList,
setCheckAll(list.length === filed.length) str: selectData.join(','),
}; pickItem,
const onChangeList1 = (list) => { stt: selectData,
let arr = [] filed22: filed1,
list.map((item, index) => { isType,
arr.push(item) });
}) };
console.log(list) const onCheckAllChange = e => {
console.log(arr) setCheckedList(e.target.checked ? filed : []);
setCheckedList(arr) setIndeterminate(false);
setIndeterminate(!!list.length && list.length < ff.length) setCheckAll(e.target.checked);
setCheckAll(list.length === ff.length) };
}; const onCheckAllChange1 = e => {
setCheckedList(e.target.checked ? ff : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
useEffect(() => {
selectAll();
}, [checkedList]);
const onSubmit = () => { const selectAll = () => {
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(","), pickItem, stt: selectData, filed22: filed1, isType: isType }); objArr = [];
} checkedList.map(item => {
const onCheckAllChange = e => { objArr = objArr.concat(item);
setCheckedList(e.target.checked ? filed : []) });
setIndeterminate(false) console.log(checkedList);
setCheckAll(e.target.checked) setSelectData(objArr);
}; };
const onCheckAllChange1 = e => {
setCheckedList(e.target.checked ? ff : [])
setIndeterminate(false)
setCheckAll(e.target.checked)
}
useEffect(() => {
selectAll()
}, [checkedList]);
const selectAll = () => {
objArr = []
checkedList.map(item => {
objArr = objArr.concat(item)
})
console.log(checkedList)
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)
setIndeterminate(!!newCheckedList.length && newCheckedList.length < filed.length)
setCheckAll(newCheckedList.length === filed.length)
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
} else if (isType === 'app') {
let checkArr = []
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (ff.includes(checkItem)) {
checkArr.push(checkItem)
}
})
setCheckedList(checkArr)
setIndeterminate(!!newCheckedList.length && newCheckedList.length < ff.length)
setCheckAll(newCheckedList.length === ff.length)
let newArr = characterValue.length ? characterValue.split(",") : []
setSelectData(newArr)
} }
}, [visible]); });
setCheckedList(checkArr);
setIndeterminate(
if (isType != 'app') { !!newCheckedList.length && newCheckedList.length < filed.length,
return ( );
<div className={styles.ChangeAddContainer}> setCheckAll(newCheckedList.length === filed.length);
<Modal let newArr = characterValue.length ? characterValue.split(',') : [];
title="反馈名称" setSelectData(newArr);
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="450px"
destroyOnClose
centered={true}
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender={true}
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem}>
{JSON.stringify(filed) == "{}" ?
<>
<div className={styles.cardContent}>
<span style={{ color: 'red', fontSize: '1rem', marginLeft: '25px' }}>暂无数据请先配置台账管理台账名称为反馈</span>
</div>
</>
:
<>
<div className={styles.cardContent}>
<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>
<CheckboxGroup options={filed} value={checkedList} onChange={(e) => onChangeList(e)} /></div>
</div>
</>
}
</div>
</div>
)
}
</Modal>
</div>
);
} else if (isType === 'app') { } else if (isType === 'app') {
return ( let checkArr = [];
<Modal console.log(newCheckedList);
title="角色" newCheckedList.map(checkItem => {
bodyStyle={{ width: '100%', minHeight: '100px' }} if (ff.includes(checkItem)) {
style={{ top: '10px' }} checkArr.push(checkItem);
width="450px" }
destroyOnClose });
centered={true} setCheckedList(checkArr);
cancelText="取消" setIndeterminate(
okText="确认" !!newCheckedList.length && newCheckedList.length < ff.length,
{...props} );
onOk={() => onSubmit()} setCheckAll(newCheckedList.length === ff.length);
forceRender={true} let newArr = characterValue.length ? characterValue.split(',') : [];
getContainer={false} setSelectData(newArr);
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem}>
<div className={styles.cardContent}>
<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>
<CheckboxGroup options={ff} value={checkedList} onChange={(e) => onChangeList1(e)} /></div>
</div>
</div>
</div>
)
}
</Modal>
);
} }
}, [visible]);
if (isType != 'app') {
return (
<div className={styles.ChangeAddContainer}>
<Modal
title="反馈名称"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="400px"
destroyOnClose
centered
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem}>
{JSON.stringify(filed) == '{}' ? (
<>
<div className={styles.cardContent}>
<span
style={{
color: 'red',
fontSize: '1rem',
marginLeft: '25px',
}}
>
暂无数据请先配置台账管理台账名称为反馈
</span>
</div>
</>
) : (
<>
<div className={styles.cardContent}>
<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>
<CheckboxGroup
options={filed}
value={checkedList}
onChange={e => onChangeList(e)}
/>
</div>
</div>
</>
)}
</div>
</div>
)}
</Modal>
</div>
);
}
if (isType === 'app') {
return (
<Modal
title="角色"
bodyStyle={{ width: '100%', minHeight: '100px' }}
style={{ top: '10px' }}
width="450px"
destroyOnClose
centered
cancelText="取消"
okText="确认"
{...props}
onOk={() => onSubmit()}
forceRender
getContainer={false}
>
{visible && (
<div className={styles.listCard}>
<div className={styles.cardItem}>
<div className={styles.cardContent}>
<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>
<CheckboxGroup
options={ff}
value={checkedList}
onChange={e => onChangeList1(e)}
/>
</div>
</div>
</div>
</div>
)}
</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);
setInputValue({ ...res.data.root }); setSummaryValue(res.data.root.outSummaryFields);
setOrder(res.data.root.Order); if (res.data.root.outSummaryFields != 0) {
setType1(res.data.root.BusinessType); setSummaryIsShow('inline');
changTable(res.data.root.TableName); } 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 });
setOrder(res.data.root.Order);
setType1(res.data.root.BusinessType);
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,10 +792,184 @@ const AddModal = props => { ...@@ -747,10 +792,184 @@ 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) => {
...@@ -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}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="摘要字段" label={
<div>
<Tooltip title={`存在${summaryValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: summaryIsShow,
}}
/>
</Tooltip>
<span
style={{
lineHeight: '12px',
verticalAlign: 'middle',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<span>摘要字段</span>
</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}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="上报字段" label={
<div>
<Tooltip title={`存在${reportValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: reportIsShow,
}}
/>
</Tooltip>
<span
style={{
lineHeight: '12px',
verticalAlign: 'middle',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<span>上报字段</span>
</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}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="显示字段" label={
<div>
<Tooltip title={`存在${displayValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: displayIsShow,
}}
/>
</Tooltip>
<span
style={{
lineHeight: '12px',
verticalAlign: 'middle',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<span>显示字段</span>
</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}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item <Item
label="编辑字段" label={
<div>
<Tooltip title={`存在${editableValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginLeft: '-6px',
display: editableIsShow,
}}
/>
</Tooltip>
<span
style={{
lineHeight: '12px',
verticalAlign: 'middle',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<span>编辑字段</span>
</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