Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/views/bpm/oa/leave/create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ defineOptions({ name: 'BpmOALeaveCreate' })
const message = useMessage() // 消息弹窗
const { delView } = useTagsViewStore() // 视图操作
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外:流程审批界面那,应该也有个重新发起。可以也加下哈。

const { push, currentRoute } = useRouter() // 路由
const { query } = useRoute() // 查询参数
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formData = ref({
Expand Down Expand Up @@ -190,6 +191,25 @@ const daysDifference = () => {
return Math.floor(diffTime / oneDay)
}
/** 获取请假数据,用于重新发起时自动填充 */
const getLeaveData = async (id: number) => {
formLoading.value = true
const data = await LeaveApi.getLeave(id)
if(!data){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!data) {

代码排版注意下哈。

message.error('重新发起请假失败,原因:请假数据不存在')
return
}
if (data) {
formData.value = {
type: data.type,
reason: data.reason,
startTime: data.startTime,
endTime: data.endTime
}
}
formLoading.value = false
}
/** 初始化 */
onMounted(async () => {
// TODO @小北:这里可以简化,统一通过 getApprovalDetail 处理么?
Expand All @@ -205,6 +225,11 @@ onMounted(async () => {
processDefinitionId.value = processDefinitionDetail.id
startUserSelectTasks.value = processDefinitionDetail.startUserSelectTasks
// 如果有业务编号,说明是重新发起,需要加载原有数据
if (query.id) {
await getLeaveData(Number(query.id))
}
// 审批相关:加载最新的审批详情,主要用于节点预测
await getApprovalDetail()
})
Expand Down
20 changes: 20 additions & 0 deletions src/views/bpm/oa/leave/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@
>
取消
</el-button>
<el-button
v-if="scope.row.status !== 1"
v-hasPermi="['bpm:oa-leave:create']"
link
type="primary"
@click="handleReInitiate(scope.row)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单词用 recreate 更好哈。

>
重新发起
</el-button>
</template>
</el-table-column>
</el-table>
Expand Down Expand Up @@ -206,6 +215,17 @@ const handleCreate = () => {
router.push({ name: 'OALeaveCreate' })
}
/** 重新发起操作 */
const handleReInitiate = (row: LeaveApi.LeaveVO) => {
router.push({
name: 'OALeaveCreate',
query: {
id: row.id,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就传递 oldId 噶。

然后,processInstanceId 不传递。因为 oldId 可以查询到流程编号噶。

processInstanceId: row.processInstanceId
}
})
}
/** 详情操作 */
const handleDetail = (row: LeaveApi.LeaveVO) => {
router.push({
Expand Down