mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vue3.git
synced 2025-12-30 01:22:27 +00:00
Merge pull request #210 from zhanglc0618/feature-oa-recreate
feat: 【bpm】bpmn设计器: 业务表单流程添加重新发起功能
This commit is contained in:
@@ -6,6 +6,7 @@ export type ProcessDefinitionVO = {
|
|||||||
deploymentTIme: string
|
deploymentTIme: string
|
||||||
suspensionState: number
|
suspensionState: number
|
||||||
formType?: number
|
formType?: number
|
||||||
|
formCustomCreatePath?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ModelVO = {
|
export type ModelVO = {
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ defineOptions({ name: 'BpmOALeaveCreate' })
|
|||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { delView } = useTagsViewStore() // 视图操作
|
const { delView } = useTagsViewStore() // 视图操作
|
||||||
const { push, currentRoute } = useRouter() // 路由
|
const { push, currentRoute } = useRouter() // 路由
|
||||||
|
const { query } = useRoute() // 查询参数
|
||||||
|
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
@@ -190,6 +191,26 @@ const daysDifference = () => {
|
|||||||
return Math.floor(diffTime / oneDay)
|
return Math.floor(diffTime / oneDay)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取请假数据,用于重新发起时自动填充 */
|
||||||
|
const getLeaveData = async (id: number) => {
|
||||||
|
try {
|
||||||
|
formLoading.value = true
|
||||||
|
const data = await LeaveApi.getLeave(id)
|
||||||
|
if (!data) {
|
||||||
|
message.error('重新发起请假失败,原因:请假数据不存在')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
formData.value = {
|
||||||
|
type: data.type,
|
||||||
|
reason: data.reason,
|
||||||
|
startTime: data.startTime,
|
||||||
|
endTime: data.endTime
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 初始化 */
|
/** 初始化 */
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// TODO @小北:这里可以简化,统一通过 getApprovalDetail 处理么?
|
// TODO @小北:这里可以简化,统一通过 getApprovalDetail 处理么?
|
||||||
@@ -205,6 +226,11 @@ onMounted(async () => {
|
|||||||
processDefinitionId.value = processDefinitionDetail.id
|
processDefinitionId.value = processDefinitionDetail.id
|
||||||
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
|
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
|
||||||
|
|
||||||
|
// 如果有业务编号,说明是重新发起,需要加载原有数据
|
||||||
|
if (query.id) {
|
||||||
|
await getLeaveData(Number(query.id))
|
||||||
|
}
|
||||||
|
|
||||||
// 审批相关:加载最新的审批详情,主要用于节点预测
|
// 审批相关:加载最新的审批详情,主要用于节点预测
|
||||||
await getApprovalDetail()
|
await getApprovalDetail()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -140,6 +140,15 @@
|
|||||||
>
|
>
|
||||||
取消
|
取消
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.status !== 1"
|
||||||
|
v-hasPermi="['bpm:oa-leave:create']"
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="handleReCreate(scope.row)"
|
||||||
|
>
|
||||||
|
重新发起
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -206,6 +215,16 @@ const handleCreate = () => {
|
|||||||
router.push({ name: 'OALeaveCreate' })
|
router.push({ name: 'OALeaveCreate' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 重新发起操作 */
|
||||||
|
const handleReCreate = (row: LeaveApi.LeaveVO) => {
|
||||||
|
router.push({
|
||||||
|
name: 'OALeaveCreate',
|
||||||
|
query: {
|
||||||
|
id: row.id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/** 详情操作 */
|
/** 详情操作 */
|
||||||
const handleDetail = (row: LeaveApi.LeaveVO) => {
|
const handleDetail = (row: LeaveApi.LeaveVO) => {
|
||||||
router.push({
|
router.push({
|
||||||
|
|||||||
@@ -275,21 +275,26 @@ const resetQuery = () => {
|
|||||||
|
|
||||||
/** 发起流程操作 **/
|
/** 发起流程操作 **/
|
||||||
const handleCreate = async (row?: ProcessInstanceVO) => {
|
const handleCreate = async (row?: ProcessInstanceVO) => {
|
||||||
// 如果是【业务表单】,不支持重新发起
|
|
||||||
if (row?.id) {
|
if (row?.id) {
|
||||||
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(
|
const processDefinitionDetail = await DefinitionApi.getProcessDefinition(
|
||||||
row.processDefinitionId
|
row.processDefinitionId
|
||||||
)
|
)
|
||||||
|
//如果是【业务表单】,跳转到对应的发起界面
|
||||||
if (processDefinitionDetail.formType === 20) {
|
if (processDefinitionDetail.formType === 20) {
|
||||||
message.error('重新发起流程失败,原因:该流程使用业务表单,不支持重新发起')
|
await router.push({
|
||||||
return
|
path: processDefinitionDetail.formCustomCreatePath,
|
||||||
|
query: {
|
||||||
|
id: row.businessKey
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else if (processDefinitionDetail.formType === 10) {
|
||||||
|
//如果是【流程表单】,跳转到流程发起界面
|
||||||
|
await router.push({
|
||||||
|
name: 'BpmProcessInstanceCreate',
|
||||||
|
query: { processInstanceId: row.id }
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 跳转发起流程界面
|
|
||||||
await router.push({
|
|
||||||
name: 'BpmProcessInstanceCreate',
|
|
||||||
query: { processInstanceId: row?.id }
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 查看详情 */
|
/** 查看详情 */
|
||||||
|
|||||||
Reference in New Issue
Block a user