| | |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="库存类型" |
| | | prop="type" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: '请选择库存类型', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select v-model="formState.type" placeholder="请选择库存类型" @change="handleTypeChange"> |
| | | <el-option label="合格库存" value="qualified" :disabled="props.record.qualifiedUnLockedQuantity <= 0" /> |
| | | <el-option label="不合格库存" value="unqualified" :disabled="props.record.unQualifiedUnLockedQuantity <= 0" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="数量" |
| | | prop="qualitity" |
| | | > |
| | |
| | | record: { |
| | | type: Object, |
| | | default: () => {}, |
| | | }, |
| | | type: { |
| | | type: String, |
| | | required: true, |
| | | default: 'qualified', |
| | | }, |
| | | } |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | |
| | | }) |
| | | |
| | | const maxQuality = computed(() => { |
| | | return props.record.unLockedQuantity ? props.record.unLockedQuantity : 0; |
| | | let max = 0; |
| | | if (formState.value.type === 'qualified') { |
| | | max = props.record.qualifiedUnLockedQuantity ? props.record.qualifiedUnLockedQuantity : 0; |
| | | } else { |
| | | max = props.record.unQualifiedUnLockedQuantity ? props.record.unQualifiedUnLockedQuantity : 0; |
| | | } |
| | | // 确保 max 至少为 1,避免 min > max 的错误 |
| | | return Math.max(max, 1); |
| | | }) |
| | | |
| | | const handleTypeChange = () => { |
| | | formState.value.qualitity = undefined; |
| | | } |
| | | |
| | | const initFormData = () => { |
| | | if (props.record) { |
| | |
| | | const handleProductSelect = async (products) => { |
| | | if (products && products.length > 0) { |
| | | const product = products[0]; |
| | | console.log(product) |
| | | formState.value.productId = product.productId; |
| | | formState.value.productName = product.productName; |
| | | formState.value.productModelName = product.model; |
| | |
| | | proxy.$modal.msgError("请选择规格"); |
| | | return; |
| | | } |
| | | if (props.type === 'qualified') { |
| | | if (formState.value.type === 'qualified') { |
| | | subtractStockInventory(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| | | </script> |