Commit 3d22d6a617e67bbb6aeb777c7b893d9c7de5adfd
1 parent
16c889d3
fix: DEFECT-1625 新增模版,邮件配置再禁用情况下,模板应该是无法选择该禁用的配置的
Showing
1 changed file
with
21 additions
and
9 deletions
... | ... | @@ -131,14 +131,18 @@ export const formSchema: FormSchema[] = [ |
131 | 131 | onChange: async (value) => { |
132 | 132 | const res = await findMessageConfig({}); |
133 | 133 | let typeId: Nullable<string> = null; |
134 | - const options = res.map((item) => { | |
135 | - if (item.messageType === value) typeId = item.id; | |
136 | - return { | |
137 | - disabled: item.messageType !== value, | |
138 | - label: item.configName, | |
139 | - value: item.id, | |
140 | - }; | |
141 | - }); | |
134 | + const options = res | |
135 | + .map((item) => { | |
136 | + if (item.messageType === value && item.status === 1) { | |
137 | + typeId = item.id; | |
138 | + } | |
139 | + return { | |
140 | + label: item.configName, | |
141 | + value: item.id, | |
142 | + status: item.status, | |
143 | + }; | |
144 | + }) | |
145 | + .filter((item) => item.status === 1); | |
142 | 146 | await formActionType.setFieldsValue({ messageConfigId: typeId }); |
143 | 147 | await formActionType.updateSchema({ |
144 | 148 | field: 'messageConfigId', |
... | ... | @@ -156,7 +160,15 @@ export const formSchema: FormSchema[] = [ |
156 | 160 | required: true, |
157 | 161 | component: 'ApiSelect', |
158 | 162 | componentProps: { |
159 | - api: findMessageConfig, | |
163 | + api: async (params: Recordable) => { | |
164 | + try { | |
165 | + const record = await findMessageConfig(params); | |
166 | + return record.filter((item) => item.status === 1); | |
167 | + } catch (error) { | |
168 | + console.log(error); | |
169 | + return []; | |
170 | + } | |
171 | + }, | |
160 | 172 | params: { |
161 | 173 | messageType: ({ values }) => Reflect.get(values, 'messageType'), |
162 | 174 | }, | ... | ... |