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

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

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