diff --git a/app/constant/constant.js b/app/constant/constant.js
index 5796f72..fd1774f 100644
--- a/app/constant/constant.js
+++ b/app/constant/constant.js
@@ -1,40 +1,39 @@
'use strict';
-module.exports = {
- tableEnum: {
- // ========================江湖表============================
- _cache: '_cache',
- _constant: '_constant',
- _file: '_file',
- _group: '_group',
- _log: '_log',
- _page: '_page',
- _resource: '_resource',
- _record_history: '_record_history',
- _resource_request_log: '_resource_request_log',
- _role: '_role',
- _test_case: '_test_case',
- _user: '_user',
- _user_group_role: '_user_group_role',
- _user_group_role_page: '_user_group_role_page',
- _user_group_role_resource: '_user_group_role_resource',
- _user_group_role_ui_level: '_user_group_role_ui_level',
- _user_session: '_user_session',
- // ========================应用表============================
- app: 'student',
- article: 'article',
- assignment: 'assignment',
- category: 'category',
- workflow: 'workflow',
- task: 'task',
- task_history: 'task_history',
- // ========================基础 View============================
- _view01_resource: '_view01_resource',
- _view01_user: '_view01_user',
- // ========================高级 View============================
- _view02_user_app: '_view02_user_app',
- _view02_user_group_role: '_view02_user_group_role',
- },
-};
+module.exports.tableEnum = Object.freeze({
+ // ========================江湖表============================
+ _cache: "_cache",
+ _constant: "_constant",
+ _constant_ui: "_constant_ui",
+ _file: "_file",
+ _group: "_group",
+ _page: "_page",
+ _record_history: "_record_history",
+ _resource: "_resource",
+ _resource_request_log: "_resource_request_log",
+ _role: "_role",
+ _user: "_user",
+ _user_group_role: "_user_group_role",
+ _user_group_role_page: "_user_group_role_page",
+ _user_group_role_resource: "_user_group_role_resource",
+ _user_session: "_user_session",
+ _constant_ui: "_constant_ui",
+ // ========================基础表============================
+ workflow: 'workflow',
+ task: 'task',
+ task_history: 'task_history',
+ // ========================基础View============================
+ // ========================View============================
+ _view01_user: "_view01_user",
+});
+module.exports.genderEnum = Object.freeze({
+ male: 'male',
+ female: 'female'
+})
+module.exports.articleViewTypeEnum = Object.freeze({
+ content: 'content',
+ audio: 'audio',
+ video: 'video',
+})
diff --git a/app/constant/error.js b/app/constant/error.js
index a5f644a..fbce7d2 100644
--- a/app/constant/error.js
+++ b/app/constant/error.js
@@ -16,7 +16,8 @@ const errorInfoEnum = {
task_not_found: { errorCode: 'task_not_found', errorReason: '任务不存在' },
node_not_found: { errorCode: 'node_not_found', errorReason: '节点不存在' },
line_not_found: { errorCode: 'line_not_found', errorReason: '线路不存在' },
- line_hook_error: { errorCode: 'line_hook_error', errorReason: '线路Hook异常' }
+ line_hook_error: { errorCode: 'line_hook_error', errorReason: '线路Hook异常' },
+ workflow_not_found: { errorCode: 'workflow_not_found', errorReason: '流程不存在' },
};
module.exports = {
diff --git a/app/service/student.js b/app/service/student.js
deleted file mode 100644
index c8ff11e..0000000
--- a/app/service/student.js
+++ /dev/null
@@ -1,59 +0,0 @@
-'use strict';
-
-
-// ========================================常用 require start===========================================
-const Service = require('egg').Service;
-const validateUtil = require("@jianghujs/jianghu/app/common/validateUtil");
-const idGenerateUtil = require("@jianghujs/jianghu/app/common/idGenerateUtil");
-const dayjs = require("dayjs");
-const actionDataScheme = Object.freeze({
- beforHookForGenerateStudentId: {
- type: "object",
- additionalProperties: true,
- required: ["dateOfBirth"],
- properties: {
- dateOfBirth: { type: "string", format: "date" },
- },
- },
-});
-
-class StudentService extends Service {
- async beforHookForGenerateStudentId() {
- const { actionData } = this.ctx.request.body.appData;
- validateUtil.validate(
- actionDataScheme.beforHookForGenerateStudentId,
- actionData
- );
- const { dateOfBirth } = actionData;
- const dateOfBirthObj = dayjs(dateOfBirth);
- const studentId = `S_${idGenerateUtil.uuid(
- 8
- )}_${dateOfBirthObj.month()}_${dateOfBirthObj.day()}`;
- this.ctx.request.body.appData.actionData.studentId = studentId;
- }
-
- async appendStudentInfoToUserInfo() {
- const studentInfo = await this.app
- .jianghuKnex("student")
- .where({ studentId: this.ctx.userInfo.user.userId })
- .first();
- this.ctx.userInfo.studentInfo = studentInfo || { classId: null };
- }
-
- async selectStudentList() {
- const studentInfo = await this.app
- .jianghuKnex("student")
- .where({ studentId: this.ctx.userInfo.user.userId })
- .first();
- const studentList = await this.app
- .jianghuKnex("student")
- .where({ classId: studentInfo.classId })
- .select();
-
- return {
- rows: studentList,
- };
- }
-}
-
-module.exports = StudentService;
diff --git a/app/service/task.js b/app/service/task.js
index c268cd7..e572949 100644
--- a/app/service/task.js
+++ b/app/service/task.js
@@ -45,25 +45,45 @@ class TaskService extends Service {
const { userId, username } = this.ctx.userInfo;
where.createByUser = userId;
}
+ async whereToViewUserId() {
+ const { whereLike } = this.ctx.request.body.appData;
+ const { userId } = this.ctx.userInfo;
+ whereLike.taskViewUserList = userId;
+ }
+
+ /**
+ * 创建审批工作流
+ * @returns void
+ */
async createTask() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex, config } = this.app;
// const { workflowId, taskTitle, taskFormStructure, taskFormData } = actionData;
- const { workflowId, taskTitle, workflowForm, workflowFormData } = actionData;
+ const { workflowId, taskTitle, workflowForm, workflowFormData, workflowConfigCustom } = actionData;
const { userId, username } = this.ctx.userInfo;
- const taskId = await idGenerateUtil.idPlus({
- knex: jianghuKnex,
- startValue: 1000,
- tableName: tableEnum.task,
- columnName: "taskId"
- });
- const workflow = await jianghuKnex(tableEnum.workflow).where({workflowId}).first();
+ const taskId = await idGenerateUtil.uuid();
+ const workflow = await jianghuKnex(tableEnum.workflow, this.ctx).where({workflowId}).first();
if (!workflow) {
throw new BizError(errorInfoEnum.workflow_not_found)
return
}
- const { workflowConfig } = workflow;
- const {nodeList = [], lineList = []} = JSON.parse(workflowConfig || '{}');
+
+ const workflowConfig = JSON.parse(workflow.workflowConfig || '{}');
+ let {mode = 'serial', nodeList = [], lineList = []} = workflowConfig;
+ const nodeListOfUserTaskNode = (JSON.parse(workflowConfigCustom || '{}')).nodeListOfUserTaskNode || []
+ // 合并定制的审批人和workflow的审批人
+ // nodeList = _.merge(_.keyBy(nodeList, 'id'), _.keyBy((JSON.parse(workflowConfigCustom || '{}')).nodeListOfUserTaskNode || [], 'id'))
+ for (let i = 0; i < nodeList.length; i++) {
+ const node = nodeList[i];
+ const tempNode = nodeListOfUserTaskNode.find(n => n.id === node.id);
+ if (tempNode) {
+ nodeList[i] = tempNode;
+ }
+ }
+ nodeList = _.values(nodeList);
+ workflowConfig.nodeList = nodeList
+
+
// start 节点进入历史
const startNode = nodeList.find(e => e.id.includes('start-'));
const startLine = lineList.filter(e => e.from === startNode.id);
@@ -83,13 +103,26 @@ class TaskService extends Service {
taskViewUserList: allUser,
createByUser: userId,
taskInitUser: userId,
- workflowConfig
+ workflowConfig: JSON.stringify(workflowConfig)
}
- const [id] = await jianghuKnex(tableEnum.task, this.ctx).insert(startData);
- await this.buildNext({ type: '同意', id, taskTpl: {input: workflowFormData}, taskComment: '' })
+ await jianghuKnex.transaction(async trx => {
+ const [id] = await trx(tableEnum.task, this.ctx).insert(startData);
+ // 并行模式下,生成所有的userTask
+ if (mode == 'parallel') {
+ await this.generateAllUserTask(id, trx);
+ }
+ // 开始节点进入历史
+ await this.buildNext({ type: '同意', id, taskTpl: {input: workflowFormData}, taskComment: ''}, trx);
+
+
+ });
return startData;
}
-
+ /**
+ * 获取组下的所有用户
+ * @param {*} groupId
+ * @returns
+ */
async getGroupUserList(groupId) {
const { jianghuKnex, config } = this.app;
const userList = await jianghuKnex(tableEnum._user_group_role).where({groupId}).select('userId');
@@ -145,11 +178,13 @@ class TaskService extends Service {
}
const taskHistoryList = await jianghuKnex(tableEnum.task_history).where({taskId: taskInfo.taskId}).orderBy('id', 'asc').select();
const taskStepperList = this.makeStepper(taskInfo.workflowConfig, taskHistoryList, taskInfo);
+ const userList = await jianghuKnex(tableEnum._view01_user).whereIn('userId', taskInfo.taskViewUserList.split(',')).select();
taskInfo.workflowConfig = JSON.parse(taskInfo.workflowConfig);
- const taskHistoryConfigList = this.getTaskHistoryConfigList(taskInfo.workflowConfig, taskHistoryList);
- // 查找task 任务历史列表
- const isAccess = taskInfo.taskEditUserList.includes(userId);
+ const taskHistoryConfigList = this.getTaskHistoryConfigList(taskInfo.workflowConfig, taskHistoryList, userList);
+ // 查找task 任务历史列表 taskEditedUserList
+ const isAccess = taskInfo.taskEditUserList.includes(userId) && (taskInfo.taskEditedUserList || '').indexOf(userId) === -1;
+ const lineTypeList = taskInfo.taskLineTypeList;
const nextLineList = taskInfo.taskStatus === 'running' ? JSON.parse(taskInfo.taskNextConfigList) : [];
const taskTpl = JSON.parse(taskInfo.taskFormInput || '{"input": {}, "formList": []}');
// const currentNode = taskInfo.workflowConfig.nodeList.find(e => e.id === taskInfo.taskConfigId);
@@ -157,6 +192,7 @@ class TaskService extends Service {
taskStepperList,
taskHistoryList,
isAccess,
+ lineTypeList,
nextLineList,
taskTpl,
currentNode: taskInfo.workflowConfig.nodeList.find(e => e.id === taskInfo.taskConfigId),
@@ -164,25 +200,29 @@ class TaskService extends Service {
};
}
/**
- * 获取历史节点+当前节点
+ * 获取所有节点,标示历史节点+当前节点
* @returns
*/
- getTaskHistoryConfigList(workflowConfig, taskHistory) {
+ getTaskHistoryConfigList(workflowConfig, taskHistory, userList) {
const {nodeList = [], lineList = []} = workflowConfig;
- // 历史所有主节点
- const historyNodeList = nodeList.filter(node => taskHistory.some(history => history.taskConfigId === node.id || history.taskLineTo.includes(node.id)));
- let historyLineList = [];
- taskHistory.forEach((history, index) => {
- const filterLineList = lineList.filter(line => history.taskConfigId === line.from && history.taskLineTo.includes(line.to));
- if (filterLineList.length) {
- filterLineList.forEach(line => {
- line.label = line.label + ` (${index + 1})`
- })
- historyLineList = [...historyLineList, ...filterLineList];
+ // 历史所有主节点和连线做标志
+ nodeList.filter(node => taskHistory.some(history => history.taskConfigId === node.id || history.taskLineTo.includes(node.id))).forEach(node => {
+ node.inPath = true
+ })
+ // TODO: 将审批人 展示再 审批节点上
+ nodeList.forEach(node => {
+ if (node.type === 'userTask') {
+ const userMap = _.keyBy(userList, 'userId');
+ node.origin.properties.userList = node.assignValue.map(uId => userMap[uId] ? userMap[uId]['username'] : uId);
}
+ });
+ taskHistory.forEach((history, index) => {
+ lineList.filter(line => history.taskConfigId === line.from && history.taskLineTo.includes(line.to)).forEach(line => {
+ line.label = line.label + ` (${index + 1})`
+ })
})
- return {nodeList: historyNodeList, lineList: historyLineList};
+ return {nodeList, lineList};
}
/**
* 制作节点步骤list
@@ -269,32 +309,59 @@ class TaskService extends Service {
const existIdList = _.flatten(nodeSortList).map(e => {return e.id});
return nodeAllList.filter(e => lineList.some(s => s.to === e.id) && !existIdList.includes(e.id));
}
- async submitNode() {
- const { actionData } = this.ctx.request.body.appData;
- await this.buildNext(actionData);
- }
- async buildNext(actionData) {
- const { jianghuKnex } = this.app;
- const { type, id, taskTpl, taskComment } = actionData;
-
- const taskInfo = await jianghuKnex(tableEnum.task).where({id}).first();
+ async generateAllUserTask(id, trx) {
+ const taskInfo = await trx(tableEnum.task).where({id}).first();
delete taskInfo.id;
const {nodeList = [], lineList = []} = JSON.parse(taskInfo.workflowConfig || '{}');
+ const userNode = nodeList.filter(e => e.id.includes('userTask') || e.id.includes('receiveTask') );
+ for (const node of userNode) {
+ let taskEditUserList = await this.getProcessUserList([node]);
+ const nextLineList = lineList.filter(e => e.from === node.id);
+ await trx(tableEnum.task).insert({
+ ...taskInfo,
+ taskNextConfigList: JSON.stringify(nextLineList),
+ taskLineTypeList: node.lineTypeList,
+ taskEditUserList,
+ taskConfigId: node.id,
+ taskStatus: 'running'
+ });
+ }
+ }
+ async submitNode() {
+ const { actionData } = this.ctx.request.body.appData;
+ const { jianghuKnex } = this.app;
+ await jianghuKnex.transaction(async trx => {
+ await this.buildNext(actionData, trx);
+ });
+ }
+ async buildNext(actionData, trx) {
+ const { type, id, taskComment } = actionData;
+ const { userId } = this.ctx.userInfo;
+
+ // 准备任务数据
+ const taskInfo = await trx(tableEnum.task).where({id}).first();
+ delete taskInfo.id;
+ const {mode = 'serial', nodeList = [], lineList = []} = JSON.parse(taskInfo.workflowConfig || '{}');
+ const userNode = nodeList.filter(e => e.id.includes('userTask') || e.id.includes('receiveTask') );
+ const userTaskCount = userNode.reduce((acc, cur) => acc += cur.isNeedAllApproval? cur.assignValue.length: 1, 0);
+ const endNode = nodeList.find(e => e.id.includes('end-'));
const nLineList = JSON.parse(taskInfo.taskNextConfigList);
const lines = nLineList.filter(e => e.type === type);
-
const currentNode = nodeList.find(e => e.id === taskInfo.taskConfigId);
+
// 写入exec历史
- const taskHistory = await jianghuKnex(tableEnum.task_history).where({taskId: taskInfo.taskId}).orderBy('operationAt', 'desc').select();
+ const taskHistory = await trx(tableEnum.task_history, this.ctx).where({taskId: taskInfo.taskId}).orderBy('operationAt', 'desc').select();
const [prevHistory] = taskHistory;
- let taskFormInput = JSON.parse(taskInfo.taskFormInput);
- taskFormInput.input = taskTpl.input;
- taskFormInput = JSON.stringify(taskFormInput);
- const historyTaskFormInput = JSON.parse(taskInfo.taskFormInput)
- historyTaskFormInput .input = taskTpl.input;
+ // let taskFormInput = JSON.parse(taskInfo.taskFormInput);
+ // taskFormInput.input = taskTpl.input;
+ // taskFormInput = JSON.stringify(taskFormInput);
+ // const historyTaskFormInput = JSON.parse(taskInfo.taskFormInput)
+ // historyTaskFormInput .input = taskTpl.input;
+ const taskFormInput = taskInfo.taskFormInput;
const history = {
...taskInfo,
- taskFormInput: JSON.stringify(historyTaskFormInput),
+ // taskFormInput: JSON.stringify(historyTaskFormInput),
+ taskFormInput,
taskExplain: currentNode.label,
taskConfigId: currentNode.id,
taskHandleDesc: type,
@@ -304,53 +371,108 @@ class TaskService extends Service {
taskCostDuration: prevHistory ? parseInt((new Date().getTime() - new Date(prevHistory.operationAt).getTime()) / 1000) : 0,
taskComment
}
+ delete history.taskEditedUserList;
+ await trx(tableEnum.task_history, this.ctx).insert(history);
- await jianghuKnex(tableEnum.task_history, this.ctx).insert(history);
+ // 未配置连线时,默认添加拒绝连线到end节点
+ if (endNode && !lines.length) {
+ lines.push({
+ "from": currentNode.id,
+ "to": endNode.id,
+ "type": "拒绝",
+ "label": "结束",
+ "toInterruptEnd": true
+ });
+ }
for (const line of lines) {
const nextNode = nodeList.find(e => e.id === line.to);
- let taskEditUserList = await this.getProcessUserList([nextNode]);
- // 修改任务步骤node 处理人\
const nextLineList = lineList.filter(e => e.from === line.to);
- if (line.to.includes('end-')) {
+ let taskEditUserList = await this.getProcessUserList([nextNode]);
+
+ // 当前节点如果需要所有人审批并且不是拒绝连线时,检查是否所有人都审批过了
+ if (currentNode.isNeedAllApproval && !line.toInterruptEnd) {
+ let taskEditedUserList = taskInfo.taskEditedUserList? `${taskInfo.taskEditedUserList},${userId}`: userId;
+ await trx(tableEnum.task, this.ctx).where({id}).update({taskEditedUserList});
+ if (_.xor(taskEditedUserList.split(','), taskInfo.taskEditUserList.split(',')).length != 0) {
+ return
+ }
+ }
+
+ await trx(tableEnum.task, this.ctx).where({id}).delete();
+
+ // 结束流程
+ // 条件:
+ // 1. 串行模式,连接end节点时
+ // 2. 默认拒绝节点
+ // 3. 并行模式,所有节点通过
+ if (
+ (mode == 'serial' && line.to.includes('end-')) ||
+ line.toInterruptEnd === true ||
+ (mode == 'parallel' && taskHistory.length == userTaskCount && line.type != '拒绝')
+ ) {
taskEditUserList = await this.getProcessUserList([currentNode]);
const endHistory = {
...history,
+ taskStatus: 'end',
taskExplain: '结束',
- taskConfigId: nextNode.id,
+ taskConfigId: endNode.id,
taskHandleDesc: '流程结束',
taskLineFrom: line.from,
taskLineTo: line.to,
taskLineLabel: line.type + '-' + line.label,
taskCostDuration: 0
}
- await jianghuKnex(tableEnum.task_history, this.ctx).insert(endHistory);
+ await trx(tableEnum.task_history, this.ctx).insert(endHistory);
+ await trx(tableEnum.task).insert({
+ ...taskInfo,
+ taskId: taskInfo.taskId,
+ taskFormInput: taskInfo.taskFormInput,
+ taskNextConfigList: JSON.stringify(nextLineList),
+ taskLineTypeList: endNode.lineTypeList,
+ taskEditUserList,
+ taskConfigId: endNode.id,
+ taskStatus: 'end'
+ });
+ // 默认拒绝节点,删除全部任务,执行interruptHook
+ if (line.toInterruptEnd) {
+ await trx(tableEnum.task, this.ctx).where({taskId: taskInfo.taskId, taskStatus: 'running'}).delete();
+ await this.executeHook(endNode.interruptHook);
+ } else {
+ await this.executeHook(endNode.finishHook);
+ }
+ return
}
- await jianghuKnex(tableEnum.task).where({id}).delete();
+
+ await this.executeHook(line.hook);
+ // 其他同级节点未结束,暂时不生成下一个节点
let otherNodeList = this.getNodeBrotherList(taskInfo.taskConfigId, nodeList, lineList);
otherNodeList = otherNodeList.filter(e => e.id !== taskInfo.taskConfigId);
-
if (otherNodeList.length && !otherNodeList.some(e => taskHistory.some(s => s.taskConfigId === e.id))) {
console.log('其他并行未结束、暂停任务')
return
}
- await jianghuKnex(tableEnum.task).insert({
- ...taskInfo,
- taskId: taskInfo.taskId,
- taskFormInput,
- taskNextConfigList: JSON.stringify(nextLineList),
- taskEditUserList,
- taskConfigId: nextNode.id,
- taskStatus: (nextLineList.length === 0 || currentNode.id.includes('end-')) ? 'end' : type === 'deny' ? 'deny' : 'running'
- });
- await this.executeLineHook(line);
+
+ // 串行审核,生成下一个task
+ if (mode == 'serial') {
+ await trx(tableEnum.task, this.ctx).insert({
+ ...taskInfo,
+ taskId: taskInfo.taskId,
+ taskFormInput,
+ taskNextConfigList: JSON.stringify(nextLineList),
+ taskLineTypeList: nextNode.lineTypeList,
+ taskEditUserList,
+ taskConfigId: nextNode.id,
+ taskStatus: type === 'deny' ? 'deny' : 'running'
+ });
+ }
}
}
- async executeLineHook(line) {
+ async executeHook(hook) {
try {
- const { service, serviceFunction } = JSON.parse(line.hook || '{}');
+ const { service, serviceFunction } = JSON.parse(hook || '{}');
if (service && serviceFunction) {
await this.ctx.service[service][serviceFunction](this.ctx.request.body.appData.actionData, this.ctx)
}
@@ -358,6 +480,18 @@ class TaskService extends Service {
throw new BizError(errorInfoEnum.line_hook_error);
}
}
+
+ /**
+ * 操作历史查询 Hook,非 admin 账户只能查自己的操作历史
+ */
+ async historyFilterHook() {
+ const { where = {} } = this.ctx.request.body.appData;
+ const { user, userGroupRoleList } = this.ctx.userInfo;
+ // 如果用户不在 adminGroup 内,则只能查看自己的数据
+ if (!userGroupRoleList.find(o => o.groupId === 'adminGroup')) {
+ where.operationByUserId = user.userId;
+ }
+ }
}
module.exports = TaskService;
diff --git a/app/service/workflow.js b/app/service/workflow.js
index 601827a..ce6026f 100644
--- a/app/service/workflow.js
+++ b/app/service/workflow.js
@@ -80,6 +80,47 @@ class WorkflowService extends Service {
console.log(actionData);
}
+ /**
+ * 创建流程审批
+ */
+ async createWorkflowTask() {
+ const { actionData } = this.ctx.request.body.appData;
+ const { jianghuKnex } = this.app;
+ const { group, formItemList, taskUserList, workflowConfigCustom, workflowId } = actionData;
+ const { userId, username } = this.ctx.userInfo;
+
+ let workflow = await jianghuKnex(tableEnum.workflow, this.ctx).where({workflowId}).first();
+ if(!workflow) {
+ throw new BizError(errorInfoEnum.workflow_not_found);
+ }
+
+ actionData.workflowConfigCustom = JSON.stringify(workflowConfigCustom);
+ actionData.workflowId = workflow.workflowId;
+ actionData.taskTitle = `[${group}]${username}`;
+ actionData.workflowForm = formItemList;
+ const formData = {};
+ formItemList.forEach(item => {
+ formData[item.statement] = item.answer;
+ })
+ actionData.workflowFormData = formData;
+ await this.ctx.service.task.createTask()
+ }
+ /**
+ * 获取节点审批历史
+ * @returns
+ */
+ async getTaskHistory() {
+ const { taskId } = this.ctx.request.body.appData.actionData;
+ const { jianghuKnex } = this.app;
+
+ const taskInfo = await jianghuKnex(tableEnum.task, this.ctx).where({taskId}).first();
+ const taskHistoryList = await jianghuKnex(tableEnum.task_history).where({taskId: taskInfo.taskId}).orderBy('id', 'asc').select();
+ // const userList = await jianghuKnex(tableEnum._view01_user).whereIn('userId', taskInfo.taskViewUserList.split(',')).select();
+ // taskInfo.workflowConfig = JSON.parse(taskInfo.workflowConfig);
+ // return this.ctx.service.task.getTaskHistoryConfigList(taskInfo.workflowConfig, taskHistoryList, userList);
+ const lineTypeList = taskInfo.taskLineTypeList;
+ return {taskHistoryList, lineTypeList};
+ }
}
module.exports = WorkflowService;
diff --git a/app/view/component/flow/editLine.html b/app/view/component/flow/editLine.html
index 757ddcb..5545250 100644
--- a/app/view/component/flow/editLine.html
+++ b/app/view/component/flow/editLine.html
@@ -35,7 +35,7 @@
名称
-
+
操作类型
+ -->
指派
-
- -->
-
+
+
+
+
允许的操作(英文逗号分隔)
-
+
+
+
+
+ 流程完成Hook
+
+
+
+ 流程中断Hook
+
@@ -139,6 +148,10 @@
return []
}
},
+ mode: {
+ type: String,
+ default: 'serial'
+ }
},
data() {
return {
diff --git a/app/view/component/flow/processFlow.html b/app/view/component/flow/processFlow.html
index 1d31c10..9ec91a5 100644
--- a/app/view/component/flow/processFlow.html
+++ b/app/view/component/flow/processFlow.html
@@ -16,8 +16,8 @@
{{editType == 'node' ? '节点' : '连线'}}属性
-
-
+
+
@@ -40,6 +40,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/view/component/taskHistory.html b/app/view/component/taskHistory.html
new file mode 100644
index 0000000..77ad2bc
--- /dev/null
+++ b/app/view/component/taskHistory.html
@@ -0,0 +1,104 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/view/page/taskHistory.html b/app/view/page/taskHistory.html
new file mode 100644
index 0000000..2ce7943
--- /dev/null
+++ b/app/view/page/taskHistory.html
@@ -0,0 +1,283 @@
+{% extends 'template/jhTemplateV4.html'%}
+
+{% block vueTemplate %}
+
+
+
+
+
+
+{% endblock %}
+
+{% block vueScript %}
+
+
+{% include 'common/fixedTableHeightV4.html' %}
+{% include 'component/taskHistory.html' %}
+
+
+
+
+
+{% endblock %}
+s
\ No newline at end of file
diff --git a/app/view/page/todo.html b/app/view/page/todo.html
new file mode 100644
index 0000000..1b3afdb
--- /dev/null
+++ b/app/view/page/todo.html
@@ -0,0 +1,412 @@
+{% extends 'template/jhTemplateV4.html'%}
+
+{% block vueTemplate %}
+
+
+
+
+
+
+{% endblock %}
+
+{% block vueScript %}
+
+
+{% include 'common/fixedTableHeightV4.html' %}
+{% include 'component/taskHistory.html' %}
+
+
+
+
+
+{% endblock %}
diff --git a/app/view/page/workflowEditor.html b/app/view/page/workflowEditor.html
index 9fcbe53..e23fc2c 100644
--- a/app/view/page/workflowEditor.html
+++ b/app/view/page/workflowEditor.html
@@ -12,31 +12,36 @@
-
+
-
+
+
+
+
- 模板设置
+
流程设置
+ :group="constantCollection.groupList" :tpl="constantCollection.workflowFormList"
+ :mode="editItem.mode">
@@ -66,12 +71,16 @@ new Vue({
vuetify: new Vuetify(),
data: () => ({
requireRules: [
- v => !!v || 'This is required',
+ v => !!v || '必填',
],
constantCollection: {
userList: [],
groupList: [],
- workflowFormList: []
+ workflowFormList: [],
+ modeList: [
+ { text: '串行', value: 'serial'},
+ { text: '并行', value: 'parallel'},
+ ]
},
editItem: {},
dialogSaveInfoAction: 'createItem',
@@ -123,8 +132,17 @@ new Vue({
},
buildEditItem() {
- const { id, workflowId, workflowName, workflowRemark, workflowCategory, workflowForm } = this.editItem;
+ const { id, workflowId, workflowName, workflowRemark, workflowCategory, mode, workflowForm } = this.editItem;
const workflowConfig = this.$refs.processFlow.getData();
+ workflowConfig.mode = mode
+ // TODO: 清除不存在的用户
+ workflowConfig.nodeList.forEach(node => {
+ if (node.type === 'userTask') {
+ node.assignValue = node.assignValue || [];
+ node.assignValue = node.assignValue.filter(userId => this.constantCollection.userList.findIndex(u => u.userId === userId) > -1);
+ node.origin.properties.assignValue = node.assignValue;
+ }
+ });
let item = {
workflowName,
workflowRemark,
@@ -159,7 +177,6 @@ new Vue({
}
}
config.formId = formId
- console.log(config.outline, config.formId)
}
},
@@ -178,7 +195,7 @@ new Vue({
}
})).data.appData.resultData;
this.constantCollection.userList = rows.map(e => {
- return {text: e.username, value: e.userId}
+ return {text: e.username, value: e.userId, userId: e.userId }
})
},
/**
@@ -202,7 +219,7 @@ new Vue({
async clearItemData() {
this.dialogSaveInfoAction = 'createItem';
- this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}};
+ this.editItem = {workflowForm: [], workflowConfig: {lineList: [], nodeList: []}, mode: 'serial'};
},
async syncEditItem() {
@@ -223,6 +240,7 @@ new Vue({
const item = rows[0];
item.workflowConfig = item.workflowConfig ? JSON.parse(item.workflowConfig) : null;
item.workflowForm = item.workflowForm ? JSON.parse(item.workflowForm) : [];
+ item.mode = item.workflowConfig.mode || 'serial';
this.editItem = item;
}
setTimeout(() => {
@@ -285,7 +303,16 @@ new Vue({
})
-
{% endblock %}
diff --git a/app/view/page/workflowManagement copy.html b/app/view/page/workflowManagement copy.html
new file mode 100644
index 0000000..343aa7a
--- /dev/null
+++ b/app/view/page/workflowManagement copy.html
@@ -0,0 +1,187 @@
+{% extends 'template/jhTemplateV3.html'%}
+
+{% block vue_template %}
+
+
+
+
+
+
+ 新增
+ 共{{ tableDataFromBackend.length }}条记录
+
+
+
+
+
+
+
+
+
+
+ {{ tableButton.text }}
+
+
+
+
+ {{ item.operationAt && dayjs(item.operationAt).format('YYYY-MM-DD HH:mm:ss') }}
+
+
+
+
+
+{% endblock %}
+
+{% block vue_body %}
+
+
+
+
+{% endblock %}
diff --git a/app/view/page/workflowManagement.html b/app/view/page/workflowManagement.html
index 62365d8..dc44521 100644
--- a/app/view/page/workflowManagement.html
+++ b/app/view/page/workflowManagement.html
@@ -1,173 +1,444 @@
-{% extends 'template/jhTemplateV3.html'%}
+{% extends 'template/jhTemplateV4.html'%}
-{% block vue_template %}
+{% block vueTemplate %}
-
-
-
-
-
- 新增
- 共{{ tableDataFromBackend.length }}条记录
-
-
-
-
-
-
+
+
+
+
{% endblock %}
-{% block vue_body %}
+{% block vueScript %}
+
+
+{% include 'component/formItem.html' %}
+
{% endblock %}
diff --git a/package.json b/package.json
index bf72a76..c899db8 100644
--- a/package.json
+++ b/package.json
@@ -8,14 +8,11 @@
"framework": "@jianghujs/jianghu"
},
"dependencies": {
- "@jianghujs/jianghu": "3.0.81",
- "dayjs": "^1.11.4",
+ "@jianghujs/jianghu": "4.0.5",
"egg": "^2.15.1",
"egg-scripts": "^2.11.0"
},
"devDependencies": {
- "autod": "^3.0.1",
- "autod-egg": "^1.1.0",
"egg-bin": "^4.11.0",
"egg-mock": "^3.21.0",
"eslint": "^7.32.0",