add 添加表单配置

This commit is contained in:
gssong
2024-03-31 15:34:54 +08:00
parent 5dfc25a493
commit 2ea1807f34
19 changed files with 744 additions and 159 deletions

View File

@ -0,0 +1,249 @@
<template>
<div class="p-2">
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div class="search" v-show="showSearch">
<el-form :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
<el-form-item label="表单名称" prop="formName">
<el-input v-model="queryParams.formName" placeholder="请输入表单名称" clearable style="width: 240px" @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</div>
</transition>
<el-card shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['workflow:formManage:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['workflow:formManage:edit']">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['workflow:formManage:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['workflow:formManage:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
<el-table v-loading="loading" :data="formManageList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="表单名称" align="center" prop="formName" />
<el-table-column label="表单类型" align="center">
<template #default="scope">
<dict-tag :options="wf_form_type" :value="scope.row.formType"></dict-tag>
</template>
</el-table-column>
<el-table-column label="地址" align="center" prop="router" />
<el-table-column label="备注" align="center" prop="remork" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['workflow:formManage:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['workflow:formManage:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
<!-- 添加或修改表单管理对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="formManageFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="表单名称" prop="formName">
<el-input v-model="form.formName" placeholder="请输入表单名称" />
</el-form-item>
<el-form-item label="表单类型" prop="formType">
<el-radio-group v-model="form.formType" @change="form.router = ''">
<el-radio border v-for="dict in wf_form_type" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="路由地址" prop="router" v-if="form.formType === 'static'">
<el-input v-model="form.router" placeholder="请输入路由地址" />
</el-form-item>
<el-form-item label="表单" prop="router" v-else>
<el-input v-model="form.router" disabled placeholder="请选择表单" >
<template #append>
<el-button icon="Search" />
</template>
</el-input>
</el-form-item>
<el-form-item label="备注" prop="remork">
<el-input v-model="form.remork" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="FormManage" lang="ts">
import { listFormManage, getFormManage, delFormManage, addFormManage, updateFormManage } from '@/api/workflow/formManage';
import { FormManageVO, FormManageQuery, FormManageForm } from '@/api/workflow/formManage/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wf_form_type } = toRefs<any>(proxy?.useDict('wf_form_type'));
const formManageList = ref<FormManageVO[]>([]);
const buttonLoading = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref<Array<string | number>>([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const formManageFormRef = ref<ElFormInstance>();
const dialog = reactive<DialogOption>({
visible: false,
title: ''
});
const initFormData: FormManageForm = {
id: undefined,
formName: undefined,
formType: 'static',
remork: undefined,
}
const data = reactive<PageData<FormManageForm, FormManageQuery>>({
form: {...initFormData},
queryParams: {
pageNum: 1,
pageSize: 10,
formName: undefined,
formType: undefined
},
rules: {
id: [
{ required: true, message: "主键不能为空", trigger: "blur" }
],
formName: [
{ required: true, message: "表单名称不能为空", trigger: "blur" }
],
formType: [
{ required: true, message: "表单类型不能为空", trigger: "change" }
],
router: [
{ required: true, message: "不能为空", trigger: "blur" }
],
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询表单管理列表 */
const getList = async () => {
loading.value = true;
const res = await listFormManage(queryParams.value);
formManageList.value = res.rows;
total.value = res.total;
loading.value = false;
}
/** 取消按钮 */
const cancel = () => {
reset();
dialog.visible = false;
}
/** 表单重置 */
const reset = () => {
form.value = {...initFormData};
formManageFormRef.value?.resetFields();
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value?.resetFields();
handleQuery();
}
/** 多选框选中数据 */
const handleSelectionChange = (selection: FormManageVO[]) => {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = "添加表单管理";
}
/** 修改按钮操作 */
const handleUpdate = async (row?: FormManageVO) => {
reset();
const _id = row?.id || ids.value[0]
const res = await getFormManage(_id);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = "修改表单管理";
}
/** 提交按钮 */
const submitForm = () => {
formManageFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
buttonLoading.value = true;
if (form.value.id) {
await updateFormManage(form.value).finally(() => buttonLoading.value = false);
} else {
await addFormManage(form.value).finally(() => buttonLoading.value = false);
}
proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false;
await getList();
}
});
}
/** 删除按钮操作 */
const handleDelete = async (row?: FormManageVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除表单管理编号为"' + _ids + '"的数据项?').finally(() => loading.value = false);
await delFormManage(_ids);
proxy?.$modal.msgSuccess("删除成功");
await getList();
}
/** 导出按钮操作 */
const handleExport = () => {
proxy?.download('workflow/formManage/export', {
...queryParams.value
}, `formManage_${new Date().getTime()}.xlsx`)
}
onMounted(() => {
getList();
});
</script>

View File

@ -221,15 +221,17 @@
</el-dialog>
<!-- 表单配置 -->
<el-dialog v-model="formDialog.visible" :title="formDialog.title" width="650px" append-to-body :close-on-click-modal="false">
<el-form :model="formDefinitionForm" label-width="auto">
<el-form :model="definitionConfigForm" label-width="auto">
<el-form-item label="流程KEY">
<el-input v-model="formDefinitionForm.processKey" disabled/>
<el-input v-model="definitionConfigForm.processKey" disabled/>
</el-form-item>
<el-form-item label="路由地址">
<el-input v-model="formDefinitionForm.path" placeholder="请假示例路由请填写:/demo/leaveEdit/index"/>
<el-form-item label="表单" prop="formId">
<el-select v-model="definitionConfigForm.formId" clearable filterable placeholder="请选择表单" style="width: 260px" >
<el-option v-for="item in formManageList" :key="item.id" :label="item.formTypeName+':'+item.formName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="formDefinitionForm.remark" type="textarea" resize="none"/>
<el-input v-model="definitionConfigForm.remark" type="textarea" resize="none"/>
</el-form-item>
</el-form>
@ -258,12 +260,15 @@ import {
} from '@/api/workflow/processDefinition';
import ProcessPreview from './components/processPreview.vue';
import { listCategory } from '@/api/workflow/category';
import { getByDefId,saveOrUpdate } from '@/api/workflow/formDefinition';
import { getByDefId,saveOrUpdate } from '@/api/workflow/definitionConfig';
import { CategoryVO } from '@/api/workflow/category/types';
import { ProcessDefinitionQuery, ProcessDefinitionVO } from '@/api/workflow/processDefinition/types';
import { FormDefinitionForm } from '@/api/workflow/formDefinition/types';
import { definitionConfigForm } from '@/api/workflow/definitionConfig/types';
import { UploadRequestOptions } from 'element-plus';
import { FormManageVO } from '@/api/workflow/formManage/types';
import { selectListFormManage } from '@/api/workflow/formManage';
const formManageList = ref<FormManageVO[]>([]);
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const previewRef = ref<InstanceType<typeof ProcessPreview>>();
@ -290,7 +295,7 @@ const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref('');
/** 部署文件分类选择 */
const selectCategory = ref();
const formDefinitionForm = ref<FormDefinitionForm>({});
const definitionConfigForm = ref<definitionConfigForm>({});
const uploadDialog = reactive<DialogOption>({
visible: false,
@ -473,21 +478,22 @@ const handerDeployProcessFile = (data: UploadRequestOptions): XMLHttpRequest =>
};
//打开表单配置
const handleFormOpen = async (row: ProcessDefinitionVO) => {
listFormManage()
formDialog.visible = true
formDefinitionForm.value.processKey = row.key
formDefinitionForm.value.definitionId = row.id
definitionConfigForm.value.processKey = row.key
definitionConfigForm.value.definitionId = row.id
const resp = await getByDefId(row.id)
if(resp.data){
formDefinitionForm.value = resp.data
definitionConfigForm.value = resp.data
}else{
formDefinitionForm.value.path = undefined
formDefinitionForm.value.remark = undefined
definitionConfigForm.value.formId = undefined
definitionConfigForm.value.remark = undefined
}
}
//保存表单
const handlerSaveForm = async () => {
await proxy?.$modal.confirm('是否确认保存?');
saveOrUpdate(formDefinitionForm.value).then(resp=>{
saveOrUpdate(definitionConfigForm.value).then(resp=>{
if(resp.code === 200){
proxy?.$modal.msgSuccess('操作成功');
formDialog.visible = false
@ -495,4 +501,9 @@ const handlerSaveForm = async () => {
}
})
}
//表单列表
const listFormManage = async () => {
const res = await selectListFormManage();
formManageList.value = res.data;
}
</script>

View File

@ -161,6 +161,8 @@ import { getListByKey, migrationDefinition } from '@/api/workflow/processDefinit
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//审批记录组件
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const queryFormRef = ref<ElFormInstance>();
@ -347,18 +349,14 @@ const handleChange = async (id: string) => {
};
/** 查看按钮操作 */
const handleView = (row) => {
if(row.wfFormDefinitionVo){
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.wfFormDefinitionVo.path}`,
query: {
id: row.businessKey,
type: 'view'
}
})
}else{
proxy?.$modal.msgError('请到流程定义菜单配置路由!');
}
const routerJumpVo = reactive<RouterJumpVo>({
wfDefinitionConfigVo: row.wfDefinitionConfigVo,
wfNodeConfigVo: row.wfNodeConfigVo,
businessKey: row.businessKey,
taskId: row.id,
type: 'view'
});
workflowCommon.routerJump(routerJumpVo,proxy)
};
onMounted(() => {

View File

@ -54,13 +54,13 @@
</template>
<template v-else>
<el-tag type="success">
{{ scope.row.assigneeName }}
{{ scope.row.assigneeName || '无'}}
</el-tag>
</template>
</template>
<template v-else-if="tab === 'finish'" #default="scope">
<el-tag type="success">
{{ scope.row.assigneeName }}
{{ scope.row.assigneeName || '无'}}
</el-tag>
</template>
</el-table-column>
@ -129,6 +129,8 @@ import { getPageByAllTaskWait, getPageByAllTaskFinish, updateAssignee, getInstan
import MultiInstanceUser from '@/components/Process/multiInstanceUser.vue';
import UserSelect from '@/components/UserSelect';
import { TaskQuery, TaskVO, VariableVo } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//审批记录组件
//加签组件
const multiInstanceUserRef = ref<InstanceType<typeof MultiInstanceUser>>();
@ -260,18 +262,14 @@ const handleInstanceVariable = async (row: TaskVO) => {
};
/** 查看按钮操作 */
const handleView = (row) => {
if(row.wfFormDefinitionVo){
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.wfFormDefinitionVo.path}`,
query: {
id: row.businessKey,
type: 'view'
}
})
}else{
proxy?.$modal.msgError('请到流程定义菜单配置路由!');
}
const routerJumpVo = reactive<RouterJumpVo>({
wfDefinitionConfigVo: row.wfDefinitionConfigVo,
wfNodeConfigVo: row.wfNodeConfigVo,
businessKey: row.businessKey,
taskId: row.id,
type: 'view'
});
workflowCommon.routerJump(routerJumpVo,proxy)
};
onMounted(() => {
getWaitingList();

View File

@ -117,6 +117,8 @@ import { getPageByCurrent, deleteRunAndHisInstance, cancelProcessApply } from '@
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const queryFormRef = ref<ElFormInstance>();
const categoryTreeRef = ref<ElTreeInstance>();
@ -250,17 +252,13 @@ const handleCancelProcessApply = async (processInstanceId: string) => {
//办理
const handleOpen = async (row,type) => {
if(row.wfFormDefinitionVo){
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.wfFormDefinitionVo.path}`,
query: {
id: row.businessKey,
type: type
}
})
}else{
proxy?.$modal.msgError('请到流程定义菜单配置路由!');
}
const routerJumpVo = reactive<RouterJumpVo>({
wfDefinitionConfigVo: row.wfDefinitionConfigVo,
wfNodeConfigVo: row.wfNodeConfigVo,
businessKey: row.businessKey,
taskId: row.id,
type: type
});
workflowCommon.routerJump(routerJumpVo,proxy)
};
</script>

View File

@ -43,7 +43,7 @@
</template>
<template v-else>
<el-tag type="success">
{{ scope.row.assigneeName }}
{{ scope.row.assigneeName || '无'}}
</el-tag>
</template>
</template>
@ -73,6 +73,8 @@
<script lang="ts" setup>
import { getPageByTaskCopy} from '@/api/workflow/task';
import { TaskQuery } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//审批记录组件
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -127,18 +129,14 @@ const getTaskCopyList = () => {
/** 查看按钮操作 */
const handleView = (row) => {
if(row.wfFormDefinitionVo){
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.wfFormDefinitionVo.path}`,
query: {
id: row.businessKey,
type: 'view'
}
})
}else{
proxy?.$modal.msgError('请到流程定义菜单配置路由!');
}
const routerJumpVo = reactive<RouterJumpVo>({
wfDefinitionConfigVo: row.wfDefinitionConfigVo,
wfNodeConfigVo: row.wfNodeConfigVo,
businessKey: row.businessKey,
taskId: row.id,
type: 'view'
});
workflowCommon.routerJump(routerJumpVo,proxy)
};

View File

@ -37,7 +37,7 @@
<el-table-column fixed align="center" prop="assigneeName" label="办理人">
<template #default="scope">
<el-tag type="success">
{{ scope.row.assigneeName }}
{{ scope.row.assigneeName || '无'}}
</el-tag>
</template>
</el-table-column>
@ -62,6 +62,8 @@
<script lang="ts" setup>
import { getPageByTaskFinish } from '@/api/workflow/task';
import { TaskQuery, TaskVO } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//审批记录组件
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -113,19 +115,15 @@ const getFinishList = () => {
});
};
/** 查看按钮操作 */
const handleView = (row) => {
if(row.wfFormDefinitionVo){
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.wfFormDefinitionVo.path}`,
query: {
id: row.businessKey,
type: 'view'
}
})
}else{
proxy?.$modal.msgError('请到流程定义菜单配置路由!');
}
const handleView = (row: TaskVO) => {
const routerJumpVo = reactive<RouterJumpVo>({
wfDefinitionConfigVo: row.wfDefinitionConfigVo,
wfNodeConfigVo: row.wfNodeConfigVo,
businessKey: row.businessKey,
taskId: row.id,
type: 'view'
});
workflowCommon.routerJump(routerJumpVo,proxy)
};
onMounted(() => {

View File

@ -43,7 +43,7 @@
</template>
<template v-else>
<el-tag type="success">
{{ scope.row.assigneeName }}
{{ scope.row.assigneeName || '无' }}
</el-tag>
</template>
</template>
@ -79,6 +79,9 @@
<script lang="ts" setup>
import { getPageByTaskWait, claim, returnTask } from '@/api/workflow/task';
import { TaskQuery, TaskVO } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
//提交组件
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -135,29 +138,14 @@ const getWaitingList = () => {
};
//办理
const handleOpen = async (row: TaskVO) => {
if (row.formKey != null) {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.formKey}`,
query: {
id: row.businessKey,
type: 'approval',
taskId: row.id
}
});
} else if (row.wfFormDefinitionVo) {
proxy.$tab.closePage(proxy.$route);
proxy.$router.push({
path: `${row.wfFormDefinitionVo.path}`,
query: {
id: row.businessKey,
type: 'approval',
taskId: row.id
}
});
} else {
proxy?.$modal.msgError('请到流程定义菜单配置路由!');
}
const routerJumpVo = reactive<RouterJumpVo>({
wfDefinitionConfigVo: row.wfDefinitionConfigVo,
wfNodeConfigVo: row.wfNodeConfigVo,
businessKey: row.businessKey,
taskId: row.id,
type: 'approval'
});
workflowCommon.routerJump(routerJumpVo,proxy)
};
/** 认领任务 */