结算修改

This commit is contained in:
hongchao 2025-10-13 21:41:30 +08:00
parent b093220a70
commit 1911763394
3 changed files with 185 additions and 174 deletions

View File

@ -960,3 +960,22 @@ export function getApproveListApi(data) {
params: data params: data
}) })
} }
//材料站结算申请工程下拉
export function getClzProjectListApi(query) {
return request({
url: '/material/material_sltAgreementInfo/getClzProjectList',
method: 'get',
params: query
})
}
//材料站结算申请班组下拉
export function getClzTeamListApi(query) {
return request({
url: '/material/material_sltAgreementInfo/getClzTeamList',
method: 'get',
params: query
})
}

View File

@ -1,45 +1,48 @@
<template> <template>
<div class="app-container" id="costApplyList"> <div class="app-container" id="costApplyList">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px">
<el-form-item> <el-form-item label="结算工程">
<treeselect <el-select
ref="treeselectRef"
v-model="unitIds"
:options="unitList"
:normalizer="normalizer"
:show-count="true"
style="width: 300px"
:disable-branch-nodes="true"
noChildrenText="没有数据了"
noOptionsText="没有数据"
noResultsText="没有搜索结果"
placeholder="请选择结算班组"
@select="unitChange"
:multiple="true"
></treeselect>
</el-form-item>
<el-form-item prop="projectIds">
<treeselect
v-model="queryParams.projectId" v-model="queryParams.projectId"
:options="proList" placeholder="请选择工程"
:normalizer="normalizer" clearable
:show-count="true" filterable
style="width: 240px" style="width: 240px"
:disable-branch-nodes="true" @change="loadTeamList"
noChildrenText="没有数据了" >
noOptionsText="没有数据" <el-option
noResultsText="没有搜索结果" v-for="item in projectList"
placeholder="请选择结算工程" :key="item.value"
@select="proChange" :label="item.label"
:disabled="unitIds.length == 0" :value="item.value"
/> />
</el-form-item> </el-select>
</el-form-item>
<el-form-item label="结算班组">
<el-select
v-model="unitIds"
placeholder="请选择班组"
clearable
filterable
multiple
style="width: 240px"
@change="changeTeamId"
>
<el-option
v-for="item in teamList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item prop="agreementCode"> <el-form-item prop="agreementCode">
<el-tooltip content="协议编号" placement="top" :disabled="!queryParams.agreementCode"> <el-tooltip content="协议编号" placement="top" :disabled="!queryParams.agreementCode">
<template #content> <template #content>
{{ queryParams.agreementCode }} {{ queryParams.agreementCode }}
</template> </template>
<el-input v-model="queryParams.agreementCode" placeholder="请输入协议号" clearable /> <el-input v-model="queryParams.agreementCode" placeholder="请输入协议号" clearable disabled/>
</el-tooltip> </el-tooltip>
</el-form-item> </el-form-item>
<el-form-item prop="sltStatus"> <el-form-item prop="sltStatus">
@ -200,7 +203,9 @@
</template> </template>
<script> <script>
import { getUnitList } from '@/api/back/index.js' import {
getClzProjectListApi,getClzTeamListApi
} from '@/api/materialsStation'
import { getTeamList } from '@/api/materialsStation/auth.js' import { getTeamList } from '@/api/materialsStation/auth.js'
import { getClzSltAgreementInfo, getClzProjectListByUnitIds, getClzAgreementInfoById, getClzSltInfo } from '@/api/cost/cost' import { getClzSltAgreementInfo, getClzProjectListByUnitIds, getClzAgreementInfoById, getClzSltInfo } from '@/api/cost/cost'
import { toChineseAmount } from '@/utils/bonus.js' import { toChineseAmount } from '@/utils/bonus.js'
@ -224,19 +229,11 @@ export default {
multiple: true, multiple: true,
// //
total: 0, total: 0,
// //
unitList: [], teamList: [],
// //
proList: [], projectList: [],
unitIds: [], unitIds: [],
projectIds: null,
selectTreeProps: {
children: 'children',
label: 'name',
value: 'id',
multiple: true //false
},
// //
tableList: [], tableList: [],
// //
@ -268,62 +265,56 @@ export default {
} }
}, },
created() { created() {
this.GetUnitData() this.loadProjectList()
// this.GetProData() // this.GetProData()
this.getList() this.getList()
}, },
methods: { methods: {
/** 转换菜单数据结构 */
normalizer(node) { async loadProjectList() {
if (node.children && !node.children.length) { try {
delete node.children const res = await getClzProjectListApi({})
if (res.code === 200) {
// this.projectList = response.data || []
this.projectList = res.data.map(item => ({
label: item.proName, //
value: item.proId,
projectId: item.projectId
}))
}
} catch (error) {
console.error('获取工程列表失败:', error)
this.$message.error('获取工程列表失败')
} }
return {
id: node.id,
label: node.name,
children: node.children
}
},
//
async GetUnitData() {
const params = {
// projectId: this.queryParams.projectId /* */,
}
const res = await getTeamList(params)
this.unitList = res.data
if (this.queryParams.projectId) {
this.getAgreementInfo()
}
},
unitChange(val) {
console.log('Selected values:', val) //
console.log('xxxxxxxxx', this.queryParams.unitId)
console.log('yyyyyyyyy', this.unitIds)
// this.GetProData()
setTimeout(() => {
this.queryParams.projectId = null
this.queryParams.agreementId = null
this.queryParams.agreementCode = null
this.GetProData()
}, 500)
}, },
// //
async GetProData() { async loadTeamList() {
const unitIdsAsNumbers = this.unitIds.map(id => Number(id)) try {
const params = { this.queryParams.agreementId = null
unitIds: unitIdsAsNumbers this.queryParams.agreementCode = null
const params = {
proId: this.queryParams.projectId,
}
const res = await getClzTeamListApi(params)
if (res.code === 200) {
// this.teamList = response.data || []
this.teamList = res.data.map(item => ({
label: item.unitName, //
value: item.unitId
}))
}
} catch (error) {
console.error('获取班组列表失败:', error)
this.$message.error('获取班组列表失败')
} }
const res = await getClzProjectListByUnitIds(params)
this.proList = res.data },
this.getAgreementInfo() async changeTeamId() {
await this.getAgreementInfo()
}, },
proChange(val) {
setTimeout(() => { // id
this.GetUnitData()
}, 500)
},
// id
async getAgreementInfo() { async getAgreementInfo() {
if (this.unitIds && this.unitIds.length > 0 && this.queryParams.projectId) { if (this.unitIds && this.unitIds.length > 0 && this.queryParams.projectId) {
const params = { const params = {
@ -334,16 +325,16 @@ export default {
console.log(res) console.log(res)
if (!res.data && res.data.some(item => !item.agreementId)) { if (!res.data && res.data.some(item => !item.agreementId)) {
this.$message.error('当前单位和工程无协议!') this.$message.error('当前单位和工程无协议!')
this.queryParams.unitId = null this.unitIds = []
this.queryParams.projectId = null this.queryParams.projectId = null
this.GetUnitData() this.loadProjectList()
this.GetProData()
} else { } else {
this.queryParams.agreementId = res.data.map(item => item.agreementId) this.queryParams.agreementId = res.data.map(item => item.agreementId)
this.queryParams.agreementCode = res.data.map(item => item.agreementCode).join(',') this.queryParams.agreementCode = res.data.map(item => item.agreementCode).join(',')
} }
} }
}, },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true this.loading = true
@ -369,7 +360,6 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.unitIds = [] this.unitIds = []
this.projectIds = []
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,

View File

@ -3,35 +3,40 @@
<!-- 操作栏 --> <!-- 操作栏 -->
<div class="operation-bar"> <div class="operation-bar">
<el-form :inline="true" label-width="80px" style="margin-bottom: 20px;"> <el-form :inline="true" label-width="80px" style="margin-bottom: 20px;">
<el-form-item label="结算班组"> <el-form-item label="结算工程">
<treeselect <el-select
v-model="selectedTeams" v-model="selectedProject"
:options="teamList" placeholder="请选择工程"
:normalizer="normalizer" clearable
:show-count="true" filterable
style="width: 300px" style="width: 240px"
:disable-branch-nodes="true" @change="loadTeamList"
noChildrenText="没有数据了" >
noOptionsText="没有数据" <el-option
noResultsText="没有搜索结果" v-for="item in projectList"
placeholder="请选择结算班组" :key="item.value"
:multiple="true" :label="item.label"
></treeselect> :value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="结算工程"> <el-form-item label="结算班组">
<treeselect <el-select
v-model="selectedProject" v-model="selectedTeams"
:options="projectList" placeholder="请选择班组"
:normalizer="normalizer" clearable
:show-count="true" filterable
style="width: 300px" multiple
:disable-branch-nodes="true" style="width: 240px"
noChildrenText="没有数据了" >
noOptionsText="没有数据" <el-option
noResultsText="没有搜索结果" v-for="item in teamList"
placeholder="请选择结算工程" :key="item.value"
/> :label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -73,10 +78,16 @@
{{ projectName || '请先选择工程并查询' }} {{ projectName || '请先选择工程并查询' }}
</div> </div>
</div> </div>
<div class="tabelAllTopUnit">
<div class="costTopUnit">出场时间</div>
<div class="costRightUnit">
{{ actualTimeAndName || '请先选择班组并查询' }}
</div>
</div>
<!-- 租赁费用明细 --> <!-- 租赁费用明细 -->
<el-table :data="leaseList"> <el-table :data="leaseList" max-height="500px">
<el-table-column label="租赁费用明细" align="center"> <el-table-column label="租赁费用明细" align="center" >
<el-table-column label="序号" align="center" type="index" width="60" /> <el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" /> <el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" /> <el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
@ -87,18 +98,10 @@
{{ scope.row.leasePrice.toFixed(2) }} {{ scope.row.leasePrice.toFixed(2) }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="租赁数量" align="center" prop="num" :show-overflow-tooltip="true"> <el-table-column label="租赁数量" align="center" prop="num" :show-overflow-tooltip="true"/>
<template slot-scope="scope" v-show="scope.row.num">
{{ scope.row.num.toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="租赁日期" align="center" prop="startTime" :show-overflow-tooltip="true" /> <el-table-column label="租赁日期" align="center" prop="startTime" :show-overflow-tooltip="true" />
<el-table-column label="归还日期 " align="center" prop="endTime" :show-overflow-tooltip="true" /> <el-table-column label="归还日期 " align="center" prop="endTime" :show-overflow-tooltip="true" />
<el-table-column label="租赁天数" align="center" prop="leaseDays" :show-overflow-tooltip="true"> <el-table-column label="租赁天数" align="center" prop="leaseDays" :show-overflow-tooltip="true"/>
<template slot-scope="scope" v-show="scope.row.leaseDays">
{{ Number(scope.row.leaseDays).toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="租赁费用(元)" align="center" prop="costs" :show-overflow-tooltip="true"> <el-table-column label="租赁费用(元)" align="center" prop="costs" :show-overflow-tooltip="true">
<template slot-scope="scope" v-show="scope.row.costs"> <template slot-scope="scope" v-show="scope.row.costs">
{{ scope.row.costs.toFixed(2) }} {{ scope.row.costs.toFixed(2) }}
@ -116,18 +119,14 @@
<!-- 维修费用明细 --> <!-- 维修费用明细 -->
<div> <div>
<el-table :data="repairList"> <el-table :data="repairList" max-height="500px">
<el-table-column label="维修费用明细" align="center"> <el-table-column label="维修费用明细" align="center" >
<el-table-column label="序号" align="center" type="index" width="60" /> <el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" /> <el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" /> <el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" /> <el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true" />
<el-table-column label="维修数量" align="center" prop="num" :show-overflow-tooltip="true"> <el-table-column label="维修数量" align="center" prop="num" :show-overflow-tooltip="true"/>
<template slot-scope="scope" v-show="scope.row.num">
{{ scope.row.num.toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="是否收费" align="center" prop="partType" :show-overflow-tooltip="true" /> <el-table-column label="是否收费" align="center" prop="partType" :show-overflow-tooltip="true" />
<el-table-column label="维修费用(元)" align="center" prop="costs" :show-overflow-tooltip="true"> <el-table-column label="维修费用(元)" align="center" prop="costs" :show-overflow-tooltip="true">
<template slot-scope="scope" v-show="scope.row.costs"> <template slot-scope="scope" v-show="scope.row.costs">
@ -146,18 +145,14 @@
<!-- 报废费用明细 --> <!-- 报废费用明细 -->
<div> <div>
<el-table :data="scrapList"> <el-table :data="scrapList" max-height="500px">
<el-table-column label="报废费用明细" align="center"> <el-table-column label="报废费用明细" align="center">
<el-table-column label="序号" align="center" type="index" width="60" /> <el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" /> <el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" /> <el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" /> <el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true" />
<el-table-column label="报废数量" align="center" prop="num" :show-overflow-tooltip="true"> <el-table-column label="报废数量" align="center" prop="num" :show-overflow-tooltip="true"/>
<template slot-scope="scope" v-show="scope.row.num">
{{ scope.row.num.toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="是否收费" align="center" prop="partType" :show-overflow-tooltip="true" /> <el-table-column label="是否收费" align="center" prop="partType" :show-overflow-tooltip="true" />
<el-table-column label="报废费用(元)" align="center" prop="costs" :show-overflow-tooltip="true"> <el-table-column label="报废费用(元)" align="center" prop="costs" :show-overflow-tooltip="true">
<template slot-scope="scope" v-show="scope.row.costs"> <template slot-scope="scope" v-show="scope.row.costs">
@ -176,18 +171,14 @@
<!-- 丢失费用明细 --> <!-- 丢失费用明细 -->
<div> <div>
<el-table :data="loseList"> <el-table :data="loseList" max-height="500px">
<el-table-column label="丢失费用明细" align="center"> <el-table-column label="丢失费用明细" align="center">
<el-table-column label="序号" align="center" type="index" width="60" /> <el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" /> <el-table-column label="单位名称" align="center" prop="unitName" :show-overflow-tooltip="true" width="150" />
<el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" /> <el-table-column label="设备名称" align="center" prop="typeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" /> <el-table-column label="规格型号" align="center" prop="modelName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="mtUnitName" :show-overflow-tooltip="true" />
<el-table-column label="丢失数量" align="center" prop="num" :show-overflow-tooltip="true"> <el-table-column label="丢失数量" align="center" prop="num" :show-overflow-tooltip="true"/>
<template slot-scope="scope" v-show="scope.row.num">
{{ scope.row.num.toFixed(2) }}
</template>
</el-table-column>
<el-table-column label="丢失费用(元)" align="center" prop="costs" :show-overflow-tooltip="true"> <el-table-column label="丢失费用(元)" align="center" prop="costs" :show-overflow-tooltip="true">
<template slot-scope="scope" v-show="scope.row.costs"> <template slot-scope="scope" v-show="scope.row.costs">
{{ scope.row.costs.toFixed(2) }} {{ scope.row.costs.toFixed(2) }}
@ -244,7 +235,9 @@
<script> <script>
import { getClzSltInfo, submitClzCosts } from '@/api/cost/cost' import { getClzSltInfo, submitClzCosts } from '@/api/cost/cost'
import { getUnitList, getProjectList } from '@/api/back/index.js' import {
getClzProjectListApi,getClzTeamListApi
} from '@/api/materialsStation'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -275,6 +268,7 @@ export default {
applyList: [], applyList: [],
projectName: '', // projectName: '', //
unitName: '', // unitName: '', //
actualTimeAndName: '', //
rowData: [] rowData: []
} }
}, },
@ -285,23 +279,38 @@ export default {
} }
}, },
async created() { async created() {
await this.loadTeamList()
await this.loadProjectList() await this.loadProjectList()
}, },
methods: { methods: {
normalizer(node) { async loadProjectList() {
return { try {
id: node.id, const res = await getClzProjectListApi({})
label: node.label || node.name, if (res.code === 200) {
children: node.children // this.projectList = response.data || []
this.projectList = res.data.map(item => ({
label: item.proName, //
value: item.proId,
projectId: item.projectId
}))
}
} catch (error) {
console.error('获取工程列表失败:', error)
this.$message.error('获取工程列表失败')
} }
}, },
async loadTeamList() { async loadTeamList() {
try { try {
const response = await getUnitList({}) const params = {
if (response.code === 200) { proId: this.selectedProject,
this.teamList = response.data || [] }
const res = await getClzTeamListApi(params)
if (res.code === 200) {
// this.teamList = response.data || []
this.teamList = res.data.map(item => ({
label: item.unitName, //
value: item.unitId
}))
} }
} catch (error) { } catch (error) {
console.error('获取班组列表失败:', error) console.error('获取班组列表失败:', error)
@ -309,18 +318,6 @@ export default {
} }
}, },
async loadProjectList() {
try {
const response = await getProjectList({})
if (response.code === 200) {
this.projectList = response.data || []
}
} catch (error) {
console.error('获取工程列表失败:', error)
this.$message.error('获取工程列表失败')
}
},
async handleQuery() { async handleQuery() {
if (this.selectedTeams.length === 0) { if (this.selectedTeams.length === 0) {
this.$message.warning('请选择结算班组') this.$message.warning('请选择结算班组')
@ -370,6 +367,7 @@ export default {
// //
const projectNames = [] const projectNames = []
const unitNames = [] const unitNames = []
const actualTimeAndNames = [] //
let totalRepairCost = 0 let totalRepairCost = 0
let totalScrapCost = 0 let totalScrapCost = 0
@ -425,6 +423,9 @@ export default {
if (data.unitName && !unitNames.includes(data.unitName)) { if (data.unitName && !unitNames.includes(data.unitName)) {
unitNames.push(data.unitName) unitNames.push(data.unitName)
} }
if(data.unitName && data.actualExitTime){
actualTimeAndNames.push(`${data.unitName} ( ${data.actualExitTime} ) `)
}
// //
if (data.repairCost) { if (data.repairCost) {
@ -444,6 +445,7 @@ export default {
// //
this.projectName = projectNames.join(', ') this.projectName = projectNames.join(', ')
this.unitName = unitNames.join(', ') this.unitName = unitNames.join(', ')
this.actualTimeAndName = actualTimeAndNames.join(', ')
console.log('项目名称:', this.projectName) console.log('项目名称:', this.projectName)
console.log('班组名称:', this.unitName) console.log('班组名称:', this.unitName)