yxk-20260417-流程表前端

This commit is contained in:
ye1023
2026-04-17 14:28:53 +08:00
parent 19620500be
commit dec2426232
6 changed files with 1181 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";
const { createConfirm } = useMessage();
enum Api {
list = '/tasktask/taskTask/list',
save='/tasktask/taskTask/add',
edit='/tasktask/taskTask/edit',
deleteOne = '/tasktask/taskTask/delete',
deleteBatch = '/tasktask/taskTask/deleteBatch',
importExcel = '/tasktask/taskTask/importExcel',
exportXls = '/tasktask/taskTask/exportXls',
}
/**
* 导出api
* @param params
*/
export const getExportUrl = Api.exportXls;
/**
* 导入api
*/
export const getImportUrl = Api.importExcel;
/**
* 列表接口
* @param params
*/
export const list = (params) => defHttp.get({ url: Api.list, params });
/**
* 删除单个
* @param params
* @param handleSuccess
*/
export const deleteOne = (params,handleSuccess) => {
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
/**
* 批量删除
* @param params
* @param handleSuccess
*/
export const batchDelete = (params, handleSuccess) => {
createConfirm({
iconType: 'warning',
title: '确认删除',
content: '是否删除选中数据',
okText: '确认',
cancelText: '取消',
onOk: () => {
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
handleSuccess();
});
}
});
}
/**
* 保存或者更新
* @param params
* @param isUpdate
*/
export const saveOrUpdate = (params, isUpdate) => {
let url = isUpdate ? Api.edit : Api.save;
return defHttp.post({ url: url, params }, { isTransformResponse: false });
}
+257
View File
@@ -0,0 +1,257 @@
import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
{
title: '流程编码',
align: "center",
dataIndex: 'flowCode'
},
{
title: '流程名称',
align: "center",
dataIndex: 'flowName'
},
{
title: '流程实例ID',
align: "center",
dataIndex: 'processInstId'
},
{
title: '流程类型',
align: "center",
dataIndex: 'processType'
},
{
title: '流程状态',
align: "center",
dataIndex: 'bpmStatus'
},
{
title: '关联台账事项ID',
align: "center",
dataIndex: 'businessId'
},
{
title: '关联台账根节点id',
align: "center",
dataIndex: 'parentBusinessId'
},
{
title: '关联台账表名',
align: "center",
dataIndex: 'businessTablename'
},
{
title: '外部来源 ID',
align: "center",
dataIndex: 'sourceId'
},
{
title: '任务标题',
align: "center",
dataIndex: 'title'
},
{
title: '任务内容',
align: "center",
dataIndex: 'content'
},
{
title: '紧急程度(一般/紧急/特急)',
align: "center",
dataIndex: 'urgencyLevel_dictText'
},
{
title: '自定义分组',
align: "center",
dataIndex: 'customGroup'
},
{
title: '所属任务清单 ID',
align: "center",
dataIndex: 'taskListId'
},
{
title: '所属任务清单名称',
align: "center",
dataIndex: 'taskListName'
},
{
title: '是否为里程碑节点',
align: "center",
dataIndex: 'milestone'
},
{
title: '任务完成方式',
align: "center",
dataIndex: 'finishMethod'
},
{
title: '被督办部门id',
align: "center",
dataIndex: 'deptId'
},
{
title: '被督办部门名称(冗余)',
align: "center",
dataIndex: 'deptName'
},
{
title: '部门负责人id',
align: "center",
dataIndex: 'deptLeaderId_dictText'
},
{
title: '部门负责人姓名(冗余)',
align: "center",
dataIndex: 'deptLeaderName'
},
{
title: '部门经办人id(负责人指派后填入)',
align: "center",
dataIndex: 'deptHandlerId_dictText'
},
{
title: '部门经办人姓名(冗余)',
align: "center",
dataIndex: 'deptHandlerName'
},
{
title: '关注人 ID 列表',
align: "center",
dataIndex: 'followerIds'
},
{
title: '关注人姓名列表,冗余',
align: "center",
dataIndex: 'followerNames'
},
{
title: '要求完成日期(业务层面的硬性要求)',
align: "center",
dataIndex: 'requireFinishDate',
customRender:({text}) =>{
text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
return text;
},
},
{
title: '督办开始时间',
align: "center",
dataIndex: 'startTime'
},
{
title: '截止时间(精确到时分,与 require_finish_date 互补)',
align: "center",
sorter: true,
dataIndex: 'deadline'
},
{
title: '实际完成时间',
align: "center",
dataIndex: 'actualFinishTime'
},
{
title: '是否已逾期',
align: "center",
dataIndex: 'isOverdue'
},
{
title: '逾期时长',
align: "center",
dataIndex: 'overdueDuration'
},
{
title: '持续时长',
align: "center",
dataIndex: 'duration'
},
{
title: '子任务完成进度(0.00~100.00,参考飞书子任务进度)',
align: "center",
dataIndex: 'subTaskProgress'
},
{
title: '父任务 ID',
align: "center",
dataIndex: 'parentTaskId'
},
{
title: '前置任务 ID 列表,逗号分隔',
align: "center",
dataIndex: 'preTaskIds'
},
{
title: '后置任务 ID 列表,逗号分隔',
align: "center",
dataIndex: 'nextTaskIds'
},
{
title: '子任务数',
align: "center",
dataIndex: 'subTaskCount'
},
{
title: '流程序列号',
align: "center",
dataIndex: 'processCodenumber'
},
{
title: '表单组件路径',
align: "center",
dataIndex: 'formUrl'
},
{
title: '流程变量',
align: "center",
dataIndex: 'jsonDataString'
},
];
// 高级查询数据
export const superQuerySchema = {
flowCode: {title: '流程编码',order: 0,view: 'text', type: 'string',},
flowName: {title: '流程名称',order: 1,view: 'text', type: 'string',},
processInstId: {title: '流程实例ID',order: 2,view: 'text', type: 'string',},
processType: {title: '流程类型',order: 3,view: 'text', type: 'string',},
bpmStatus: {title: '流程状态',order: 4,view: 'text', type: 'string',},
businessId: {title: '关联台账事项ID',order: 5,view: 'text', type: 'string',},
parentBusinessId: {title: '关联台账根节点id',order: 6,view: 'text', type: 'string',},
businessTablename: {title: '关联台账表名',order: 7,view: 'text', type: 'string',},
sourceId: {title: '外部来源 ID',order: 8,view: 'text', type: 'string',},
title: {title: '任务标题',order: 9,view: 'text', type: 'string',},
content: {title: '任务内容',order: 10,view: 'text', type: 'string',},
urgencyLevel: {title: '紧急程度(一般/紧急/特急)',order: 11,view: 'list', type: 'string',dictCode: 'urgency_level',},
customGroup: {title: '自定义分组',order: 12,view: 'text', type: 'string',},
taskListId: {title: '所属任务清单 ID',order: 13,view: 'text', type: 'string',},
taskListName: {title: '所属任务清单名称',order: 14,view: 'text', type: 'string',},
milestone: {title: '是否为里程碑节点',order: 15,view: 'text', type: 'string',},
finishMethod: {title: '任务完成方式',order: 16,view: 'text', type: 'string',},
deptId: {title: '被督办部门id',order: 17,view: 'text', type: 'string',},
deptName: {title: '被督办部门名称(冗余)',order: 18,view: 'text', type: 'string',},
deptLeaderId: {title: '部门负责人id',order: 19,view: 'sel_user', type: 'string',},
deptLeaderName: {title: '部门负责人姓名(冗余)',order: 20,view: 'text', type: 'string',},
deptHandlerId: {title: '部门经办人id(负责人指派后填入)',order: 21,view: 'sel_depart', type: 'string',},
deptHandlerName: {title: '部门经办人姓名(冗余)',order: 22,view: 'text', type: 'string',},
followerIds: {title: '关注人 ID 列表',order: 23,view: 'text', type: 'string',},
followerNames: {title: '关注人姓名列表,冗余',order: 24,view: 'text', type: 'string',},
requireFinishDate: {title: '要求完成日期(业务层面的硬性要求)',order: 25,view: 'date', type: 'string',},
startTime: {title: '督办开始时间',order: 26,view: 'datetime', type: 'string',},
deadline: {title: '截止时间(精确到时分,与 require_finish_date 互补)',order: 27,view: 'datetime', type: 'string',},
actualFinishTime: {title: '实际完成时间',order: 28,view: 'datetime', type: 'string',},
isOverdue: {title: '是否已逾期',order: 29,view: 'text', type: 'string',},
overdueDuration: {title: '逾期时长',order: 30,view: 'number', type: 'number',},
duration: {title: '持续时长',order: 31,view: 'number', type: 'number',},
subTaskProgress: {title: '子任务完成进度(0.00~100.00,参考飞书子任务进度)',order: 32,view: 'number', type: 'number',},
parentTaskId: {title: '父任务 ID',order: 33,view: 'text', type: 'string',},
preTaskIds: {title: '前置任务 ID 列表,逗号分隔',order: 34,view: 'text', type: 'string',},
nextTaskIds: {title: '后置任务 ID 列表,逗号分隔',order: 35,view: 'text', type: 'string',},
subTaskCount: {title: '子任务数',order: 36,view: 'number', type: 'number',},
processCodenumber: {title: '流程序列号',order: 37,view: 'text', type: 'string',},
formUrl: {title: '表单组件路径',order: 38,view: 'text', type: 'string',},
jsonData: {title: '流程变量',order: 39,view: 'text', type: 'string',},
};
+341
View File
@@ -0,0 +1,341 @@
<template>
<div class="p-2">
<!--查询区域-->
<div class="jeecg-basic-table-form-container">
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-row :gutter="24">
<a-col :lg="6">
<a-form-item name="title">
<template #label><span title="任务标题">任务标题</span></template>
<JInput v-model:value="queryParam.title"/>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="content">
<template #label><span title="任务内容">任务内容</span></template>
<JInput v-model:value="queryParam.content"/>
</a-form-item>
</a-col>
<template v-if="toggleSearchStatus">
<a-col :lg="6">
<a-form-item name="urgencyLevel">
<template #label><span title="紧急程度(一般/紧急/特急)">紧急程度</span></template>
<j-select-multiple placeholder="请选择紧急程度(一般/紧急/特急)" v-model:value="queryParam.urgencyLevel" dictCode="urgency_level" allow-clear />
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="deptLeaderName">
<template #label><span title="部门负责人姓名(冗余)">部门负责</span></template>
<JInput v-model:value="queryParam.deptLeaderName"/>
</a-form-item>
</a-col>
<a-col :lg="6">
<a-form-item name="deptHandlerName">
<template #label><span title="部门经办人姓名(冗余)">部门经办</span></template>
<JInput v-model:value="queryParam.deptHandlerName"/>
</a-form-item>
</a-col>
</template>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
<a-col :lg="6">
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
<a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
{{ toggleSearchStatus ? '收起' : '展开' }}
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
</a>
</a-col>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!--引用表格-->
<BasicTable @register="registerTable" :rowSelection="rowSelection">
<!--插槽:table标题-->
<template #tableTitle>
<a-button type="primary" v-auth="'tasktask:task_task:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
<a-button type="primary" v-auth="'tasktask:task_task:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
<j-upload-button type="primary" v-auth="'tasktask:task_task:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="batchHandleDelete">
<Icon icon="ant-design:delete-outlined"></Icon>
删除
</a-menu-item>
</a-menu>
</template>
<a-button v-auth="'tasktask:task_task:deleteBatch'">批量操作
<Icon icon="mdi:chevron-down"></Icon>
</a-button>
</a-dropdown>
<!-- 高级查询 -->
<super-query :config="superQueryConfig" @search="handleSuperQuery" />
</template>
<!--操作栏-->
<template #action="{ record }">
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
</template>
<template v-slot:bodyCell="{ column, record, index, text }">
</template>
</BasicTable>
<!-- 表单区域 -->
<TaskTaskModal ref="registerModal" @success="handleSuccess"></TaskTaskModal>
<!-- 审批记录 -->
<BpmPictureModal @register="registerBpmModal" />
</div>
</template>
<script lang="ts" name="tasktask-taskTask" setup>
import { ref, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { useListPage } from '/@/hooks/system/useListPage';
import { columns, superQuerySchema } from './TaskTask.data';
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './TaskTask.api';
import { downloadFile } from '/@/utils/common/renderUtils';
import TaskTaskModal from './components/TaskTaskModal.vue'
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
import {useModal} from '/@/components/Modal';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
import { startProcess } from '/@/api/common/api';
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
const formRef = ref();
const queryParam = reactive<any>({});
const toggleSearchStatus = ref<boolean>(false);
const registerModal = ref();
const userStore = useUserStore();
const { createMessage } = useMessage();
//注册table数据
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
tableProps: {
title: '事项任务计划表(发起流程)',
api: list,
columns,
canResize:false,
useSearchForm: false,
actionColumn: {
width: 120,
fixed: 'right',
},
beforeFetch: async (params) => {
return Object.assign(params, queryParam);
},
},
exportConfig: {
name: "事项任务计划表(发起流程)",
url: getExportUrl,
params: queryParam,
},
importConfig: {
url: getImportUrl,
success: handleSuccess
},
});
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
const labelCol = reactive({
xs:24,
sm:4,
xl:6,
xxl:4
});
const wrapperCol = reactive({
xs: 24,
sm: 20,
});
// 高级查询配置
const superQueryConfig = reactive(superQuerySchema);
/**
* 高级查询事件
*/
function handleSuperQuery(params) {
Object.keys(params).map((k) => {
queryParam[k] = params[k];
});
searchQuery();
}
/**
* 新增事件
*/
function handleAdd() {
registerModal.value.disableSubmit = false;
registerModal.value.add();
}
/**
* 编辑事件
*/
function handleEdit(record: Recordable) {
registerModal.value.disableSubmit = false;
registerModal.value.edit(record);
}
/**
* 详情
*/
function handleDetail(record: Recordable) {
registerModal.value.disableSubmit = true;
registerModal.value.edit(record);
}
/**
* 删除事件
*/
async function handleDelete(record) {
await deleteOne({ id: record.id }, handleSuccess);
}
/**
* 批量删除事件
*/
async function batchHandleDelete() {
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
}
/**
* 成功回调
*/
function handleSuccess() {
(selectedRowKeys.value = []) && reload();
}
/**
* 操作栏
*/
function getTableAction(record) {
return [
{
label: '编辑',
onClick: handleEdit.bind(null, record),
auth: 'tasktask:task_task:edit'
},
];
}
/**
* 下拉操作栏
*/
function getDropDownAction(record) {
let dropDownAction = [
{
label: '详情',
onClick: handleDetail.bind(null, record),
}, {
label: '删除',
popConfirm: {
title: '是否确认删除',
confirm: handleDelete.bind(null, record),
placement: 'topLeft',
},
auth: 'tasktask:task_task:delete'
},
{
label: '审批进度',
onClick: handlePreviewPic.bind(null, record),
ifShow: !!record.bpmStatus && record.bpmStatus !== '1',
}
];
if(record.bpmStatus == '1'){
dropDownAction.push({
label: '发起流程',
popConfirm: {
title: '确认提交流程吗?',
confirm: handleProcess.bind(null, record),
placement: 'topLeft',
}
})
}
return dropDownAction;
}
/**
* 查询
*/
function searchQuery() {
reload();
}
/**
* 重置
*/
function searchReset() {
formRef.value.resetFields();
selectedRowKeys.value = [];
//刷新数据
reload();
}
/**
* form点击事件(以逗号分割)
* @param key
* @param value
*/
function handleFormJoinChange(key, value) {
if (typeof value != 'string') {
queryParam[key] = value.join(',');
}
}
/**
* 提交流程
*/
async function handleProcess(record) {
let params = {
flowCode: 'dev_task_task_001',
id: record.id,
formUrl: 'tasktask/components/TaskTaskForm',
formUrlMobile: ''
}
await startProcess(params);
handleSuccess();
}
/**
* 审批进度
*/
async function handlePreviewPic(record) {
bpmPicModal(true, {
flowCode: 'dev_task_task_001',
dataId: record.id,
});
}
</script>
<style lang="less" scoped>
.jeecg-basic-table-form-container {
padding: 0;
.table-page-search-submitButtons {
display: block;
margin-bottom: 24px;
white-space: nowrap;
}
.query-group-cust{
min-width: 100px !important;
}
.query-group-split-cust{
width: 30px;
display: inline-block;
text-align: center
}
.ant-form-item:not(.ant-form-item-with-help){
margin-bottom: 16px;
height: 32px;
}
:deep(.ant-picker),:deep(.ant-input-number){
width: 100%;
}
}
</style>
@@ -0,0 +1,26 @@
-- 注意:该页面对应的前台目录为views/tasktask文件夹下
-- 如果你想更改到其他目录,请修改sql中component字段对应的值
INSERT INTO sys_permission(id, parent_id, name, url, component, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_route, is_leaf, keep_alive, hidden, hide_tab, description, status, del_flag, rule_flag, create_by, create_time, update_by, update_time, internal_or_external)
VALUES ('2026041701599730510', NULL, '事项任务计划表(发起流程)', '/taskProcess/taskTaskList', 'taskProcess/TaskTaskList', NULL, NULL, 0, NULL, '1', 0.00, 0, NULL, 1, 0, 0, 0, 0, NULL, '1', 0, 0, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0);
-- 权限控制sql
-- 新增
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2026041701599730511', '2026041701599730510', '添加事项任务计划表(发起流程)', NULL, NULL, 0, NULL, NULL, 2, 'tasktask:task_task:add', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0, 0, '1', 0);
-- 编辑
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2026041701599730512', '2026041701599730510', '编辑事项任务计划表(发起流程)', NULL, NULL, 0, NULL, NULL, 2, 'tasktask:task_task:edit', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0, 0, '1', 0);
-- 删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2026041701599730513', '2026041701599730510', '删除事项任务计划表(发起流程)', NULL, NULL, 0, NULL, NULL, 2, 'tasktask:task_task:delete', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0, 0, '1', 0);
-- 批量删除
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2026041701599730514', '2026041701599730510', '批量删除事项任务计划表(发起流程)', NULL, NULL, 0, NULL, NULL, 2, 'tasktask:task_task:deleteBatch', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0, 0, '1', 0);
-- 导出excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2026041701599730515', '2026041701599730510', '导出excel_事项任务计划表(发起流程)', NULL, NULL, 0, NULL, NULL, 2, 'tasktask:task_task:exportXls', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0, 0, '1', 0);
-- 导入excel
INSERT INTO sys_permission(id, parent_id, name, url, component, is_route, component_name, redirect, menu_type, perms, perms_type, sort_no, always_show, icon, is_leaf, keep_alive, hidden, hide_tab, description, create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external)
VALUES ('2026041701599730516', '2026041701599730510', '导入excel_事项任务计划表(发起流程)', NULL, NULL, 0, NULL, NULL, 2, 'tasktask:task_task:importExcel', '1', NULL, 0, NULL, 1, 0, 0, 0, NULL, 'admin', '2026-04-17 13:59:51', NULL, NULL, 0, 0, '1', 0);
@@ -0,0 +1,404 @@
<template>
<a-spin :spinning="confirmLoading">
<JFormContainer :disabled="disabled">
<template #detail>
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="TaskTaskForm">
<a-row>
<a-col :span="24">
<a-form-item label="流程编码" v-bind="validateInfos.flowCode" id="TaskTaskForm-flowCode" name="flowCode">
<a-input v-model:value="formData.flowCode" placeholder="请输入流程编码" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="流程名称" v-bind="validateInfos.flowName" id="TaskTaskForm-flowName" name="flowName">
<a-input v-model:value="formData.flowName" placeholder="请输入流程名称" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="流程实例ID" v-bind="validateInfos.processInstId" id="TaskTaskForm-processInstId" name="processInstId">
<a-input v-model:value="formData.processInstId" placeholder="请输入流程实例ID" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="流程类型" v-bind="validateInfos.processType" id="TaskTaskForm-processType" name="processType">
<a-input v-model:value="formData.processType" placeholder="请输入流程类型" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="关联台账事项ID" v-bind="validateInfos.businessId" id="TaskTaskForm-businessId" name="businessId">
<a-input v-model:value="formData.businessId" placeholder="请输入关联台账事项ID" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="关联台账根节点id" v-bind="validateInfos.parentBusinessId" id="TaskTaskForm-parentBusinessId" name="parentBusinessId">
<a-input v-model:value="formData.parentBusinessId" placeholder="请输入关联台账根节点id" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="关联台账表名" v-bind="validateInfos.businessTablename" id="TaskTaskForm-businessTablename" name="businessTablename">
<a-input v-model:value="formData.businessTablename" placeholder="请输入关联台账表名" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="外部来源 ID" v-bind="validateInfos.sourceId" id="TaskTaskForm-sourceId" name="sourceId">
<a-input v-model:value="formData.sourceId" placeholder="请输入外部来源 ID" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="任务标题" v-bind="validateInfos.title" id="TaskTaskForm-title" name="title">
<a-input v-model:value="formData.title" placeholder="请输入任务标题" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="任务内容" v-bind="validateInfos.content" id="TaskTaskForm-content" name="content">
<a-input v-model:value="formData.content" placeholder="请输入任务内容" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="紧急程度(一般/紧急/特急)" v-bind="validateInfos.urgencyLevel" id="TaskTaskForm-urgencyLevel" name="urgencyLevel">
<j-dict-select-tag v-model:value="formData.urgencyLevel" dictCode="urgency_level" placeholder="请选择紧急程度(一般/紧急/特急)" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="自定义分组" v-bind="validateInfos.customGroup" id="TaskTaskForm-customGroup" name="customGroup">
<a-input v-model:value="formData.customGroup" placeholder="请输入自定义分组" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="所属任务清单 ID" v-bind="validateInfos.taskListId" id="TaskTaskForm-taskListId" name="taskListId">
<a-input v-model:value="formData.taskListId" placeholder="请输入所属任务清单 ID" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="所属任务清单名称" v-bind="validateInfos.taskListName" id="TaskTaskForm-taskListName" name="taskListName">
<a-input v-model:value="formData.taskListName" placeholder="请输入所属任务清单名称" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否为里程碑节点" v-bind="validateInfos.milestone" id="TaskTaskForm-milestone" name="milestone">
<a-input v-model:value="formData.milestone" placeholder="请输入是否为里程碑节点" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="任务完成方式" v-bind="validateInfos.finishMethod" id="TaskTaskForm-finishMethod" name="finishMethod">
<a-input v-model:value="formData.finishMethod" placeholder="请输入任务完成方式" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="被督办部门id" v-bind="validateInfos.deptId" id="TaskTaskForm-deptId" name="deptId">
<a-input v-model:value="formData.deptId" placeholder="请输入被督办部门id" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="被督办部门名称(冗余)" v-bind="validateInfos.deptName" id="TaskTaskForm-deptName" name="deptName">
<a-input v-model:value="formData.deptName" placeholder="请输入被督办部门名称(冗余)" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="部门负责人id" v-bind="validateInfos.deptLeaderId" id="TaskTaskForm-deptLeaderId" name="deptLeaderId">
<j-select-user v-model:value="formData.deptLeaderId" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="部门负责人姓名(冗余)" v-bind="validateInfos.deptLeaderName" id="TaskTaskForm-deptLeaderName" name="deptLeaderName">
<a-input v-model:value="formData.deptLeaderName" placeholder="请输入部门负责人姓名(冗余)" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="部门经办人id(负责人指派后填入)" v-bind="validateInfos.deptHandlerId" id="TaskTaskForm-deptHandlerId" name="deptHandlerId">
<j-select-dept v-model:value="formData.deptHandlerId" :multiple="true" checkStrictly allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="部门经办人姓名(冗余)" v-bind="validateInfos.deptHandlerName" id="TaskTaskForm-deptHandlerName" name="deptHandlerName">
<a-input v-model:value="formData.deptHandlerName" placeholder="请输入部门经办人姓名(冗余)" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="关注人 ID 列表" v-bind="validateInfos.followerIds" id="TaskTaskForm-followerIds" name="followerIds">
<a-input v-model:value="formData.followerIds" placeholder="请输入关注人 ID 列表" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="关注人姓名列表,冗余" v-bind="validateInfos.followerNames" id="TaskTaskForm-followerNames" name="followerNames">
<a-input v-model:value="formData.followerNames" placeholder="请输入关注人姓名列表,冗余" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="要求完成日期(业务层面的硬性要求)" v-bind="validateInfos.requireFinishDate" id="TaskTaskForm-requireFinishDate" name="requireFinishDate">
<a-date-picker placeholder="请选择要求完成日期(业务层面的硬性要求)" v-model:value="formData.requireFinishDate" value-format="YYYY-MM-DD" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="督办开始时间" v-bind="validateInfos.startTime" id="TaskTaskForm-startTime" name="startTime">
<a-date-picker placeholder="请选择督办开始时间" v-model:value="formData.startTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="截止时间(精确到时分,与 require_finish_date 互补)" v-bind="validateInfos.deadline" id="TaskTaskForm-deadline" name="deadline">
<a-date-picker placeholder="请选择截止时间(精确到时分,与 require_finish_date 互补)" v-model:value="formData.deadline" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="实际完成时间" v-bind="validateInfos.actualFinishTime" id="TaskTaskForm-actualFinishTime" name="actualFinishTime">
<a-date-picker placeholder="请选择实际完成时间" v-model:value="formData.actualFinishTime" showTime value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" allow-clear />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否已逾期" v-bind="validateInfos.isOverdue" id="TaskTaskForm-isOverdue" name="isOverdue">
<a-input v-model:value="formData.isOverdue" placeholder="请输入是否已逾期" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="逾期时长" v-bind="validateInfos.overdueDuration" id="TaskTaskForm-overdueDuration" name="overdueDuration">
<a-input-number v-model:value="formData.overdueDuration" placeholder="请输入逾期时长" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="持续时长" v-bind="validateInfos.duration" id="TaskTaskForm-duration" name="duration">
<a-input-number v-model:value="formData.duration" placeholder="请输入持续时长" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="子任务完成进度(0.00~100.00,参考飞书子任务进度)" v-bind="validateInfos.subTaskProgress" id="TaskTaskForm-subTaskProgress" name="subTaskProgress">
<a-input-number v-model:value="formData.subTaskProgress" placeholder="请输入子任务完成进度(0.00~100.00,参考飞书子任务进度)" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="父任务 ID" v-bind="validateInfos.parentTaskId" id="TaskTaskForm-parentTaskId" name="parentTaskId">
<a-input v-model:value="formData.parentTaskId" placeholder="请输入父任务 ID" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="前置任务 ID 列表,逗号分隔" v-bind="validateInfos.preTaskIds" id="TaskTaskForm-preTaskIds" name="preTaskIds">
<a-input v-model:value="formData.preTaskIds" placeholder="请输入前置任务 ID 列表,逗号分隔" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="后置任务 ID 列表,逗号分隔" v-bind="validateInfos.nextTaskIds" id="TaskTaskForm-nextTaskIds" name="nextTaskIds">
<a-input v-model:value="formData.nextTaskIds" placeholder="请输入后置任务 ID 列表,逗号分隔" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="子任务数" v-bind="validateInfos.subTaskCount" id="TaskTaskForm-subTaskCount" name="subTaskCount">
<a-input-number v-model:value="formData.subTaskCount" placeholder="请输入子任务数" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="流程序列号" v-bind="validateInfos.processCodenumber" id="TaskTaskForm-processCodenumber" name="processCodenumber">
<a-input v-model:value="formData.processCodenumber" placeholder="请输入流程序列号" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="表单组件路径" v-bind="validateInfos.formUrl" id="TaskTaskForm-formUrl" name="formUrl">
<a-input v-model:value="formData.formUrl" placeholder="请输入表单组件路径" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="流程变量" v-bind="validateInfos.jsonDataString" id="TaskTaskForm-jsonDataString" name="jsonDataString">
<a-input v-model:value="formData.jsonDataString" placeholder="请输入流程变量" allow-clear ></a-input>
</a-form-item>
</a-col>
<a-col v-if="showFlowSubmitButton" :span="24" style="width: 100%;text-align: center;">
<a-button preIcon="ant-design:check-outlined" style="width: 126px" type="primary" @click="submitForm"> </a-button>
</a-col>
</a-row>
</a-form>
</template>
</JFormContainer>
</a-spin>
</template>
<script lang="ts" setup>
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
import JSelectDept from '/@/components/Form/src/jeecg/components/JSelectDept.vue';
import JSelectUser from '/@/components/Form/src/jeecg/components/JSelectUser.vue';
import { getValueType } from '/@/utils';
import { saveOrUpdate } from '../TaskTask.api';
import { Form } from 'ant-design-vue';
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
import { usePermission } from '/@/hooks/web/usePermission';
const { isDisabledAuth, hasPermission, initBpmFormData } = usePermission();
const props = defineProps({
formDisabled: { type: Boolean, default: false },
formData: { type: Object, default: () => ({})},
formBpm: { type: Boolean, default: true }
});
const formRef = ref();
const useForm = Form.useForm;
const emit = defineEmits(['register', 'ok']);
const formData = reactive<Record<string, any>>({
id: '',
flowCode: '',
flowName: '',
processInstId: '',
processType: '',
businessId: '',
parentBusinessId: '',
businessTablename: '',
sourceId: '',
title: '',
content: '',
urgencyLevel: '',
customGroup: '',
taskListId: '',
taskListName: '',
milestone: '',
finishMethod: '',
deptId: '',
deptName: '',
deptLeaderId: '',
deptLeaderName: '',
deptHandlerId: '',
deptHandlerName: '',
followerIds: '',
followerNames: '',
requireFinishDate: '',
startTime: '',
deadline: '',
actualFinishTime: '',
isOverdue: '',
overdueDuration: undefined,
duration: undefined,
subTaskProgress: undefined,
parentTaskId: '',
preTaskIds: '',
nextTaskIds: '',
subTaskCount: undefined,
processCodenumber: '',
formUrl: '',
jsonDataString: '',
});
const { createMessage } = useMessage();
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
const confirmLoading = ref<boolean>(false);
//表单验证
const validatorRules = reactive({
});
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
// 表单禁用
const disabled = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return false;
}else{
return true;
}
}
return props.formDisabled;
});
onMounted(()=>{
initBpmFormData(props.formData);
initFormData();
});
//渲染流程表单数据
const queryByIdUrl = '/tasktask/taskTask/queryById';
async function initFormData(){
if(props.formBpm === true){
let params = {id: props.formData.dataId};
const data = await defHttp.get({url: queryByIdUrl, params});
//设置表单的值
edit({...data});
}
}
// 是否显示提交按钮
const showFlowSubmitButton = computed(()=>{
if(props.formBpm === true){
if(props.formData.disabled === false){
return true
}
}
return false
});
/**
* 新增
*/
function add() {
edit({});
}
/**
* 编辑
*/
function edit(record) {
nextTick(() => {
resetFields();
const tmpData = {};
Object.keys(formData).forEach((key) => {
if(record.hasOwnProperty(key)){
tmpData[key] = record[key]
}
})
//赋值
Object.assign(formData, tmpData);
});
}
/**
* 提交数据
*/
async function submitForm() {
try {
// 触发表单验证
await validate();
} catch ({ errorFields }) {
if (errorFields) {
const firstField = errorFields[0];
if (firstField) {
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
}
}
return Promise.reject(errorFields);
}
confirmLoading.value = true;
const isUpdate = ref<boolean>(false);
//时间格式化
let model = formData;
if (model.id) {
isUpdate.value = true;
}
//循环数据
for (let data in model) {
//如果该数据是数组并且是字符串类型
if (model[data] instanceof Array) {
let valueType = getValueType(formRef.value.getProps, data);
//如果是字符串类型的需要变成以逗号分割的字符串
if (valueType === 'string') {
model[data] = model[data].join(',');
}
}
}
await saveOrUpdate(model, isUpdate.value)
.then((res) => {
if (res.success) {
createMessage.success(res.message);
emit('ok');
} else {
createMessage.warning(res.message);
}
})
.finally(() => {
confirmLoading.value = false;
});
}
defineExpose({
add,
edit,
submitForm,
});
</script>
<style lang="less" scoped>
.antd-modal-form {
padding: 14px;
}
</style>
@@ -0,0 +1,81 @@
<template>
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
<TaskTaskForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></TaskTaskForm>
<template #footer>
<a-button @click="handleCancel">取消</a-button>
<a-button :class="{ 'jee-hidden': disableSubmit }" type="primary" @click="handleOk">确认</a-button>
</template>
</j-modal>
</template>
<script lang="ts" setup>
import { ref, nextTick, defineExpose } from 'vue';
import TaskTaskForm from './TaskTaskForm.vue'
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
const title = ref<string>('');
const width = ref<number>(800);
const visible = ref<boolean>(false);
const disableSubmit = ref<boolean>(false);
const registerForm = ref();
const emit = defineEmits(['register', 'success']);
/**
* 新增
*/
function add() {
title.value = '新增';
visible.value = true;
nextTick(() => {
registerForm.value.add();
});
}
/**
* 编辑
* @param record
*/
function edit(record) {
title.value = disableSubmit.value ? '详情' : '编辑';
visible.value = true;
nextTick(() => {
registerForm.value.edit(record);
});
}
/**
* 确定按钮点击事件
*/
function handleOk() {
registerForm.value.submitForm();
}
/**
* form保存回调事件
*/
function submitCallback() {
handleCancel();
emit('success');
}
/**
* 取消按钮回调事件
*/
function handleCancel() {
visible.value = false;
}
defineExpose({
add,
edit,
disableSubmit,
});
</script>
<style lang="less">
/**隐藏样式-modal确定按钮 */
.jee-hidden {
display: none !important;
}
</style>
<style lang="less" scoped></style>