Commit 547ecf959bd771356ce7155f098a919b8da55c82
1 parent
e491f16a
perf: product model of matter unit select show unit in label
Showing
1 changed file
with
6 additions
and
10 deletions
1 | -import { h } from 'vue'; | |
2 | 1 | import { ModelOfMatterParams } from '/@/api/device/model/modelOfMatterModel'; |
3 | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
4 | 3 | import { FormSchema } from '/@/components/Table'; |
... | ... | @@ -141,10 +140,15 @@ export const formSchemas: FormSchema[] = [ |
141 | 140 | const { setFieldsValue } = formActionType; |
142 | 141 | return { |
143 | 142 | placeholder: '请选择单位', |
144 | - api: findDictItemByCode, | |
143 | + api: async (params) => { | |
144 | + const list = await findDictItemByCode(params); | |
145 | + list.map((item) => (item.itemText = `${item.itemText} / ${item.itemValue}`)); | |
146 | + return list; | |
147 | + }, | |
145 | 148 | params: { |
146 | 149 | dictCode: 'attribute_unit', |
147 | 150 | }, |
151 | + labelInValue: true, | |
148 | 152 | labelField: 'itemText', |
149 | 153 | valueField: 'itemValue', |
150 | 154 | onChange(_, record: Record<'label' | 'value', string>) { |
... | ... | @@ -165,14 +169,6 @@ export const formSchemas: FormSchema[] = [ |
165 | 169 | ifShow: ({ values }) => |
166 | 170 | values[FormField.TYPE] === DateTypeEnum.IS_NUMBER_INT || |
167 | 171 | values[FormField.TYPE] === DateTypeEnum.IS_NUMBER_DOUBLE, |
168 | - renderComponentContent: () => { | |
169 | - return { | |
170 | - option: (params: Record<'label' | 'value', string>) => { | |
171 | - const { label, value } = params; | |
172 | - return h('span', `${label} / ${value}`); | |
173 | - }, | |
174 | - }; | |
175 | - }, | |
176 | 172 | }, |
177 | 173 | { |
178 | 174 | field: FormField.BOOL_CLOSE, | ... | ... |