bonus-ui/src/views/material/cost/component/applyHome.vue

546 lines
22 KiB
Vue
Raw Normal View History

2024-12-06 17:23:40 +08:00
<template>
<div class="app-container" id="costApplyList">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px">
2025-03-19 15:29:39 +08:00
<el-form-item >
2024-12-30 11:17:25 +08:00
<treeselect
2025-03-19 15:29:39 +08:00
ref="treeselectRef"
v-model="unitIds"
2024-12-30 11:17:25 +08:00
:options="unitList" :normalizer="normalizer"
2025-03-19 15:29:39 +08:00
:show-count="true" style="width: 300px;"
:disable-branch-nodes="true"
2024-12-30 11:17:25 +08:00
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择结算单位" @select="unitChange"
2025-03-19 15:29:39 +08:00
:multiple="true"
>
</treeselect>
2024-12-30 11:17:25 +08:00
<!-- <el-cascader v-model="unitIds"
2024-12-06 17:23:40 +08:00
:show-all-levels="false"
:options="unitList"
:props="selectTreeProps"
filterable
2025-06-14 17:11:13 +08:00
clearable
collapse-tags
@change="unitChange"
2025-03-19 15:29:39 +08:00
popper-class="popper-select"
2024-12-06 17:23:40 +08:00
placeholder="请选择单位"
2024-12-30 11:17:25 +08:00
></el-cascader> -->
2024-12-06 17:23:40 +08:00
</el-form-item>
<el-form-item prop="projectIds">
2024-12-30 11:17:25 +08:00
<treeselect
v-model="queryParams.projectId"
:options="proList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择结算工程" @select="proChange"
/>
<!-- <el-cascader v-model="projectIds"
2024-12-06 17:23:40 +08:00
:show-all-levels="false"
:options="proList"
:props="selectTreeProps"
filterable clearable
2025-06-14 17:11:13 +08:00
collapse-tags
2024-12-06 17:23:40 +08:00
@change="proChange"
2025-06-14 17:11:13 +08:00
placeholder="请选择工程"
2024-12-30 11:17:25 +08:00
></el-cascader> -->
2024-12-06 17:23:40 +08:00
</el-form-item>
<el-form-item prop="agreementCode">
2025-03-19 18:14:18 +08:00
<el-tooltip content="协议编号" placement="top" :disabled="!queryParams.agreementCode">
<template #content>
{{ queryParams.agreementCode }}
</template>
<el-input v-model="queryParams.agreementCode" placeholder="请输入协议号" clearable disabled/>
</el-tooltip>
2024-12-06 17:23:40 +08:00
</el-form-item>
<el-form-item prop="sltStatus">
2024-12-06 17:23:40 +08:00
<el-select
v-model="queryParams.sltStatus"
placeholder="请选择结算状态"
clearable
filterable
>
<el-option
2025-01-20 17:10:15 +08:00
v-for="dict in dict.type.cost_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
2024-12-06 17:23:40 +08:00
></el-option>
</el-select>
</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
>
2025-03-19 15:29:39 +08:00
<el-button
2024-12-06 17:23:40 +08:00
type="primary"
plain
size="mini"
@click="handleApplyList"
>批量结算</el-button
2025-03-19 15:29:39 +08:00
>
2024-12-06 17:23:40 +08:00
<el-button
type="primary"
plain
size="mini"
@click="openPrintDialog"
>协议书</el-button
>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
2025-01-20 17:10:15 +08:00
<el-table-column type="selection" width="55" align="center" :selectable="(row) => row.sltStatus == 0 || row.sltStatus == 3"/>
2024-12-06 17:23:40 +08:00
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{
(queryParams.pageNum - 1) * 10 + scope.$index + 1
}}</span>
</template>
</el-table-column>
2025-06-14 17:11:13 +08:00
<el-table-column label="协议编号" align="center" prop="agreementCode" :show-overflow-tooltip="true"/>
2024-12-06 17:23:40 +08:00
<el-table-column label="结算单位" align="center" prop="unitName" :show-overflow-tooltip="true"/>
<el-table-column label="结算工程" align="center" prop="projectName" :show-overflow-tooltip="true"/>
2025-01-20 17:10:15 +08:00
<el-table-column label="合计费用(元)" align="center" prop="costs" :show-overflow-tooltip="true">
<template slot-scope="scope" v-if="scope.row.costs != null && scope.row.costs!=''">
{{ scope.row.costs.toFixed(2) }}
</template>
</el-table-column>
2024-12-06 17:23:40 +08:00
<el-table-column label="结算状态" align="center" prop="sltStatus" :show-overflow-tooltip="true">
<template slot-scope="scope">
2025-01-20 17:10:15 +08:00
<dict-tag :options="dict.type.cost_status" :value="scope.row.sltStatus"/>
2024-12-06 17:23:40 +08:00
</template>
2025-01-20 17:10:15 +08:00
<!-- <template slot-scope="scope">
<span v-if="scope.row.sltStatus == '0'">未结算</span>
<span v-if="scope.row.sltStatus == '1'">已结算</span>
<span v-if="scope.row.sltStatus == '2'">已审核</span>
<span v-if="scope.row.sltStatus == '3'">已驳回</span>
</template> -->
2024-12-06 17:23:40 +08:00
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="租赁期限(天)" align="center" prop="leaseDay" :show-overflow-tooltip="true" />
<el-table-column label="授权人" align="center" prop="authPerson" :show-overflow-tooltip="true" />
<el-table-column label="联系电话 " align="center" prop="phone" :show-overflow-tooltip="true" /> -->
<el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="primary" icon="el-icon-edit"
@click="handleApply(scope.row)"
2025-01-20 17:10:15 +08:00
v-if="scope.row.sltStatus == '0' || (scope.row.sltStatus == '3')"
2024-12-06 17:23:40 +08:00
>结算申请</el-button>
<!-- <el-button size="mini" type="danger" icon="el-icon-delete"
@click="handleDelete(scope.row)"
>撤销申请</el-button> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 协议单弹窗 -->
<el-dialog :visible.sync="openPrint" width="1100px" append-to-body>
2025-06-14 17:11:13 +08:00
<div id="checkId">
<div style="height: 600px; overflow-y: scroll" >
2024-12-06 17:23:40 +08:00
<vue-easy-print tableShow ref="remarksPrintRef" class="print">
<div style="text-align: center; font-weight: 600; font-size: 16px">
机具设备有偿使用费结算协议书
</div>
<div class="info" style="margin-top: 10px; display: flex; flex-wrap: wrap">
<div class="item" style=" width: 65%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px;">
</div>
<div class="item" style=" width: 35%; flex-shrink: 0; margin-bottom: 5px; font-size: 14px;">
2025-06-14 17:11:13 +08:00
<span>协议号</span>
</div>
</div>
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 20%;">工程名称</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 80%;">金上-湖北线路工程川12标</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 20%;">承租单位</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 40%;">金上-湖北线路工程川12标项目部</div>
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 10%;border-left: 1px solid #9c9c9c;">日期</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 30%;">2024-12-01</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 100%;">结算项目及金额()</div>
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 60%;">施工机具有偿使用费</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 40%;"> 13144247. 44</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 60%;">施工机具维修费</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 40%;"> 13144247. 44</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 60%;">施工机具丢失费</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 40%;"> 13144247. 44</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 60%;">施工机具损坏赔偿费</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 40%;"> 13144247. 44</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 20%;">费用合计金额大写</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 40%;">贰仟肆佰伍拾陆万伍仟肆佰捌拾玖元肆角伍分</div>
<div class="columnContent" style="width: 40%;"> 24565489.45</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 20%;">说明</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 80%;">本协议一式三份甲方一份乙方一份经双方签字后生效</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
<div class="tabelColumn" style="border: 1px solid #9c9c9c;">
2024-12-06 17:23:40 +08:00
<div class="columnLabel" style="width: 20%;">备注</div>
2025-06-14 17:11:13 +08:00
<div class="columnContent" style="width: 80%;">此费用仅为在机具设备分公司发生费用未计从项目部领用机具费用</div>
2024-12-06 17:23:40 +08:00
</div>
2025-06-14 17:11:13 +08:00
2024-12-06 17:23:40 +08:00
<div class="fillIn" style="margin-top: 20px; display: flex; justify-content: space-between;">
<div class="item" style="width: 33%">
<div>
<span>部门负责人</span>
</div>
</div>
<div class="item" style="width: 33%">
<div>
<span>承租负责人</span>
</div>
</div>
<div class="item" style="width: 33%">
<div>
<span>核算员</span>
</div>
</div>
</div>
</vue-easy-print>
</div>
2025-06-14 17:11:13 +08:00
</div>
2024-12-06 17:23:40 +08:00
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button type="primary" @click="print"> </el-button>
<el-button @click="openPrint = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
2025-03-19 15:29:39 +08:00
// getProjectList,
2024-12-06 17:23:40 +08:00
getUnitList,
2025-06-14 17:11:13 +08:00
// getAgreementInfoById,
} from '@/api/back/index.js'
2025-03-19 18:14:18 +08:00
import { getSltAgreementInfo,getProjectListByUnitIds,getAgreementInfoById } from '@/api/cost/cost'
2024-12-06 17:23:40 +08:00
import vueEasyPrint from "vue-easy-print";
2024-12-30 11:17:25 +08:00
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
2025-06-14 17:11:13 +08:00
import printJS from 'print-js'
2024-12-06 17:23:40 +08:00
export default {
name: 'CostApplyList',
2025-01-20 17:10:15 +08:00
dicts: ['cost_status'],
2024-12-30 11:17:25 +08:00
components: { Treeselect },
2024-12-06 17:23:40 +08:00
data() {
return {
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
2025-06-14 17:11:13 +08:00
multiple: true,
2024-12-06 17:23:40 +08:00
// 总条数
total: 0,
// 单位数据
unitList: [],
// 工程数据
proList: [],
2025-03-19 15:29:39 +08:00
unitIds: [],
2024-12-06 17:23:40 +08:00
projectIds: null,
selectTreeProps: {
children: 'children',
2025-06-14 17:11:13 +08:00
label: 'name',
2024-12-06 17:23:40 +08:00
value: 'id',
2025-03-19 15:29:39 +08:00
multiple: true,//false
2025-06-14 17:11:13 +08:00
},
2025-01-20 17:10:15 +08:00
// statusList: [
// { id: '1', name: '未结算' },
// { id: '2', name: '已结算' },
// { id: '3', name: '已审核' },
// { id: '4', name: '已驳回' },
// ],
2024-12-06 17:23:40 +08:00
// 表格数据
2025-06-14 17:11:13 +08:00
tableList: [],
2024-12-06 17:23:40 +08:00
// 查询参数
queryParams: {
pageNum: 1,
2025-06-14 17:11:13 +08:00
pageSize: 10,
2024-12-06 17:23:40 +08:00
sltStatus: '',
isCommit:'',
2024-12-30 11:17:25 +08:00
unitId: null,
projectId: null,
2025-03-19 18:14:18 +08:00
agreementId: [],
2024-12-06 17:23:40 +08:00
agreementCode: '',
},
openPrint:false
}
},
2025-03-19 15:29:39 +08:00
// updated() {
// this.$nextTick(() => {
// // 通过 ref 获取 treeselect 组件的 DOM 元素
// const treeselectElm = this.$refs.treeselectRef.$el;
// if (treeselectElm && typeof treeselectElm.getBoundingClientRect === 'function') {
// const rect = treeselectElm.getBoundingClientRect();
// // 处理 rect
// console.log(rect);
// }
// });
// },
2025-06-14 17:11:13 +08:00
created() {
2024-12-06 17:23:40 +08:00
this.GetUnitData()
2025-03-19 15:29:39 +08:00
// this.GetProData()
2025-01-20 17:10:15 +08:00
this.getList()
2024-12-06 17:23:40 +08:00
},
methods: {
2024-12-30 11:17:25 +08:00
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
2025-06-14 17:11:13 +08:00
},
2024-12-06 17:23:40 +08:00
// 获取 来往单位 列表数据
async GetUnitData() {
const params = {
2024-12-30 11:17:25 +08:00
// projectId: this.queryParams.projectId /* */,
2024-12-06 17:23:40 +08:00
}
const res = await getUnitList(params)
this.unitList = res.data;
2025-03-19 18:14:18 +08:00
if(this.queryParams.projectId){
2025-06-14 17:11:13 +08:00
this.getAgreementInfo()
2025-03-19 18:14:18 +08:00
}
2024-12-30 11:17:25 +08:00
2024-12-06 17:23:40 +08:00
},
unitChange(val){
2025-03-19 15:29:39 +08:00
console.log('Selected values:', val); // 检查选中的值
// this.unitIds.push(Number(val.id));
2024-12-30 11:17:25 +08:00
// if(val&&val.length>0){
// this.queryParams.unitId=this.unitIds[this.unitIds.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.unitId=""
// }
2025-03-19 15:29:39 +08:00
console.log("xxxxxxxxx",this.queryParams.unitId)
console.log("yyyyyyyyy",this.unitIds)
2024-12-30 11:17:25 +08:00
// this.GetProData()
setTimeout(()=>{
this.queryParams.projectId=null
this.queryParams.agreementId = null
this.queryParams.agreementCode = null
this.GetProData()
2025-06-14 17:11:13 +08:00
},500)
},
2024-12-06 17:23:40 +08:00
// 获取 工程名称 列表数据
async GetProData() {
2025-03-19 15:29:39 +08:00
const unitIdsAsNumbers = this.unitIds.map(id => Number(id));
2024-12-06 17:23:40 +08:00
const params = {
2025-03-19 15:29:39 +08:00
unitIds: unitIdsAsNumbers,
2024-12-06 17:23:40 +08:00
}
2025-03-19 15:29:39 +08:00
const res = await getProjectListByUnitIds(params)
2024-12-06 17:23:40 +08:00
this.proList = res.data;
2025-06-14 17:11:13 +08:00
this.getAgreementInfo()
2024-12-06 17:23:40 +08:00
},
proChange(val){
2024-12-30 11:17:25 +08:00
// if(val&&val.length>0){
// this.queryParams.projectId=this.projectIds[this.projectIds.length - 1]
// }else if(val&&val.length==0){
// this.queryParams.projectId=""
// }
// this.GetUnitData()
setTimeout(()=>{
this.GetUnitData()
2025-06-14 17:11:13 +08:00
},500)
2024-12-06 17:23:40 +08:00
},
// 获取 协议id
async getAgreementInfo() {
2025-03-19 18:14:18 +08:00
if (this.unitIds && this.unitIds.length > 0 && this.queryParams.projectId) {
2024-12-06 17:23:40 +08:00
const params = {
2025-03-19 18:14:18 +08:00
unitIds: this.unitIds,
2024-12-06 17:23:40 +08:00
projectId: this.queryParams.projectId,
}
const res = await getAgreementInfoById(params)
console.log(res)
2025-03-19 18:14:18 +08:00
if ((!res.data && res.data.some(item => !item.agreementId))) {
2024-12-06 17:23:40 +08:00
this.$message.error('当前单位和工程无协议!')
this.queryParams.unitId = null
this.queryParams.projectId = null
this.GetUnitData()
this.GetProData()
} else {
2025-03-19 18:14:18 +08:00
this.queryParams.agreementId = res.data.map(item => item.agreementId);
this.queryParams.agreementCode = res.data.map(item => item.agreementCode).join(',');
2024-12-06 17:23:40 +08:00
}
}
2025-06-14 17:11:13 +08:00
},
2024-12-06 17:23:40 +08:00
/** 查询列表 */
getList() {
this.loading = true
2025-03-19 18:14:18 +08:00
const params = {
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
projectId: this.queryParams.projectId,
sltStatus: this.queryParams.sltStatus,
// ...this.queryParams,
unitIds: this.unitIds,
}
getSltAgreementInfo(params).then((response) => {
2024-12-06 17:23:40 +08:00
this.tableList = response.rows
this.total = response.total
this.loading = false
})
2025-06-14 17:11:13 +08:00
},
2024-12-06 17:23:40 +08:00
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.unitIds=[]
2025-06-14 17:11:13 +08:00
this.projectIds=[]
2024-12-06 17:23:40 +08:00
this.queryParams={
pageNum: 1,
2025-06-14 17:11:13 +08:00
pageSize: 10,
2024-12-06 17:23:40 +08:00
sltStatus: '',
isCommit:'',
2024-12-30 11:17:25 +08:00
unitId: null,
projectId: null,
2025-03-19 18:14:18 +08:00
agreementId: [],
2024-12-06 17:23:40 +08:00
agreementCode: '',
}
this.resetForm('queryForm')
this.handleQuery()
2025-06-14 17:11:13 +08:00
},
2024-12-06 17:23:40 +08:00
//结算申请
handleApply(row) {
2025-03-20 13:14:44 +08:00
let arr = [];
arr.push(row);
2024-12-06 17:23:40 +08:00
// console.log(arr)
// console.log(this.ids)
// console.log(JSON.stringify(arr))
// this.$tab.closeOpenPage({
// path: '/cost/costApplyDetail',
// query: {
// rowData: JSON.stringify(arr),
// },
// })
this.$emit("goDetail",JSON.stringify(arr));
},
handleApplyList() {
if (this.ids.length < 1) {
2025-03-19 18:14:18 +08:00
this.$message.error('请勾选需要结算的数据!')
2024-12-06 17:23:40 +08:00
return
}
if (this.ids.length > 0) {
let arr = this.ids
2025-03-19 18:14:18 +08:00
this.$emit("goDetail",JSON.stringify(arr));
2024-12-06 17:23:40 +08:00
}
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item)
this.single = selection.length != 1
this.multiple = !selection.length
},
openPrintDialog(){
this.openPrint = true
},
//维修任务单打印
print() {
2025-06-14 17:11:13 +08:00
// this.$refs.remarksPrintRef.print();
printJS({
printable: 'checkId',
type: 'html',
targetStyles: ['*'],
maxWidth:'1400'
// 其他配置选项
});
2024-12-06 17:23:40 +08:00
},
/** 删除按钮操作 */
handleDelete(row) {
// const agreementId = row.agreementId;
// let param = {
// agreementId:row.agreementId+''
// }
// this.$modal.confirm('是否确认删除该数据项?').then(function() {
// return removeAgreement(param);
// }).then(() => {
// this.getList();
// this.$modal.msgSuccess("删除成功");
// }).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// this.download('material/agreementInfo/export', {
// ...this.queryParams
// }, `协议_${new Date().getTime()}.xlsx`)
},
},
}
</script>
<style lang="scss" scoped>
::v-deep.el-table .fixed-width .el-button--mini {
width: 80px !important;
margin-bottom: 10px;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
}
.tabelColumn {
width:1000px;
height: 50px;
display: flex;
align-items: center;
border: 1px solid #9c9c9c;
2025-06-14 17:11:13 +08:00
// margin-bottom: 1px;
2024-12-06 17:23:40 +08:00
border-bottom: none;
}
.columnLabel {
height: 50px;
line-height: 50px;
2025-06-14 17:11:13 +08:00
text-align: center;
2024-12-06 17:23:40 +08:00
border-left: none;
}
.columnContent {
height: 50px;
line-height: 50px;
2025-06-14 17:11:13 +08:00
text-align: center;
2024-12-06 17:23:40 +08:00
border-left: 1px solid #9c9c9c;
2025-06-14 17:11:13 +08:00
}
2024-12-06 17:23:40 +08:00
</style>