结算修改
This commit is contained in:
		
							parent
							
								
									b093220a70
								
							
						
					
					
						commit
						1911763394
					
				| 
						 | 
				
			
			@ -960,3 +960,22 @@ export function getApproveListApi(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
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,45 +1,48 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <div class="app-container" id="costApplyList">
 | 
			
		||||
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="80px">
 | 
			
		||||
      <el-form-item>
 | 
			
		||||
        <treeselect
 | 
			
		||||
          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
 | 
			
		||||
        <el-form-item label="结算工程">
 | 
			
		||||
          <el-select
 | 
			
		||||
          v-model="queryParams.projectId"
 | 
			
		||||
          :options="proList"
 | 
			
		||||
          :normalizer="normalizer"
 | 
			
		||||
          :show-count="true"
 | 
			
		||||
          placeholder="请选择工程"
 | 
			
		||||
          clearable
 | 
			
		||||
          filterable
 | 
			
		||||
          style="width: 240px"
 | 
			
		||||
          :disable-branch-nodes="true"
 | 
			
		||||
          noChildrenText="没有数据了"
 | 
			
		||||
          noOptionsText="没有数据"
 | 
			
		||||
          noResultsText="没有搜索结果"
 | 
			
		||||
          placeholder="请选择结算工程"
 | 
			
		||||
          @select="proChange"
 | 
			
		||||
          :disabled="unitIds.length == 0"
 | 
			
		||||
          @change="loadTeamList"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="item in projectList"
 | 
			
		||||
            :key="item.value"
 | 
			
		||||
            :label="item.label"
 | 
			
		||||
            :value="item.value"
 | 
			
		||||
          />
 | 
			
		||||
        </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-tooltip content="协议编号" placement="top" :disabled="!queryParams.agreementCode">
 | 
			
		||||
          <template #content>
 | 
			
		||||
            {{ queryParams.agreementCode }}
 | 
			
		||||
          </template>
 | 
			
		||||
          <el-input v-model="queryParams.agreementCode" placeholder="请输入协议号" clearable />
 | 
			
		||||
          <el-input v-model="queryParams.agreementCode" placeholder="请输入协议号" clearable disabled/>
 | 
			
		||||
        </el-tooltip>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item prop="sltStatus">
 | 
			
		||||
| 
						 | 
				
			
			@ -200,7 +203,9 @@
 | 
			
		|||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import { getUnitList } from '@/api/back/index.js'
 | 
			
		||||
import {
 | 
			
		||||
   getClzProjectListApi,getClzTeamListApi
 | 
			
		||||
} from '@/api/materialsStation'
 | 
			
		||||
import { getTeamList } from '@/api/materialsStation/auth.js'
 | 
			
		||||
import {  getClzSltAgreementInfo, getClzProjectListByUnitIds, getClzAgreementInfoById, getClzSltInfo } from '@/api/cost/cost'
 | 
			
		||||
import { toChineseAmount } from '@/utils/bonus.js'
 | 
			
		||||
| 
						 | 
				
			
			@ -224,19 +229,11 @@ export default {
 | 
			
		|||
      multiple: true,
 | 
			
		||||
      // 总条数
 | 
			
		||||
      total: 0,
 | 
			
		||||
      // 单位数据
 | 
			
		||||
      unitList: [],
 | 
			
		||||
      // 班组数据
 | 
			
		||||
      teamList: [],
 | 
			
		||||
      // 工程数据
 | 
			
		||||
      proList: [],
 | 
			
		||||
      projectList: [],
 | 
			
		||||
      unitIds: [],
 | 
			
		||||
      projectIds: null,
 | 
			
		||||
      selectTreeProps: {
 | 
			
		||||
        children: 'children',
 | 
			
		||||
        label: 'name',
 | 
			
		||||
        value: 'id',
 | 
			
		||||
        multiple: true //false
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
      // 表格数据
 | 
			
		||||
      tableList: [],
 | 
			
		||||
      // 查询参数
 | 
			
		||||
| 
						 | 
				
			
			@ -268,61 +265,55 @@ export default {
 | 
			
		|||
    }
 | 
			
		||||
  },
 | 
			
		||||
  created() {
 | 
			
		||||
    this.GetUnitData()
 | 
			
		||||
    this.loadProjectList()
 | 
			
		||||
    // this.GetProData()
 | 
			
		||||
    this.getList()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    /** 转换菜单数据结构 */
 | 
			
		||||
    normalizer(node) {
 | 
			
		||||
      if (node.children && !node.children.length) {
 | 
			
		||||
        delete node.children
 | 
			
		||||
 | 
			
		||||
    async loadProjectList() {
 | 
			
		||||
      try {
 | 
			
		||||
        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
 | 
			
		||||
        }))
 | 
			
		||||
        }
 | 
			
		||||
      return {
 | 
			
		||||
        id: node.id,
 | 
			
		||||
        label: node.name,
 | 
			
		||||
        children: node.children
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        console.error('获取工程列表失败:', error)
 | 
			
		||||
        this.$message.error('获取工程列表失败')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    // 获取来往单位数据,只获取班组
 | 
			
		||||
    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() {
 | 
			
		||||
      const unitIdsAsNumbers = this.unitIds.map(id => Number(id))
 | 
			
		||||
    async loadTeamList() {
 | 
			
		||||
      try {
 | 
			
		||||
        this.queryParams.agreementId = null
 | 
			
		||||
        this.queryParams.agreementCode = null
 | 
			
		||||
        const params = {
 | 
			
		||||
        unitIds: unitIdsAsNumbers
 | 
			
		||||
          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()
 | 
			
		||||
    },
 | 
			
		||||
    proChange(val) {
 | 
			
		||||
      setTimeout(() => {
 | 
			
		||||
        this.GetUnitData()
 | 
			
		||||
      }, 500)
 | 
			
		||||
 | 
			
		||||
    async changeTeamId() {
 | 
			
		||||
      await this.getAgreementInfo()
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
        // 获取 协议id
 | 
			
		||||
    async getAgreementInfo() {
 | 
			
		||||
      if (this.unitIds && this.unitIds.length > 0 && this.queryParams.projectId) {
 | 
			
		||||
| 
						 | 
				
			
			@ -334,16 +325,16 @@ export default {
 | 
			
		|||
        console.log(res)
 | 
			
		||||
        if (!res.data && res.data.some(item => !item.agreementId)) {
 | 
			
		||||
          this.$message.error('当前单位和工程无协议!')
 | 
			
		||||
          this.queryParams.unitId = null
 | 
			
		||||
          this.unitIds = []
 | 
			
		||||
          this.queryParams.projectId = null
 | 
			
		||||
          this.GetUnitData()
 | 
			
		||||
          this.GetProData()
 | 
			
		||||
          this.loadProjectList()
 | 
			
		||||
        } else {
 | 
			
		||||
          this.queryParams.agreementId = res.data.map(item => item.agreementId)
 | 
			
		||||
          this.queryParams.agreementCode = res.data.map(item => item.agreementCode).join(',')
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /** 查询列表 */
 | 
			
		||||
    getList() {
 | 
			
		||||
      this.loading = true
 | 
			
		||||
| 
						 | 
				
			
			@ -369,7 +360,6 @@ export default {
 | 
			
		|||
    /** 重置按钮操作 */
 | 
			
		||||
    resetQuery() {
 | 
			
		||||
      this.unitIds = []
 | 
			
		||||
      this.projectIds = []
 | 
			
		||||
      this.queryParams = {
 | 
			
		||||
        pageNum: 1,
 | 
			
		||||
        pageSize: 10,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,35 +3,40 @@
 | 
			
		|||
    <!-- 操作栏 -->
 | 
			
		||||
    <div class="operation-bar">
 | 
			
		||||
      <el-form :inline="true" label-width="80px" style="margin-bottom: 20px;">
 | 
			
		||||
        <el-form-item label="结算班组">
 | 
			
		||||
          <treeselect
 | 
			
		||||
            v-model="selectedTeams"
 | 
			
		||||
            :options="teamList"
 | 
			
		||||
            :normalizer="normalizer"
 | 
			
		||||
            :show-count="true"
 | 
			
		||||
            style="width: 300px"
 | 
			
		||||
            :disable-branch-nodes="true"
 | 
			
		||||
            noChildrenText="没有数据了"
 | 
			
		||||
            noOptionsText="没有数据"
 | 
			
		||||
            noResultsText="没有搜索结果"
 | 
			
		||||
            placeholder="请选择结算班组"
 | 
			
		||||
            :multiple="true"
 | 
			
		||||
          ></treeselect>
 | 
			
		||||
        <el-form-item label="结算工程">
 | 
			
		||||
          <el-select
 | 
			
		||||
          v-model="selectedProject"
 | 
			
		||||
          placeholder="请选择工程"
 | 
			
		||||
          clearable
 | 
			
		||||
          filterable
 | 
			
		||||
          style="width: 240px"
 | 
			
		||||
          @change="loadTeamList"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="item in projectList"
 | 
			
		||||
            :key="item.value"
 | 
			
		||||
            :label="item.label"
 | 
			
		||||
            :value="item.value"
 | 
			
		||||
          />
 | 
			
		||||
        </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
 | 
			
		||||
        <el-form-item label="结算工程">
 | 
			
		||||
          <treeselect
 | 
			
		||||
            v-model="selectedProject"
 | 
			
		||||
            :options="projectList"
 | 
			
		||||
            :normalizer="normalizer"
 | 
			
		||||
            :show-count="true"
 | 
			
		||||
            style="width: 300px"
 | 
			
		||||
            :disable-branch-nodes="true"
 | 
			
		||||
            noChildrenText="没有数据了"
 | 
			
		||||
            noOptionsText="没有数据"
 | 
			
		||||
            noResultsText="没有搜索结果"
 | 
			
		||||
            placeholder="请选择结算工程"
 | 
			
		||||
        <el-form-item label="结算班组">
 | 
			
		||||
          <el-select
 | 
			
		||||
            v-model="selectedTeams"
 | 
			
		||||
            placeholder="请选择班组"
 | 
			
		||||
            clearable
 | 
			
		||||
            filterable
 | 
			
		||||
            multiple 
 | 
			
		||||
            style="width: 240px"
 | 
			
		||||
          >
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in teamList"
 | 
			
		||||
              :key="item.value"
 | 
			
		||||
              :label="item.label"
 | 
			
		||||
              :value="item.value"
 | 
			
		||||
            />
 | 
			
		||||
        </el-select>
 | 
			
		||||
        </el-form-item>
 | 
			
		||||
 | 
			
		||||
        <el-form-item>
 | 
			
		||||
| 
						 | 
				
			
			@ -73,10 +78,16 @@
 | 
			
		|||
            {{ projectName || '请先选择工程并查询' }}
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="tabelAllTopUnit">
 | 
			
		||||
          <div class="costTopUnit">出场时间</div>
 | 
			
		||||
          <div class="costRightUnit">
 | 
			
		||||
            {{ actualTimeAndName || '请先选择班组并查询' }}
 | 
			
		||||
          </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <!-- 租赁费用明细 -->
 | 
			
		||||
        <el-table :data="leaseList">
 | 
			
		||||
          <el-table-column label="租赁费用明细" align="center">
 | 
			
		||||
        <el-table :data="leaseList"   max-height="500px">
 | 
			
		||||
          <el-table-column label="租赁费用明细" align="center" >
 | 
			
		||||
            <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="typeName" :show-overflow-tooltip="true" />
 | 
			
		||||
| 
						 | 
				
			
			@ -87,18 +98,10 @@
 | 
			
		|||
                {{ scope.row.leasePrice.toFixed(2) }}
 | 
			
		||||
              </template>
 | 
			
		||||
            </el-table-column>
 | 
			
		||||
            <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="num" :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="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="leaseDays" :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">
 | 
			
		||||
                {{ scope.row.costs.toFixed(2) }}
 | 
			
		||||
| 
						 | 
				
			
			@ -116,18 +119,14 @@
 | 
			
		|||
 | 
			
		||||
      <!-- 维修费用明细 -->
 | 
			
		||||
      <div>
 | 
			
		||||
        <el-table :data="repairList">
 | 
			
		||||
          <el-table-column label="维修费用明细" align="center">
 | 
			
		||||
        <el-table :data="repairList" max-height="500px">
 | 
			
		||||
          <el-table-column label="维修费用明细" align="center" >
 | 
			
		||||
            <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="typeName" :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="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="num" :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">
 | 
			
		||||
              <template slot-scope="scope" v-show="scope.row.costs">
 | 
			
		||||
| 
						 | 
				
			
			@ -146,18 +145,14 @@
 | 
			
		|||
 | 
			
		||||
      <!-- 报废费用明细 -->
 | 
			
		||||
      <div>
 | 
			
		||||
        <el-table :data="scrapList">
 | 
			
		||||
        <el-table :data="scrapList" max-height="500px">
 | 
			
		||||
          <el-table-column label="报废费用明细" align="center">
 | 
			
		||||
            <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="typeName" :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="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="num" :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">
 | 
			
		||||
              <template slot-scope="scope" v-show="scope.row.costs">
 | 
			
		||||
| 
						 | 
				
			
			@ -176,18 +171,14 @@
 | 
			
		|||
 | 
			
		||||
      <!-- 丢失费用明细 -->
 | 
			
		||||
      <div>
 | 
			
		||||
        <el-table :data="loseList">
 | 
			
		||||
        <el-table :data="loseList" max-height="500px">
 | 
			
		||||
          <el-table-column label="丢失费用明细" align="center">
 | 
			
		||||
            <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="typeName" :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="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="num" :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">
 | 
			
		||||
                {{ scope.row.costs.toFixed(2) }}
 | 
			
		||||
| 
						 | 
				
			
			@ -244,7 +235,9 @@
 | 
			
		|||
 | 
			
		||||
<script>
 | 
			
		||||
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 '@riophae/vue-treeselect/dist/vue-treeselect.css'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -275,6 +268,7 @@ export default {
 | 
			
		|||
      applyList: [],
 | 
			
		||||
      projectName: '', //结算工程
 | 
			
		||||
      unitName: '', //结算班组
 | 
			
		||||
      actualTimeAndName: '', //实际时间和对应的班组名称
 | 
			
		||||
      rowData: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
| 
						 | 
				
			
			@ -285,23 +279,38 @@ export default {
 | 
			
		|||
    }
 | 
			
		||||
  },
 | 
			
		||||
  async created() {
 | 
			
		||||
    await this.loadTeamList()
 | 
			
		||||
    await this.loadProjectList()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    normalizer(node) {
 | 
			
		||||
      return {
 | 
			
		||||
        id: node.id,
 | 
			
		||||
        label: node.label || node.name,
 | 
			
		||||
        children: node.children
 | 
			
		||||
    async loadProjectList() {
 | 
			
		||||
      try {
 | 
			
		||||
        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('获取工程列表失败')
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    async loadTeamList() {
 | 
			
		||||
      try {
 | 
			
		||||
        const response = await getUnitList({})
 | 
			
		||||
        if (response.code === 200) {
 | 
			
		||||
          this.teamList = response.data || []
 | 
			
		||||
        const params = {
 | 
			
		||||
          proId: this.selectedProject,
 | 
			
		||||
        }
 | 
			
		||||
        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)
 | 
			
		||||
| 
						 | 
				
			
			@ -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() {
 | 
			
		||||
      if (this.selectedTeams.length === 0) {
 | 
			
		||||
        this.$message.warning('请选择结算班组')
 | 
			
		||||
| 
						 | 
				
			
			@ -370,6 +367,7 @@ export default {
 | 
			
		|||
        // 收集项目名称和班组名称
 | 
			
		||||
        const projectNames = []
 | 
			
		||||
        const unitNames = []
 | 
			
		||||
        const actualTimeAndNames = [] // 用于存储实际时间和对应的班组名称
 | 
			
		||||
 | 
			
		||||
        let totalRepairCost = 0
 | 
			
		||||
        let totalScrapCost = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -425,6 +423,9 @@ export default {
 | 
			
		|||
          if (data.unitName && !unitNames.includes(data.unitName)) {
 | 
			
		||||
            unitNames.push(data.unitName)
 | 
			
		||||
          }
 | 
			
		||||
          if(data.unitName && data.actualExitTime){
 | 
			
		||||
            actualTimeAndNames.push(`${data.unitName} ( ${data.actualExitTime} ) `)
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          // 累计维修和报废费用
 | 
			
		||||
          if (data.repairCost) {
 | 
			
		||||
| 
						 | 
				
			
			@ -444,6 +445,7 @@ export default {
 | 
			
		|||
        // 设置项目和班组名称(多个用逗号分隔)
 | 
			
		||||
        this.projectName = projectNames.join(', ')
 | 
			
		||||
        this.unitName = unitNames.join(', ')
 | 
			
		||||
        this.actualTimeAndName = actualTimeAndNames.join(', ')
 | 
			
		||||
        console.log('项目名称:', this.projectName)
 | 
			
		||||
        console.log('班组名称:', this.unitName)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue