src/views/eam/equipment/EamEquipmentList.vue
@@ -166,9 +166,12 @@
    </div>
    <!-- table区域-end -->
    <a-tabs v-model="activeTabKey">
    <a-tabs v-model="activeTabKey" @change="handleTabChange">
      <a-tab-pane tab="保养标准" :key="1">
        <eam-maintenance-standard-list ref="tabPaneTableListRef" :isDisplayOperation="false"/>
        <eam-maintenance-standard-list ref="tabPaneTableListRef1" :isDisplayOperation="false"/>
      </a-tab-pane>
      <a-tab-pane tab="维修工单" :key="2">
        <eam-repair-order-list ref="tabPaneTableListRef2" :isDisplayOperation="false"/>
      </a-tab-pane>
    </a-tabs>
@@ -182,380 +185,391 @@
</template>
<script>
import '@/assets/less/TableExpand.less'
import EamEquipmentModal from './modules/EamEquipmentModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction, templateXlsDownload } from '@api/manage'
import NameplateModal from '@views/eam/equipment/modules/NameplateModal.vue'
import { getSystemConfigValue } from '@api/api'
import ResumeDrawer from '@views/eam/equipment/modules/ResumeDrawer.vue'
import EamMaintenanceStandardList from '@views/eam/base/EamMaintenanceStandardList.vue'
  import '@/assets/less/TableExpand.less'
  import EamEquipmentModal from './modules/EamEquipmentModal'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { getAction, templateXlsDownload } from '@api/manage'
  import NameplateModal from '@views/eam/equipment/modules/NameplateModal.vue'
  import { getSystemConfigValue } from '@api/api'
  import ResumeDrawer from '@views/eam/equipment/modules/ResumeDrawer.vue'
  import EamMaintenanceStandardList from '@views/eam/base/EamMaintenanceStandardList.vue'
  import EamRepairOrderList from '../repair/EamRepairOrderList'
