材料站供需平衡表

This commit is contained in:
bb_pan 2025-09-28 13:56:19 +08:00
parent d14a5b4335
commit a101c16b51
2 changed files with 686 additions and 1 deletions

View File

@ -0,0 +1,675 @@
<template>
<div class="app-container" id="">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="70px">
<el-form-item label="分公司" prop="impUnitName">
<el-select
v-model="queryParams.impUnitName"
placeholder="请选择分公司"
clearable
filterable
style="width: 240px"
@change="handleImpUnitChange"
>
<el-option v-for="item in impUnitOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="项目部" prop="departName">
<el-select
v-model="queryParams.departName"
placeholder="请选择项目部"
clearable
filterable
style="width: 240px"
@change="handleDepartChange"
>
<el-option v-for="item in departOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="工程" prop="proName">
<el-select
v-model="queryParams.proName"
placeholder="请选择工程"
clearable
filterable
style="width: 240px"
@change="getTeamListAndSubUnit"
>
<el-option v-for="item in proOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<!-- <el-form-item label="分包单位" prop="subUnitName">
<el-select
v-model="queryParams.subUnitName"
placeholder="请选择分包单位"
clearable
filterable
style="width: 240px"
>
<el-option v-for="item in subUnitOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item> -->
<el-form-item label="物资名称" prop="typeName">
<el-select
v-model="queryParams.typeName"
placeholder="请选择物资名称"
clearable
filterable
style="width: 240px"
@change="handleMaModel"
>
<el-option v-for="item in materialNameList" :key="item.value" :label="item.label" :value="item.label" />
</el-select>
</el-form-item>
<el-form-item label="规格型号" prop="typeModelName">
<el-select
v-model="queryParams.typeModelName"
placeholder="请选择规格型号"
clearable
filterable
style="width: 240px"
>
<el-option v-for="item in materialModelList" :key="item.value" :label="item.label" :value="item.label" />
</el-select>
</el-form-item>
<el-form-item label="机具类型" prop="jiJuType">
<el-select v-model="queryParams.jiJuType" placeholder="请选择机具类型" clearable style="width: 240px">
<el-option label="施工机具" :value="1" />
<el-option label="安全工器具" :value="2" />
</el-select>
</el-form-item>
<el-form-item label="计量单位" prop="unitName">
<el-select
v-model="queryParams.unitName"
placeholder="请选择计量单位"
clearable
filterable
style="width: 240px"
>
<el-option v-for="item in unitNameList" :key="item.value" :label="item.label" :value="item.label" />
</el-select>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
<el-input
v-model="queryParams.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="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出数据</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableList" :span-method="objectSpanMethod" :max-height="650">
<el-table-column label="序号" align="center" 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
v-for="(column, index) in tableColumns"
:show-overflow-tooltip="!column.showTooltip"
:key="index"
:label="column.label"
:prop="column.prop"
:width="column.width"
align="center"
>
<template v-slot="{ row, $index }" v-if="column.prop === 'storeNum'">
<!-- manageType '编码' 使用可点击的 span -->
<!-- <span
class="clickText"
v-if="row.manageType == '编码' && row.storeNum > 0 && $index != 0"
@click="openRecords(row)"
>
{{ row.storeNum }}
</span> -->
<!-- 否则直接显示数字 -->
<span>{{ row.storeNum }}</span>
</template>
<template v-slot="{ row }" v-else-if="column.prop === 'usNum'">
<span v-if="row.usNum > 0 && $index != 0" class="clickText" @click="openUserRecords(row)">
{{ row.usNum }}
</span>
<!-- 否则直接显示数字 -->
<span v-else>{{ row.usNum }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
:page-sizes="[10, 20, 50, 100]"
@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-download" size="mini" @click="handleDialogStoreExport">导出</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="dialogList">
<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="buyPrice" :show-overflow-tooltip="true" />
<el-table-column label="设备编码" align="center" prop="maCode" :show-overflow-tooltip="true" />
<el-table-column label="操作人" align="center" prop="inputUser" :show-overflow-tooltip="true" />
<el-table-column label="入库时间" align="center" prop="inputTime" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="dialogTotal > 0"
:total="dialogTotal"
:page.sync="dialogQuery.pageNum"
:limit.sync="dialogQuery.pageSize"
@pagination="getStoreCodeList"
/>
</el-dialog>
<!-- 在用编码设备弹窗-->
<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="loading" :data="useRecordList">
<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="subUnit" :show-overflow-tooltip="true" />
<el-table-column label="班组名称" align="center" prop="teamName" :show-overflow-tooltip="true" />
<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="leaseNum" :show-overflow-tooltip="true" />
<el-table-column label="退料数量" align="center" prop="backNum" :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 {
getImpUnitListApi,
getDepartListByImpUnitApi,
getProListByDepartApi,
getTeamList,
getSubUnitList,
getStorageInfoListApi,
getUserRecordListApi,
getStoreNumAndUseListApi,
getRetainedEquipmentListNoPageApi
} from '@/api/materialsStation'
export default {
name: '',
dicts: [],
data() {
return {
//
loading: false,
//
ids: [],
//
title: '查看',
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
tableColumns: [
{ label: '工程名称', prop: 'proName', showTooltip: false },
{ label: '物资名称', prop: 'typeName' },
{ label: '规格型号', prop: 'typeModelName' },
{ label: '计量单位', prop: 'unitName' },
{ label: '业务需求数量', prop: 'num' },
{ label: '实际供应数量', prop: 'num' },
{ label: '在库数量', prop: 'storeNum' },
{ label: '在用数量', prop: 'usNum' }
],
//
tableList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: null,
departName: null,
proName: null,
subUnitName: null,
typeName: null, //
typeModelName: null, //
jiJuType: null // (1 2)
},
impUnitOptions: [], //
departOptions: [], //
proOptions: [], //
subUnitOptions: [], //
materialNameList: [], //
materialModelList: [], //
unitNameList: [
{ label: '计件', value: 0 },
{ label: '绳索', value: 1 }
], //
//
openRecord: false,
dialogList: [], //
dialogQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined
},
dialogTotal: 0,
//
openUseRecord: false,
dialogUseQuery: {
pageNum: 1,
pageSize: 10,
keyWord: undefined
},
useRecordList: [], //
dialogUserTotal: 0
}
},
created() {
const query = this.$route.query || {}
console.log('🚀 ~ created ~ query:', query)
this.queryParams.proId = query.proId || ''
this.queryParams.proCenter = query.proCenter || ''
this.getList()
},
methods: {
/** 获取分公司下拉 */
async getImpUnitOptions() {
try {
const res = await getImpUnitListApi() //
this.impUnitOptions = res.data.map(item => ({
label: item.impUnitName, //
value: item.impUnitName
}))
} catch (e) {
console.error('获取分公司下拉失败:', e)
}
},
/** 分公司选择变化,加载项目部 */
async handleImpUnitChange() {
this.queryParams.departName = null //
this.departOptions = [] //
try {
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName: this.queryParams.teamName,
subUnitName: this.queryParams.subUnitName
}
const res = await getDepartListByImpUnitApi(params)
this.departOptions = res.data.map(item => ({
label: item.departName, //
value: item.departName
}))
} catch (e) {
console.error('获取项目部下拉失败:', e)
}
},
/** 项目部选择变化,加载工程 */
async handleDepartChange() {
this.queryParams.proName = null //
this.proOptions = [] //
try {
//
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName: this.queryParams.teamName,
subUnitName: this.queryParams.subUnitName
}
const res = await getProListByDepartApi(params)
this.proOptions = res.data.map(item => ({
label: item.proName, //
value: item.proName
}))
} catch (e) {
console.error('获取工程下拉失败:', e)
}
},
/** 项目部选择变化,加载工程 */
async getTeamListAndSubUnit() {
this.queryParams.teamName = null //
this.teamOptions = [] //
try {
//
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName: this.queryParams.teamName,
subUnitName: this.queryParams.subUnitName
}
const res = await getTeamList(params)
this.teamOptions = res.data.map(item => ({
label: item.teamName, //
value: item.teamName
}))
} catch (e) {
console.error('获取班组下拉失败:', e)
}
this.queryParams.subUnitName = null //
this.subUnitOptions = [] //
try {
//
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName: this.queryParams.teamName,
subUnitName: this.queryParams.subUnitName
}
const res = await getSubUnitList(params)
this.subUnitOptions = res.data.map(item => ({
label: item.subUnitName,
value: item.subUnitName
}))
} catch (e) {
console.error('获取分包单位下拉失败:', e)
}
},
async getSubUnitList() {
this.queryParams.subUnitName = null //
this.subUnitOptions = [] //
try {
//
const params = {
impUnitName: this.queryParams.impUnitName, //
departName: this.queryParams.departName, //
proName: this.queryParams.proName,
teamName: this.queryParams.teamName,
subUnitName: this.queryParams.subUnitName
}
const res = await getSubUnitList(params)
this.subUnitOptions = res.data.map(item => ({
label: item.subUnitName,
value: item.subUnitName
}))
} catch (e) {
console.error('获取分包单位下拉失败:', e)
}
},
getDeviceType() {
getDeviceType({ level: 3, skipPermission: 1 }).then(response => {
let matNameRes = response.data
this.materialNameList = matNameRes.map(item => {
return {
label: item.typeName,
value: item.typeId
}
})
})
getDeviceType({ level: 4, skipPermission: 1 }).then(response => {
let matModelRes = response.data
this.materialModelList = matModelRes.map(item => {
return {
label: item.typeName,
value: item.typeId
}
})
})
},
// change
handleMaModel(e) {
this.queryParams.typeModelName = null
this.materialModelList = []
let typeId = null
if (!e) {
typeId = null
} else {
typeId = this.materialNameList.find(item => item.label == e).value
}
console.log('🚀 ~ handleMaModel ~ typeId:', typeId)
getDeviceType({ level: 4, skipPermission: 1, typeId }).then(response => {
let matModelRes = response.data
this.materialModelList = matModelRes.map(item => {
return {
label: item.typeName,
value: item.typeId
}
})
})
},
//
async getList() {
this.loading = true
const params = {
proId: this.queryParams.proId || '',
proCenter: this.queryParams.proCenter || '',
keyWord: this.queryParams.keyWord,
typeName: this.queryParams.typeName,
typeModelName: this.queryParams.typeModelName,
pageSize: this.queryParams.pageSize,
pageNum: this.queryParams.pageNum
}
try {
const res = await getStoreNumAndUseListApi(params)
this.tableList = res.data.rows || []
console.log('🚀 ~ getList ~ this.tableList:', this.tableList)
this.total = res.data.total || 0
let param = {
proId: this.queryParams.proId || '',
proCenter: this.queryParams.proCenter || '',
keyWord: this.queryParams.keyWord,
typeName: this.queryParams.typeName,
typeModelName: this.queryParams.typeModelName
}
const response = await getRetainedEquipmentListNoPageApi(param)
let obj = {
// storeNum manageType usNum repairNum inputNum repairInputNum allNum
storeNum: response.data.storeNum || 0,
usNum: response.data.usNum || 0,
repairNum: response.data.repairNum || 0,
inputNum: response.data.inputNum || 0,
repairInputNum: response.data.repairInputNum || 0,
pendingScrapNum: response.data.pendingScrapNum || 0,
scrapNum: response.data.scrapNum || 0,
allNum: response.data.allNum || 0,
totalPrice: response.data.totalPrice || 0,
fiveReplacementRate: response.data.fiveReplacementRate || 0,
tenReplacementRate: response.data.tenReplacementRate || 0,
tenPlusReplacementRate: response.data.tenPlusReplacementRate || 0,
manageType: response.data.manageType || ''
}
this.tableList.unshift(obj)
console.log(this.tableList)
this.loading = false
} catch (error) {
this.loading = false
}
},
indexContinuationForTable(num, size) {
let number = (num - 1) * size
console.log(number)
if (number == 0) {
return '合计'
} else {
return number
}
},
// rowIndex= columnIndex=
// table +
// 0
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (rowIndex === 0 && columnIndex == 0) {
let rowspan = 1
let colspan = 6
return { rowspan, colspan }
}
//
// else if
// 使
else if (rowIndex === 0 && columnIndex < 6) {
return {
rowspan: 0,
colspan: 0
}
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
/** 导出按钮操作 */
handleExport() {
this.download(
'material/material_maMachine/exportStoreNumAndUseList',
{
...this.queryParams
},
`站内库存查询_${new Date().getTime()}.xlsx`
)
},
//
openRecords(row) {
this.openRecord = true
this.dialogQuery.keyWord = ''
this.dialogQuery.typeId = row.typeId
this.dialogQuery.proId = row.proId
this.getStoreCodeList()
},
/** 查询在库编码列表 */
getStoreCodeList() {
getStorageInfoListApi(this.dialogQuery).then(response => {
this.dialogList = response.data.rows
this.dialogTotal = response.data.total
})
},
/** 搜索在库按钮操作 */
handleDialogQuery() {
this.dialogQuery.pageNum = 1
this.getStoreCodeList()
},
handleDialogStoreExport() {
this.download(
'material/material_maMachine/exportStorageInfo',
{ ...this.dialogQuery },
`站内库存查询_在库设备_${new Date().getTime()}.xlsx`
)
},
// ------------------
//
openUserRecords(row) {
this.openUseRecord = true
this.dialogUseQuery.typeId = row.typeId
this.dialogUseQuery.keyWord = ''
this.dialogUseQuery.proId = row.proId
this.getUserRecords()
},
/** 查询在用设备列表 */
getUserRecords() {
getUserRecordListApi(this.dialogUseQuery).then(response => {
this.useRecordList = response.data.rows
this.dialogUserTotal = response.data.total
})
},
/** 搜索在用按钮操作 */
handleDialogUseQuery() {
this.dialogUseQuery.pageNum = 1
this.getUserRecords()
},
handleDialogUserExport() {
this.download(
'material/material_maMachine/exportUserRecordList',
{ ...this.dialogUseQuery },
`站内库存查询_在用设备_${new Date().getTime()}.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>

View File

@ -67,12 +67,21 @@
style="width: 240px"
/>
</el-form-item>
<!-- <el-form-item label="领料人" prop="leasePerson" v-if="maForm.pickType == 1">
<el-input
v-model="maForm.leasePerson"
placeholder="请输入领料人"
disabled
maxlength="50"
style="width: 240px"
/>
</el-form-item> -->
<el-form-item label="联系电话" prop="relPhone">
<el-input
v-model="maForm.relPhone"
placeholder="请输入联系电话"
:disabled="isEdit"
:disabled="!isView"
clearable
maxlength="11"
style="width: 240px"
@ -418,6 +427,7 @@ export default {
},
mounted() {
this.getStandardConfigListApi()
console.log('🚀 ~ mounted ~ this.isView:', this.isView)
if (this.isEdit && this.isView == false) {
console.log('isEdit', this.isEdit)
this.taskId = this.editTaskId