37 changed files with 278 additions and 858 deletions
@ -1,193 +0,0 @@ |
|||||
<template> |
|
||||
<w-list-grid |
|
||||
ref="listGridRef" |
|
||||
:title="$t('org.wsp.framework.flowable.task.grid.title')" |
|
||||
:data-url="$fc.apiContextPath + '/system/process/query/task/isc'" |
|
||||
:form-fields="listGridFields.query" |
|
||||
:form-field-counter="{ xxs:1, xs:1, sm:2, md:2, lg:2, xl:2, xxl:2 }" |
|
||||
:table-columns="listGridFields.grid" |
|
||||
:detail-fields="listGridFields.detail" |
|
||||
:can-pageable="true" |
|
||||
:tool-bar-actions="listGridToolBarActions" |
|
||||
:table-scroll="{x:'100%',y:$fc.ui.contentHeight-$fc.ui.toolBarHeight-$fc.ui.tableHeaderHeight-$fc.ui.paginationHeight-40}" |
|
||||
@selected-rows-change="selectedRowsChange" |
|
||||
> |
|
||||
</w-list-grid> |
|
||||
<CompleteTaskDialog ref="completeTaskDialogRef" @after-completed="afterCompleted"></CompleteTaskDialog> |
|
||||
</template> |
|
||||
<script setup> |
|
||||
import { |
|
||||
computed, ref, onMounted, createVNode, toRaw |
|
||||
} from 'vue'; |
|
||||
import { useRouter, useRoute } from 'vue-router'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import { Modal, notification } from 'ant-design-vue'; |
|
||||
import { QuestionCircleOutlined } from '@ant-design/icons-vue'; |
|
||||
import { |
|
||||
useFrameworkConfiguration, useAxios, |
|
||||
useEnumOptions, getOptionText, useTrueFalseOptions, |
|
||||
useYesNoOptions, useDataComeFromOptions, useRoleOptions, |
|
||||
useOrgOptions, useTableColumn |
|
||||
} from 'framework-core'; |
|
||||
|
|
||||
import CompleteTaskDialog from './CompleteTaskDialog'; |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义事件 |
|
||||
*/ |
|
||||
const emit = defineEmits([ |
|
||||
'selectedRowsChange', // 选择的行发生改变 |
|
||||
]); |
|
||||
|
|
||||
const { t } = useI18n(); |
|
||||
const axios = useAxios(); |
|
||||
const fc = useFrameworkConfiguration(); |
|
||||
const router = useRouter(); |
|
||||
const route = useRoute(); |
|
||||
|
|
||||
const listGridRef = ref(null); |
|
||||
const completeTaskDialogRef = ref(null); |
|
||||
|
|
||||
const listGridFields = computed(() => { |
|
||||
return { |
|
||||
query: [ |
|
||||
{ component:'input', name:'processInstanceId', label:t('org.wsp.framework.flowable.task.entity.processInstanceId') }, |
|
||||
], |
|
||||
grid: [ |
|
||||
useTableColumn({ width:150, name:'name', title:t('org.wsp.framework.flowable.task.entity.name') }), |
|
||||
useTableColumn({ width:80, name:'owner', title:t('org.wsp.framework.flowable.task.entity.owner') }), |
|
||||
useTableColumn({ width:100, name:'assignee', title:t('org.wsp.framework.flowable.task.entity.assignee') }), |
|
||||
useTableColumn({ width:150, name:'createTime', title:t('org.wsp.framework.flowable.task.entity.createTime') }), |
|
||||
useTableColumn({ width:150, name:'claimTime', title:t('org.wsp.framework.flowable.task.entity.claimTime') }), |
|
||||
useTableColumn({ width:150, name:'processInstanceId', title:t('org.wsp.framework.flowable.task.entity.processInstanceId') }), |
|
||||
] |
|
||||
}; |
|
||||
}); |
|
||||
|
|
||||
const listGridToolBarActions = computed(() => { |
|
||||
return ['*query', 'reset', 'refresh', 'divider', |
|
||||
{ |
|
||||
icon: 'PartitionOutlined', |
|
||||
title: t('org.wsp.framework.flowable.action.showWorkflowDiagram'), |
|
||||
enableIf: (selectedRecords) => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
return selectedRecords.length > 0; |
|
||||
}, |
|
||||
click: () => { |
|
||||
console.log('1'); |
|
||||
}, |
|
||||
}, |
|
||||
'divider', |
|
||||
{ |
|
||||
icon: 'RightCircleOutlined', |
|
||||
title: t('org.wsp.framework.flowable.action.complete.task'), |
|
||||
enableIf: (selectedRecords) => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
return selectedRecords.length > 0; |
|
||||
}, |
|
||||
click: () => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
completeTaskDialogRef?.value?.open(record.id); |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
icon: 'DownCircleOutlined', |
|
||||
title: t('org.wsp.framework.flowable.action.claim.task'), |
|
||||
enableIf: (selectedRecords) => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
return selectedRecords.length > 0 && !record.assignee; |
|
||||
}, |
|
||||
click: () => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
axios.post( |
|
||||
fc.apiContextPath + '/system/process/operation/claim/' + record.id, |
|
||||
null |
|
||||
).then(() => { |
|
||||
notification.success({ |
|
||||
message: t('operationSuccess'), |
|
||||
duration:2 |
|
||||
}); |
|
||||
listGridRef?.value.refresh(); |
|
||||
}); |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
icon: 'UpCircleOutlined', |
|
||||
title: t('org.wsp.framework.flowable.action.unclaim.task'), |
|
||||
enableIf: (selectedRecords) => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
return selectedRecords.length > 0 && record.assignee; |
|
||||
}, |
|
||||
click: () => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
axios.post( |
|
||||
fc.apiContextPath + '/system/process/operation/unClaim/' + record.id, |
|
||||
null |
|
||||
).then(() => { |
|
||||
notification.success({ |
|
||||
message: t('operationSuccess'), |
|
||||
duration:2 |
|
||||
}); |
|
||||
listGridRef?.value.refresh(); |
|
||||
}); |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
icon: 'RollbackOutlined', |
|
||||
title: t('org.wsp.framework.flowable.action.jump.task'), |
|
||||
enableIf: (selectedRecords) => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
return selectedRecords.length > 0; |
|
||||
}, |
|
||||
click: () => { |
|
||||
console.log('2'); |
|
||||
}, |
|
||||
}, |
|
||||
{ |
|
||||
icon: 'CloseCircleOutlined', |
|
||||
title: t('org.wsp.framework.flowable.action.terminate.processInstance'), |
|
||||
enableIf: (selectedRecords) => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
return selectedRecords.length > 0; |
|
||||
}, |
|
||||
click: () => { |
|
||||
const record = listGridRef?.value?.getSelectedRow(); |
|
||||
axios.post( |
|
||||
fc.apiContextPath + '/system/process/operation/terminateProcessInstance/' + record.id, |
|
||||
null |
|
||||
).then(() => { |
|
||||
notification.success({ |
|
||||
message: t('operationSuccess'), |
|
||||
duration:2 |
|
||||
}); |
|
||||
listGridRef?.value.refresh(); |
|
||||
}); |
|
||||
}, |
|
||||
} |
|
||||
]; |
|
||||
}); |
|
||||
|
|
||||
const selectedRowsChange = (selectedRecords) => { |
|
||||
if (selectedRecords && selectedRecords.length > 0) { |
|
||||
emit('selectedRowsChange', selectedRecords[0]); |
|
||||
} else { |
|
||||
emit('selectedRowsChange', null); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
const refresh = () => { |
|
||||
listGridRef.value.refresh(); |
|
||||
}; |
|
||||
|
|
||||
const afterCompleted = () => { |
|
||||
notification.success({ |
|
||||
message: t('operationSuccess'), |
|
||||
duration:2 |
|
||||
}); |
|
||||
listGridRef?.value.refresh(); |
|
||||
}; |
|
||||
|
|
||||
defineExpose({ |
|
||||
refresh, |
|
||||
}); |
|
||||
</script> |
|
@ -1,67 +0,0 @@ |
|||||
<template> |
|
||||
<a-modal |
|
||||
v-model:visible="visible" |
|
||||
:force-render="true" |
|
||||
:mask-closable="false" |
|
||||
:title="$t('org.wsp.framework.flowable.action.complete.task')" |
|
||||
> |
|
||||
<a-form |
|
||||
:model="formModelRef" |
|
||||
layout="horizontal" |
|
||||
:label-col="{ span: 6 }" |
|
||||
:wrapper-col="{ span: 18 }" |
|
||||
autocomplete="off" |
|
||||
> |
|
||||
<a-form-item name="variables" :label="$t('org.wsp.framework.flowable.instance.form.variables')"> |
|
||||
<a-textarea v-model:value="formModelRef.variables" :rows="6" /> |
|
||||
</a-form-item> |
|
||||
<a-form-item name="transientVariables" :label="$t('org.wsp.framework.flowable.instance.form.transientVariables')"> |
|
||||
<a-textarea v-model:value="formModelRef.transientVariables" :rows="6" /> |
|
||||
</a-form-item> |
|
||||
</a-form> |
|
||||
<template #footer> |
|
||||
<WorkflowAction |
|
||||
ref="workflowActionRef" |
|
||||
action-url="/system/process/operation/complete/" |
|
||||
@after-submit="afterSubmit" |
|
||||
> |
|
||||
</WorkflowAction> |
|
||||
</template> |
|
||||
</a-modal> |
|
||||
</template> |
|
||||
<script setup> |
|
||||
import { ref, reactive, onMounted } from 'vue'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import WorkflowAction from './WorkflowAction'; |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义事件 |
|
||||
*/ |
|
||||
const emit = defineEmits([ |
|
||||
'afterCompleted', // 提交成功后 |
|
||||
]); |
|
||||
|
|
||||
const { t } = useI18n(); |
|
||||
|
|
||||
const visible = ref(false); |
|
||||
const formModelRef = reactive({}); |
|
||||
const workflowActionRef = ref([]); |
|
||||
|
|
||||
const open = (taskId) => { |
|
||||
const transientVariables = {}; |
|
||||
transientVariables.task_treatment = '此处填写处理意见'; |
|
||||
formModelRef.transientVariables = JSON.stringify(transientVariables, null, 2); |
|
||||
workflowActionRef.value.setTaskId(taskId); |
|
||||
workflowActionRef.value.setDataRef(formModelRef); |
|
||||
visible.value = true; |
|
||||
}; |
|
||||
|
|
||||
const afterSubmit = (taskId) => { |
|
||||
visible.value = false; |
|
||||
emit('afterCompleted'); |
|
||||
}; |
|
||||
|
|
||||
defineExpose({ |
|
||||
open |
|
||||
}); |
|
||||
</script> |
|
@ -1,69 +0,0 @@ |
|||||
<template> |
|
||||
<a-modal |
|
||||
v-model:visible="visible" |
|
||||
:force-render="true" |
|
||||
:mask-closable="false" |
|
||||
:title="$t('org.wsp.framework.flowable.window.selectAssignee.title')" |
|
||||
centered |
|
||||
@ok="okHandle" |
|
||||
> |
|
||||
<a-space direction="vertical"> |
|
||||
<div>{{ t('org.wsp.framework.flowable.task.tip.selectAssignee') }}</div> |
|
||||
<a-form |
|
||||
:model="formModelRef" |
|
||||
layout="horizontal" |
|
||||
:label-col="{ span: 6 }" |
|
||||
:wrapper-col="{ span: 18 }" |
|
||||
autocomplete="off" |
|
||||
> |
|
||||
<a-form-item name="assignee" :label="$t('org.wsp.framework.flowable.task.entity.assignee')"> |
|
||||
<a-select v-model:value="formModelRef.assignee" :options="assigneeOptionsRef" /> |
|
||||
</a-form-item> |
|
||||
</a-form> |
|
||||
</a-space> |
|
||||
</a-modal> |
|
||||
</template> |
|
||||
<script setup> |
|
||||
import { |
|
||||
ref, reactive, toRaw, computed, onMounted |
|
||||
} from 'vue'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import { notification } from 'ant-design-vue'; |
|
||||
import { useFrameworkConfiguration, useAxios } from 'framework-core'; |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义事件 |
|
||||
*/ |
|
||||
const emit = defineEmits([ |
|
||||
'assigneeSelected', // 选择了候选人 |
|
||||
]); |
|
||||
|
|
||||
const fc = useFrameworkConfiguration(); |
|
||||
const axios = useAxios(); |
|
||||
const { t } = useI18n(); |
|
||||
|
|
||||
const visible = ref(false); |
|
||||
const formModelRef = reactive({}); |
|
||||
const assigneeOptionsRef = ref(null); |
|
||||
|
|
||||
const okHandle = () => { |
|
||||
emit('assigneeSelected', formModelRef.assignee); |
|
||||
visible.value = false; |
|
||||
}; |
|
||||
|
|
||||
const open = (assignees) => { |
|
||||
visible.value = true; |
|
||||
formModelRef.assignee = null; |
|
||||
const result = []; |
|
||||
if (assignees) { |
|
||||
for (let i = 0; i < assignees.length; i++) { |
|
||||
result.push({ value : assignees[i].loginName, label : assignees[i].loginName + '/' + assignees[i].userName, text : assignees[i].loginName + '/' + assignees[i].userName }); |
|
||||
} |
|
||||
} |
|
||||
assigneeOptionsRef.value = result; |
|
||||
}; |
|
||||
|
|
||||
defineExpose({ |
|
||||
open |
|
||||
}); |
|
||||
</script> |
|
@ -1,158 +0,0 @@ |
|||||
<template> |
|
||||
<div> |
|
||||
<a-button v-for="action in actionsRef" @click="buttonClick(action)">{{ action.title }}</a-button> |
|
||||
</div> |
|
||||
<SelectAssigneeDialog ref="selectAssigneeDialogRef" @assignee-selected="assigneeSelected"></SelectAssigneeDialog> |
|
||||
</template> |
|
||||
<script setup> |
|
||||
import { |
|
||||
ref, reactive, toRaw, computed, onMounted |
|
||||
} from 'vue'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import { useStore } from 'vuex'; |
|
||||
import { notification } from 'ant-design-vue'; |
|
||||
import { useFrameworkConfiguration, useAxios } from 'framework-core'; |
|
||||
import SelectAssigneeDialog from './SelectAssigneeDialog'; |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义属性 |
|
||||
*/ |
|
||||
const props = defineProps({ |
|
||||
// 获取回退按钮列表的 url,由系统自动提供,使用者无需指定 |
|
||||
gobackActionUrl : { type: String, default: '/system/process/operation/getGobacks/' }, |
|
||||
// 操作对应的服务器端控制器 url |
|
||||
actionUrl : { type: String, default: undefined }, |
|
||||
// 任务ID |
|
||||
taskId : { type: String, default: undefined }, |
|
||||
// 临时变量 |
|
||||
transientVariables : { type: Object, default: undefined }, |
|
||||
// 回退按钮默认宽度 |
|
||||
actionButtonWidth : { type: Number, default: 100 }, |
|
||||
// 默认按钮 |
|
||||
defaultActionButtons : { type: [Array, Object], default: undefined }, |
|
||||
// 默认按钮对齐方式 |
|
||||
defaultActionButtonsAlign : { type: String, default: 'right' }, |
|
||||
}); |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义事件 |
|
||||
*/ |
|
||||
const emit = defineEmits([ |
|
||||
'afterSubmit', // 提交成功后 |
|
||||
]); |
|
||||
|
|
||||
const fc = useFrameworkConfiguration(); |
|
||||
const store = useStore(); |
|
||||
const axios = useAxios(); |
|
||||
const { t } = useI18n(); |
|
||||
|
|
||||
const actionIdRef = ref(null); |
|
||||
const selectAssigneeDialogRef = ref(null); |
|
||||
|
|
||||
let dataRef = null; |
|
||||
let currentAction = null; |
|
||||
const actionsRef = reactive([]); |
|
||||
|
|
||||
const buildMembers = (gobacks) => { |
|
||||
actionsRef.splice(0, actionsRef.length); |
|
||||
|
|
||||
const members = []; |
|
||||
// 添加默认按钮(左边) |
|
||||
if (props.defaultActionButtonsAlign === 'left') { |
|
||||
if (props.defaultActionButtons && props.defaultActionButtons && props.defaultActionButtons.length > 0) { |
|
||||
for (let i = 0; i < props.defaultActionButtons.length; i++) { |
|
||||
members.push(props.defaultActionButtons[i]); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// 回退按钮 |
|
||||
if (gobacks) { |
|
||||
for (let i = 0; i < gobacks.length; i++) { |
|
||||
const goback = gobacks[i]; |
|
||||
const transientVariables = {}; |
|
||||
transientVariables[goback.variableName] = goback.variableValue; |
|
||||
members.push({ |
|
||||
title : goback.title || t('goback'), |
|
||||
transientVariables, |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// 提交按钮 |
|
||||
members.push({ title: t('submit') }); |
|
||||
|
|
||||
// 添加默认按钮(右边) |
|
||||
if (props.defaultActionButtonsAlign === 'right') { |
|
||||
if (props.defaultActionButtons && props.defaultActionButtons && props.defaultActionButtons.length > 0) { |
|
||||
for (let i = 0; i < props.defaultActionButtons.length; i++) { |
|
||||
members.push(props.defaultActionButtons[i]); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// 更新到响应式变量中 |
|
||||
for (let i = 0; i < members.length; i++) { |
|
||||
actionsRef.push(members[i]); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
const setTaskId = (taskId) => { |
|
||||
actionIdRef.value = taskId; |
|
||||
axios.get( |
|
||||
fc.apiContextPath + props.gobackActionUrl + taskId, |
|
||||
).then((data) => { |
|
||||
buildMembers(data.data); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const buttonClick = (action) => { |
|
||||
currentAction = action; |
|
||||
// 首先清除临时变量,为第二次提交初始化数据 |
|
||||
const transientVariables = {}; |
|
||||
|
|
||||
// 如果是点击了“回退”按钮,将回退控制变量付给临时变量 |
|
||||
axios.post( |
|
||||
fc.apiContextPath + props.actionUrl + actionIdRef.value, |
|
||||
action |
|
||||
).then((data) => { |
|
||||
const rawData = data.data; |
|
||||
if (rawData.code === 0) { // 操作成功 |
|
||||
emit('afterSubmit'); |
|
||||
} else if (rawData.code === 1) { // 需要选择处理人 |
|
||||
selectAssigneeDialogRef.value.open(rawData.assignees); |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const assigneeSelected = (assignee) => { |
|
||||
const data = currentAction; |
|
||||
if (dataRef.variables) { |
|
||||
data.variables = JSON.parse(dataRef.variables); |
|
||||
} |
|
||||
if (dataRef.transientVariables) { |
|
||||
data.transientVariables = JSON.parse(dataRef.transientVariables); |
|
||||
data.transientVariables.assignee = assignee; |
|
||||
} |
|
||||
axios.post( |
|
||||
fc.apiContextPath + props.actionUrl + actionIdRef.value, |
|
||||
data |
|
||||
).then((response) => { |
|
||||
const rawData = response.data; |
|
||||
if (rawData.code === 0) { // 操作成功 |
|
||||
emit('afterSubmit'); |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const setDataRef = (_dataRef) => { |
|
||||
if (_dataRef) { |
|
||||
dataRef = _dataRef; |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
defineExpose({ |
|
||||
setTaskId, |
|
||||
setDataRef |
|
||||
}); |
|
||||
</script> |
|
@ -1,158 +0,0 @@ |
|||||
<template> |
|
||||
<div :class="`flex ${align === 'right' ? 'justify-end' : ''} gap-4`"> |
|
||||
<q-btn v-for="action in actionsRef" :key="action.name" :label="action.title" color="primary" @click="buttonClick(action)"></q-btn> |
|
||||
</div> |
|
||||
<SelectAssigneeDialog ref="selectAssigneeDialogRef" @assignee-selected="assigneeSelected"></SelectAssigneeDialog> |
|
||||
</template> |
|
||||
<script setup lang="ts"> |
|
||||
import { ref, onMounted } from 'vue'; |
|
||||
import { useI18n } from 'vue-i18n'; |
|
||||
import { Environment, Tools, axios } from 'platform-core'; |
|
||||
import SelectAssigneeDialog from './SelectAssigneeDialog.vue'; |
|
||||
import { reactive } from 'vue'; |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义属性 |
|
||||
*/ |
|
||||
const props = defineProps({ |
|
||||
//任务 ID |
|
||||
taskId: { type: String, default: undefined }, |
|
||||
//数据对象 |
|
||||
data: { |
|
||||
type: Object, |
|
||||
default: () => { |
|
||||
return {}; |
|
||||
}, |
|
||||
}, |
|
||||
//对齐方式 |
|
||||
align: { type: String, default: 'center' }, |
|
||||
// 完成操作对应的服务器端控制器 url |
|
||||
actionUrl: { type: String, default: undefined }, |
|
||||
// 获取回退按钮列表的 url,由系统自动提供,使用者无需指定 |
|
||||
gobackActionUrl: { type: String, default: '/api/flowable/process/operation/getGobacks' }, |
|
||||
// 默认按钮 |
|
||||
defaultActionButtons: { type: [Array, Object], default: undefined }, |
|
||||
// 默认按钮放置位置 |
|
||||
defaultActionButtonsPlacement: { type: String, default: 'right' }, |
|
||||
// 是否 goback 按钮组采用下拉列表模式 |
|
||||
isGobackActionDropdown: { type: Boolean, default: false }, |
|
||||
}); |
|
||||
|
|
||||
/** |
|
||||
* 定义组件支持的自定义事件 |
|
||||
*/ |
|
||||
const emit = defineEmits([ |
|
||||
'afterSubmit', // 提交成功后 |
|
||||
]); |
|
||||
|
|
||||
const { t } = useI18n(); |
|
||||
const actionsRef = ref([]); |
|
||||
const selectAssigneeDialogRef = ref(); |
|
||||
const currentActionRef = ref(null); |
|
||||
|
|
||||
const buildActions = (taskId: string) => { |
|
||||
axios.get(Environment.apiContextPath(props.gobackActionUrl + '/' + taskId)).then((data) => { |
|
||||
buildButtons(data.data); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const buildButtons = (gobacks) => { |
|
||||
const buttons = []; |
|
||||
// 添加默认按钮(左边) |
|
||||
if (props.defaultActionButtonsPlacement === 'left') { |
|
||||
if (props.defaultActionButtons && props.defaultActionButtons && props.defaultActionButtons.length > 0) { |
|
||||
for (let i = 0; i < props.defaultActionButtons.length; i++) { |
|
||||
buttons.push(props.defaultActionButtons[i]); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// 回退按钮 |
|
||||
if (gobacks && gobacks.length > 0) { |
|
||||
for (let i = 0; i < gobacks.length; i++) { |
|
||||
const goback = gobacks[i]; |
|
||||
const transientVariables = {}; |
|
||||
transientVariables[goback.variableName] = goback.variableValue; |
|
||||
buttons.push({ |
|
||||
title: goback.title || t('goback'), |
|
||||
transientVariables, |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// 提交按钮 |
|
||||
buttons.push({ title: t('submit') }); |
|
||||
|
|
||||
// 添加默认按钮(右边) |
|
||||
if (props.defaultActionButtonsPlacement === 'right') { |
|
||||
if (props.defaultActionButtons && props.defaultActionButtons && props.defaultActionButtons.length > 0) { |
|
||||
for (let i = 0; i < props.defaultActionButtons.length; i++) { |
|
||||
buttons.push(props.defaultActionButtons[i]); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// 更新到响应式变量中 |
|
||||
actionsRef.value.splice(0, actionsRef.value.length); |
|
||||
for (let i = 0; i < buttons.length; i++) { |
|
||||
actionsRef.value.push(buttons[i]); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
const buttonClick = (action) => { |
|
||||
currentActionRef.value = action; |
|
||||
const data = { |
|
||||
variables: {}, |
|
||||
transientVariables: {}, |
|
||||
}; |
|
||||
if (!Tools.isUndefinedOrNull(props.data)) { |
|
||||
if (!Tools.isEmpty(props.data.variables)) { |
|
||||
data.variables = JSON.parse(props.data.variables); |
|
||||
} |
|
||||
if (!Tools.isEmpty(props.data.transientVariables)) { |
|
||||
data.transientVariables = JSON.parse(props.data.transientVariables); |
|
||||
} |
|
||||
} |
|
||||
if (!Tools.isUndefinedOrNull(action)) { |
|
||||
if (!Tools.isUndefinedOrNull(action.transientVariables)) { |
|
||||
Tools.mergeObject(data.transientVariables, action.transientVariables); |
|
||||
} |
|
||||
} |
|
||||
console.log(data); |
|
||||
|
|
||||
// 如果是点击了“回退”按钮,将回退控制变量付给临时变量 |
|
||||
axios.post(props.actionUrl + '/' + props.taskId, data).then((response) => { |
|
||||
if (response.data.code === 0) { |
|
||||
// 操作成功 |
|
||||
emit('afterSubmit'); |
|
||||
} else if (response.data.code === 1) { |
|
||||
// 需要选择处理人 |
|
||||
selectAssigneeDialogRef.value.open(response.data); |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
const assigneeSelected = (assignee) => { |
|
||||
const data = currentActionRef.value; |
|
||||
if (props.data.variables) { |
|
||||
data.variables = JSON.parse(props.data.variables); |
|
||||
} |
|
||||
if (props.data.transientVariables) { |
|
||||
data.transientVariables = JSON.parse(props.data.transientVariables); |
|
||||
data.transientVariables.assignee = assignee; |
|
||||
} |
|
||||
axios.post(Environment.apiContextPath(props.actionUrl + props.taskId), data).then((response) => { |
|
||||
const rawData = response.data; |
|
||||
if (rawData.code === 0) { |
|
||||
// 操作成功 |
|
||||
emit('afterSubmit'); |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
onMounted(() => { |
|
||||
if (props.taskId) { |
|
||||
buildActions(props.taskId); |
|
||||
} |
|
||||
}); |
|
||||
</script> |
|
Loading…
Reference in new issue