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

fix: '方案制定优化'

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