Commit 32f08112 authored by 皮倩雯's avatar 皮倩雯

fix: '设备维保交互优化'

parent 0e4c3b77
Pipeline #63119 waiting for manual action with stages
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
Menu, Menu,
Space, Space,
Radio, Radio,
Switch,
} from 'antd'; } from 'antd';
import { import {
PlusOutlined, PlusOutlined,
...@@ -30,7 +31,11 @@ import { ...@@ -30,7 +31,11 @@ import {
CM_XWBPlan_DataEditORAdd, CM_XWBPlan_DataEditORAdd,
CM_XWBPlan_DataList, CM_XWBPlan_DataList,
} from '@/services/maintenance/api'; } from '@/services/maintenance/api';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import {
GetCM_Event_LoadEventTable,
CM_Event_LoadDepartmentAndRoles,
} from '@/services/standingBook/api';
import RMSComponents from '@/components/RolePmSite/index'; import RMSComponents from '@/components/RolePmSite/index';
import ChangeAdd from './ChangeAdd'; import ChangeAdd from './ChangeAdd';
...@@ -57,6 +62,10 @@ const AddModal = props => { ...@@ -57,6 +62,10 @@ const AddModal = props => {
const [groupName, setGroupName] = useState('角色'); const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色']); const [chooseGroupName, setChooseGroupName] = useState(['角色']);
const [keepFiled, setKeepFiled] = useState([]); const [keepFiled, setKeepFiled] = useState([]);
const [visibleChecked, setVisibleChecked] = useState(false);
const [visibleChecked1, setVisibleChecked1] = useState(false);
const [eventData, setEventData] = useState([]);
const [autoFlag, setAutoFlag] = useState(false); // 禁用自动派发
const [form] = Form.useForm(); const [form] = Form.useForm();
const { Item } = Form; const { Item } = Form;
...@@ -65,6 +74,7 @@ const AddModal = props => { ...@@ -65,6 +74,7 @@ const AddModal = props => {
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
getRole(); getRole();
getEventData();
if (type === 'add') { if (type === 'add') {
setChee('否'); setChee('否');
form.setFieldsValue({ isSubmit: '否', docycle: '一周一次' }); form.setFieldsValue({ isSubmit: '否', docycle: '一周一次' });
...@@ -74,13 +84,16 @@ const AddModal = props => { ...@@ -74,13 +84,16 @@ const AddModal = props => {
} 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];
setVisibleChecked(data.isSubmit == '是');
setVisibleChecked1(data.autoAssign == '是');
data && form.setFieldsValue({ ...data }); data && form.setFieldsValue({ ...data });
console.log(data.businessTypee);
setType1(data.businessType); setType1(data.businessType);
setType2(data.accountName); setType2(data.accountName);
}); });
} }
} else { } else {
setVisibleChecked(false);
setVisibleChecked1(false);
setChee(''); setChee('');
form.resetFields(); form.resetFields();
} }
...@@ -91,6 +104,22 @@ const AddModal = props => { ...@@ -91,6 +104,22 @@ const AddModal = props => {
getList(); getList();
getFeedbackTable(); getFeedbackTable();
}, []); }, []);
// 获取关联事件数据
const getEventData = () => {
GetCM_Event_LoadEventTable().then(res => {
if (res.code === 0) {
let aa = [];
res.data.map(i => {
i.root.map(j => {
aa.push(j.name);
});
});
setEventData(aa);
}
});
};
const getList = () => { const getList = () => {
CM_XWBPlan_AccountTable().then(res => { CM_XWBPlan_AccountTable().then(res => {
if (res.msg == 'Ok') { if (res.msg == 'Ok') {
...@@ -107,6 +136,8 @@ const AddModal = props => { ...@@ -107,6 +136,8 @@ const AddModal = props => {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
obj.isSubmit = visibleChecked == true ? '是' : '否';
obj.autoAssign = visibleChecked1 == true ? '是' : '否';
if (type == 'add') { if (type == 'add') {
CM_XWBPlan_DataEditORAdd(obj).then(res => { CM_XWBPlan_DataEditORAdd(obj).then(res => {
if (res.msg == '') { if (res.msg == '') {
...@@ -127,6 +158,10 @@ const AddModal = props => { ...@@ -127,6 +158,10 @@ const AddModal = props => {
}); });
} }
if (type == 'edit') { if (type == 'edit') {
console.log(obj.isSubmit);
obj.isSubmit = visibleChecked == true ? '是' : '否';
obj.autoAssign = visibleChecked1 == true ? '是' : '否';
console.log(obj);
CM_XWBPlan_DataEditORAdd({ CM_XWBPlan_DataEditORAdd({
...obj, ...obj,
id: formObj.id, id: formObj.id,
...@@ -316,6 +351,18 @@ const AddModal = props => { ...@@ -316,6 +351,18 @@ const AddModal = props => {
form.setFieldsValue({ businessType: value }); form.setFieldsValue({ businessType: value });
} }
}; };
const change = e => {
console.log(e);
setVisibleChecked(e);
setAutoFlag(e);
};
const change1 = e => {
console.log(e);
setVisibleChecked1(e);
};
return ( return (
<Drawer <Drawer
title="巡维保计划配置" title="巡维保计划配置"
...@@ -393,6 +440,10 @@ const AddModal = props => { ...@@ -393,6 +440,10 @@ const AddModal = props => {
<Col span={24}> <Col span={24}>
<Item label="执行周期" name="docycle" labelCol={{ span: 5 }}> <Item label="执行周期" name="docycle" labelCol={{ span: 5 }}>
<Select placeholder="选择计划执行周期"> <Select placeholder="选择计划执行周期">
<Option value="2小时一次">2小时一次</Option>
<Option value="6小时一次">6小时一次</Option>
<Option value="12小时一次">12小时一次</Option>
<Option value="一日一次">一日一次</Option>
<Option value="一周一次">一周一次</Option> <Option value="一周一次">一周一次</Option>
<Option value="半月一次">半月一次</Option> <Option value="半月一次">半月一次</Option>
<Option value="一月一次">一月一次</Option> <Option value="一月一次">一月一次</Option>
...@@ -542,12 +593,42 @@ const AddModal = props => { ...@@ -542,12 +593,42 @@ const AddModal = props => {
<Input placeholder="请输入在线任务量" /> <Input placeholder="请输入在线任务量" />
</Item> </Item>
</Col> </Col>
<Col span={24}>
<Item label="关联事件" name="relationEvent" labelCol={{ span: 5 }}>
<Select placeholder="选择事件表" showSearch>
{eventData
? eventData.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select>
</Item>
</Col>
<Col span={24}> <Col span={24}>
<Item label="是否送审" name="isSubmit" labelCol={{ span: 5 }}> <Item label="是否送审" name="isSubmit" labelCol={{ span: 5 }}>
<Radio.Group defaultValue={chee}> <Switch
checkedChildren="是"
unCheckedChildren="否"
checked={visibleChecked}
onChange={change}
/>
{/* <Radio.Group defaultValue={chee}>
<Radio value="否">否</Radio> <Radio value="否">否</Radio>
<Radio value="是">是</Radio> <Radio value="是">是</Radio>
</Radio.Group> </Radio.Group> */}
</Item>
</Col>
<Col span={24}>
<Item label="自动派发" name="autoAssign" labelCol={{ span: 5 }}>
<Switch
checkedChildren="是"
unCheckedChildren="否"
checked={visibleChecked1}
onChange={change1}
disabled={autoFlag}
/>
</Item> </Item>
</Col> </Col>
<Col span={24}> <Col span={24}>
......
...@@ -16,7 +16,10 @@ import { ...@@ -16,7 +16,10 @@ import {
CM_Feedback_LoadFields, CM_Feedback_LoadFields,
CM_Feedback_QueryPatrolFeedback, CM_Feedback_QueryPatrolFeedback,
} from '@/services/PatrolFeedback/api'; } from '@/services/PatrolFeedback/api';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import {
GetCM_Event_LoadEventTable,
CM_Event_LoadDepartmentAndRoles,
} from '@/services/standingBook/api';
import RMSComponents from '@/components/RolePmSite/index'; import RMSComponents from '@/components/RolePmSite/index';
import ChangeRoles from './ChangeRoles'; import ChangeRoles from './ChangeRoles';
...@@ -40,12 +43,14 @@ const AddModal = props => { ...@@ -40,12 +43,14 @@ const AddModal = props => {
const [groupName, setGroupName] = useState('角色'); const [groupName, setGroupName] = useState('角色');
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']); const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
const [keepFiled, setKeepFiled] = useState([]); const [keepFiled, setKeepFiled] = useState([]);
const [eventData, setEventData] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
const { Item } = Form; const { Item } = Form;
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
getEventData();
getFeedbackTable(); getFeedbackTable();
getRoles(); getRoles();
if (type === 'edit') { if (type === 'edit') {
...@@ -58,6 +63,21 @@ const AddModal = props => { ...@@ -58,6 +63,21 @@ const AddModal = props => {
} }
}, [visible]); }, [visible]);
// 获取关联事件数据
const getEventData = () => {
GetCM_Event_LoadEventTable().then(res => {
if (res.code === 0) {
let aa = [];
res.data.map(i => {
i.root.map(j => {
aa.push(j.name);
});
});
setEventData(aa);
}
});
};
const getFeedbackTable = () => { const getFeedbackTable = () => {
CM_Feedback_LoadFeedbackTables().then(res => { CM_Feedback_LoadFeedbackTables().then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -464,6 +484,19 @@ const AddModal = props => { ...@@ -464,6 +484,19 @@ const AddModal = props => {
</div> </div>
</Item> </Item>
</Col> </Col>
<Col span={23}>
<Item label="关联事件" name="relationEvent" labelCol={{ span: 4 }}>
<Select placeholder="选择事件表" showSearch>
{eventData
? eventData.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select>
</Item>
</Col>
{/* <Col span={23}> {/* <Col span={23}>
<Item label="分组" name="groupType" labelCol={{ span: 4 }}> <Item label="分组" name="groupType" labelCol={{ span: 4 }}>
<Input placeholder="请输入分组" /> <Input placeholder="请输入分组" />
......
...@@ -87,8 +87,8 @@ const ProcessConfig = props => { ...@@ -87,8 +87,8 @@ const ProcessConfig = props => {
rules={[{ required: true, message: '请选择前端样式' }]} rules={[{ required: true, message: '请选择前端样式' }]}
> >
<Select placeholder="请选择前端样式"> <Select placeholder="请选择前端样式">
<Option value="多表显示">多表显示</Option>
<Option value="多表在办显示">多表在办显示</Option> <Option value="多表在办显示">多表在办显示</Option>
<Option value="多表显示">多表显示</Option>
<Option value="表堆叠显示">表堆叠显示</Option> <Option value="表堆叠显示">表堆叠显示</Option>
{/* <Option value="分派节点显示">分派节点显示</Option> */} {/* <Option value="分派节点显示">分派节点显示</Option> */}
</Select> </Select>
......
...@@ -11,6 +11,7 @@ import { ...@@ -11,6 +11,7 @@ import {
checkedValue, checkedValue,
message, message,
notification, notification,
Switch,
} from 'antd'; } from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
import classnames from 'classnames'; import classnames from 'classnames';
...@@ -40,6 +41,7 @@ const EditForm = props => { ...@@ -40,6 +41,7 @@ const EditForm = props => {
const [indeterminate, setIndeterminate] = useState([]); const [indeterminate, setIndeterminate] = useState([]);
const [indeterminateAll, setIndeterminateAll] = useState(false); const [indeterminateAll, setIndeterminateAll] = useState(false);
const [choo, setChoo] = useState(false); // 最外层复选框状态 const [choo, setChoo] = useState(false); // 最外层复选框状态
const [visibleChecked, setVisibleChecked] = useState(false);
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
labelCol: { span: 2 }, labelCol: { span: 2 },
...@@ -60,6 +62,8 @@ const EditForm = props => { ...@@ -60,6 +62,8 @@ const EditForm = props => {
arr.map(i => { arr.map(i => {
obj[i] = infoAll[i]; obj[i] = infoAll[i];
}); });
console.log(obj);
setVisibleChecked(infoAll.hideInMenu);
targetForm.setFieldsValue({ ...obj, shortName: infoAll.menuShortName }); targetForm.setFieldsValue({ ...obj, shortName: infoAll.menuShortName });
if (info.length > 0) { if (info.length > 0) {
let list = []; let list = [];
...@@ -272,6 +276,12 @@ const EditForm = props => { ...@@ -272,6 +276,12 @@ const EditForm = props => {
setIndeterminateAll(false); setIndeterminateAll(false);
setPlainOptions(list); setPlainOptions(list);
}; };
const change = e => {
console.log(e);
setVisibleChecked(e);
};
return ( return (
<div style={{ marginTop: '10px' }}> <div style={{ marginTop: '10px' }}>
{nodeType === 1 && ( {nodeType === 1 && (
...@@ -320,10 +330,16 @@ const EditForm = props => { ...@@ -320,10 +330,16 @@ const EditForm = props => {
initialValue={false} initialValue={false}
style={{ marginLeft: '11px' }} style={{ marginLeft: '11px' }}
> >
<Radio.Group onChange={radioChange}> <Switch
checkedChildren="是"
unCheckedChildren="否"
checked={visibleChecked}
onChange={change}
/>
{/* <Radio.Group onChange={radioChange}>
<Radio value={false}>否</Radio> <Radio value={false}>否</Radio>
<Radio value>是</Radio> <Radio value>是</Radio>
</Radio.Group> </Radio.Group> */}
</Item> </Item>
<Item <Item
name="pageUrl" name="pageUrl"
...@@ -374,74 +390,68 @@ const EditForm = props => { ...@@ -374,74 +390,68 @@ const EditForm = props => {
</Checkbox> </Checkbox>
</div> </div>
{plainOptions && plainOptions.length > 0 ? ( {plainOptions && plainOptions.length > 0 ? (
plainOptions.map((item, index) => { plainOptions.map((item, index) => (
return ( <div
<div className={classnames({
className={classnames({ [styles.divBox]: item.groupName.length > 0,
[styles.divBox]: item.groupName.length > 0, })}
})} >
> <div style={{ marginTop: '-12px' }}>
<div style={{ marginTop: '-12px' }}> {item.groupName.length == 0 ? (
{item.groupName.length == 0 ? ( <span style={{ marginLeft: '15px', marginTop: '0px' }} />
<span style={{ marginLeft: '15px', marginTop: '0px' }} /> ) : (
) : ( <Checkbox
<Checkbox onChange={e => {
onChange={e => { selectChange(e, index, item);
selectChange(e, index, item); }}
}} checked={item.isChecked}
checked={item.isChecked} indeterminate={indeterminate[index]}
indeterminate={indeterminate[index]} >
> <span style={{ fontWeight: 'bold', fontSize: '15px' }}>
<span style={{ fontWeight: 'bold', fontSize: '15px' }}> {item.groupName}
{item.groupName} </span>
</span> </Checkbox>
</Checkbox> )}
)} </div>
</div> <div style={{ marginLeft: '0px', marginTop: '5px' }}>
<div style={{ marginLeft: '0px', marginTop: '5px' }}> {item.groupName.length == 0 ? (
{item.groupName.length == 0 ? ( <>
<> <Row>
<Row> {item.list.map((val, i) => (
{item.list.map((val, i) => { <Col span={4} style={{ marginBottom: '10px' }}>
return ( <Checkbox
<Col span={4} style={{ marginBottom: '10px' }}> onChange={e => {
<Checkbox handleChecked(e, index, item, i);
onChange={e => { }}
handleChecked(e, index, item, i); checked={val.related}
}} >
checked={val.related} {val.relatedRoleName}
> </Checkbox>
{val.relatedRoleName} </Col>
</Checkbox> ))}
</Col> </Row>
); </>
})} ) : (
</Row> <>
</> <Row>
) : ( {item.list.map((val, i) => (
<> <Col span={4}>
<Row> <Checkbox
{item.list.map((val, i) => { onChange={e => {
return ( handleChecked(e, index, item, i);
<Col span={4}> }}
<Checkbox checked={val.related}
onChange={e => { >
handleChecked(e, index, item, i); {val.relatedRoleName}
}} </Checkbox>
checked={val.related} </Col>
> ))}
{val.relatedRoleName} </Row>
</Checkbox> </>
</Col> )}
);
})}
</Row>
</>
)}
</div>
</div> </div>
); </div>
}) ))
) : ( ) : (
<span /> <span />
)} )}
......
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