| | |
| | | </el-button> |
| | | <ImportExcel :product-id="currentId" |
| | | @uploadSuccess="getModelList" /> |
| | | <el-input v-model="specification" |
| | | <el-input v-model="model" |
| | | placeholder="规格型号" |
| | | style="width: 150px" |
| | | clearable |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="产品名称:" |
| | | prop="materialName"> |
| | | <el-input v-model="form.materialName" |
| | | prop="productName"> |
| | | <el-input v-model="form.productName" |
| | | placeholder="请输入产品名称" |
| | | maxlength="20" |
| | | show-word-limit |
| | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="基本单位:" |
| | | prop="baseUnit"> |
| | | <el-input v-model="form.baseUnit" |
| | | prop="unit"> |
| | | <el-input v-model="form.unit" |
| | | placeholder="请输入基本单位" |
| | | clearable |
| | | @keydown.enter.prevent /> |
| | |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <el-form-item label="规格型号:" |
| | | prop="specification"> |
| | | <el-input v-model="modelForm.specification" |
| | | prop="model"> |
| | | <el-input v-model="modelForm.model" |
| | | placeholder="请输入规格型号" |
| | | clearable |
| | | @keydown.enter.prevent /> |
| | |
| | | const expandedKeys = ref([]); |
| | | const inventoryCategoryList = ref([]); |
| | | const materialTypeList = ref([]); |
| | | const specification = ref(""); |
| | | const model = ref(""); |
| | | const materialCode = ref(""); |
| | | |
| | | const getloadData = () => { |
| | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "规格型号", |
| | | prop: "materialName", |
| | | prop: "productName", |
| | | }, |
| | | { |
| | | label: "规格", |
| | | prop: "specification", |
| | | prop: "model", |
| | | }, |
| | | { |
| | | label: "物料编码", |
| | |
| | | }, |
| | | { |
| | | label: "单位", |
| | | prop: "baseUnit", |
| | | prop: "unit", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | |
| | | form: { |
| | | materialTypeId: null, |
| | | inventoryCategoryId: null, |
| | | materialName: "", |
| | | baseUnit: "", |
| | | productName: "", |
| | | unit: "", |
| | | remark: "", |
| | | }, |
| | | rules: { |
| | | materialName: [ |
| | | productName: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | { max: 20, message: "产品名称不能超过20个字符", trigger: "blur" }, |
| | | ], |
| | | inventoryCategoryId: [ |
| | | { required: true, message: "请选择", trigger: "change" }, |
| | | ], |
| | | baseUnit: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | unit: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | }, |
| | | modelForm: { |
| | | specification: "", |
| | | model: "", |
| | | supplyType: "", |
| | | materialCode: "", |
| | | id: null, |
| | | }, |
| | | modelRules: { |
| | | specification: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | model: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | supplyType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | materialCode: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | }, |
| | |
| | | |
| | | treeLoad.value = true; |
| | | // 调用 productTreeListQuery 接口进行搜索 |
| | | productTreeListQuery({ materialName: search.value }) |
| | | productTreeListQuery({ productName: search.value }) |
| | | .then(res => { |
| | | // 处理返回的数据 |
| | | const newList = []; |
| | |
| | | item.children = (category.materialList || []).map(item => ({ |
| | | id: item.id, |
| | | isLeaf: true, |
| | | label: item.materialName, |
| | | label: item.productName, |
| | | inventoryCategoryId: item.inventoryCategoryId, |
| | | materialTypeId: item.materialTypeId, |
| | | remark: item.remark, |
| | | baseUnit: item.baseUnit, |
| | | unit: item.unit, |
| | | })); |
| | | break; |
| | | } |
| | |
| | | // children: (category.materialList || []).map(item => ({ |
| | | // id: item.id, |
| | | // isLeaf: true, |
| | | // label: item.materialName, |
| | | // label: item.productName, |
| | | // inventoryCategoryId: item.inventoryCategoryId, |
| | | // materialTypeId: item.materialTypeId, |
| | | // remark: item.remark, |
| | | // baseUnit: item.baseUnit, |
| | | // unit: item.unit, |
| | | // })), |
| | | // }; |
| | | // newList.push(categoryNode); |
| | |
| | | productDia.value = true; |
| | | // 重置表单 |
| | | form.value = { |
| | | materialName: "", |
| | | productName: "", |
| | | inventoryCategoryId: null, |
| | | baseUnit: "", |
| | | unit: "", |
| | | remark: "", |
| | | materialTypeId: null, |
| | | }; |
| | | console.log(data); |
| | | if (type === "edit" && data) { |
| | | // 编辑模式,回填数据 |
| | | form.value.materialName = data.label || ""; |
| | | form.value.productName = data.label || ""; |
| | | form.value.inventoryCategoryId = data.inventoryCategoryId || null; |
| | | form.value.baseUnit = data.baseUnit || ""; |
| | | form.value.unit = data.unit || ""; |
| | | form.value.remark = data.remark || ""; |
| | | form.value.materialTypeId = data.materialTypeId || null; |
| | | form.value.id = data.id || null; |
| | |
| | | modelOperationType.value = type; |
| | | modelDia.value = true; |
| | | // 重置所有字段 |
| | | modelForm.value.specification = ""; |
| | | modelForm.value.model = ""; |
| | | modelForm.value.supplyType = ""; |
| | | modelForm.value.id = null; |
| | | modelForm.value.materialCode = null; |
| | | |
| | | if (type === "edit" && data) { |
| | | // 编辑模式,回填数据 |
| | | modelForm.value.specification = data.specification || ""; |
| | | modelForm.value.model = data.model || ""; |
| | | modelForm.value.supplyType = data.supplyType || ""; |
| | | modelForm.value.id = data.skuId || null; |
| | | modelForm.value.id = data.id || null; |
| | | modelForm.value.materialCode = data.materialCode || null; |
| | | } |
| | | }; |
| | |
| | | // const params = { |
| | | // materialTypeId: null, |
| | | // inventoryCategoryId: form.value.inventoryCategoryId, |
| | | // materialName: form.value.materialName, |
| | | // baseUnit: form.value.baseUnit, |
| | | // productName: form.value.productName, |
| | | // unit: form.value.unit, |
| | | // remark: form.value.remark, |
| | | // }; |
| | | |
| | |
| | | const children = materialList.map(item => ({ |
| | | id: item.id, |
| | | isLeaf: true, |
| | | label: item.materialName, |
| | | label: item.productName, |
| | | inventoryCategoryId: item.inventoryCategoryId, |
| | | materialTypeId: item.materialTypeId, |
| | | remark: item.remark, |
| | | baseUnit: item.baseUnit, |
| | | unit: item.unit, |
| | | })); |
| | | // 更新节点的子节点 |
| | | val.children = children; |
| | |
| | | if (valid) { |
| | | // 构建提交参数 |
| | | const params = { |
| | | materialId: currentId.value, |
| | | specification: modelForm.value.specification, |
| | | productId: currentId.value, |
| | | model: modelForm.value.model, |
| | | materialCode: modelForm.value.materialCode, |
| | | supplyType: modelForm.value.supplyType, |
| | | }; |
| | |
| | | } |
| | | tableLoading.value = true; |
| | | modelListPage({ |
| | | materialId: currentId.value, |
| | | productId: currentId.value, |
| | | current: page.current, |
| | | size: page.size, |
| | | specification: specification.value, |
| | | model: model.value, |
| | | materialCode: materialCode.value, |
| | | }).then(res => { |
| | | console.log("res", res); |
| | |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | ids = selectedRows.value.map(item => item.skuId); |
| | | ids = selectedRows.value.map(item => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("请选择数据"); |
| | | return; |