zhaowei
2025-02-27 c5f1d9790f712b5d7d5de9c5e58a0f0de5dec928
新增设备故障维修报表页面并完成布局样式及功能
已添加2个文件
已修改2个文件
351 ■■■■■ 文件已修改
src/views/mdc/base/EquipmentFailureRepaireReport.vue 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/EquipmentFailureCloseTime/EquipmentFailureCloseTimeList.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/EquipmentFailureRepaireReport/EquipmentFailureRepaireReportList.vue 267 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/modules/EquipmentRepairTime/EquipmentRepairTimeList.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/base/EquipmentFailureRepaireReport.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
<template>
  <div style="width: 100%; height: 100%;">
    <a-card :bordered="false">
      <a-row type="flex" :gutter="16">
        <a-col :md="5">
          <a-tabs :activeKey="activeKey" @change="tabChange">
            <a-tab-pane key="1" tab="车间层级" force-render>
              <base-tree @getCurrSelected="changeSelectionNode"></base-tree>
            </a-tab-pane>
            <a-tab-pane v-if="isDepartType == 0" key="2" tab="部门层级">,
              <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree>
            </a-tab-pane>
          </a-tabs>
        </a-col>
        <a-col :md="19">
          <EquipmentFailureRepaireReportList :nodePeople='selectPeople' :nodeTree='selectEquipment' :Type="selectTypeTree"/>
        </a-col>
      </a-row>
    </a-card>
  </div>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import BaseTree from '../common/BaseTree'
  import EquipmentFailureRepaireReportList from './modules/EquipmentFailureRepaireReport/EquipmentFailureRepaireReportList'
  import DepartTree from './modules/DepartList/DepartListTree/DepartTree'
  import { mapActions } from 'vuex'
  export default {
    name: 'EquipmentFailureRepaireReport',
    components: {
      BaseTree,
      DepartTree,
      EquipmentFailureRepaireReportList
    },
    data() {
      return {
        activeKey: '1',
        selectEquipmentId: '',
        selectEquipment: {},
        selectPeople: {},
        selectTypeTree: '',
        isDepartType: ''
      }
    },
    created() {
      this.queryTreeData()
    },
    methods: {
      ...mapActions(['QueryDepartTree']),
      queryTreeData() {
        this.QueryDepartTree().then(res => {
          if (res.success) {
            this.isDepartType = res.result[0].value
          } else {
            // this.$message.warn(res.message)
            this.$notification.warning({
              message: '消息',
              description: res.message
            })
          }
        }).finally(() => {
        })
      },
      tabChange(val) {
        this.activeKey = val
        this.selectTypeTree = val
      },
      changeSelectionNode(val) {
        this.selectEquipment = val
        this.selectTypeTree = '1'
      },
      changeSelectionNodedd(val) {
        this.selectPeople = val
        this.selectTypeTree = '2'
      }
    }
  }
</script>
src/views/mdc/base/modules/EquipmentFailureCloseTime/EquipmentFailureCloseTimeList.vue
@@ -61,6 +61,7 @@
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
        <template slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
src/views/mdc/base/modules/EquipmentFailureRepaireReport/EquipmentFailureRepaireReportList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,267 @@
<template>
  <div class="device_list">
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="设备编号">
              <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentId"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="月份">
              <a-range-picker
                :placeholder="['开始时间', '结束时间']"
                format="YYYY-MM"
                :value="dates"
                :mode="['month', 'month']"
                @panelChange="dateParamChange"
                @change="handleDateChange"
              />
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-space>
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload">重置</a-button>
            </a-space>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æŸ¥è¯¢åŒºåŸŸ-END -->
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button type="primary" icon="download" @click="handleExportXls('设备故障维修报表')">导出</a-button>
    </div>
    <!-- table区域-begin -->
    <div id="DeviceList" style="flex: 1;overflow: hidden">
      <a-table
        ref="table"
        :scroll="{x:'max-content',y:scrollY}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
      />
    </div>
  </div>
