工地直转修正

This commit is contained in:
hongchao 2025-11-24 16:37:51 +08:00
parent 97645a20c3
commit d049659ab6
2 changed files with 44 additions and 9 deletions

View File

@ -277,7 +277,7 @@
:row-key="getRowKey"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center" :selectable="checkSelectable"/>
<el-table-column align="center" label="序号" width="55">
<template slot-scope="scope">
{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
@ -392,6 +392,8 @@ export default {
{ label: '设备编码', prop: 'maCode' },
{ label: '计量单位', prop: 'unitName' },
{ label: '在用数量', prop: 'useNum' },
{ label: '待转数量', prop: 'waitTransNum' },
{ label: '可转数量', prop:'transNum' },
{ label: '领料人', prop: 'leasePerson' },
{ label: '领料日期', prop: 'startTime' }
],
@ -856,6 +858,15 @@ export default {
loading.close()
}
},
checkSelectable(row) {
if(row.transNum==0){
return false
}else{
return true
}
},
//
handleSelectionChange(currentPageSelectedRows) {
//
@ -886,7 +897,7 @@ export default {
currentPageSelectedRows.forEach(row => {
const completeRow = {
...row,
directNum: row.directNum || row.useNum,
directNum: row.directNum || row.transNum,
isActive: true
}
this.selectedDataArray.push(completeRow)
@ -897,8 +908,8 @@ export default {
this.equipmentList.forEach(item => {
const isSelected = currentPageSelectedRows.some(selectedRow => this.getRowKey(selectedRow) === this.getRowKey(item))
item.isActive = isSelected
if (isSelected && !item.directNum && item.useNum) {
item.directNum = item.useNum
if (isSelected && !item.directNum && item.transNum) {
item.directNum = item.transNum
} else if (!isSelected && !this.isEdit && !this.isDetail) {
item.directNum = undefined
}
@ -921,10 +932,10 @@ export default {
} else {
row.directNum = Number(String(row.directNum).replace(/[^\d]/g, ''))
}
if (row.directNum > row.useNum) {
this.$message.error('直转数量不能大于领料数量')
if (row.directNum > row.transNum) {
this.$message.error('直转数量不能大于可转数量')
this.$nextTick(() => {
row.directNum = row.useNum
row.directNum = row.transNum
})
}

View File

@ -887,14 +887,38 @@ export default {
async getListDepart(projectName) {
try {
const res = await getListDepartApi({ projectName })
console.log('🚀 ~ res:', res)
this.departList = res.data
console.log('🚀 ~ this.departList:', this.departList)
// departList
if (this.departList && this.departList.length === 1) {
//
const autoSelectItem = this.findLeafNode(this.departList[0]);
if (autoSelectItem) {
this.form.projectUnitId = autoSelectItem.id;
// unitSelect
this.unitSelect(autoSelectItem);
}
}
} catch (error) {
console.log('🚀 ~ error:', error)
}
},
//
findLeafNode(node) {
// childrenchildren
if (!node.children || node.children.length === 0) {
return node;
}
//
for (const child of node.children) {
const leafNode = this.findLeafNode(child);
if (leafNode) return leafNode;
}
return null;
},
/** 新增按钮操作 */
handleAdd() {
this.reset()