relationClass.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import ajax from '../util'
  2. /**
  3. * 获得指定实体类为起点的所有关系类列表
  4. * @param id
  5. * @returns {*}
  6. */
  7. function getAllRelationClassList (id, entClsType) {
  8. return ajax({
  9. method: 'get',
  10. url: '/relcls/{id}/list',
  11. path: {
  12. id: id
  13. },
  14. data: {
  15. entClsType: entClsType,
  16. }
  17. })
  18. }
  19. /**
  20. * 删除关系类
  21. * @param id
  22. * @returns {*}
  23. */
  24. function deleteRelationClass (id) {
  25. return ajax({
  26. method: 'post',
  27. url: '/relcls/del/{id}',
  28. path: {
  29. id: id
  30. }
  31. })
  32. }
  33. /**
  34. * 通过名称获取所有关系类列表
  35. * @param name
  36. * @returns {*}
  37. */
  38. function getAllRelationClassListByName (name, isModel, current, size) {
  39. return ajax({
  40. method: 'get',
  41. url: '/relcls/list',
  42. data: {
  43. name: name,
  44. current,
  45. size,
  46. isModel
  47. }
  48. })
  49. }
  50. /**
  51. * 修改一个关系类名
  52. * @param data
  53. * @returns {*}
  54. */
  55. function editRelationClass (data) {
  56. return ajax({
  57. method: 'post',
  58. url: '/relcls/update',
  59. data: data
  60. })
  61. }
  62. /**
  63. * 添加一个关系类
  64. * @param data
  65. * @returns {*}
  66. */
  67. function addRelationClass (data) {
  68. return ajax({
  69. method: 'post',
  70. url: '/relcls/add',
  71. data: data
  72. })
  73. }
  74. /**
  75. * 新建实体关系
  76. * @param data
  77. * @returns {*}
  78. */
  79. function addEntityRelation (data) {
  80. return ajax({
  81. method: 'post',
  82. url: '/rel/add',
  83. data: data
  84. })
  85. }
  86. /**
  87. * 删除实体关系
  88. * @param relID, isModel
  89. * @returns {*}
  90. */
  91. function deleteEntityRelation (relID, isModel) {
  92. return ajax({
  93. method: 'post',
  94. url: '/rel/del/{id}',
  95. path: {
  96. id: relID
  97. },
  98. data: {
  99. id: relID,
  100. isModel
  101. }
  102. })
  103. }
  104. /**
  105. * 查找所有关系类
  106. * */
  107. function getAllRelationClass () {
  108. return ajax({
  109. method: 'post',
  110. url: '/relcls/getall'
  111. })
  112. }
  113. /**
  114. * 批量新增实体关系
  115. * */
  116. function addRelBatch (data) {
  117. return ajax({
  118. method: 'post',
  119. url: '/rel/add/batch',
  120. data: data
  121. })
  122. }
  123. /**
  124. * 查询此关系类所指向实体类还未有关联的实体列表
  125. * @param relClsId direction isModel current size
  126. * @returns {*}
  127. */
  128. function getRelclsUnpoint(relClsId, direction, entId, isModel, current, size) {
  129. return ajax({
  130. method: 'get',
  131. url: '/relcls/{direction}/{relClsId}/unpoint/{entId}',
  132. data: {
  133. current,
  134. size,
  135. isModel
  136. },
  137. path: {
  138. direction,
  139. relClsId,
  140. entId
  141. }
  142. })
  143. }
  144. /**
  145. * 查询此关系类所指向实体类还未有关联的实体列表(带属性类)
  146. * @param relClsId direction isModel current size
  147. * @returns {*}
  148. */
  149. function getRelclsEnt(relClsId, direction, entId, isModel, entName, current, size) {
  150. return ajax({
  151. method: 'get',
  152. url: '/relcls/{direction}/{relClsId}/ent/{entId}',
  153. data: {
  154. entName,
  155. current,
  156. size,
  157. isModel
  158. },
  159. path: {
  160. direction,
  161. relClsId,
  162. entId
  163. }
  164. })
  165. }
  166. /**
  167. * 批量编辑实体关系
  168. * */
  169. function editRelBatch (data) {
  170. return ajax({
  171. method: 'post',
  172. url: '/relattr/update/batch',
  173. data: data
  174. })
  175. }
  176. export {
  177. addRelationClass,
  178. getAllRelationClassList,
  179. deleteRelationClass,
  180. getAllRelationClassListByName,
  181. editRelationClass,
  182. deleteEntityRelation,
  183. addEntityRelation,
  184. getAllRelationClass,
  185. addRelBatch,
  186. getRelclsUnpoint,
  187. editRelBatch,
  188. getRelclsEnt
  189. }