zhangym 2 年之前
父节点
当前提交
1f045f505e
共有 1 个文件被更改,包括 28 次插入37 次删除
  1. 28 37
      src/views/energyOperationSupport/components/securitys/pic2.vue

+ 28 - 37
src/views/energyOperationSupport/components/securitys/pic2.vue

@@ -13,11 +13,11 @@
               <el-checkbox v-model="searchParam.radioTime" @change="isShowTimeinfo">显示时间</el-checkbox>
             </el-col>
             <el-col :span="2" class="mt10">
-              <el-checkbox v-model="searchParam.radioItemStatus" @change="isShowItemStatus">显示状态</el-checkbox>
+              <el-checkbox @change="isShowItemStatus">显示状态</el-checkbox>
             </el-col>
 
             <el-col :span="2" class="mt10">
-              <el-checkbox  @change="isShowItemStatus">显示简介</el-checkbox>
+              <el-checkbox @click="previewstart">显示简介</el-checkbox>
             </el-col>
 
             <div class="crumb-nav2">
@@ -1256,11 +1256,10 @@ export default {
           });
       }
     },
-       //预览简介
-       previewstart(data) {
+    //预览简介
+    previewstart() {
       let that = this;
       that.loading = true;
-      that.chart.fileData = data;
       let SubmitData = {
         fileName: '简介.docx',
         fileUrl: '/安泰控股集团/集团/2023/05/25/1684977494620440.docx'
@@ -1268,40 +1267,32 @@ export default {
       let urla = 'pass/ems/v1/uploadfiles/getfile/';
       let type = 'text/html';
       let responseType = 'application/json';
-      if (data.filename !== null) {
-        let fileExtension = data.filename.substring(data.filename.lastIndexOf('.') + 1);
-        if (fileExtension === 'pdf') {
-          urla = 'pass/ems/v1/uploadfiles/downloadFile/';
-          type = 'application/pdf';
-          responseType = 'blob';
-        }
-        that.axios.get(urla, {
-          params: SubmitData,
-          responseType: responseType
-        }).then(function (res) {
-          let urlObject = window.URL || window.webkitURL || window;
-          // 将二进制流转为blob
-          let blob = new Blob([res], {
+      that.axios.get(urla, {
+        params: SubmitData,
+        responseType: responseType
+      }).then(function (res) {
+        let urlObject = window.URL || window.webkitURL || window;
+        // 将二进制流转为blob
+        let blob = new Blob([res], {
+          type: type
+        });
+        if (fileExtension !== 'pdf') {
+          blob = new Blob([res.data], {
             type: type
           });
-          if (fileExtension !== 'pdf') {
-            blob = new Blob([res.data], {
-              type: type
-            });
-          }
-          let blobURL = urlObject.createObjectURL(blob);
-          that.dialogVisible = true;
-          that.previewUrl = blobURL;
-          that.tableLoading = false;
-          that.loading = false;
-          setTimeout(() => {
-            urlObject.revokeObjectURL(blobURL);
-          }, 1000)
-        }).catch(function () {
-          that.$message.error('预览失败');
-          that.loading = true;
-        })
-      }
+        }
+        let blobURL = urlObject.createObjectURL(blob);
+        that.dialogVisible = true;
+        that.previewUrl = blobURL;
+        that.tableLoading = false;
+        that.loading = false;
+        setTimeout(() => {
+          urlObject.revokeObjectURL(blobURL);
+        }, 1000)
+      }).catch(function () {
+        that.$message.error('预览失败');
+        that.loading = true;
+      })
 
     },
     //预览文件