update:动态表格优化
This commit is contained in:
@@ -65,8 +65,8 @@ export const getFileBaseInfoApi = (params: any) => {
|
||||
return post(`${PREFIX}data/getFileBaseInfo`, params);
|
||||
};
|
||||
|
||||
export const dataUpdateFileApi = (params: any) => {
|
||||
return upload(`${PREFIX}data/updateFile`, params);
|
||||
export const dataUpdateFileApi = (params: any, onProgress?: any, options?: any) => {
|
||||
return upload(`${PREFIX}data/updateFile`, params, onProgress, options);
|
||||
};
|
||||
|
||||
export const fileSearchApi = (params: any) => {
|
||||
|
||||
@@ -20,13 +20,18 @@ let token = $wujie?.props?.TOKEN || localStorage.getItem('TOKEN') || '';
|
||||
let tenantId = $wujie?.props?.TENANT_ID || localStorage.getItem('TENANT_ID') || '';
|
||||
|
||||
service.interceptors.request.use(
|
||||
(config) => {
|
||||
(config: any) => {
|
||||
const configData = config.data || config.params || {};
|
||||
if (configData.token) {
|
||||
userId = configData.userId;
|
||||
token = configData.token;
|
||||
tenantId = configData.tenantId;
|
||||
}
|
||||
if (config.token) {
|
||||
userId = config.userId;
|
||||
token = config.token;
|
||||
tenantId = config.tenantId;
|
||||
}
|
||||
config.headers['company'] = company;
|
||||
config.headers['jobNumber'] = getUserData().username || '';
|
||||
config.headers['token'] = token;
|
||||
@@ -73,7 +78,7 @@ const post = async (url: string, data = {}) => {
|
||||
return res.data;
|
||||
};
|
||||
|
||||
const upload = async (url: string, formData = {}, onProgress?: any) => {
|
||||
const upload = async (url: string, formData = {}, onProgress?: any, options?: any) => {
|
||||
const res: any = await service.post(url, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
@@ -86,6 +91,7 @@ const upload = async (url: string, formData = {}, onProgress?: any) => {
|
||||
});
|
||||
}
|
||||
},
|
||||
...options,
|
||||
});
|
||||
if (res.data.code !== 200) {
|
||||
ElMessage.warning(res.data.message);
|
||||
|
||||
@@ -32,6 +32,9 @@ const props = withDefaults(
|
||||
fileId: string;
|
||||
fileContent?: any;
|
||||
localFile?: boolean;
|
||||
userId?: any;
|
||||
tenantId?: any;
|
||||
token?: any;
|
||||
}>(),
|
||||
{
|
||||
readonly: false,
|
||||
@@ -40,6 +43,9 @@ const props = withDefaults(
|
||||
fileId: '',
|
||||
fileContent: '',
|
||||
localFile: false,
|
||||
userId: '',
|
||||
tenantId: '',
|
||||
token: '',
|
||||
}
|
||||
);
|
||||
|
||||
@@ -94,7 +100,11 @@ const saveFile = async () => {
|
||||
form.append('id ', props.fileId);
|
||||
form.append('fileName ', fileTitle.value);
|
||||
form.append('file', new Blob([currentValue], { type: 'text/txt' }));
|
||||
const res: any = await dataUpdateFileApi(form);
|
||||
const res: any = await dataUpdateFileApi(form, null, {
|
||||
userId: props.userId,
|
||||
token: props.token,
|
||||
tenantId: props.tenantId,
|
||||
});
|
||||
|
||||
// const res = await fragmentUpload(
|
||||
// false,
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<MonacoEditor v-if="fileId" :idIndex="fileId" :readonly="!permissionWrite" :file-id="fileId" />
|
||||
<MonacoEditor
|
||||
:readonly="!permissionWrite"
|
||||
:idIndex="query.fileId"
|
||||
:fileId="query.fileId"
|
||||
:userId="query.userId"
|
||||
:token="query.token"
|
||||
:tenantId="query.tenantId"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -9,10 +16,5 @@ import MonacoEditor from '@/components/common/fileEdit/monacoEditor/index.vue';
|
||||
|
||||
const route: any = useRoute();
|
||||
const { query } = route;
|
||||
const fileId = ref(query.fileId);
|
||||
const permissionWrite = ref(query.permissionWrite);
|
||||
|
||||
localStorage.setItem('USER_ID', query.userId);
|
||||
localStorage.setItem('TOKEN', query.token);
|
||||
localStorage.setItem('TENANT_ID', query.tenantId);
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user