|
@@ -4,7 +4,7 @@
|
|
|
<el-tabs v-model="state.activeName" @tab-change="handleClick" class="h100">
|
|
|
<el-tab-pane label="流程业务" name="0"></el-tab-pane>
|
|
|
<el-tab-pane label="流程模板" name="1"></el-tab-pane>
|
|
|
-<!-- <el-tab-pane label="流程实例" name="2"></el-tab-pane>-->
|
|
|
+ <!-- <el-tab-pane label="流程实例" name="2"></el-tab-pane>-->
|
|
|
<div class="flex-column">
|
|
|
<el-form
|
|
|
:model="state.queryParams"
|
|
@@ -12,17 +12,22 @@
|
|
|
:inline="true"
|
|
|
@submit.native.prevent
|
|
|
class="mt15"
|
|
|
- v-if="['1','2'].includes(state.activeName)"
|
|
|
+ v-if="['1', '2'].includes(state.activeName)"
|
|
|
>
|
|
|
<el-form-item label="关键字查询" prop="Keyword">
|
|
|
- <el-input v-model="state.queryParams.Keyword" :placeholder="state.activeName ==='1' ? '模板名称/模板编码' : '流程标题/流程ID'" clearable @keyup.enter="queryList" />
|
|
|
+ <el-input
|
|
|
+ v-model="state.queryParams.Keyword"
|
|
|
+ :placeholder="state.activeName === '1' ? '模板名称/模板编码' : '流程标题/流程ID'"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="queryList"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="模板状态" prop="Status" v-show="state.activeName === '1'">
|
|
|
- <el-select v-model="state.queryParams.Status" class="w100" placeholder="请选择模板状态" v-show="state.activeName === '1'">
|
|
|
- <el-option v-for="item in state.statusList" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="业务模块" prop="ModuleCode" v-show="state.activeName === '2'">
|
|
|
+ <el-form-item label="模板状态" prop="Status" v-show="state.activeName === '1'">
|
|
|
+ <el-select v-model="state.queryParams.Status" class="w100" placeholder="请选择模板状态" v-show="state.activeName === '1'">
|
|
|
+ <el-option v-for="item in state.statusList" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="业务模块" prop="ModuleCode" v-show="state.activeName === '2'">
|
|
|
<el-select v-model="state.queryParams.ModuleCode" class="w100" placeholder="请选择业务模块">
|
|
|
<el-option v-for="item in state.moduleOptions" :key="item.key" :label="item.value" :value="item.key" />
|
|
|
</el-select>
|
|
@@ -31,7 +36,9 @@
|
|
|
<el-button type="primary" @click="queryList" :loading="state.loading" v-waves>
|
|
|
<SvgIcon name="ele-Search" class="mr5" />查询
|
|
|
</el-button>
|
|
|
- <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button" :loading="state.loading"> <SvgIcon name="ele-Refresh" class="mr5" />重置 </el-button>
|
|
|
+ <el-button @click="resetQuery(ruleFormRef)" v-waves class="default-button" :loading="state.loading">
|
|
|
+ <SvgIcon name="ele-Refresh" class="mr5" />重置
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div class="mb20">
|
|
@@ -46,15 +53,26 @@
|
|
|
<el-table-column prop="name" label="业务模块" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="code" label="编码" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="remark" label="备注" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="definition.name" label="模板名称" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="definition.code" label="模板编码" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="definition.version" label="模板版本" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column label="操作" width="160" fixed="right" align="center">
|
|
|
- <template #default="{ row }">
|
|
|
- <el-button link type="primary" @click="onConfig(row)" title="配置模板" v-auth="'system:workflow:template:config'"> 配置模板</el-button>
|
|
|
- <el-button link type="danger" @click="configClear(row)" title="清除配置" v-if="row.definition" v-auth="'system:workflow:template:clear'"> 清除配置 </el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column prop="definition.name" label="模板名称" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="definition.code" label="模板编码" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="definition.version" label="模板版本" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column label="操作" width="160" fixed="right" align="center">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button link type="primary" @click="onConfig(row)" title="配置模板" v-auth="'system:workflow:template:config'">
|
|
|
+ 配置模板</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="danger"
|
|
|
+ @click="configClear(row)"
|
|
|
+ title="清除配置"
|
|
|
+ v-if="row.definition"
|
|
|
+ v-auth="'system:workflow:template:clear'"
|
|
|
+ >
|
|
|
+ 清除配置
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</template>
|
|
|
<!-- 模板 -->
|
|
|
<template v-if="state.activeName === '1'">
|
|
@@ -71,11 +89,25 @@
|
|
|
<!-- 草稿0 启用1 禁用2 -->
|
|
|
<template #default="{ row }">
|
|
|
<el-button link type="primary" @click="onEditTemp(row)" title="修改" v-auth="'system:workflow:template:edit'"> 修改 </el-button>
|
|
|
- <el-button link type="success" v-if="row.status === 0" @click="onReleaseTemp(row)" title="发布" v-auth="'system:workflow:template:publish'" >
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="success"
|
|
|
+ v-if="row.status === 0"
|
|
|
+ @click="onReleaseTemp(row)"
|
|
|
+ title="发布"
|
|
|
+ v-auth="'system:workflow:template:publish'"
|
|
|
+ >
|
|
|
发布
|
|
|
</el-button>
|
|
|
<!-- 发布之后不能修改 -->
|
|
|
- <el-button link v-if="row.status === 0" type="danger" @click="onDeleteTemp(row)" title="删除" v-auth="'system:workflow:template:delete'">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ v-if="row.status === 0"
|
|
|
+ type="danger"
|
|
|
+ @click="onDeleteTemp(row)"
|
|
|
+ title="删除"
|
|
|
+ v-auth="'system:workflow:template:delete'"
|
|
|
+ >
|
|
|
删除
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -139,23 +171,33 @@
|
|
|
</div>
|
|
|
</el-tabs>
|
|
|
</el-card>
|
|
|
- <!-- 流程跳转 -->
|
|
|
+ <!-- 流程跳转 -->
|
|
|
<workflow-jump ref="workflowJumpRef" @updateList="queryList" />
|
|
|
|
|
|
- <!-- 配置模板 -->
|
|
|
- <Workflow-config ref="workflowConfigRef" @updateList="queryList"/>
|
|
|
+ <!-- 配置模板 -->
|
|
|
+ <Workflow-config ref="workflowConfigRef" @updateList="queryList" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup name="systemWorkflow">
|
|
|
-import {defineAsyncComponent, onActivated, onMounted, reactive, ref} from 'vue';
|
|
|
-import {useRoute, useRouter} from 'vue-router';
|
|
|
-import type {FormInstance} from 'element-plus';
|
|
|
-import {ElMessage, ElMessageBox} from 'element-plus';
|
|
|
-import {formatDate} from '/@/utils/formatTime';
|
|
|
-import {throttle} from '/@/utils/tools';
|
|
|
-import {baseData, publishOnList, wfmodules, wfmodulesMatch, workflowDelete, workflowDisable, workflowEnable, workflowList, workflowPaged, workflowTerminate,} from '/@/api/system/workflow';
|
|
|
-
|
|
|
+import { defineAsyncComponent, onActivated, onMounted, reactive, ref } from 'vue';
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
+import type { FormInstance } from 'element-plus';
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
+import { formatDate } from '/@/utils/formatTime';
|
|
|
+import { throttle } from '/@/utils/tools';
|
|
|
+import {
|
|
|
+ baseData,
|
|
|
+ publishOnList,
|
|
|
+ wfmodules,
|
|
|
+ wfmodulesMatch,
|
|
|
+ workflowDelete,
|
|
|
+ workflowDisable,
|
|
|
+ workflowEnable,
|
|
|
+ workflowList,
|
|
|
+ workflowPaged,
|
|
|
+ workflowTerminate,
|
|
|
+} from '/@/api/system/workflow';
|
|
|
|
|
|
// 引入组件
|
|
|
const WorkflowJump = defineAsyncComponent(() => import('/@/views/system/config/workflow/component/Workflow-jump.vue')); // 流程跳转
|
|
@@ -164,11 +206,12 @@ const WorkflowConfig = defineAsyncComponent(() => import('/@/views/system/config
|
|
|
// 定义变量内容
|
|
|
const state = reactive(<any>{
|
|
|
activeName: '0', // 0:模板 1:实例 2:历史
|
|
|
- queryParams: { // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ // 查询参数
|
|
|
PageIndex: 1, // 当前页
|
|
|
PageSize: 10, // 每页条数
|
|
|
- Keyword: null,// 关键字
|
|
|
- Status:null,
|
|
|
+ Keyword: null, // 关键字
|
|
|
+ Status: null,
|
|
|
ModuleCode: null, // 模块编码
|
|
|
},
|
|
|
tableList: [], // 表格数据
|
|
@@ -176,13 +219,14 @@ const state = reactive(<any>{
|
|
|
total: 0, // 总条数
|
|
|
multipleSelection: [], // 多选
|
|
|
moduleOptions: [], // 模块下拉
|
|
|
- statusList:[ // 状态下拉
|
|
|
- {label:'启用',value:'1'},
|
|
|
- {label:'草稿',value:'0'},
|
|
|
- ]
|
|
|
+ statusList: [
|
|
|
+ // 状态下拉
|
|
|
+ { label: '启用', value: '1' },
|
|
|
+ { label: '草稿', value: '0' },
|
|
|
+ ],
|
|
|
});
|
|
|
|
|
|
-const ruleFormRef = ref<FormInstance>(); // 表单ref
|
|
|
+const ruleFormRef = ref<FormInstance>(); // 表单ref
|
|
|
const workflowJumpRef = ref(null as any); // 跳转ref
|
|
|
const workflowConfigRef = ref(null as any); // 配置ref
|
|
|
const router = useRouter(); // 路由
|
|
@@ -190,11 +234,11 @@ const route = useRoute();
|
|
|
/** 获取列表 */
|
|
|
const queryList = () => {
|
|
|
state.loading = true;
|
|
|
- let req:any = {
|
|
|
- PageIndex: state.queryParams.PageIndex,
|
|
|
- PageSize: state.queryParams.PageSize,
|
|
|
- Keyword: state.queryParams.Keyword,
|
|
|
- }
|
|
|
+ let req: any = {
|
|
|
+ PageIndex: state.queryParams.PageIndex,
|
|
|
+ PageSize: state.queryParams.PageSize,
|
|
|
+ Keyword: state.queryParams.Keyword,
|
|
|
+ };
|
|
|
switch (state.activeName) {
|
|
|
case '0':
|
|
|
wfmodules()
|
|
@@ -207,10 +251,10 @@ const queryList = () => {
|
|
|
});
|
|
|
break;
|
|
|
case '1':
|
|
|
- req = {
|
|
|
- ...req,
|
|
|
- Status:state.queryParams.Status
|
|
|
- }
|
|
|
+ req = {
|
|
|
+ ...req,
|
|
|
+ Status: state.queryParams.Status,
|
|
|
+ };
|
|
|
workflowList(req)
|
|
|
.then((response: any) => {
|
|
|
state.tableList = response.result.items ?? [];
|
|
@@ -222,10 +266,10 @@ const queryList = () => {
|
|
|
});
|
|
|
break;
|
|
|
case '2':
|
|
|
- req = {
|
|
|
- ...req,
|
|
|
- ModuleCode:state.queryParams.ModuleCode
|
|
|
- }
|
|
|
+ req = {
|
|
|
+ ...req,
|
|
|
+ ModuleCode: state.queryParams.ModuleCode,
|
|
|
+ };
|
|
|
workflowPaged(req)
|
|
|
.then((response: any) => {
|
|
|
state.tableList = response.result?.items ?? [];
|
|
@@ -248,13 +292,17 @@ const resetQuery = throttle((formEl: FormInstance | undefined) => {
|
|
|
}, 500);
|
|
|
// 切换tab 查询列表
|
|
|
const handleClick = () => {
|
|
|
- state.queryParams.Keyword = '';
|
|
|
- state.queryParams.Status = '';
|
|
|
- state.queryParams.ModuleCode = '';
|
|
|
+ state.queryParams.Keyword = '';
|
|
|
+ state.queryParams.Status = '';
|
|
|
+ state.queryParams.ModuleCode = '';
|
|
|
queryList();
|
|
|
};
|
|
|
// 新增模板
|
|
|
const onAddTemp = () => {
|
|
|
+ if (!router.hasRoute('workflowAddEdit')) {
|
|
|
+ ElMessage.warning('未找到新增流程模板页面');
|
|
|
+ return;
|
|
|
+ }
|
|
|
router.push({
|
|
|
name: 'workflowAddEdit',
|
|
|
params: {
|
|
@@ -264,6 +312,10 @@ const onAddTemp = () => {
|
|
|
};
|
|
|
// 修改模板
|
|
|
const onEditTemp = (row: any) => {
|
|
|
+ if (!router.hasRoute('workflowAddEdit')) {
|
|
|
+ ElMessage.warning('未找到流程编辑页面');
|
|
|
+ return;
|
|
|
+ }
|
|
|
router.push({
|
|
|
name: 'workflowAddEdit',
|
|
|
params: {
|
|
@@ -292,22 +344,22 @@ const onDeleteTemp = (row: any) => {
|
|
|
};
|
|
|
// 发布模板
|
|
|
const onReleaseTemp = async (row: any) => {
|
|
|
- console.log(row)
|
|
|
- ElMessageBox.confirm(`此操作将发布模板:“${row.name}”,是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- draggable: true,
|
|
|
- cancelButtonClass: 'default-button',
|
|
|
- autofocus: false,
|
|
|
+ console.log(row);
|
|
|
+ ElMessageBox.confirm(`此操作将发布模板:“${row.name}”,是否继续?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ autofocus: false,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ publishOnList(row.id).then(() => {
|
|
|
+ ElMessage.success('发布成功');
|
|
|
+ queryList();
|
|
|
+ });
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- publishOnList(row.id).then(() => {
|
|
|
- ElMessage.success('发布成功');
|
|
|
- queryList();
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
+ .catch(() => {});
|
|
|
};
|
|
|
// 跳转流程
|
|
|
const onLink = (row: any) => {
|
|
@@ -353,44 +405,45 @@ const onStopProcess = (row: any) => {
|
|
|
.catch(() => {});
|
|
|
};
|
|
|
|
|
|
-
|
|
|
// 配置模板
|
|
|
-const onConfig = (row:any)=>{
|
|
|
- workflowConfigRef.value.openDialog(row);
|
|
|
-}
|
|
|
+const onConfig = (row: any) => {
|
|
|
+ workflowConfigRef.value.openDialog(row);
|
|
|
+};
|
|
|
// 清除配置
|
|
|
-const configClear = (row:any)=>{
|
|
|
- ElMessageBox.confirm(`确认清除${row.name} 的配置?`, '提示', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- draggable: true,
|
|
|
- cancelButtonClass: 'default-button',
|
|
|
- autofocus: false,
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- wfmodulesMatch({code:row.code,definitionId:''}).then(()=>{
|
|
|
- ElMessage.success('操作成功');
|
|
|
- queryList();
|
|
|
- }).catch(()=>{})
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
-}
|
|
|
+const configClear = (row: any) => {
|
|
|
+ ElMessageBox.confirm(`确认清除${row.name} 的配置?`, '提示', {
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ draggable: true,
|
|
|
+ cancelButtonClass: 'default-button',
|
|
|
+ autofocus: false,
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ wfmodulesMatch({ code: row.code, definitionId: '' })
|
|
|
+ .then(() => {
|
|
|
+ ElMessage.success('操作成功');
|
|
|
+ queryList();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
const params = history.state;
|
|
|
onMounted(async () => {
|
|
|
queryList();
|
|
|
// 获取页面基础信息
|
|
|
const res: any = await baseData();
|
|
|
state.moduleOptions = res.result?.moduleOptions ?? [];
|
|
|
- if(params.index){
|
|
|
- state.activeName = params.index as string;
|
|
|
- }
|
|
|
+ if (params.index) {
|
|
|
+ state.activeName = params.index as string;
|
|
|
+ }
|
|
|
});
|
|
|
onActivated(() => {
|
|
|
- if(params.index){
|
|
|
- state.activeName = params.index as string;
|
|
|
- queryList();
|
|
|
- }
|
|
|
+ if (params.index) {
|
|
|
+ state.activeName = params.index as string;
|
|
|
+ queryList();
|
|
|
+ }
|
|
|
});
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|