This commit is contained in:
weibl
2025-11-21 09:31:43 +08:00
8 changed files with 148 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
import { post } from '@/api/request'; import { post, upload } from '@/api/request';
const env = import.meta.env; const env = import.meta.env;
const PREFIX = env.VITE_API_PREFIX_PROJECT; const PREFIX = env.VITE_API_PREFIX_PROJECT;
@@ -28,3 +28,76 @@ export const editTaskApi = (params: any) => {
export const getTaskCountApi = (params: any) => { export const getTaskCountApi = (params: any) => {
return post(`${PREFIX}task/count`, params); return post(`${PREFIX}task/count`, params);
}; };
/**
* 获取项目任务下的算例信息
* @param params
* @returns
*/
export const getTaskRunTreeApi = (params: any) => {
return post(`${PREFIX}run/getTaskRunTree`, params);
};
/**
* 获取用户工作负载信息
* @param params
* @returns
*/
export const getListUserWorkloadsApi = (params: any) => {
return post(`${PREFIX}task/listUserWorkloads`, params);
};
/**
* 新建算例
* @param params
* @returns
*/
export const addTaskRunApi = (params: any) => {
return post(`${PREFIX}run/addTaskRun`, params);
};
/**
* 查询算例信息
* @param params
* @returns
*/
export const queryTaskRunApi = (params: any) => {
return post(`${PREFIX}run/queryTaskRun`, params);
};
/**
* 创建算例下的结果文件夹
* @param params dirName文件夹名称 dirType文件夹类型默认2 uuId算例的uuid
* @returns
*/
export const createRunDirApi = (params: any) => {
return post(`${PREFIX}run/createRunDir`, params);
};
/**
* 查询算例结果文件夹及文件
* @param params uuId算例的uuid size 10 current 1
* @returns
*/
export const queryRunDirApi = (params: any) => {
return post(`${PREFIX}run/queryRunDir`, params);
};
/**
* 上传算例结果文件
* @param params file文件 dirId文件夹id fileName文件名称
* @returns
*/
export const uploadRunFilesApi = (params: any) => {
return upload(`${PREFIX}run/uploadRunFiles`, params);
};
/**
* 删除算例
* @param params runId 算例的id
* @returns
*/
export const deleteTaskRunApi = (params: any) => {
return post(`${PREFIX}run/deleteTaskRun`, params);
};

View File

@@ -1,4 +1,4 @@
import { get, post } from '@/api/request'; import { get, post, download } from '@/api/request';
const env = import.meta.env; const env = import.meta.env;
const PREFIX = env.VITE_API_PREFIX_SYSTEM; const PREFIX = env.VITE_API_PREFIX_SYSTEM;
@@ -27,3 +27,8 @@ export const tenantGetTenantDetailByIdApi = (params: any) => {
export const tenantDeleteApi = (params: any) => { export const tenantDeleteApi = (params: any) => {
return get(`${PREFIX}tenant/delete`, params); return get(`${PREFIX}tenant/delete`, params);
}; };
// 租户列表导出
export const tenantExportApi = (params: any, filename: string) => {
return download(`${PREFIX}/tenant/export`, params, filename);
};

View File

@@ -22,6 +22,8 @@
<div class="item"> <div class="item">
<div class="btns"> <div class="btns">
<slot name="leftOptions" /> <slot name="leftOptions" />
<el-button v-if="exportApi" :icon="Download" @click="exportFun">{{ $t('表格.导出') }}</el-button>
<el-button v-if="showImport" :icon="Upload">{{ $t('表格.导入') }}</el-button>
<el-tooltip :content="$t('表格.列表字段设置')" placement="top" > <el-tooltip :content="$t('表格.列表字段设置')" placement="top" >
<div class="icon-btn" @click="formDiaVisible = true"> <div class="icon-btn" @click="formDiaVisible = true">
<el-icon :size="18"> <el-icon :size="18">
@@ -45,8 +47,6 @@
</div> </div>
</el-tooltip> </el-tooltip>
</template> </template>
<el-button v-if="showExport" type="success" :icon="Upload">{{ $t('表格.导出') }}</el-button>
<el-button v-if="showImport" type="success" :icon="Download">{{ $t('表格.导入') }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@@ -67,14 +67,14 @@
}" }"
> >
<vxe-column v-if="showCheckbox" type="checkbox" width="60" align="center" header-align="center"></vxe-column> <vxe-column v-if="showCheckbox" type="checkbox" width="60" align="center" header-align="center"></vxe-column>
<vxe-column v-if="showIndex" type="seq" width="80" align="center" header-align="left" /> <vxe-column v-if="showIndex" type="seq" width="80" align="left" header-align="left" />
<vxe-column <vxe-column
v-for="(item) in tableHeadVisible" v-for="(item) in tableHeadVisible"
:key="item.key" :key="item.key"
:field="item.key" :field="item.key"
:title="item.title" :title="item.title"
:min-width="item.width" :min-width="item.width"
align="center" align="left"
header-align="left" header-align="left"
:tree-node="item.treeNode" :tree-node="item.treeNode"
sortable sortable
@@ -90,7 +90,7 @@
v-if="$slots.tableActions || actionList.length > 0" v-if="$slots.tableActions || actionList.length > 0"
title="操作" title="操作"
:width="$slots.tableActions ? actionsWidth : actionAutoWidth" :width="$slots.tableActions ? actionsWidth : actionAutoWidth"
align="center" align="left"
header-align="left" header-align="left"
fixed="right" fixed="right"
> >
@@ -149,12 +149,16 @@ import TableSearch from './tableSearch.vue';
import TableFormDia from './tableFormDia.vue'; import TableFormDia from './tableFormDia.vue';
import { getFormConfigureApi } from '@/api/system/systemData'; import { getFormConfigureApi } from '@/api/system/systemData';
import { formOptionsFormat } from './lib'; import { formOptionsFormat } from './lib';
import { exportFile } from '@/utils/file';
const emit = defineEmits(['searchChange', 'load', 'update:viewType']); const emit = defineEmits(['searchChange', 'load', 'update:viewType']);
interface Props { interface Props {
tableName?: string; tableName?: string;
api?: (params: ApiParams) => Promise<any> | undefined; api?: (params: ApiParams) => Promise<any> | undefined;
exportApi?: any;
exportFileName?: string;
exportDict?: any;
render?: (data: any, cb: (cbData: any) => void) => void | undefined; render?: (data: any, cb: (cbData: any) => void) => void | undefined;
params?: any; params?: any;
head?: any; head?: any;
@@ -175,6 +179,9 @@ interface Props {
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
tableName: '', tableName: '',
api: undefined, api: undefined,
exportApi: undefined,
exportFileName: '',
exportDict: {},
render: undefined, render: undefined,
params: () => {}, params: () => {},
head: null, head: null,
@@ -400,6 +407,10 @@ const actionClickFun = (row: any, action: any) => {
} }
}; };
const exportFun = () => {
exportFile(props.exportApi, props.tableName, props.exportFileName, {}, props.exportDict);
};
watch(() => props.tableName, () => { watch(() => props.tableName, () => {
initFun(); initFun();
}); });

View File

@@ -33,7 +33,7 @@ withDefaults(defineProps<Props>(), {
.tip { .tip {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: flex-start;
font-size: 12px; font-size: 12px;
color: var(--el-text-color-secondary); color: var(--el-text-color-secondary);
.text { .text {

View File

@@ -22,6 +22,8 @@
<div class="item"> <div class="item">
<div class="btns"> <div class="btns">
<slot name="leftOptions" /> <slot name="leftOptions" />
<el-button v-if="exportApi" :icon="Download" @click="exportFun">{{ $t('表格.导出') }}</el-button>
<el-button v-if="showImport" :icon="Upload">{{ $t('表格.导入') }}</el-button>
<el-tooltip :content="$t('表格.列表字段设置')" placement="top" > <el-tooltip :content="$t('表格.列表字段设置')" placement="top" >
<div class="icon-btn" @click="formDiaVisible = true"> <div class="icon-btn" @click="formDiaVisible = true">
<el-icon :size="18"> <el-icon :size="18">
@@ -29,8 +31,6 @@
</el-icon> </el-icon>
</div> </div>
</el-tooltip> </el-tooltip>
<el-button v-if="showExport" type="success" :icon="Upload">{{ $t('表格.导出') }}</el-button>
<el-button v-if="showImport" type="success" :icon="Download">{{ $t('表格.导入') }}</el-button>
</div> </div>
</div> </div>
</div> </div>
@@ -65,14 +65,14 @@
}" }"
> >
<vxe-column v-if="showCheckbox" type="checkbox" width="60" align="center" header-align="center" fixed="left"></vxe-column> <vxe-column v-if="showCheckbox" type="checkbox" width="60" align="center" header-align="center" fixed="left"></vxe-column>
<vxe-column v-if="showIndex" type="seq" width="80" align="center" header-align="left" fixed="left" /> <vxe-column v-if="showIndex" type="seq" width="80" align="left" header-align="left" fixed="left" />
<vxe-column <vxe-column
v-for="(item) in tableHeadVisible" v-for="(item) in tableHeadVisible"
:key="item.key" :key="item.key"
:field="item.key" :field="item.key"
:title="item.title" :title="item.title"
:min-width="item.width" :min-width="item.width"
:align="item.key === 'nodeName' ? 'left' : 'center'" align="left"
header-align="left" header-align="left"
:tree-node="item.key === 'nodeName'" :tree-node="item.key === 'nodeName'"
:fixed="item.key === 'nodeName' ? 'left' : ''" :fixed="item.key === 'nodeName' ? 'left' : ''"
@@ -127,7 +127,7 @@
v-if="$slots.tableActions || actionList.length > 0" v-if="$slots.tableActions || actionList.length > 0"
title="操作" title="操作"
:width="$slots.tableActions ? actionsWidth : actionAutoWidth" :width="$slots.tableActions ? actionsWidth : actionAutoWidth"
align="center" align="left"
header-align="left" header-align="left"
fixed="right" fixed="right"
> >
@@ -172,11 +172,15 @@ import TableFormDia from './tableFormDia.vue';
import { getFormConfigureApi } from '@/api/system/systemData'; import { getFormConfigureApi } from '@/api/system/systemData';
import { formOptionsFormat } from './lib'; import { formOptionsFormat } from './lib';
import { uniqBy, cloneDeep } from 'lodash-es'; import { uniqBy, cloneDeep } from 'lodash-es';
import { exportFile } from '@/utils/file';
const emit = defineEmits(['searchChange', 'load']); const emit = defineEmits(['searchChange', 'load']);
interface Props { interface Props {
tableName: string; tableName: string;
exportApi?: any;
exportFileName?: string;
exportDict?: any;
params?: any; params?: any;
head?: any; head?: any;
searchItems?: any[]; searchItems?: any[];
@@ -195,6 +199,9 @@ interface Props {
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
tableName: '', tableName: '',
exportApi: undefined,
exportFileName: '',
exportDict: {},
params: () => {}, params: () => {},
head: null, head: null,
searchItems: () => [] as any[], searchItems: () => [] as any[],
@@ -470,6 +477,10 @@ const actionClickFun = (row: any, action: any) => {
} }
}; };
const exportFun = () => {
exportFile(props.exportApi, props.tableName, props.exportFileName, {}, props.exportDict);
};
watch(() => props.tableName, () => { watch(() => props.tableName, () => {
initFun(); initFun();
}); });

View File

@@ -41,6 +41,11 @@ export const CommonStore = defineStore('common', {
getDictData(key: string) { getDictData(key: string) {
if (this.dictData[key]) { if (this.dictData[key]) {
return this.dictData[key]; return this.dictData[key];
} else {
return {
A: [],
O: {},
};
} }
}, },
}, },

View File

@@ -1,7 +1,10 @@
import { getKKFileViewURLFromMinioApi } from '@/api/data/data'; import { getKKFileViewURLFromMinioApi } from '@/api/data/data';
import { getFormConfigureApi } from '@/api/system/systemData';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import * as XLSX from 'xlsx'; import * as XLSX from 'xlsx';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
import { CommonStore } from '@/stores/common';
import dayjs from 'dayjs';
const env = import.meta.env; const env = import.meta.env;
@@ -173,3 +176,23 @@ export class FileUtil {
} }
} }
// 导出文件
export const exportFile = (api: any, tableName: string, fileName: string, params: any, dict: any) => {
getFormConfigureApi({ formName: tableName }).then((res: any) => {
if (res.code === 200) {
const formConfig = JSON.parse(res.data.formConfig);
const listData = formConfig.filter((item: any) => item.isShow).map((item: any) => {
const val: any = {
key: item.key,
title: item.title,
};
if (dict[item.key] && CommonStore().getDictData(dict[item.key])) {
val.dictCode = dict[item.key];
val.dictData = CommonStore().getDictData(dict[item.key]).O;
}
return val;
});
api(listData, `${dayjs().format('YYYYMMDDHHmmss')}_${fileName || tableName}.xlsx`);
}
});
};

View File

@@ -5,6 +5,11 @@
ref="baseTableRef" ref="baseTableRef"
tableName="SYSTEM_TENANT" tableName="SYSTEM_TENANT"
:api="tenantListApi" :api="tenantListApi"
:exportApi="tenantExportApi"
exportFileName="租户列表"
:exportDict="{
status: 'TENANT_STATUS'
}"
> >
<template #leftOptions> <template #leftOptions>
<el-button type="primary" :icon="Plus" @click="openDetailFun('')">新增租户</el-button> <el-button type="primary" :icon="Plus" @click="openDetailFun('')">新增租户</el-button>
@@ -34,7 +39,7 @@ import { Plus } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import BaseTable from '@/components/common/table/baseTable.vue'; import BaseTable from '@/components/common/table/baseTable.vue';
import Detail from './components/detail.vue'; import Detail from './components/detail.vue';
import { tenantListApi, tenantDeleteApi } from '@/api/system/tenant'; import { tenantListApi, tenantDeleteApi, tenantExportApi } from '@/api/system/tenant';
import { useDict } from '@/utils/useDict'; import { useDict } from '@/utils/useDict';
const { TENANT_STATUS } = useDict('TENANT_STATUS'); const { TENANT_STATUS } = useDict('TENANT_STATUS');