zhangherong
2025-05-28 7056a75cc2d05e8c6fd0b21710d76471fc45c59b
src/views/eam/equipment/EamEquipmentList.vue
@@ -43,7 +43,7 @@
              <a-form-item label="使用车间">
                <a-tree-select v-model="queryParam.orgId"
                               style="width: 100%"
                               :tree-data="treeData"
                               :tree-data="treeDataAlias"
                               :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                               placeholder="请选择使用车间"
                               allow-clear
@@ -85,13 +85,13 @@
      <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-menu-item key="1" @click="handleOpenNameplateModal(selectionRows)">
            <a-icon type="printer"/>
            打印铭牌
          </a-menu-item>
          <a-menu-item key="2" @click="batchDel" v-if="isShowAuth('eam:equipment:delete')">
            <a-icon type="delete"/>
            删除
          </a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作
@@ -107,7 +107,6 @@
        style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onSelectChange([])">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
@@ -117,6 +116,7 @@
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :scroll="{ x: 'max-content' }"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange"
@@ -128,15 +128,15 @@
        <span slot="mdcFlag" slot-scope="text">
          <lx-switch v-model="text" disabled checked-children="是" un-checked-children="否"/>
        </span>
        <span slot="processParametersFlag" slot-scope="text">
<!--        <span slot="processParametersFlag" slot-scope="text">
          <lx-switch v-model="text" disabled checked-children="有" un-checked-children="无"/>
        </span>
        <span slot="precisionParametersFlag" slot-scope="text">
        </span>-->
<!--        <span slot="precisionParametersFlag" slot-scope="text">
          <lx-switch v-model="text" disabled checked-children="有" un-checked-children="无"/>
        </span>
        <span slot="specialEquipment" slot-scope="text">
        </span>-->
<!--        <span slot="specialEquipment" slot-scope="text">
          <lx-switch v-model="text" disabled checked-children="是" un-checked-children="否"/>
        </span>
        </span>-->
        <span slot="action" slot-scope="text, record">
          <a @click.stop="handleEdit(record)">编辑</a>
@@ -153,7 +153,7 @@
              <a-menu-item>
                <a href="javascript:;" @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
              <a-menu-item v-if="isShowAuth('eam:equipment:delete')">
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
@@ -168,13 +168,13 @@
    <a-tabs v-model="activeTabKey" @change="handleTabChange">
      <a-tab-pane tab="设备文档" :key="1">
        <eam-equipment-attachment-list ref="tabPaneTableListRef1" />
        <eam-equipment-attachment-list ref="tabPaneTableListRef1"/>
      </a-tab-pane>
      <a-tab-pane tab="点检工单" :key="2">
        <eam-inspection-order-list ref="tabPaneTableListRef2" :isDisplayOperation="false"/>
      </a-tab-pane>
      <a-tab-pane tab="周保工单" :key="3">
        <eam-week-maintenance-order-list ref="tabPaneTableListRef3" :isDisplayOperation="false" />
        <eam-week-maintenance-order-list ref="tabPaneTableListRef3" :isDisplayOperation="false"/>
      </a-tab-pane>
      <a-tab-pane tab="维修工单" :key="4">
        <eam-repair-order-list ref="tabPaneTableListRef4" :isDisplayOperation="false"/>
@@ -189,7 +189,7 @@
    <!--铭牌弹窗-->
    <nameplate-modal ref="nameplateModalRef" :printedRows="printedRows"/>
    <!--履历弹窗-->
    <resume-drawer ref="resumeDrawerRef"/>
    <resume-drawer ref="resumeDrawerRef" :currentTableRowRecord="currentTableRowRecord"/>
  </a-card>
