diff --git a/src/api/infra/fileConfig/index.ts b/src/api/infra/fileConfig/index.ts index 2151141c..9a4f625c 100644 --- a/src/api/infra/fileConfig/index.ts +++ b/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 diff --git a/src/config/axios/request.ts b/src/config/axios/request.ts new file mode 100644 index 00000000..d65842c2 --- /dev/null +++ b/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 (option: any) => { + const res = await request({ method: 'GET', ...option }) + return res as unknown as T + }, + post: async (option: any) => { + const res = await request({ method: 'POST', ...option }) + return res as unknown as T + }, + delete: async (option: any) => { + const res = await request({ method: 'DELETE', ...option }) + return res as unknown as T + }, + put: async (option: any) => { + const res = await request({ method: 'PUT', ...option }) + return res as unknown as T + }, + patch: async (option: any) => { + const res = await request({ method: 'PATCH', ...option }) + return res as unknown as T + }, + download: async (option: any) => { + const res = await request({ method: 'GET', responseType: 'blob', ...option }) + return res as unknown as Promise + }, + upload: async (option: any) => { + option.headersType = 'multipart/form-data' + const res = await request({ method: 'POST', ...option }) + return res as unknown as Promise + } +} diff --git a/src/views/infra/fileConfig/index.vue b/src/views/infra/fileConfig/index.vue index 9d796a65..bd9a978a 100644 --- a/src/views/infra/fileConfig/index.vue +++ b/src/views/infra/fileConfig/index.vue @@ -183,7 +183,7 @@ const detailData = ref() // 详情 Ref const form = ref({ 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: { diff --git a/src/views/infra/fileList/index.vue b/src/views/infra/fileList/index.vue index cda8b68d..b9bfb815 100644 --- a/src/views/infra/fileList/index.vue +++ b/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 @@