511 lines
18 KiB
Vue
511 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="$t('checkStockCheck.stockCheckId')" prop="stockCheckId"> <!-- 盘点单据ID -->
|
|
<el-input
|
|
v-model="queryParams.stockCheckId"
|
|
:placeholder="$t('checkStockCheck.inputStockCheckId')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('checkStockCheck.checkType')" prop="checkType"> <!-- 盘库类型 -->
|
|
<el-select v-model="queryParams.checkType" :placeholder="$t('checkStockCheck.selectCheckType')" clearable>
|
|
<el-option
|
|
v-for="dict in dict.type.check_stock_type"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('checkStockCheck.status')" prop="status"> <!-- 状态 -->
|
|
<el-select v-model="queryParams.status" :placeholder="$t('checkStockCheck.selectStatus')" clearable>
|
|
<el-option
|
|
v-for="dict in dict.type.check_bill_status"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<!-- <el-form-item label="建立时间" prop="createDate">
|
|
<el-input
|
|
v-model="queryParams.createDate"
|
|
placeholder="请输入建立时间"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="创建人" prop="createManId">
|
|
<el-input
|
|
v-model="queryParams.createManId"
|
|
placeholder="请输入创建人"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>-->
|
|
<el-form-item :label="$t('checkStockCheck.warehouse')" prop="warehouseId"> <!-- 仓库 -->
|
|
<el-select v-model="queryParams.warehouseId" :placeholder="$t('checkStockCheck.selectWarehouse')" clearable>
|
|
<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=" 完成日期" prop="finishDate">
|
|
<el-input
|
|
v-model="queryParams.finishDate"
|
|
placeholder="请输入 完成日期"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="erp单号" prop="erpBill">
|
|
<el-input
|
|
v-model="queryParams.erpBill"
|
|
placeholder="请输入erp单号"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="单据来源" prop="stockSource">
|
|
<el-input
|
|
v-model="queryParams.stockSource"
|
|
placeholder="请输入单据来源"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="客户编码" prop="customerNo">
|
|
<el-input
|
|
v-model="queryParams.customerNo"
|
|
placeholder="请输入客户编码"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="班组编码" prop="classNo">
|
|
<el-input
|
|
v-model="queryParams.classNo"
|
|
placeholder="请输入班组编码"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="供应商编码" prop="supplierNo">
|
|
<el-input
|
|
v-model="queryParams.supplierNo"
|
|
placeholder="请输入供应商编码"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="备用字段1" prop="spare1">
|
|
<el-input
|
|
v-model="queryParams.spare1"
|
|
placeholder="请输入备用字段1"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="备用字段2" prop="spare2">
|
|
<el-input
|
|
v-model="queryParams.spare2"
|
|
placeholder="请输入备用字段2"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="备用字段3" prop="spare3">
|
|
<el-input
|
|
v-model="queryParams.spare3"
|
|
placeholder="请输入备用字段3"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="备用字段4" prop="spare4">
|
|
<el-input
|
|
v-model="queryParams.spare4"
|
|
placeholder="请输入备用字段4"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="备用字段5" prop="spare5">
|
|
<el-input
|
|
v-model="queryParams.spare5"
|
|
placeholder="请输入备用字段5"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>-->
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('checkStockCheck.search')}}</el-button> <!-- 搜索 -->
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('checkStockCheck.reset')}}</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-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleInvalidated"
|
|
v-hasPermi="['check:stockCheck:edit']"
|
|
>{{$t('checkStockCheck.invalidate')}}</el-button> <!-- 单据作废 -->
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
:disabled="single"
|
|
@click="handleReview"
|
|
v-hasPermi="['check:stockCheck:edit']"
|
|
>{{$t('checkStockCheck.review')}}</el-button> <!-- 单据审核 -->
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="success"
|
|
plain
|
|
icon="el-icon-edit"
|
|
size="mini"
|
|
:disabled="single"
|
|
@click="handleConfirmation"
|
|
v-hasPermi="['check:stockCheck:edit']"
|
|
>{{$t('checkStockCheck.confirm')}}</el-button> <!-- 单据确认 -->
|
|
</el-col>
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table v-loading="loading" :data="stockCheckList" @selection-change="handleSelectionChange" @row-click="handleRowClick">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<!-- <el-table-column label="GUID" align="center" prop="stockGuid" /> -->
|
|
<el-table-column :label="$t('checkStockCheck.stockCheckId')" align="center" prop="stockCheckId" /> <!-- 盘点单据ID -->
|
|
<el-table-column :label="$t('checkStockCheck.checkType')" align="center" prop="checkType"> <!-- 盘库类型 -->
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.check_stock_type" :value="scope.row.checkType"/>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column :label="$t('checkStockCheck.status')" align="center" prop="status" > <!-- 单据状态 -->
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.check_bill_status" :value="scope.row.status"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('checkStockCheck.warehouseId')" align="center" prop="warehouseId" /> <!-- 仓库ID -->
|
|
<el-table-column :label="$t('checkStockCheck.stockSource')" align="center" prop="stockSource" /> <!-- 单据来源 -->
|
|
<el-table-column :label="$t('checkStockCheck.departmentNo')" align="center" prop="departmentNo" /> <!-- 部门编码 -->
|
|
<el-table-column :label="$t('checkStockCheck.createManId')" align="center" prop="createManId" /> <!-- 创建人 -->
|
|
<el-table-column :label="$t('checkStockCheck.createDate')" align="center" prop="createDate" /> <!-- 建立时间 -->
|
|
<el-table-column :label="$t('checkStockCheck.finishDate')" align="center" prop="finishDate" /> <!-- 完成日期 -->
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total>0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
|
|
<el-table v-loading="detailLoading" :data="stockCheckDetailList" @selection-change="handleDetailSelectionChange">
|
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
|
<el-table-column :label="$t('checkStockCheck.detailId')" align="center" prop="stockCheckDetailId" /> <!-- 子单ID -->
|
|
<!-- <el-table-column label="主单GUID" align="center" prop="stockCheckGuid" /> -->
|
|
<el-table-column :label="$t('checkStockCheck.mainId')" align="center" prop="stockCheckId" /> <!-- 主单ID -->
|
|
<el-table-column :label="$t('checkStockCheck.lotNo')" align="center" prop="lotNo"/> <!-- 批次号 -->
|
|
<!-- <el-table-column label="物料ID" align="center" prop="productGuid"/>-->
|
|
<el-table-column :label="$t('checkStockCheck.productId')" align="center" prop="productId"/> <!-- 物料编码 -->
|
|
<el-table-column :label="$t('checkStockCheck.materialDesc')" align="center" prop="extraField.materialDesc"/> <!-- 物料描述 -->
|
|
<el-table-column :label="$t('checkStockCheck.englishDesc')" align="center" prop="extraField.englishDesc"/> <!-- 英文描述 -->
|
|
<el-table-column :label="$t('checkStockCheck.cartonNo')" align="center" prop="extraField.cartonNo"/> <!-- 箱号 -->
|
|
<el-table-column :label="$t('checkStockCheck.packingMethod')" align="center" prop="extraField.packingMethod"/> <!-- 包装方式 -->
|
|
<el-table-column :label="$t('checkStockCheck.quantity')" align="center" prop="quantity"/> <!-- 计划数量 -->
|
|
<el-table-column :label="$t('checkStockCheck.scanNum')" align="center" prop="scanNum"/> <!-- 扫码数量 -->
|
|
<el-table-column :label="$t('checkStockCheck.assignNum')" align="center" prop="assignNum"/> <!-- 实际数量 -->
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="detailTotal>0"
|
|
:total="detailTotal"
|
|
:page.sync="queryDetailParams.pageNum"
|
|
:limit.sync="queryDetailParams.pageSize"
|
|
@pagination="getDetailList"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { listStockCheck, getStockCheck, delStockCheck, addStockCheck, updateStockCheck } from "@/api/check/stockCheck"
|
|
import { listStockCheckDetail } from "@/api/check/stockCheckDetail"
|
|
import { listWarehouse } from "@/api/bas/warehouse"
|
|
|
|
export default {
|
|
name: "StockCheck",
|
|
dicts: ['check_stock_type', 'check_bill_status'],
|
|
data() {
|
|
return {
|
|
// 遮罩层
|
|
loading: true,
|
|
// 选中数组
|
|
ids: [],
|
|
// 非单个禁用
|
|
single: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
// 仓库选项列表
|
|
warehouseOptions: [],
|
|
// 盘库单据主信息表格数据
|
|
stockCheckList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 明细遮罩层
|
|
detailLoading: false,
|
|
// 明细选中数组
|
|
detailIds: [],
|
|
// 明细总条数
|
|
detailTotal: 0,
|
|
// 明细表格数据
|
|
stockCheckDetailList: [],
|
|
// 明细查询参数
|
|
queryDetailParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
stockCheckGuid: null,
|
|
status: null
|
|
},
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
stockCheckId: null,
|
|
checkType: '1',
|
|
createDate: null,
|
|
createManId: null,
|
|
status: '1',
|
|
warehouseId: null,
|
|
finishDate: null,
|
|
erpBill: null,
|
|
stockSource: null,
|
|
departmentNo: null,
|
|
customerNo: null,
|
|
classNo: null,
|
|
supplierNo: null,
|
|
spare1: null,
|
|
spare2: null,
|
|
spare3: null,
|
|
spare4: null,
|
|
spare5: null
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
rules: {
|
|
stockCheckId: [
|
|
{ required: true, message: this.$t('checkStockCheck.stockCheckIdRequired'), trigger: "blur" }
|
|
],
|
|
checkType: [
|
|
{ required: true, message: this.$t('checkStockCheck.checkTypeRequired'), trigger: "change" }
|
|
],
|
|
createDate: [
|
|
{ required: true, message: this.$t('checkStockCheck.createDateRequired'), trigger: "blur" }
|
|
],
|
|
status: [
|
|
{ required: true, message: this.$t('checkStockCheck.statusRequired'), trigger: "change" }
|
|
],
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.getList();
|
|
this.getWarehouseList();
|
|
},
|
|
methods: {
|
|
/** 行点击事件处理 */
|
|
handleRowClick(row) {
|
|
this.queryDetailParams.stockCheckGuid = row.stockGuid
|
|
this.queryDetailParams.status = row.status
|
|
this.getDetailList()
|
|
},
|
|
/** 查询盘库单据主信息列表 */
|
|
getList() {
|
|
this.loading = true
|
|
listStockCheck(this.queryParams).then(response => {
|
|
this.stockCheckList = response.rows
|
|
this.total = response.total
|
|
this.loading = false
|
|
// 获取列表后,自动点击第一行数据
|
|
if (this.stockCheckList.length > 0) {
|
|
this.handleRowClick(this.stockCheckList[0])
|
|
}
|
|
})
|
|
},
|
|
/** 查询仓库列表 */
|
|
getWarehouseList() {
|
|
listWarehouse().then(response => {
|
|
this.warehouseOptions = response.rows;
|
|
});
|
|
},
|
|
/** 查询明细列表 */
|
|
getDetailList() {
|
|
this.detailLoading = true
|
|
listStockCheckDetail(this.queryDetailParams).then(response => {
|
|
this.stockCheckDetailList = response.rows
|
|
this.detailTotal = response.total
|
|
this.detailLoading = false
|
|
})
|
|
},
|
|
/** 明细多选框选中数据 */
|
|
handleDetailSelectionChange(selection) {
|
|
this.detailIds = selection.map(item => item.stockCheckDetailId)
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false
|
|
this.reset()
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
stockGuid: null,
|
|
stockCheckId: null,
|
|
checkType: null,
|
|
createDate: null,
|
|
createManId: null,
|
|
status: null,
|
|
warehouseId: null,
|
|
finishDate: null,
|
|
erpBill: null,
|
|
stockSource: null,
|
|
departmentNo: null,
|
|
customerNo: null,
|
|
classNo: null,
|
|
supplierNo: null,
|
|
spare1: null,
|
|
spare2: null,
|
|
spare3: null,
|
|
spare4: null,
|
|
spare5: 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.stockGuid)
|
|
this.single = selection.length!==1
|
|
this.multiple = !selection.length
|
|
if (selection.length === 1) {
|
|
this.queryDetailParams.stockCheckGuid = selection[0].stockGuid
|
|
this.queryDetailParams.status = selection[0].status
|
|
this.getDetailList()
|
|
} else {
|
|
this.queryDetailParams.stockCheckGuid = null
|
|
this.stockCheckDetailList = []
|
|
this.detailTotal = 0
|
|
}
|
|
},
|
|
|
|
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs["form"].validate(valid => {
|
|
if (valid) {
|
|
if (this.form.stockGuid != null) {
|
|
updateStockCheck(this.form).then(response => {
|
|
this.$modal.msgSuccess(this.$t('checkStockCheck.editSuccess'))
|
|
this.open = false
|
|
this.getList()
|
|
})
|
|
} else {
|
|
addStockCheck(this.form).then(response => {
|
|
this.$modal.msgSuccess(this.$t('checkStockCheck.addSuccess'))
|
|
this.open = false
|
|
this.getList()
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
/** 作废按钮操作 */
|
|
handleInvalidated(row) {
|
|
let stockCheck = this.stockCheckList.find(item => item.stockGuid === (row.stockGuid || this.ids[0]));
|
|
if (stockCheck.status === "1") {
|
|
let data = {
|
|
"stockGuid": stockCheck.stockGuid,
|
|
"status": "5"
|
|
}
|
|
updateStockCheck(data).then(response => {
|
|
this.$modal.msgSuccess(this.$t('checkStockCheck.invalidateSuccess'))
|
|
this.getList()
|
|
})
|
|
} else {
|
|
this.$modal.msgError(this.$t('checkStockCheck.onlyUnreviewedCanInvalidate'))
|
|
}
|
|
},
|
|
/** 审核按钮操作 */
|
|
handleReview(row) {
|
|
let stockCheck = this.stockCheckList.find(item => item.stockGuid === (row?.stockGuid || this.ids[0]));
|
|
if (stockCheck.status === "2") {
|
|
this.$modal.msgError(this.$t('checkStockCheck.alreadyReviewed'))
|
|
return
|
|
}
|
|
if (stockCheck.status === "1") {
|
|
let data = {
|
|
"stockGuid": stockCheck.stockGuid,
|
|
"status": "2"
|
|
}
|
|
updateStockCheck(data).then(response => {
|
|
this.$modal.msgSuccess(this.$t('checkStockCheck.reviewSuccess'))
|
|
this.getList()
|
|
})
|
|
} else {
|
|
this.$modal.msgError(this.$t('checkStockCheck.onlyUnreviewedCanReview'))
|
|
}
|
|
},
|
|
/** 确认按钮操作 */
|
|
handleConfirmation(row) {
|
|
let stockCheck = this.stockCheckList.find(item => item.stockGuid === (row?.stockGuid || this.ids[0]));
|
|
if (stockCheck.status === "3") {
|
|
let data = {
|
|
"stockGuid": stockCheck.stockGuid,
|
|
"status": "4"
|
|
}
|
|
updateStockCheck(data).then(response => {
|
|
this.$modal.msgSuccess(this.$t('checkStockCheck.confirmSuccess'))
|
|
this.getList()
|
|
})
|
|
} else {
|
|
this.$modal.msgError(this.$t('checkStockCheck.onlyReviewedCanConfirm'))
|
|
}
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|