532 lines
21 KiB
Vue
532 lines
21 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="$t('stockRecord.stockId')" prop="stockId"> <!-- 库存编码 -->
|
|
<el-input
|
|
v-model="queryParams.stockId"
|
|
:placeholder="$t('stockRecord.inputStockId')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.cargoSpaceId')" prop="cargoSpaceId"> <!-- 货位编码 -->
|
|
<el-input
|
|
v-model="queryParams.cargoSpaceId"
|
|
:placeholder="$t('stockRecord.inputCargoSpaceId')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.trayCode')" prop="trayCode"> <!-- 托盘条码 -->
|
|
<el-input
|
|
v-model="queryParams.trayCode"
|
|
:placeholder="$t('stockRecord.inputTrayCode')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<!-- <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="$t('stockRecord.productName')" prop="productName"> <!-- 物品名称 -->
|
|
<el-input
|
|
v-model="queryParams.productName"
|
|
:placeholder="$t('stockRecord.inputProductName')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<!-- <el-form-item :label="$t('stockRecord.printDate')" prop="printDate"> <!– 生产日期 –>
|
|
<el-input
|
|
v-model="queryParams.printDate"
|
|
:placeholder="$t('stockRecord.inputPrintDate')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>-->
|
|
<el-form-item :label="$t('stockRecord.lotNo')" prop="lotNo"> <!-- 批号 -->
|
|
<el-input
|
|
v-model="queryParams.lotNo"
|
|
:placeholder="$t('stockRecord.inputLotNo')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="初始数量" prop="oldQuantity">
|
|
<el-input
|
|
v-model="queryParams.oldQuantity"
|
|
placeholder="请输入初始数量"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="操作后数量" prop="quantity">
|
|
<el-input
|
|
v-model="queryParams.quantity"
|
|
placeholder="请输入操作后数量"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>-->
|
|
<el-form-item :label="$t('stockRecord.method')" prop="method"> <!-- 操作 -->
|
|
<el-select v-model="queryParams.method" :placeholder="$t('stockRecord.selectMethod')" clearable>
|
|
|
|
<el-option
|
|
v-for="dict in dict.type.stock_maintain_method"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.warehouseId')" prop="warehouseId"> <!-- 仓库 -->
|
|
<el-select v-model="queryParams.warehouseId" :placeholder="$t('stockRecord.warehouseId')">
|
|
<el-option
|
|
v-for="item in warehouseOptions"
|
|
:key="item.warehouseId"
|
|
:label="item.warehouseName"
|
|
:value="item.warehouseId"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="库存字表id" prop="stockDetailId">
|
|
<el-input
|
|
v-model="queryParams.stockDetailId"
|
|
placeholder="请输入库存字表id"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="操作目标" prop="operatingTarget">
|
|
<el-input
|
|
v-model="queryParams.operatingTarget"
|
|
placeholder="请输入操作目标"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="条码数量" prop="barCodeOldQuantity">
|
|
<el-input
|
|
v-model="queryParams.barCodeOldQuantity"
|
|
placeholder="请输入条码数量"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="条码数量" prop="barCodeQuantity">
|
|
<el-input
|
|
v-model="queryParams.barCodeQuantity"
|
|
placeholder="请输入条码数量"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="物料guid" prop="productGuid">
|
|
<el-input
|
|
v-model="queryParams.productGuid"
|
|
placeholder="请输入物料guid"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>-->
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('stockRecord.search')}}</el-button> <!-- 搜索 -->
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('stockRecord.reset')}}</el-button> <!-- 重置 -->
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<!-- <el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
v-hasPermi="['stock:record:add']"
|
|
>新增</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="success"
|
|
plain
|
|
icon="el-icon-edit"
|
|
size="mini"
|
|
:disabled="single"
|
|
@click="handleUpdate"
|
|
v-hasPermi="['stock:record:edit']"
|
|
>修改</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="el-icon-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
v-hasPermi="['stock:record:remove']"
|
|
>删除</el-button>
|
|
</el-col>-->
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="warning"
|
|
plain
|
|
icon="el-icon-download"
|
|
size="mini"
|
|
@click="handleExport"
|
|
v-hasPermi="['stock:record:export']"
|
|
>{{$t('stockRecord.export')}}</el-button> <!-- 导出 -->
|
|
</el-col>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column :label="$t('stockRecord.stockId')" align="center" prop="stockId" /> <!-- 库存编码 -->
|
|
<el-table-column :label="$t('stockRecord.cargoSpaceId')" align="center" prop="cargoSpaceId" /> <!-- 货位编码 -->
|
|
<el-table-column :label="$t('stockRecord.cargoSpaceName')" align="center" prop="cargoSpaceName" /> <!-- 货位编码 -->
|
|
<el-table-column :label="$t('stockRecord.trayCode')" align="center" prop="trayCode" /> <!-- 托盘条码 -->
|
|
<el-table-column :label="$t('stockRecord.productId')" align="center" prop="productId" /> <!-- 物品编码 -->
|
|
<el-table-column :label="$t('stockRecord.productName')" align="center" prop="productName" /> <!-- 物品名称 -->
|
|
<!-- <el-table-column :label="$t('stockRecord.printDate')" align="center" prop="printDate" /> <!– 生产日期 –>-->
|
|
<el-table-column :label="$t('stockRecord.lotNo')" align="center" prop="lotNo" /> <!-- 批号 -->
|
|
<el-table-column :label="$t('stockRecord.oldQuantity')" align="center" prop="oldQuantity" /> <!-- 初始数量 -->
|
|
<el-table-column :label="$t('stockRecord.quantity')" align="center" prop="quantity" /> <!-- 操作后数量 -->
|
|
<el-table-column :label="$t('stockRecord.method')" align="center" prop="method"> <!-- 操作 -->
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.stock_maintain_method" :value="scope.row.method"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('stockRecord.warehouseId')" align="center" prop="warehouseName" /> <!-- 仓库 -->
|
|
<el-table-column :label="$t('stockRecord.createTime')" align="center" prop="createTime" /> <!-- 创建时间 -->
|
|
<!-- <el-table-column :label="$t('stockRecord.stockDetailId')" align="center" prop="stockDetailId" /> <!– 库存字表id –>-->
|
|
<!-- <el-table-column :label="$t('stockRecord.operatingTarget')" align="center" prop="operatingTarget" /> <!– 操作目标 –>-->
|
|
<!-- <el-table-column :label="$t('stockRecord.barCodeOldQuantity')" align="center" prop="barCodeOldQuantity" /> <!– 条码数量 –>-->
|
|
<!-- <el-table-column :label="$t('stockRecord.barCodeQuantity')" align="center" prop="barCodeQuantity" /> <!– 条码数量 –>-->
|
|
<!-- <el-table-column :label="$t('stockRecord.productGuid')" align="center" prop="productGuid" /> <!– 物料guid –>-->
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="handleUpdate(scope.row)"
|
|
v-hasPermi="['stock:record:edit']"
|
|
>修改</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row)"
|
|
v-hasPermi="['stock:record:remove']"
|
|
>删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</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="$t('stockRecord.stockId')" prop="stockId"> <!-- 库存编码 -->
|
|
<el-input v-model="form.stockId" :placeholder="$t('stockRecord.inputStockId')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.cargoSpaceId')" prop="cargoSpaceId"> <!-- 货位编码 -->
|
|
<el-input v-model="form.cargoSpaceId" :placeholder="$t('stockRecord.inputCargoSpaceId')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.trayCode')" prop="trayCode"> <!-- 托盘条码 -->
|
|
<el-input v-model="form.trayCode" :placeholder="$t('stockRecord.inputTrayCode')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.productId')" prop="productId"> <!-- 物品编码 -->
|
|
<el-input v-model="form.productId" :placeholder="$t('stockRecord.inputProductId')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.productName')" prop="productName"> <!-- 物品名称 -->
|
|
<el-input v-model="form.productName" :placeholder="$t('stockRecord.inputProductName')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.printDate')" prop="printDate"> <!-- 生产日期 -->
|
|
<el-input v-model="form.printDate" :placeholder="$t('stockRecord.inputPrintDate')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.lotNo')" prop="lotNo"> <!-- 批号 -->
|
|
<el-input v-model="form.lotNo" :placeholder="$t('stockRecord.inputLotNo')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.oldQuantity')" prop="oldQuantity"> <!-- 初始数量 -->
|
|
<el-input v-model="form.oldQuantity" :placeholder="$t('stockRecord.inputOldQuantity')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.quantity')" prop="quantity"> <!-- 操作后数量 -->
|
|
<el-input v-model="form.quantity" :placeholder="$t('stockRecord.inputQuantity')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.method')" prop="method"> <!-- 操作 -->
|
|
<el-select v-model="form.method" :placeholder="$t('stockRecord.selectMethod')">
|
|
<el-option
|
|
v-for="dict in dict.type.stock_maintain_method"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.warehouseId')" prop="warehouseId"> <!-- 仓库 -->
|
|
<el-input v-model="form.warehouseId" :placeholder="$t('stockRecord.inputWarehouseId')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.stockDetailId')" prop="stockDetailId"> <!-- 库存字表id -->
|
|
<el-input v-model="form.stockDetailId" :placeholder="$t('stockRecord.inputStockDetailId')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.operatingTarget')" prop="operatingTarget"> <!-- 操作目标 -->
|
|
<el-input v-model="form.operatingTarget" :placeholder="$t('stockRecord.inputOperatingTarget')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.barCodeOldQuantity')" prop="barCodeOldQuantity"> <!-- 条码数量 -->
|
|
<el-input v-model="form.barCodeOldQuantity" :placeholder="$t('stockRecord.inputBarCodeOldQuantity')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.barCodeQuantity')" prop="barCodeQuantity"> <!-- 条码数量 -->
|
|
<el-input v-model="form.barCodeQuantity" :placeholder="$t('stockRecord.inputBarCodeQuantity')" />
|
|
</el-form-item>
|
|
<el-form-item :label="$t('stockRecord.productGuid')" prop="productGuid"> <!-- 物料guid -->
|
|
<el-input v-model="form.productGuid" :placeholder="$t('stockRecord.inputProductGuid')" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="submitForm">{{$t('stockRecord.confirm')}}</el-button> <!-- 确定 -->
|
|
<el-button @click="cancel">{{$t('stockRecord.cancel')}}</el-button> <!-- 取消 -->
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listRecord, getRecord, delRecord, addRecord, updateRecord, exportRecord } from "@/api/stock/record";
|
|
import {listWarehouse} from "@/api/bas/warehouse"
|
|
|
|
export default {
|
|
name: "Record",
|
|
dicts: ['stock_maintain_method'],
|
|
data() {
|
|
return {
|
|
// 遮罩层
|
|
loading: false,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 库存操作记录表格数据
|
|
recordList: [],
|
|
warehouseOptions:[],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
stockId: null,
|
|
cargoSpaceId: null,
|
|
trayCode: null,
|
|
productId: null,
|
|
productName: null,
|
|
printDate: null,
|
|
lotNo: null,
|
|
oldQuantity: null,
|
|
quantity: null,
|
|
method: null,
|
|
warehouseId: null,
|
|
stockDetailId: null,
|
|
operatingTarget: null,
|
|
barCodeOldQuantity: null,
|
|
barCodeQuantity: null,
|
|
productGuid: null
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
rules: {
|
|
stockId: [
|
|
{ required: true, message: this.$t('stockRecord.stockIdRequired'), trigger: "blur" }
|
|
],
|
|
cargoSpaceId: [
|
|
{ required: true, message: this.$t('stockRecord.cargoSpaceIdRequired'), trigger: "blur" }
|
|
],
|
|
trayCode: [
|
|
{ required: true, message: this.$t('stockRecord.trayCodeRequired'), trigger: "blur" }
|
|
],
|
|
productId: [
|
|
{ required: true, message: this.$t('stockRecord.productIdRequired'), trigger: "blur" }
|
|
],
|
|
productName: [
|
|
{ required: true, message: this.$t('stockRecord.productNameRequired'), trigger: "blur" }
|
|
],
|
|
printDate: [
|
|
{ required: true, message: this.$t('stockRecord.printDateRequired'), trigger: "blur" }
|
|
],
|
|
lotNo: [
|
|
{ required: true, message: this.$t('stockRecord.lotNoRequired'), trigger: "blur" }
|
|
],
|
|
oldQuantity: [
|
|
{ required: true, message: this.$t('stockRecord.oldQuantityRequired'), trigger: "blur" }
|
|
],
|
|
quantity: [
|
|
{ required: true, message: this.$t('stockRecord.quantityRequired'), trigger: "blur" }
|
|
],
|
|
method: [
|
|
{ required: true, message: this.$t('stockRecord.methodRequired'), trigger: "change" }
|
|
],
|
|
warehouseId: [
|
|
{ required: true, message: this.$t('stockRecord.warehouseIdRequired'), trigger: "blur" }
|
|
],
|
|
stockDetailId: [
|
|
{ required: true, message: this.$t('stockRecord.stockDetailIdRequired'), trigger: "blur" }
|
|
],
|
|
operatingTarget: [
|
|
{ required: true, message: this.$t('stockRecord.operatingTargetRequired'), trigger: "blur" }
|
|
],
|
|
barCodeOldQuantity: [
|
|
{ required: true, message: this.$t('stockRecord.barCodeOldQuantityRequired'), trigger: "blur" }
|
|
],
|
|
barCodeQuantity: [
|
|
{ required: true, message: this.$t('stockRecord.barCodeQuantityRequired'), trigger: "blur" }
|
|
],
|
|
productGuid: [
|
|
{ required: true, message: this.$t('stockRecord.productGuidRequired'), trigger: "blur" }
|
|
]
|
|
}
|
|
};
|
|
},
|
|
created() {
|
|
this.getList()
|
|
this.getWarehouseList();
|
|
},
|
|
methods: {
|
|
/** 获取仓库列表 */
|
|
getWarehouseList() {
|
|
listWarehouse().then(response => {
|
|
this.warehouseOptions = response.rows;
|
|
});
|
|
},
|
|
/** 查询库存操作记录列表 */
|
|
getList() {
|
|
this.loading = true;
|
|
listRecord(this.queryParams).then(response => {
|
|
this.recordList = response.rows;
|
|
this.total = response.total;
|
|
this.loading = false;
|
|
});
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false;
|
|
this.reset();
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
whGuid: null,
|
|
stockId: null,
|
|
cargoSpaceId: null,
|
|
trayCode: null,
|
|
productId: null,
|
|
productName: null,
|
|
printDate: null,
|
|
lotNo: null,
|
|
oldQuantity: null,
|
|
quantity: null,
|
|
method: null,
|
|
warehouseId: null,
|
|
createTime: null,
|
|
stockDetailId: null,
|
|
operatingTarget: null,
|
|
barCodeOldQuantity: null,
|
|
barCodeQuantity: null,
|
|
productGuid: null
|
|
};
|
|
this.resetForm("form");
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1;
|
|
this.getList();
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.resetForm("queryForm");
|
|
this.handleQuery();
|
|
},
|
|
// 多选框选中数据
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.whGuid)
|
|
this.single = selection.length!==1;
|
|
this.multiple = !selection.length;
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.reset();
|
|
this.open = true;
|
|
this.title = this.$t('stockRecord.addTitle');
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
this.reset();
|
|
const whGuid = row.whGuid || this.ids
|
|
getRecord(whGuid).then(response => {
|
|
this.form = response.data;
|
|
this.open = true;
|
|
this.title = this.$t('stockRecord.editTitle');
|
|
});
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (this.form.whGuid != null) {
|
|
updateRecord(this.form).then(response => {
|
|
this.$modal.msgSuccess(this.$t('stockRecord.editSuccess'));
|
|
this.open = false;
|
|
this.getList();
|
|
});
|
|
} else {
|
|
addRecord(this.form).then(response => {
|
|
this.$modal.msgSuccess(this.$t('stockRecord.addSuccess'));
|
|
this.open = false;
|
|
this.getList();
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const whGuids = row.whGuid || this.ids;
|
|
this.$modal.confirm(this.$t('stockRecord.confirmDelete', { whGuids: whGuids })).then(function() {
|
|
return delRecord(whGuids);
|
|
}).then(() => {
|
|
this.getList();
|
|
this.$modal.msgSuccess(this.$t('stockRecord.deleteSuccess'));
|
|
}).catch(() => {});
|
|
},
|
|
/** 导出按钮操作 */
|
|
handleExport() {
|
|
this.download('stock/record/export', {
|
|
...this.queryParams
|
|
}, `record_${new Date().getTime()}.xlsx`)
|
|
}
|
|
}
|
|
}
|
|
</script>
|