add 添加动态表单单据
This commit is contained in:
parent
3a9c651c28
commit
435542932d
63
src/api/workflow/businessForm/index.ts
Normal file
63
src/api/workflow/businessForm/index.ts
Normal file
@ -0,0 +1,63 @@
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
import { BusinessFormVO, BusinessFormForm, BusinessFormQuery } from '@/api/workflow/businessForm/types';
|
||||
|
||||
/**
|
||||
* 查询发起流程列表
|
||||
* @param query
|
||||
* @returns {*}
|
||||
*/
|
||||
|
||||
export const listBusinessForm = (query?: BusinessFormQuery): AxiosPromise<BusinessFormVO[]> => {
|
||||
return request({
|
||||
url: '/workflow/businessForm/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询发起流程详细
|
||||
* @param id
|
||||
*/
|
||||
export const getBusinessForm = (id: string | number): AxiosPromise<BusinessFormVO> => {
|
||||
return request({
|
||||
url: '/workflow/businessForm/' + id,
|
||||
method: 'get'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 新增发起流程
|
||||
* @param data
|
||||
*/
|
||||
export const addBusinessForm = (data: BusinessFormForm) => {
|
||||
return request({
|
||||
url: '/workflow/businessForm',
|
||||
method: 'post',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 修改发起流程
|
||||
* @param data
|
||||
*/
|
||||
export const updateBusinessForm = (data: BusinessFormForm) => {
|
||||
return request({
|
||||
url: '/workflow/businessForm',
|
||||
method: 'put',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除发起流程
|
||||
* @param id
|
||||
*/
|
||||
export const delBusinessForm = (id: string | number | Array<string | number>) => {
|
||||
return request({
|
||||
url: '/workflow/businessForm/' + id,
|
||||
method: 'delete'
|
||||
});
|
||||
};
|
76
src/api/workflow/businessForm/types.ts
Normal file
76
src/api/workflow/businessForm/types.ts
Normal file
@ -0,0 +1,76 @@
|
||||
export interface BusinessFormVO {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 申请编码
|
||||
*/
|
||||
applyCode: string;
|
||||
|
||||
/**
|
||||
* 表单id
|
||||
*/
|
||||
formId: string | number;
|
||||
|
||||
/**
|
||||
* 表单名称
|
||||
*/
|
||||
formName: string;
|
||||
|
||||
}
|
||||
|
||||
export interface BusinessFormForm extends BaseEntity {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id?: string | number;
|
||||
|
||||
/**
|
||||
* 申请编码
|
||||
*/
|
||||
applyCode?: string;
|
||||
|
||||
/**
|
||||
* 表单id
|
||||
*/
|
||||
formId?: string | number;
|
||||
|
||||
/**
|
||||
* 表单名称
|
||||
*/
|
||||
formName?: string;
|
||||
|
||||
/**
|
||||
* 表单内容
|
||||
*/
|
||||
content?: string;
|
||||
|
||||
/**
|
||||
* 表单值
|
||||
*/
|
||||
contentValue?: string;
|
||||
|
||||
}
|
||||
|
||||
export interface BusinessFormQuery extends PageQuery {
|
||||
|
||||
/**
|
||||
* 申请编码
|
||||
*/
|
||||
applyCode?: string;
|
||||
|
||||
/**
|
||||
* 表单名称
|
||||
*/
|
||||
formName?: string;
|
||||
|
||||
/**
|
||||
* 日期范围参数
|
||||
*/
|
||||
params?: any;
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,6 +11,15 @@ export function listForm(query: FormQuery): AxiosPromise<FormVO[]> {
|
||||
});
|
||||
}
|
||||
|
||||
// 查询流程表单列表
|
||||
export function queryList(query: any): AxiosPromise<FormVO[]> {
|
||||
return request({
|
||||
url: '/workflow/form/queryList',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
// 查询流程表单详细
|
||||
export function getForm(formId: string | number): AxiosPromise<FormVO> {
|
||||
return request({
|
||||
|
@ -5,6 +5,37 @@ export interface FormVO extends BaseEntity {
|
||||
content: string;
|
||||
status?: string;
|
||||
remark: string;
|
||||
wfFormDefinitionVo: {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
id: string | number;
|
||||
|
||||
/**
|
||||
* 动态表单id
|
||||
*/
|
||||
formId: string | number;
|
||||
|
||||
/**
|
||||
* 流程定义id
|
||||
*/
|
||||
processDefinitionKey: string;
|
||||
|
||||
/**
|
||||
* 流程定义名称
|
||||
*/
|
||||
processDefinitionName: string;
|
||||
|
||||
/**
|
||||
* 流程定义id
|
||||
*/
|
||||
processDefinitionId: string | number;
|
||||
|
||||
/**
|
||||
* 流程定义版本
|
||||
*/
|
||||
processDefinitionVersion: number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface FormForm {
|
||||
|
@ -14,9 +14,11 @@
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="dialog.visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="handleCompleteTask"> 提交 </el-button>
|
||||
<el-button type="danger" @click="handleBackProcess" v-if="businessStatus === 'waiting'"> 退回 </el-button>
|
||||
<el-button @click="cancel" v-loading="buttonLoading">取消</el-button>
|
||||
<el-button type="primary" v-loading="buttonLoading" @click="handleCompleteTask"> 提交 </el-button>
|
||||
<el-button type="danger" v-loading="buttonLoading" @click="handleBackProcess" v-if="businessStatus === 'waiting'">
|
||||
退回
|
||||
</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
@ -31,6 +33,8 @@ const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
//遮罩层
|
||||
const loading = ref(true);
|
||||
//按钮
|
||||
const buttonLoading = ref(true);
|
||||
//流程状态
|
||||
const businessStatus = ref<string>('');
|
||||
//任务id
|
||||
@ -48,27 +52,30 @@ const form = ref<Record<string, any>>({
|
||||
messageType: ['1']
|
||||
});
|
||||
//打开弹窗
|
||||
const openDialog = (visible?: any,id?: string) => {
|
||||
const openDialog = (id?: string) => {
|
||||
taskId.value = id
|
||||
form.value.message = undefined;
|
||||
dialog.visible = visible;
|
||||
dialog.visible = true;
|
||||
loading.value = true;
|
||||
buttonLoading.value = true;
|
||||
nextTick(() => {
|
||||
getBusinessStatus(taskId.value).then((response) => {
|
||||
businessStatus.value = response.data;
|
||||
loading.value = false;
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
onMounted(() => {});
|
||||
const emits = defineEmits(['submitCallback']);
|
||||
onMounted(() => { });
|
||||
const emits = defineEmits(['submitCallback', 'cancelCallback']);
|
||||
|
||||
/** 办理流程 */
|
||||
const handleCompleteTask = async () => {
|
||||
form.value.taskId = taskId.value;
|
||||
await proxy?.$modal.confirm('是否确认提交?');
|
||||
loading.value = true
|
||||
buttonLoading.value = true
|
||||
await completeTask(form.value).finally(() => (loading.value = false));
|
||||
dialog.visible = false;
|
||||
emits('submitCallback');
|
||||
@ -80,12 +87,18 @@ const handleBackProcess = async () => {
|
||||
form.value.taskId = taskId.value;
|
||||
await proxy?.$modal.confirm('是否确认驳回到申请人?');
|
||||
loading.value = true
|
||||
buttonLoading.value = true
|
||||
await backProcess(form.value).finally(() => (loading.value = false));
|
||||
dialog.visible = false;
|
||||
emits('submitCallback');
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
};
|
||||
|
||||
//取消
|
||||
const cancel = async () => {
|
||||
dialog.visible = false
|
||||
buttonLoading.value = false
|
||||
emits('cancelCallback');
|
||||
}
|
||||
/**
|
||||
* 对外暴露子组件方法
|
||||
*/
|
||||
|
@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div class="p-2">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<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="title">
|
||||
@ -24,7 +25,8 @@
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['demo:leave:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['demo:leave:export']">导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['demo:leave:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -38,36 +40,35 @@
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column align="center" prop="businessStatusName" label="流程状态" min-width="70">
|
||||
<template #default="scope">
|
||||
<el-tag type="success">{{scope.row.processInstanceVo.businessStatusName}}</el-tag>
|
||||
<el-tag type="success">{{ scope.row.processInstanceVo.businessStatusName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-tooltip
|
||||
content="修改"
|
||||
placement="top"
|
||||
v-if="scope.row.processInstanceVo.businessStatus === 'draft'||scope.row.processInstanceVo.businessStatus === 'cancel'||scope.row.processInstanceVo.businessStatus === 'back'"
|
||||
>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['demo:leave:edit']"></el-button>
|
||||
<el-tooltip content="修改" placement="top"
|
||||
v-if="scope.row.processInstanceVo.businessStatus === 'draft' || scope.row.processInstanceVo.businessStatus === 'cancel' || scope.row.processInstanceVo.businessStatus === 'back'">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['demo:leave:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip
|
||||
content="删除"
|
||||
placement="top"
|
||||
v-if="scope.row.processInstanceVo.businessStatus === 'draft'||scope.row.processInstanceVo.businessStatus === 'cancel'||scope.row.processInstanceVo.businessStatus === 'back'"
|
||||
>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['demo:leave:remove']"></el-button>
|
||||
<el-tooltip content="删除" placement="top"
|
||||
v-if="scope.row.processInstanceVo.businessStatus === 'draft' || scope.row.processInstanceVo.businessStatus === 'cancel' || scope.row.processInstanceVo.businessStatus === 'back'">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['demo:leave:remove']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="撤销" placement="top" v-if="scope.row.processInstanceVo.businessStatus === 'waiting'">
|
||||
<el-button link type="primary" icon="Promotion" @click="handleCancelProcessApply(scope.row.processInstanceVo.id)"></el-button>
|
||||
<el-button link type="primary" icon="Promotion"
|
||||
@click="handleCancelProcessApply(scope.row.processInstanceVo.id)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="审批记录" placement="top" v-if="scope.row.processInstanceVo.businessStatus === 'waiting'">
|
||||
<el-button link type="primary" icon="Document" @click="handleApprovalRecord(scope.row.processInstanceVo.id)"></el-button>
|
||||
<el-button link type="primary" icon="Document"
|
||||
@click="handleApprovalRecord(scope.row.processInstanceVo.id)"></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" />
|
||||
<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>
|
||||
@ -117,7 +118,7 @@ const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
//提交组件
|
||||
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
|
||||
//审批记录组件
|
||||
//审批记录组件
|
||||
const approvalRecordRef = ref<InstanceType<typeof ApprovalRecord>>();
|
||||
|
||||
const queryFormRef = ref(ElForm);
|
||||
@ -270,9 +271,9 @@ const handleStartWorkFlow = async (data: any) => {
|
||||
leaveDays: data.leaveDays,
|
||||
userList: [1]
|
||||
};
|
||||
startWorkFlow(submitFormData.value).then((response:any) => {
|
||||
startWorkFlow(submitFormData.value).then((response: any) => {
|
||||
if (submitVerifyRef.value) {
|
||||
submitVerifyRef.value.openDialog(true, response.data.taskId);
|
||||
submitVerifyRef.value.openDialog(response.data.taskId);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
213
src/views/workflow/businessForm/index.vue
Normal file
213
src/views/workflow/businessForm/index.vue
Normal file
@ -0,0 +1,213 @@
|
||||
<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 @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" v-loading="loading">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="queryFromList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
<el-row :gutter="12">
|
||||
<el-col :span="8" style="padding-top: 15px;" v-for="(item, index) in formList" :key="index">
|
||||
<el-card shadow="hover" style="cursor: pointer;" @click="handleAppay(item)">
|
||||
<div style="display: flex;justify-content:flex-start;">
|
||||
<div>
|
||||
<img
|
||||
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHAAAABwBAMAAAA0zul4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURf///zKW+ur0/nO4+6XR/YvE/Eqi+5DG/Nnr/sPg/brnfYAAAAFMSURBVFjD7dfPSsNAEAbwNTGtuXVM09pbqCAeFV8gwYNXtU+wioI3FcFrLorH+OeBncYuSnYl+wUKEueDNmHhR8rO7myqqGOUQIECBQoUaDK5dsQD3ihXNtth6YTqtQ0mbqcGbXD8C4z6BYPFUSP3ftCawOVU+8ANezH5QXuVzDwnJ5g38nfruP/SSOYHh9bkjNdcjrDrAghOHhvJe7ettlab6RaFA9fDkTpOURivbi963OX+H/x4qLrA4IzHzjvA57pzVDCMsU7+nT0eKfiTofCQKF2SAxAGPLBdf4GQz63LXB1rHsVgRDtfD05BGLKofQJDOuXLHQyHdQm5mOhPjQ2coXXUXIiM6zFCYUGj3aTUlKMwpIQPOd9j7ufS0abDotsqMu+wcAd40nRV+sCp1W0ysxbW9GpNlRsWrTB9mzvyLn/KBAoUKFCgyScZMYmWkzKSDQAAAABJRU5ErkJggg=="
|
||||
width="60">
|
||||
</div>
|
||||
<div style="display: inline-block;padding-left: 15px;">
|
||||
<div class="from-font">{{ item.formName }}</div>
|
||||
<div class="from-time">{{ item.updateTime }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-empty description="暂无可用表单" v-if="formList.length === 0" />
|
||||
</el-card>
|
||||
<!-- 流程表单设计器对话框 -->
|
||||
<el-dialog :title="render.title" v-if="render.visible" v-model="render.visible" width="80%" append-to-body>
|
||||
<div v-loading="fromLoading">
|
||||
<v-form-render :form-json="{}" :form-data="{}" ref="vfRenderRef" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button v-loading="buttonLoading" @click="render.visible = false">取消</el-button>
|
||||
<el-button type="success" v-loading="buttonLoading" @click="submitData('draft')">暂存</el-button>
|
||||
<el-button type="primary" v-loading="buttonLoading" @click="submitData('submit')">提交</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<!-- 提交组件 -->
|
||||
<submitVerify ref="submitVerifyRef" @submitCallback="submitCallback" @cancelCallback="cancelCallback" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="BusinessForm" lang="ts">
|
||||
import { queryList, getForm } from "@/api/workflow/form";
|
||||
import { FormVO } from "@/api/workflow/form/types";
|
||||
import { addBusinessForm } from '@/api/workflow/businessForm';
|
||||
import { BusinessFormForm } from '@/api/workflow/businessForm/types';
|
||||
import { startWorkFlow } from '@/api/workflow/task';
|
||||
import SubmitVerify from '@/components/Process/submitVerify.vue';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
//提交组件
|
||||
const submitVerifyRef = ref<InstanceType<typeof SubmitVerify>>();
|
||||
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const formList = ref<FormVO[]>([]);
|
||||
const loading = ref(true);
|
||||
const fromLoading = ref(true);
|
||||
const buttonLoading = ref(false);
|
||||
const processDefinitionKey = ref<string>('');
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const vfRenderRef = ref(null);
|
||||
|
||||
const render = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
})
|
||||
|
||||
const queryParams = ref<Record<string, any>>({
|
||||
formName: ''
|
||||
});
|
||||
|
||||
const initFormData: BusinessFormForm = {
|
||||
id: undefined,
|
||||
applyCode: undefined,
|
||||
formId: undefined,
|
||||
formName: undefined,
|
||||
content: undefined,
|
||||
contentValue: undefined
|
||||
}
|
||||
|
||||
const submitFormData = ref<Record<string, any>>({
|
||||
businessKey: '',
|
||||
processKey: '',
|
||||
variables: {}
|
||||
});
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryFromList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 查询可用表单 */
|
||||
const queryFromList = async () => {
|
||||
loading.value = true
|
||||
const res = await queryList(queryParams.value);
|
||||
formList.value = res.data;
|
||||
loading.value = false
|
||||
}
|
||||
/** 申请单据 */
|
||||
const handleAppay = async (row?: FormVO) => {
|
||||
render.visible = true;
|
||||
fromLoading.value = false
|
||||
render.title = row?.formName;
|
||||
const formId = row?.formId || ids.value[0];
|
||||
initFormData.formId = row?.formId
|
||||
initFormData.formName = row?.formName
|
||||
initFormData.content = row?.content
|
||||
const res = await getForm(formId);
|
||||
if (vfRenderRef.value) {
|
||||
fromLoading.value = false
|
||||
if (res.data.wfFormDefinitionVo && res.data.wfFormDefinitionVo.processDefinitionKey) {
|
||||
processDefinitionKey.value = res.data.wfFormDefinitionVo.processDefinitionKey
|
||||
}
|
||||
vfRenderRef.value.setFormJson(res.data.content);
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitData = (status: string) => {
|
||||
if (vfRenderRef.value) {
|
||||
fromLoading.value = true
|
||||
buttonLoading.value = true;
|
||||
vfRenderRef.value.getFormData().then((formData) => {
|
||||
initFormData.contentValue = JSON.stringify(formData)
|
||||
if ('draft' === status) {
|
||||
addBusinessForm(initFormData).then(res => {
|
||||
proxy?.$modal.msgSuccess("暂存成功");
|
||||
render.visible = false;
|
||||
buttonLoading.value = false;
|
||||
})
|
||||
} else {
|
||||
if (!processDefinitionKey.value) {
|
||||
proxy?.$modal.msgError("未绑定流程!");
|
||||
buttonLoading.value = false;
|
||||
fromLoading.value = false;
|
||||
}
|
||||
addBusinessForm(initFormData).then(res => {
|
||||
handleStartWorkFlow(res.data)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//提交申请
|
||||
const handleStartWorkFlow = async (data: any) => {
|
||||
submitFormData.value.processKey = processDefinitionKey.value;
|
||||
submitFormData.value.businessKey = data.id;
|
||||
submitFormData.value.variables = data.variable;
|
||||
startWorkFlow(submitFormData.value).then((response: any) => {
|
||||
if (submitVerifyRef.value) {
|
||||
submitVerifyRef.value.openDialog(response.data.taskId);
|
||||
}
|
||||
});
|
||||
};
|
||||
//提交回调
|
||||
const submitCallback = async () => {
|
||||
render.visible = false;
|
||||
buttonLoading.value = false;
|
||||
fromLoading.value = false;
|
||||
handleQuery();
|
||||
};
|
||||
//取消回调
|
||||
const cancelCallback = async () => {
|
||||
buttonLoading.value = false;
|
||||
fromLoading.value = false;
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
queryFromList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.from-font {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
vertical-align: top;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.from-time {
|
||||
font-size: 12px;
|
||||
vertical-align: bottom;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
210
src/views/workflow/businessForm/list.vue
Normal file
210
src/views/workflow/businessForm/list.vue
Normal file
@ -0,0 +1,210 @@
|
||||
<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="applyCode">
|
||||
<el-input v-model="queryParams.applyCode" placeholder="请输入申请编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="表单名称" prop="formName">
|
||||
<el-input v-model="queryParams.formName" placeholder="请输入表单名称" clearable @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="success" plain icon="Edit" :disabled="single" @click="handleUpdate()"
|
||||
v-hasPermi="['workflow:businessForm:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()"
|
||||
v-hasPermi="['workflow:businessForm:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['workflow:businessForm:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" :data="businessFormList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" v-if="true" />
|
||||
<el-table-column label="申请编码" align="center" prop="applyCode" />
|
||||
<el-table-column label="表单id" align="center" prop="formId" />
|
||||
<el-table-column label="表单名称" align="center" prop="formName" />
|
||||
<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:businessForm:edit']"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip content="删除" placement="top">
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['workflow:businessForm: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="render.title" v-if="render.visible" v-model="render.visible" width="80%" append-to-body>
|
||||
<div v-loading="fromLoading">
|
||||
<v-form-render :form-json="{}" :form-data="{}" ref="vfRenderRef" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button v-loading="buttonLoading" @click="render.visible = false">取消</el-button>
|
||||
<el-button type="success" v-loading="buttonLoading" @click="submitData('draft')">暂存</el-button>
|
||||
<el-button type="primary" v-loading="buttonLoading" @click="submitData('submit')">提交</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="BusinessForm" lang="ts">
|
||||
import { listBusinessForm, getBusinessForm, delBusinessForm, addBusinessForm, updateBusinessForm } from '@/api/workflow/businessForm';
|
||||
import { BusinessFormVO, BusinessFormQuery, BusinessFormForm } from '@/api/workflow/businessForm/types';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const businessFormList = ref<BusinessFormVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const fromLoading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const applyCodes = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const vfRenderRef = ref(null);
|
||||
|
||||
const render = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: BusinessFormForm = {
|
||||
id: undefined,
|
||||
applyCode: undefined,
|
||||
formId: undefined,
|
||||
formName: undefined,
|
||||
content: undefined,
|
||||
contentValue: undefined
|
||||
}
|
||||
const data = reactive<PageData<BusinessFormForm, BusinessFormQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
applyCode: undefined,
|
||||
formName: undefined,
|
||||
params: {
|
||||
}
|
||||
},
|
||||
rules: {}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询发起流程列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listBusinessForm(queryParams.value);
|
||||
businessFormList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: BusinessFormVO[]) => {
|
||||
ids.value = selection.map(item => item.id);
|
||||
applyCodes.value = selection.map(item => item.applyCode);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: BusinessFormVO) => {
|
||||
const _id = row?.id || ids.value[0]
|
||||
fromLoading.value = true
|
||||
render.visible = true;
|
||||
const res = await getBusinessForm(_id);
|
||||
Object.assign(form.value, res.data);
|
||||
render.title = "修改单据";
|
||||
if (vfRenderRef.value) {
|
||||
fromLoading.value = false
|
||||
vfRenderRef.value.setFormJson(res.data.content);
|
||||
vfRenderRef.value.setFormData(JSON.parse(res.data.contentValue))
|
||||
}
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitData = (status: string) => {
|
||||
if (vfRenderRef.value) {
|
||||
buttonLoading.value = true;
|
||||
vfRenderRef.value.getFormData().then((formData) => {
|
||||
initFormData.contentValue = JSON.stringify(formData)
|
||||
if ('draft' === status) {
|
||||
addBusinessForm(initFormData).then(res => {
|
||||
proxy?.$modal.msgSuccess("暂存成功");
|
||||
render.visible = false;
|
||||
buttonLoading.value = false;
|
||||
})
|
||||
} else {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: BusinessFormVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
const _applyCode = row?.applyCode || applyCodes.value;
|
||||
await proxy?.$modal.confirm('是否确认删除流程编号为【' + _applyCode + '】的数据项?').finally(() => loading.value = false);
|
||||
await delBusinessForm(_ids);
|
||||
proxy?.$modal.msgSuccess("删除成功");
|
||||
await getList();
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download('workflow/businessForm/export', {
|
||||
...queryParams.value
|
||||
}, `businessForm_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
@ -200,7 +200,7 @@ const getFinishList = () => {
|
||||
//提交
|
||||
const submitVerifyOpen = async (id: string) => {
|
||||
if (submitVerifyRef.value) {
|
||||
submitVerifyRef.value.openDialog(true, id);
|
||||
submitVerifyRef.value.openDialog(id);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -239,7 +239,7 @@ const handleCancelProcessApply = async (row: any) => {
|
||||
//提交
|
||||
const submitVerifyOpen = async (id: string) => {
|
||||
if (submitVerifyRef.value) {
|
||||
submitVerifyRef.value.openDialog(true, id);
|
||||
submitVerifyRef.value.openDialog(id);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user