| | |
| | | <el-form-item label="库存数量:"> |
| | | <el-input v-model.trim="state.originInventory" readonly placeholder="库存数量"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="材料清单:" prop="warehousingRecordDetails"> |
| | | <el-form-item label="出入库:" prop="warehousingRecordDetails"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | |
| | | const dialogRef = ref(); |
| | | const checkList = (rule, value, callback) => { |
| | | if (state.form.warehousingRecordDetails.length == 0) { |
| | | callback(new Error('材料清单不可为空')) |
| | | callback(new Error('出入库不可为空')) |
| | | } else { |
| | | callback() |
| | | } |
| | |
| | | } |
| | | |
| | | const calculateInventoryExcludingCurrent = (currentRow) => { |
| | | if(!state.form.materialId) return 0 |
| | | // if(!state.form.materialId) return 0 |
| | | let inventory = state.materialList.find(i=>i.id == state.form.materialId)?.inventory || 0; |
| | | if(Array.isArray(state.form.warehousingRecordDetails) && state.form.warehousingRecordDetails.length>0){ |
| | | for(let i of state.form.warehousingRecordDetails){ |
| | |
| | | } |
| | | |
| | | const calculateInventory = () => { |
| | | if(state.form.materialId){ |
| | | // if(state.form.materialId){ |
| | | let inventory = state.materialList.find(i=>i.id == state.form.materialId)?.inventory || 0 |
| | | if(Array.isArray(state.form.warehousingRecordDetails) && state.form.warehousingRecordDetails.length>0){ |
| | | for(let i of state.form.warehousingRecordDetails){ |
| | |
| | | if(inventory < 0){ |
| | | ElMessage.warning('库存不足,无法出库') |
| | | } |
| | | }else{ |
| | | state.originInventory = 0 |
| | | } |
| | | // }else{ |
| | | // state.originInventory = 0 |
| | | // } |
| | | } |
| | | |
| | | const checkRemain = (scope) => { |
| | |
| | | } |
| | | |
| | | const getInventory = ()=>{ |
| | | state.form.warehousingRecordDetails = state.form.warehousingRecordDetails.map(i=>{ |
| | | return { |
| | | ...i, |
| | | specification: state.materialList.find(i=>i.id == state.form.materialId)?.specification, |
| | | materialUnit: state.materialList.find(i=>i.id == state.form.materialId)?.materialUnit |
| | | } |
| | | }) |
| | | state.form.warehousingRecordDetails = [] |
| | | // state.form.warehousingRecordDetails = state.form.warehousingRecordDetails.map(i=>{ |
| | | // return { |
| | | // ...i, |
| | | // specification: state.materialList.find(i=>i.id == state.form.materialId)?.specification, |
| | | // materialUnit: state.materialList.find(i=>i.id == state.form.materialId)?.materialUnit |
| | | // } |
| | | // }) |
| | | calculateInventory() |
| | | } |
| | | |
| | |
| | | warehousingRecordDetails: [], |
| | | delDetails: [] |
| | | } |
| | | state.originInventory = 0 |
| | | superRef.value.clearValidate(); |
| | | superRef.value.resetFields() |
| | | dialogVisible.value = false; |