库房bug修复
This commit is contained in:
@@ -14,11 +14,18 @@
|
||||
<el-table-column label="规格" align="center" prop="specifications" />
|
||||
<el-table-column label="出库时间" align="cenetr" width="220px" prop="signTime" />
|
||||
<el-table-column label="品牌" align="center" prop="brand" />
|
||||
<el-table-column label="操作" align="center" width="90">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" style="color:#e6a23c"
|
||||
icon="el-icon-back" @click="handleReturn(scope.row)">退库</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { redoDetail } from '@/api/oa/warehouse/oaOutWarehouse'
|
||||
export default {
|
||||
name: 'OutWarehouseDetailTable',
|
||||
props: {
|
||||
@@ -53,6 +60,33 @@ export default {
|
||||
},
|
||||
handlePagination (val) {
|
||||
this.$emit('pagination', val);
|
||||
},
|
||||
// 一键退库:默认按出库数量全额退回
|
||||
handleReturn (row) {
|
||||
const max = Number(row.amount || 0)
|
||||
if (max <= 0) {
|
||||
this.$message.warning('该明细出库数量为 0,无法退库')
|
||||
return
|
||||
}
|
||||
this.$prompt(`退回数量(最大 ${max}),物料:${row.warehouseName || ''}`, '退库', {
|
||||
confirmButtonText: '确定退库',
|
||||
cancelButtonText: '取消',
|
||||
inputValue: String(max),
|
||||
inputValidator: (v) => {
|
||||
const n = Number(v)
|
||||
if (!n || n <= 0) return '请输入大于 0 的数量'
|
||||
if (n > max) return '不能超过出库数量 ' + max
|
||||
return true
|
||||
}
|
||||
}).then(({ value }) => {
|
||||
const num = Math.floor(Number(value))
|
||||
redoDetail([{ detailId: row.id, returnNum: num }]).then(() => {
|
||||
this.$modal.msgSuccess(`已退库 ${num} 件`)
|
||||
this.$emit('returned')
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('退库失败')
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,6 +113,12 @@
|
||||
<el-table-column label="型号" align="center" prop="model"/>
|
||||
<el-table-column label="规格" align="center" prop="specifications"/>
|
||||
<el-table-column label="品牌" align="center" prop="brand"/>
|
||||
<el-table-column label="操作" align="center" width="90">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" style="color:#e6a23c"
|
||||
icon="el-icon-back" @click="handleReturn(scope.row)">退库</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="detail = false">关闭</el-button>
|
||||
@@ -122,6 +128,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { redoDetail } from '@/api/oa/warehouse/oaOutWarehouse'
|
||||
export default {
|
||||
name: 'OutWarehouseMasterTable',
|
||||
props: {
|
||||
@@ -174,6 +181,40 @@ export default {
|
||||
},
|
||||
handlePagination(val) {
|
||||
this.$emit('pagination', val);
|
||||
},
|
||||
// 一键退库:默认按出库数量全额退回
|
||||
handleReturn (row) {
|
||||
const max = Number(row.amount || 0)
|
||||
if (max <= 0) {
|
||||
this.$message.warning('该明细出库数量为 0,无法退库')
|
||||
return
|
||||
}
|
||||
this.$prompt(`退回数量(最大 ${max}),物料:${row.warehouseName || ''}`, '退库', {
|
||||
confirmButtonText: '确定退库',
|
||||
cancelButtonText: '取消',
|
||||
inputValue: String(max),
|
||||
inputValidator: (v) => {
|
||||
const n = Number(v)
|
||||
if (!n || n <= 0) return '请输入大于 0 的数量'
|
||||
if (n > max) return '不能超过出库数量 ' + max
|
||||
return true
|
||||
}
|
||||
}).then(({ value }) => {
|
||||
const num = Math.floor(Number(value))
|
||||
redoDetail([{ detailId: row.id, returnNum: num }]).then(() => {
|
||||
this.$modal.msgSuccess(`已退库 ${num} 件`)
|
||||
// 通知父页面刷新数据
|
||||
this.$emit('returned')
|
||||
// 同步本地:扣掉已退数量
|
||||
row.amount = max - num
|
||||
if (row.amount <= 0) {
|
||||
const idx = this.detailData.warehouseList.indexOf(row)
|
||||
if (idx > -1) this.detailData.warehouseList.splice(idx, 1)
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('退库失败')
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
<OutWarehouseMasterTable :list="outWareHouseList" :loading="loading" :total="total"
|
||||
@selection-change="handleSelectionChange" @delete="handleDelete" @query="handleQuery"
|
||||
@pagination="handlePagination" @status-change="handleStatusChange"
|
||||
@returned="handleReturned"
|
||||
@export-detail="handleExportDetail" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="出库明细维度" name="detail">
|
||||
<OutWarehouseDetailTable :list="outWarehouseDetailList" :loading="loading" :total="total"
|
||||
@pagination="handlePagination" @export-detail="handleExportDetailDetail" />
|
||||
@pagination="handlePagination" @returned="handleReturned"
|
||||
@export-detail="handleExportDetailDetail" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
@@ -218,6 +220,10 @@ export default {
|
||||
});
|
||||
},
|
||||
// 项目选择
|
||||
// 退库成功后刷新右侧明细
|
||||
handleReturned () {
|
||||
this.getList()
|
||||
},
|
||||
handleProjectSelect (data) {
|
||||
this.currentProject = data;
|
||||
this.queryParams.projectId = data.projectId;
|
||||
|
||||
Reference in New Issue
Block a user