From 5a61fc355ec912f644d96620f46283f407092419 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 26 Feb 2025 11:12:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=8A=E4=BC=A0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/tool/file.ts | 10 +++++----- src/views/account/components/base-info.vue | 3 ++- src/views/faultManage/event/index.vue | 7 +++++++ src/views/faultManage/history-alarm/index.vue | 17 +++++++++++++++-- .../ne/neSoftware/components/EditModal.vue | 8 ++++---- .../ne/neSoftware/components/UploadMoreFile.vue | 4 ++-- src/views/neUser/auth/index.vue | 2 +- src/views/neUser/sub/index.vue | 2 +- .../quick-start/components/SystemConfig.vue | 6 +++--- .../setting/components/change-help-doc.vue | 2 +- .../setting/components/change-login-bg.vue | 4 ++-- .../system/setting/components/change-logo.vue | 6 +++--- src/views/tool/upload/index.vue | 2 +- 13 files changed, 47 insertions(+), 26 deletions(-) diff --git a/src/api/tool/file.ts b/src/api/tool/file.ts index bd953004..5a29df83 100644 --- a/src/api/tool/file.ts +++ b/src/api/tool/file.ts @@ -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) { 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, }, diff --git a/src/views/account/components/base-info.vue b/src/views/account/components/base-info.vue index 30a48c55..8c166dc5 100644 --- a/src/views/account/components/base-info.vue +++ b/src/views/account/components/base-info.vue @@ -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(() => { 1, width: 5, + customRender(opt) { + if (typeof opt.value === 'number') { + return parseDateToStr(+opt.value); + } + return opt.value; + }, }, { title: t('common.operate'), diff --git a/src/views/faultManage/history-alarm/index.vue b/src/views/faultManage/history-alarm/index.vue index 83615056..9813e2ac 100644 --- a/src/views/faultManage/history-alarm/index.vue +++ b/src/views/faultManage/history-alarm/index.vue @@ -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) }} diff --git a/src/views/ne/neSoftware/components/EditModal.vue b/src/views/ne/neSoftware/components/EditModal.vue index 0afe1a5e..10af7fe9 100644 --- a/src/views/ne/neSoftware/components/EditModal.vue +++ b/src/views/ne/neSoftware/components/EditModal.vue @@ -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); } diff --git a/src/views/ne/neSoftware/components/UploadMoreFile.vue b/src/views/ne/neSoftware/components/UploadMoreFile.vue index f3fee8ec..61bbad45 100644 --- a/src/views/ne/neSoftware/components/UploadMoreFile.vue +++ b/src/views/ne/neSoftware/components/UploadMoreFile.vue @@ -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); } diff --git a/src/views/neUser/auth/index.vue b/src/views/neUser/auth/index.vue index a1cea9db..3610b9fd 100644 --- a/src/views/neUser/auth/index.vue +++ b/src/views/neUser/auth/index.vue @@ -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; diff --git a/src/views/neUser/sub/index.vue b/src/views/neUser/sub/index.vue index f944fd96..162b7b64 100644 --- a/src/views/neUser/sub/index.vue +++ b/src/views/neUser/sub/index.vue @@ -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; diff --git a/src/views/system/quick-start/components/SystemConfig.vue b/src/views/system/quick-start/components/SystemConfig.vue index 2a7fd1aa..1801c9c2 100644 --- a/src/views/system/quick-start/components/SystemConfig.vue +++ b/src/views/system/quick-start/components/SystemConfig.vue @@ -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); diff --git a/src/views/system/setting/components/change-help-doc.vue b/src/views/system/setting/components/change-help-doc.vue index f0141a73..b0cbe75e 100644 --- a/src/views/system/setting/components/change-help-doc.vue +++ b/src/views/system/setting/components/change-help-doc.vue @@ -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); } diff --git a/src/views/system/setting/components/change-login-bg.vue b/src/views/system/setting/components/change-login-bg.vue index aa9d893e..8a6d4d59 100644 --- a/src/views/system/setting/components/change-login-bg.vue +++ b/src/views/system/setting/components/change-login-bg.vue @@ -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); } diff --git a/src/views/system/setting/components/change-logo.vue b/src/views/system/setting/components/change-logo.vue index 701f4150..1ea03f57 100644 --- a/src/views/system/setting/components/change-logo.vue +++ b/src/views/system/setting/components/change-logo.vue @@ -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); diff --git a/src/views/tool/upload/index.vue b/src/views/tool/upload/index.vue index 3728b2f6..70d29a02 100644 --- a/src/views/tool/upload/index.vue +++ b/src/views/tool/upload/index.vue @@ -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); }