1
0
tangning 2 місяців тому
батько
коміт
48a4b3753f
1 змінених файлів з 13 додано та 3 видалено
  1. 13 3
      src/view/material/index.vue

+ 13 - 3
src/view/material/index.vue

@@ -113,7 +113,7 @@
 </template>
 
 <script setup lang="ts">
-import { uploadNewFile, addByMediaLiBrary, getSceneListHasAi } from "@/store/case";
+import { uploadNewFile, addByMediaLiBrary, getSceneListHasAi, exportCaseInquestInfo } from "@/store/case";
 import { computed, ref, reactive } from "vue";
 import { addCaseFile } from "../originalPhoto/quisk";
 import { ElMessage, ElMessageBox } from "element-plus";
@@ -235,7 +235,7 @@ async function handleAdd(filesTypeName) {
   getList()
   console.log("handleAdd");
 }
-const handleCommand = (command: string | number | object, item) => {
+const handleCommand =  async (command: string | number | object, item) => {
   switch (command) {
     case "edit":
       handleRecords(item.filesId)
@@ -246,12 +246,22 @@ const handleCommand = (command: string | number | object, item) => {
     default:
       // window.open(item.filesUrl)
       console.log("other", item);
+      if(item.filesId){
+          const res = await exportCaseInquestInfo(item.filesId);
+          const href = URL.createObjectURL(res)
+          saveAs(href, item.filesTitle+'.docx');
+          return;
+      }
       downloadFile(item.filesUrl, item.filesTitle)
   }
   // ElMessage(`click on item ${command}`)
 }
 function getExtension (name) {
-      return name.substring(name.lastIndexOf("."))
+  try {
+    return name.substring(name.lastIndexOf("."))
+  } catch (error) {
+    return ".docx"
+  }
 }
 // 下载文件
 function downloadFile(sourceUrl, fileName,) {