Browse Source

1、配合地区管理接口的api文件,后端修改相应字段可以不要此文件
2、基础设施/文件管理/文件列表 上传失败无法上传只能刷新页面才能上传bug
3、基础设施/文件管理/文件列表 新增是下拉框显示0 设置为null

gexinzhineng/gxzn27 2 years ago
parent
commit
944015484a

+ 1 - 1
src/api/infra/fileConfig/index.ts

@@ -16,7 +16,7 @@ export interface FileClientConfig {
 export interface FileConfigVO {
   id: number
   name: string
-  storage: number
+  storage: any
   master: boolean
   visible: boolean
   config: FileClientConfig

+ 50 - 0
src/config/axios/request.ts

@@ -0,0 +1,50 @@
+import { service } from './service'
+
+import { config } from './config'
+
+const { default_headers } = config
+
+const request = (option: any) => {
+  const { url, method, params, data, headersType, responseType } = option
+  return service({
+    url: url,
+    method,
+    params,
+    data,
+    responseType: responseType,
+    headers: {
+      'Content-Type': headersType || default_headers
+    }
+  })
+}
+export default {
+  get: async <T = any>(option: any) => {
+    const res = await request({ method: 'GET', ...option })
+    return res as unknown as T
+  },
+  post: async <T = any>(option: any) => {
+    const res = await request({ method: 'POST', ...option })
+    return res as unknown as T
+  },
+  delete: async <T = any>(option: any) => {
+    const res = await request({ method: 'DELETE', ...option })
+    return res as unknown as T
+  },
+  put: async <T = any>(option: any) => {
+    const res = await request({ method: 'PUT', ...option })
+    return res as unknown as T
+  },
+  patch: async <T = any>(option: any) => {
+    const res = await request({ method: 'PATCH', ...option })
+    return res as unknown as T
+  },
+  download: async <T = any>(option: any) => {
+    const res = await request({ method: 'GET', responseType: 'blob', ...option })
+    return res as unknown as Promise<T>
+  },
+  upload: async <T = any>(option: any) => {
+    option.headersType = 'multipart/form-data'
+    const res = await request({ method: 'POST', ...option })
+    return res as unknown as Promise<T>
+  }
+}

+ 2 - 2
src/views/infra/fileConfig/index.vue

@@ -183,7 +183,7 @@ const detailData = ref() // 详情 Ref
 const form = ref<FileConfigApi.FileConfigVO>({
   id: 0,
   name: '',
-  storage: 0,
+  storage: null,
   master: false,
   visible: false,
   config: {
@@ -216,7 +216,7 @@ const handleCreate = (formEl: FormInstance | undefined) => {
   form.value = {
     id: 0,
     name: '',
-    storage: 0,
+    storage: null,
     master: false,
     visible: false,
     config: {

+ 5 - 1
src/views/infra/fileList/index.vue

@@ -59,6 +59,7 @@
       :on-exceed="handleExceed"
       :on-success="handleFileSuccess"
       :on-error="excelUploadError"
+      :before-remove="beforeRemove"
       :auto-upload="false"
       accept=".jpg, .png, .gif"
     >
@@ -82,7 +83,7 @@
   </XModal>
 </template>
 <script setup lang="ts" name="FileList">
-import type { UploadInstance, UploadRawFile } from 'element-plus'
+import type { UploadInstance, UploadRawFile, UploadProps } from 'element-plus'
 // 业务相关的 import
 import { allSchemas } from './fileList.data'
 import * as FileApi from '@/api/infra/fileList'
@@ -141,6 +142,9 @@ const handleFileSuccess = async (response: any): Promise<void> => {
   uploadDisabled.value = false
   await reload()
 }
+const beforeRemove: UploadProps['beforeRemove'] = () => {
+  uploadDisabled.value = false
+}
 // 文件数超出提示
 const handleExceed = (): void => {
   message.error('最多只能上传一个文件!')