| | |
| | | <el-input v-model="formState.unit" |
| | | disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="厂家" |
| | | prop="manufacturerId"> |
| | | <el-select v-model="formState.manufacturerId" |
| | | placeholder="请选择厂家" |
| | | clearable |
| | | filterable |
| | | style="width: 100%"> |
| | | <el-option v-for="item in manufacturerOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="库存类型" |
| | | prop="type" |
| | | :rules="[ |
| | |
| | | } |
| | | ]"> |
| | | <el-select v-model="formState.type" |
| | | placeholder="请选择库存类型"> |
| | | <el-option label="合格库存" |
| | | placeholder="请选择库存类型" |
| | | @change="handleTypeChange"> |
| | | <el-option label="合格库" |
| | | value="qualified" /> |
| | | <el-option label="不合格库存" |
| | | <el-option label="废品库" |
| | | value="waste" /> |
| | | <el-option label="不合格库" |
| | | value="unqualified" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item v-if="formState.type && formState.type !== 'unqualified'" |
| | | label="来源" |
| | | prop="source" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: '请选择来源', |
| | | trigger: 'change', |
| | | } |
| | | ]"> |
| | | <el-select v-model="formState.source" |
| | | placeholder="请选择来源"> |
| | | <el-option v-for="item in sourceOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="库存数量" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ref, computed, watch, getCurrentInstance } from "vue"; |
| | | import { ref, computed, watch, getCurrentInstance, onMounted } from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import { addStockInRecordOnly } from "@/api/inventoryManagement/stockInventory.js"; |
| | | import { createStockUnInventory } from "@/api/inventoryManagement/stockUninventory.js"; |
| | | import { getManufacturerOptions } from "@/api/inspectionManagement/manufacturerManageFile.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | |
| | | productModelName: "", |
| | | unit: "", |
| | | type: undefined, |
| | | manufacturerId: "", |
| | | source: "", |
| | | qualitity: 0, |
| | | batchNo: null, |
| | | warnNum: 0, |
| | | remark: "", |
| | | }); |
| | | |
| | | const sourceOptions = computed(() => { |
| | | if (formState.value.type === "qualified") { |
| | | return [ |
| | | { value: "purchaseReceipt", label: "采购入库" }, |
| | | { value: "productionReceipt", label: "生产入库" }, |
| | | { value: "outsourcedReceipt", label: "外协入库" }, |
| | | { value: "repairReceipt", label: "修复入库" }, |
| | | ]; |
| | | } else if (formState.value.type === "waste") { |
| | | return [ |
| | | { value: "prodGenerated", label: "生产产生" }, |
| | | { value: "transGenerated", label: "运输产生" }, |
| | | { value: "cuttingGenerated", label: "裁剪产生" }, |
| | | ]; |
| | | } |
| | | return []; |
| | | }); |
| | | |
| | | const handleTypeChange = val => { |
| | | formState.value.source = ""; |
| | | }; |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | |
| | | }); |
| | | |
| | | const showProductSelectDialog = ref(false); |
| | | const manufacturerOptions = ref([]); |
| | | |
| | | const loadManufacturerOptions = () => { |
| | | getManufacturerOptions().then(res => { |
| | | manufacturerOptions.value = res.data || []; |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | loadManufacturerOptions(); |
| | | }); |
| | | |
| | | // 批号为空时转为 null |
| | | watch( |
| | |
| | | productModelName: "", |
| | | unit: "", |
| | | type: undefined, |
| | | manufacturerId: "", |
| | | source: "", |
| | | qualitity: 0, |
| | | batchNo: null, |
| | | warnNum: 0, |