api.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. import axios from './request'
  2. // 用户登录接口
  3. export const userLogin = (data) => {
  4. return axios({
  5. method: 'post',
  6. url: '/admin/login',
  7. data
  8. })
  9. }
  10. // 获取项目列表
  11. export const getProjectList = (data) => {
  12. return axios({
  13. method: 'post',
  14. url: '/db/project/list',
  15. data
  16. })
  17. }
  18. // 新增/编辑项目
  19. export const addProject = (data) => {
  20. return axios({
  21. method: 'post',
  22. url: '/db/project/save',
  23. data
  24. })
  25. }
  26. // 删除项目
  27. export const delProject = (id) => {
  28. return axios({
  29. method: 'post',
  30. url: `/db/project/remove/${id}`
  31. })
  32. }
  33. // 通过id获取项目详情
  34. export const projectInfoById = (id) => {
  35. return axios({
  36. method: 'get',
  37. url: `/db/project/detail/${id}`
  38. })
  39. }
  40. // -----------------表相关
  41. // 获取表列表
  42. export const getTabletList = (data) => {
  43. return axios({
  44. method: 'post',
  45. url: '/db/table/getList',
  46. data
  47. })
  48. }
  49. // 删除表
  50. export const delTablet = (data) => {
  51. return axios({
  52. method: 'post',
  53. url: '/db/table/removes',
  54. data
  55. })
  56. }
  57. // 新增表
  58. export const addTable = (data) => {
  59. return axios({
  60. method: 'post',
  61. url: '/db/table/createTable',
  62. data
  63. })
  64. }
  65. // -----------------字段相关
  66. //获取字段列表
  67. export const getFieldData = (data) => {
  68. return axios({
  69. method: 'post',
  70. url: "/db/field/getList",
  71. data
  72. })
  73. }
  74. //添加表字段
  75. export const addField = (data) => {
  76. return axios({
  77. method: 'post',
  78. url: "/db/field/add",
  79. data
  80. })
  81. }
  82. //删除字段
  83. export const delField = (data) => {
  84. return axios({
  85. method: 'post',
  86. url: '/db/field/delField',
  87. data
  88. })
  89. }
  90. // 通过表id获取详细信息
  91. export const getInfoById = (tableId,data) => {
  92. return axios({
  93. method: 'post',
  94. url: `/db/record/getFieldData/${tableId}`,
  95. data
  96. })
  97. }
  98. // 新增数据
  99. export const recordInsert = (data) => {
  100. return axios({
  101. method: 'post',
  102. url: '/db/record/insert',
  103. data
  104. })
  105. }
  106. // 编辑数据
  107. export const recordUpdate = (data) => {
  108. return axios({
  109. method: 'post',
  110. url: '/db/record/update',
  111. data
  112. })
  113. }
  114. // 根据id获取数据详情
  115. export const recordDetail = (tableId,id) => {
  116. return axios({
  117. method: 'get',
  118. url: `/db/record/detail/${tableId}/${id}`,
  119. })
  120. }
  121. // 删除数据
  122. export const recordDel = (tableId,ids) => {
  123. return axios({
  124. method: 'get',
  125. url: `/db/record/del/${tableId}/${ids}`,
  126. })
  127. }
  128. // ---------------白名单相关
  129. // 列表
  130. export const ipGetList = (data) => {
  131. return axios({
  132. method: 'post',
  133. url: '/sys/ip/getList',
  134. data
  135. })
  136. }
  137. // 新增和编辑
  138. export const ipSave = (data) => {
  139. return axios({
  140. method: 'post',
  141. url: '/sys/ip/save',
  142. data
  143. })
  144. }
  145. // 删除
  146. export const ipRemoves = (ids) => {
  147. return axios({
  148. method: 'get',
  149. url: `/sys/ip/removes/${ids}`,
  150. })
  151. }
  152. // ----------------用户相关
  153. // 列表
  154. export const userList = (data) => {
  155. return axios({
  156. method: 'post',
  157. url: '/sys/user/list',
  158. data
  159. })
  160. }
  161. // 新增和编辑用户
  162. export const userSave = (data) => {
  163. return axios({
  164. method: 'post',
  165. url: '/sys/user/save',
  166. data
  167. })
  168. }
  169. // 删除用户
  170. export const userRemoves = (ids) => {
  171. return axios({
  172. method: 'get',
  173. url: `/sys/user/removes/${ids}`,
  174. })
  175. }
  176. // 重置密码
  177. export const userResetPass = (id) => {
  178. return axios({
  179. method: 'get',
  180. url: `/sys/user/resetPass/${id}`,
  181. })
  182. }
  183. // 修改密码
  184. export const userUpdatePwd = (data) => {
  185. return axios({
  186. method: 'post',
  187. url: '/sys/user/updatePwd',
  188. data
  189. })
  190. }
  191. // 获取用户详情
  192. export const userDetail = (id) => {
  193. return axios({
  194. method: 'get',
  195. url: `/sys/user/detail/${id}`,
  196. })
  197. }
  198. // 授权项目
  199. export const userAuth = (projectIds,userId) => {
  200. return axios({
  201. method: 'get',
  202. url: `/sys/user/auth/${projectIds}/${userId}`,
  203. })
  204. }