positionSequence.js 803 B

12345678910111213141516171819202122232425262728
  1. import Vue from "vue";
  2. import { get } from "@/utils/request";
  3. // 岗位序列状态:1-启用 / 0-停用
  4. export const SEQUENCE_STATUS_LABEL = {
  5. 1: "启用",
  6. 0: "停用",
  7. 启用: "启用",
  8. 停用: "停用",
  9. };
  10. /**
  11. * 查询岗位序列列表(仅启用)
  12. * GET /hr/positionSequence/getPositionSequenceList
  13. */
  14. export async function getPositionSequenceList() {
  15. const res = await get(
  16. Vue.prototype.apiUrl + "/hr/positionSequence/getPositionSequenceList"
  17. );
  18. if (res.code == 0) return Array.isArray(res.data) ? res.data : [];
  19. return [];
  20. }
  21. /** 岗位层级按 levelGrade 升序(数值越大层级越高) */
  22. export function sortLevelsByGrade(levels) {
  23. if (!Array.isArray(levels)) return [];
  24. return levels.slice().sort((a, b) => (a.levelGrade || 0) - (b.levelGrade || 0));
  25. }