Commit 5d1d94c9 authored by 皮倩雯's avatar 皮倩雯

fix: '维保配置优化'

parent 880e5347
Pipeline #74613 passed with stages
......@@ -33,6 +33,8 @@ import {
CM_XWBPlan_feedbackTable,
CM_XWBPlan_DataEditORAdd,
CM_XWBPlan_DataList,
CM_XWBPlan_DeviceAccountTable,
GetParentDeviceTemplate,
} from '@/services/maintenance/api';
import { GetTaskSyncField } from '@/services/PatrolFeedback/api';
......@@ -75,6 +77,7 @@ const AddModal = props => {
const [eventData, setEventData] = useState([]);
const [autoFlag, setAutoFlag] = useState(false); // 禁用自动派发
const [keepData, setKeepData] = useState('');
const [parentList, setParentList] = useState([]);
const [keep, setKeep] = useState([
'任务编码',
'设备编码',
......@@ -143,6 +146,7 @@ const AddModal = props => {
getEventData();
if (visible) {
getRole();
getParentList();
if (type === 'add') {
setChee('否');
form.setFieldsValue({ isSubmit: '否', docycle: '一周一次' });
......@@ -162,6 +166,11 @@ const AddModal = props => {
setVisibleChecked1(data.autoAssign == '是');
console.log(data);
data && form.setFieldsValue({ ...data });
if (data.parentBusinessName) {
form.setFieldsValue({ parentId: data.parentId });
} else {
form.setFieldsValue({ parentId: '' });
}
let mappingFields = JSON.parse(data.mappingFields);
getGetTaskSyncField(mappingFields); // 获取字段名数据
......@@ -189,6 +198,14 @@ const AddModal = props => {
getFeedbackTable();
}, []);
const getParentList = () => {
GetParentDeviceTemplate({ id: formObj.id }).then(res => {
if (res.code === 0) {
setParentList(res.data);
}
});
};
// 获取关联事件数据
const getEventData = () => {
GetCM_Event_LoadEventTable().then(res => {
......@@ -208,13 +225,9 @@ const AddModal = props => {
};
const getList = () => {
CM_XWBPlan_AccountTable().then(res => {
if (res.msg == 'Ok') {
let arr = [];
res.data.map((item, index) => {
arr.push(item.accountName);
});
setTreeData(arr);
CM_XWBPlan_DeviceAccountTable().then(res => {
if (res.code === 0) {
setTreeData(res.data);
}
});
};
......@@ -484,6 +497,17 @@ const AddModal = props => {
return <TreeNode value={org} title={org} key={org} />;
};
const mapTree = org => {
if (org.Value) {
return (
<TreeNode value={org.Key} title={org.Key} disabled>
{org.Value.map(item => mapTree(item))}
</TreeNode>
);
}
return <TreeNode value={org} title={org} key={org} />;
};
// 获取字段名数据
const getGetTaskSyncField = e => {
// 编辑时处理数据为下拉框过滤调已选数据
......@@ -535,14 +559,11 @@ const AddModal = props => {
let lastFrom = [];
let lastTo = [];
console.log(from);
console.log(keep);
keep.map(j => {
if (from.indexOf(j) == -1) {
lastFrom.push(j);
}
});
console.log(lastFrom);
setKeepData(lastFrom);
keepAll.map(j => {
......@@ -550,7 +571,6 @@ const AddModal = props => {
lastTo.push(j);
}
});
console.log(lastTo);
setKeepTree(lastTo);
}
......@@ -571,13 +591,11 @@ const AddModal = props => {
// 改变关联事件类型
const onChangeEvent = (e, i) => {
console.log(e, i, '666');
if (!i || !e) {
setKeepData(keep);
formAdd.resetFields();
}
let aa = keepAllData.find(i => i.name === e);
console.log(keepAllData, e, '666');
if (aa) {
getReloadTableField(aa.tableName, i); // 找到关联事件对应事件表获取对应表的所有字段
}
......@@ -588,8 +606,6 @@ const AddModal = props => {
tableName: e,
}).then(res => {
if (res.msg === 'Ok') {
console.log(res.data.root);
console.log(i);
setKeepAll(res.data.root);
// 编辑时过滤下l拉框初始数据
if (i) {
......@@ -606,7 +622,6 @@ const AddModal = props => {
lastTo.push(b);
}
});
console.log(lastTo);
setKeepTree(lastTo);
} else {
setKeepTree(res.data.root);
......@@ -632,7 +647,6 @@ const AddModal = props => {
aa.push({ name: item, key: index, ID: index, children: arr[item] });
bb.push(item);
});
console.log(aa, 'aaaaaaaaaaaaa');
// setKeepTree(aa);
// setKeepAll(aa);
// all.current = aa;
......@@ -749,6 +763,7 @@ const AddModal = props => {
<Select placeholder="选择业务类型" onSearch={inputType} showSearch>
<Option value="巡检">巡检</Option>
<Option value="保养">保养</Option>
<Option value="水厂">水厂</Option>
</Select>
</Item>
</Col>
......@@ -764,22 +779,6 @@ const AddModal = props => {
>
{characteristics1.map(i => mapTreeSelect(i))}
</TreeSelect>
{/* <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="1小时一次">1小时一次</Option>
<Option value="2小时一次">2小时一次</Option>
<Option value="3小时一次">3小时一次</Option>
<Option value="4小时一次">4小时一次</Option>
<Option value="6小时一次">6小时一次</Option>
<Option value="8小时一次">8小时一次</Option>
<Option value="12小时一次">12小时一次</Option>
</Select> */}
</Item>
</Col>
<Col span={24}>
......@@ -790,7 +789,7 @@ const AddModal = props => {
rules={[
{
required: true,
message: '请输入业务名称',
message: '请选择维保设备',
},
{
validator: (rule, value) => {
......@@ -802,7 +801,7 @@ const AddModal = props => {
},
]}
>
<Select placeholder="选择此计划关联的设备台账名称" showSearch>
{/* <Select placeholder="选择此计划关联的设备台账名称" showSearch>
{treeData
? treeData.map((item, index) => (
<Option key={index} value={item}>
......@@ -810,6 +809,29 @@ const AddModal = props => {
</Option>
))
: ''}
</Select> */}
<TreeSelect
showSearch
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择执行周期"
allowClear
treeDefaultExpandAll
showCheckedStrategy
>
{treeData.map(i => mapTree(i))}
</TreeSelect>
</Item>
</Col>
<Col span={24}>
<Item label="父业务模板" name="parentId" labelCol={{ span: 5 }}>
<Select placeholder="选择父业务模板" showSearch allowClear>
{parentList
? parentList.map((item, index) => (
<Option key={index.ID} value={item.ID}>
{item.TemplateName}
</Option>
))
: ''}
</Select>
</Item>
</Col>
......
......@@ -10,7 +10,13 @@ import {
GetDeviceConfigList,
EditDeviceConfig,
} from '@/services/maintenance/api';
import { EditTwoTone, DeleteOutlined, PlusOutlined, OrderedListOutlined } from '@ant-design/icons';
import {
EditTwoTone,
DeleteOutlined,
PlusOutlined,
OrderedListOutlined,
ApartmentOutlined,
} from '@ant-design/icons';
import styles from './maintenance.less';
import AddModal from './AddModal';
import OptionEditModal from './OptionEditModal';
......@@ -355,11 +361,17 @@ const maintenance = () => {
</Tooltip>
),
},
{
title: '父业务模板',
dataIndex: 'parentBusinessName',
key: 'parentBusinessName',
width: 100,
align: 'center',
},
{
title: '反馈名称',
dataIndex: 'feedbackName',
key: 'feedbackName',
onCell: () => ({
style: {
maxWidth: 200,
......
......@@ -17,6 +17,7 @@ import { SaveRoutes } from '@/services/hostmanager/hostmanager';
import { InfoCircleOutlined } from '@ant-design/icons';
const { Item } = Form;
const { TextArea } = Input;
const AddModal = props => {
const { callBackSubmit = () => {}, type, pickItem, visible, onCancel, keepData } = props;
const [loading, setLoading] = useState(false);
......@@ -40,6 +41,7 @@ const AddModal = props => {
IsAuthentication: pickItem.isAuthentication,
Key: pickItem.key,
Priority: pickItem.priority,
Remark: pickItem.remark,
UpstreamHost: pickItem.upstreamHost,
AddHeasersToRequest: pickItem.addHeasersToRequest,
UpstreamHeaderTransform: pickItem.upstreamHeaderTransform,
......@@ -103,6 +105,7 @@ const AddModal = props => {
Url: obj.Url || null,
IsAuthentication: obj.IsAuthentication,
Key: obj.Key || null,
Remark: obj.Remark || null,
Priority: obj.Priority || 0,
UpstreamHost: obj.UpstreamHost || null,
AddHeasersToRequest: obj.AddHeasersToRequest || null,
......@@ -239,7 +242,7 @@ const AddModal = props => {
},
]}
>
<Input allowClear placeholder="示例:/{url}" disabled={hidden}/>
<Input allowClear placeholder="示例:/{url}" disabled={hidden} />
</Item>
<Item
label="上游请求方式"
......@@ -275,10 +278,6 @@ const AddModal = props => {
label="关键字"
name="Key"
rules={[
{
required: true,
message: '请输入关键字',
},
{
validator: (rule, value) => {
let val = form.getFieldValue().Key;
......@@ -300,6 +299,18 @@ const AddModal = props => {
>
<Input allowClear disabled={hidden} />
</Item>
<Item
label="备注"
name="Remark"
rules={[
{
required: true,
message: '请填写备注',
},
]}
>
<TextArea placeholder="请填写备注" allowClear />
</Item>
<Row>
<Col span={8}>
<Item
......
......@@ -69,13 +69,6 @@ const GateConfig = () => {
console.log(checked);
if (checked) {
setAllLoading(true);
// axios({
// method: 'get',
// url: `${tableData[0].url}/PandaOMS/OMS/health/get`,
// }).then(res => {
// console.log(res);
// debugger;
// });
GetWayHealthCheck().then(resData => {
setAllLoading(false);
if (resData.code === 0) {
......
......@@ -24,6 +24,10 @@ export const CM_XWBPlan_DataList = query =>
export const CM_XWBPlan_AccountTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_AccountTable`, query);
// 巡维保计划关联设备台账表、普通台账
export const CM_XWBPlan_DeviceAccountTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_DeviceAccountTable`, query);
// 计划关联反馈台账表
export const CM_XWBPlan_feedbackTable = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_feedbackTable`, query);
......@@ -39,3 +43,7 @@ export const CM_XWBPlan_DataEditORAdd = data =>
// 巡维保计划数据编辑OR添加
export const CM_XWBPlan_ChangeOrder = planIds =>
post(`${PUBLISH_SERVICE}/WorkOrderCenter/CM_XWBPlan_ChangeOrder?planIds=${planIds}`);
// 获取父级维保模板
export const GetParentDeviceTemplate = query =>
get(`${PUBLISH_SERVICE}/WorkOrderCenter/GetParentDeviceTemplate`, 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