供应统计报表
This commit is contained in:
parent
e472d8042e
commit
6d80c4165d
|
|
@ -149,19 +149,23 @@ export function getOutRecordListApi(query) {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 供应统计表-列表
|
||||
export function getStatisticsListApi(query) {
|
||||
return request({
|
||||
url: '/material/complex_query/getStatisticsList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 供应统计表-详情
|
||||
export function getAllUsDetailsApi(query) {
|
||||
return request({
|
||||
url: '/material/complex_query/getAllUsDetails',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,337 @@
|
|||
<template>
|
||||
<div class="app-container" id="">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item prop="time">
|
||||
<el-date-picker
|
||||
v-model="queryParams.time"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
style="width: 240px"
|
||||
:unlink-panels="true"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item prop="keyWord">
|
||||
<el-input
|
||||
v-model="queryParams.keyWord"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
:maxlength="20"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="proName">
|
||||
<el-input
|
||||
v-model="queryParams.proName"
|
||||
placeholder="请输入工程名称"
|
||||
clearable
|
||||
:maxlength="20"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="typeName">
|
||||
<el-input
|
||||
v-model="queryParams.typeName"
|
||||
placeholder="请输入物资名称"
|
||||
clearable
|
||||
:maxlength="20"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</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" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<div style="font-weight: bolder">
|
||||
统计日期:
|
||||
<span v-if="queryParams.time">{{ queryParams.time[0] || '' }} 至 {{ queryParams.time[1] || '' }}</span>
|
||||
</div>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="tableList" :max-height="650">
|
||||
<el-table-column
|
||||
label="序号"
|
||||
align="center"
|
||||
width="80"
|
||||
type="index"
|
||||
:index="indexContinuation(queryParams.pageNum, queryParams.pageSize)"
|
||||
/>
|
||||
<el-table-column label="工程名称" align="center" prop="proName" min-width="160"/>
|
||||
<el-table-column label="物资名称" align="center" prop="typeName" />
|
||||
<el-table-column label="规格型号" align="center" prop="typeModelName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="需求数量" align="center" prop="needNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="已供数量(累计)" align="center" prop="supplyNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="差值(需求F-已供G)" align="center" prop="diffNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="在用数量" align="center" prop="usNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="库存数量" align="center" prop="storeNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="在修数量" align="center" prop="repairNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="待入库数量" align="center" prop="inputNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="总保有量" align="center" prop="allNum" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="总在用工程明细" align="center" prop="allUsNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.usNum > 0" class="clickText" @click="openUserRecords(scope.row)">
|
||||
{{ scope.row.usNum }}
|
||||
</span>
|
||||
<!-- 否则,直接显示数字 -->
|
||||
<span v-else>
|
||||
{{ scope.row.usNum }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="manageType" :show-overflow-tooltip="true" />
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:page-sizes="[5, 10, 15, 20, 30]"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 在用编码设备弹窗-->
|
||||
<el-dialog :title="title" :visible.sync="openUseRecord" width="1200px" append-to-body>
|
||||
<el-form :model="dialogUseQuery" ref="dialogUseQuery" size="small" :inline="true" label-width="80px">
|
||||
<el-form-item label="关键字" prop="keyWord">
|
||||
<el-input
|
||||
v-model="dialogUseQuery.keyWord"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
:maxlength="20"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleDialogUseQuery">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<!-- <el-button icon="el-icon-download" size="mini" @click="handleDialogUserExport">导出</el-button> -->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading2" :data="useRecordList" :max-height="650">
|
||||
<el-table-column
|
||||
label="序号"
|
||||
align="center"
|
||||
width="80"
|
||||
type="index"
|
||||
:index="indexContinuation(dialogUseQuery.pageNum, dialogUseQuery.pageSize)"
|
||||
></el-table-column>
|
||||
<el-table-column label="工程名称" align="center" prop="proName" width="200" />
|
||||
<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="usNum" :show-overflow-tooltip="true" />
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="dialogUserTotal > 0"
|
||||
:total="dialogUserTotal"
|
||||
:page.sync="dialogUseQuery.pageNum"
|
||||
:limit.sync="dialogUseQuery.pageSize"
|
||||
@pagination="getUserRecords"
|
||||
/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getStatisticsListApi, getAllUsDetailsApi } from '@/api/stquery/stquery'
|
||||
export default {
|
||||
name: 'DeviceStatusRecord',
|
||||
dicts: [],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
loading2: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 弹出层标题
|
||||
title: '查看',
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 主表格数据
|
||||
tableList: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
time: [],
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyWord: null,
|
||||
typeName: null, //物资名称
|
||||
proName: null
|
||||
},
|
||||
//在用弹窗
|
||||
openUseRecord: false,
|
||||
dialogUseQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyWord: undefined,
|
||||
typeId: undefined
|
||||
},
|
||||
useRecordList: [], //在用设备列表
|
||||
dialogUserTotal: 0
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const end = new Date()
|
||||
let start = new Date()
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
this.queryParams.time = [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}`
|
||||
},
|
||||
// 获取列表
|
||||
async getList() {
|
||||
try {
|
||||
this.loading = true
|
||||
const params = {
|
||||
keyWord: this.queryParams.keyWord,
|
||||
typeName: this.queryParams.typeName,
|
||||
typeModelName: this.queryParams.typeModelName,
|
||||
pageSize: this.queryParams.pageSize,
|
||||
pageNum: this.queryParams.pageNum,
|
||||
startTime: this.queryParams.time ? this.queryParams.time[0] : '',
|
||||
endTime: this.queryParams.time ? this.queryParams.time[1] : ''
|
||||
}
|
||||
const res = await getStatisticsListApi(params)
|
||||
if (res.data.rows.length > 0) {
|
||||
this.tableList = res.data.rows
|
||||
} else {
|
||||
this.tableList = []
|
||||
}
|
||||
this.total = res.data.total
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getList ~ error:', error)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
indexContinuationForTable(num, size) {
|
||||
let number = (num - 1) * size
|
||||
console.log(number)
|
||||
if (number == 0) {
|
||||
return '合计'
|
||||
} else {
|
||||
return number
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
const end = new Date()
|
||||
let start = new Date()
|
||||
start.setMonth(start.getMonth() - 1)
|
||||
this.queryParams.time = [this.format(start), this.format(end)]
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
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/complex_query/exportRetainedEquipmentList',
|
||||
{
|
||||
...this.queryParams
|
||||
},
|
||||
`供应统计报表_${currentTime}.xlsx`
|
||||
)
|
||||
},
|
||||
// ------------------
|
||||
//查看在用设备
|
||||
openUserRecords(row) {
|
||||
this.openUseRecord = true
|
||||
this.dialogUseQuery.typeId = row.typeId
|
||||
this.dialogUseQuery.keyWord = ''
|
||||
this.getUserRecords()
|
||||
},
|
||||
/** 查询在用设备列表 */
|
||||
getUserRecords() {
|
||||
this.loading2 = true
|
||||
getAllUsDetailsApi(this.dialogUseQuery)
|
||||
.then(response => {
|
||||
this.useRecordList = response.data.rows
|
||||
this.dialogUserTotal = response.data.total
|
||||
})
|
||||
.catch(() => {
|
||||
this.useRecordList = []
|
||||
this.dialogUserTotal = 0
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading2 = false
|
||||
})
|
||||
},
|
||||
/** 搜索在用按钮操作 */
|
||||
handleDialogUseQuery() {
|
||||
this.dialogUseQuery.pageNum = 1
|
||||
this.getUserRecords()
|
||||
},
|
||||
handleDialogUserExport() {
|
||||
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/complex_query/exportUserRecordList',
|
||||
{ ...this.dialogUseQuery },
|
||||
`供应统计报表_在用设备_${currentTime}.xlsx`
|
||||
)
|
||||
}
|
||||
// ------------------
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.el-table .fixed-width .el-button--mini {
|
||||
width: 60px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.clickText {
|
||||
color: #02a7f0;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -81,47 +81,47 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="在用数量" align="center" prop="usNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span class="clickText" @click="openUserRecords(scope.row)">
|
||||
<span v-if="scope.$index !== 0" class="clickText" @click="openUserRecords(scope.row)">
|
||||
{{ scope.row.usNum }}
|
||||
</span>
|
||||
<!-- 否则,直接显示数字 -->
|
||||
<!-- <span v-else>
|
||||
<span v-else>
|
||||
{{ scope.row.usNum }}
|
||||
</span> -->
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="在修数量" align="center" prop="repairNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span class="clickText" @click="openRepairRecords(scope.row)">
|
||||
<span v-if="scope.$index !== 0" class="clickText" @click="openRepairRecords(scope.row)">
|
||||
{{ scope.row.repairNum }}
|
||||
</span>
|
||||
<!-- 否则,直接显示数字 -->
|
||||
<!-- <span v-else>
|
||||
<span v-else>
|
||||
{{ scope.row.repairNum }}
|
||||
</span> -->
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="新购待入库数量" align="center" prop="inputNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span class="clickText" @click="openPurchaseRecords(scope.row)">
|
||||
<span v-if="scope.$index !== 0" class="clickText" @click="openPurchaseRecords(scope.row)">
|
||||
{{ scope.row.inputNum }}
|
||||
</span>
|
||||
<!-- 否则,直接显示数字 -->
|
||||
<!-- <span v-else>
|
||||
<span v-else>
|
||||
{{ scope.row.inputNum }}
|
||||
</span> -->
|
||||
</span>
|
||||
<!-- <span class="clickText" @click="openPurchaseRecords(scope.row)">{{ scope.row.inputNum }}</span> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="修试后待入库数量" align="center" prop="repairInputNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span class="clickText" @click="openTestedRecords(scope.row)">
|
||||
<span v-if="scope.$index !== 0" class="clickText" @click="openTestedRecords(scope.row)">
|
||||
{{ scope.row.repairInputNum }}
|
||||
</span>
|
||||
<!-- 否则,直接显示数字 -->
|
||||
<!-- <span v-else>
|
||||
<span v-else>
|
||||
{{ scope.row.repairInputNum }}
|
||||
</span> -->
|
||||
</span>
|
||||
<!-- <span class="clickText" @click="openTestedRecords(scope.row)">{{ scope.row.repairInputNum }}</span> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
</el-table-column> -->
|
||||
<el-table-column label="已审核报废数量" align="center" prop="scrapNum" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<span class="clickText" @click="openAuditedRecords(scope.row)">
|
||||
<span v-if="scope.$index !== 0" class="clickText" @click="openAuditedRecords(scope.row)">
|
||||
{{ scope.row.scrapNum }}
|
||||
</span>
|
||||
<!-- 否则,直接显示数字 -->
|
||||
|
|
|
|||
Loading…
Reference in New Issue