bonus-ui/src/views/material/report/goodsEntryReport.vue

681 lines
30 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 prop="dateRange">
<el-date-picker
v-model="dateRange"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item prop="keyWord">
<el-input
v-model="queryParams.keyWord"
placeholder="请输入关键词"
clearable
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</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-button type="warning" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList" ref="multipleTable" border :span-method="objectSpanMethod" :max-height="650">
<el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope">
<span v-if="scope.$index==0">合计:</span>
<span v-else>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index }}</span>
</template>
</el-table-column>
<el-table-column label="物资名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true"/>
<el-table-column label="采购数量" align="center" prop="purchaseNum" :show-overflow-tooltip="true">
<template scope="scope">
<!-- 当 manageType 为 '编码' 时,使用可点击的 span -->
<span class="clickText" v-if="scope.row.manageType=='0'" @click="openRecords(scope.row)">
{{ scope.row.purchaseNum }}
</span>
<!-- 否则,直接显示数字 -->
<span v-else>
{{ scope.row.purchaseNum }}
</span>
</template>
</el-table-column>
<el-table-column label="验收合格数量" align="center" prop="passNum" :show-overflow-tooltip="true">
<template scope="scope">
<!-- 当 manageType 为 '编码' 时,使用可点击的 span -->
<span class="clickText" v-if="scope.row.manageType=='0'" @click="openAcceptRecords(scope.row)">
{{ scope.row.passNum }}
</span>
<!-- 否则,直接显示数字 -->
<span v-else>
{{ scope.row.passNum }}
</span>
</template>
</el-table-column>
<el-table-column label="入库数量" align="center" prop="inputNum" :show-overflow-tooltip="true">
<template scope="scope">
<!-- 当 manageType 为 '编码' 时,使用可点击的 span -->
<span class="clickText" v-if="scope.row.manageType=='0'" @click="openInBoundRecords(scope.row)">
{{ scope.row.inputNum }}
</span>
<!-- 否则,直接显示数字 -->
<span v-else>
{{ scope.row.inputNum }}
</span>
</template>
</el-table-column>
<el-table-column label="待入库数量" align="center" prop="pendingInputNum" :show-overflow-tooltip="true">
<template scope="scope">
<!-- 当 manageType 为 '编码' 时,使用可点击的 span -->
<span class="clickText" v-if="scope.row.manageType=='0'" @click="openWaitRecords(scope.row)">
{{ scope.row.pendingInputNum }}
</span>
<!-- 否则,直接显示数字 -->
<span v-else>
{{ scope.row.pendingInputNum }}
</span>
</template>
</el-table-column>
<el-table-column label="采购价格(含税)" align="center" prop="purchasePrice" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(不含税)" align="center" prop="purchasePriceNoTax" :show-overflow-tooltip="true"/>
<el-table-column label="物资厂家" align="center" prop="supplierName" :show-overflow-tooltip="true"/>
<el-table-column label="采购时间" align="center" prop="purchaseTime" :show-overflow-tooltip="true"/>
<el-table-column label="验收时间" align="center" prop="passTime" :show-overflow-tooltip="true"/>
<el-table-column label="入库时间" align="center" prop="inputTime" :show-overflow-tooltip="true"/>
<el-table-column label="入库人员" align="center" prop="inputUser" :show-overflow-tooltip="true"/>
<el-table-column label="采购单号" align="center" prop="inputCode" :show-overflow-tooltip="true"/>
</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="openRecord" width="1200px" append-to-body>
<el-form :model="dialogQuery" ref="dialogQuery" size="small" :inline="true" label-width="80px">
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="dialogQuery.keyWord"
placeholder="请输入关键字"
clearable :maxlength="30"
style="width: 240px"/>
</el-form-item>
<el-form-item>
<el-button type="primary"
icon="el-icon-search" size="mini"
@click="handleDialogQuery"
>查询</el-button>
</el-form-item>
<el-form-item>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetDialogQuery"
>重置</el-button>
</el-form-item>
<el-form-item>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleDialogExport"
>导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogList" height="500px">
<el-table-column label="序号" align="center" width="80" type="index" :index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)">
</el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(含税)" align="center" prop="purchasePrice" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(不含税)" align="center" prop="purchasePriceNoTax" :show-overflow-tooltip="true"/>
</el-table>
<pagination
v-show="dialogTotal > 0"
:total="dialogTotal"
:page.sync="dialogQuery.pageNum"
:limit.sync="dialogQuery.pageSize"
@pagination="getDialogDataList"
/>
</el-dialog>
<!-- 验收合格数量弹窗 -->
<el-dialog :title="title" :visible.sync="openAcceptRecord" width="1200px" append-to-body>
<el-form :model="dialogAcceptQuery" ref="dialogAcceptQuery" size="small" :inline="true" label-width="80px">
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="dialogAcceptQuery.keyWord"
placeholder="请输入关键字"
clearable :maxlength="30"
style="width: 240px"/>
</el-form-item>
<el-form-item>
<el-button type="primary"
icon="el-icon-search" size="mini"
@click="handleAcceptQuery"
>查询</el-button>
</el-form-item>
<el-form-item>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetAcceptQuery"
>重置</el-button>
</el-form-item>
<el-form-item>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleAcceptExport"
>导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogAcceptList" height="500px">
<el-table-column label="序号" align="center" width="80" type="index" :index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)">
</el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(含税)" align="center" prop="purchasePrice" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(不含税)" align="center" prop="purchasePriceNoTax" :show-overflow-tooltip="true"/>
</el-table>
<pagination
v-show="dialogTotal > 0"
:total="dialogTotal"
:page.sync="dialogAcceptQuery.pageNum"
:limit.sync="dialogAcceptQuery.pageSize"
@pagination="getDialogAcceptDataList"
/>
</el-dialog>
<!-- 入库数量弹窗 -->
<el-dialog :title="title" :visible.sync="openInBoundRecord" width="1200px" append-to-body>
<el-form :model="dialogInBoundQuery" ref="dialogInBoundQuery" size="small" :inline="true" label-width="80px">
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="dialogInBoundQuery.keyWord"
placeholder="请输入关键字"
clearable :maxlength="30"
style="width: 240px"/>
</el-form-item>
<el-form-item>
<el-button type="primary"
icon="el-icon-search" size="mini"
@click="handleInBoundQuery"
>查询</el-button>
</el-form-item>
<el-form-item>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetInBoundQuery"
>重置</el-button>
</el-form-item>
<el-form-item>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleInBoundExport"
>导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogInBoundList" height="500px">
<el-table-column label="序号" align="center" width="80" type="index" :index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)">
</el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(含税)" align="center" prop="purchasePrice" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(不含税)" align="center" prop="purchasePriceNoTax" :show-overflow-tooltip="true"/>
</el-table>
<pagination
v-show="dialogTotal > 0"
:total="dialogTotal"
:page.sync="dialogInBoundQuery.pageNum"
:limit.sync="dialogInBoundQuery.pageSize"
@pagination="getDialogInBoundDataList"
/>
</el-dialog>
<!-- 待入库数量弹窗 -->
<el-dialog :title="title" :visible.sync="openWaitRecord" width="1200px" append-to-body>
<el-form :model="dialogWaitQuery" ref="dialogWaitQuery" size="small" :inline="true" label-width="80px">
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="dialogWaitQuery.keyWord"
placeholder="请输入关键字"
clearable :maxlength="30"
style="width: 240px"/>
</el-form-item>
<el-form-item>
<el-button type="primary"
icon="el-icon-search" size="mini"
@click="handleWaitQuery"
>查询</el-button>
</el-form-item>
<el-form-item>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetWaitQuery"
>重置</el-button>
</el-form-item>
<el-form-item>
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleWaitExport"
>导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogWaitList" height="500px">
<el-table-column label="序号" align="center" width="80" type="index" :index="indexContinuation(dialogQuery.pageNum, dialogQuery.pageSize)">
</el-table-column>
<el-table-column label="机具名称" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true"/>
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(含税)" align="center" prop="purchasePrice" :show-overflow-tooltip="true"/>
<el-table-column label="采购价格(不含税)" align="center" prop="purchasePriceNoTax" :show-overflow-tooltip="true"/>
</el-table>
<pagination
v-show="dialogTotal > 0"
:total="dialogTotal"
:page.sync="dialogWaitQuery.pageNum"
:limit.sync="dialogWaitQuery.pageSize"
@pagination="getDialogWaitDataList"
/>
</el-dialog>
</div>
</template>
<script>
import { getPurChaseReportListApi,getPurChaseReportListNoPageApi,getPurChaseReportDetailsListApi,
getPurChaseReportSuccessListApi,getPurChaseReportInBoundListApi,getPurChaseReportNotInBoundListApi } from "@/api/report/report";
export default {
name: "GoodsEntryReport",
data() {
return {
// 遮罩层
loading: false,
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
showHouse: false,
dateRange:[],
ids:[],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord:undefined,
},
// 总条数
total: 0,
//表格数据
tableList: [],
// 弹出层标题
title: "",
//弹窗
openRecord: false,
openAcceptRecord: false,
openInBoundRecord: false,
openWaitRecord: false,
dialogList: [], //在库编码设备列表
dialogAcceptList: [], //验收合格设备列表
dialogInBoundList: [], //入库设备列表
dialogWaitList: [], //待入库设备列表
dialogQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined,
},
dialogAcceptQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined,
},
dialogInBoundQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined,
},
dialogWaitQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined,
},
dialogTotal: 0,
};
},
created() {
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.dateRange = [this.format(start), this.format(end)]
this.getList()
},
methods: {
format(date) {
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
},
// 合并单元格 rowIndex=行数 columnIndex=列数
// 这里是合并table的除表头外的第一行的第二列 + 除表头外的第二行的第二列
// 注意列数和行数从 0 开始
objectSpanMethod ({ row, column, rowIndex, columnIndex }) {
if (rowIndex === 0 && columnIndex == 0) {
let rowspan = 1
let colspan = 4
return { rowspan, colspan }
}
// 解决偏移的重要代码
// 重点在 else if 判断必须加因为合并单元格数据会出现偏移、
// 否则如果是 第二行 的 第二列 那么隐藏原有第二行 的 第二列的数据使他隐藏
else if (rowIndex === 0 && columnIndex < 4) {
return {
rowspan: 0,
colspan: 0
}
}
},
/** 查询列表 */
async getList() {
this.loading = true
const params = {
keyWord: this.queryParams.keyWord,
startTime: this.dateRange && this.dateRange[0],
endTime: this.dateRange && this.dateRange[1],
pageSize: this.queryParams.pageSize,
pageNum: this.queryParams.pageNum
}
const res = await getPurChaseReportListApi(params)
if(res.data.rows.length>0){
this.tableList = res.data.rows;
}else{
this.tableList=[]
}
this.total = res.data.total;
let param = {
keyWord: this.queryParams.keyWord,
startTime: this.dateRange && this.dateRange[0],
endTime: this.dateRange && this.dateRange[1],
}
const response = await getPurChaseReportListNoPageApi(param)
let obj = {
purchaseNum: response.data.purchaseNum||0,//采购数量
passNum: response.data.passNum||0,//验收合格数量
inputNum: response.data.inputNum||0,//验收合格数量
purchasePrice: response.data.purchasePrice||0,//采购价格(含税)
purchasePriceNoTax: response.data.purchasePriceNoTax||0,//采购价格(不含税)
pendingInputNum: response.data.pendingInputNum||0,//待入库数量
}
this.tableList.unshift(obj)
this.loading = false
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
const end = new Date()
let start = new Date()
start.setMonth(start.getMonth() - 1)
this.dateRange = [this.format(start), this.format(end)]
this.queryParams.keyWord=null;
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
handleExport() {
const formatTime = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
};
const currentTime = formatTime(new Date());
this.download(
"/material/bm_report/exportPurChaseReportList",
{keyWord: this.queryParams.keyWord,startTime: this.dateRange && this.dateRange[0],endTime: this.dateRange && this.dateRange[1]},
`新购入库报表_${currentTime}.xlsx`
);
},
//查看弹框数据
openRecords(row) {
this.openRecord = true
this.dialogQuery.keyWord = ""
this.dialogQuery.taskId = row.taskId;
this.dialogQuery.typeId = row.typeId;
this.getDialogDataList()
},
//验收合格数量
openAcceptRecords(row) {
this.openAcceptRecord = true
this.dialogAcceptQuery.keyWord = ""
this.dialogAcceptQuery.taskId = row.taskId;
this.dialogAcceptQuery.typeId = row.typeId;
this.getDialogAcceptDataList()
},
//入库数量
openInBoundRecords(row) {
this.openInBoundRecord = true
this.dialogInBoundQuery.keyWord = ""
this.dialogInBoundQuery.taskId = row.taskId;
this.dialogInBoundQuery.typeId = row.typeId;
this.getDialogInBoundDataList()
},
//待入库数量
openWaitRecords(row) {
this.openWaitRecord = true
this.dialogWaitQuery.keyWord = ""
this.dialogWaitQuery.taskId = row.taskId;
this.getDialogWaitDataList()
},
/** 查询采购数量弹框列表 */
getDialogDataList() {
getPurChaseReportDetailsListApi(this.dialogQuery).then((response) => {
this.dialogList = response.data.rows
this.dialogTotal = response.data.total
})
},
/** 查询验收合格数量弹框列表 */
getDialogAcceptDataList() {
getPurChaseReportSuccessListApi(this.dialogAcceptQuery).then((response) => {
this.dialogAcceptList = response.data.rows
this.dialogTotal = response.data.total
})
},
/** 查询入库数量弹框列表 */
getDialogInBoundDataList() {
getPurChaseReportInBoundListApi(this.dialogInBoundQuery).then((response) => {
this.dialogInBoundList = response.data.rows
this.dialogTotal = response.data.total
})
},
/** 查询待入库数量弹框列表 */
getDialogWaitDataList() {
getPurChaseReportNotInBoundListApi(this.dialogWaitQuery).then((response) => {
this.dialogWaitList = response.data.rows
this.dialogTotal = response.data.total
})
},
/** 弹框搜索操作 */
handleDialogQuery() {
this.dialogQuery.pageNum = 1
this.getDialogDataList()
},
handleAcceptQuery() {
this.dialogAcceptQuery.pageNum = 1
this.getDialogAcceptDataList()
},
handleInBoundQuery() {
this.dialogInBoundQuery.pageNum = 1
this.getDialogInBoundDataList()
},
handleWaitQuery() {
this.dialogWaitQuery.pageNum = 1
this.getDialogWaitDataList()
},
/** 弹框重置操作 */
resetDialogQuery(){
this.dialogQuery.keyWord = "";
this.handleDialogQuery()
},
resetAcceptQuery(){
this.dialogAcceptQuery.keyWord = "";
this.handleAcceptQuery()
},
resetInBoundQuery(){
this.dialogInBoundQuery.keyWord = "";
this.handleInBoundQuery()
},
resetWaitQuery(){
this.dialogWaitQuery.keyWord = "";
this.handleWaitQuery()
},
/** 弹框导出操作 */
handleDialogExport() {
const formatTime = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
};
const currentTime = formatTime(new Date());
this.download(
'material/bm_report/exportPurChaseReportDetailsList',
{ ...this.dialogQuery},
`新购入库报表_采购设备_${currentTime}.xlsx`,
)
},
handleAcceptExport() {
const formatTime = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
};
const currentTime = formatTime(new Date());
this.download(
'material/bm_report/exportPurChaseReportSuccessList',
{ ...this.dialogAcceptQuery},
`新购入库报表_验收合格设备_${currentTime}.xlsx`,
)
},
handleInBoundExport() {
const formatTime = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
};
const currentTime = formatTime(new Date());
this.download(
'material/bm_report/exportPurChaseReportInBoundList',
{ ...this.dialogInBoundQuery},
`新购入库报表_入库设备_${currentTime}.xlsx`,
)
},
handleWaitExport() {
const formatTime = (date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hours = String(date.getHours()).padStart(2, '0');
const minutes = String(date.getMinutes()).padStart(2, '0');
const seconds = String(date.getSeconds()).padStart(2, '0');
return `${year}${month}${day}_${hours}${minutes}${seconds}`;
};
const currentTime = formatTime(new Date());
this.download(
'material/bm_report/exportPurChaseReportNotInBoundList',
{ ...this.dialogWaitQuery},
`新购入库报表_待入库设备_${currentTime}.xlsx`,
)
},
}
};
</script>
<style lang="scss" scoped>
.image-type {
/* 旋转图片 */
transform: rotate(-90deg);
/* 确保旋转后的图片不会超出容器 */
max-width: 100%;
/* 保持图片的宽高比 */
width: 40px;
height: 80px;
}
.sign-type{
width: 80px;
height: 40px;
}
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.clickText {
color: #02a7f0;
cursor: pointer;
}
</style>