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

fix: '方案制定优化'

parent abc4c13b
Pipeline #81580 passed with stages
...@@ -28,7 +28,7 @@ const RuleConfig = props => { ...@@ -28,7 +28,7 @@ const RuleConfig = props => {
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
setExpandedKey(fieldList[0].TableName); setExpandedKey(fieldList?.[0]?.TableName);
setRule(RuleContent); setRule(RuleContent);
setTimeout(() => { setTimeout(() => {
document document
...@@ -111,7 +111,7 @@ const RuleConfig = props => { ...@@ -111,7 +111,7 @@ const RuleConfig = props => {
onSelect={onSelect} onSelect={onSelect}
selectedKeys={[currentSelectId]} selectedKeys={[currentSelectId]}
expandedKeys={expandedKey} expandedKeys={expandedKey}
treeData={fieldList.map((item, index) => mapTree(item, index))} treeData={fieldList?.map((item, index) => mapTree(item, index))}
/> />
</div> </div>
<div className={styles.rightContent}> <div className={styles.rightContent}>
......
...@@ -44,13 +44,14 @@ import RuleConfig from '@/components/RuleConfig'; ...@@ -44,13 +44,14 @@ import RuleConfig from '@/components/RuleConfig';
import { FormRender } from 'panda-xform'; import { FormRender } from 'panda-xform';
import { import {
CM_XWBPlan_AccountTable, CM_XWBPlan_AccountTable,
CM_XWBPlan_feedbackTable, NewCM_XWBPlan_feedbackTable,
CM_XWBPlan_DataEditORAdd, NewCM_XWBPlan_DataEditORAdd,
CM_XWBPlan_DataList, NewCM_XWBPlan_DataList,
QueryDevicesList, QueryDevicesList,
GetParentDeviceTemplate, GetParentDeviceTemplate,
GetFeedbackTableFields, GetFeedbackTableFields,
GetAccountConfigInfo, GetAccountConfigInfo,
newGetAccountConfigInfo,
} from '@/services/maintenance/api'; } from '@/services/maintenance/api';
import BaseTimeConfig from './components/BaseTimeConfig'; import BaseTimeConfig from './components/BaseTimeConfig';
...@@ -400,12 +401,15 @@ const AddModal = props => { ...@@ -400,12 +401,15 @@ const AddModal = props => {
} else if (type === 'edit') { } else if (type === 'edit') {
getParentList(); getParentList();
CM_XWBPlan_DataList({ id: formObj.id }).then(res => { NewCM_XWBPlan_DataList({ id: formObj.id }).then(res => {
if (res.data[0].docycle.indexOf('{') === -1) { if (res.data[0].docycle.indexOf('{') === -1) {
setKeepTimeData(null); setKeepTimeData(null);
} else { } else {
let list = JSON.parse(res.data[0].docycle); let list = JSON.parse(res.data[0].docycle);
setKeepTimeData(list); setKeepTimeData(list);
form.setFieldsValue({
time: list?.time,
});
} }
let data = res.data[0]; let data = res.data[0];
...@@ -432,9 +436,12 @@ const AddModal = props => { ...@@ -432,9 +436,12 @@ const AddModal = props => {
setVisibleChecked1(data.autoAssign === '是'); setVisibleChecked1(data.autoAssign === '是');
data && form.setFieldsValue({ ...data }); data && form.setFieldsValue({ ...data });
if (data.parentBusinessName) { if (data.parentBusinessName) {
form.setFieldsValue({ parentId: data.parentId }); form.setFieldsValue({
parentId: data.parentId,
inOrder: data.inOrder === 1 ? true : false,
});
} else { } else {
form.setFieldsValue({ parentId: '' }); form.setFieldsValue({ parentId: '', inOrder: data.inOrder === 1 ? true : false });
} }
setType1(data.businessType); setType1(data.businessType);
...@@ -456,6 +463,7 @@ const AddModal = props => { ...@@ -456,6 +463,7 @@ const AddModal = props => {
setKeepData([]); setKeepData([]);
setKeep([]); setKeep([]);
setCount(0); setCount(0);
setFieldList([]);
} }
}, [visible]); }, [visible]);
...@@ -518,6 +526,39 @@ const AddModal = props => { ...@@ -518,6 +526,39 @@ const AddModal = props => {
obj.isSubmit = visibleChecked === true ? '是' : '否'; obj.isSubmit = visibleChecked === true ? '是' : '否';
obj.autoAssign = visibleChecked1 === true ? '是' : '否'; obj.autoAssign = visibleChecked1 === true ? '是' : '否';
let datas = detailTimeData(timeData.current.getdata); let datas = detailTimeData(timeData.current.getdata);
obj.inOrder = obj.inOrder ? 1 : 0;
if (!obj.time) {
datas.time = false;
if (datas.type === '月') {
datas.excTime = [
{
mold: 'begin',
day: 1,
type: '首',
},
{
mold: 'end',
day: 28,
type: '首',
},
];
} else if (datas.type === '周') {
datas.excTime = [
{
mold: 'begin',
day: 1,
type: 'now',
},
{
mold: 'end',
day: 7,
type: 'now',
},
];
}
} else {
datas.time = true;
}
obj.docycle = JSON.stringify(datas); obj.docycle = JSON.stringify(datas);
let arr = []; let arr = [];
dataSource.forEach(i => { dataSource.forEach(i => {
...@@ -529,7 +570,7 @@ const AddModal = props => { ...@@ -529,7 +570,7 @@ const AddModal = props => {
} else { } else {
obj.feedbackName = newArr.toString(); obj.feedbackName = newArr.toString();
if (type === 'add') { if (type === 'add') {
CM_XWBPlan_DataEditORAdd({ NewCM_XWBPlan_DataEditORAdd({
...obj, ...obj,
mappingFields: mappingFields && JSON.stringify(mappingFields), mappingFields: mappingFields && JSON.stringify(mappingFields),
}).then(res => { }).then(res => {
...@@ -553,7 +594,7 @@ const AddModal = props => { ...@@ -553,7 +594,7 @@ const AddModal = props => {
if (type === 'edit') { if (type === 'edit') {
obj.isSubmit = visibleChecked === true ? '是' : '否'; obj.isSubmit = visibleChecked === true ? '是' : '否';
obj.autoAssign = visibleChecked1 === true ? '是' : '否'; obj.autoAssign = visibleChecked1 === true ? '是' : '否';
CM_XWBPlan_DataEditORAdd({ NewCM_XWBPlan_DataEditORAdd({
...obj, ...obj,
id: formObj.id, id: formObj.id,
mappingFields: mappingFields && JSON.stringify(mappingFields), mappingFields: mappingFields && JSON.stringify(mappingFields),
...@@ -716,7 +757,7 @@ const AddModal = props => { ...@@ -716,7 +757,7 @@ const AddModal = props => {
return list; return list;
}; };
const getFeedbackTable = () => { const getFeedbackTable = () => {
CM_XWBPlan_feedbackTable().then(res => { NewCM_XWBPlan_feedbackTable().then(res => {
if (res.code === 0) { if (res.code === 0) {
let arr = []; let arr = [];
res.data.forEach((item, index) => { res.data.forEach((item, index) => {
...@@ -1052,12 +1093,16 @@ const AddModal = props => { ...@@ -1052,12 +1093,16 @@ const AddModal = props => {
} }
} }
}); });
GetAccountConfigInfo({ accountName: val }).then(res => { newGetAccountConfigInfo({ accountName: val }).then(res => {
if (res.code === 0) { if (res.code === 0) {
let list = res.data.editFieldGroup.split(','); let arr = [];
res.data?.map(resData => {
let list = resData.editFieldGroup.split(',');
let newList = list.filter(i => i && i.trim()); let newList = list.filter(i => i && i.trim());
let data = [{ TableName: res.data.tableName, TableFieldNames: newList }]; let data = { TableName: resData.tableName, TableFieldNames: newList };
setFieldList(data); arr.push(data);
});
setFieldList(arr);
} }
}); });
if (flag) { if (flag) {
...@@ -1328,7 +1373,7 @@ const AddModal = props => { ...@@ -1328,7 +1373,7 @@ const AddModal = props => {
marginBottom: '5px', marginBottom: '5px',
}} }}
> >
请选择此设备巡检后的反馈表单,来源与类型维设备反馈的台账 请选择此设备巡检后的反馈表单,来源与类型为【设备反馈】的台账
</div> </div>
{stateType === 'drag' {stateType === 'drag'
? dataSource.length > 0 && ( ? dataSource.length > 0 && (
...@@ -1362,7 +1407,7 @@ const AddModal = props => { ...@@ -1362,7 +1407,7 @@ const AddModal = props => {
)} )}
</Item> </Item>
</Col> </Col>
<Col span={24}> <Col span={12}>
<Button <Button
onClick={handleAdd} onClick={handleAdd}
icon={<EditOutlined />} icon={<EditOutlined />}
...@@ -1375,6 +1420,11 @@ const AddModal = props => { ...@@ -1375,6 +1420,11 @@ const AddModal = props => {
添加设备反馈 添加设备反馈
</Button> </Button>
</Col> </Col>
<Col span={12}>
<Item valuePropName="checked" label="顺序验证" name="inOrder">
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
</Item>
</Col>
<BaseTimeConfig <BaseTimeConfig
keepTimeData={keepTimeData} keepTimeData={keepTimeData}
ref={timeData} ref={timeData}
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/* eslint-disable prefer-destructuring */ /* eslint-disable prefer-destructuring */
/* eslint-disable no-else-return */ /* eslint-disable no-else-return */
// 基础信息配置 // 基础信息配置
import { Form, Radio, Select, Row, Col } from 'antd'; import { Form, Radio, Select, Row, Col, Switch } from 'antd';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import styles from './BaseTimeConfig.less'; import styles from './BaseTimeConfig.less';
...@@ -33,9 +33,13 @@ const BaseConfig = (props, ref) => { ...@@ -33,9 +33,13 @@ const BaseConfig = (props, ref) => {
const [secondCity, setSecondCity] = useState(cityData[provinceData[0]][0]); const [secondCity, setSecondCity] = useState(cityData[provinceData[0]][0]);
const [startLen, setstartLen] = useState(1); // 开始日期 const [startLen, setstartLen] = useState(1); // 开始日期
const [Unit, setValue] = useState(); const [Unit, setValue] = useState();
const [visibleChecked, setVisibleChecked] = useState(false);
useEffect(() => { useEffect(() => {
if (props.keepTimeData) { if (props.keepTimeData) {
if (props.keepTimeData?.time) {
setVisibleChecked(true);
}
let aa = props.keepTimeData; let aa = props.keepTimeData;
let type = props.keepTimeData.type; let type = props.keepTimeData.type;
let num = props.keepTimeData.cycle; let num = props.keepTimeData.cycle;
...@@ -173,7 +177,7 @@ const BaseConfig = (props, ref) => { ...@@ -173,7 +177,7 @@ const BaseConfig = (props, ref) => {
if (value == 'week') { if (value == 'week') {
return ( return (
<div> <div>
<span></span> <span>工作周将</span>
<Select <Select
key="Select1" key="Select1"
value={startLen} value={startLen}
...@@ -749,6 +753,10 @@ const BaseConfig = (props, ref) => { ...@@ -749,6 +753,10 @@ const BaseConfig = (props, ref) => {
} }
}; };
const change = e => {
setVisibleChecked(e);
};
return ( return (
<div className={styles.baseForm}> <div className={styles.baseForm}>
{Unit && ( {Unit && (
...@@ -782,7 +790,20 @@ const BaseConfig = (props, ref) => { ...@@ -782,7 +790,20 @@ const BaseConfig = (props, ref) => {
{randerZqsz(Unit)} {randerZqsz(Unit)}
</Form.Item> </Form.Item>
</Col> </Col>
{Unit !== 'day' && ( {(Unit === 'week' || Unit === 'month') && (
<Col span={24}>
<Form.Item labelCol={{ span: 5 }} name="time" label="制定执行时间">
<Switch
checkedChildren="开启"
unCheckedChildren="关闭"
checked={visibleChecked}
onChange={change}
/>
</Form.Item>
</Col>
)}
{visibleChecked && Unit !== 'day' && (
<Col span={24}> <Col span={24}>
<Form.Item labelCol={{ span: 5 }} name="zxsj" label="执行时间"> <Form.Item labelCol={{ span: 5 }} name="zxsj" label="执行时间">
<div id="aaa">{randerZxsj(secondCity, Unit)}</div> <div id="aaa">{randerZxsj(secondCity, Unit)}</div>
......
...@@ -5,8 +5,11 @@ import React, { useState, createContext, useEffect, useMemo, useReducer } from ' ...@@ -5,8 +5,11 @@ import React, { useState, createContext, useEffect, useMemo, useReducer } from '
import { Space, Table, Popconfirm, Tooltip, Button, notification, Tag, message } from 'antd'; import { Space, Table, Popconfirm, Tooltip, Button, notification, Tag, message } from 'antd';
import { import {
CM_XWBPlan_DataList, CM_XWBPlan_DataList,
NewCM_XWBPlan_DataList,
CM_XWBPlan_RemovePlan, CM_XWBPlan_RemovePlan,
NewCM_XWBPlan_RemovePlan,
CM_XWBPlan_ChangeOrder, CM_XWBPlan_ChangeOrder,
NewCM_XWBPlan_ChangeOrder,
GetDeviceConfigList, GetDeviceConfigList,
EditDeviceConfig, EditDeviceConfig,
} from '@/services/maintenance/api'; } from '@/services/maintenance/api';
...@@ -47,8 +50,10 @@ const maintenance = () => { ...@@ -47,8 +50,10 @@ const maintenance = () => {
useEffect(() => { useEffect(() => {
setTreeLoading(true); setTreeLoading(true);
if (activeName === 'template' || activeName === 'project') { if (activeName === 'template') {
getDataList(); getDataList();
} else if (activeName === 'project') {
getNewDataList();
} else { } else {
getConfigList(); getConfigList();
} }
...@@ -68,6 +73,20 @@ const maintenance = () => { ...@@ -68,6 +73,20 @@ const maintenance = () => {
}); });
}; };
const getNewDataList = () => {
NewCM_XWBPlan_DataList().then(res => {
setTreeLoading(false);
if (res.msg === 'Ok') {
setTableData(res.data);
let list = [];
res.data.map(i => {
list.push(i.businessName);
});
setKeepTableData(list);
}
});
};
const getConfigList = () => { const getConfigList = () => {
GetDeviceConfigList().then(res => { GetDeviceConfigList().then(res => {
setTreeLoading(false); setTreeLoading(false);
...@@ -535,7 +554,7 @@ const maintenance = () => { ...@@ -535,7 +554,7 @@ const maintenance = () => {
okText="确认" okText="确认"
cancelText="取消" cancelText="取消"
onConfirm={() => { onConfirm={() => {
deleteEventType(record); deleteEventTypeNew(record);
}} }}
> >
<DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} /> <DeleteOutlined style={{ fontSize: '16px', color: '#e86060' }} />
...@@ -737,6 +756,25 @@ const maintenance = () => { ...@@ -737,6 +756,25 @@ const maintenance = () => {
} }
}); });
}; };
const deleteEventTypeNew = record => {
NewCM_XWBPlan_RemovePlan({ planId: record.id }).then(res => {
if (res.code === 0) {
notification.success({
message: '提示',
duration: 3,
description: '删除成功',
});
getNewDataList();
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
});
};
const onSubmit = () => { const onSubmit = () => {
if (activeName === 'template') { if (activeName === 'template') {
setAddVisible(false); setAddVisible(false);
...@@ -782,10 +820,10 @@ const maintenance = () => { ...@@ -782,10 +820,10 @@ const maintenance = () => {
}); });
let aa = arr.toString(); let aa = arr.toString();
setTreeLoading(true); setTreeLoading(true);
CM_XWBPlan_ChangeOrder(aa).then(res => { NewCM_XWBPlan_ChangeOrder(aa).then(res => {
setTreeLoading(false); setTreeLoading(false);
if (res.code === 0) { if (res.code === 0) {
setTableData(value.data); setFlag(flag + 1);
} else { } else {
message.error(res.msg); message.error(res.msg);
} }
...@@ -801,7 +839,9 @@ const maintenance = () => { ...@@ -801,7 +839,9 @@ const maintenance = () => {
<div className={styles.tabs}> <div className={styles.tabs}>
<div <div
className={activeName === 'template' ? styles.active : ''} className={activeName === 'template' ? styles.active : ''}
onClick={() => setActiveName('template')} onClick={() => {
setActiveName('template');
}}
> >
维保模板 维保模板
</div> </div>
...@@ -813,7 +853,9 @@ const maintenance = () => { ...@@ -813,7 +853,9 @@ const maintenance = () => {
</div> </div>
<div <div
className={activeName === 'project' ? styles.active : ''} className={activeName === 'project' ? styles.active : ''}
onClick={() => setActiveName('project')} onClick={() => {
setActiveName('project');
}}
> >
方案制定 方案制定
</div> </div>
......
...@@ -12,22 +12,42 @@ import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index'; ...@@ -12,22 +12,42 @@ import { CITY_SERVICE, get, PUBLISH_SERVICE, post, postForm } from '../index';
export const GetDeviceConfigList = query => export const GetDeviceConfigList = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetDeviceConfigList`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetDeviceConfigList`, query);
// 巡维保计划数据获取
export const NewGetDeviceConfigList = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/NewGetDeviceConfigList`, query);
// 巡维保计划数据修改 // 巡维保计划数据修改
export const EditDeviceConfig = data => export const EditDeviceConfig = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/EditDeviceConfig`, data); post(`${PUBLISH_SERVICE}/WorkOrderCenter/EditDeviceConfig`, data);
// 巡维保计划数据修改
export const NewEditDeviceConfig = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/NewEditDeviceConfig`, data);
// 巡维保设备库列表数据获取 // 巡维保设备库列表数据获取
export const CM_XWBPlan_DataList = query => export const CM_XWBPlan_DataList = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DataList`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DataList`, query);
// 巡维保设备库列表数据获取
export const NewCM_XWBPlan_DataList = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_DataList`, query);
// 巡维保计划关联设备台账 // 巡维保计划关联设备台账
export const CM_XWBPlan_AccountTable = query => export const CM_XWBPlan_AccountTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_AccountTable`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_AccountTable`, query);
// 巡维保计划关联设备台账
export const NewCM_XWBPlan_AccountTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_AccountTable`, query);
// 巡维保计划关联设备台账表、普通台账 // 巡维保计划关联设备台账表、普通台账
export const CM_XWBPlan_DeviceAccountTable = query => export const CM_XWBPlan_DeviceAccountTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DeviceAccountTable`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DeviceAccountTable`, query);
// 巡维保计划关联设备台账表、普通台账
export const NewCM_XWBPlan_DeviceAccountTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_DeviceAccountTable`, query);
// 新巡维保获取维保设备 // 新巡维保获取维保设备
export const QueryDevicesList = query => export const QueryDevicesList = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/QueryDevicesList`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/QueryDevicesList`, query);
...@@ -36,18 +56,34 @@ export const QueryDevicesList = query => ...@@ -36,18 +56,34 @@ export const QueryDevicesList = query =>
export const CM_XWBPlan_feedbackTable = query => export const CM_XWBPlan_feedbackTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_feedbackTable`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_feedbackTable`, query);
// 计划关联反馈台账表
export const NewCM_XWBPlan_feedbackTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_feedbackTable`, query);
// 巡维保计划数据删除 // 巡维保计划数据删除
export const CM_XWBPlan_RemovePlan = query => export const CM_XWBPlan_RemovePlan = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_RemovePlan`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_RemovePlan`, query);
// 巡维保计划数据删除
export const NewCM_XWBPlan_RemovePlan = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_RemovePlan`, query);
// 巡维保计划数据编辑OR添加 // 巡维保计划数据编辑OR添加
export const CM_XWBPlan_DataEditORAdd = data => export const CM_XWBPlan_DataEditORAdd = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DataEditORAdd`, data); post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DataEditORAdd`, data);
// 巡维保计划数据编辑OR添加
export const NewCM_XWBPlan_DataEditORAdd = data =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_DataEditORAdd`, data);
// 巡维保计划数据编辑OR添加 // 巡维保计划数据编辑OR添加
export const CM_XWBPlan_ChangeOrder = planIds => export const CM_XWBPlan_ChangeOrder = planIds =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_ChangeOrder?planIds=${planIds}`); post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_ChangeOrder?planIds=${planIds}`);
// 巡维保计划数据编辑OR添加
export const NewCM_XWBPlan_ChangeOrder = planIds =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/NewCM_XWBPlan_ChangeOrder?planIds=${planIds}`);
// 获取父级维保模板 // 获取父级维保模板
export const GetParentDeviceTemplate = query => export const GetParentDeviceTemplate = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetParentDeviceTemplate`, query); get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetParentDeviceTemplate`, query);
...@@ -57,3 +93,6 @@ export const GetFeedbackTableFields = query => ...@@ -57,3 +93,6 @@ export const GetFeedbackTableFields = query =>
export const GetAccountConfigInfo = query => export const GetAccountConfigInfo = query =>
get(`/PandaWorkFlow/WorkFlow/AccountManage/GetAccountConfigInfo`, query); get(`/PandaWorkFlow/WorkFlow/AccountManage/GetAccountConfigInfo`, query);
export const newGetAccountConfigInfo = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetAccountConfigInfo`, query);
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