删除审批流

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