1、配合地区管理接口的api文件,后端修改相应字段可以不要此文件

2、基础设施/文件管理/文件列表 上传失败无法上传只能刷新页面才能上传bug
3、基础设施/文件管理/文件列表 新增是下拉框显示0 设置为null
This commit is contained in:
gexinzhineng/gxzn27 2023-03-28 11:27:08 +08:00
parent d6f2eafbde
commit 944015484a
4 changed files with 58 additions and 4 deletions

View File

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

View File

@ -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>
}
}

View File

@ -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: {

View File

@ -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('最多只能上传一个文件!')