lyh
17 小时以前 50e9a40ac746c7d46bd0b9f74e98d4d478cf5e64
src/views/eam/base/EamMaintenanceStandardList.vue
@@ -96,6 +96,12 @@
               :pagination="ipagination" :loading="loading" :scroll="{x:'max-content'}"
               :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :customRow='clickThenSelect'
               @change="handleTableChange">
        <!--使用部门-->
        <template slot="factoryOrgCode" slot-scope="text,record">
          {{[record.zxfactoryOrgCode_dictText].filter(item=>item).join('/')}}
        </template>
        <span slot="action" slot-scope="text, record">
          <a v-has="'standard:upgrade'" v-if="record.standardStatus === 'START'"
             @click.stop="handleUpgrade(record)">升版</a>
@@ -129,8 +135,7 @@
          </a-popconfirm>
          </template>
          <template
            v-if="record.standardStatus !== 'WAIT_SUBMIT'&&record.standardStatus!=='ABOLISH'&&record.standardStatus!=='START'">
          <template>
            <a-divider type="vertical"/>
            <a @click.stop="handleDetail(record)">详情</a>
@@ -231,6 +236,11 @@
            dataIndex: 'equipmentModel',
          },
          {
            title: '使用部门',
            align: 'center',
            scopedSlots: { customRender: 'factoryOrgCode' },
          },
          {
            title: '规范状态',
            align: 'center',
            dataIndex: 'standardStatus_dictText',
@@ -282,7 +292,7 @@
          inspectionImportExcel: '/eam/maintenanceStandard/importPointInspection',
          secondMaintenanceImportExcel: '/eam/maintenanceStandard/importSecondMaintenanceStandard',
          thirdMaintenanceImportExcel: '/eam/maintenanceStandard/importThirdMaintenanceStandard',
          inspectionXlsDownloadUrl: '导入模板/设备点检标准导入模板.xlsx',
          inspectionXlsDownloadUrl: '导入模板/设备点检标准导入模板.xls',
          secondMaintenanceXlsDownloadUrl: '导入模板/生产设备二级保养规范.docx',
          thirdMaintenanceXlsDownloadUrl: '导入模板/生产设备三级保养规范.docx'
        },
@@ -309,7 +319,6 @@
        dataIndex: 'action',
        align: 'center',
        scopedSlots: { customRender: 'action' },
        width: 200,
        fixed: 'right'
      }
      this.columns = [...this.columns, operationColumn]
@@ -404,13 +413,87 @@
       */
      handleAddUpgrade(id){
        this.$refs.fileImportModule.upload(id);
        this.$refs.fileImportModule.title="导入"
        this.$refs.fileImportModule.title="升版导入"
      },
      getTreeDataByApi(){
        this.loadData();
      },
      /* 导入 */
      handleImportExcel(info) {
        this.loading = true;
        if (info.file.status === 'done') {
          this.loading = false;
          // 检查响应内容是否为CSV格式(包含未找到的设备编码)
          if (info.file.response && typeof info.file.response === 'string' &&
            info.file.response.includes('未找到的设备编码')) {
            // 创建CSV文件并下载
            const blob = new Blob([info.file.response], { type: 'text/csv;charset=utf-8' });
            const downloadUrl = window.URL.createObjectURL(blob);
            const link = document.createElement('a');
            link.href = downloadUrl;
            link.setAttribute('download', '未找到的设备编码.csv');
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
            window.URL.revokeObjectURL(downloadUrl);
            // 显示提示信息
            this.$notification.warning({
              message: '导入完成',
              description: '导入成功但存在未找到的设备编码,已下载未找到的设备编码列表'
            });
            this.loadData();
            return;
          }
          // 处理常规JSON响应
          if (info.file.response && info.file.response.success) {
            this.$notification.success({
              message: '导入成功',
              description: info.file.response.message || `${info.file.name} 文件上传成功`
            });
            this.loadData();
          } else {
            const fileName = info.file.name || '未知文件';
            const errorMessage = info.file.response && info.file.response.message
              ? info.file.response.message
              : '导入失败,未知错误';
            this.$notification.error({
              message: '导入失败',
              description: `${fileName} ${errorMessage}`
            });
          }
        } else if (info.file.status === 'error') {
          this.loading = false;
          const fileName = info.file.name || '未知文件';
          let errorMessage = '上传失败,未知错误';
          if (info.file.response) {
            if (info.file.response.message) {
              errorMessage = info.file.response.message;
            } else if (info.file.response.error) {
              errorMessage = info.file.response.error;
            }
          } else if (info.file.error) {
            errorMessage = info.file.error.message || info.file.error;
          }
          this.$notification.error({
            message: '上传失败',
            description: `${fileName} ${errorMessage}`
          });
        }
      },
      batchDel() {
        var ids = ''
        for (var a = 0; a < this.selectedRowKeys.length; a++) {