entity.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. import ajax from '../util'
  2. /**
  3. * 根据实体类id获取实体列表
  4. * @param id
  5. * @returns {*}
  6. */
  7. function getEntityListByEntityClassId(id, data) {
  8. return ajax({
  9. method: 'get',
  10. url: '/ent/{id}/list',
  11. path: {
  12. id: id,
  13. },
  14. data: {
  15. id: id,
  16. },
  17. })
  18. }
  19. /**
  20. * 删除实体
  21. * @param id
  22. * @returns {*}
  23. */
  24. function delEntityById(id, isModel) {
  25. return ajax({
  26. method: 'post',
  27. url: '/ent/del/ids',
  28. data: {
  29. ids: id,
  30. isModel,
  31. },
  32. })
  33. }
  34. // 原有的删除接口,没有调用成功
  35. // function delEntityById (id) {
  36. // return ajax({
  37. // method: 'post',
  38. // url: '/ent/del/{id}',
  39. // path: {
  40. // id:id
  41. // }
  42. // })
  43. // }
  44. /**
  45. * 批量删除实体
  46. * @param ids
  47. * @returns {*}
  48. */
  49. function delEntityByIds(ids) {
  50. return ajax({
  51. method: 'post',
  52. url: '/ent/del/ids',
  53. data: {
  54. ids: ids,
  55. },
  56. })
  57. }
  58. /**
  59. * 添加实体
  60. * @param entClsID
  61. * @param entName
  62. * @returns {*}
  63. */
  64. function addEntity(
  65. entClsID,
  66. entName,
  67. entMemo,
  68. entIcon,
  69. notNullAttrVOList,
  70. isModel
  71. ) {
  72. return ajax({
  73. method: 'post',
  74. url: '/ent/add',
  75. headers: { 'Content-Type': 'application/json;charset=UTF-8' },
  76. data: {
  77. entClsID: entClsID,
  78. entMemo: entMemo,
  79. entName: entName,
  80. entIcon: entIcon,
  81. notNullAttrVOList: notNullAttrVOList, // 必填属性列表
  82. isModel,
  83. },
  84. json: true,
  85. })
  86. }
  87. /**
  88. * 根据实体id获取实体详情
  89. * @param id
  90. * @returns {*}
  91. */
  92. function getEntityDetailById(id, isModel) {
  93. return ajax({
  94. method: 'get',
  95. url: '/ent/{id}',
  96. path: {
  97. id: id,
  98. },
  99. data: {
  100. isModel,
  101. },
  102. })
  103. }
  104. /**
  105. * 实体修改接口
  106. * @param entID
  107. * @param entName
  108. * @returns {*}
  109. */
  110. function updateEntityName(entID, entName, entMemo, entIcon, isModel) {
  111. return ajax({
  112. method: 'post',
  113. url: '/ent/update',
  114. data: {
  115. entID: entID,
  116. entMemo: entMemo, // 可选择传不传
  117. entName: entName,
  118. entIcon: entIcon,
  119. isModel,
  120. },
  121. })
  122. }
  123. /**
  124. * 通过实体名字查询实体类
  125. * @param entName
  126. * @returns {*}
  127. */
  128. function searchEntClsByEntName(entName) {
  129. return ajax({
  130. method: 'get',
  131. url: 'ent/search/entclses',
  132. data: {
  133. entName: entName,
  134. },
  135. })
  136. }
  137. /**
  138. *待审属性删除接口
  139. * @param attrClsID
  140. * @returns {*}
  141. */
  142. function deleteAttrClassNone(attrClsID, isModel) {
  143. return ajax({
  144. method: 'post',
  145. url: '/attrcls/none/del/{attrClsID}',
  146. path: {
  147. attrClsID: attrClsID,
  148. },
  149. data: {
  150. attrClsID: attrClsID,
  151. isModel,
  152. },
  153. })
  154. }
  155. /**
  156. *待审属性新增属性
  157. * @param entID
  158. * @param attrValue
  159. * @param attrClsName
  160. * @param valueType
  161. * @returns {*}
  162. */
  163. function addEntNoneAttr(data) {
  164. return ajax({
  165. method: 'post',
  166. url: '/attr/add/none',
  167. data: {
  168. entID: data.entID,
  169. attrClsMemo: data.attrClsMemo,
  170. attrClsName: data.attrClsName,
  171. attrUnit: data.attrUnit,
  172. attrValue: data.attrValue,
  173. valueType: data.valueType,
  174. isModel: data.isModel,
  175. },
  176. })
  177. }
  178. //
  179. /**
  180. * 实体待审属性查找接口
  181. * @param entID
  182. * @returns {*}
  183. */
  184. function getEntNoneList(entID, pagenum, pagesize, isModel) {
  185. return ajax({
  186. method: 'post',
  187. url: '/attr/none/list',
  188. data: {
  189. entID: entID,
  190. pagenum: pagenum,
  191. pagesize: pagesize,
  192. isModel,
  193. },
  194. })
  195. }
  196. /**
  197. * 待审属性类调整中的查询
  198. * @param attrClsID
  199. * @returns {*}
  200. */
  201. function getAttrClassAdjustSearch(attrClsID) {
  202. return ajax({
  203. method: 'post',
  204. url: '/attrcls/none/attrs',
  205. data: {
  206. attrClsID: attrClsID,
  207. },
  208. })
  209. }
  210. /**
  211. * 待审属性名称修改接口
  212. * @param data
  213. * @returns {*}
  214. */
  215. function updateAttrNoneName(data) {
  216. return ajax({
  217. method: 'post',
  218. url: '/attr/none/update',
  219. data: data,
  220. })
  221. }
  222. /**
  223. * 参照创建模板
  224. * @param entReferenceQuery : {
  225. "delEntIds": [
  226. "string"
  227. ],
  228. "entIcon": "string",
  229. "entMemo": "string",
  230. "entName": "string",
  231. "isModel": true,
  232. "modelId": "string",
  233. "suffix": "string"
  234. }
  235. * @returns {*}
  236. */
  237. function addReferenceEnt(entReferenceQuery) {
  238. return ajax({
  239. method: 'post',
  240. url: '/ent/reference/add',
  241. data: entReferenceQuery,
  242. })
  243. }
  244. /**
  245. * 根据某一实体,关联出他的一定度数的数据
  246. * @param id, degree, delEntIds, direction, isModel, entClsIDs, relClsIDs
  247. * @returns {*}
  248. */
  249. function getRelationEnt(
  250. id,
  251. degree,
  252. delEntIds,
  253. direction="BOTH",
  254. isModel,
  255. entClsIDs,
  256. entName,
  257. relClsIDs,
  258. limitNum=3,
  259. entConditionQueries=[]
  260. ) {
  261. return ajax({
  262. method: 'post',
  263. url: '/show/graph',
  264. data: {
  265. entId: id,
  266. degree,
  267. delEntIds,
  268. direction,
  269. isModel,
  270. entName,
  271. relClsIDs,
  272. limitNum,
  273. entConditionQueries: entConditionQueries
  274. },
  275. headers: { 'Content-Type': 'application/json;charset=UTF-8' },
  276. json: true,
  277. })
  278. }
  279. /*
  280. let data = {
  281. degree: this.degreeCache,
  282. delEntIds: this.getDelEntIdsString(),
  283. direction: direction,
  284. entId: id,
  285. entName: name,
  286. relClsIDs: this.linkClassCache,
  287. limitNum: 3,
  288. isModel: false,
  289. entConditionQueries: entConditionQueries
  290. }
  291. */
  292. function getChart(data) {
  293. return ajax({
  294. method: 'post',
  295. url: '/show/graph',
  296. data: data,
  297. headers: { 'Content-Type': 'application/json;charset=UTF-8' },
  298. json: true,
  299. })
  300. }
  301. /**
  302. * 根据实体类,获取关系类
  303. * @param id, degree, delEntIds, direction, isModel
  304. * @returns {*}
  305. */
  306. function getRelationClsByEntCls(id) {
  307. return ajax({
  308. method: 'get',
  309. url: '/relcls/all/list/{id}',
  310. path: {
  311. id,
  312. },
  313. })
  314. }
  315. /**
  316. * 根据关系类获取树形
  317. * @param entId, relClsId, direction, isModel, current, size
  318. * @returns {*}
  319. */
  320. function getRelationAttr(entId, relClsId, direction, isModel, current, size) {
  321. return ajax({
  322. method: 'get',
  323. url: '/entcls/{direction}/{relClsId}/{entId}',
  324. path: {
  325. entId,
  326. relClsId,
  327. direction,
  328. },
  329. data: {
  330. current,
  331. isModel,
  332. size,
  333. },
  334. })
  335. }
  336. /**
  337. * 保存基础属性/能力属性
  338. * @param data
  339. * @returns {*}
  340. */
  341. function saveEntAttr(data) {
  342. return ajax({
  343. method: 'post',
  344. url: '/ent/update/batch',
  345. data: data,
  346. })
  347. }
  348. /**
  349. * 集成服务导出接口1
  350. * @param data
  351. * @returns {*}
  352. */
  353. function exportUnionid() {
  354. return ajax({
  355. method: 'post',
  356. url: '/ent/batch/unionid',
  357. data: {
  358. noTimeout: true,
  359. },
  360. })
  361. }
  362. /**
  363. * 集成服务导出接口2
  364. * @returns {*}
  365. */
  366. function exportOmsUpload() {
  367. return ajax({
  368. method: 'post',
  369. url: '/oms/media/upload',
  370. data: {
  371. noTimeout: true,
  372. },
  373. })
  374. }
  375. export {
  376. updateAttrNoneName,
  377. getAttrClassAdjustSearch,
  378. addEntNoneAttr,
  379. getEntNoneList,
  380. deleteAttrClassNone,
  381. searchEntClsByEntName,
  382. getEntityListByEntityClassId,
  383. delEntityById,
  384. addEntity,
  385. getEntityDetailById,
  386. updateEntityName,
  387. delEntityByIds,
  388. addReferenceEnt,
  389. getRelationEnt,
  390. getRelationClsByEntCls,
  391. getRelationAttr,
  392. saveEntAttr,
  393. exportUnionid,
  394. exportOmsUpload,
  395. getChart,
  396. }