504 lines
16 KiB
Vue
504 lines
16 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('inReceiveStockin.stockinId')" prop="stockinId"><!--入库订单ID-->
|
|
<el-input
|
|
v-model="queryParams.stockinId"
|
|
:placeholder="$t('inReceiveStockin.inputstockinId')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('inReceiveStockin.materialDesc')" prop="materialDesc"><!--物料描述-->
|
|
<el-input
|
|
v-model="queryParams.materialDesc"
|
|
:placeholder="$t('inReceiveStockin.inputMaterialDesc')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item :label="$t('inReceiveStockin.inType')" prop="inType"><!--入库类型-->
|
|
<el-select v-model="queryParams.inType" :placeholder="$t('inReceiveStockin.selecInType')" clearable>
|
|
<el-option
|
|
v-for="dict in dict.type.in_bill_type"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('inReceiveStockin.status')" prop="status"><!--单据状态-->
|
|
<el-select v-model="queryParams.status" :placeholder="$t('inReceiveStockin.selectStatus')" >
|
|
<el-option
|
|
v-for="dict in dict.type.in_bill_status"
|
|
:key="dict.value"
|
|
:label="dict.label"
|
|
:value="dict.value"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item :label="$t('inReceiveStockin.warehouseId')" prop="warehouseId"><!--仓库-->
|
|
<el-select
|
|
v-model="queryParams.warehouseId"
|
|
:placeholder="$t('inReceiveStockin.selectWarehouseId')"
|
|
clearable
|
|
@change="handleQuery"
|
|
>
|
|
<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="$t('inReceiveStockin.supplierNo')" prop="supplierNo"><!--供应商编码-->
|
|
<el-input
|
|
v-model="queryParams.supplierNo"
|
|
:placeholder="$t('inReceiveStockin.inputSupplierNo')"
|
|
clearable
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('inReceiveStockin.search')}}</el-button><!--搜索-->
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('inReceiveStockin.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="single"
|
|
@click="handleInvalidated"
|
|
v-hasPermi="['in:stockIn:edit']"
|
|
>{{$t('inStockin.cancel')}}<!--单据作废-->
|
|
</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="['in:stockIn:edit']"
|
|
>{{$t('inStockin.examine')}}<!--单据审核-->
|
|
</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="['in:stockIn:edit']"
|
|
>{{$t('inStockin.confirm')}}<!--单据确认-->
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="info"
|
|
plain
|
|
icon="el-icon-download"
|
|
size="mini"
|
|
:disabled="detailMultiple"
|
|
@click="handleBarcodePrinting"
|
|
v-hasPermi="['in:stockIn:barcodePrinting']"
|
|
>{{$t('inStockin.printBarcode')}}<!--打印条码-->
|
|
</el-button>
|
|
</el-col>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table v-loading="loading" :data="stockInList" @selection-change="handleSelectionChange"
|
|
@row-click="handleRowClick">
|
|
<el-table-column type="selection" width="55" align="center"/>
|
|
<el-table-column label="GUID" align="center" prop="stockinGuid" v-if="false"/>
|
|
<el-table-column :label="$t('inReceiveStockin.stockinId')" align="left" prop="stockinId"/><!--入库订单-->
|
|
<el-table-column :label="$t('inReceiveStockin.inType')" align="left" prop="inType"><!--入库类型-->
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.in_bill_type" :value="scope.row.inType"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('inReceiveStockin.status')" align="left" prop="status"><!--单据状态-->
|
|
<template slot-scope="scope">
|
|
<dict-tag :options="dict.type.in_bill_status" :value="scope.row.status"/>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column :label="$t('inReceiveStockin.warehouseName')" align="left" prop="warehouseName"/><!--仓库-->
|
|
<el-table-column :label="$t('inReceiveStockin.supplierName')" align="left" prop="supplierName"/><!--供应商-->
|
|
<el-table-column :label="$t('inReceiveStockin.createManName')" align="left" prop="createManName"/><!--创建人-->
|
|
<el-table-column :label="$t('inReceiveStockin.departmentName')" align="left" prop="departmentName"/><!--部门-->
|
|
<el-table-column :label="$t('inReceiveStockin.createDate')" align="left" prop="createDate"/><!--建立时间-->
|
|
<el-table-column :label="$t('inStockin.finishDate')" align="left" 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="stockInDetailList" @selection-change="handleDetailSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column :label="$t('inReceiveStockin.stockinDetailId')" align="left" prop="stockinDetailId"/><!--子单ID-->
|
|
<el-table-column :label="$t('inReceiveStockin.stockinId')" align="left" prop="stockinId"/><!--主单ID-->
|
|
<el-table-column :label="$t('inReceiveStockin.productId')" align="left" prop="productId"/><!--物料编码-->
|
|
<el-table-column :label="$t('inReceiveStockin.materialDesc')" align="left" prop="extraField.materialDesc"/><!--物料描述-->
|
|
<el-table-column :label="$t('inReceiveStockin.englishDesc')" align="left" prop="extraField.englishDesc"/><!--英文描述-->
|
|
<el-table-column :label="$t('inReceiveStockin.cartonNo')" align="left" prop="extraField.cartonNo"/><!--箱号-->
|
|
<el-table-column :label="$t('inReceiveStockin.packingMethod')" align="left" prop="extraField.packingMethod"/><!--包装方式-->
|
|
<!-- <el-table-column :label="$t('inReceiveStockin.netWeight')" align="right" width="120px" prop="extraField.netWeight" /> <!–净重–>-->
|
|
<el-table-column :label="$t('inReceiveStockin.quantity')" align="right" prop="quantity"/><!--计划数量-->
|
|
<el-table-column :label="$t('inStockin.scanNum')" align="right" prop="scanNum"/><!--扫码数量-->
|
|
<el-table-column :label="$t('inStockin.assignNum')" align="right" prop="assignNum"/><!--实际数量-->
|
|
</el-table>
|
|
<pagination
|
|
v-show="detailTotal>0"
|
|
:total="detailTotal"
|
|
:page.sync="queryDetailParams.pageNum"
|
|
:limit.sync="queryDetailParams.pageSize"
|
|
@pagination="getDetailList"
|
|
/>
|
|
|
|
<!-- 打印模板 -->
|
|
<vue-easy-print v-show="true" ref="easyPrint2">
|
|
<div v-for="item in printData" :key="item.stockinDetailId" style="page-break-after:always" class="vue-easy-print">
|
|
<vue-qr :text='item.stockinDetailId' :size="150" :margin="10" :align-item="center" :correctLevel="2"></vue-qr>
|
|
<div>
|
|
<span class="num">{{ item.stockinDetailId }}</span>
|
|
</div>
|
|
</div>
|
|
</vue-easy-print>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
listStockIn,
|
|
getStockIn,
|
|
delStockIn,
|
|
addStockIn,
|
|
updateStockIn,
|
|
invalidatedStockIn,
|
|
reviewStockIn,
|
|
confirmationStockIn
|
|
} from "@/api/in/stockIn"
|
|
import {listStockInDetail, barcodePrinting} from "@/api/in/stockInDetail"
|
|
import {getLodop} from "@/plugins/LodopFuncs.js"
|
|
import {listWarehouse} from "@/api/bas/warehouse";
|
|
import vueEasyPrint from 'vue-easy-print'
|
|
import VueQr from 'vue-qr'
|
|
|
|
|
|
|
|
export default {
|
|
name: "StockIn",
|
|
dicts: ['bill_resource', 'in_bill_status', 'in_bill_type'],
|
|
components: {
|
|
vueEasyPrint,
|
|
VueQr
|
|
},
|
|
data() {
|
|
return {
|
|
// 遮罩层
|
|
loading: true,
|
|
detailLoading: true,
|
|
warehouseOptions:[],
|
|
// 选中数组
|
|
ids: [],
|
|
detailIds: [],
|
|
// 主表选中的数据
|
|
stockInListSelected: [],
|
|
stockInDetailListSelected: [],
|
|
printData:[],
|
|
// 非单个禁用
|
|
single: true,
|
|
detailSingle: true,
|
|
// 非多个禁用
|
|
multiple: true,
|
|
detailMultiple: true,
|
|
// 显示搜索条件
|
|
showSearch: true,
|
|
// 总条数
|
|
total: 0,
|
|
detailTotal: 0,
|
|
// 入库单据表格数据
|
|
stockInList: [],
|
|
// 入库单据子表表格数据
|
|
stockInDetailList: [],
|
|
// 弹出层标题
|
|
title: "",
|
|
// 是否显示弹出层
|
|
open: false,
|
|
// 查询参数
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
stockinId: null,
|
|
inType: null,
|
|
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,
|
|
spare4: null,
|
|
spare3: null,
|
|
spare5: null
|
|
},
|
|
queryDetailParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
stockinId: null
|
|
},
|
|
queryWarehouseParams:{
|
|
pageNum: 1,
|
|
pageSize: 99
|
|
},
|
|
// 表单参数
|
|
form: {},
|
|
// 表单校验
|
|
|
|
}
|
|
},
|
|
created() {
|
|
this.getList()
|
|
this.getWarehouseList()
|
|
},
|
|
methods: {
|
|
/** 获取仓库列表 */
|
|
getWarehouseList() {
|
|
listWarehouse(this.queryWarehouseParams).then(response => {
|
|
this.warehouseOptions = response.rows;
|
|
if (this.warehouseOptions.length > 0) {
|
|
this.handleQuery();
|
|
}
|
|
});
|
|
},
|
|
/** 查询入库单据列表 */
|
|
getList() {
|
|
this.loading = true
|
|
listStockIn(this.queryParams).then(response => {
|
|
this.stockInList = response.rows
|
|
this.total = response.total
|
|
this.loading = false
|
|
var length = this.stockInList.length;
|
|
if (length > 0) {
|
|
var data = this.stockInList.at(0);
|
|
this.getDetailList(data.stockinId);
|
|
} else {
|
|
this.stockInDetailList = []
|
|
this.detailLoading = false
|
|
}
|
|
})
|
|
},
|
|
// 取消按钮
|
|
cancel() {
|
|
this.open = false
|
|
this.reset()
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
stockinGuid: null,
|
|
stockinId: null,
|
|
inType: 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,
|
|
spare4: null,
|
|
spare3: 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.stockinGuid)
|
|
this.stockInListSelected = selection
|
|
this.single = selection.length !== 1
|
|
this.multiple = !selection.length
|
|
},
|
|
handleDetailSelectionChange(selection){
|
|
this.detailIds = selection.map(item => item.stockinDetailId)
|
|
this.stockInDetailListSelected = selection
|
|
this.detailSingle = selection.length !== 1
|
|
this.detailMultiple = !selection.length
|
|
},
|
|
/** 作废单据按钮操作 */
|
|
handleInvalidated(row){
|
|
let stockIn = this.stockInListSelected[0];
|
|
if (stockIn.status === "1") {
|
|
console.log(1)
|
|
let data = {
|
|
"stockinGuid": stockIn.stockinGuid,
|
|
"status":"5"
|
|
}
|
|
invalidatedStockIn(data).then(response => {
|
|
this.$modal.msgSuccess(this.$t('inStockin.invalidateSuccess'))
|
|
this.getList()
|
|
})
|
|
}else {
|
|
this.$modal.msgError(this.$t('inStockin.onlyUnreviewedCanInvalidate'))
|
|
}
|
|
|
|
},
|
|
/** 审核单据按钮操作 */
|
|
handleReview(row){
|
|
let stockIn = this.stockInListSelected[0];
|
|
if (stockIn.status !== "1") {
|
|
this.$modal.msgError(this.$t('inStockin.alreadyReviewed'))
|
|
return
|
|
}
|
|
if (stockIn.status === "1") {
|
|
let data = {
|
|
"stockinGuid": stockIn.stockinGuid,
|
|
"status":"2"
|
|
}
|
|
reviewStockIn(data).then(response => {
|
|
this.$modal.msgSuccess(this.$t('inStockin.reviewSuccess'))
|
|
this.getList()
|
|
})
|
|
}
|
|
},
|
|
/**确认单据按钮操作 */
|
|
handleConfirmation(row){
|
|
let stockIn = this.stockInListSelected[0];
|
|
if (stockIn.status === "3"){
|
|
let data = {
|
|
"stockinGuid": stockIn.stockinGuid,
|
|
"status":"4"
|
|
}
|
|
confirmationStockIn(data).then(response => {
|
|
this.$modal.msgSuccess(this.$t('inStockin.confirmSuccess'))
|
|
this.getList()
|
|
})
|
|
}else {
|
|
this.$modal.msgError(this.$t('inStockin.onlyUnconfirmedCanConfirm'))
|
|
}
|
|
},
|
|
/** 打印条码按钮操作 */
|
|
handleBarcodePrinting(row){
|
|
this.printData = this.stockInDetailListSelected
|
|
if (this.printData.length === 0) {
|
|
this.$modal.msgWarning(this.$t('inStockin.selectPrintData'))
|
|
return
|
|
}
|
|
this.$nextTick(() => {
|
|
setTimeout(() => {
|
|
this.$refs.easyPrint2.print()
|
|
}, 100)
|
|
})
|
|
},
|
|
getDetailList(stockinId) {
|
|
this.detailLoading = true;
|
|
this.queryDetailParams.stockinId = stockinId;
|
|
this.queryDetailParams.status = this.queryParams.status;
|
|
listStockInDetail(this.queryDetailParams).then(response => {
|
|
this.stockInDetailList = response.rows;
|
|
this.detailTotal = response.total;
|
|
this.detailLoading = false;
|
|
});
|
|
},
|
|
handleRowClick(selection) {
|
|
this.detailLoading = true;
|
|
this.queryDetailParams.stockinId = selection.stockinId;
|
|
listStockInDetail(this.queryDetailParams).then(response => {
|
|
this.stockInDetailList = response.rows;
|
|
this.detailTotal = response.total;
|
|
this.detailLoading = false;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.el-form-item >>> .el-form-item__label {
|
|
white-space: nowrap;
|
|
width: auto;
|
|
min-width: fit-content;
|
|
}
|
|
/* 打印样式 */
|
|
.vue-easy-print {
|
|
text-align: center;
|
|
}
|
|
|
|
.num {
|
|
display: block;
|
|
text-align: center;
|
|
font-size: 16px;
|
|
margin-top: 15px;
|
|
font-family: Arial, sans-serif;
|
|
}
|
|
|
|
.vue-qr {
|
|
display: block;
|
|
margin: 20px auto;
|
|
max-width: 100%;
|
|
}
|
|
|
|
@media print {
|
|
@page {
|
|
size: A4;
|
|
margin: 0;
|
|
}
|
|
|
|
body {
|
|
margin: 0;
|
|
}
|
|
|
|
.vue-easy-print {
|
|
padding: 20px;
|
|
}
|
|
|
|
.num {
|
|
font-size: 14px;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.vue-qr {
|
|
margin: 10px auto;
|
|
}
|
|
}
|
|
</style>
|