common.js 2.7 KB

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