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

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

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