lyh
17 小时以前 50e9a40ac746c7d46bd0b9f74e98d4d478cf5e64
src/views/eam/base/EamMaintenanceStandardList.vue
@@ -96,9 +96,19 @@
               :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>
          <a-divider v-has="'standard:add:upgrade'" v-if="record.standardStatus === 'START'" type="vertical"/>
          <a v-has="'standard:add:upgrade'" v-if="record.standardStatus === 'START'" @click="handleAddUpgrade(record.id)" >升版导入</a>
          <template v-if="record.standardStatus === 'WAIT_SUBMIT'">
              <a v-has="'standard:edit'" @click.stop="handleEdit(record)">编辑</a>
@@ -125,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>
@@ -170,6 +179,9 @@
    <!--审批窗口-->
    <maintenance-standard-approval-modal ref="maintenanceStandardApprovalModal" :selectShenpiData="selectedRowData"/>
    <!--导入文件-->
    <MaintenanceStandardImportModule ref="fileImportModule" @ok="getTreeDataByApi" />
  </a-card>
</template>
@@ -182,6 +194,7 @@
  import LxSearchEquipmentSelect from '@views/eam/equipment/modules/LxSearchEquipmentSelect.vue'
  import MaintenanceStandardApprovalModal
    from '../../flowable/workflow/MaintenanceStandard/MaintenanceStandardApprovalModal'
  import MaintenanceStandardImportModule from "@views/base/modules/file/MaintenanceStandardImportModule.vue";
  export default {
@@ -194,6 +207,7 @@
      }
    },
    components: {
      MaintenanceStandardImportModule,
      MaintenanceStandardApprovalModal,
      LxSearchEquipmentSelect,
      EamMaintenanceStandardModal,
@@ -220,6 +234,11 @@
            title: '设备型号',
            align: 'center',
            dataIndex: 'equipmentModel',
          },
          {
            title: '使用部门',
            align: 'center',
            scopedSlots: { customRender: 'factoryOrgCode' },
          },
          {
            title: '规范状态',
@@ -273,7 +292,7 @@
          inspectionImportExcel: '/eam/maintenanceStandard/importPointInspection',
          secondMaintenanceImportExcel: '/eam/maintenanceStandard/importSecondMaintenanceStandard',
          thirdMaintenanceImportExcel: '/eam/maintenanceStandard/importThirdMaintenanceStandard',
          inspectionXlsDownloadUrl: '导入模板/设备点检标准导入模板.xlsx',
          inspectionXlsDownloadUrl: '导入模板/设备点检标准导入模板.xls',
          secondMaintenanceXlsDownloadUrl: '导入模板/生产设备二级保养规范.docx',
          thirdMaintenanceXlsDownloadUrl: '导入模板/生产设备三级保养规范.docx'
        },
@@ -300,7 +319,6 @@
        dataIndex: 'action',
        align: 'center',
        scopedSlots: { customRender: 'action' },
        width: 200,
        fixed: 'right'
      }
      this.columns = [...this.columns, operationColumn]
@@ -389,6 +407,93 @@
        this.$refs.maintenanceStandardApprovalModal.handleDetail(record)
      },
      /**
       * 点击升版导入时触发时触发
       * @param record
       */
      handleAddUpgrade(id){
        this.$refs.fileImportModule.upload(id);
        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++) {