Commit d4dd8495 authored by 皮倩雯's avatar 皮倩雯

fix: '修复维保模板父业务模板接口报错问题'

parent 82ffe887
Pipeline #76793 passed with stages
......@@ -145,7 +145,6 @@ const AddModal = props => {
getEventData();
if (visible) {
getRole();
getParentList();
if (type === 'add') {
setChee('否');
form.setFieldsValue({ isSubmit: '否', docycle: '一周一次', feedbackRule: '' });
......@@ -154,6 +153,7 @@ const AddModal = props => {
setType2('');
setFiled1({});
} else if (type === 'edit') {
getParentList();
onChangeFeed(
formObj.feedbackName,
'',
......@@ -203,8 +203,9 @@ const AddModal = props => {
useEffect(() => {}, [keepData]);
const getParentList = () => {
GetParentDeviceTemplate({ id: formObj.id }).then(res => {
const getParentList = e => {
let value = e ? e : formObj.accountName;
GetParentDeviceTemplate({ accountName: value }).then(res => {
if (res.code === 0) {
setParentList(res.data);
}
......@@ -823,14 +824,6 @@ const AddModal = props => {
required: true,
message: '请选择维保设备',
},
{
validator: (rule, value) => {
if (form.getFieldsValue().accountName === '') {
return Promise.reject('维保设备必选');
}
return Promise.resolve();
},
},
]}
>
{/* <Select placeholder="选择此计划关联的设备台账名称" showSearch>
......@@ -849,24 +842,44 @@ const AddModal = props => {
allowClear
treeDefaultExpandAll
showCheckedStrategy
onChange={e => {
getParentList(e);
}}
>
{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>
{form.getFieldsValue().accountName ? (
<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>
) : (
<Col span={24}>
<Item label="父业务模板" name="parentId" labelCol={{ span: 5 }}>
<Select placeholder="请先选择维保设备" disabled>
{parentList
? parentList.map((item, index) => (
<Option key={index.ID} value={item.ID}>
{item.TemplateName}
</Option>
))
: ''}
</Select>
</Item>
</Col>
)}
<Col span={24}>
<Item
label="反馈名称"
......
......@@ -450,7 +450,7 @@ const AddModal = props => {
notification.warning({
message: '提示',
duration: 3,
description: '请先选择反馈名称',
description: '请先选择反馈',
});
}
};
......@@ -959,7 +959,7 @@ const AddModal = props => {
onFocus={() => {
let obj = form.getFieldsValue().tableName;
if (!obj) {
message.warning('请先选择反馈名称!');
message.warning('请先选择反馈!');
}
}}
>
......
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