zhaowei
2025-04-02 66d2a3a44b44489eaab5465bd7a2e906d508d898
src/views/eam/equipment/EamEquipmentList.vue
@@ -82,11 +82,16 @@
                @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-button type="primary" icon="download" @click="handleTemplateXlsDownload">导入模板下载</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
          <a-menu-item key="2" @click="handleOpenNameplateModal(selectionRows)">
            <a-icon type="printer"/>
            打印铭牌
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
@@ -100,7 +105,7 @@
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
        <a style="margin-left: 24px" @click="onSelectChange([])">清空</a>
      </div>
      <a-table
@@ -114,7 +119,9 @@
        :loading="loading"
        :scroll="{ x: 'max-content' }"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        @change="handleTableChange"
        :customRow="customTableRow"
      >
        <span slot="equipmentImportance" slot-scope="text">
          <lx-switch v-model="text" disabled checked-children="是" un-checked-children="否"/>
        </span>
@@ -131,14 +138,17 @@
          <lx-switch v-model="text" disabled checked-children="是" un-checked-children="否"/>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a @click.stop="handleEdit(record)">编辑</a>
          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a href="javascript:;" @click="handleOpenNameplateModal(record)">铭牌</a>
                <a href="javascript:;" @click="handleOpenNameplateModal([record])">铭牌</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="handleOpenResumeDrawer(record)">履历</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="handleDetail(record)">详情</a>
@@ -156,10 +166,18 @@
    </div>
    <!-- table区域-end -->
    <a-tabs v-model="activeTabKey">
      <a-tab-pane tab="保养标准" :key="1">
        <eam-maintenance-standard-list ref="tabPaneTableListRef" :isDisplayOperation="false"/>
      </a-tab-pane>
    </a-tabs>
    <!-- 表单区域 -->
    <eamEquipment-modal ref="modalForm" @ok="modalFormOk"></eamEquipment-modal>
    <!--铭牌弹窗-->
    <nameplate-modal ref="nameplateModalRef"/>
    <nameplate-modal ref="nameplateModalRef" :printedRows="printedRows"/>
    <!--履历弹窗-->
    <resume-drawer ref="resumeDrawerRef"/>
  </a-card>
</template>
@@ -167,13 +185,18 @@
import '@/assets/less/TableExpand.less'
import EamEquipmentModal from './modules/EamEquipmentModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@api/manage'
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'
export default {
  name: 'EamEquipmentList',
  mixins: [JeecgListMixin],
  components: {
    EamMaintenanceStandardList,
    ResumeDrawer,
    NameplateModal,
    EamEquipmentModal
  },
@@ -268,7 +291,7 @@
        {
          title: '设备型号',
          align: 'center',
          width: 100,
          width: 200,
          dataIndex: 'equipmentModel'
        },
        {
@@ -390,6 +413,26 @@
          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,
@@ -410,9 +453,13 @@
        deleteBatch: '/eam/equipment/deleteBatch',
        exportXlsUrl: 'eam/equipment/exportXls',
        importExcelUrl: 'eam/equipment/importExcel',
        loadProductionOptions: '/mdc/mdcProduction/loadProductionTreeOptions'
        loadProductionOptions: '/mdc/mdcProduction/loadProductionTreeOptions',
        templateXlsDownloadUrl: '导入模板/设备台账导入模板_v1.0.xlsx'
      },
      treeData: []
      treeData: [],
      printedRows: [],
      activeTabKey: 1,
      appHomeUrl: ''
    }
  },
  computed: {
@@ -422,6 +469,7 @@
  },
  created() {
    this.loadAllProductionTree()
    this.loadAppHomeUrlConfigValue()
  },
  methods: {
    loadAllProductionTree() {
@@ -437,11 +485,73 @@
    /**
     * 开启铭牌弹窗
     * @param record
     * @param recordArray 表格行信息集合
     */
    handleOpenNameplateModal(record) {
      this.$refs.nameplateModalRef.model = Object.assign({}, record)
    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) {
      return {
        style: {
          cursor: 'pointer'
        },
        on: {
          click: () => {
            this.onSelectChange([record.id])
          }
        }
      }
    },
    /**
     * 加载页签表格数据
     * @param id 设备台账行记录Id
     */
    loadTabPaneTableData(id) {
      this.$refs.tabPaneTableListRef.queryParam.equipmentId = id
      this.$refs.tabPaneTableListRef.loadData(1)
    },
    /**
     * 设备台账表格多选框状态改变时触发
     * @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])
    },
    handleTemplateXlsDownload() {
      templateXlsDownload(this.url.templateXlsDownloadUrl)
    },
    loadAppHomeUrlConfigValue() {
      let params = { settingKey: 'app_home_url' }
      getSystemConfigValue(params).then(res => {
        if (res.success) {
          this.appHomeUrl = res.result.settingValue
        }
      })
    }
  }
}