| | |
| | | <el-form :model="directQuery" |
| | | class="mb-2"> |
| | | <el-form-item label="产品大类"> |
| | | <!-- <el-select v-model="directQuery.productCategory" |
| | | placeholder="请选择产品大类" |
| | | clearable |
| | | filterable |
| | | @change="handleProductCategoryChange"> |
| | | <el-option v-for="item in productList" |
| | | :key="item.id" |
| | | :label="item.productName" |
| | | :value="item.productName" /> |
| | | </el-select> --> |
| | | <el-tree-select v-model="directQuery.productId" |
| | | placeholder="请选择产品大类" |
| | | clearable |
| | | check-strictly |
| | | @change="handleProductCategoryChange" |
| | | :data="productList" |
| | | :disabled="typeValue === 'edit'" |
| | | :render-after-expand="false" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | |
| | | placeholder="请先选择产品大类" |
| | | clearable |
| | | filterable |
| | | :disabled="!directQuery.productId"> |
| | | :disabled="!directQuery.productId || typeValue === 'edit'"> |
| | | <el-option v-for="item in productModelList" |
| | | :key="item.id" |
| | | :label="item.model" |
| | |
| | | openDirectForm(type, row); |
| | | } |
| | | }; |
| | | |
| | | const typeValue = ref("add"); |
| | | // 打开直接新增入库弹框 |
| | | const openDirectForm = (type, row) => { |
| | | const openDirectForm = async (type, row) => { |
| | | typeValue.value = type; |
| | | directDialogVisible.value = true; |
| | | directSelectedRows.value = []; |
| | | directQuery.value = { |
| | |
| | | entryDate: getCurrentDate(), |
| | | remark: "", |
| | | }; |
| | | |
| | | // 确保产品大类数据已加载 |
| | | // if (productList.value.length === 0) { |
| | | // await loadProductList(); |
| | | // } |
| | | if (type === "edit" && row) { |
| | | // 编辑模式,回显数据 |
| | | console.log(row, "=============="); |
| | | directForm.value = { ...row }; |
| | | // 回显其他字段 |
| | | directQuery.value.inboundQuantity = row.inboundNum || row.inboundQuantity; |
| | |
| | | directQuery.value.productCategory = productCategory; |
| | | } |
| | | // 根据产品大类加载规格型号列表并回显 |
| | | loadProductModelList(row.productId).then(() => { |
| | | await loadProductModelList(row.productId); |
| | | directQuery.value.productModelId = row.productModelId; |
| | | }); |
| | | } else { |
| | | // 如果没有productId字段,尝试根据productCategory查找 |
| | | // 这里需要根据实际情况调整查找逻辑 |
| | | directQuery.value.productCategory = row.productCategory || ""; |
| | | directQuery.value.productId = row.productCategory || ""; |
| | | directQuery.value.productModelId = row.specificationModel; |
| | | } |
| | | } |
| | | } |