代码生成器修改,流程新建,表单新建,流程审批等页面修改

This commit is contained in:
GAOANG
2024-03-29 16:41:21 +08:00
parent d55f879846
commit 788cfac511
6 changed files with 754 additions and 704 deletions

View File

@ -1,169 +1,170 @@
<template>
<PageLayout :layoutClass="currentRoute.path == '/workflow/launch' ? '!p-2' : currentRoute.path == '/task/processtasks' ? '!p-0 !pr-7px' : ''" :searchConfig="searchConfig" :title="t('流程模板列表')" @search="search" @scroll-height="scrollHeight">
<PageLayout
:layoutClass="currentRoute.path == '/workflow/launch' ? '!p-2' : currentRoute.path == '/task/processtasks' ? '!p-0 !pr-7px' : ''"
:searchConfig="searchConfig" :title="t('流程模板列表')" @search="search" @scroll-height="scrollHeight">
<template #left>
<BasicTree :clickRowToExpand="true" :fieldNames="{ key: 'id', title: 'name' }" :title="t('流程模板分类')" :treeData="data.treeData" search @select="handleSelect" />
<BasicTree :clickRowToExpand="true" :fieldNames="{ key: 'id', title: 'name' }" :title="t('流程模板分类')"
:treeData="data.treeData" search @select="handleSelect" />
</template>
<template #search></template>
<template #right>
<div v-if="data.list.length > 0" :style="{ overflowY: 'auto', height: tableOptions.scrollHeight + 30 + 'px' }">
<div v-if="data.list.length > 0"
:style="{ overflowY: 'auto', height: tableOptions.scrollHeight + 30 + 'px' }">
<div class="list-page-box">
<TemplateCard v-for="(item, index) in data.list" :key="index" :item="item" @click="launchProcessInTab(item.id)" />
<TemplateCard v-for="(item, index) in data.list" :key="index" :item="item"
@click="launchProcessInTab(item.id)" />
</div>
<div class="page-box">
<a-pagination
v-model:current="data.pagination.current"
v-model:pageSize="data.pagination.pageSize"
<a-pagination v-model:current="data.pagination.current" v-model:pageSize="data.pagination.pageSize"
:pageSizeOptions="['18', '36', '54', '72']"
:show-total="(total) => t(`共 {total} 条数据`, { total })"
:showSizeChanger="true"
:total="data.pagination.total"
@change="getList"
/>
:show-total="(total) => t(`共 {total} 条数据`, { total })" :showSizeChanger="true"
:total="data.pagination.total" @change="getList" />
</div>
</div>
<div v-else>
<EmptyBox />
</div>
<LaunchProcess v-if="visibleLaunchProcess" :schemaId="data.schemaId" @close="visibleLaunchProcess = false" />
<LaunchProcess v-if="visibleLaunchProcess" :schemaId="data.schemaId"
@close="visibleLaunchProcess = false" />
</template>
</PageLayout>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref, unref, watch } from 'vue';
import TemplateCard from '/@bpmn/components/card/TemplateCard.vue';
import { EmptyBox } from '/@/components/ModalPanel/index';
import { getDesignPage } from '/@/api/workflow/design';
import { WorkflowPageModel } from '/@/api/workflow/model';
import { getDicDetailList } from '/@/api/system/dic';
import { BasicTree, TreeItem } from '/@/components/Tree';
import { PageLayout } from '/@/components/ModalPanel';
import LaunchProcess from './components/LaunchProcess.vue';
import { FlowCategory } from '/@/enums/workflowEnum';
import userTableScrollHeight from '/@/hooks/setting/userTableScrollHeight';
import { useRouter } from 'vue-router';
import { useI18n } from '/@/hooks/web/useI18n';
import { onMounted, reactive, ref, unref, watch } from 'vue';
import TemplateCard from '/@bpmn/components/card/TemplateCard.vue';
import { EmptyBox } from '/@/components/ModalPanel/index';
import { getDesignPage } from '/@/api/workflow/design';
import { WorkflowPageModel } from '/@/api/workflow/model';
import { getDicDetailList } from '/@/api/system/dic';
import { BasicTree, TreeItem } from '/@/components/Tree';
import { PageLayout } from '/@/components/ModalPanel';
import LaunchProcess from './components/LaunchProcess.vue';
import { FlowCategory } from '/@/enums/workflowEnum';
import userTableScrollHeight from '/@/hooks/setting/userTableScrollHeight';
import { useRouter } from 'vue-router';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n();
const router = useRouter();
const { currentRoute } = router;
const searchConfig = [
{
field: 'code',
label: t('模板编码'),
type: 'input'
},
{
field: 'name',
label: t('模板名称'),
type: 'input'
}
];
const { tableOptions, scrollHeight } = userTableScrollHeight();
let visibleLaunchProcess = ref(false);
let data: {
list: Array<WorkflowPageModel>;
treeData: Array<TreeItem>;
schemaId: string;
selectDeptId: string;
pagination: { current: number; total: number; pageSize: number };
} = reactive({
list: [],
treeData: [],
schemaId: '',
selectDeptId: '',
pagination: {
current: 1,
total: 0,
pageSize: 18
}
const { t } = useI18n();
const router = useRouter();
const { currentRoute } = router;
const searchConfig = [
{
field: 'code',
label: t('模板编码'),
type: 'input'
},
{
field: 'name',
label: t('模板名称'),
type: 'input'
}
];
const { tableOptions, scrollHeight } = userTableScrollHeight();
let visibleLaunchProcess = ref(false);
let data: {
list: Array<WorkflowPageModel>;
treeData: Array<TreeItem>;
schemaId: string;
selectDeptId: string;
pagination: { current: number; total: number; pageSize: number };
} = reactive({
list: [],
treeData: [],
schemaId: '',
selectDeptId: '',
pagination: {
current: 1,
total: 0,
pageSize: 18
}
});
watch(
() => unref(currentRoute),
(val) => {
if (val.path == '/workflow/launch') init();
},
{ deep: true }
);
onMounted(() => {
getCategoryTree();
init();
});
async function init() {
data.pagination.current = 1;
data.pagination.total = 0;
data.selectDeptId = '';
await getList();
}
async function getCategoryTree() {
let res = (await getDicDetailList({
itemId: FlowCategory.ID
})) as unknown as TreeItem[];
data.treeData = res.map((ele) => {
ele.icon = 'ant-design:tags-outlined';
return ele;
});
}
watch(
() => unref(currentRoute),
(val) => {
if (val.path == '/workflow/launch') init();
async function getList(params?: any) {
const searchParams = {
...{
limit: data.pagination.current,
size: data.pagination.pageSize
},
{ deep: true }
);
onMounted(() => {
getCategoryTree();
init();
...{ category: data.selectDeptId },
...params,
...{ enabledMark: 1 } // 流程发起list 需要隐藏 禁用的模板[enabledMark=1]
};
try {
let res = await getDesignPage(searchParams);
data.pagination.total = res.total;
data.list = res.list;
} catch (error) { }
}
function handleSelect(deptIds) {
data.selectDeptId = deptIds[0];
getList();
}
async function launchProcess(id: string) {
// 旧版弹窗界面 便于调试
data.schemaId = id;
visibleLaunchProcess.value = true;
}
function launchProcessInTab(id: string) {
router.push({
path: `/flow/${id}/0/createFlow`
});
}
async function init() {
data.pagination.current = 1;
data.pagination.total = 0;
data.selectDeptId = '';
await getList();
}
async function getCategoryTree() {
let res = (await getDicDetailList({
itemId: FlowCategory.ID
})) as unknown as TreeItem[];
data.treeData = res.map((ele) => {
ele.icon = 'ant-design:tags-outlined';
return ele;
});
}
async function getList(params?: any) {
const searchParams = {
...{
limit: data.pagination.current,
size: data.pagination.pageSize
},
...{ category: data.selectDeptId },
...params,
...{ enabledMark: 1 } // 流程发起list 需要隐藏 禁用的模板[enabledMark=1]
};
try {
let res = await getDesignPage(searchParams);
data.pagination.total = res.total;
data.list = res.list;
} catch (error) {}
}
function handleSelect(deptIds) {
data.selectDeptId = deptIds[0];
getList();
}
async function launchProcess(id: string) {
// 旧版弹窗界面 便于调试
data.schemaId = id;
visibleLaunchProcess.value = true;
}
function launchProcessInTab(id: string) {
router.push({
path: `/flow/${id}/0/createFlow`
});
}
function search(params: any) {
data.pagination.current = 1;
getList(params);
}
function search(params: any) {
data.pagination.current = 1;
getList(params);
}
</script>
<style lang="less" scoped>
.list-page-box {
display: flex;
flex-wrap: wrap;
}
.list-page-box {
display: flex;
flex-wrap: wrap;
}
:deep(.list-item) {
max-width: 320px;
}
:deep(.list-item) {
max-width: 320px;
}
.page-box {
position: absolute;
bottom: 20px;
right: 20px;
}
.page-box {
position: absolute;
bottom: 20px;
right: 20px;
}
</style>

View File

@ -4,122 +4,124 @@
<TableAction :actions="tableActions(record)" />
</template>
</BasicTable>
<LaunchProcess v-if="processData.visible" :draftsId="processData.draftsId" :draftsJsonStr="processData.draftsJsonStr" :schemaId="processData.schemaId" @close="processData.visible = false" />
<LaunchProcess v-if="processData.visible" :draftsId="processData.draftsId"
:draftsJsonStr="processData.draftsJsonStr" :schemaId="processData.schemaId"
@close="processData.visible = false" />
</template>
<script setup>
import userTaskTable from './../../hooks/userTaskTable';
import userTaskTable from './../../hooks/userTaskTable';
import LaunchProcess from './../LaunchProcess.vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { deleteDraft, getDraftInfo, getSchemaTask } from '/@/api/workflow/process';
import { reactive } from 'vue';
import { notification } from 'ant-design-vue';
import { TaskTypeUrl } from '/@/enums/workflowEnum';
import { useI18n } from '/@/hooks/web/useI18n';
import { useRouter } from 'vue-router';
import LaunchProcess from './../LaunchProcess.vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { deleteDraft, getDraftInfo, getSchemaTask } from '/@/api/workflow/process';
import { reactive } from 'vue';
import { notification } from 'ant-design-vue';
import { TaskTypeUrl } from '/@/enums/workflowEnum';
import { useI18n } from '/@/hooks/web/useI18n';
import { useRouter } from 'vue-router';
const { t } = useI18n();
const router = useRouter();
const configColumns = [
const { t } = useI18n();
const router = useRouter();
const configColumns = [
{
title: t('流程名称'),
dataIndex: 'schemaName',
align: 'left'
},
{
title: t('发起者'),
dataIndex: 'originator',
sorter: true,
align: 'left'
},
{
title: t('发起时间'),
dataIndex: 'createDate',
align: 'left'
}
];
const processData = reactive({
visible: false,
schemaId: '',
draftsJsonStr: '',
draftsId: ''
});
const { formConfig } = userTaskTable();
const [registerTable, { reload }] = useTable({
title: t('草稿箱列表'),
api: getSchemaTask,
rowKey: 'id',
columns: configColumns,
formConfig: formConfig('Drafts'),
beforeFetch: (params) => {
return { data: params, taskUrl: TaskTypeUrl.DRAFT };
},
useSearchForm: true,
showTableSetting: true,
striped: false,
pagination: {
pageSize: 18
},
actionColumn: {
width: 80,
title: t('操作'),
dataIndex: 'action',
slots: { customRender: 'action' },
fixed: undefined
}
});
function tableActions(record) {
return [
{
title: t('流程名称'),
dataIndex: 'schemaName',
align: 'left'
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record)
},
{
title: t('发起者'),
dataIndex: 'originator',
sorter: true,
align: 'left'
},
{
title: t('发起时间'),
dataIndex: 'createDate',
align: 'left'
icon: 'ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: t('是否确认删除'),
confirm: handleDelete.bind(null, record)
}
}
];
const processData = reactive({
visible: false,
schemaId: '',
draftsJsonStr: '',
draftsId: ''
});
const { formConfig } = userTaskTable();
const [registerTable, { reload }] = useTable({
title: t('草稿箱列表'),
api: getSchemaTask,
rowKey: 'id',
columns: configColumns,
formConfig: formConfig('Drafts'),
beforeFetch: (params) => {
return { data: params, taskUrl: TaskTypeUrl.DRAFT };
},
useSearchForm: true,
showTableSetting: true,
striped: false,
pagination: {
pageSize: 18
},
actionColumn: {
width: 80,
title: t('操作'),
dataIndex: 'action',
slots: { customRender: 'action' },
fixed: undefined
}
});
}
function tableActions(record) {
return [
{
icon: 'clarity:note-edit-line',
onClick: handleEdit.bind(null, record)
},
{
icon: 'ant-design:delete-outlined',
color: 'error',
popConfirm: {
title: t('是否确认删除'),
confirm: handleDelete.bind(null, record)
}
}
];
}
async function handleEdit(record) {
try {
let res = await getDraftInfo(record.id);
/*processData.draftsId = record.id;
processData.schemaId = res.schemaId;
processData.draftsJsonStr = res.formData;
processData.visible = true;*/
localStorage.setItem('draftsJsonStr', res.formData);
router.push({
path: `/flow/${res.schemaId}/${record.id}/createFlow`
});
} catch (error) { }
}
async function handleEdit(record) {
try {
let res = await getDraftInfo(record.id);
/*processData.draftsId = record.id;
processData.schemaId = res.schemaId;
processData.draftsJsonStr = res.formData;
processData.visible = true;*/
localStorage.setItem('draftsJsonStr', res.formData);
router.push({
path: `/flow/${res.schemaId}/${record.id}/createFlow`
async function handleDelete(record) {
try {
let res = await deleteDraft([record.id]);
if (res) {
notification.open({
type: 'success',
message: t('删除'),
description: t('删除成功')
});
} catch (error) {}
}
async function handleDelete(record) {
try {
let res = await deleteDraft([record.id]);
if (res) {
notification.open({
type: 'success',
message: t('删除'),
description: t('删除成功')
});
reload();
} else {
notification.open({
type: 'error',
message: t('删除'),
description: t('删除失败')
});
}
} catch (error) {}
}
reload();
} else {
notification.open({
type: 'error',
message: t('删除'),
description: t('删除失败')
});
}
} catch (error) { }
}
</script>
<style scoped></style>

View File

@ -114,6 +114,15 @@
});
const router = useRouter();
const { currentRoute } = router;
onMounted(() => {
bus.on(FLOW_PROCESSED, onFlowProcessed);
});
onUnmounted(() => {
bus.off(FLOW_PROCESSED, onFlowProcessed);
});
watch(
() => unref(currentRoute),
(val) => {
@ -134,14 +143,6 @@
function onFlowProcessed() {
reload();
}
onMounted(() => {
bus.on(FLOW_PROCESSED, onFlowProcessed);
});
onUnmounted(() => {
bus.off(FLOW_PROCESSED, onFlowProcessed);
});
</script>
<style scoped></style>