mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	1、配合地区管理接口的api文件,后端修改相应字段可以不要此文件
2、基础设施/文件管理/文件列表 上传失败无法上传只能刷新页面才能上传bug 3、基础设施/文件管理/文件列表 新增是下拉框显示0 设置为null
This commit is contained in:
		@@ -16,7 +16,7 @@ export interface FileClientConfig {
 | 
				
			|||||||
export interface FileConfigVO {
 | 
					export interface FileConfigVO {
 | 
				
			||||||
  id: number
 | 
					  id: number
 | 
				
			||||||
  name: string
 | 
					  name: string
 | 
				
			||||||
  storage: number
 | 
					  storage: any
 | 
				
			||||||
  master: boolean
 | 
					  master: boolean
 | 
				
			||||||
  visible: boolean
 | 
					  visible: boolean
 | 
				
			||||||
  config: FileClientConfig
 | 
					  config: FileClientConfig
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										50
									
								
								src/config/axios/request.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								src/config/axios/request.ts
									
									
									
									
									
										Normal 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>
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -183,7 +183,7 @@ const detailData = ref() // 详情 Ref
 | 
				
			|||||||
const form = ref<FileConfigApi.FileConfigVO>({
 | 
					const form = ref<FileConfigApi.FileConfigVO>({
 | 
				
			||||||
  id: 0,
 | 
					  id: 0,
 | 
				
			||||||
  name: '',
 | 
					  name: '',
 | 
				
			||||||
  storage: 0,
 | 
					  storage: null,
 | 
				
			||||||
  master: false,
 | 
					  master: false,
 | 
				
			||||||
  visible: false,
 | 
					  visible: false,
 | 
				
			||||||
  config: {
 | 
					  config: {
 | 
				
			||||||
@@ -216,7 +216,7 @@ const handleCreate = (formEl: FormInstance | undefined) => {
 | 
				
			|||||||
  form.value = {
 | 
					  form.value = {
 | 
				
			||||||
    id: 0,
 | 
					    id: 0,
 | 
				
			||||||
    name: '',
 | 
					    name: '',
 | 
				
			||||||
    storage: 0,
 | 
					    storage: null,
 | 
				
			||||||
    master: false,
 | 
					    master: false,
 | 
				
			||||||
    visible: false,
 | 
					    visible: false,
 | 
				
			||||||
    config: {
 | 
					    config: {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,6 +59,7 @@
 | 
				
			|||||||
      :on-exceed="handleExceed"
 | 
					      :on-exceed="handleExceed"
 | 
				
			||||||
      :on-success="handleFileSuccess"
 | 
					      :on-success="handleFileSuccess"
 | 
				
			||||||
      :on-error="excelUploadError"
 | 
					      :on-error="excelUploadError"
 | 
				
			||||||
 | 
					      :before-remove="beforeRemove"
 | 
				
			||||||
      :auto-upload="false"
 | 
					      :auto-upload="false"
 | 
				
			||||||
      accept=".jpg, .png, .gif"
 | 
					      accept=".jpg, .png, .gif"
 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
@@ -82,7 +83,7 @@
 | 
				
			|||||||
  </XModal>
 | 
					  </XModal>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
<script setup lang="ts" name="FileList">
 | 
					<script setup lang="ts" name="FileList">
 | 
				
			||||||
import type { UploadInstance, UploadRawFile } from 'element-plus'
 | 
					import type { UploadInstance, UploadRawFile, UploadProps } from 'element-plus'
 | 
				
			||||||
// 业务相关的 import
 | 
					// 业务相关的 import
 | 
				
			||||||
import { allSchemas } from './fileList.data'
 | 
					import { allSchemas } from './fileList.data'
 | 
				
			||||||
import * as FileApi from '@/api/infra/fileList'
 | 
					import * as FileApi from '@/api/infra/fileList'
 | 
				
			||||||
@@ -141,6 +142,9 @@ const handleFileSuccess = async (response: any): Promise<void> => {
 | 
				
			|||||||
  uploadDisabled.value = false
 | 
					  uploadDisabled.value = false
 | 
				
			||||||
  await reload()
 | 
					  await reload()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					const beforeRemove: UploadProps['beforeRemove'] = () => {
 | 
				
			||||||
 | 
					  uploadDisabled.value = false
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
// 文件数超出提示
 | 
					// 文件数超出提示
 | 
				
			||||||
const handleExceed = (): void => {
 | 
					const handleExceed = (): void => {
 | 
				
			||||||
  message.error('最多只能上传一个文件!')
 | 
					  message.error('最多只能上传一个文件!')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user