</template>
@@ -305,7 +305,6 @@
          {
            title: '设备分类',
            align: 'center',
            width: 100,
            dataIndex: 'equipmentCategory_dictText'
          },
          {
@@ -338,23 +337,20 @@
            width: 100,
            dataIndex: 'installationPosition'
          },
          {
            title: '立项卡号',
            align: 'center',
            width: 100,
            dataIndex: 'cardNumber'
          },
          {
            title: '出厂编号',
            align: 'center',
            width: 100,
            dataIndex: 'factoryNumber'
          },
          {
            title: '机床厂家',
            align: 'center',
            width: 100,
            width: 300,
            dataIndex: 'manufacturingEnterprise'
          },
          {
@@ -394,52 +390,52 @@
            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',
          //   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',
          //   dataIndex: 'equipmentPort'
          // },
          // {
          //   title: '坐标数量',
          //   align: 'center',
          //   dataIndex: 'coordinateNum'
          // },
          {
            title: '创建人',
            align: 'center',
            width: 100,
            dataIndex: 'createBy_dictText'
          },
          {
            title: '创建时间',
            align: 'center',
            width: 200,
            dataIndex: 'createTime'
          },
          {
@@ -455,7 +451,6 @@
          {
            title: '备注',
            align: 'center',
            width: 100,
            dataIndex: 'remark'
          },
          {
@@ -479,7 +474,9 @@
        treeData: [],
        printedRows: [],
        activeTabKey: 1,
        appHomeUrl: ''
        appHomeUrl: '',
        currentTableRowRecord: {},
        treeDataAlias: [],
      }
    },
    computed: {
@@ -497,6 +494,8 @@
        getAction(this.url.loadProductionOptions).then(res => {
          if (res.success) {
            this.treeData = [...res.result]
            this.treeDataAlias = this.deepCopyAndModify(res.result)
            console.info('treeDataAlias====', this.treeDataAlias)
          } else {
            that.$message.warning(res.message)
          }
@@ -518,7 +517,11 @@
       * @param record 表格行信息
       */
      handleOpenResumeDrawer(record) {
        this.currentTableRowRecord = Object.assign({}, record)
        this.$refs.resumeDrawerRef.title = '设备履历' + `(${record.equipmentCode})`
        this.$refs.resumeDrawerRef.dataSource = []
        this.$refs.resumeDrawerRef.visible = true
        this.$nextTick(() => this.$refs.resumeDrawerRef.getEquipmentResumeByApi())
      },
      /**
@@ -565,7 +568,7 @@
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys
        this.selectionRows = selectionRows
        this.$refs['tabPaneTableListRef' + this.activeTabKey].queryParam.equipmentId = null;
        this.$refs['tabPaneTableListRef' + this.activeTabKey].queryParam.equipmentId = null
        this.$refs['tabPaneTableListRef' + this.activeTabKey].dataSource = []
        this.$refs['tabPaneTableListRef' + this.activeTabKey].onClearSelected()
        if (selectedRowKeys.length === 1) this.loadTabPaneTableData(selectedRowKeys[0])
@@ -582,7 +585,38 @@
            this.appHomeUrl = res.result.settingValue
          }
        })
      }
      },
      deepCopyAndModify(arr) {
        // 如果当前元素不是数组或对象,直接返回
        if (!Array.isArray(arr) && typeof arr !== 'object' || arr === null || arr.length === 0) {
          return arr;
        }
        // 如果是数组,创建一个新数组并递归处理每个元素
        if (Array.isArray(arr)) {
          const newArray = [];
          for (let i = 0; i < arr.length; i++) {
            newArray.push(this.deepCopyAndModify(arr[i]));
          }
          return newArray;
        }
        // 如果是对象,创建一个新对象并递归处理每个属性
        const newObj = {};
        for (const key in arr) {
          if (arr.hasOwnProperty(key)) {
            if(key === 'selectable') {
              newObj[key] = true;
            } else if(key === 'children') {
              newObj[key] = this.deepCopyAndModify(arr[key]);
            }else {
              newObj[key] = arr[key];
            }
          }
        }
        return newObj;
      },
    }
  }
</script>