This commit is contained in:
2026-02-12 16:33:25 +08:00
9 changed files with 118 additions and 47 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -17,11 +17,11 @@
import { ref, onMounted, toRaw, watchEffect, onBeforeUnmount } from 'vue';
import * as monaco from 'monaco-editor';
import { ElMessage } from 'element-plus';
import { dataDownloadFileApi, getFileBaseInfoApi } from '@/api/data/data';
import { upload } from '@/api/request';
import { dataDownloadFileApi, dataUpdateFileApi, getFileBaseInfoApi } from '@/api/data/data';
// 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<{
@@ -86,10 +86,11 @@ const saveFile = async () => {
const form = new FormData();
// form.append('fileType', String(FILE_TYPE.FLOW_PYTHON));
form.append('scriptFileId ', props.fileId);
form.append('id ', props.fileId);
form.append('fileName ', fileTitle.value);
form.append('updateFile ', new Blob([currentValue], { type: 'text/txt' }));
const res: any = await upload(`${PREFIX}data/updateScriptFile`, form);
form.append('file', new Blob([currentValue], { type: 'text/txt' }));
console.log('currentValue', currentValue);
const res: any = await dataUpdateFileApi(form);
// const res = await fragmentUpload(
// false,
@@ -101,10 +102,10 @@ const saveFile = async () => {
ElMessage.success('修改成功!');
text.value = toRaw(editor.value).getValue();
isChange.value = false;
emits('saveHandle');
} else {
ElMessage.error(res as any);
}
emits('saveHandle');
} else {
ElMessage('暂无内容更新');
}
@@ -142,7 +143,8 @@ const getFile = async () => {
// 填入内容时设置只读为false
toRaw(editor.value).updateOptions({ readonly: true });
// 设置内容
text.value = JSON.stringify(res) as string;
// text.value = JSON.stringify(res) as string;
text.value = res;
toRaw(editor.value).setValue(text.value);
// 设置光标位置为第一行第一列
toRaw(editor.value).setPosition({ lineNumber: 1, column: 1 });

View File

@@ -1,9 +1,21 @@
<template>
<div>
<Dialog v-model="diaVisible" diaTitle="文件预览" width="70%" height="90%" @close="closeFun">
<Dialog
v-model="diaVisible"
diaTitle="文件预览"
width="70%"
height="90%"
@close="closeFun"
:showFooter="false"
>
<template v-if="diaVisible && fileId">
<div v-if="modeType === 'txt'" class="content">
<div>txt预览编辑</div>
<MonacoEditor
:idIndex="fileId"
:readonly="!permissionWrite"
:file-id="fileId"
@saveHandle="closeFun"
></MonacoEditor>
</div>
<div v-if="modeType === 'csv'" class="content">
<CsvView :fileId="fileId" :row="csvData" />
@@ -33,6 +45,8 @@ import CsvView from './csvView.vue';
import { parsePermission } from '@/utils/permission';
import { isAcceptFileType } from '@/utils/file';
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
import MonacoEditor from '@/components/common/fileEdit/monacoEditor/index.vue';
import { useDict } from '@/utils/useDict';
interface Props {
modelValue: boolean;
@@ -67,6 +81,8 @@ watch(
}
);
const permissionWrite = ref(false);
const initFun = () => {
if (!props.fileId) {
return;
@@ -76,13 +92,10 @@ const initFun = () => {
};
getFileBaseInfoApi(params).then((res: any) => {
if (res.code === 200) {
const { originalName, permissionValue } = res.data;
if (originalName.toLowerCase().endsWith('.txt')) {
if (parsePermission(permissionValue).write) {
console.log('txt编辑');
} else {
console.log('txt预览');
}
const { originalName, permissionValue, fileSize } = res.data;
permissionWrite.value = parsePermission(permissionValue).write;
// 只能在线编辑10M以内
if (permissionWrite.value && isEditFile(originalName) && fileSize <= 1024 * 1024 * 10) {
modeType.value = 'txt';
diaVisible.value = true;
return;
@@ -97,7 +110,7 @@ const initFun = () => {
diaVisible.value = true;
return;
}
if (parsePermission(permissionValue).write && isAcceptFileType(originalName, 'onlyOffice')) {
if (permissionWrite.value && isAcceptFileType(originalName, 'onlyOffice')) {
modeType.value = 'onlyOffice';
getOnlyOfficeFun();
} else {
@@ -108,6 +121,13 @@ const initFun = () => {
});
};
const isEditFile = (fileName: string) => {
const { CAN_EDIT_FILE } = useDict('CAN_EDIT_FILE');
return CAN_EDIT_FILE.value.A.some((item: any) => {
return fileName.toLowerCase().endsWith(item.value);
});
};
const getCsvDataFun = () => {
const params = {
fileId: props.fileId,

View File

@@ -24,22 +24,27 @@
@paste="pasteFun"
>
<template v-if="fileList.length > 0">
<div v-for="(item, index) in fileList" :key="index" class="img-item">
<div class="img">
<img :src="item.src" />
</div>
<div class="tip">
<el-input
v-model="item.title"
:placeholder="params.placeholder || '请输入图例名称'"
clearable
@input="inputFun"
/>
</div>
<div class="del-btn" @click.stop="delFun(index)">
<el-icon :size="22"><DeleteFilled /></el-icon>
</div>
</div>
<el-row :gutter="20">
<el-col v-for="(item, index) in fileList" :key="index" :span="24 / paramsData.colNum">
<div class="img-item">
<div class="img">
<img :src="item.src" />
</div>
<div class="tip">
<el-input
class="img-tip-inp"
v-model="item.title"
:placeholder="params.placeholder || '请输入图例名称'"
clearable
@input="inputFun"
/>
</div>
<div class="del-btn" @click.stop="delFun(index)">
<el-icon :size="22"><DeleteFilled /></el-icon>
</div>
</div>
</el-col>
</el-row>
</template>
<div v-else class="preview">
<div class="no-data">单击此处粘贴图片...</div>
@@ -220,6 +225,16 @@ const closeFun = () => {
};
</script>
<style lang="scss">
.img-content {
.img-tip-inp {
.el-input__inner {
text-align: center;
}
}
}
</style>
<style lang="scss" scoped>
.img-content {
position: relative;
@@ -280,7 +295,8 @@ const closeFun = () => {
}
}
.tip {
width: 300px;
width: 100%;
max-width: 300px;
}
.del-btn {
opacity: 0;

View File

@@ -376,9 +376,9 @@ const getFormatDataFun = () => {
unitData.value.forEach((u: any, uIndex: number) => {
let picName = '';
if (u.title) {
picName = `${u.title.replace(/\s/g, '')}_${unitIndex + 1}_${uIndex + 1}.png`;
picName = `${u.title.replace(/\s/g, '')}_${new Date().getTime()}_${unitIndex + 1}_${uIndex + 1}`;
} else {
picName = `图片_${new Date().getTime()}_${unitIndex + 1}_${uIndex + 1}.png`;
picName = `图片_${new Date().getTime()}_${unitIndex + 1}_${uIndex + 1}`;
}
u.picName = picName;
});

View File

@@ -76,6 +76,7 @@
:title="
TASK_APPROVE_STATUS.O[row.approvalStatus || TASK_APPROVE_STATUS_ENUM.NOT_APPROVED]
"
@click="seeApproveDetailFun(row)"
>
</StatusDot>
</template>
@@ -549,6 +550,7 @@
</template>
</TreeTable>
</div>
<ApprovalProcess v-model="approveDetailVisible" :flowId="approveId" />
</template>
<script setup lang="ts">
@@ -580,6 +582,10 @@ import { initProjectDicts } from '@/utils/project';
import { TASK_APPROVE_STATUS_ENUM } from '@/utils/enum/task';
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
import { CommonStore } from '@/stores/common';
import { ElMessage } from 'element-plus';
import { FLOW_APPROVE_STATUS_ENUM } from '@/utils/enum/flow';
import ApprovalProcess from '@/components/common/approvalProcess/index.vue';
import { getTaskDetailApi } from '@/api/project/task';
const commonStore = CommonStore();
const allDictData = ref(commonStore.dictData);
@@ -675,6 +681,27 @@ const disabledDate = (time: Date, row: any, flag: string) => {
}
};
const approveDetailVisible = ref(false);
const approveId = ref('');
const seeApproveDetailFun = async (row: any) => {
// 走获取任务详情接口拿到审批id
const res: any = await getTaskDetailApi({
relatedResourceUuid: row.uuid,
});
if (res.code === 200) {
if (res.data.cidFlowId) {
if (row.approvalStatus !== FLOW_APPROVE_STATUS_ENUM.NOT_APPROVED && row.approvalStatus) {
approveDetailVisible.value = true;
approveId.value = res.data.cidFlowId;
}
} else {
ElMessage.warning('暂无审批信息');
}
}
};
onMounted(() => {
initProjectDicts();
taskStore.fetchTemplates();

View File

@@ -36,7 +36,9 @@ import { ref, watch } from 'vue';
import TableForm from '@/components/common/table/tableForm.vue';
import ParamClass from '@/components/common/paramClass/index.vue';
import ParamUnit from '@/components/common/paramUnit/index.vue';
import { getUserData } from '@/utils/user';
import { cloneDeep } from 'lodash-es';
import dayjs from 'dayjs';
interface Props {
modelValue: boolean;
@@ -74,6 +76,8 @@ watch(
const submitFun = async () => {
const valid = await tableFormRef.value.validateFun();
if (valid) {
paramData.value.createName = getUserData().nickname;
paramData.value.createTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
if (!props.data.parameterName) {
emit('add', cloneDeep(paramData.value));
} else {

View File

@@ -557,7 +557,7 @@ const upgradeFlowFun = (flow: any) => {
width: 100%;
height: 200px;
background-color: var(--el-bg-color-page);
background-image: url(@/assets/imgs/dragFlow/default-img.svg);
background-image: url(@/assets/imgs/reportLib/report-cover.png);
background-size: 100px;
background-repeat: no-repeat;
background-position: center;

View File

@@ -254,7 +254,7 @@ const apiParams = computed(() => {
const filterBtnList = ref([
{ label: '总数', count: 0, value: 'total', selected: false, key: 'total', color: '#1890FF' }, // 中性灰
{
label: '今明任务',
label: '今明',
count: 0,
value: 'todayTmrTasks',
selected: false,
@@ -262,7 +262,7 @@ const filterBtnList = ref([
color: '#FF9900',
}, // 蓝色
{
label: '进行',
label: '进行',
count: 0,
value: TASK_PROCESS_STATUS.IN_PROGRESS,
selected: false,
@@ -270,7 +270,7 @@ const filterBtnList = ref([
color: '#0066FF',
}, // 橙色
{
label: '逾期',
label: '逾期',
count: 0,
value: TASK_PROCESS_STATUS.POSTPONED,
selected: false,
@@ -286,7 +286,7 @@ const filterBtnList = ref([
color: '#999999',
}, // 浅灰
{
label: '完成',
label: '完成',
count: 0,
value: TASK_PROCESS_STATUS.COMPLETED,
selected: false,
@@ -294,7 +294,7 @@ const filterBtnList = ref([
color: '#33FF00',
}, // 绿色
{
label: '关闭',
label: '关闭',
count: 0,
value: TASK_PROCESS_STATUS.CLOSED,
selected: false,
@@ -302,7 +302,7 @@ const filterBtnList = ref([
color: '#339900',
}, // 靛蓝色
{
label: '暂停',
label: '暂停',
count: 0,
value: TASK_PROCESS_STATUS.PAUSED,
selected: false,
@@ -310,7 +310,7 @@ const filterBtnList = ref([
color: '#DDDD09',
}, // 淡灰
{
label: '驳回',
label: '驳回',
count: 0,
value: TASK_PROCESS_STATUS.REJECTED,
selected: false,
@@ -318,7 +318,7 @@ const filterBtnList = ref([
color: '#F4652C',
}, // 粉色
{
label: '闭环',
label: '闭环',
count: 0,
value: TASK_PROCESS_STATUS.CLOSED_LOOP,
selected: false,
@@ -539,6 +539,8 @@ onMounted(() => {
padding-right: var(--padding-large);
// width: 110px;
font-size: 14px;
// height: 24px;
white-space: nowrap;
}
.selected {
position: absolute;