common.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import { postJ, post, get } from '@/utils/request'
  2. import Vue from 'vue'
  3. /**
  4. * 登录
  5. */
  6. export async function login(data) {
  7. const res = await postJ(Vue.prototype.apiUrl + '/main/user/login', data)
  8. if (res.code == 0) {
  9. return res
  10. }
  11. return Promise.reject(res.message)
  12. }
  13. /**
  14. * 获取用户信息
  15. */
  16. export async function getLoginUser(data) {
  17. const res = await get(Vue.prototype.apiUrl + '/system/account/getLoginUser', data)
  18. if (res.code == 0) {
  19. return res.data
  20. }
  21. return Promise.reject(res.message)
  22. }
  23. // 公司名称
  24. export async function usName() {
  25. const data = await get(Vue.prototype.apiUrl + `/pda/mes/us/indexName`)
  26. if (data.code == 0) {
  27. return data.data
  28. }
  29. return Promise.reject(data.message)
  30. }
  31. // 工序列表
  32. export async function producetaskList() {
  33. const data = await get(Vue.prototype.apiUrl + `/main/producetask/list`)
  34. if (data.code == 0) {
  35. return data.data
  36. }
  37. return Promise.reject(data.message)
  38. }
  39. /**
  40. * 查询机构列表
  41. * @param params 查询条件
  42. */
  43. export async function listOrganizations(params) {
  44. const res = await get(Vue.prototype.apiUrl + `/main/group/getGroupList`, params)
  45. console.log(res.code, '=====')
  46. if (res.code == 0) {
  47. return res.data
  48. }
  49. return Promise.reject(new Error(res.message))
  50. }
  51. /**
  52. * 查询人员列表
  53. * @param params 查询条件
  54. */
  55. export async function getUserPage(params) {
  56. // let par = new URLSearchParams(params);
  57. const res = await get(Vue.prototype.apiUrl + `/main/user/getUserPage`, params)
  58. if (res.code == 0) {
  59. return res.data
  60. }
  61. return Promise.reject(new Error(res.message))
  62. }
  63. /**
  64. * 获取所有用户
  65. *
  66. */
  67. export async function listAllUserBind() {
  68. const res = await get(Vue.prototype.apiUrl + `/main/user/listAllUserBind`)
  69. if (res.code == 0) {
  70. return res.data
  71. }
  72. return Promise.reject(new Error(res.message))
  73. }
  74. /**
  75. * 获取部门所有父级
  76. *
  77. */
  78. export async function getParentIdListByDeptId(id) {
  79. const res = await get(Vue.prototype.apiUrl + `/main/group/getParentIdListById/${id}`)
  80. if (res.code == 0) {
  81. return res.data
  82. }
  83. return Promise.reject(new Error(res.message))
  84. }