| | |
| | | placeholder="请选择单位" |
| | | style="width: 100%" |
| | | clearable |
| | | :disabled="!canEditUnit" |
| | | > |
| | | <el-option label="吨" value="吨" /> |
| | | <el-option label="公斤" value="公斤" /> |
| | | <el-option |
| | | v-for="item in editableUnitOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item |
| | |
| | | }); |
| | | |
| | | const showProductSelectDialog = ref(false); |
| | | const unitEditableValues = ['吨', '公斤']; |
| | | |
| | | const canEditUnit = computed(() => unitEditableValues.includes(formState.value?.unit)); |
| | | |
| | | const editableUnitOptions = computed(() => { |
| | | const options = [ |
| | | {label: '吨', value: '吨'}, |
| | | {label: '公斤', value: '公斤'}, |
| | | ]; |
| | | const currentUnit = formState.value?.unit; |
| | | if (currentUnit && !unitEditableValues.includes(currentUnit)) { |
| | | return [{label: currentUnit, value: currentUnit}]; |
| | | } |
| | | return options; |
| | | }); |
| | | |
| | | let { proxy } = getCurrentInstance() |
| | | |