Commit e8f79d93 authored by chenjiahao's avatar chenjiahao

Shell开发-新增路径显示;

任务调度——导入导出功能实现;
调整BasicUpload组件暴露打开上传弹窗方法;
parent 154d1b72
......@@ -155,6 +155,16 @@
emit('change', values);
}
// 定义一个方法用于从外部触发上传模态框
function triggerUpload() {
openUploadModal();
}
// 暴露此方法给父组件
defineExpose({
triggerUpload,
});
function handleDelete(record: Recordable<any>) {
emit('delete', record);
}
......
......@@ -11,7 +11,7 @@
<Icon size="35" icon="mdi:powershell" :color="'#fda861'" />
<div style="display: flex; flex-direction: column">
<span style="font-weight: bold; font-size: 18px">Shell开发</span>
<!-- <span style="color: grey; font-size: 12px">{{ searchInfo.res.workSpaceName }}</span>-->
<span style="color: grey; font-size: 12px">{{ path }}</span>
</div>
</div>
<div style="display: flex; gap: 10px">
......@@ -143,6 +143,7 @@
let DataTreeDataList = ref(DataTreeData);
const path = ref();
const searchInfo = reactive<Recordable>({});
const { createMessage, createConfirm } = useMessage();
const [registerImport, { openModal: openImportModal }] = useModal();
......@@ -272,9 +273,29 @@
},
});
}
// 根据id获取文件路径
function getPathById(id) {
const node = DataTreeData.find((item) => '' + item.businessId === '' + id);
if (!node) return ''; // 如果找不到节点,则返回空字符串
// 如果是根节点,直接返回其名称
if (node.parentId === 0) {
return node.workSpaceName;
}
// 递归获取父节点路径,并拼接当前节点名称
const parentPath = getPathById('' + node.parentId);
return `${parentPath} / ${node.workSpaceName}`;
}
/** 部门树的select*/
function handleSelect(workSpaceName = '') {
searchInfo.res = workSpaceName;
path.value = getPathById(searchInfo.res.businessId);
DataTreeDataList.value = DataTreeData.filter(
(item) =>
// [searchInfo.res.businessId].includes(item.parentId) &&
![0, 100, 101, 102, 103].includes(item.parentId),
);
// console.log(searchInfo.res)
reload();
}
......@@ -297,6 +318,7 @@
});
}
onMounted(() => {
path.value = getPathById('100');
DataTreeDataList.value = DataTreeData.filter(
(item) => ![0, 100, 101, 102, 103].includes(item.parentId),
);
......
......@@ -3,7 +3,7 @@
<template #extra>
<div style="display: flex">
<div>
<a-button type="link" :disabled="checkDisabled()">
<a-button type="link" :disabled="checkDisabled()" @click="handleRun">
<Icon icon="ant-design:caret-right-outlined" size="24" />
<p style="color: black">运行</p>
</a-button>
......@@ -49,13 +49,27 @@
</a-button>
</div>
<div>
<a-button type="link" :disabled="checkDisabled()">
<a-button type="link" :disabled="checkDisabled()" @click="handleExport">
<Icon icon="ant-design:arrow-up-outlined" size="24" />
<p style="color: black">导出</p>
</a-button>
<BasicUpload
v-show="false"
:maxSize="20"
:maxNumber="1"
@change="handleChange"
@click="handleUpload"
ref="basicUploadRef"
:api="userImport"
:accept="['.xlsx, .xls']"
>
<template #uploadBtnName>
<span>导入文件</span>
</template>
</BasicUpload>
</div>
<div>
<a-button type="link">
<a-button type="link" @click="handleImportClick">
<Icon icon="ant-design:arrow-down-outlined" size="24" />
<p style="color: black">导入</p>
</a-button>
......@@ -173,6 +187,8 @@
</PageWrapper>
</template>
<script lang="ts" setup>
import { userImport } from '@/api/system/user/user';
import { BasicUpload } from '@/components/Upload';
import { reactive, onMounted, ref } from 'vue';
import { BasicTable, useTable, TableAction } from '@/components/Table';
import { PageWrapper } from '@/components/Page';
......@@ -190,6 +206,8 @@
import CheckModal from '@/views/taskScheduling/taskFlow/CheckModal.vue';
import AddNewFolder from './addNewFolder.vue';
import UploadModel from '@/views/taskScheduling/taskFlowDesign/uploadModel.vue';
import { exportRoleList } from '@/api/system/role/role';
import { downloadByData } from '@/utils/file/download';
defineOptions({ name: 'SafetyLevelManage' });
const { createMessage, createConfirm } = useMessage();
......@@ -197,6 +215,7 @@
let modelLevel = ref(1);
const tableData = ref([]);
const searchInfo = reactive<Recordable>({});
const basicUploadRef = ref(); // 创建对 BasicUpload 的引用
const [copyModal, { openModal: openCopyModal }] = useModal();
const [moveModal, { openModal: openMoveModal }] = useModal();
const [checkModal, { openModal: openCheckModal }] = useModal();
......@@ -296,7 +315,19 @@
},
});
}
/**运行*/
function handleRun() {
router.push({
path: '/taskScheduling/taskFlowMaintenance/periodicScheduling/index',
});
}
// function handleUpload() {
// // isGetMeta.value = 'true';
// }
function handleChange(list: string[]) {
console.log('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', list);
createMessage.success(`文件上传成功`);
}
/**查看详情*/
function detailButton(record) {
router.push({
......@@ -306,6 +337,15 @@
},
});
}
// 处理导入按钮点击的方法
const handleImportClick = () => {
if (basicUploadRef.value) {
// 调用 BasicUpload 组件的公开方法来触发文件选择对话框
// 注意:这里假设 BasicUpload 提供了名为 triggerUpload 的方法用于触发上传行为
// 如果没有这个方法,你需要根据实际情况调整此行代码
basicUploadRef.value.triggerUpload();
}
};
/**血缘按钮跳转路由以及传值*/
function handleConsanguinity(record: Recordable) {}
......@@ -376,6 +416,13 @@
function AddNewFolderSuccess() {
createMessage.success('创建成功!');
}
function handleExport() {
console.log('导出----');
const params = Object.assign({}, {});
const data = exportRoleList(params);
downloadByData(data, '任务流' + '.xlsx');
createMessage.success('导出成功!');
}
function handleUpload() {
openUploadModel(true, {
isUpdate: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment