| | |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="数量" |
| | | label="库存数量" |
| | | prop="qualitity" |
| | | > |
| | | <el-input-number v-model="formState.qualitity" :step="1" :min="0" style="width: 100%" /> |
| | | <el-input-number v-model="formState.qualitity" :step="1" :min="1" style="width: 100%" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | v-if="type === 'qualified'" |
| | | label="库存预警数量" |
| | | prop="warnNum" |
| | | > |
| | | <el-input-number v-model="formState.warnNum" :step="1" :min="0" :max="formState.qualitity" style="width: 100%" /> |
| | | </el-form-item> |
| | | <!-- productType === 0:原材料 --> |
| | | <el-form-item |
| | | v-if="type === 'qualified' && formState.productType === 0" |
| | | label="过磅日期" |
| | | prop="weighingDate" |
| | | > |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="formState.weighingDate" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | type="datetime" |
| | | placeholder="请选择过磅日期" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | v-if="type === 'qualified' && formState.productType === 0" |
| | | label="净重(吨)" |
| | | prop="netWeight" |
| | | > |
| | | <el-input-number v-model="formState.netWeight" :step="0.01" :min="0" style="width: 100%" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="备注" prop="remark"> |
| | |
| | | import {ref, computed, getCurrentInstance} from "vue"; |
| | | import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue"; |
| | | import {createStockInventory} from "@/api/inventoryManagement/stockInventory.js"; |
| | | import {createStockUnInventory} from "@/api/inventoryManagement/stockUninventory.js"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | |
| | | type: { |
| | | type: String, |
| | | required: true, |
| | | default: 'qualified', |
| | | }, |
| | | }); |
| | | |
| | |
| | | productName: "", |
| | | productModelName: "", |
| | | unit: "", |
| | | weighingDate: undefined, |
| | | productType: undefined, |
| | | qualitity: 0, |
| | | warnNum: 0, |
| | | netWeight: undefined, |
| | | remark: '', |
| | | }); |
| | | |
| | |
| | | |
| | | // 产品选择处理 |
| | | const handleProductSelect = async (products) => { |
| | | formState.value.weighingDate = undefined; |
| | | formState.value.netWeight = undefined; |
| | | 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; |
| | | formState.value.productModelId = product.id; |
| | | formState.value.unit = product.unit; |
| | | formState.value.productType = product.productType; |
| | | showProductSelectDialog.value = false; |
| | | // 触发表单验证更新 |
| | | proxy.$refs["formRef"]?.validateField('productModelId'); |
| | |
| | | proxy.$modal.msgError("请选择规格"); |
| | | return; |
| | | } |
| | | createStockInventory(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | }) |
| | | if (props.type === 'qualified') { |
| | | createStockInventory(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | }) |
| | | } else { |
| | | createStockUnInventory(formState.value).then(res => { |
| | | // 关闭模态框 |
| | | isShow.value = false; |
| | | // 告知父组件已完成 |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("提交成功"); |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | }; |