Browse Source

fix: 上传增加tableName和tableId参数

master
zhangli 1 year ago
parent
commit
7429bcac56
  1. 4
      src/api/path/infra.api.ts
  2. 7
      src/views/chart/ContentConfigurations/components/CanvasPage/index.vue

4
src/api/path/infra.api.ts

@ -3,9 +3,9 @@ import { httpErrorHandle } from '@/utils'
import { RequestHttpEnum, ModuleTypeEnum, ContentTypeEnum } from '@/enums/httpEnum'
// * 上传文件
export const uploadFile = async (data: object) => {
export const uploadFile = async (data: object,upData: object) => {
try {
const res = await http(RequestHttpEnum.POST)<string>(`${ModuleTypeEnum.INFRA}/file/upload`, data, ContentTypeEnum.FORM_DATA)
const res = await http(RequestHttpEnum.POST)<string>(`${ModuleTypeEnum.INFRA}/file/upload?tableId=${upData.tableId}&tableName=${upData.tableName}`, data, ContentTypeEnum.FORM_DATA)
return res
} catch {
httpErrorHandle()

7
src/views/chart/ContentConfigurations/components/CanvasPage/index.vue

@ -282,7 +282,12 @@ const customRequest = (options: UploadCustomRequestOptions) => {
)
let uploadParams = new FormData()
uploadParams.append('file', newNameFile)
const uploadRes = await uploadFile(uploadParams)
const upData = {
tableId: fetchRouteParamsLocation(),
tableName: 'reportGoViewProject',
}
const uploadRes = await uploadFile(uploadParams, upData)
if(uploadRes && uploadRes.code === ResultEnum.SUCCESS) {
chartEditStore.setEditCanvasConfig(

Loading…
Cancel
Save