删除审批流

This commit is contained in:
ChenXinXin committed 2024-05-09 11:15:10 +08:00
1 parent 4570db06ac
commit a41ced621b
3 files changed
+52 -24

No files matched your search

+12 -22
View File
@@ -32,8 +32,8 @@ appDataSchema.createWorkflowTask = Object.freeze({
additionalProperties: true
}
},
workflowId: {type: 'string', minLength: 1, maxLength: 100},
workflowConfigCustom: {type: 'string', minLength: 1, maxLength: 10000},
workflowId: { type: 'string', minLength: 1, maxLength: 100 },
workflowConfigCustom: { type: 'string', minLength: 1, maxLength: 10000 },
},
additionalProperties: true
});
@@ -56,16 +56,6 @@ class WorkflowService extends Service {
columnName: "formId"
});
}
async createWorkflowId() {
const { actionData } = this.ctx.request.body.appData;
const { jianghuKnex } = this.app;
actionData.workflowId = await idGenerateUtil.idPlus({
knex: jianghuKnex,
startValue: 1000,
tableName: 'workflow',
columnName: "workflowId"
});
}
async assignTplData() {
const { actionData } = this.ctx.request.body.appData;
@@ -76,13 +66,13 @@ class WorkflowService extends Service {
const tplList = await jianghuKnex('form').whereIn('formId', tplIds).select();
let formList = [];
const formData = {};
for( const item of tplList) {
for (const item of tplList) {
const cache = JSON.parse(item.formStructure);
for(const i of cache) {
for (const i of cache) {
i.tplId = item.tplId
}
formList = [...formList, ...cache];
for(const it of cache) {
for (const it of cache) {
formData[it.id] = '';
}
}
@@ -98,12 +88,12 @@ class WorkflowService extends Service {
*/
async createWorkflowTask() {
const { actionData } = this.ctx.request.body.appData;
validateUtil.validate(appDataSchema.createWorkflowTask , actionData);
validateUtil.validate(appDataSchema.createWorkflowTask, actionData);
const { jianghuKnex } = this.app;
const { formItemList, workflowConfigCustom, workflowId } = actionData;
let workflow = await jianghuKnex('workflow', this.ctx).where({workflowId}).first();
if(!workflow) {
let workflow = await jianghuKnex('workflow', this.ctx).where({ workflowId }).first();
if (!workflow) {
throw new BizError(errorInfoEnum.workflow_not_found);
}
@@ -124,16 +114,16 @@ class WorkflowService extends Service {
*/
async getTaskHistory() {
const { taskId } = this.ctx.request.body.appData.actionData;
validateUtil.validate(appDataSchema.getTaskHistory , taskId);
validateUtil.validate(appDataSchema.getTaskHistory, taskId);
const { jianghuKnex } = this.app;
const taskInfo = await jianghuKnex('task', this.ctx).where({taskId}).first();
const taskHistoryList = await jianghuKnex('task_history').where({taskId: taskInfo.taskId}).orderBy('id', 'asc').select();
const taskInfo = await jianghuKnex('task', this.ctx).where({ taskId }).first();
const taskHistoryList = await jianghuKnex('task_history').where({ taskId: taskInfo.taskId }).orderBy('id', 'asc').select();
// const userList = await jianghuKnex('_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};
return { taskHistoryList, lineTypeList };
}
/**
+7 -1
View File
@@ -346,7 +346,13 @@ Vue.component("workflow-editor-drawer", {
appData: {
pageId: 'workflowManagement',
actionId: 'insertItem',
actionData: this.formSubmitData
actionData: this.formSubmitData,
bizIdGenerate: {
tableName: "workflow",
prefix: "W",
type: "idSequence",
bizId: "workflowId",
},
}
}
})).data.appData.resultData;
+33 -1
View File
@@ -53,9 +53,12 @@
<template>
<!-- pc端 -->
<template v-if="!isMobile">
<span role="button" class="success--text font-weight-medium font-size-2" @click="doUiAction('openWorkflowEditorDrawer', item)">
<span role="button" class="success--text font-weight-medium font-size-2 mr-2" @click="doUiAction('openWorkflowEditorDrawer', item)">
<v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>编辑
</span>
<span role="button" class="success--text font-weight-medium font-size-2" @click="doUiAction('deleteWorkflow', item)">
<v-icon size="16" class="success--text">mdi-note-edit-outline</v-icon>删除
</span>
</template>
<!-- 手机端 -->
<v-menu offset-y v-if="isMobile">
@@ -69,6 +72,9 @@
<v-list-item @click="doUiAction('openWorkflowEditorDrawer', item)">
<v-list-item-title>编辑</v-list-item-title>
</v-list-item>
<v-list-item @click="doUiAction('deleteWorkflow', item)">
<v-list-item-title>删除</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</template>
@@ -179,6 +185,11 @@
case 'openWorkflowEditorDrawer':
await this.openWorkflowEditorDrawer(uiActionData);
break;
case 'deleteWorkflow':
await this.confirmDeleteItemDialog();
await this.deleteWorkflow(uiActionData);
await this.doUiAction('getTableData')
break;
default:
console.error("[doUiAction] uiActionId not find", { uiActionId });
break;
@@ -233,6 +244,27 @@
openWorkflowEditorDrawer(item) {
this.$refs.workflowEditorDrawer.doUiAction('open', item);
},
async confirmDeleteItemDialog() {
if (await window.confirmDialog({title: "删除", content: "确定删除吗?"}) === false) {
throw new Error("[confirmDeleteItemDialog] 否");
}
},
async deleteWorkflow({workflowId}){
await window.vtoast.loading("删除数据");
await window.jianghuAxios({
data: {
appData: {
pageId: 'workflowManagement',
actionId: 'deleteItem',
actionData: {},
where: {workflowId: workflowId}
}
}
})
await window.vtoast.success("删除数据成功");
}
}
})