Skip to content

Commit 9440154

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

File tree

4 files changed

+58
-4
lines changed

4 files changed

+58
-4
lines changed

src/api/infra/fileConfig/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface FileClientConfig {
1616
export interface FileConfigVO {
1717
id: number
1818
name: string
19-
storage: number
19+
storage: any
2020
master: boolean
2121
visible: boolean
2222
config: FileClientConfig

src/config/axios/request.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { service } from './service'
2+
3+
import { config } from './config'
4+
5+
const { default_headers } = config
6+
7+
const request = (option: any) => {
8+
const { url, method, params, data, headersType, responseType } = option
9+
return service({
10+
url: url,
11+
method,
12+
params,
13+
data,
14+
responseType: responseType,
15+
headers: {
16+
'Content-Type': headersType || default_headers
17+
}
18+
})
19+
}
20+
export default {
21+
get: async <T = any>(option: any) => {
22+
const res = await request({ method: 'GET', ...option })
23+
return res as unknown as T
24+
},
25+
post: async <T = any>(option: any) => {
26+
const res = await request({ method: 'POST', ...option })
27+
return res as unknown as T
28+
},
29+
delete: async <T = any>(option: any) => {
30+
const res = await request({ method: 'DELETE', ...option })
31+
return res as unknown as T
32+
},
33+
put: async <T = any>(option: any) => {
34+
const res = await request({ method: 'PUT', ...option })
35+
return res as unknown as T
36+
},
37+
patch: async <T = any>(option: any) => {
38+
const res = await request({ method: 'PATCH', ...option })
39+
return res as unknown as T
40+
},
41+
download: async <T = any>(option: any) => {
42+
const res = await request({ method: 'GET', responseType: 'blob', ...option })
43+
return res as unknown as Promise<T>
44+
},
45+
upload: async <T = any>(option: any) => {
46+
option.headersType = 'multipart/form-data'
47+
const res = await request({ method: 'POST', ...option })
48+
return res as unknown as Promise<T>
49+
}
50+
}

src/views/infra/fileConfig/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ const detailData = ref() // 详情 Ref
183183
const form = ref<FileConfigApi.FileConfigVO>({
184184
id: 0,
185185
name: '',
186-
storage: 0,
186+
storage: null,
187187
master: false,
188188
visible: false,
189189
config: {
@@ -216,7 +216,7 @@ const handleCreate = (formEl: FormInstance | undefined) => {
216216
form.value = {
217217
id: 0,
218218
name: '',
219-
storage: 0,
219+
storage: null,
220220
master: false,
221221
visible: false,
222222
config: {

src/views/infra/fileList/index.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
:on-exceed="handleExceed"
6060
:on-success="handleFileSuccess"
6161
:on-error="excelUploadError"
62+
:before-remove="beforeRemove"
6263
:auto-upload="false"
6364
accept=".jpg, .png, .gif"
6465
>
@@ -82,7 +83,7 @@
8283
</XModal>
8384
</template>
8485
<script setup lang="ts" name="FileList">
85-
import type { UploadInstance, UploadRawFile } from 'element-plus'
86+
import type { UploadInstance, UploadRawFile, UploadProps } from 'element-plus'
8687
// 业务相关的 import
8788
import { allSchemas } from './fileList.data'
8889
import * as FileApi from '@/api/infra/fileList'
@@ -141,6 +142,9 @@ const handleFileSuccess = async (response: any): Promise<void> => {
141142
uploadDisabled.value = false
142143
await reload()
143144
}
145+
const beforeRemove: UploadProps['beforeRemove'] = () => {
146+
uploadDisabled.value = false
147+
}
144148
// 文件数超出提示
145149
const handleExceed = (): void => {
146150
message.error('最多只能上传一个文件!')

0 commit comments

Comments
 (0)