index.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import request from "@/utils/request";
  2. import { AxiosPromise } from "axios";
  3. import { CaptchaResult, LoginData, LoginResult } from "./types";
  4. /**
  5. * 登录API
  6. *
  7. * @param data {LoginData}
  8. * @returns
  9. */
  10. export function loginApi(data: LoginData): AxiosPromise<LoginResult> {
  11. // const formData = new FormData();
  12. // formData.append("userName", data.username);
  13. // formData.append("password", data.password);
  14. // formData.append("captchaKey", data.captchaKey || "");
  15. // formData.append("captchaCode", data.captchaCode || "");
  16. return request({
  17. url: "/api/auth/aioLogin",
  18. method: "post",
  19. data: data,
  20. // headers: {
  21. // "Content-Type": "multipart/form-data",
  22. // },
  23. });
  24. }
  25. /**
  26. * 注销API
  27. */
  28. export function logoutApi() {
  29. return request({
  30. url: "/api/auth/loginOut",
  31. method: "post",
  32. });
  33. }
  34. /**
  35. * 获取验证码
  36. */
  37. export function getCaptchaApi(): AxiosPromise<CaptchaResult> {
  38. return request({
  39. url: "/api/v1/auth/captcha",
  40. method: "get",
  41. });
  42. }
  43. export function getOrgListApi(): AxiosPromise<any[]> {
  44. return request({
  45. url: "/api/v1/sys/dept/orgList",
  46. method: "get",
  47. });
  48. }
  49. //产线管理列表查询
  50. export function getProductionList(): AxiosPromise<any[]> {
  51. return request({
  52. url: "/api/v1/base/productionLine/list/list",
  53. method: "post",
  54. data: {},
  55. });
  56. }
  57. // 一体机登录通过产线code获取工位信息
  58. export function stationListByCode(
  59. code: string,
  60. type: number = 2
  61. ): AxiosPromise<any[]> {
  62. return request({
  63. url: `/api/v1/base/station/getStationList/${code}/${type}`,
  64. method: "get",
  65. });
  66. }
  67. /**
  68. * 登录成功后获取用户字典
  69. */
  70. export function getUserDicts(data: string[]): AxiosPromise {
  71. return request({
  72. url: "/api/v1/sys/dictData/queryByTypes",
  73. method: "post",
  74. data: data,
  75. });
  76. }
  77. // 用户信息列表查询
  78. export function getUserList(): AxiosPromise {
  79. return request({
  80. url: "/api/v1/sys/user/list",
  81. method: "post",
  82. data: {},
  83. });
  84. }