432 lines
14 KiB
Vue
432 lines
14 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="productId"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.productId"
|
||
placeholder="请输入存货编码"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="存货名称" prop="productName"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.productName"
|
||
placeholder="请输入存货名称"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="项目号" prop="spare4"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.spare4"
|
||
placeholder="请输入项目号"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="合同号" prop="spare5"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.spare5"
|
||
placeholder="请输入合同号"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="层级关系" prop="spare1"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.spare1"
|
||
placeholder="请输入层级关系"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="上层物料" prop="spare2"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.spare2"
|
||
placeholder="请输入上层物料"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="顶层物料" prop="spare3"><!-- 品名 -->
|
||
<el-input
|
||
v-model="queryParams.spare3"
|
||
placeholder="请输入顶层物料"
|
||
clearable
|
||
@keyup.enter.native="handleQuery"
|
||
/>
|
||
</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="warning"
|
||
plain
|
||
icon="el-icon-download"
|
||
size="mini"
|
||
@click="pointOut"
|
||
v-hasPermi="['job:outmydoJob:pointOut']"
|
||
>指定货位出库 <!-- 指定货位出库 --></el-button>
|
||
</el-col>
|
||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||
</el-row>
|
||
|
||
<el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange" max-height="650">
|
||
<el-table-column type="selection" width="55" align="center"/>
|
||
<el-table-column label="库存编码" align="center" prop="stockId" width="160"/>
|
||
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" width="120"/>
|
||
<el-table-column label="入库日期" align="center" prop="inDate" width="160" />
|
||
<el-table-column label="批次号" align="center" prop="lotNo"/>
|
||
<el-table-column label="托盘条码" align="center" prop="trayCode" width="130" />
|
||
<el-table-column label="存货编码" align="center" prop="productId" />
|
||
<el-table-column label="存货名称" align="center" prop="productName" width="120"/>
|
||
<el-table-column label="层级关系" align="center" prop="spare1"/>
|
||
<el-table-column label="上层物料" align="center" prop="spare2"/>
|
||
<el-table-column label="顶层物料" align="center" prop="spare3"/>
|
||
<el-table-column label="项目号" align="center" prop="spare4"/>
|
||
<el-table-column label="合同号" align="center" prop="spare5"/>
|
||
<el-table-column label="销售订单" align="center" prop="spare6"/>
|
||
<el-table-column label="供应商编码" align="center" prop="voltage" width="120"/>
|
||
<el-table-column label="规格型号" align="center" prop="power"/>
|
||
<el-table-column label="计量单位" align="center" prop="phase"/>
|
||
<el-table-column label="数量" align="center" prop="quantity"/>
|
||
|
||
|
||
</el-table>
|
||
|
||
<pagination
|
||
v-show="total>0"
|
||
:total="total"
|
||
:page.sync="queryParams.pageNum"
|
||
:limit.sync="queryParams.pageSize"
|
||
@pagination="getList"
|
||
/>
|
||
|
||
<!-- 添加或修改库存信息对话框 -->
|
||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||
<el-form-item label="库存ID" prop="stockId"> <!-- 库存id -->
|
||
<el-input v-model="form.stockId" placeholder="请输入库存ID"/>
|
||
</el-form-item>
|
||
<el-form-item label="货位ID" prop="cargoSpaceId"> <!-- 货位id -->
|
||
<el-input v-model="form.cargoSpaceId" placeholder="请输入货位ID"/>
|
||
</el-form-item>
|
||
<el-form-item label="库存状态" prop="stockStatus"> <!-- 库存状态 -->
|
||
<el-select v-model="form.stockStatus" placeholder="请选择库存状态">
|
||
<el-option
|
||
v-for="dict in dict.type.stock_status"
|
||
:key="dict.value"
|
||
:label="dict.label"
|
||
:value="dict.value"
|
||
></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="库存数量" prop="quantity"> <!-- 库存数量 -->
|
||
<el-input v-model="form.quantity" placeholder="请输入库存数量"/>
|
||
</el-form-item>
|
||
|
||
</el-form>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitForm">确定 <!-- 确定 --></el-button>
|
||
<el-button @click="cancel">取消 <!-- 取消 --></el-button>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<!-- 出口选择弹窗 -->
|
||
<el-dialog title="选择出口" :visible.sync="exitDialogVisible" width="400px" append-to-body>
|
||
<el-form ref="exitForm" :model="exitForm" :rules="exitRules" label-width="80px">
|
||
<el-form-item label="选择出口" prop="exitId">
|
||
<el-select v-model="exitForm.exitId" placeholder="请选择出口" clearable>
|
||
<el-option
|
||
v-for="item in exitOptions"
|
||
:key="item.exitId"
|
||
:label="item.exitName"
|
||
:value="item.exitId"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-form>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="submitPointOut">确定</el-button>
|
||
<el-button @click="cancelExit">取消</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import {addManagement, delManagement, getManagement, listManagement, updateManagement} from "@/api/stock/management"
|
||
import {listWarehouse} from "@/api/bas/warehouse"
|
||
import {pointOut} from "@/api/job/OutmydoJob"
|
||
|
||
export default {
|
||
name: "Management",
|
||
dicts: ['product_status', 'stock_status', 'cargo_space_status', 'cargo_space_lock_status'],
|
||
data() {
|
||
return {
|
||
// 遮罩层
|
||
loading: true,
|
||
// 选中数组
|
||
ids: [],
|
||
// 非单个禁用
|
||
single: true,
|
||
// 非多个禁用
|
||
multiple: true,
|
||
// 显示搜索条件
|
||
showSearch: true,
|
||
// 总条数
|
||
total: 0,
|
||
// 库存信息表格数据
|
||
managementList: [],
|
||
// 仓库选项
|
||
warehouseOptions: [],
|
||
// 弹出层标题
|
||
title: "",
|
||
// 是否显示弹出层
|
||
open: false,
|
||
// 查询参数
|
||
queryParams: {
|
||
pageNum: 1,
|
||
pageSize: 10,
|
||
stockId: null,
|
||
cargoSpaceStockStatus: '2',
|
||
cargoSpaceName: null,
|
||
stockStatus: null,
|
||
productStatus: null,
|
||
lotNo: null,
|
||
inDate: null,
|
||
backDate: null,
|
||
productGuid: null,
|
||
quantity: null,
|
||
jobId: null,
|
||
trayCode: null,
|
||
outQuantity: null,
|
||
stockinDetailId: null,
|
||
stockinId: null,
|
||
inType: null,
|
||
inClassId: null,
|
||
warehouseId: null,
|
||
stackingId: null,
|
||
spare1: null,
|
||
spare2: null,
|
||
spare3: null,
|
||
spare4: null,
|
||
spare5: null,
|
||
spare6: null,
|
||
roadwayId: null
|
||
},
|
||
// 表单参数
|
||
form: {},
|
||
// 表单校验
|
||
rules: {
|
||
/*stockId: [
|
||
{ required: true, message: this.$t('stockManagement.stockIdRequired'), trigger: "blur" } // 库存id不能为空
|
||
]*/
|
||
},
|
||
// 出口选择弹窗显示状态
|
||
exitDialogVisible: false,
|
||
// 出口表单数据
|
||
exitForm: {
|
||
exitId: null
|
||
},
|
||
// 出口表单验证规则
|
||
exitRules: {
|
||
exitId: [
|
||
{required: true, message: "请选择出口", trigger: 'change'}
|
||
]
|
||
},
|
||
// 出口选项
|
||
exitOptions: [
|
||
{exitId: '1', exitName: '缓存'},
|
||
{exitId: '2', exitName: '线边'},
|
||
|
||
],
|
||
|
||
// 选中的库存数据
|
||
selectedStockData: []
|
||
}
|
||
},
|
||
created() {
|
||
this.getList()
|
||
this.getWarehouseList();
|
||
},
|
||
methods: {
|
||
/** 获取仓库列表 */
|
||
getWarehouseList() {
|
||
listWarehouse().then(response => {
|
||
this.warehouseOptions = response.rows;
|
||
});
|
||
},
|
||
/** 查询库存信息列表 */
|
||
getList() {
|
||
this.loading = true
|
||
listManagement(this.queryParams).then(response => {
|
||
this.managementList = response.rows
|
||
this.total = response.total
|
||
this.loading = false
|
||
})
|
||
},
|
||
// 取消按钮
|
||
cancel() {
|
||
this.open = false
|
||
this.reset()
|
||
},
|
||
// 表单重置
|
||
reset() {
|
||
this.form = {
|
||
stockId: null,
|
||
cargoSpaceId: null,
|
||
stockStatus: null,
|
||
productStatus: null,
|
||
lotNo: null,
|
||
inDate: null,
|
||
backDate: null,
|
||
productGuid: null,
|
||
quantity: null,
|
||
jobId: null,
|
||
trayCode: null,
|
||
outQuantity: null,
|
||
stockinDetailId: null,
|
||
stockinId: null,
|
||
inType: null,
|
||
inClassId: null,
|
||
warehouseId: null,
|
||
stackingId: null,
|
||
spare1: null,
|
||
spare2: null,
|
||
spare3: null,
|
||
spare4: null,
|
||
spare5: null,
|
||
spare6: null,
|
||
roadwayId: null
|
||
}
|
||
this.resetForm("form")
|
||
},
|
||
/** 搜索按钮操作 */
|
||
handleQuery() {
|
||
this.queryParams.pageNum = 1
|
||
this.getList()
|
||
},
|
||
/** 重置按钮操作 */
|
||
resetQuery() {
|
||
this.resetForm("queryForm")
|
||
this.queryParams.inDate = null
|
||
this.handleQuery()
|
||
},
|
||
// 多选框选中数据
|
||
handleSelectionChange(selection) {
|
||
this.ids = selection.map(item => item.stockId)
|
||
this.single = selection.length !== 1
|
||
this.multiple = !selection.length
|
||
},
|
||
/** 新增按钮操作 */
|
||
handleAdd() {
|
||
this.reset()
|
||
this.open = true
|
||
this.title = "添加库存信息"
|
||
},
|
||
/** 修改按钮操作 */
|
||
handleUpdate(row) {
|
||
this.reset()
|
||
const stockId = row.stockId || this.ids
|
||
getManagement(stockId).then(response => {
|
||
this.form = response.data
|
||
this.open = true
|
||
this.title = "修改库存信息"
|
||
})
|
||
},
|
||
/** 提交按钮 */
|
||
submitForm() {
|
||
this.$refs["form"].validate(valid => {
|
||
if (valid) {
|
||
if (this.form.stockId != null) {
|
||
updateManagement(this.form).then(response => {
|
||
this.$modal.msgSuccess("修改成功")
|
||
this.open = false
|
||
this.getList()
|
||
})
|
||
} else {
|
||
addManagement(this.form).then(response => {
|
||
this.$modal.msgSuccess("新增成功")
|
||
this.open = false
|
||
this.getList()
|
||
})
|
||
}
|
||
}
|
||
})
|
||
},
|
||
/** 删除按钮操作 */
|
||
handleDelete(row) {
|
||
const stockIds = row.stockId || this.ids
|
||
this.$modal.confirm("是否确认删除库存信息编号为" + stockIds + "?").then(function () {
|
||
return delManagement(stockIds)
|
||
}).then(() => {
|
||
this.getList()
|
||
this.$modal.msgSuccess("删除成功")
|
||
}).catch(() => {
|
||
})
|
||
},
|
||
/** 指定货位出库按钮操作 */
|
||
pointOut() {
|
||
if (this.ids.length === 0) {
|
||
this.$modal.msgError("请至少选择一行数据");
|
||
return;
|
||
}
|
||
// 获取选中的完整数据
|
||
const selectedData = this.managementList.filter(item => this.ids.includes(item.stockId));
|
||
this.selectedStockData = selectedData;
|
||
// 显示出口选择弹窗
|
||
this.exitDialogVisible = true;
|
||
this.exitForm.exitId = null;
|
||
},
|
||
|
||
|
||
/** 提交指定货位出库 */
|
||
submitPointOut() {
|
||
this.$refs["exitForm"].validate(valid => {
|
||
if (valid) {
|
||
const stockIds = this.ids;
|
||
// 调用API将stockIds数组和出口信息传给后端
|
||
//console.log("指定货位出库:", stockIds, this.exitForm.exitId)
|
||
|
||
|
||
|
||
pointOut(stockIds, this.exitForm.exitId).then(response => {
|
||
// 根据后端返回的实际code判断业务是否成功
|
||
this.$modal.msgSuccess(response.msg);
|
||
this.exitDialogVisible = false;
|
||
this.getList();
|
||
|
||
});
|
||
}
|
||
})
|
||
},
|
||
|
||
/** 取消出口选择 */
|
||
cancelExit() {
|
||
this.exitDialogVisible = false;
|
||
this.exitForm.exitId = null;
|
||
},
|
||
/** 导出按钮操作 */
|
||
handleExport() {
|
||
this.download('stock/management/export', {
|
||
...this.queryParams
|
||
}, `management_${new Date().getTime()}.xlsx`)
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.no-wrap {
|
||
white-space: nowrap;
|
||
}
|
||
</style>
|