| | |
| | | clearable |
| | | filterable |
| | | > |
| | | <el-option |
| | | v-for="o in getOptions(field)" |
| | | :key="String(o.value)" |
| | | :label="o.label" |
| | | :value="o.value" |
| | | /> |
| | | <el-option |
| | | v-for="o in getOptions(field, { moduleKey: props.moduleKey })" |
| | | :key="String(o.value)" |
| | | :label="o.label" |
| | | :value="o.value" |
| | | /> |
| | | </el-select> |
| | | <span v-else class="field-value">{{ displayValue(field) }}</span> |
| | | </el-form-item> |
| | |
| | | fields: { type: Array, default: () => [] }, |
| | | formPayload: { type: Object, default: () => ({}) }, |
| | | readonly: { type: Boolean, default: false }, |
| | | moduleKey: { type: String, default: "" }, |
| | | }); |
| | | |
| | | const { loading: optionSourceLoading, ensureForFields, getOptions, getDisplayLabel } = |
| | | useSelectOptionSources(); |
| | | |
| | | async function loadOptionCaches() { |
| | | await ensureForFields(props.fields); |
| | | await ensureForFields(props.fields, { moduleKey: props.moduleKey }); |
| | | } |
| | | |
| | | onMounted(() => { |
| | |
| | | function displayValue(field) { |
| | | const val = props.formPayload?.[field.key]; |
| | | if (field.type === "select" && field.optionSource && field.optionSource !== "static") { |
| | | return getDisplayLabel(field, val); |
| | | return getDisplayLabel(field, val, { moduleKey: props.moduleKey }); |
| | | } |
| | | return formatFieldDisplayValue(field, val); |
| | | } |