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

事件外部字段显示

parent b7d995e0
Pipeline #41848 skipped with stages
import React, { useState, useEffect} from 'react';
import { Drawer, Form, Input, notification, Row, Col, Select, Button, Dropdown, Menu, Space } from 'antd';
import styles from './maintenance.less'
import React, { useState, useEffect } from 'react';
import {
Drawer,
Form,
Input,
notification,
Row,
Col,
Select,
Button,
Dropdown,
Menu,
Space,
} from 'antd';
import styles from './maintenance.less';
import ModalDrag from './ModalDrag';
import { CM_XWBPlan_AccountTable, CM_XWBPlan_feedbackTable, 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'
import {
CM_XWBPlan_AccountTable,
CM_XWBPlan_feedbackTable,
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 AddModal = props => {
const [inputValue, setInputValue] = useState({ feedbackName: '', doRole: '' });
const { callBackSubmit = () => { }, visible, type, formObj } = props;
const [inputValue, setInputValue] = useState({
feedbackName: '',
doRole: '',
});
const { callBackSubmit = () => {}, visible, type, formObj } = props;
const [Type1, setType1] = useState('')
const [Type2, setType2] = useState('')
const [selectValue, setSelectValue] = useState('')
const [selectValue1, setSelectValue1] = useState('')
const [treeData, setTreeData] = useState([])
const [isVisible, setIsVisible] = useState(false)
const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [types, setTypes] = useState(''); // 弹窗类型
const [pickItem, setPickItem] = useState('')//复选框数据填入项
const [checkedList1, setCheckedList1] = useState([])//最新选择数据
const [characterValue, setCharacterValue] = useState('')//打开弹框之前数据
const [ff, setFf] = useState([])
const [Type1, setType1] = useState('');
const [Type2, setType2] = useState('');
const [selectValue, setSelectValue] = useState('');
const [selectValue1, setSelectValue1] = useState('');
const [treeData, setTreeData] = useState([]);
const [isVisible, setIsVisible] = useState(false);
const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
const [types, setTypes] = useState(''); // 弹窗类型
const [pickItem, setPickItem] = useState(''); //复选框数据填入项
const [checkedList1, setCheckedList1] = useState([]); //最新选择数据
const [characterValue, setCharacterValue] = useState(''); //打开弹框之前数据
const [ff, setFf] = useState([]);
const [form] = Form.useForm();
const { Item } = Form;
const { TextArea } = Input;
const [form] = Form.useForm();
const { Item } = Form;
const { TextArea } = Input;
useEffect(() => {
getRole()
if (type === 'add') {
setType1('')
setType2('')
setInputValue({ feedbackName: '', doRole: '' })
setFiled1({})
form.resetFields();
} else if (type === 'edit') {
CM_XWBPlan_DataList({id:formObj.id}).then(res =>{
let data = res.data[0]
data && form.setFieldsValue({ ...data});
setInputValue({ ...data})
console.log(data.businessTypee)
setType1(data.businessType)
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)
}
})
useEffect(() => {
getRole();
if (type === 'add') {
setType1('');
setType2('');
setInputValue({ feedbackName: '', doRole: '' });
setFiled1({});
form.resetFields();
} else if (type === 'edit') {
CM_XWBPlan_DataList({ id: formObj.id }).then(res => {
let data = res.data[0];
data && form.setFieldsValue({ ...data });
setInputValue({ ...data });
console.log(data.businessTypee);
setType1(data.businessType);
setType2(data.accountName);
});
}
}, [visible]);
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,
});
}
})
}
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)
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);
}
});
};
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"
let nameArr = []
a3.map(i => {
if (nameArr.indexOf(i.group) === -1) {
nameArr.push(i.group)
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,
});
}
})
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 => {
setSelectValue(value)
if (!name) {
return '请传入对象属性';
}
const changTable1 = value => {
setSelectValue1(value)
//先获取一下这个数组中有多少个"name"
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(prop.isType)
setIsVisible(false)
let inputText = { ...inputValue }
inputText[prop.pickItem] = prop.str
setCheckedList1(prop.checkedList)
setInputValue(inputText)
console.log(tempObj);
for (let key in tempObj) {
let arr = [];
tempObj[key].map(item => {
tempObj[key] = arr;
arr.push(item.Name);
});
}
// const title = <ModalDrag title="巡维保计划配置" />
return (
<Drawer
title="巡维保计划配置"
visible={visible}
destroyOnClose
width="600px"
{...props}
footer={
<Space>
<Button onClick={onSubmit} type="primary" >
确定
</Button>
</Space>
}
>
<Form form={form} labelCol={{ span: 7 }} style={{overflowY: 'scroll' }}>
<Row>
<Col span={23}>
<Item
label="业务名称"
name="businessName"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请输入业务名称',
},
]}
>
<Input placeholder="业务名称不可重复" />
</Item>
</Col>
<Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="业务类型"
name="businessType"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (form.getFieldsValue().businessType == '') {
return Promise.reject('业务类型必填')
}
return Promise.resolve();
}
}
]}
>
<div>
<Input
className="ue-editable-select-input"
onChange={inputType1}
value={Type1}
placeholder="选择或手动输入业务类型"
>
</Input>
<Dropdown
placement='bottomRight'
style={{ width: '430px' }}
overlay={<Menu>
<Menu.Item key="巡检" onClick={() => { 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>
</Dropdown>
</div>
</Item>
</Col>
<Col span={23}>
<Item
label="执行周期"
name="docycle"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择执行周期',
},
]}
>
<Select
placeholder="选择计划执行周期"
onChange={changTable}
value={selectValue}
>
<Option value="一周一次">一周一次</Option>
<Option value="半月一次">半月一次</Option>
<Option value="一月一次">一月一次</Option>
<Option value="季度一次">季度一次</Option>
<Option value="半年一次">半年一次</Option>
<Option value="一年一次">一年一次</Option>
</Select>
</Item>
</Col>
<Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="台账名称"
name="accountName"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (form.getFieldsValue().accountName == '') {
return Promise.reject('台账名称必选')
}
return Promise.resolve();
}
}
]}
>
<div>
<Input
className="ue-editable-select-input"
onChange={inputType2}
value={Type2}
placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备"
>
</Input>
<Dropdown
placement='bottomRight'
style={{ width: '430px' }}
overlay={<Menu>
{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>} >
<div className={styles.linkDrowp} onClick={e => e.preventDefault()}>
<DownOutlined style={{ fontSize: '12px', color: 'rgba(0, 0, 0, 0.25)', marginLeft:'5px'}} />
</div>
</Dropdown>
</div>
</Item>
</Col>
<Col span={23}>
<span style={{ position: 'absolute', left: '1%', top: '9%', color: 'red', fontSize: '16px' }}>*</span>
<Item
label="反馈名称"
name="feedbackName"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (inputValue.feedbackName == "") {
return Promise.reject('反馈名称必填')
}
return Promise.resolve();
}
}
]}
>
<div className={styles.filed_listItem} >
<Input 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>
</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>
)
return tempObj;
};
const changTable = value => {
setSelectValue(value);
};
const changTable1 = value => {
setSelectValue1(value);
};
const onOK = prop => {
console.log(prop.isType);
setIsVisible(false);
let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.checkedList);
setInputValue(inputText);
};
// const title = <ModalDrag title="巡维保计划配置" />
return (
<Drawer
title="巡维保计划配置"
visible={visible}
destroyOnClose
width="600px"
{...props}
footer={
<Space>
<Button onClick={onSubmit} type="primary">
确定
</Button>
</Space>
}
>
<Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}>
<Row>
<Col span={23}>
<Item
label="业务名称"
name="businessName"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请输入业务名称',
},
]}
>
<Input placeholder="业务名称不可重复" />
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item
label="业务类型"
name="businessType"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (form.getFieldsValue().businessType == '') {
return Promise.reject('业务类型必填');
}
return Promise.resolve();
},
},
]}
>
<div>
<Input
className="ue-editable-select-input"
onChange={inputType1}
value={Type1}
placeholder="选择或手动输入业务类型"
/>
<Dropdown
placement="bottomRight"
style={{ width: '430px' }}
overlay={
<Menu>
<Menu.Item
key="巡检"
onClick={() => {
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>
</Dropdown>
</div>
</Item>
</Col>
<Col span={23}>
<Item
label="执行周期"
name="docycle"
labelCol={{ span: 4 }}
rules={[
{
required: true,
message: '请选择执行周期',
},
]}
>
<Select
placeholder="选择计划执行周期"
onChange={changTable}
value={selectValue}
>
<Option value="一周一次">一周一次</Option>
<Option value="半月一次">半月一次</Option>
<Option value="一月一次">一月一次</Option>
<Option value="季度一次">季度一次</Option>
<Option value="半年一次">半年一次</Option>
<Option value="一年一次">一年一次</Option>
</Select>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item
label="台账名称"
name="accountName"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (form.getFieldsValue().accountName == '') {
return Promise.reject('台账名称必选');
}
return Promise.resolve();
},
},
]}
>
<div>
<Input
className="ue-editable-select-input"
onChange={inputType2}
value={Type2}
placeholder="选择此计划关联的设备台账名称,如果没有请先配置台账管理台账名称为设备"
/>
<Dropdown
placement="bottomRight"
style={{ width: '430px' }}
overlay={
<Menu>
{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>
}
>
<div
className={styles.linkDrowp}
onClick={e => e.preventDefault()}
>
<DownOutlined
style={{
fontSize: '12px',
color: 'rgba(0, 0, 0, 0.25)',
marginLeft: '5px',
}}
/>
</div>
</Dropdown>
</div>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '9%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Item
label="反馈名称"
name="feedbackName"
labelCol={{ span: 4 }}
rules={[
{
validator: (rule, value) => {
if (inputValue.feedbackName == '') {
return Promise.reject('反馈名称必填');
}
return Promise.resolve();
},
},
]}
>
<div className={styles.filed_listItem}>
<Input
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>
</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
\ No newline at end of file
export default AddModal;
import React, { useState, useEffect, PureComponent } from 'react';
import { Modal, Divider, Checkbox, Space, Button } from 'antd';
import styles from './maintenance.less'
import styles from './maintenance.less';
const CheckboxGroup = Checkbox.Group;
const ChangeAdd = props => {
const { callBackSubmit = () => { }, isType, visible, newCheckedList, 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 {
callBackSubmit = () => {},
isType,
visible,
newCheckedList,
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) => {
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 onSubmit = () => {
isType === 'rule'
? callBackSubmit(
`${
value === '无' || value === '' ? '' : `${value},`
}${checkValue.join(',')}`,
)
: callBackSubmit({
checkedList,
str: selectData.join(','),
pickItem,
stt: selectData,
filed22: filed1,
isType,
});
};
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? filed : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
const onCheckAllChange1 = e => {
setCheckedList(e.target.checked ? ff : []);
setIndeterminate(false);
setCheckAll(e.target.checked);
};
useEffect(() => {
selectAll();
}, [checkedList]);
const onSubmit = () => {
isType === 'rule' ? callBackSubmit(`${value === '无' || value === '' ? '' : value + ','}${checkValue.join(',')}`) : callBackSubmit({ checkedList, str: selectData.join(","), pickItem, stt: selectData, filed22: filed1, isType: isType });
}
const onCheckAllChange = e => {
setCheckedList(e.target.checked ? filed : [])
setIndeterminate(false)
setCheckAll(e.target.checked)
};
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)
}
const selectAll = () => {
objArr = [];
checkedList.map(item => {
objArr = objArr.concat(item);
});
console.log(checkedList);
setSelectData(objArr);
};
useEffect(() => {
console.log(indeterminate)
if (isType != '' && isType === 'add') {
let checkArr = []
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (filed.includes(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)
useEffect(() => {
console.log(indeterminate);
if (isType != '' && isType === 'add') {
let checkArr = [];
console.log(newCheckedList);
newCheckedList.map(checkItem => {
if (filed.includes(checkItem)) {
checkArr.push(checkItem);
}
}, [visible]);
if (isType != 'app') {
return (
<div className={styles.ChangeAddContainer}>
<Modal
title="反馈名称"
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>
);
});
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') {
return (
<Modal
title="角色"
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}>
<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>
);
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]);
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
\ No newline at end of file
export default ChangeAdd;
......@@ -35,6 +35,7 @@ import {
Dropdown,
Menu,
Button,
Tooltip,
} from 'antd';
import {
GetCM_Event_LoadEventTypeTable,
......@@ -49,7 +50,11 @@ import ChangeAdd from './changeAdd';
import ChangeEdit from './changeEdit';
import ChangeImage from './ChangeImage';
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 { getRoleGroup } from '@/services/userCenter/roleManage/api';
......@@ -497,6 +502,18 @@ const AddModal = props => {
const [isVisible1, setIsVisible1] = useState(false); // 弹窗
const [characterValue, setCharacterValue] = useState('');
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 onSubmit = () => {
......@@ -505,23 +522,17 @@ const AddModal = props => {
setLoading(true);
let obj = form.getFieldsValue();
obj.Code = obj.Code.toString();
console.log(obj);
console.log(obj.Reportable);
console.log(obj.ReportFromWeb);
console.log(obj.ReportFromMobile);
if (obj.BusinessType === undefined) {
obj.BusinessType = rember1;
}
if (obj.TableName === undefined) {
console.log(selectValue);
obj.TableName = selectValue;
}
if (obj.CreateMode === undefined) {
console.log(1111);
obj.CreateMode = 0;
}
// eslint-disable-next-line no-constant-condition
if (obj.CreateMode === 0 || 1) {
console.log(2222);
obj.CreateMode = obj.CreateMode.toString();
}
if (editable != true) {
......@@ -563,11 +574,6 @@ const AddModal = props => {
inputValue.ReportFromMobile = '';
inputValue.ReportFromWeb = '';
}
console.log(obj.BusinessType);
console.log(ReportFromWeb);
console.log(ReportFromMobile);
console.log(obj);
console.log(inputValue);
let data = { ...obj, ...inputValue, Order: maxLength };
if (inputValue.Roles == '' && inputValue.Reportable != '否') {
notification.warning({
......@@ -658,13 +664,10 @@ const AddModal = props => {
};
useEffect(() => {
console.log(rember1);
console.log(selectData);
getRole();
if (type === 'add') {
setType1(rember1);
form.setFieldsValue({ BusinessType: rember1 });
console.log(Type1);
setReportFromWeb(true);
setCheckedList3(true);
setChee(0);
......@@ -690,16 +693,62 @@ const AddModal = props => {
} else if (type === 'edit') {
getEventData1();
GetCM_Event_QueryEventType({ eventTypeId: formObj.ID }).then(res => {
res.data.root && form.setFieldsValue({ ...res.data.root });
console.log(res.data.root);
console.log(res.data.root.Editable);
setEditable(res.data.root.Editable);
setReportFromMobile(res.data.root.ReportFromMobile);
setReportFromWeb(res.data.root.ReportFromWeb);
setInputValue({ ...res.data.root });
setOrder(res.data.root.Order);
setType1(res.data.root.BusinessType);
changTable(res.data.root.TableName);
if (res.data.root) {
console.log(res.data.root);
form.setFieldsValue({ ...res.data.root });
setEditable(res.data.root.Editable);
setReportFromMobile(res.data.root.ReportFromMobile);
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 });
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);
......@@ -710,7 +759,6 @@ const AddModal = props => {
if (res.msg === 'Ok') {
setNu1(res.data);
setFiled1(formateArrDataA1(res.data, 'groupType'));
console.log(res.data);
}
});
};
......@@ -718,13 +766,11 @@ const AddModal = props => {
const getEventData = () => {
GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') {
console.log(res.data);
setStandingTable(res.data);
let arr = [];
res.data.map((item, index) => {
arr.push(item.text);
});
console.log(arr);
// setSelectValue(arr[0])
// changTable(arr[0])
}
......@@ -735,7 +781,6 @@ const AddModal = props => {
setType1('');
GetCM_Event_LoadEventTypeTable().then(res => {
if (res.msg === 'Ok') {
console.log(res.data);
setStandingTable(res.data);
}
});
......@@ -747,10 +792,184 @@ const AddModal = props => {
if (res.data.root) {
setNu(res.data.root);
setFiled(formateArrDataA(res.data.root, 'group'));
console.log(filed);
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) => {
......@@ -871,29 +1090,21 @@ const AddModal = props => {
};
const onChange1 = e => {
console.log(e.target.checked);
setEditable(e.target.checked);
setCheckedList2(e.target.checked); //true
};
const onChange2 = e => {
console.log(e.target.value);
setValue(e.target.value);
};
const onChange3 = e => {
console.log(e.target.checked);
setReportFromWeb(e.target.checked);
setCheckedList3(e.target.checked); //true
};
const onChange4 = e => {
console.log(e.target.checked);
setReportFromMobile(e.target.checked);
setCheckedList4(e.target.checked); //true
};
const onOK = prop => {
console.log(prop.isType);
console.log(prop.stt);
console.log(prop.filed22);
console.log(prop.title);
setIsVisible(false);
let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str;
......@@ -948,22 +1159,70 @@ const AddModal = props => {
// }
};
const onOK1 = prop => {
console.log(prop.isType);
console.log(prop.stt);
console.log(prop.title);
setIsVisibleEdit(false);
let inputText = { ...inputValue };
inputText[prop.pickItem] = prop.str;
setCheckedList1(prop.stt);
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 => {
setIsVisible1(false);
};
const pickFiled = fileds => {
if (form.getFieldsValue().TableName) {
setFlag(flag + 1);
}
let pp = formateArrDataA(nu, 'group');
let ab = inputValue[fileds].split(',');
console.log(pp);
let arr = Object.keys(pp);
let b = [];
let a = [];
......@@ -972,7 +1231,6 @@ const AddModal = props => {
b.push(i);
});
});
console.log(ab);
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
......@@ -984,10 +1242,8 @@ const AddModal = props => {
});
if (a.length > 0) {
pp.外部字段 = a;
console.log(pp);
arr.push('外部字段');
}
console.log(a);
console.log(pp);
setFiled(pp);
setTypes('add');
......@@ -999,7 +1255,6 @@ const AddModal = props => {
const pickFiled1 = fileds => {
let pp = formateArrDataA1(nu1, 'group');
let ab = inputValue[fileds].split(',');
console.log(pp);
let arr = Object.keys(pp);
let b = [];
let a = [];
......@@ -1008,7 +1263,6 @@ const AddModal = props => {
b.push(i);
});
});
console.log(ab);
ab.map((item, index) => {
if (b.includes(item) == false) {
if (item == '') {
......@@ -1023,8 +1277,6 @@ const AddModal = props => {
// console.log(pp);
// arr.push('外部字段');
// }
console.log(a);
console.log(pp);
setFiled1(pp);
setTypes('app');
setCharacterValue(inputValue[fileds]);
......@@ -1133,9 +1385,10 @@ const AddModal = props => {
>
<Form form={form} labelCol={{ span: 7 }} style={{ overflowY: 'scroll' }}>
<Row>
<Col span={13}>
<Col span={14}>
<Item
label="事件名称"
labelCol={{ span: 7 }}
name="Name"
rules={[
{
......@@ -1162,30 +1415,11 @@ const AddModal = props => {
<Input value={prefixName} placeholder="请输入编码前缀" />
</Item>
</Col>
<Col span={23}>
{/* <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> */}
<Col span={24}>
<span
style={{
position: 'absolute',
left: '1%',
left: '2%',
top: '9%',
color: 'red',
fontSize: '16px',
......@@ -1254,7 +1488,7 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item
label="事件主表"
name="TableName"
......@@ -1293,25 +1527,6 @@ const AddModal = props => {
<Item />
</Col>
<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">
<Checkbox onChange={onChange3} checked={ReportFromWeb}>
前端
......@@ -1353,20 +1568,32 @@ const AddModal = props => {
</Radio.Group>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Col span={24}>
<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"
labelCol={{ span: 4 }}
rules={[
......@@ -1397,20 +1624,32 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Col span={24}>
<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"
labelCol={{ span: 4 }}
rules={[
......@@ -1441,20 +1680,32 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Col span={24}>
<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"
labelCol={{ span: 4 }}
rules={[
......@@ -1485,20 +1736,32 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<span
style={{
position: 'absolute',
left: '1%',
top: '5%',
color: 'red',
fontSize: '16px',
}}
>
*
</span>
<Col span={24}>
<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"
labelCol={{ span: 4 }}
rules={[
......@@ -1529,8 +1792,25 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<Item label="转单字段" name="TransitFields" labelCol={{ span: 4 }}>
<Col span={24}>
<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}>
<Input
style={{ width: '83%' }}
......@@ -1548,7 +1828,7 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item label="事件权限" name="Roles" labelCol={{ span: 4 }}>
<div className={styles.filed_listItem}>
<Input
......@@ -1567,29 +1847,42 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item label="置顶条件" name="TopWhere" labelCol={{ span: 4 }}>
<Input placeholder="请输入置顶条件" allowClear />
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item label="上报视图" name="ReportPage" labelCol={{ span: 4 }}>
<Input placeholder="请输入上报视图" allowClear />
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item label="处理视图" name="DealPage" labelCol={{ span: 4 }}>
<Input placeholder="请输入处理视图" allowClear />
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item label="关联事件" name="RelatedEvents" labelCol={{ span: 4 }}>
<Input placeholder="请输入关联事件" allowClear />
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item
label="关联字段"
label={
<div>
<Tooltip title={`存在${relatedEventValue}个外部字段`}>
<InfoCircleOutlined
style={{
color: 'red',
marginRight: '2px',
display: relatedEventIsShow,
}}
/>
</Tooltip>
<span>关联字段</span>
</div>
}
name="RelatedEventFields"
labelCol={{ span: 4 }}
>
......@@ -1610,7 +1903,7 @@ const AddModal = props => {
</div>
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item
label="接口配置"
name="InterfaceConfig"
......@@ -1619,7 +1912,7 @@ const AddModal = props => {
<Input placeholder="请输入接口配置" />
</Item>
</Col>
<Col span={23}>
<Col span={24}>
<Item
label="图片表达"
name="ImageExpression"
......
......@@ -251,7 +251,6 @@ const ChangeAdd = props => {
}, [filed1]);
const formateArrDataA1 = (initialArr, name) => {
console.log(initialArr);
let aa = [];
let a1 = [];
let a2;
......@@ -269,7 +268,6 @@ const ChangeAdd = props => {
a3.push(o);
});
});
console.log(a3);
// 判定传参是否符合规则
if (!(a3 instanceof Array)) {
......@@ -285,7 +283,6 @@ const ChangeAdd = props => {
nameArr.push(i.group);
}
});
console.log(nameArr);
// 新建一个包含多个list的结果对象
let tempObj = {};
// 根据不同的"name"生成多个数组
......@@ -298,7 +295,6 @@ const ChangeAdd = props => {
}
}
}
console.log(tempObj);
for (let key in tempObj) {
let arr = [];
tempObj[key].map(item => {
......
......@@ -104,7 +104,18 @@ const EditModal = props => {
}
});
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({
valueArr,
checkedList,
str: aRR.join(','),
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