fix: 上传接口变更
This commit is contained in:
@@ -168,7 +168,7 @@ export async function uploadFileChunk(
|
|||||||
*/
|
*/
|
||||||
export function chunkCheck(identifier: string, fileName: string) {
|
export function chunkCheck(identifier: string, fileName: string) {
|
||||||
return request({
|
return request({
|
||||||
url: '/file/chunkCheck',
|
url: '/file/chunk-check',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { identifier, fileName },
|
data: { identifier, fileName },
|
||||||
timeout: 60_000,
|
timeout: 60_000,
|
||||||
@@ -188,7 +188,7 @@ export function chunkMerge(
|
|||||||
subPath: string = 'default'
|
subPath: string = 'default'
|
||||||
) {
|
) {
|
||||||
return request({
|
return request({
|
||||||
url: '/file/chunkMerge',
|
url: '/file/chunk-merge',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { identifier, fileName, subPath },
|
data: { identifier, fileName, subPath },
|
||||||
timeout: 60_000,
|
timeout: 60_000,
|
||||||
@@ -202,7 +202,7 @@ export function chunkMerge(
|
|||||||
*/
|
*/
|
||||||
export function chunkUpload(data: FormData) {
|
export function chunkUpload(data: FormData) {
|
||||||
return request({
|
return request({
|
||||||
url: '/file/chunkUpload',
|
url: '/file/chunk-upload',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
dataType: 'form-data',
|
dataType: 'form-data',
|
||||||
@@ -216,7 +216,7 @@ export function chunkUpload(data: FormData) {
|
|||||||
*/
|
*/
|
||||||
export function transferStaticFile(data: Record<string, any>) {
|
export function transferStaticFile(data: Record<string, any>) {
|
||||||
return request({
|
return request({
|
||||||
url: `/file/transferStaticFile`,
|
url: `/file/transfer-static-file`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data,
|
data,
|
||||||
timeout: 60_000,
|
timeout: 60_000,
|
||||||
@@ -243,7 +243,7 @@ export async function uploadFileToNE(
|
|||||||
url: `/ne/action/pushFile`,
|
url: `/ne/action/pushFile`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
uploadPath: uploadChunkRes.data.fileName,
|
uploadPath: uploadChunkRes.data.filePath,
|
||||||
neType,
|
neType,
|
||||||
neId,
|
neId,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -114,13 +114,13 @@ function fnUpload(up: UploadRequestOption) {
|
|||||||
if (filePath === '') return undefined;
|
if (filePath === '') return undefined;
|
||||||
const form = toRaw(stateForm.form);
|
const form = toRaw(stateForm.form);
|
||||||
form.avatar = filePath;
|
form.avatar = filePath;
|
||||||
|
uerStore.setAvatar(filePath);
|
||||||
return updateUserProfile(form);
|
return updateUserProfile(form);
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res === undefined) return;
|
if (res === undefined) return;
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success(t('views.account.settings.uploadOk'), 3);
|
message.success(t('views.account.settings.uploadOk'), 3);
|
||||||
uerStore.setAvatar(res.data);
|
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
@@ -257,6 +257,7 @@ onMounted(() => {
|
|||||||
<a-upload
|
<a-upload
|
||||||
name="file"
|
name="file"
|
||||||
list-type="picture"
|
list-type="picture"
|
||||||
|
accept=".jpg,.png"
|
||||||
:max-count="1"
|
:max-count="1"
|
||||||
:show-upload-list="false"
|
:show-upload-list="false"
|
||||||
:before-upload="fnBeforeUpload"
|
:before-upload="fnBeforeUpload"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import saveAs from 'file-saver';
|
|||||||
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
|
import TableColumnsDnd from '@/components/TableColumnsDnd/index.vue';
|
||||||
import { writeSheet } from '@/utils/execl-utils';
|
import { writeSheet } from '@/utils/execl-utils';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
const neInfoStore = useNeInfoStore();
|
const neInfoStore = useNeInfoStore();
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -154,6 +155,12 @@ let tableColumns: ColumnsType = [
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
sorter: (a: any, b: any) => 1,
|
sorter: (a: any, b: any) => 1,
|
||||||
width: 5,
|
width: 5,
|
||||||
|
customRender(opt) {
|
||||||
|
if (typeof opt.value === 'number') {
|
||||||
|
return parseDateToStr(+opt.value);
|
||||||
|
}
|
||||||
|
return opt.value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('common.operate'),
|
title: t('common.operate'),
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import useNeInfoStore from '@/store/modules/neinfo';
|
|||||||
import saveAs from 'file-saver';
|
import saveAs from 'file-saver';
|
||||||
import { writeSheet } from '@/utils/execl-utils';
|
import { writeSheet } from '@/utils/execl-utils';
|
||||||
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
|
||||||
|
import { parseDateToStr } from '@/utils/date-utils';
|
||||||
const neInfoStore = useNeInfoStore();
|
const neInfoStore = useNeInfoStore();
|
||||||
const { getDict } = useDictStore();
|
const { getDict } = useDictStore();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -171,6 +172,12 @@ let tableColumns: ColumnsType = [
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
sorter: (a: any, b: any) => 1,
|
sorter: (a: any, b: any) => 1,
|
||||||
width: 5,
|
width: 5,
|
||||||
|
customRender(opt) {
|
||||||
|
if (typeof opt.value === 'number') {
|
||||||
|
return parseDateToStr(+opt.value);
|
||||||
|
}
|
||||||
|
return opt.value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.faultManage.activeAlarm.alarmType'),
|
title: t('views.faultManage.activeAlarm.alarmType'),
|
||||||
@@ -204,6 +211,12 @@ let tableColumns: ColumnsType = [
|
|||||||
align: 'left',
|
align: 'left',
|
||||||
sorter: (a: any, b: any) => 1,
|
sorter: (a: any, b: any) => 1,
|
||||||
width: 5,
|
width: 5,
|
||||||
|
customRender(opt) {
|
||||||
|
if (typeof opt.value === 'number') {
|
||||||
|
return parseDateToStr(+opt.value);
|
||||||
|
}
|
||||||
|
return opt.value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('views.faultManage.activeAlarm.ackState'),
|
title: t('views.faultManage.activeAlarm.ackState'),
|
||||||
@@ -540,7 +553,7 @@ function fnGetList(pageNum?: number) {
|
|||||||
queryParams.beginTime = queryRangePicker.value[0];
|
queryParams.beginTime = queryRangePicker.value[0];
|
||||||
queryParams.endTime = queryRangePicker.value[1];
|
queryParams.endTime = queryRangePicker.value[1];
|
||||||
listAct(toRaw(queryParams)).then(res => {
|
listAct(toRaw(queryParams)).then(res => {
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
// 取消勾选
|
// 取消勾选
|
||||||
if (state.selectedRowKeys.length > 0) {
|
if (state.selectedRowKeys.length > 0) {
|
||||||
state.selectedRowKeys = [];
|
state.selectedRowKeys = [];
|
||||||
@@ -941,7 +954,7 @@ onMounted(() => {
|
|||||||
:label="t('views.faultManage.activeAlarm.eventTime')"
|
:label="t('views.faultManage.activeAlarm.eventTime')"
|
||||||
name="eventTime"
|
name="eventTime"
|
||||||
>
|
>
|
||||||
{{ modalState.from.eventTime }}
|
{{ parseDateToStr(modalState.from.eventTime) }}
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
|
|||||||
@@ -212,11 +212,11 @@ function fnUploadFile(up: UploadRequestOption) {
|
|||||||
// 改为完成状态
|
// 改为完成状态
|
||||||
uploadFile.percent = 100;
|
uploadFile.percent = 100;
|
||||||
uploadFile.status = 'done';
|
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.name = originalFileName;
|
||||||
modalState.from.path = fileName;
|
modalState.from.path = filePath;
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
@@ -290,7 +290,7 @@ function fnUploadFileDep(up: UploadRequestOption) {
|
|||||||
// 改为完成状态
|
// 改为完成状态
|
||||||
uploadFile.percent = 100;
|
uploadFile.percent = 100;
|
||||||
uploadFile.status = 'done';
|
uploadFile.status = 'done';
|
||||||
uploadFile.path = res.data.fileName;
|
uploadFile.path = res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ function fnUploadFile(up: UploadRequestOption) {
|
|||||||
// 改为完成状态
|
// 改为完成状态
|
||||||
uploadFile.percent = 100;
|
uploadFile.percent = 100;
|
||||||
uploadFile.status = 'done';
|
uploadFile.status = 'done';
|
||||||
uploadFile.path = res.data.fileName;
|
uploadFile.path = res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
@@ -338,7 +338,7 @@ function fnUploadFileDep(up: UploadRequestOption) {
|
|||||||
// 改为完成状态
|
// 改为完成状态
|
||||||
uploadFile.percent = 100;
|
uploadFile.percent = 100;
|
||||||
uploadFile.status = 'done';
|
uploadFile.status = 'done';
|
||||||
uploadFile.path = res.data.fileName;
|
uploadFile.path = res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -683,7 +683,7 @@ function fnModalUploadImportUpload(file: File) {
|
|||||||
uploadFile(formData)
|
uploadFile(formData)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
return res.data.fileName;
|
return res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
uploadImportState.msg = res.msg;
|
uploadImportState.msg = res.msg;
|
||||||
uploadImportState.loading = false;
|
uploadImportState.loading = false;
|
||||||
|
|||||||
@@ -1043,7 +1043,7 @@ function fnModalUploadImportUpload(file: File) {
|
|||||||
uploadFile(formData)
|
uploadFile(formData)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
return res.data.fileName;
|
return res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
uploadImportState.msg = res.msg;
|
uploadImportState.msg = res.msg;
|
||||||
uploadImportState.loading = false;
|
uploadImportState.loading = false;
|
||||||
|
|||||||
@@ -93,16 +93,16 @@ function fnUpload(up: UploadRequestOption) {
|
|||||||
hide();
|
hide();
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success(t('views.system.quickStart.sysUploadOk'), 3);
|
message.success(t('views.system.quickStart.sysUploadOk'), 3);
|
||||||
state.filePath = res.data.fileName;
|
state.filePath = res.data.filePath;
|
||||||
// 兼容旧前端可改配置文件
|
// 兼容旧前端可改配置文件
|
||||||
const baseUrl = import.meta.env.PROD
|
const baseUrl = import.meta.env.PROD
|
||||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||||
: import.meta.env.VITE_API_BASE_URL;
|
: import.meta.env.VITE_API_BASE_URL;
|
||||||
if (state.type === 'icon') {
|
if (state.type === 'icon') {
|
||||||
state.icon = `${baseUrl}${res.data.fileName}`;
|
state.icon = `${baseUrl}${res.data.filePath}`;
|
||||||
}
|
}
|
||||||
if (state.type === 'brand') {
|
if (state.type === 'brand') {
|
||||||
state.brand = `${baseUrl}${res.data.fileName}`;
|
state.brand = `${baseUrl}${res.data.filePath}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function fnUpload(up: UploadRequestOption) {
|
|||||||
hide();
|
hide();
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success(t('views.system.setting.uploadSuccess'), 3);
|
message.success(t('views.system.setting.uploadSuccess'), 3);
|
||||||
state.filePath = res.data.fileName;
|
state.filePath = res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ function fnUpload(up: UploadRequestOption) {
|
|||||||
hide();
|
hide();
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success(t('views.system.setting.uploadSuccess'), 3);
|
message.success(t('views.system.setting.uploadSuccess'), 3);
|
||||||
state.filePath = res.data.fileName;
|
state.filePath = res.data.filePath;
|
||||||
// 兼容旧前端可改配置文件
|
// 兼容旧前端可改配置文件
|
||||||
const baseUrl = import.meta.env.PROD
|
const baseUrl = import.meta.env.PROD
|
||||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||||
: 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 {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,16 +70,16 @@ function fnUpload(up: UploadRequestOption) {
|
|||||||
hide();
|
hide();
|
||||||
if (res.code === RESULT_CODE_SUCCESS) {
|
if (res.code === RESULT_CODE_SUCCESS) {
|
||||||
message.success(t('views.system.setting.uploadSuccess'), 3);
|
message.success(t('views.system.setting.uploadSuccess'), 3);
|
||||||
state.filePath = res.data.fileName;
|
state.filePath = res.data.filePath;
|
||||||
// 兼容旧前端可改配置文件
|
// 兼容旧前端可改配置文件
|
||||||
const baseUrl = import.meta.env.PROD
|
const baseUrl = import.meta.env.PROD
|
||||||
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
? sessionGet('baseUrl') || import.meta.env.VITE_API_BASE_URL
|
||||||
: import.meta.env.VITE_API_BASE_URL;
|
: import.meta.env.VITE_API_BASE_URL;
|
||||||
if (state.type === 'icon') {
|
if (state.type === 'icon') {
|
||||||
state.icon = `${baseUrl}${res.data.fileName}`;
|
state.icon = `${baseUrl}${res.data.filePath}`;
|
||||||
}
|
}
|
||||||
if (state.type === 'brand') {
|
if (state.type === 'brand') {
|
||||||
state.brand = `${baseUrl}${res.data.fileName}`;
|
state.brand = `${baseUrl}${res.data.filePath}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ function fnUpload(up: UploadRequestOption) {
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
message.success('文件上传成功', 3);
|
message.success('文件上传成功', 3);
|
||||||
state.uploadFilePath = res.data.url;
|
state.uploadFilePath = res.data.url;
|
||||||
state.downloadFilePath = res.data.fileName;
|
state.downloadFilePath = res.data.filePath;
|
||||||
} else {
|
} else {
|
||||||
message.error(res.msg, 3);
|
message.error(res.msg, 3);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user