3 changed files with 87 additions and 1 deletions
@ -0,0 +1,84 @@
@@ -0,0 +1,84 @@
|
||||
<template> |
||||
<BasicModal |
||||
v-bind="$attrs" |
||||
title="退回任务" |
||||
minHeight="100px" |
||||
@ok="handleSubmit" |
||||
@register="registerModal" |
||||
> |
||||
<Form :model="modelRef" :rules="rulesRef"> |
||||
<FormItem name="rollBackTaskDefKey" |
||||
:wrapperCol="{ style: { padding:'8px' } }" |
||||
v-bind="validateInfos.rollBackTaskDefKey" |
||||
> |
||||
<ApiSelect v-model:value="modelRef.rollBackTaskDefKey" |
||||
:api="rollBackTaskList" |
||||
:params="{ taskId: modelRef.taskId }" |
||||
labelField="taskName" |
||||
valueField="taskDefKey" |
||||
/> |
||||
</FormItem> |
||||
</Form> |
||||
</BasicModal> |
||||
</template> |
||||
|
||||
<script lang="ts" setup> |
||||
/** |
||||
* 提供模板规范代码参考,请尽量保证编写代码风格跟模板规范代码一致 |
||||
* 采用ant-design-vue原生组件编写表单,采用 setup 写法 |
||||
* Copyright © 2023-2023 <a href="https://godolphinx.org">海豚生态开源社区</a> All rights reserved. |
||||
* author wangxiang4 |
||||
*/ |
||||
import { reactive } from 'vue'; |
||||
import { BasicModal, ModalProps, useModalInner } from '/@/components/Modal'; |
||||
import { Form } from 'ant-design-vue'; |
||||
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
import { rollBackTaskList } from '/@/api/platform/workflow/controller/task'; |
||||
import { ApiSelect } from '/@/components/Form'; |
||||
|
||||
interface WindowState { |
||||
taskId: string; |
||||
rollBackTaskDefKey: string; |
||||
} |
||||
|
||||
const { createMessage } = useMessage(); |
||||
const emit = defineEmits(['success', 'register']); |
||||
const FormItem = Form.Item; |
||||
const useForm = Form.useForm; |
||||
const modelRef = reactive<WindowState>({ |
||||
taskId: '', |
||||
rollBackTaskDefKey: '', |
||||
}); |
||||
|
||||
const rulesRef = reactive<Recordable>({ |
||||
rollBackTaskDefKey: [ |
||||
{ |
||||
required: true, |
||||
whitespace: true, |
||||
message: '请选择驳回节点!', |
||||
} |
||||
] |
||||
}); |
||||
const { resetFields, clearValidate, validate, validateInfos } = useForm(modelRef, rulesRef); |
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner( (data: BoxPayload) => { |
||||
resetFields(); |
||||
clearValidate(); |
||||
modelRef.taskId = data.taskId; |
||||
const props: Partial<ModalProps> = { confirmLoading: false }; |
||||
setModalProps(props); |
||||
}); |
||||
|
||||
/** 处理模态框提交 */ |
||||
async function handleSubmit() { |
||||
try { |
||||
// 验证数据 |
||||
await validate(); |
||||
// 处理提交之前逻辑 |
||||
setModalProps({ confirmLoading: true }); |
||||
closeModal(); |
||||
emit('success', modelRef.rollBackTaskDefKey); |
||||
} finally { |
||||
setModalProps({ confirmLoading: false }); |
||||
} |
||||
} |
||||
</script> |
Loading…
Reference in new issue