521 lines
18 KiB
Vue
521 lines
18 KiB
Vue
<template>
|
||
<div class="app-container">
|
||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||
<el-form-item label="出库类型" prop="outType">
|
||
<el-select v-model="queryParams.outType" placeholder="请选择出库类型" clearable>
|
||
<el-option
|
||
v-for="dict in dict.type.out_stockout_out_type"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="单据来源" prop="stockSource">
|
||
<el-select v-model="queryParams.stockSource" placeholder="请选择单据来源" clearable>
|
||
<el-option
|
||
v-for="dict in dict.type.out_stockout_stock_source"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="单据状态" prop="status">
|
||
<el-select v-model="queryParams.status" placeholder="请选择单据状态" clearable>
|
||
<el-option
|
||
v-for="dict in dict.type.out_stockout_status"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="上位单号" prop="erpBill">
|
||
<el-input
|
||
v-model="queryParams.erpBill"
|
||
placeholder="请输入上位单号"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="仓库名称" prop="warehouseName">
|
||
<el-input
|
||
v-model="queryParams.warehouseName"
|
||
placeholder="请输入仓库名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="用户名称" prop="userName">
|
||
<el-input
|
||
v-model="queryParams.userName"
|
||
placeholder="请输入用户名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="部门名称" prop="deptName">
|
||
<el-input
|
||
v-model="queryParams.deptName"
|
||
placeholder="请输入部门名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="客户名称" prop="customerName">
|
||
<el-input
|
||
v-model="queryParams.customerName"
|
||
placeholder="请输入客户名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="创建时间">
|
||
<el-date-picker
|
||
v-model="daterangeCreateDate"
|
||
style="width: 240px"
|
||
value-format="yyyy-MM-dd"
|
||
type="daterange"
|
||
range-separator="-"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期"
|
||
></el-date-picker>
|
||
</el-form-item>
|
||
<el-form-item label="开始时间">
|
||
<el-date-picker
|
||
v-model="daterangeStartDate"
|
||
style="width: 240px"
|
||
value-format="yyyy-MM-dd"
|
||
type="daterange"
|
||
range-separator="-"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期"
|
||
></el-date-picker>
|
||
</el-form-item>
|
||
<el-form-item label="结束时间">
|
||
<el-date-picker
|
||
v-model="daterangeFinishDate"
|
||
style="width: 240px"
|
||
value-format="yyyy-MM-dd"
|
||
type="daterange"
|
||
range-separator="-"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期"
|
||
></el-date-picker>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="danger"
|
||
plain
|
||
icon="el-icon-close"
|
||
size="mini"
|
||
:disabled="single"
|
||
@click="handleCancel"
|
||
v-hasPermi="['out:stockout:cancel']"
|
||
>手动作废
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
plain
|
||
icon="el-icon-s-check"
|
||
size="mini"
|
||
:disabled="single"
|
||
@click="handleAudit"
|
||
v-hasPermi="['out:stockout:audit']"
|
||
>审核单据
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="success"
|
||
plain
|
||
icon="el-icon-check"
|
||
size="mini"
|
||
:disabled="single"
|
||
@click="handleFinish"
|
||
v-hasPermi="['out:stockout:finish']"
|
||
>完成单据
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
plain
|
||
icon="el-icon-magic-stick"
|
||
size="mini"
|
||
:disabled="single"
|
||
@click="handleAutoAssign"
|
||
v-hasPermi="['out:stockout:autoAssign']"
|
||
>自动分配
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="info"
|
||
plain
|
||
icon="el-icon-s-operation"
|
||
size="mini"
|
||
:disabled="detailSingle"
|
||
@click="openAssignDialog"
|
||
v-hasPermi="['out:stockout:manualAssign']"
|
||
>手动分配
|
||
</el-button>
|
||
</el-col>
|
||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||
</el-row>
|
||
|
||
<el-table v-loading="loading" :data="stockoutList" @selection-change="handleSelectionChange"
|
||
@row-click="handleRowClick" highlight-current-row>
|
||
<el-table-column type="selection" width="55" align="center"/>
|
||
<el-table-column label="出库订单" align="center" prop="stockoutId" width="160"/>
|
||
<el-table-column label="出库类型" align="center" prop="outType">
|
||
<template slot-scope="scope">
|
||
<dict-tag :options="dict.type.out_stockout_out_type" :value="scope.row.outType"/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="单据来源" align="center" prop="stockSource">
|
||
<template slot-scope="scope">
|
||
<dict-tag :options="dict.type.out_stockout_stock_source" :value="scope.row.stockSource"/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="单据状态" align="center" prop="status">
|
||
<template slot-scope="scope">
|
||
<dict-tag :options="dict.type.out_stockout_status" :value="scope.row.status"/>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="上位单号" align="center" prop="erpBill"/>
|
||
<el-table-column label="仓库名称" align="center" prop="warehouseName"/>
|
||
<el-table-column label="用户名称" align="center" prop="userName"/>
|
||
<el-table-column label="部门名称" align="center" prop="deptName"/>
|
||
<el-table-column label="客户名称" align="center" prop="customerName" width="100" show-overflow-tooltip/>
|
||
<el-table-column label="创建时间" align="center" prop="createDate" width="160">
|
||
<template slot-scope="scope">
|
||
<span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="开始时间" align="center" prop="startDate" width="160">
|
||
<template slot-scope="scope">
|
||
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="结束时间" align="center" prop="finishDate" width="160">
|
||
<template slot-scope="scope">
|
||
<span>{{ parseTime(scope.row.finishDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<pagination
|
||
v-show="total>0"
|
||
:total="total"
|
||
:page.sync="queryParams.pageNum"
|
||
:limit.sync="queryParams.pageSize"
|
||
@pagination="getList"
|
||
/>
|
||
|
||
<!-- 出库子单详情 -->
|
||
<div class="detail-panel" style="margin-top: 20px;">
|
||
<div class="detail-header" style="margin-bottom: 10px; display: flex; align-items: center; gap: 8px;">
|
||
<span style="font-size: 14px; font-weight: 600; color: #303133;">出库子单详情</span>
|
||
<el-tag v-if="currentStockout" type="primary" size="small" style="margin-left: 4px;">
|
||
主单:{{ currentStockout.stockoutId }}
|
||
</el-tag>
|
||
<span v-else
|
||
style="font-size: 12px; color: #909399; margin-left: 4px;">(请点击上方主单行查看对应子单数据)</span>
|
||
</div>
|
||
<el-table
|
||
v-loading="detailLoading"
|
||
:data="detailList"
|
||
border
|
||
stripe
|
||
size="small"
|
||
style="width: 100%;"
|
||
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
|
||
@selection-change="handleDetailSelectionChange"
|
||
ref="detailTable"
|
||
>
|
||
<el-table-column type="selection" width="55" align="center"/>
|
||
<el-table-column label="子单ID" align="center" prop="stockoutDetailId" width="180"/>
|
||
<el-table-column label="批次" align="center" prop="lotNo" width="150"/>
|
||
<el-table-column label="辊号" align="center" prop="rollerNumber" width="150"/>
|
||
<el-table-column label="版长" align="center" prop="length" width="150"/>
|
||
<el-table-column label="版周" align="center" prop="perimeter" width="150"/>
|
||
<el-table-column label="物料编码" align="center" prop="productId" width="150"/>
|
||
<el-table-column label="物料名称" align="center" prop="productName" min-width="150" show-overflow-tooltip/>
|
||
<el-table-column label="计划数量" align="center" prop="quantity" width="100"/>
|
||
<el-table-column label="分配数量" align="center" prop="allotNum" width="100"/>
|
||
<el-table-column label="实际数量" align="center" prop="assignNum" width="100"/>
|
||
<el-table-column label="备注" align="center" prop="remark" min-width="120" show-overflow-tooltip/>
|
||
<template slot="empty">
|
||
<div style="padding: 30px 0; color: #909399; font-size: 13px;">
|
||
<i class="el-icon-document" style="font-size: 28px; display: block; margin-bottom: 8px;"></i>
|
||
{{ currentStockout ? '暂无子单数据' : '请先选择上侧主单行' }}
|
||
</div>
|
||
</template>
|
||
</el-table>
|
||
<pagination
|
||
v-show="detailTotal > 0"
|
||
:total="detailTotal"
|
||
:page.sync="detailQueryParams.pageNum"
|
||
:limit.sync="detailQueryParams.pageSize"
|
||
@pagination="getDetailList"
|
||
style="margin-top: 0;"
|
||
/>
|
||
</div>
|
||
|
||
<!-- ===================== 手动分配弹窗 ===================== -->
|
||
<el-dialog
|
||
title="选择出库库存"
|
||
:visible.sync="assignDialogVisible"
|
||
width="80%"
|
||
append-to-body
|
||
>
|
||
<el-table
|
||
v-loading="stockLoading"
|
||
:data="stockList"
|
||
border
|
||
size="small"
|
||
ref="stockTable"
|
||
@selection-change="handleStockSelectionChange"
|
||
>
|
||
<el-table-column type="selection" width="55" align="center"/>
|
||
<el-table-column label="库存ID" prop="stockId" align="center"/>
|
||
<el-table-column label="辊号" prop="rollerNumber" align="center"/>
|
||
<el-table-column label="版长" prop="length" align="center"/>
|
||
<el-table-column label="版周" prop="perimeter" align="center"/>
|
||
<el-table-column label="物料编码" prop="productId" align="center"/>
|
||
<el-table-column label="物料名称" prop="productName" align="center"/>
|
||
<el-table-column label="批次" prop="lotNo" align="center"/>
|
||
<el-table-column label="货位" prop="cargoSpaceId" align="center"/>
|
||
<el-table-column label="托盘号" prop="trayCode" align="center"/>
|
||
<el-table-column label="可用数量" prop="quantity" align="center"/>
|
||
</el-table>
|
||
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button @click="assignDialogVisible = false">取消</el-button>
|
||
<el-button type="primary" @click="confirmManualAssign">确认分配</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
listStockout,
|
||
cancelStockout,
|
||
auditStockout,
|
||
finishStockout,
|
||
autoAssignStockout,
|
||
manualAssignStockout
|
||
} from "@/api/out/stockout"
|
||
import { listStockoutdetail } from "@/api/out/stockoutdetail"
|
||
import { listStock } from "@/api/bas/stock"
|
||
|
||
export default {
|
||
name: "Stockout",
|
||
dicts: ['out_stockout_stock_source', 'out_stockout_status', 'out_stockout_out_type'],
|
||
data() {
|
||
return {
|
||
loading: true,
|
||
ids: [],
|
||
single: true,
|
||
multiple: true,
|
||
showSearch: true,
|
||
total: 0,
|
||
stockoutList: [],
|
||
daterangeCreateDate: [],
|
||
daterangeStartDate: [],
|
||
daterangeFinishDate: [],
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
outType: null,
|
||
stockSource: null,
|
||
status: null,
|
||
createDate: null,
|
||
startDate: null,
|
||
finishDate: null,
|
||
erpBill: null,
|
||
warehouseName: null,
|
||
userName: null,
|
||
deptName: null,
|
||
customerName: null
|
||
},
|
||
// 子单
|
||
currentStockout: null,
|
||
detailLoading: false,
|
||
detailTotal: 0,
|
||
detailList: [],
|
||
detailQueryParams: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
stockoutId: null
|
||
},
|
||
// 子单选中ID
|
||
detailIds: [],
|
||
detailSingle: true,
|
||
|
||
// 手动分配弹窗
|
||
assignDialogVisible: false,
|
||
stockLoading: false,
|
||
stockList: [],
|
||
selectedStockList: []
|
||
}
|
||
},
|
||
created() {
|
||
this.getList()
|
||
},
|
||
methods: {
|
||
getList() {
|
||
this.loading = true
|
||
this.queryParams.params = {}
|
||
if (this.daterangeCreateDate && this.daterangeCreateDate.length > 0) {
|
||
this.queryParams.params.beginCreateDate = this.daterangeCreateDate[0]
|
||
this.queryParams.params.endCreateDate = this.daterangeCreateDate[1]
|
||
}
|
||
if (this.daterangeStartDate && this.daterangeStartDate.length > 0) {
|
||
this.queryParams.params.beginStartDate = this.daterangeStartDate[0]
|
||
this.queryParams.params.endStartDate = this.daterangeStartDate[1]
|
||
}
|
||
if (this.daterangeFinishDate && this.daterangeFinishDate.length > 0) {
|
||
this.queryParams.params.beginFinishDate = this.daterangeFinishDate[0]
|
||
this.queryParams.params.endFinishDate = this.daterangeFinishDate[1]
|
||
}
|
||
listStockout(this.queryParams).then(res => {
|
||
this.stockoutList = res.rows
|
||
this.total = res.total
|
||
this.loading = false
|
||
})
|
||
},
|
||
handleQuery() {
|
||
this.queryParams.pageNum = 1
|
||
this.getList()
|
||
},
|
||
resetQuery() {
|
||
this.daterangeCreateDate = []
|
||
this.daterangeStartDate = []
|
||
this.daterangeFinishDate = []
|
||
this.resetForm("queryForm")
|
||
this.handleQuery()
|
||
this.resetDetailList()
|
||
},
|
||
resetDetailList() {
|
||
this.detailList = []
|
||
this.detailQueryParams.stockoutId = null
|
||
this.currentStockout = null
|
||
this.detailTotal = 0
|
||
},
|
||
handleSelectionChange(selection) {
|
||
this.ids = selection.map(item => item.stockoutId)
|
||
this.single = selection.length !== 1
|
||
},
|
||
handleRowClick(row) {
|
||
this.currentStockout = row
|
||
this.detailQueryParams.stockoutId = row.stockoutId
|
||
this.detailQueryParams.pageNum = 1
|
||
this.getDetailList()
|
||
},
|
||
getDetailList() {
|
||
if (!this.detailQueryParams.stockoutId) return
|
||
this.detailLoading = true
|
||
listStockoutdetail(this.detailQueryParams).then(res => {
|
||
this.detailList = res.rows
|
||
this.detailTotal = res.total
|
||
this.detailLoading = false
|
||
})
|
||
},
|
||
|
||
// 子单多选事件
|
||
handleDetailSelectionChange(val) {
|
||
this.detailIds = val.map(item => item.stockoutDetailId)
|
||
this.detailSingle = val.length !== 1
|
||
},
|
||
|
||
// ===================== 手动分配:打开弹窗 =====================
|
||
openAssignDialog() {
|
||
if (this.detailIds.length === 0) {
|
||
this.$modal.msgWarning("请选择子单")
|
||
return
|
||
}
|
||
|
||
const detail = this.detailList.find(item => item.stockoutDetailId === this.detailIds[0])
|
||
this.assignDialogVisible = true
|
||
this.stockLoading = true
|
||
// 根据物料编码查询可用库存 @@@FT577
|
||
// listStock({ productId: detail.productId }).then(res => {
|
||
// this.stockList = res.rows
|
||
// this.stockLoading = false
|
||
// })
|
||
listStock({ rollerNumber: detail.rollerNumber }).then(res => {
|
||
this.stockList = res.rows
|
||
this.stockLoading = false
|
||
})
|
||
|
||
},
|
||
|
||
// 库存选中事件
|
||
handleStockSelectionChange(val) {
|
||
this.selectedStockList = val
|
||
},
|
||
|
||
// 确认分配
|
||
confirmManualAssign() {
|
||
if (this.selectedStockList.length === 0) {
|
||
this.$modal.msgWarning("请选择要出库的库存")
|
||
return
|
||
}
|
||
const stockIdList = this.selectedStockList.map(item => item.stockId)
|
||
const detailId = this.detailIds[0]
|
||
|
||
this.$modal.confirm("确认选中库存进行分配?").then(() => {
|
||
// 调用子单手动分配接口
|
||
return manualAssignStockout({
|
||
stockoutDetailId: detailId,
|
||
stockIdList: stockIdList
|
||
})
|
||
}).then(() => {
|
||
this.$modal.msgSuccess("分配成功")
|
||
this.assignDialogVisible = false
|
||
this.getDetailList()
|
||
})
|
||
},
|
||
|
||
handleCancel() {
|
||
cancelStockout(this.ids[0]).then(() => {
|
||
this.$modal.msgSuccess("作废成功")
|
||
this.getList()
|
||
})
|
||
},
|
||
handleAudit() {
|
||
auditStockout(this.ids[0]).then(() => {
|
||
this.$modal.msgSuccess("审核成功")
|
||
this.getList()
|
||
})
|
||
},
|
||
handleFinish() {
|
||
finishStockout(this.ids[0]).then(() => {
|
||
this.$modal.msgSuccess("完成成功")
|
||
this.getList()
|
||
})
|
||
},
|
||
handleAutoAssign() {
|
||
autoAssignStockout(this.ids[0]).then(() => {
|
||
this.$modal.msgSuccess("自动分配成功")
|
||
this.getDetailList()
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|