fix: 移除新增的tabKey,调整对应的路由设计,方便关闭路由和修改标题
feat: 新样式的退回操作对话框
This commit is contained in:
@ -2,9 +2,14 @@
|
||||
<a-modal :title="dialogTitle" :visible="isOpen" :width="500" centered class="geg" @cancel="onClickCancel" @ok="onClickOK">
|
||||
<div class="dialog-wrap">
|
||||
<a-form :label-col="{ span: 5 }" :model="formState" autocomplete="off">
|
||||
<a-form-item label="下一节点" name="nextNodeName">
|
||||
<a-form-item v-if="_action === 'agree'" label="下一节点" name="nextNodeName">
|
||||
<span>{{ formState.nextNodeName }}</span>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="_action === 'reject'" label="退回至" name="rejectNode">
|
||||
<a-select v-model:value="rejectNodeId">
|
||||
<a-select-option v-for="(item, index) in rejectNodeList" :key="index" :value="item.activityId">{{ item.activityName }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="审批意见" name="opinion">
|
||||
<a-textarea v-model:value="formState.opinion" :maxlength="200" :rows="3" placeholder="请输入审批意见,不超过200字" />
|
||||
</a-form-item>
|
||||
@ -15,17 +20,17 @@
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { getRejectNodeList } from '/@/api/workflow/task';
|
||||
|
||||
const dialogTitle = ref('审批');
|
||||
const isOpen = ref(false);
|
||||
let _action = 'approve';
|
||||
const titleMapping = {
|
||||
approve: '同意',
|
||||
deny: '拒绝',
|
||||
eject: '退回',
|
||||
cancel: '终止',
|
||||
transfer: '转办'
|
||||
};
|
||||
const rejectNodeList = ref([]);
|
||||
const rejectNodeId = ref('');
|
||||
|
||||
let _action = ref('agree');
|
||||
let _processId = '';
|
||||
let _taskId = '';
|
||||
|
||||
let _callback = null;
|
||||
|
||||
const formState = reactive({
|
||||
@ -34,18 +39,35 @@
|
||||
opinionList: ['同意。', '请领导审批。']
|
||||
});
|
||||
|
||||
function toggleDialog({ action, callback } = {}) {
|
||||
function toggleDialog({ isClose, action, callback, processId, taskId } = {}) {
|
||||
if (isClose) {
|
||||
isOpen.value = false;
|
||||
return;
|
||||
}
|
||||
isOpen.value = true;
|
||||
_action = action;
|
||||
_action.value = action;
|
||||
_callback = callback;
|
||||
_processId = processId;
|
||||
_taskId = taskId;
|
||||
formState.opinion = '';
|
||||
dialogTitle.value = `审批 - ${titleMapping[action]}`;
|
||||
dialogTitle.value = `审批`;
|
||||
if (action === 'reject') {
|
||||
loadRejectNodeList();
|
||||
}
|
||||
}
|
||||
|
||||
async function loadRejectNodeList() {
|
||||
let res = await getRejectNodeList(_processId, _taskId);
|
||||
if (res && Array.isArray(res) && res.length > 0) {
|
||||
rejectNodeList.value = res;
|
||||
}
|
||||
}
|
||||
|
||||
function onClickOK() {
|
||||
if (_callback && typeof _callback === 'function') {
|
||||
_callback({
|
||||
opinion: formState.opinion
|
||||
opinion: formState.opinion,
|
||||
rejectNodeId: rejectNodeId.value
|
||||
});
|
||||
}
|
||||
isOpen.value = false;
|
||||
@ -62,6 +84,6 @@
|
||||
|
||||
<style lang="less" scoped>
|
||||
.dialog-wrap {
|
||||
padding-right: 15px;
|
||||
padding: 10px 15px 0 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user