export default {
  name: 'EamEquipmentList',
  mixins: [JeecgListMixin],
  components: {
    EamMaintenanceStandardList,
    ResumeDrawer,
    NameplateModal,
    EamEquipmentModal
  },
  data() {
    return {
      description: '设备台账管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          },
          fixed: 'left'
        },
        {
          title: '设备编号',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentCode',
          ellipsis: true,
          fixed: 'left',
          sorter: true
        },
        {
          title: '设备名称',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentName',
          ellipsis: true,
          fixed: 'left'
        },
        {
          title: '关键设备标识',
          align: 'center',
          width: 120,
          dataIndex: 'equipmentImportance',
          scopedSlots: { customRender: 'equipmentImportance' }
        },
        {
          title: '资产状态',
          align: 'center',
          width: 100,
          dataIndex: 'assetStatus_dictText'
        },
        {
          title: '技术状态',
          align: 'center',
          width: 100,
          dataIndex: 'technologyStatus_dictText'
        },
        {
          title: '维修状态',
          align: 'center',
          width: 100,
          dataIndex: 'repairStatus_dictText'
        },
        {
          title: '保养状态',
          align: 'center',
          width: 100,
          dataIndex: 'maintenanceStatus_dictText'
        },
        {
          title: '操作系统',
          align: 'center',
          width: 100,
          dataIndex: 'operationSystem'
        },
        {
          title: '使用车间',
          align: 'center',
          width: 100,
          dataIndex: 'orgId_dictText'
        },
        {
          title: '设备管理员',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentManager_dictText'
        },
        {
          title: '设备分类',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentCategory_dictText'
        },
        {
          title: '设备型号',
          align: 'center',
          width: 200,
          dataIndex: 'equipmentModel'
        },
        {
          title: '设备规格',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentSpecification'
        },
        {
          title: '主轴连接尺寸',
          align: 'center',
          width: 120,
          dataIndex: 'spindleConnectDimension'
        },
        {
          title: '总功率',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentPower'
        },
        {
          title: '安装位置',
          align: 'center',
          width: 100,
          dataIndex: 'installationPosition'
        },
        {
          title: '立项卡号',
          align: 'center',
          width: 100,
          dataIndex: 'cardNumber'
        },
        {
          title: '出厂编号',
          align: 'center',
          width: 100,
          dataIndex: 'factoryNumber'
        },
        {
          title: '机床厂家',
          align: 'center',
          width: 100,
          dataIndex: 'manufacturingEnterprise'
        },
        {
          title: '来源国家',
          align: 'center',
          width: 100,
          dataIndex: 'originCountry'
        },
        {
          title: '出厂日期',
          align: 'center',
          width: 100,
          dataIndex: 'leaveFactoryDate'
        },
        {
          title: '验收日期',
          align: 'center',
          width: 100,
          dataIndex: 'acceptanceCheckDate'
        },
        {
          title: '质保开始日期',
          align: 'center',
          width: 120,
          dataIndex: 'warrantyStartDate'
        },
        {
          title: '质保结束日期',
          align: 'center',
          width: 120,
          dataIndex: 'warrantyEndDate'
        },
        {
          title: '是否实施MDC',
          align: 'center',
          width: 120,
          dataIndex: 'mdcFlag',
          scopedSlots: { customRender: 'mdcFlag' }
        },
        {
          title: '有无工艺参数',
          align: 'center',
          width: 120,
          dataIndex: 'processParametersFlag',
          scopedSlots: { customRender: 'processParametersFlag' }
        },
        {
          title: '有无精度参数',
          align: 'center',
          width: 120,
          dataIndex: 'precisionParametersFlag',
          scopedSlots: { customRender: 'precisionParametersFlag' }
        },
        {
          title: '是否为特种设备',
          align: 'center',
          width: 120,
          dataIndex: 'specialEquipment',
          scopedSlots: { customRender: 'specialEquipment' }
        },
        {
          title: '重量',
          align: 'center',
          dataIndex: 'equipmentWeight'
        },
        {
          title: '设备端口',
          align: 'center',
          width: 100,
          dataIndex: 'equipmentPort'
        },
        {
          title: '坐标数量',
          align: 'center',
          width: 100,
          dataIndex: 'coordinateNum'
        },
        {
          title: '创建人',
          align: 'center',
          dataIndex: 'createBy_dictText'
        },
        {
          title: '创建时间',
          align: 'center',
          dataIndex: 'createTime'
        },
        {
          title: '更新人',
          align: 'center',
          dataIndex: 'updateBy_dictText'
        },
        {
          title: '更新时间',
          align: 'center',
          dataIndex: 'updateTime'
        },
        {
          title: '备注',
          align: 'center',
          width: 100,
          dataIndex: 'remark'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          width: 150,
          scopedSlots: { customRender: 'action' },
          fixed: 'right'
        }
      ],
      url: {
        list: '/eam/equipment/list',
        delete: '/eam/equipment/delete',
        deleteBatch: '/eam/equipment/deleteBatch',
        exportXlsUrl: 'eam/equipment/exportXls',
        importExcelUrl: 'eam/equipment/importExcel',
        loadProductionOptions: '/mdc/mdcProduction/loadProductionTreeOptions',
        templateXlsDownloadUrl: '导入模板/设备台账导入模板_v1.0.xlsx'
      },
      treeData: [],
      printedRows: [],
      activeTabKey: 1,
      appHomeUrl: ''
    }
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  created() {
    this.loadAllProductionTree()
    this.loadAppHomeUrlConfigValue()
  },
  methods: {
    loadAllProductionTree() {
      //加载车间选择树
      getAction(this.url.loadProductionOptions).then(res => {
        if (res.success) {
          this.treeData = [...res.result]
        } else {
          that.$message.warning(res.message)
        }
      })
  export default {
    name: 'EamEquipmentList',
    mixins: [JeecgListMixin],
    components: {
      EamRepairOrderList,
      EamMaintenanceStandardList,
      ResumeDrawer,
      NameplateModal,
      EamEquipmentModal
    },
    /**
     * 开启铭牌弹窗
     * @param recordArray 表格行信息集合
     */
    handleOpenNameplateModal(recordArray) {
      this.printedRows = recordArray
      this.$refs.nameplateModalRef.httpUrl = this.appHomeUrl
      this.$refs.nameplateModalRef.visible = true
    },
    /**
     * 开启履历抽屉
     * @param record 表格行信息
     */
    handleOpenResumeDrawer(record) {
      this.$refs.resumeDrawerRef.visible = true
    },
    /**
     * 自定义设备台账表格行
     * @param record 表格行信息
     * @returns {{style: {cursor: string}, on: {click: *}}} 样式对象与事件方法
     */
    customTableRow(record) {
    data() {
      return {
        style: {
          cursor: 'pointer'
        },
        on: {
          click: () => {
            this.onSelectChange([record.id])
        description: '设备台账管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            },
            fixed: 'left'
          },
          {
            title: '设备编号',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentCode',
            ellipsis: true,
            fixed: 'left',
            sorter: true
          },
          {
            title: '设备名称',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentName',
            ellipsis: true,
            fixed: 'left'
          },
          {
            title: '关键设备标识',
            align: 'center',
            width: 120,
            dataIndex: 'equipmentImportance',
            scopedSlots: { customRender: 'equipmentImportance' }
          },
          {
            title: '资产状态',
            align: 'center',
            width: 100,
            dataIndex: 'assetStatus_dictText'
          },
          {
            title: '技术状态',
            align: 'center',
            width: 100,
            dataIndex: 'technologyStatus_dictText'
          },
          {
            title: '维修状态',
            align: 'center',
            width: 100,
            dataIndex: 'repairStatus_dictText'
          },
          {
            title: '保养状态',
            align: 'center',
            width: 100,
            dataIndex: 'maintenanceStatus_dictText'
          },
          {
            title: '操作系统',
            align: 'center',
            width: 100,
            dataIndex: 'operationSystem'
          },
          {
            title: '使用车间',
            align: 'center',
            width: 100,
            dataIndex: 'orgId_dictText'
          },
          {
            title: '设备管理员',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentManager_dictText'
          },
          {
            title: '设备分类',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentCategory_dictText'
          },
          {
            title: '设备型号',
            align: 'center',
            width: 200,
            dataIndex: 'equipmentModel'
          },
          {
            title: '设备规格',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentSpecification'
          },
          {
            title: '主轴连接尺寸',
            align: 'center',
            width: 120,
            dataIndex: 'spindleConnectDimension'
          },
          {
            title: '总功率',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentPower'
          },
          {
            title: '安装位置',
            align: 'center',
            width: 100,
            dataIndex: 'installationPosition'
          },
          {
            title: '立项卡号',
            align: 'center',
            width: 100,
            dataIndex: 'cardNumber'
          },
          {
            title: '出厂编号',
            align: 'center',
            width: 100,
            dataIndex: 'factoryNumber'
          },
          {
            title: '机床厂家',
            align: 'center',
            width: 100,
            dataIndex: 'manufacturingEnterprise'
          },
          {
            title: '来源国家',
            align: 'center',
            width: 100,
            dataIndex: 'originCountry'
          },
          {
            title: '出厂日期',
            align: 'center',
            width: 100,
            dataIndex: 'leaveFactoryDate'
          },
          {
            title: '验收日期',
            align: 'center',
            width: 100,
            dataIndex: 'acceptanceCheckDate'
          },
          {
            title: '质保开始日期',
            align: 'center',
            width: 120,
            dataIndex: 'warrantyStartDate'
          },
          {
            title: '质保结束日期',
            align: 'center',
            width: 120,
            dataIndex: 'warrantyEndDate'
          },
          {
            title: '是否实施MDC',
            align: 'center',
            width: 120,
            dataIndex: 'mdcFlag',
            scopedSlots: { customRender: 'mdcFlag' }
          },
          {
            title: '有无工艺参数',
            align: 'center',
            width: 120,
            dataIndex: 'processParametersFlag',
            scopedSlots: { customRender: 'processParametersFlag' }
          },
          {
            title: '有无精度参数',
            align: 'center',
            width: 120,
            dataIndex: 'precisionParametersFlag',
            scopedSlots: { customRender: 'precisionParametersFlag' }
          },
          {
            title: '是否为特种设备',
            align: 'center',
            width: 120,
            dataIndex: 'specialEquipment',
            scopedSlots: { customRender: 'specialEquipment' }
          },
          {
            title: '重量',
            align: 'center',
            dataIndex: 'equipmentWeight'
          },
          {
            title: '设备端口',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentPort'
          },
          {
            title: '坐标数量',
            align: 'center',
            width: 100,
            dataIndex: 'coordinateNum'
          },
          {
            title: '创建人',
            align: 'center',
            dataIndex: 'createBy_dictText'
          },
          {
            title: '创建时间',
            align: 'center',
            dataIndex: 'createTime'
          },
          {
            title: '更新人',
            align: 'center',
            dataIndex: 'updateBy_dictText'
          },
          {
            title: '更新时间',
            align: 'center',
            dataIndex: 'updateTime'
          },
          {
            title: '备注',
            align: 'center',
            width: 100,
            dataIndex: 'remark'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: 'center',
            width: 150,
            scopedSlots: { customRender: 'action' },
            fixed: 'right'
          }
        }
        ],
        url: {
          list: '/eam/equipment/list',
          delete: '/eam/equipment/delete',
          deleteBatch: '/eam/equipment/deleteBatch',
          exportXlsUrl: 'eam/equipment/exportXls',
          importExcelUrl: 'eam/equipment/importExcel',
          loadProductionOptions: '/mdc/mdcProduction/loadProductionTreeOptions',
          templateXlsDownloadUrl: '导入模板/设备台账导入模板_v1.0.xlsx'
        },
        treeData: [],
        printedRows: [],
        activeTabKey: 1,
        appHomeUrl: ''
      }
    },
    /**
     * 加载页签表格数据
     * @param id 设备台账行记录Id
     */
    loadTabPaneTableData(id) {
      this.$refs.tabPaneTableListRef.queryParam.equipmentId = id
      this.$refs.tabPaneTableListRef.loadData(1)
    computed: {
      importExcelUrl: function() {
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
      }
    },
    /**
     * 设备台账表格多选框状态改变时触发
     * @param selectedRowKeys 已选择的rowKey集合
     * @param selectionRows 当前分页下已选择的行信息集合
     */
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectionRows = selectionRows
      this.$refs.tabPaneTableListRef.dataSource = []
      this.$refs.tabPaneTableListRef.onClearSelected()
      if (selectedRowKeys.length === 1) this.loadTabPaneTableData(selectedRowKeys[0])
    created() {
      this.loadAllProductionTree()
      this.loadAppHomeUrlConfigValue()
    },
    methods: {
      loadAllProductionTree() {
        //加载车间选择树
        getAction(this.url.loadProductionOptions).then(res => {
          if (res.success) {
            this.treeData = [...res.result]
          } else {
            that.$message.warning(res.message)
          }
        })
      },
    handleTemplateXlsDownload() {
      templateXlsDownload(this.url.templateXlsDownloadUrl)
    },
      /**
       * 开启铭牌弹窗
       * @param recordArray 表格行信息集合
       */
      handleOpenNameplateModal(recordArray) {
        this.printedRows = recordArray
        this.$refs.nameplateModalRef.httpUrl = this.appHomeUrl
        this.$refs.nameplateModalRef.visible = true
      },
    loadAppHomeUrlConfigValue() {
      let params = { settingKey: 'app_home_url' }
      getSystemConfigValue(params).then(res => {
        if (res.success) {
          this.appHomeUrl = res.result.settingValue
      /**
       * 开启履历抽屉
       * @param record 表格行信息
       */
      handleOpenResumeDrawer(record) {
        this.$refs.resumeDrawerRef.visible = true
      },
      /**
       * 自定义设备台账表格行
       * @param record 表格行信息
       * @returns {{style: {cursor: string}, on: {click: *}}} 样式对象与事件方法
       */
      customTableRow(record) {
        return {
          style: {
            cursor: 'pointer'
          },
          on: {
            click: () => {
              this.onSelectChange([record.id])
            }
          }
        }
      })
      },
      /**
       * 页签改变时触发
       * @param activeTabKey 当前激活的页签key
       */
      handleTabChange(activeTabKey) {
        if (this.selectedRowKeys.length !== 1) return
        this.$nextTick(() => this.loadTabPaneTableData(this.selectedRowKeys[0]))
      },
      /**
       * 加载页签表格数据
       * @param id 设备台账行记录Id
       */
      loadTabPaneTableData(id) {
        this.$refs['tabPaneTableListRef' + this.activeTabKey].queryParam.equipmentId = id
        this.$refs['tabPaneTableListRef' + this.activeTabKey].loadData(1)
      },
      /**
       * 设备台账表格多选框状态改变时触发
       * @param selectedRowKeys 已选择的rowKey集合
       * @param selectionRows 当前分页下已选择的行信息集合
       */
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectionRows = selectionRows
        this.$refs['tabPaneTableListRef' + this.activeTabKey].dataSource = []
        this.$refs['tabPaneTableListRef' + this.activeTabKey].onClearSelected()
        if (selectedRowKeys.length === 1) this.loadTabPaneTableData(selectedRowKeys[0])
      },
      handleTemplateXlsDownload() {
        templateXlsDownload(this.url.templateXlsDownloadUrl)
      },
      loadAppHomeUrlConfigValue() {
        let params = { settingKey: 'app_home_url' }
        getSystemConfigValue(params).then(res => {
          if (res.success) {
            this.appHomeUrl = res.result.settingValue
          }
        })
      }
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
  @import '~@assets/less/common.less';
</style>