</template>
<script>
  import moment from 'moment'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  export default {
    name: 'EquipmentFailureRepaireReportList',
    mixins: [JeecgListMixin],
    components: {  },
    props: { nodeTree: '', Type: '', nodePeople: '' },
    data() {
      return {
        disableMixinCreated: true,
        /* åˆ†é¡µå‚æ•° */
        ipagination: {
          current: 1,
          pageSize: 30,
          pageSizeOptions: ['30', '50', '100'],
          showTotal: (total, range) => {
            return range[0] + '-' + range[1] + ' å…±' + total + '条'
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        dates: [moment().subtract('month', 1), moment().subtract('month', 1)],
        queryParam: {},
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '设备编号',
            align: 'center',
            dataIndex: 'equipmentId',
            width: 200
          },
          {
            title: '总故障次数',
            align: 'center',
            dataIndex: 'totalDownCount',
            width: 100
          }, {
            title: '总故障停机时间(hour)',
            align: 'center',
            dataIndex: 'totalDownLong',
            width: 150
          },
          {
            title: '总维修次数',
            align: 'center',
            dataIndex: 'totalRepairCount',
            width: 100
          }, {
            title: '总维修时间(hour)',
            align: 'center',
            dataIndex: 'totalRepairLong',
            width: 150
          },
          {
            title: 'MTBF(hour)',
            align: 'center',
            dataIndex: 'mtbf',
            width: 150
          }, {
            title: 'MTTR(hour)',
            align: 'center',
            dataIndex: 'mttr',
            width: 150
          },
          {
            title: '日期',
            align: 'center',
            dataIndex: 'theDate',
            width: 150
          }
        ],
        scrollY: 465,
        url: {
          list: '/mdc/mdcMttrInfo/list',
          exportXlsUrl: '/mdc/mdcMttrInfo/exportXls'
        }
      }
    },
    watch: {
      Type(valmath) {
        this.dataList = []
        this.queryParam.typeTree = valmath
        // console.log(this.queryParam.typeTree)
      },
      nodeTree(val) { //监听currSelected å˜åŒ–,将变化后的数值传递给 getCurrSelected äº‹ä»¶
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParam.parentId = ''
            this.queryParam.equipmentId = val.equipmentId
          } else {
            this.queryParam.parentId = val.key
            this.queryParam.equipmentId = ''
          }
          this.searchQuery()
        }
      },
      nodePeople(val) {
        if (JSON.stringify(val) != '{}') {
          if (val.equipmentId) {
            this.queryParam.parentId = ''
            this.queryParam.equipmentId = val.equipmentId
          } else {
            this.queryParam.parentId = val.key
            this.queryParam.equipmentId = ''
          }
          this.searchQuery()
        }
      }
    },
    methods: {
      handleComputeModalOpen() {
        this.$refs.computeEquipmentFailureCloseTimeModalRef.visible = true
      },
      dateParamChange(value) {
        console.log('dateParamChangeValue', value)
        this.dates = value
        this.queryParam.startTime = moment(this.dates[0]).format('YYYY-MM')
        this.queryParam.endTime = moment(this.dates[1]).format('YYYY-MM')
      },
      handleDateChange(value) {
        console.log('handleDateChangeValue', value)
        if (!value.length) {
          delete this.queryParam.startTime
          delete this.queryParam.endTime
          this.dates = []
        }
      },
      searchReset() {
        this.queryParam = {}
        this.dates = []
        this.loadData(1)
      },
      /**
       * å½“浏览器可视窗口尺寸发生改变时触发
       */
      handleWindowResize() {
        const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0, -2)
        const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0, -2)
        this.scrollY = boxHeight - tableHeadHeight - 50
      }
    },
    created() {
      this.queryParam.startTime = moment(this.dates[0]).format('YYYY-MM')
      this.queryParam.endTime = moment(this.dates[1]).format('YYYY-MM')
      this.loadData()
    },
    mounted() {
      window.addEventListener('resize', this.handleWindowResize)
      this.handleWindowResize()
    },
    beforeDestroy() {
      window.removeEventListener('resize', this.handleWindowResize)
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
  .device_list {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  @media screen and (min-width: 1920px) {
    .device_list {
      height: 811px !important;
    }
  }
  @media screen and (min-width: 1680px) and (max-width: 1920px) {
    .device_list {
      height: 811px !important;
    }
  }
  @media screen and (min-width: 1400px) and (max-width: 1680px) {
    .device_list {
      height: 663px !important;
    }
  }
  @media screen and (min-width: 1280px) and (max-width: 1400px) {
    .device_list {
      height: 564px !important;
    }
  }
  @media screen and (max-width: 1280px) {
    .device_list {
      height: 564px !important;
    }
  }
</style>
src/views/mdc/base/modules/EquipmentRepairTime/EquipmentRepairTimeList.vue
@@ -61,6 +61,7 @@
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}">
        <template slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>