Explorar o código

Merge branch 'xj' of http://192.168.0.115:3000/bill/fuse-code into xj

xzw hai 1 ano
pai
achega
499f704ca1

+ 32 - 3
src/api/floder.ts

@@ -1,6 +1,6 @@
 import { params } from '@/env'
 import { FLODER_LIST } from './constant'
-import axios from './instance'
+import { addUnsetResErrorURLS,axios } from './instance'
 
 export interface Floder {
   filesId:	number,
@@ -12,6 +12,35 @@ export interface Floder {
 
 export type Floders = Floder[]
 
+addUnsetResErrorURLS('/fusion-xj/caseInquest/downDocx', '/fusion-xj/caseExtractDetail/downDocx')
 
-export const fetchFloders = () => 
-  axios.get<Floders>(FLODER_LIST, { params: { caseId: params.caseId } })
+export const fetchFloders = async () => {
+  const floders = await axios.get<Floders>(FLODER_LIST, { params: { caseId: params.caseId } })
+  const otherFloders = [{
+    filesId: 88,
+    filesTypeId: 100,
+    filesTitle: '勘验笔录',
+    ex: '/fusion-xj/caseInquest/info',
+    bex: '/fusion-xj/caseInquest/downDocx'
+  }, {
+    filesId: 89,
+    filesTypeId: 100,
+    filesTitle: '提取清单',
+    ex: '/fusion-xj/caseExtractDetail/info',
+    bex: '/fusion-xj/caseExtractDetail/downDocx'
+  }, ]
+  await Promise.all(otherFloders.map(async of => {
+    const kybl = await axios.get(of.ex, { params: { caseId: params.caseId } })
+    if (kybl) {
+      const data = await axios.get(of.bex, { params: { caseId: params.caseId }, responseType: 'blob' })
+      const blob = data.data
+      floders.push({
+        ...of,
+        caseId: params.caseId.toString(),
+        filesUrl: URL.createObjectURL(blob)
+      })
+    }
+  }))
+
+  return floders
+}

+ 8 - 2
src/api/folder-type.ts

@@ -9,5 +9,11 @@ export interface FloderType {
 export type FloderTypes = FloderType[]
 
 
-export const fetchFloderTypes = () => 
-  axios.get<FloderTypes>(FOLDER_TYPE_LIST)
+export const fetchFloderTypes = async () => {
+  const types =await axios.get<FloderTypes>(FOLDER_TYPE_LIST)
+  types.push({
+    filesTypeId: 100,
+    filesTypeName: '其他',
+  })
+  return types
+}

+ 1 - 0
src/api/instance.ts

@@ -15,6 +15,7 @@ export const {
   addResErrorHandler,
   delReqErrorHandler,
   delResErrorHandler,
+  addUnsetResErrorURLS,
   getToken,
   setToken,
   delToken,

+ 2 - 0
src/store/floder-type.ts

@@ -7,8 +7,10 @@ export const floderTypes = ref<FloderTypes>([])
 export const getFloderType = (id: FloderType['filesTypeId']) => 
   floderTypes.value.find(type => type.filesTypeId === id)
 
+
 export const initialFloderTypes = async () => {
   floderTypes.value = await fetchFloderTypes()
+
 }
 
 export type { FloderType, FloderTypes }

+ 2 - 0
src/store/floder.ts

@@ -10,6 +10,8 @@ export const getFloderByType = (type: FloderType) =>
 
 export const initialFloders = async () => {
   floders.value = await fetchFloders()
+
+  
 }
 
 export type { Floders, Floder } from '@/api'

+ 9 - 3
src/views/folder/index.vue

@@ -28,7 +28,7 @@
 <script lang="ts" setup>
 import { LeftPano } from "@/layout";
 import { computed, ref } from "vue";
-import { getUrlType, MetaType } from "@/utils";
+import { getUrlType, MetaType, saveAs } from "@/utils";
 import { Preview, MediaItem, MediaType } from "@/components/static-preview/index.vue";
 import { floderTypes, getFloderByType } from "@/store";
 
@@ -55,7 +55,7 @@ const typeIcons = {
 };
 
 const currentFile = ref<MediaItem | null>(null);
-const preview = (floder: Floder) => {
+const preview = async (floder: Floder) => {
   const ext = floder.filesUrl
     .substring(floder.filesUrl.lastIndexOf("."))
     .toLocaleLowerCase();
@@ -76,7 +76,13 @@ const preview = (floder: Floder) => {
       : null;
 
   if (!mediaType) {
-    window.open(floder.filesUrl + "?time=" + Date.now());
+    const isBlob = floder.filesUrl.includes("blob");
+
+    if (floder.filesTypeId === 100) {
+      saveAs(floder.filesUrl, floder.filesTitle + ".doc");
+    } else {
+      window.open(floder.filesUrl + (!isBlob ? "?time=" + Date.now() : ""));
+    }
   } else {
     currentFile.value = {
       type: mediaType,