fix: 上传接口变更

This commit is contained in:
TsMask
2025-02-26 11:12:06 +08:00
parent 7429a55734
commit 5a61fc355e
13 changed files with 47 additions and 26 deletions

View File

@@ -168,7 +168,7 @@ export async function uploadFileChunk(
*/
export function chunkCheck(identifier: string, fileName: string) {
return request({
url: '/file/chunkCheck',
url: '/file/chunk-check',
method: 'POST',
data: { identifier, fileName },
timeout: 60_000,
@@ -188,7 +188,7 @@ export function chunkMerge(
subPath: string = 'default'
) {
return request({
url: '/file/chunkMerge',
url: '/file/chunk-merge',
method: 'POST',
data: { identifier, fileName, subPath },
timeout: 60_000,
@@ -202,7 +202,7 @@ export function chunkMerge(
*/
export function chunkUpload(data: FormData) {
return request({
url: '/file/chunkUpload',
url: '/file/chunk-upload',
method: 'POST',
data,
dataType: 'form-data',
@@ -216,7 +216,7 @@ export function chunkUpload(data: FormData) {
*/
export function transferStaticFile(data: Record<string, any>) {
return request({
url: `/file/transferStaticFile`,
url: `/file/transfer-static-file`,
method: 'POST',
data,
timeout: 60_000,
@@ -243,7 +243,7 @@ export async function uploadFileToNE(
url: `/ne/action/pushFile`,
method: 'POST',
data: {
uploadPath: uploadChunkRes.data.fileName,
uploadPath: uploadChunkRes.data.filePath,
neType,
neId,
},

View File

@@ -114,13 +114,13 @@ function fnUpload(up: UploadRequestOption) {
if (filePath === '') return undefined;
const form = toRaw(stateForm.form);
form.avatar = filePath;
uerStore.setAvatar(filePath);
return updateUserProfile(form);
})
.then(res => {
if (res === undefined) return;
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.account.settings.uploadOk'), 3);
uerStore.setAvatar(res.data);
} else {
message.error(res.msg, 3);
}
@@ -257,6 +257,7 @@ onMounted(() => {
<a-upload
name="file"
list-type="picture"
accept=".jpg,.png"
:max-count="1"
:show-upload-list="false"
:before-upload="fnBeforeUpload"

View File

@@ -14,6 +14,7 @@ import saveAs from 'file-saver';
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
import { writeSheet } from '@/utils/execl-utils';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { parseDateToStr } from '@/utils/date-utils';
const neInfoStore = useNeInfoStore();
const { getDict } = useDictStore();
const { t } = useI18n();
@@ -154,6 +155,12 @@ let tableColumns: ColumnsType = [
align: 'center',
sorter: (a: any, b: any) => 1,
width: 5,
customRender(opt) {
if (typeof opt.value === 'number') {
return parseDateToStr(+opt.value);
}
return opt.value;
},
},
{
title: t('common.operate'),

View File

@@ -18,6 +18,7 @@ import useNeInfoStore from '@/store/modules/neinfo';
import saveAs from 'file-saver';
import { writeSheet } from '@/utils/execl-utils';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { parseDateToStr } from '@/utils/date-utils';
const neInfoStore = useNeInfoStore();
const { getDict } = useDictStore();
const { t } = useI18n();
@@ -171,6 +172,12 @@ let tableColumns: ColumnsType = [
align: 'center',
sorter: (a: any, b: any) => 1,
width: 5,
customRender(opt) {
if (typeof opt.value === 'number') {
return parseDateToStr(+opt.value);
}
return opt.value;
},
},
{
title: t('views.faultManage.activeAlarm.alarmType'),
@@ -204,6 +211,12 @@ let tableColumns: ColumnsType = [
align: 'left',
sorter: (a: any, b: any) => 1,
width: 5,
customRender(opt) {
if (typeof opt.value === 'number') {
return parseDateToStr(+opt.value);
}
return opt.value;
},
},
{
title: t('views.faultManage.activeAlarm.ackState'),
@@ -540,7 +553,7 @@ function fnGetList(pageNum?: number) {
queryParams.beginTime = queryRangePicker.value[0];
queryParams.endTime = queryRangePicker.value[1];
listAct(toRaw(queryParams)).then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
if (res.code === RESULT_CODE_SUCCESS) {
// 取消勾选
if (state.selectedRowKeys.length > 0) {
state.selectedRowKeys = [];
@@ -941,7 +954,7 @@ onMounted(() => {
:label="t('views.faultManage.activeAlarm.eventTime')"
name="eventTime"
>
{{ modalState.from.eventTime }}
{{ parseDateToStr(modalState.from.eventTime) }}
</a-form-item>
</a-col>
</a-row>

View File

@@ -212,11 +212,11 @@ function fnUploadFile(up: UploadRequestOption) {
// 改为完成状态
uploadFile.percent = 100;
uploadFile.status = 'done';
uploadFile.path = res.data.fileName;
uploadFile.path = res.data.filePath;
// 预置到表单
const { fileName, originalFileName } = res.data;
const { filePath, originalFileName } = res.data;
modalState.from.name = originalFileName;
modalState.from.path = fileName;
modalState.from.path = filePath;
} else {
message.error(res.msg, 3);
}
@@ -290,7 +290,7 @@ function fnUploadFileDep(up: UploadRequestOption) {
// 改为完成状态
uploadFile.percent = 100;
uploadFile.status = 'done';
uploadFile.path = res.data.fileName;
uploadFile.path = res.data.filePath;
} else {
message.error(res.msg, 3);
}

View File

@@ -264,7 +264,7 @@ function fnUploadFile(up: UploadRequestOption) {
// 改为完成状态
uploadFile.percent = 100;
uploadFile.status = 'done';
uploadFile.path = res.data.fileName;
uploadFile.path = res.data.filePath;
} else {
message.error(res.msg, 3);
}
@@ -338,7 +338,7 @@ function fnUploadFileDep(up: UploadRequestOption) {
// 改为完成状态
uploadFile.percent = 100;
uploadFile.status = 'done';
uploadFile.path = res.data.fileName;
uploadFile.path = res.data.filePath;
} else {
message.error(res.msg, 3);
}

View File

@@ -683,7 +683,7 @@ function fnModalUploadImportUpload(file: File) {
uploadFile(formData)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
return res.data.fileName;
return res.data.filePath;
} else {
uploadImportState.msg = res.msg;
uploadImportState.loading = false;

View File

@@ -1043,7 +1043,7 @@ function fnModalUploadImportUpload(file: File) {
uploadFile(formData)
.then(res => {
if (res.code === RESULT_CODE_SUCCESS) {
return res.data.fileName;
return res.data.filePath;
} else {
uploadImportState.msg = res.msg;
uploadImportState.loading = false;

View File

@@ -93,16 +93,16 @@ function fnUpload(up: UploadRequestOption) {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.system.quickStart.sysUploadOk'), 3);
state.filePath = res.data.fileName;
state.filePath = res.data.filePath;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
: import.meta.env.VITE_API_BASE_URL;
if (state.type === 'icon') {
state.icon = `${baseUrl}${res.data.fileName}`;
state.icon = `${baseUrl}${res.data.filePath}`;
}
if (state.type === 'brand') {
state.brand = `${baseUrl}${res.data.fileName}`;
state.brand = `${baseUrl}${res.data.filePath}`;
}
} else {
message.error(res.msg, 3);

View File

@@ -50,7 +50,7 @@ function fnUpload(up: UploadRequestOption) {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.system.setting.uploadSuccess'), 3);
state.filePath = res.data.fileName;
state.filePath = res.data.filePath;
} else {
message.error(res.msg, 3);
}

View File

@@ -66,12 +66,12 @@ function fnUpload(up: UploadRequestOption) {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.system.setting.uploadSuccess'), 3);
state.filePath = res.data.fileName;
state.filePath = res.data.filePath;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
: import.meta.env.VITE_API_BASE_URL;
state.flag = `${baseUrl}${res.data.fileName}`;
state.flag = `${baseUrl}${res.data.filePath}`;
} else {
message.error(res.msg, 3);
}

View File

@@ -70,16 +70,16 @@ function fnUpload(up: UploadRequestOption) {
hide();
if (res.code === RESULT_CODE_SUCCESS) {
message.success(t('views.system.setting.uploadSuccess'), 3);
state.filePath = res.data.fileName;
state.filePath = res.data.filePath;
// 兼容旧前端可改配置文件
const baseUrl = import.meta.env.PROD
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
: import.meta.env.VITE_API_BASE_URL;
if (state.type === 'icon') {
state.icon = `${baseUrl}${res.data.fileName}`;
state.icon = `${baseUrl}${res.data.filePath}`;
}
if (state.type === 'brand') {
state.brand = `${baseUrl}${res.data.fileName}`;
state.brand = `${baseUrl}${res.data.filePath}`;
}
} else {
message.error(res.msg, 3);

View File

@@ -118,7 +118,7 @@ function fnUpload(up: UploadRequestOption) {
if (res.code === 200) {
message.success('文件上传成功', 3);
state.uploadFilePath = res.data.url;
state.downloadFilePath = res.data.fileName;
state.downloadFilePath = res.data.filePath;
} else {
message.error(res.msg, 3);
}