优化在线编辑,新增getFileStream方法

This commit is contained in:
weibl
2026-02-26 14:23:43 +08:00
parent 3ee768e50f
commit 5e54f0c652
6 changed files with 42 additions and 13 deletions

View File

@@ -17,11 +17,12 @@
import { ref, onMounted, toRaw, watchEffect, onBeforeUnmount } from 'vue';
import * as monaco from 'monaco-editor';
import { ElMessage } from 'element-plus';
import { dataDownloadFileApi, dataUpdateFileApi, getFileBaseInfoApi } from '@/api/data/data';
import { dataUpdateFileApi, getFileBaseInfoApi } from '@/api/data/data';
import { getFileSteam } from '@/api/request';
// import { upload } from '@/api/request';
// const env = import.meta.env;
// const PREFIX = env.VITE_API_PREFIX_DATA;
const env = import.meta.env;
const PREFIX = env.VITE_API_PREFIX_DATA;
const props = withDefaults(
defineProps<{
@@ -126,8 +127,8 @@ const getFile = async () => {
if (baseRes.code === 200) {
fileTitle.value = baseRes.data.originalName;
}
const res: any = await dataDownloadFileApi({ fileId: props.fileId });
if (res) {
const resText: any = await getFileSteam(`${PREFIX}data/downloadFile`, { fileId: props.fileId });
if (resText) {
// 设置语言
let fileSuffix = '';
if (fileTitle.value.lastIndexOf('.') != -1) {
@@ -151,7 +152,7 @@ const getFile = async () => {
// // 设置内容
// text.value = res;
// }
text.value = res.request.response;
text.value = resText;
toRaw(editor.value).setValue(text.value);
// 设置光标位置为第一行第一列
toRaw(editor.value).setPosition({ lineNumber: 1, column: 1 });

View File

@@ -130,8 +130,8 @@ import { syncKeyResultToTaskApi } from '@/api/project/run';
const props = defineProps({
taskId: {
type: String,
default: '',
type: Number,
default: 0,
},
runInfo: {
type: Object,

View File

@@ -211,8 +211,8 @@ import reviewData from '@/components/taskDetail/reviewData.vue';
const emits = defineEmits(['closeFn', 'updateFn']);
const props = defineProps({
taskId: {
type: String,
default: '',
type: Number,
default: 0,
},
currentTaskInfo: {
type: Object,

View File

@@ -3,7 +3,7 @@
ref="tableRef"
showIndex
:tableName="tableName"
:params="{ ...params, sortOrder: 1 }"
:params="apiParams"
:api="api"
:searchLimitNum="3"
@searchChange="changeFun($event, 'search')"
@@ -102,7 +102,7 @@
</template>
<script setup lang="ts">
import { onMounted, reactive, ref, type PropType } from 'vue';
import { computed, onMounted, reactive, ref, type PropType } from 'vue';
import BaseTable from '@/components/common/table/baseTable.vue';
import { getChildrenNodeList } from '../../projectDetail/components/projectApi';
import { NODE_TYPE } from '@/utils/enum/node';
@@ -118,7 +118,7 @@ import StatusDot from '@/components/common/statusDot/index.vue';
import { demandStatus, getTaskAchieveStyleClass } from '@/components/common/statusDot/statusMap';
import TaskListDialog from './taskListDialog.vue';
defineProps({
const props = defineProps({
params: {
type: Object,
default: () => ({}),
@@ -150,6 +150,10 @@ const commonStore = CommonStore();
const { SIMULATION_TYPE, IS_MOLD_MARKING } = useDict('SIMULATION_TYPE', 'IS_MOLD_MARKING');
const emits = defineEmits(['show']);
const apiParams = computed(() => {
return { ...props.params, sortOrder: 1 };
});
const attachmentsVisible = ref(false);
const tableRef = ref();

View File

@@ -19,6 +19,25 @@
:api="getTaskListByDemandIdApi"
hideSpecialSearch
@show="showTaskDetailFun"
:hideSearchKeys="[
'tag10',
'exeStatus',
'achieveStatus',
'tag1Code',
'project',
'nodeCode',
'tag5',
'submitterName',
'pMemberList',
'eMemberList',
'approvalStatus',
'phase',
'discipline',
'beginTime',
'endTime',
'finishTime',
'confidence',
]"
></TaskTable>
</div>
<template #footer>

View File

@@ -10,6 +10,7 @@
:searchLimitNum="searchLimitNum"
@searchChange="changeFun($event, 'search')"
@load="tableOnLoadFun"
:hideSearchKeys="hideSearchKeys"
v-bind="$attrs"
:exportApi="exportTaskApi"
:exportFileName="exportFileName"
@@ -209,6 +210,10 @@ const props = defineProps({
type: Boolean,
default: false,
},
hideSearchKeys: {
type: Array,
default: () => [],
},
});
const emits = defineEmits(['show']);