Files
FT501-WMS/ruoyi-ui/src/views/check/difference/index.vue
2025-06-05 16:02:04 +08:00

390 lines
15 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('checkDifference.checkStockDetailId')" prop="checkStockDetailId"> <!-- 盘点单据id -->
<el-input
v-model="queryParams.checkStockDetailId"
:placeholder="$t('checkDifference.inputCheckStockDetailId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkDifference.stockId')" prop="stockId"> <!-- 库存id -->
<el-input
v-model="queryParams.stockId"
:placeholder="$t('checkDifference.inputStockId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkDifference.trayCode')" prop="trayCode"> <!-- 托盘 -->
<el-input
v-model="queryParams.trayCode"
:placeholder="$t('checkDifference.inputTrayCode')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkDifference.cargoSpaceId')" prop="cargoSpaceId"> <!-- 货位id -->
<el-input
v-model="queryParams.cargoSpaceId"
:placeholder="$t('checkDifference.inputCargoSpaceId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkDifference.productId')" prop="productId"> <!-- 物料id -->
<el-input
v-model="queryParams.productId"
:placeholder="$t('checkDifference.inputProductId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkDifference.lotNo')" prop="lotNo"> <!-- 批次号 -->
<el-input
v-model="queryParams.lotNo"
:placeholder="$t('checkDifference.inputLotNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="供应商" prop="supplier">
<el-input
v-model="queryParams.supplier"
placeholder="请输入供应商"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户" prop="customer">
<el-input
v-model="queryParams.customer"
placeholder="请输入客户"
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="newQuantity">
<el-input
v-model="queryParams.newQuantity"
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('checkDifference.search')}}</el-button> <!-- 搜索 -->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('checkDifference.reset')}}</el-button> <!-- 重置 -->
</el-form-item>
</el-form>
<!-- <el-row :gutter="10" class="mb8">-->
<!--&lt;!&ndash; <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['check:difference: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="['check:difference: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="['check:difference:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>&ndash;&gt;-->
<!--&lt;!&ndash; <el-col :span="1.5">&ndash;&gt;-->
<!--&lt;!&ndash; <el-button&ndash;&gt;-->
<!--&lt;!&ndash; type="warning"&ndash;&gt;-->
<!--&lt;!&ndash; plain&ndash;&gt;-->
<!--&lt;!&ndash; icon="el-icon-download"&ndash;&gt;-->
<!--&lt;!&ndash; size="mini"&ndash;&gt;-->
<!--&lt;!&ndash; @click="handleExport"&ndash;&gt;-->
<!--&lt;!&ndash; v-hasPermi="['check:difference:export']"&ndash;&gt;-->
<!--&lt;!&ndash; >导出</el-button>&ndash;&gt;-->
<!--&lt;!&ndash; </el-col>&ndash;&gt;-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!-- </el-row>-->
<el-table v-loading="loading" :data="differenceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('checkDifference.checkGuid')" align="center" prop="checkGuid" /> <!-- 盘点id -->
<el-table-column :label="$t('checkDifference.checkStockDetailId')" align="center" prop="checkStockDetailId" /> <!-- 盘点单据id -->
<el-table-column :label="$t('checkDifference.stockId')" align="center" prop="stockId" /> <!-- 库存id -->
<el-table-column :label="$t('checkDifference.trayCode')" align="center" prop="trayCode" /> <!-- 托盘 -->
<el-table-column :label="$t('checkDifference.cargoSpaceId')" align="center" prop="cargoSpaceId" /> <!-- 货位id -->
<el-table-column :label="$t('checkDifference.productId')" align="center" prop="productId" /> <!-- 物料id -->
<el-table-column :label="$t('checkDifference.lotNo')" align="center" prop="lotNo" /> <!-- 批次号 -->
<el-table-column :label="$t('checkDifference.supplier')" align="center" prop="supplier" /> <!-- 供应商 -->
<el-table-column :label="$t('checkDifference.customer')" align="center" prop="customer" /> <!-- 客户 -->
<el-table-column :label="$t('checkDifference.oldQuantity')" align="center" prop="oldQuantity" /> <!-- 原值 -->
<el-table-column :label="$t('checkDifference.newQuantity')" align="center" prop="newQuantity" /> <!-- 新值 -->
<el-table-column :label="$t('checkDifference.recordType')" align="center" prop="recordType" /> <!-- 操作方式 -->
<el-table-column :label="$t('checkDifference.productGuid')" align="center" prop="productGuid" /> <!-- 物料guid -->
<el-table-column :label="$t('checkDifference.operation')" 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="['check:difference:edit']"
>{{$t('checkDifference.edit')}}</el-button> <!-- 修改 -->
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['check:difference:remove']"
>{{$t('checkDifference.delete')}}</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('checkDifference.checkStockDetailId')" prop="checkStockDetailId"> <!-- 盘点单据id -->
<el-input v-model="form.checkStockDetailId" :placeholder="$t('checkDifference.inputCheckStockDetailId')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.stockId')" prop="stockId"> <!-- 库存id -->
<el-input v-model="form.stockId" :placeholder="$t('checkDifference.inputStockId')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.trayCode')" prop="trayCode"> <!-- 托盘 -->
<el-input v-model="form.trayCode" :placeholder="$t('checkDifference.inputTrayCode')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.cargoSpaceId')" prop="cargoSpaceId"> <!-- 货位id -->
<el-input v-model="form.cargoSpaceId" :placeholder="$t('checkDifference.inputCargoSpaceId')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.productId')" prop="productId"> <!-- 物料id -->
<el-input v-model="form.productId" :placeholder="$t('checkDifference.inputProductId')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.lotNo')" prop="lotNo"> <!-- 批次号 -->
<el-input v-model="form.lotNo" :placeholder="$t('checkDifference.inputLotNo')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.supplier')" prop="supplier"> <!-- 供应商 -->
<el-input v-model="form.supplier" :placeholder="$t('checkDifference.inputSupplier')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.customer')" prop="customer"> <!-- 客户 -->
<el-input v-model="form.customer" :placeholder="$t('checkDifference.inputCustomer')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.oldQuantity')" prop="oldQuantity"> <!-- 原值 -->
<el-input v-model="form.oldQuantity" :placeholder="$t('checkDifference.inputOldQuantity')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.newQuantity')" prop="newQuantity"> <!-- 新值 -->
<el-input v-model="form.newQuantity" :placeholder="$t('checkDifference.inputNewQuantity')" />
</el-form-item>
<el-form-item :label="$t('checkDifference.productGuid')" prop="productGuid"> <!-- 物料guid -->
<el-input v-model="form.productGuid" :placeholder="$t('checkDifference.inputProductGuid')" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">{{$t('checkDifference.confirm')}}</el-button> <!-- 确定 -->
<el-button @click="cancel">{{$t('checkDifference.cancel')}}</el-button> <!-- 取消 -->
</div>
</el-dialog>
</div>
</template>
<script>
import { listDifference, getDifference, delDifference, addDifference, updateDifference } from "@/api/check/difference"
export default {
name: "Difference",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 盘点差异表格数据
differenceList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
checkStockDetailId: null,
stockId: null,
trayCode: null,
cargoSpaceId: null,
productId: null,
lotNo: null,
supplier: null,
customer: null,
oldQuantity: null,
newQuantity: null,
recordType: null,
productGuid: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询盘点差异列表 */
getList() {
this.loading = true
listDifference(this.queryParams).then(response => {
this.differenceList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
checkGuid: null,
checkStockDetailId: null,
stockId: null,
trayCode: null,
cargoSpaceId: null,
productId: null,
lotNo: null,
supplier: null,
customer: null,
oldQuantity: null,
newQuantity: null,
recordType: null,
createTime: 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.checkGuid)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加盘点差异"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const checkGuid = row.checkGuid || this.ids
getDifference(checkGuid).then(response => {
this.form = response.data
this.open = true
this.title = "修改盘点差异"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.checkGuid != null) {
updateDifference(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addDifference(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const checkGuids = row.checkGuid || this.ids
this.$modal.confirm('是否确认删除盘点差异编号为"' + checkGuids + '"的数据项?').then(function() {
return delDifference(checkGuids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('check/difference/export', {
...this.queryParams
}, `difference_${new Date().getTime()}.xlsx`)
}
}
}
</script>