diff --git a/src/api/data/data.ts b/src/api/data/data.ts
index 3d1b3997..f547a424 100644
--- a/src/api/data/data.ts
+++ b/src/api/data/data.ts
@@ -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) => {
diff --git a/src/api/request.ts b/src/api/request.ts
index caf28d54..6263a7a5 100644
--- a/src/api/request.ts
+++ b/src/api/request.ts
@@ -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);
diff --git a/src/components/common/fileEdit/monacoEditor/index.vue b/src/components/common/fileEdit/monacoEditor/index.vue
index f2012010..3bec2a59 100644
--- a/src/components/common/fileEdit/monacoEditor/index.vue
+++ b/src/components/common/fileEdit/monacoEditor/index.vue
@@ -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,
diff --git a/src/views/index/monaco.vue b/src/views/index/monaco.vue
index f8cad493..e5d7266f 100644
--- a/src/views/index/monaco.vue
+++ b/src/views/index/monaco.vue
@@ -1,5 +1,12 @@
-
+