relationClass new.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. import request from '@/utils/request'
  2. /**
  3. * 获得指定实体类为起点的所有关系类列表
  4. * @param id
  5. * @returns {*}
  6. */
  7. //旧的getAllRelationClassList函数
  8. /* function getAllRelationClassList (id, entClsType) {
  9. return ajax({
  10. method: 'get',
  11. url: '/relcls/{id}/list',
  12. path: {
  13. id: id
  14. },
  15. data: {
  16. entClsType: entClsType,
  17. }
  18. })
  19. } */
  20. //新的getAllRelationClassList函数
  21. function getAllRelationClassList(id, entClsType) {
  22. return request({
  23. method: 'get',
  24. url: `/relcls/${id}/list`,
  25. params: {
  26. id: id,
  27. entClsType: entClsType,
  28. }
  29. })
  30. }
  31. /**
  32. * 删除关系类
  33. * @param id
  34. * @returns {*}
  35. */
  36. //旧的deleteRelationClass函数
  37. /* function deleteRelationClass (id) {
  38. return ajax({
  39. method: 'post',
  40. url: '/relcls/del/{id}',
  41. path: {
  42. id: id
  43. }
  44. })
  45. } */
  46. //新的deleteRelationClass函数
  47. function deleteRelationClass(id) {
  48. return request({
  49. method: 'post',
  50. url: `/relcls/del/${id}`,
  51. params: {
  52. id: id
  53. }
  54. })
  55. }
  56. /**
  57. * 通过名称获取所有关系类列表
  58. * @param name
  59. * @returns {*}
  60. */
  61. //旧的getAllRelationClassListByName函数
  62. /* function getAllRelationClassListByName (name, isModel, current, size) {
  63. return ajax({
  64. method: 'get',
  65. url: '/relcls/list',
  66. data: {
  67. name: name,
  68. current,
  69. size,
  70. isModel
  71. }
  72. })
  73. } */
  74. //新的getAllRelationClassListByName函数
  75. function getAllRelationClassListByName(name, isModel, current, size) {
  76. return request({
  77. method: 'get',
  78. url: `/relcls/list`,
  79. data: {
  80. name: name,
  81. current,
  82. size,
  83. isModel
  84. }
  85. })
  86. }
  87. /**
  88. * 修改一个关系类名
  89. * @param data
  90. * @returns {*}
  91. */
  92. //旧的editRelationClass函数
  93. /* function editRelationClass (data) {
  94. return ajax({
  95. method: 'post',
  96. url: '/relcls/update',
  97. data: data
  98. })
  99. } */
  100. //新的editRelationClass函数
  101. function editRelationClass(data) {
  102. return request({
  103. method: 'post',
  104. url: `/relcls/update`,
  105. data: data
  106. })
  107. }
  108. /**
  109. * 添加一个关系类
  110. * @param data
  111. * @returns {*}
  112. */
  113. //旧的addRelationClass函数
  114. /* function addRelationClass (data) {
  115. return ajax({
  116. method: 'post',
  117. url: '/relcls/add',
  118. data: data
  119. })
  120. } */
  121. //新的addRelationClass函数
  122. function addRelationClass(data) {
  123. return request({
  124. method: 'post',
  125. url: `/relcls/add`,
  126. data: data
  127. })
  128. }
  129. /**
  130. * 新建实体关系
  131. * @param data
  132. * @returns {*}
  133. */
  134. //旧的addEntityRelation函数
  135. /* function addEntityRelation (data) {
  136. return ajax({
  137. method: 'post',
  138. url: '/rel/add',
  139. data: data
  140. })
  141. } */
  142. //新的addEntityRelation函数
  143. function addEntityRelation(data) {
  144. return request({
  145. method: 'post',
  146. url: `/rel/add`,
  147. data: data
  148. })
  149. }
  150. /**
  151. * 删除实体关系
  152. * @param relID, isModel
  153. * @returns {*}
  154. */
  155. //旧的deleteEntityRelation函数
  156. /* function deleteEntityRelation (relID, isModel) {
  157. return ajax({
  158. method: 'post',
  159. url: '/rel/del/{id}',
  160. path: {
  161. id: relID
  162. },
  163. data: {
  164. id: relID,
  165. isModel
  166. }
  167. })
  168. } */
  169. //新的deleteEntityRelation函数
  170. function deleteEntityRelation(relID, isModel) {
  171. return request({
  172. method: 'post',
  173. url: `/rel/del/${id}`,
  174. params: {
  175. id: relID,
  176. isModel
  177. }
  178. })
  179. }
  180. /**
  181. * 查找所有关系类
  182. * */
  183. //旧的getAllRelationClass函数
  184. /* function getAllRelationClass () {
  185. return ajax({
  186. method: 'post',
  187. url: '/relcls/getall'
  188. })
  189. } */
  190. //新的getAllRelationClass函数
  191. function getAllRelationClass() {
  192. return request({
  193. method: 'post',
  194. url: `/relcls/getall`
  195. })
  196. }
  197. /**
  198. * 批量新增实体关系
  199. * */
  200. //旧的addRelBatch函数
  201. /* function addRelBatch (data) {
  202. return ajax({
  203. method: 'post',
  204. url: '/rel/add/batch',
  205. data: data
  206. })
  207. } */
  208. //新的addRelBatch函数
  209. function addRelBatch(data) {
  210. return request({
  211. method: 'post',
  212. url: `/rel/add/batch`,
  213. data: data
  214. })
  215. }
  216. /**
  217. * 查询此关系类所指向实体类还未有关联的实体列表
  218. * @param relClsId direction isModel current size
  219. * @returns {*}
  220. */
  221. //旧的getEntityListByEntityClassId函数
  222. /* function getRelclsUnpoint(relClsId, direction, entId, isModel, current, size) {
  223. return ajax({
  224. method: 'get',
  225. url: '/relcls/{direction}/{relClsId}/unpoint/{entId}',
  226. data: {
  227. current,
  228. size,
  229. isModel
  230. },
  231. path: {
  232. direction,
  233. relClsId,
  234. entId
  235. }
  236. })
  237. } */
  238. //新的getEntityListByEntityClassId函数
  239. function getRelclsUnpoint(relClsId, direction, entId, isModel, current, size) {
  240. return request({
  241. method: 'get',
  242. url: `/relcls/${direction}/${relClsId}/unpoint/${entId}`,
  243. params: {
  244. current,
  245. size,
  246. isModel,
  247. direction,
  248. relClsId,
  249. entId
  250. }
  251. })
  252. }
  253. /**
  254. * 查询此关系类所指向实体类还未有关联的实体列表(带属性类)
  255. * @param relClsId direction isModel current size
  256. * @returns {*}
  257. */
  258. //旧的getEntityListByEntityClassId函数
  259. /* function getRelclsEnt(relClsId, direction, entId, isModel, entName, current, size) {
  260. return ajax({
  261. method: 'get',
  262. url: '/relcls/{direction}/{relClsId}/ent/{entId}',
  263. data: {
  264. entName,
  265. current,
  266. size,
  267. isModel
  268. },
  269. path: {
  270. direction,
  271. relClsId,
  272. entId
  273. }
  274. })
  275. } */
  276. //新的getEntityListByEntityClassId函数
  277. function getRelclsEnt(relClsId, direction, entId, isModel, entName, current, size) {
  278. return request({
  279. method: 'get',
  280. url: `/relcls/${direction}/${relClsId}/ent/${entId}`,
  281. params: {
  282. entName,
  283. current,
  284. size,
  285. isModel,
  286. direction,
  287. relClsId,
  288. entId
  289. }
  290. })
  291. }
  292. /**
  293. * 批量编辑实体关系
  294. * */
  295. //旧的editRelBatch函数
  296. /* function editRelBatch(data) {
  297. return ajax({
  298. method: 'post',
  299. url: '/relattr/update/batch',
  300. data: data
  301. })
  302. } */
  303. //新的editRelBatch函数
  304. function editRelBatch(data) {
  305. return request({
  306. method: 'post',
  307. url: `/relattr/update/batch`,
  308. data: data
  309. })
  310. }
  311. export {
  312. addRelationClass,
  313. getAllRelationClassList,
  314. deleteRelationClass,
  315. getAllRelationClassListByName,
  316. editRelationClass,
  317. deleteEntityRelation,
  318. addEntityRelation,
  319. getAllRelationClass,
  320. addRelBatch,
  321. getRelclsUnpoint,
  322. editRelBatch,
  323. getRelclsEnt
  324. }