| | |
| | | clearable |
| | | placeholder="请输入重量" |
| | | /> |
| | | <wd-input |
| | | <wd-picker |
| | | v-model="model.supplier" |
| | | :columns="supplierOptions" |
| | | label="厂家" |
| | | label-width="100px" |
| | | prop="supplier" |
| | | placeholder="请选择厂家" |
| | | clearable |
| | | placeholder="请输入厂家" |
| | | @confirm="handleSupplierChange" |
| | | /> |
| | | </wd-cell-group> |
| | | </wd-form> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { onMounted, watch } from "vue"; |
| | | import useFormData from "@/hooks/useFormData"; |
| | | import TwistApi from "@/api/product/twist"; |
| | | import ManageApi from "@/api/product/manage"; |
| | |
| | | const diskMaterialOptions = ref<Array<{ label: string; value: string }>>([]); |
| | | const diskMaterialValue = ref(""); |
| | | |
| | | // 厂家字典数据 |
| | | const supplierOptions = ref<Array<{ label: string; value: string }>>([]); |
| | | |
| | | // 加载芯线类型字典数据 |
| | | const loadDiskMaterialDict = async () => { |
| | | try { |
| | |
| | | } |
| | | }; |
| | | |
| | | // 加载厂家字典数据 |
| | | const loadSupplierDict = async () => { |
| | | try { |
| | | const res = await ManageApi.dictAPI("factory"); |
| | | if (res.data && Array.isArray(res.data)) { |
| | | supplierOptions.value = res.data.map((item: any) => ({ |
| | | label: item.dictLabel || "", |
| | | value: item.dictValue || "", |
| | | })); |
| | | } |
| | | } catch (error) { |
| | | // 加载字典失败,静默处理 |
| | | } |
| | | }; |
| | | |
| | | // 处理芯线类型选择 |
| | | const handleDiskMaterialChange = (val: any) => { |
| | | model.diskMaterial = val.value; |
| | | }; |
| | | |
| | | // 处理厂家选择 |
| | | const handleSupplierChange = (val: any) => { |
| | | model.supplier = val.value; |
| | | }; |
| | | |
| | | // 监听 model.diskMaterial 变化,同步选择器显示 |
| | |
| | | |
| | | onMounted(async () => { |
| | | await loadDiskMaterialDict(); |
| | | await loadSupplierDict(); |
| | | }); |
| | | |
| | | defineExpose({ |