gaoluyang
2 天以前 f1cb99b6650d2ff22d421489c0cf0da5d7d569ec
fix(hrm): 离职提交前选择审批流程并传 processDefinitionKey

离职提交接口 /hrm/resignation/submit 要求 processDefinitionKey,前端一直只传 id,
导致生产提交必报「请求参数缺失:processDefinitionKey」。改为与请假/加班一致:
先拉取可用流程定义,弹窗选择后再提交。

Co-Authored-By: Claude Code <noreply@anthropic.com>
已修改2个文件
68 ■■■■■ 文件已修改
src/api/hrm/resignation/index.ts 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/hrm/resignation/index.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/hrm/resignation/index.ts
@@ -24,6 +24,12 @@
    remark?: string;
    createTime?: string;
  }
  /** 审批流程 */
  export interface ApproveProcess {
    key: string;
    name: string;
  }
}
/** 查询离职申请分页列表 */
@@ -57,8 +63,10 @@
}
/** 提交离职申请(发起审批) */
export function submitResignation(id: number) {
  return requestClient.post(`/hrm/resignation/submit?id=${id}`);
export function submitResignation(id: number, processDefinitionKey: string) {
  return requestClient.post('/hrm/resignation/submit', null, {
    params: { id, processDefinitionKey },
  });
}
/** 撤销离职申请 */
@@ -73,5 +81,7 @@
/** 获取可用流程定义列表 */
export function getResignationApproveProcessDefinitionList() {
  return requestClient.get<any[]>('/hrm/resignation/approve-process-definition-list');
}
  return requestClient.get<HrmResignationApi.ApproveProcess[]>(
    '/hrm/resignation/approve-process-definition-list',
  );
}
src/views/hrm/resignation/index.vue
@@ -2,14 +2,17 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { HrmResignationApi } from '#/api/hrm/resignation';
import { ref } from 'vue';
import { Page, useVbenModal } from '#/packages/effects/common-ui/src';
import { message } from 'ant-design-vue';
import { message, Modal, Select } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import {
  cancelResignation,
  deleteResignation,
  getResignationApproveProcessDefinitionList,
  getResignationPage,
  submitResignation,
  updateHandoverStatus,
@@ -59,11 +62,34 @@
  }
}
/** 提交离职申请 */
const submitModalVisible = ref(false);
const currentRow = ref<HrmResignationApi.Resignation>();
const processList = ref<HrmResignationApi.ApproveProcess[]>([]);
const selectedProcessKey = ref<string>();
const submitLoading = ref(false);
/** 提交离职申请(先选择审批流程) */
async function handleSubmit(row: HrmResignationApi.Resignation) {
  await submitResignation(row.id!);
  message.success('提交成功');
  handleRefresh();
  processList.value = await getResignationApproveProcessDefinitionList();
  currentRow.value = row;
  selectedProcessKey.value = undefined;
  submitModalVisible.value = true;
}
async function confirmSubmit() {
  if (!selectedProcessKey.value) {
    message.warning('请选择离职审批流程');
    return;
  }
  submitLoading.value = true;
  try {
    await submitResignation(currentRow.value!.id!, selectedProcessKey.value);
    message.success('提交成功');
    submitModalVisible.value = false;
    handleRefresh();
  } finally {
    submitLoading.value = false;
  }
}
/** 撤销离职申请 */
@@ -186,5 +212,19 @@
        />
      </template>
    </Grid>
    <Modal
      v-model:open="submitModalVisible"
      title="提交至协同办公"
      width="420px"
      :confirm-loading="submitLoading"
      @ok="confirmSubmit"
    >
      <Select
        v-model:value="selectedProcessKey"
        class="w-full"
        placeholder="请选择离职审批流程"
        :options="processList.map((item) => ({ label: item.name, value: item.key }))"
      />
    </Modal>
  </Page>
</template>