index.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. "use strict"
  2. if (!Object.values) Object.values = function (obj) {
  3. if (obj !== Object(obj))
  4. throw new TypeError('Object.values called on a non-object');
  5. var val = [], key;
  6. for (key in obj) {
  7. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  8. val.push(obj[key]);
  9. }
  10. }
  11. return val;
  12. }
  13. var PLG_BUTTON = {
  14. value: {
  15. addBtn: function () {
  16. return '<i class="layui-icon layui-icon-add-1" style="color:#467cfd"></i>' + _t("新增")
  17. },
  18. delBtn: function () {
  19. return '<i class="layui-icon layui-icon-delete"></i>' + _t("删除")
  20. },
  21. alldelBtn: function () {
  22. return '<i class="layui-icon layui-icon-delete"></i>' + _t("批量删除")
  23. },
  24. logBtn: function () {
  25. return '<i class="layui-icon layui-icon-log" style="color:#467cfd"></i>' + _t("日志")
  26. },
  27. editBtn: function () {
  28. return '<i class="layui-icon layui-icon-edit" style="color:#467cfd"></i>' + _t("编辑")
  29. },
  30. saveBtn: function () {
  31. return '<i class="iconfont p-icon-save" style="font-size: 14px;" ></i> ' + _t("保存")
  32. },
  33. importBtn: function () {
  34. return '<i class="iconfont p-icon-daoru" style="color:#467cfd"></i> ' + _t("导入")
  35. },
  36. exportBtn: function () {
  37. return '<i class="iconfont p-icon-daochu" style="color:#467cfd"></i> ' + _t("导出")
  38. },
  39. downBtn: function () {
  40. return '<i class="iconfont p-icon-xiazaimoban" style="color:#467cfd"></i> ' + _t("模版")
  41. },
  42. searchBtn: function () {
  43. return '<i class="layui-icon layui-icon-search" style="color:#467cfd"></i>' + _t("查询")
  44. },
  45. resetBtn: function () {
  46. return '<i class="layui-icon layui-icon-refresh-1" style="color:#467cfd"></i>' + _t("重置")
  47. }
  48. },
  49. warehouseId: {
  50. type: "hidden",
  51. name: "warehouseId",
  52. notToggle: true
  53. }
  54. }
  55. var APIS = Object.create({ base_url: '/api' }, {})
  56. //资源管理
  57. APIS.resource = {
  58. //查询资源,添加资源
  59. getResource: function () {
  60. return this.base_url + "/service-authorization/resource"
  61. }.bind(APIS),
  62. getList: function () {
  63. return this.getResource() + "/list"
  64. },
  65. //查询所有服务名【自动加载】
  66. getSysNames: function () {
  67. return this.getResource() + "/instance/names"
  68. },
  69. //根据服务名查询所有接口【自动加载】
  70. getNameByList: function () {
  71. return this.getResource() + "/instance"
  72. },
  73. //导入服务接口【自动加载】
  74. importInterface: function () {
  75. return this.getResource() + "/importinstance"
  76. },
  77. //删除资源
  78. delete: function () {
  79. return this.getResource() + "/delete"
  80. },
  81. //多个删除资源
  82. deleteAll: function () {
  83. return this.delete() + "/multiple"
  84. },
  85. //修改资源
  86. update: function () {
  87. return this.getResource() + "/update"
  88. },
  89. // 导出Excel数据
  90. export: function () {
  91. return this.getResource() + "/export"
  92. },
  93. // 导入模版
  94. import: function () {
  95. return this.getResource() + "/import"// 【批量导入】
  96. },
  97. // 下载模版下载
  98. download: function () {
  99. return this.getResource() + "/download/template"// 【导入模版下载】
  100. },
  101. //没有分配的资源
  102. listnotingroup:function(){
  103. return this.getResource() + "/listnotingroup"
  104. },
  105. //分配的资源
  106. listbygroup:function(){
  107. return this.getResource() + "/listbygroup"
  108. },
  109. //根据clientid分页查询资源
  110. listbyclient: function () {
  111. return this.getResource() + "/listbyclient"
  112. },
  113. //根据客户端id查询不包含的资源
  114. notlistbyclient: function () {
  115. return this.getResource() + "/listnotinclient"
  116. }
  117. }
  118. //资源组管理
  119. APIS.groupResource = {
  120. getList: function () {
  121. //return this.base_url + "/data/mock/resource/groupResource.json"
  122. return this.base_url + "/service-authorization/group"
  123. }.bind(APIS),
  124. //添加资源
  125. addRes: function () {
  126. return this.getList() + "/recources/add"
  127. },
  128. //删除资源
  129. removeRes: function () {
  130. return this.getList() + "/resource/remove"
  131. },
  132. //添加资源组
  133. groupAdd: function () {
  134. return this.getList() + "/add"
  135. },
  136. groupDelete: function () {
  137. return this.getList() + "/delete"
  138. },
  139. update() {
  140. return this.getList() + "/update"
  141. },
  142. //根据clientid分页查询资源下组
  143. listbyclient: function () {
  144. return this.getList() + "/listbyclient"
  145. },
  146. //根据客户端id查询不包含的资源组
  147. notlistbyclient: function () {
  148. return this.getList() + "/listothersbyclient"
  149. },
  150. };
  151. //用户资源
  152. APIS.client={
  153. authmgr: function () {
  154. return this.base_url + "/service-authorization/authmgr"
  155. }.bind(APIS),
  156. update:function () {
  157. return this.authmgr() + "/update"
  158. },
  159. getAuthmgr:function(){
  160. return this.authmgr() + "/like"
  161. },
  162. addAuthmgr:function(){
  163. return this.authmgr() + "/add"
  164. },
  165. deleteAuthmgr:function(){
  166. return this.authmgr() + "/delete"
  167. },
  168. //分配资源
  169. addResource:function(){
  170. return this.authmgr() + "/resource/add"
  171. },
  172. //删除资源
  173. removeResource:function(){
  174. return this.authmgr() + "/resource/remove"
  175. },
  176. //分配资源组
  177. addGroup:function(){
  178. return this.authmgr() + "/group/add"
  179. },
  180. //删除资源组
  181. removeGroup:function(){
  182. return this.authmgr() + "/group/remove"
  183. },
  184. //激活客户端
  185. active:function(){
  186. return this.authmgr() + "/active"
  187. },
  188. //解冻客户端
  189. unfreeze:function(){
  190. return this.authmgr() + "/unfreeze"
  191. },
  192. //冻结客户端
  193. freeze:function(){
  194. return this.authmgr() + "/freeze"
  195. },
  196. //重置初始密码
  197. resetpassword:function(){
  198. return this.authmgr() + "/resetpassword"
  199. },
  200. //更新密码
  201. updatepassword:function(){
  202. return this.authmgr() + "/updatepassword"
  203. },
  204. //重置权限
  205. refreshauths:function(){
  206. return this.authmgr() + "/refreshauths"
  207. }
  208. }
  209. APIS.home={
  210. statistics: function () {
  211. return this.base_url + "/service-authorization/statistics"
  212. }.bind(APIS),
  213. userStatus:function(){
  214. return this.statistics()+"/distribute/auclient"
  215. },
  216. entry:function(){
  217. return this.statistics()+"/entry/resource/count"
  218. },
  219. service:function(){
  220. return this.statistics()+"/entry/service/count"
  221. },
  222. reginstance:function(){
  223. return this.statistics()+"/reg/instance/count"
  224. },
  225. regService:function(){
  226. return this.statistics()+"/reg/service/count"
  227. },
  228. distribute:function(){
  229. return this.statistics()+"/distribute/resource"
  230. }
  231. }
  232. //服务器管理
  233. APIS.settings={
  234. server:{
  235. serviceDevopsbackstage:function () {
  236. return "/api/service-devopsbackstage"
  237. }.bind(APIS),
  238. /*请求列表*/
  239. serverinfo: function () {
  240. return this.serviceDevopsbackstage() + "/serverinfo"
  241. },
  242. getAllServers:function () {
  243. return this.serverinfo()+"/getAllServers"
  244. },
  245. instanceInfo:function () {
  246. return this.serviceDevopsbackstage() + "/instanceInfo"
  247. },
  248. //部署
  249. setArrange:function () {
  250. return this.instanceInfo()+"/arrange"
  251. },
  252. //启动容器
  253. toggleContainer:function () {
  254. return this.instanceInfo()+"/startStopContainer"
  255. },
  256. },
  257. }
  258. APIS.languageGroup={
  259. zh_CN:"简体中文",
  260. en:"English"
  261. };
  262. APIS.lang={
  263. baseUrl: function () {
  264. return APIS.base_url + "/service-internationalize"
  265. },
  266. getMenu:function(){
  267. return this.baseUrl() + "/menu/getMenu"
  268. },
  269. language:function(){
  270. return this.baseUrl() + "/language"
  271. },
  272. languageDel:function(){
  273. return this.baseUrl() + "/language/del"
  274. },
  275. languageGetAll:function(){
  276. return this.baseUrl() + "/language/getAll"
  277. },
  278. pageItem:function(){
  279. return this.baseUrl() + "/pageItem"
  280. },
  281. pageItemDel:function(){
  282. return this.baseUrl() + "/pageItem/del"
  283. },
  284. pageLanguage:function(){
  285. return this.baseUrl() + "/pageLanguage"
  286. }
  287. }