供需平衡表
This commit is contained in:
		
							parent
							
								
									affa833aaa
								
							
						
					
					
						commit
						eb29f39b54
					
				| 
						 | 
				
			
			@ -646,7 +646,6 @@ export const getDetailsListApi = data => {
 | 
			
		|||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// 领料记录添加备注
 | 
			
		||||
export function addRemarkApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
| 
						 | 
				
			
			@ -656,7 +655,6 @@ export function addRemarkApi(data) {
 | 
			
		|||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// 总站点退料-列表
 | 
			
		||||
export const getBackTotalListApi = data => {
 | 
			
		||||
  return request({
 | 
			
		||||
| 
						 | 
				
			
			@ -926,3 +924,30 @@ export function directUpdateApi(data) {
 | 
			
		|||
    data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 供需平衡表-列表
 | 
			
		||||
export function getDemandAndSupplyApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/material_maMachine/getDemandAndSupply',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 供需平衡表-合计
 | 
			
		||||
export function getDemandAndSupplyNoPageApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/material_maMachine/getDemandAndSupplyNoPage',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 供需平衡表-在用
 | 
			
		||||
export function getUseDemandAndSupplyApi(data) {
 | 
			
		||||
  return request({
 | 
			
		||||
    url: '/material/material_maMachine/getUseDemandAndSupply',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    params: data
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,15 +81,15 @@
 | 
			
		|||
          <el-option label="安全工器具" :value="2" />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="计量单位" prop="unitName">
 | 
			
		||||
      <el-form-item label="计量单位" prop="unitValue">
 | 
			
		||||
        <el-select
 | 
			
		||||
          v-model="queryParams.unitName"
 | 
			
		||||
          v-model="queryParams.unitValue"
 | 
			
		||||
          placeholder="请选择计量单位"
 | 
			
		||||
          clearable
 | 
			
		||||
          filterable
 | 
			
		||||
          style="width: 240px"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option v-for="item in unitNameList" :key="item.value" :label="item.label" :value="item.label" />
 | 
			
		||||
          <el-option v-for="item in unitNameList" :key="item.value" :label="item.label" :value="item.value" />
 | 
			
		||||
        </el-select>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="关键字" prop="keyWord">
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +129,7 @@
 | 
			
		|||
        :width="column.width"
 | 
			
		||||
        align="center"
 | 
			
		||||
      >
 | 
			
		||||
        <template v-slot="{ row, $index }" v-if="column.prop === 'storeNum'">
 | 
			
		||||
        <template v-slot="{ row }" v-if="column.prop === 'storeNum'">
 | 
			
		||||
          <!-- 当 manageType 为 '编码' 时,使用可点击的 span -->
 | 
			
		||||
          <!-- <span
 | 
			
		||||
            class="clickText"
 | 
			
		||||
| 
						 | 
				
			
			@ -142,12 +142,12 @@
 | 
			
		|||
          <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 }}
 | 
			
		||||
        <template v-slot="{ row, $index }" v-else-if="column.prop === 'useNum'">
 | 
			
		||||
          <span v-if="row.useNum > 0 && $index != 0" class="clickText" @click="openUserRecords(row)">
 | 
			
		||||
            {{ row.useNum }}
 | 
			
		||||
          </span>
 | 
			
		||||
          <!-- 否则,直接显示数字 -->
 | 
			
		||||
          <span v-else>{{ row.usNum }}</span>
 | 
			
		||||
          <span v-else>{{ row.useNum }}</span>
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
    </el-table>
 | 
			
		||||
| 
						 | 
				
			
			@ -224,7 +224,7 @@
 | 
			
		|||
        </el-form-item>
 | 
			
		||||
      </el-form>
 | 
			
		||||
 | 
			
		||||
      <el-table v-loading="loading" :data="useRecordList">
 | 
			
		||||
      <el-table v-loading="isDlgLoading" :data="useRecordList">
 | 
			
		||||
        <el-table-column
 | 
			
		||||
          label="序号"
 | 
			
		||||
          align="center"
 | 
			
		||||
| 
						 | 
				
			
			@ -232,13 +232,13 @@
 | 
			
		|||
          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="subUnitName" :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-column label="在用数量" align="center" prop="useNum" :show-overflow-tooltip="true" />
 | 
			
		||||
      </el-table>
 | 
			
		||||
 | 
			
		||||
      <pagination
 | 
			
		||||
| 
						 | 
				
			
			@ -260,10 +260,12 @@ import {
 | 
			
		|||
  getTeamList,
 | 
			
		||||
  getSubUnitList,
 | 
			
		||||
  getStorageInfoListApi,
 | 
			
		||||
  getUserRecordListApi,
 | 
			
		||||
  getStoreNumAndUseListApi,
 | 
			
		||||
  getRetainedEquipmentListNoPageApi
 | 
			
		||||
  getUseDemandAndSupplyApi,
 | 
			
		||||
  getDemandAndSupplyApi,
 | 
			
		||||
  getDemandAndSupplyNoPageApi
 | 
			
		||||
} from '@/api/materialsStation'
 | 
			
		||||
import { getDeviceType } from '@/api/ma/device'
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: '',
 | 
			
		||||
  dicts: [],
 | 
			
		||||
| 
						 | 
				
			
			@ -271,6 +273,7 @@ export default {
 | 
			
		|||
    return {
 | 
			
		||||
      // 遮罩层
 | 
			
		||||
      loading: false,
 | 
			
		||||
      isDlgLoading: false,
 | 
			
		||||
      // 选中数组
 | 
			
		||||
      ids: [],
 | 
			
		||||
      // 弹出层标题
 | 
			
		||||
| 
						 | 
				
			
			@ -287,11 +290,11 @@ export default {
 | 
			
		|||
        { label: '工程名称', prop: 'proName', showTooltip: false },
 | 
			
		||||
        { label: '物资名称', prop: 'typeName' },
 | 
			
		||||
        { label: '规格型号', prop: 'typeModelName' },
 | 
			
		||||
        { label: '计量单位', prop: 'unitName' },
 | 
			
		||||
        { label: '业务需求数量', prop: 'num' },
 | 
			
		||||
        { label: '实际供应数量', prop: 'num' },
 | 
			
		||||
        { label: '计量单位', prop: 'unit' },
 | 
			
		||||
        { label: '业务需求数量', prop: 'businessNum' },
 | 
			
		||||
        { label: '实际供应数量', prop: 'supplyNum' },
 | 
			
		||||
        { label: '在库数量', prop: 'storeNum' },
 | 
			
		||||
        { label: '在用数量', prop: 'usNum' }
 | 
			
		||||
        { label: '在用数量', prop: 'useNum' }
 | 
			
		||||
      ],
 | 
			
		||||
      // 主表格数据
 | 
			
		||||
      tableList: [],
 | 
			
		||||
| 
						 | 
				
			
			@ -305,7 +308,8 @@ export default {
 | 
			
		|||
        subUnitName: null,
 | 
			
		||||
        typeName: null, //物资名称
 | 
			
		||||
        typeModelName: null, //规格型号
 | 
			
		||||
        jiJuType: null // 机具类型 (1施工机具 2安全工器具)
 | 
			
		||||
        jiJuType: null, // 机具类型 (1施工机具 2安全工器具)
 | 
			
		||||
        unitValue: null
 | 
			
		||||
      },
 | 
			
		||||
      impUnitOptions: [], // 分公司下拉
 | 
			
		||||
      departOptions: [], // 项目部下拉
 | 
			
		||||
| 
						 | 
				
			
			@ -344,6 +348,11 @@ export default {
 | 
			
		|||
    this.queryParams.proId = query.proId || ''
 | 
			
		||||
    this.queryParams.proCenter = query.proCenter || ''
 | 
			
		||||
    this.getList()
 | 
			
		||||
    this.getImpUnitOptions()
 | 
			
		||||
    this.handleDepartChange()
 | 
			
		||||
    this.getSubUnitList()
 | 
			
		||||
    this.getDeviceType()
 | 
			
		||||
    this.handleImpUnitChange()
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    /** 获取分公司下拉 */
 | 
			
		||||
| 
						 | 
				
			
			@ -512,46 +521,24 @@ export default {
 | 
			
		|||
    // 获取列表
 | 
			
		||||
    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 params = {
 | 
			
		||||
          ...this.queryParams
 | 
			
		||||
        }
 | 
			
		||||
        const response = await getRetainedEquipmentListNoPageApi(param)
 | 
			
		||||
        const res = await getDemandAndSupplyApi(params)
 | 
			
		||||
        this.tableList = res.data.rows || []
 | 
			
		||||
        this.total = res.data.total || 0
 | 
			
		||||
        const response = await getDemandAndSupplyNoPageApi(params)
 | 
			
		||||
        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 || ''
 | 
			
		||||
          ...response.data,
 | 
			
		||||
          // businessNum: response.data.businessNum || response.data.totalBusinessNum,
 | 
			
		||||
          // supplyNum: response.data.supplyNum,
 | 
			
		||||
          // storeNum: response.data.storeNum,
 | 
			
		||||
          // useNum: response.data.useNum
 | 
			
		||||
        }
 | 
			
		||||
        this.tableList.unshift(obj)
 | 
			
		||||
        console.log(this.tableList)
 | 
			
		||||
 | 
			
		||||
        console.log('🚀 ~ getList ~ this.tableList:', this.tableList)
 | 
			
		||||
        this.loading = false
 | 
			
		||||
      } catch (error) {
 | 
			
		||||
        this.loading = false
 | 
			
		||||
| 
						 | 
				
			
			@ -559,7 +546,7 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    indexContinuationForTable(num, size) {
 | 
			
		||||
      let number = (num - 1) * size
 | 
			
		||||
      console.log(number)
 | 
			
		||||
      console.log('🚀 ~ indexContinuationForTable ~ number:', number)
 | 
			
		||||
      if (number == 0) {
 | 
			
		||||
        return '合计'
 | 
			
		||||
      } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -571,14 +558,14 @@ export default {
 | 
			
		|||
    // 注意列数和行数从 0 开始
 | 
			
		||||
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
 | 
			
		||||
      if (rowIndex === 0 && columnIndex == 0) {
 | 
			
		||||
        let rowspan = 1
 | 
			
		||||
        let colspan = 6
 | 
			
		||||
        let rowspan = 1 // 合并行数
 | 
			
		||||
        let colspan = 5 // 合并列数
 | 
			
		||||
        return { rowspan, colspan }
 | 
			
		||||
      }
 | 
			
		||||
      // 解决偏移的重要代码
 | 
			
		||||
      // 重点在 else if 判断必须加因为合并单元格数据会出现偏移、
 | 
			
		||||
      // 否则如果是 第二行 的 第二列 那么隐藏原有第二行 的 第二列的数据使他隐藏
 | 
			
		||||
      else if (rowIndex === 0 && columnIndex < 6) {
 | 
			
		||||
      else if (rowIndex === 0 && columnIndex < 5) {
 | 
			
		||||
        return {
 | 
			
		||||
          rowspan: 0,
 | 
			
		||||
          colspan: 0
 | 
			
		||||
| 
						 | 
				
			
			@ -598,11 +585,11 @@ export default {
 | 
			
		|||
    /** 导出按钮操作 */
 | 
			
		||||
    handleExport() {
 | 
			
		||||
      this.download(
 | 
			
		||||
        'material/material_maMachine/exportStoreNumAndUseList',
 | 
			
		||||
        'material/material_maMachine/exportDemandAndSupply',
 | 
			
		||||
        {
 | 
			
		||||
          ...this.queryParams
 | 
			
		||||
        },
 | 
			
		||||
        `站内库存查询_${new Date().getTime()}.xlsx`
 | 
			
		||||
        `材料站供需平衡表_${new Date().getTime()}.xlsx`
 | 
			
		||||
      )
 | 
			
		||||
    },
 | 
			
		||||
    //查看在库编码数据
 | 
			
		||||
| 
						 | 
				
			
			@ -643,9 +630,13 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    /** 查询在用设备列表 */
 | 
			
		||||
    getUserRecords() {
 | 
			
		||||
      getUserRecordListApi(this.dialogUseQuery).then(response => {
 | 
			
		||||
      this.isDlgLoading = true
 | 
			
		||||
      getUseDemandAndSupplyApi(this.dialogUseQuery).then(response => {
 | 
			
		||||
        this.isDlgLoading = false
 | 
			
		||||
        this.useRecordList = response.data.rows
 | 
			
		||||
        this.dialogUserTotal = response.data.total
 | 
			
		||||
      }).catch(() => {
 | 
			
		||||
        this.isDlgLoading = false
 | 
			
		||||
      })
 | 
			
		||||
    },
 | 
			
		||||
    /** 搜索在用按钮操作 */
 | 
			
		||||
| 
						 | 
				
			
			@ -655,9 +646,9 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    handleDialogUserExport() {
 | 
			
		||||
      this.download(
 | 
			
		||||
        'material/material_maMachine/exportUserRecordList',
 | 
			
		||||
        'material/material_maMachine/exportUseDemandAndSupply',
 | 
			
		||||
        { ...this.dialogUseQuery },
 | 
			
		||||
        `站内库存查询_在用设备_${new Date().getTime()}.xlsx`
 | 
			
		||||
        `材料站供需平衡表_在用设备_${new Date().getTime()}.xlsx`
 | 
			
		||||
      )
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -157,13 +157,13 @@
 | 
			
		|||
          >
 | 
			
		||||
            {{ scope.row.preNum > 0 ? scope.row.preNum : '添加编码' }}
 | 
			
		||||
          </span>
 | 
			
		||||
          <el-input
 | 
			
		||||
          <el-input-number
 | 
			
		||||
            v-if="scope.row.manageType == 1"
 | 
			
		||||
            v-model.number="scope.row.preNum"
 | 
			
		||||
            controls-position="right"
 | 
			
		||||
            placeholder="退料数量"
 | 
			
		||||
            type="number"
 | 
			
		||||
            min="1"
 | 
			
		||||
            clearable
 | 
			
		||||
            :min="0"
 | 
			
		||||
            :precision="scope.row.unitValue == 1 ? 3 : 0"
 | 
			
		||||
            @input="checkNum(scope.row)"
 | 
			
		||||
            style="width: 100%"
 | 
			
		||||
          />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -165,19 +165,19 @@
 | 
			
		|||
      <el-table-column align="center" label="在用数量" prop="useNum" />
 | 
			
		||||
      <el-table-column label="预领数量" prop="preNum" align="center">
 | 
			
		||||
        <template v-slot="scope">
 | 
			
		||||
          <el-input
 | 
			
		||||
          <el-input-number
 | 
			
		||||
            v-model.number="scope.row.preNum"
 | 
			
		||||
            controls-position="right"
 | 
			
		||||
            type="number"
 | 
			
		||||
            style="width: 100%"
 | 
			
		||||
            :min="1"
 | 
			
		||||
            @input="
 | 
			
		||||
            :min="0"
 | 
			
		||||
            :precision="scope.row.unitValue == 1 ? 3 : 0"
 | 
			
		||||
            @change="
 | 
			
		||||
              v =>
 | 
			
		||||
                scope.row.unitValue == 1
 | 
			
		||||
                  ? (scope.row.preNum = Number(v.replace(/[^\d.]/g, '')))
 | 
			
		||||
                  : (scope.row.preNum = Number(v.replace(/[^\d]/g, '')))
 | 
			
		||||
                  ? (scope.row.preNum = Number(String(v).replace(/[^\d.]/g, '')))
 | 
			
		||||
                  : (scope.row.preNum = Number(String(v).replace(/[^\d]/g, '')))
 | 
			
		||||
            "
 | 
			
		||||
          ></el-input>
 | 
			
		||||
          ></el-input-number>
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="管理模式" prop="manageType" align="center">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue