iPortalQueryMyResources.html 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631
  1. <!--********************************************************************
  2. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3. *********************************************************************-->
  4. <!DOCTYPE html>
  5. <html lang="en">
  6. <head>
  7. <meta charset="UTF-8">
  8. <title data-i18n="resources.title_iPortalQueryMyResources"></title>
  9. <style>
  10. .container-wrap {
  11. padding-left: 200px!important;
  12. }
  13. .gallery-item {
  14. margin-bottom: 30px;
  15. }
  16. .gallery-item-border {
  17. border: 1px solid #dadada;
  18. -webkit-box-shadow: 0px 2px 3px #dcdcdc;
  19. box-shadow: 0px 2px 3px #dcdcdc;
  20. background: white;
  21. }
  22. .gallery-item-img {
  23. height: 170px !important;
  24. width: 262px !important;
  25. }
  26. .resourcesDetails {
  27. height: 21px;
  28. overflow: hidden;
  29. text-overflow: ellipsis;
  30. white-space: nowrap;
  31. font-size: 14px !important;
  32. color: #7c7c7c;
  33. }
  34. .title-checkbox-container p{
  35. max-width: 160px;
  36. float: left;
  37. }
  38. .title-checkbox-container input{
  39. float: right;
  40. }
  41. .operate-btn-container , .title-checkbox-container{
  42. width: 100%;
  43. height: 33px;
  44. padding: 0 17px;
  45. }
  46. .operate-btn-container a:nth-child(1){
  47. float: left;
  48. }
  49. .operate-btn-container a:nth-child(2){
  50. float: right;
  51. }
  52. #plottingPanel {
  53. float: left;
  54. background: #ffffff;
  55. width: 250px;
  56. height: 100%;
  57. border: 1px solid #3473b7;
  58. }
  59. .datagrid-cell {
  60. word-break: break-all;
  61. white-space: normal!important;
  62. }
  63. .tabs-container ,.tabs-panels,.panel-body{
  64. height: auto!important;
  65. }
  66. .panel-title {
  67. margin-top: 0!important;
  68. margin-bottom: 0!important;
  69. font-size: 16px!important;
  70. color: inherit!important;
  71. }
  72. .input-group-addon {
  73. cursor: pointer;
  74. }
  75. .tab-content {
  76. max-height: 500px;
  77. overflow-y: auto;
  78. }
  79. .tab-pane {
  80. margin-top: 12px;
  81. }
  82. .choose {
  83. display: block;
  84. margin: 12px 0;
  85. }
  86. </style>
  87. </head>
  88. <body style=" margin: 0;overflow: auto;background: #F2F2F2;width: 100%;height:100%;position: absolute;top: 0;">
  89. <!-- 删除资源模态框(Modal) -->
  90. <div class="modal fade" tabindex="-1" role="dialog" id="deleteModel">
  91. <div class="modal-dialog" role="document">
  92. <div class="modal-content">
  93. <div class="modal-header">
  94. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  95. <h4 class="modal-title" data-i18n="resources.title_delete_resources"></h4>
  96. </div>
  97. <div class="modal-body">
  98. <p data-i18n="resources.title_confirm_delete_resources"></p>
  99. </div>
  100. <div class="modal-footer">
  101. <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="resources.text_close"></button>
  102. <button type="button" class="btn btn-primary" onclick="requestDeleteUrl()" data-i18n="resources.text_confirm"></button>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- 共享资源模态框(Modal) -->
  108. <div class="modal fade" id="shareModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  109. <div class="modal-dialog">
  110. <div class="modal-content">
  111. <div class="modal-header">
  112. <div class="modal-header">
  113. <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="removeUser()"><span aria-hidden="true">&times;</span></button>
  114. <h4 class="modal-title" data-i18n="resources.title_share_setting"></h4>
  115. </div>
  116. </div>
  117. <table class="table table-bordered col-md-6">
  118. <tbody>
  119. <!--共享设置-->
  120. <tr>
  121. <td>
  122. <div class="col-md-10 col-md-offset-1">
  123. <form class="form-horizontal">
  124. <fieldset>
  125. <ul class="nav nav-tabs" role="tablist">
  126. <li role="presentation" class="active">
  127. <a href="#public" aria-controls="public" role="tab" data-toggle="tab" data-i18n="resources.title_iPortalQueryResourcesPublic"></a>
  128. </li>
  129. <li role="presentation">
  130. <a href="#group" aria-controls="group" role="tab" data-toggle="tab" data-i18n="resources.title_iPortalQueryResourcesGroup"></a>
  131. </li>
  132. <li role="presentation">
  133. <a href="#department" aria-controls="department" role="tab" data-toggle="tab" data-i18n="resources.title_iPortalQueryResourcesDepartment"></a>
  134. </li>
  135. <li role="presentation">
  136. <a href="#user" aria-controls="user" role="tab" data-toggle="tab" data-i18n="resources.title_iPortalQueryResourcesUser"></a>
  137. </li>
  138. </ul>
  139. <div class="tab-content">
  140. <div role="tabpanel" class="tab-pane active" id="public">
  141. </div>
  142. <div role="tabpanel" class="tab-pane" id="group">
  143. <table border="1" bordercolor="black" width="100%">
  144. <thead id="group_thead">
  145. </thead>
  146. <tbody id="group_tbody">
  147. </tbody>
  148. </table>
  149. </div>
  150. <div role="tabpanel" class="tab-pane" id="user">
  151. <div class="input-group" style="margin-top: 12px;width: 100%;">
  152. <input type="text" class="form-control" data-i18n="[placeholder]resources.text_input_user_name" id="add-user-val">
  153. <span class="input-group-addon" onclick="searchUser()" data-i18n="resources.btn_add"></span>
  154. </div>
  155. <span data-i18n="resources.text_choose_user" class="choose"></span>
  156. <table border="1" bordercolor="black" width="100%">
  157. <thead id="user_thead">
  158. </thead>
  159. <tbody id="user_tbody">
  160. </tbody>
  161. </table>
  162. </div>
  163. <div role="tabpanel" class="tab-pane" id="department">
  164. <span data-i18n="resources.text_choose_department" class="choose"></span>
  165. <table border="1" bordercolor="black" width="100%">
  166. <thead id="department_thead">
  167. </thead>
  168. <tbody id="department_tbody">
  169. </tbody>
  170. </table>
  171. </div>
  172. </div>
  173. </fieldset>
  174. </form>
  175. </div>
  176. </td>
  177. </tr>
  178. </tbody>
  179. </table>
  180. <div class="modal-footer">
  181. <button type="button" class="btn btn-default" data-dismiss="modal" data-i18n="resources.text_close" onclick="removeUser()">
  182. </button>
  183. <button type="button" class="btn btn-primary" onclick="requestShareUrl()" data-i18n="resources.btn_save">
  184. </button>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. <!-- 详情 属性面板Dom -->
  190. <div id="plottingPanel">
  191. <div class="easyui-panel" style="position:absolute;top:0px;bottom:0px;left:0px;right:0px;padding:5px; width: 100%;">
  192. <div class="easyui-tabs" style="width: 100%;height: 100%" id="edit-and-detail-plot">
  193. <div id="iPortalDetailPanel" data-i18n="[title]resources.text_detailPanel" style="overflow: hidden"></div>
  194. <div id="plotPanel" data-i18n="[title]resources.text_attributePanel" style="overflow: hidden"></div>
  195. </div>
  196. </div>
  197. </div>
  198. <!-- 资源过滤 and 资源展示 -->
  199. <div style="margin-bottom: 100px">
  200. <div id="toolbar" class="panel panel-primary" style="position: absolute;top: 10px;right: 70px;text-align: center;z-index: 800;border-radius: 4px;">
  201. <div class='panel-heading' id="panelheading">
  202. <h5 class='panel-title text-center' data-i18n="resources.title_iPortalQueryMyResources"></h5>
  203. </div>
  204. <div class='panel-body content' id="panelbodycontent">
  205. <!-- 资源类型选择 -->
  206. <div class='input-group' style="width: 220px">
  207. <span class='input-group-addon' data-i18n="resources.title_iPortalQueryResourcesType"></span>
  208. <select class='form-control' id='typeSelect' onchange="onSelectResourcesType()">
  209. <option value="MAP" data-i18n="resources.title_iPortalQueryResourcesMap"></option>
  210. <option value="SERVICE" data-i18n="resources.title_iPortalQueryResourcesService"></option>
  211. <option value="SCENE" data-i18n="resources.title_iPortalQueryResourcesScene"></option>
  212. <option value="DATA" data-i18n="resources.title_iPortalQueryResourcesData"></option>
  213. <option value="INSIGHTS_WORKSPACE" data-i18n="resources.title_iPortalQueryResourcesInsights"></option>
  214. <option value="MAP_DASHBOARD" data-i18n="resources.title_iPortalQueryResourcesDashboards"></option>
  215. </select>
  216. </div>
  217. </div>
  218. </div>
  219. <br />
  220. <div class="container container-wrap">
  221. <div class="col-md-10">
  222. <div class="row">
  223. <div class="col-md-12">
  224. <div class="operate-list">
  225. <input type='button' class="btn btn-default" onclick="deleteResource()" data-i18n="[value]resources.text_input_value_delete"/>
  226. <input type='button' class="btn btn-default" onclick="shareResource()" data-i18n="[value]resources.title_share_setting"/>
  227. </div>
  228. <!--所有资源的承载DIV-->
  229. <div class="row" id="resourcesList">
  230. <!--单个资源数据的可视化承载DIV 添加在此位置中-->
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. </div>
  237. <script type="text/javascript" include="jquery,bootstrap,plottingPanel,widgets" src="../js/include-web.js"></script>
  238. <script type="text/javascript" include="iclient-plot-leaflet" src="../../dist/leaflet/include-leaflet.js"></script>
  239. <script type="text/javascript" include="iPortalStylePanel" src="../js/plottingPanel/PlottingPanel.Include.js"></script>
  240. <script>
  241. //iportal的URL地址 或根据情况添加自己的本地iportal地址:http://localhost:8091/iportal
  242. var iPortalUrl = "https://iportal.supermap.io/iportal";
  243. var token = "MFEKl8kVmkvEDrDFcgnjodlPCudIO83mBSwvdjiUlWNnySGD-FCEyYEk4CsY2WnSCujfAs8HI0ZkSL6Vxa-njg..";
  244. //默认请求资源类型
  245. var resourceType = "MAP";
  246. //全局变量,承载请求后,一共有多少页数
  247. var queryParams = new SuperMap.iPortalQueryParam({
  248. resourceType: resourceType,
  249. pageSize: 15,
  250. currentPage: 1,
  251. searchType:'MY_RES'
  252. });
  253. //资源查询初始化工作
  254. var iPortal;
  255. var isShowLogin = true;
  256. var deleteIds = [];//批量删除id
  257. var shareIds = [];//批量共享设置id
  258. var itemData = {};//某条资源的详细信息
  259. //公开权限共享实体参数
  260. var publicSettingEntity = {
  261. "permissionType": "",
  262. "entityType": "USER",
  263. "entityName": "GUEST",
  264. "entityId": null,
  265. "authorizeList": []
  266. }
  267. // 用户权限共享实体参数
  268. var usersSettingEntities = [];
  269. // 部门权限共享实体参数
  270. var departmentSettingEntities = [];
  271. // 群组权限共享实体参数
  272. var groupsSettingEntities = [];
  273. // 用户的登陆信息对象
  274. var userStateObj = {};
  275. // 群组列表
  276. var groupList = [];
  277. $(document).ready(function () {
  278. generatePortalToken();
  279. });
  280. // 申请,注册token并查询
  281. function generatePortalToken() {
  282. var serverInfo = new SuperMap.ServerInfo(SuperMap.ServerType.IPORTAL, {
  283. server: iPortalUrl
  284. });
  285. SuperMap.SecurityManager.registerServers([serverInfo]);
  286. SuperMap.SecurityManager.destroyToken(iPortalUrl);
  287. SuperMap.SecurityManager.registerToken(iPortalUrl, token);
  288. //加载完DOM后,开始资源数据查询并添加
  289. iPortal = new SuperMap.iPortal(iPortalUrl);
  290. queryResouces(queryParams);
  291. }
  292. //获取用户的登陆信息
  293. function getLoginUserInfos() {
  294. var url = iPortalUrl + "/web/config/userprofile.json?token=" + token;
  295. $.get(url,(res)=>{
  296. userStateObj = res;
  297. })
  298. }
  299. // 查询iPortal中的资源
  300. function queryResouces(queryParams) {
  301. iPortal.queryResources(queryParams).then(function (resourcesReslut) {
  302. //返回的结果集,需要查看可打开下行代码
  303. // console.log(resourcesReslut);
  304. // 切换资源类型 清空之前的资源DOM
  305. $("#resourcesList").children().remove();
  306. //将结果集进行遍历,并添加到HTML中
  307. $.each(resourcesReslut.content, function (i) {
  308. var resourceItem = resourcesReslut.content[i];
  309. var thumbnail = resourceItem.thumbnail;
  310. // 此判断获取部分相对路径的default图片
  311. if(thumbnail.indexOf("./") === 0){
  312. thumbnail = iPortalUrl + thumbnail.replace("./","/");
  313. }
  314. var resourcesDOM = $("<div class='col-xs-10 col-md-6 col-lg-4 gallery-item' id='map'>" +
  315. "<div class='gallery-item-border'>" +
  316. "<a class='thumbnail' style='margin-bottom: 10px'>" +
  317. "<img class='gallery-item-img' src='" + thumbnail + "' alt=''>" +
  318. "</a>" +
  319. "<div>" +
  320. "<div class='title-checkbox-container'>"+
  321. "<p class='resourcesDetails'>" + resourceItem.name + "</p>" +
  322. "<input type='checkbox' class='floatLeft' id='preferenceCheck' name='checkbox' value='"+resourceItem.resourceId+"'/>" +
  323. "</div>"+
  324. "<div>" +
  325. "<div class='operate-btn-container'>"+
  326. "<a href='#' class='delete' onclick='deleteResource("+resourceItem.resourceId +")'>"+resources.text_input_value_delete+"</a>" +
  327. "<a href='#' id='detail' onclick='viewResource("+resourceItem.resourceId+")'>"+resources.title_view_detail+"</a>"+
  328. "</div>"+
  329. "<div class='operate-btn-container'>"+
  330. "<a href='#' class='edit' onclick='editResource("+resourceItem.resourceId+","+resourceItem.resourceId+")'>"+resources.title_edit_attr+"</a>"+
  331. "<a href='#' class='edit' onclick='shareResource("+resourceItem.resourceId+")'>"+resources.title_share_setting+"</a>"+
  332. "</div>"+
  333. "</div>" +
  334. "</div>")
  335. $("#resourcesList").append(resourcesDOM);
  336. });
  337. }).catch (()=>{
  338. widgets.alert.showAlert(resources.msg_query_failed, false);
  339. })
  340. };
  341. //获取多选CheckBox资源的id值 给(删除 和 共享资源 使用)
  342. function getDeleteAndShareCheckArr(){
  343. var checkDataEle = document.getElementsByName("checkbox");
  344. var check_val = [];
  345. for(k in checkDataEle) {
  346. if(checkDataEle[k].checked){
  347. check_val.push(checkDataEle[k].value);
  348. }
  349. }
  350. return check_val;
  351. }
  352. //删除资源代码块
  353. //点击删除前 确认弹框
  354. function deleteResource(ids){
  355. deleteIds = ids ? [ids] : getDeleteAndShareCheckArr();
  356. if(deleteIds.length<=0) {
  357. widgets.alert.showAlert(resources.msg_choise_resources_delete, false);
  358. }else {
  359. $('#deleteModel').modal('show');
  360. }
  361. }
  362. //发送删除请求
  363. function requestDeleteUrl(){
  364. var resourceIds = deleteIds;
  365. var deleteParams = {
  366. resourceType: resourceType,
  367. ids: resourceIds
  368. };
  369. new SuperMap.iPortalUser(iPortalUrl).deleteResources(deleteParams).then(result=>{
  370. $('#deleteModel').modal('hide');
  371. widgets.alert.showAlert(resources.text_deleteSuccess, true);
  372. deleteIds = [];
  373. }).catch(err => {
  374. widgets.alert.showAlert(resources.msg_deleteFailure, false);
  375. })
  376. }
  377. //编辑资源属性参数对象
  378. var attributes = {
  379. title: '',
  380. tags: [''],
  381. description: '',
  382. tokenRefreshUrl: '',
  383. refSysInfo: {
  384. refSysID: 0,
  385. projection: ''
  386. },
  387. identifier: {
  388. region:''
  389. },
  390. bounds: {
  391. west:0.0,
  392. east:0.0,
  393. south:0.0,
  394. north:0.0
  395. },
  396. contact: {
  397. personName: '',
  398. orgName: '',
  399. address: '',
  400. email: '',
  401. voiceNum: '',
  402. faxNum:''
  403. },
  404. dataMetaInfo: {},
  405. filePostfix: ''
  406. }
  407. //点击查看详情按钮
  408. function viewResource(ids){
  409. $("#edit-and-detail-plot").tabs('select',0);
  410. var item = new SuperMap.iPortalResource(iPortalUrl,{resourceId:ids,resourceType:resourceType});
  411. item.load().then(()=>{
  412. //创建详情面板
  413. L.supermap.plotting.initIportalStylePanel("iPortalDetailPanel",resourceType,item.sourceJSON,'detail');
  414. });
  415. }
  416. //点击编辑属性按钮
  417. function editResource(ids){
  418. viewResource(ids)
  419. $("#edit-and-detail-plot").tabs('select',1);
  420. var item = new SuperMap.iPortalResource(iPortalUrl,{resourceId:ids,resourceType:resourceType});
  421. item.load().then(()=>{
  422. //创建属性面板
  423. L.supermap.plotting.initIportalStylePanel("plotPanel", resourceType, item.sourceJSON,'edit');
  424. itemData = item.sourceJSON;
  425. //填充attributes对象
  426. switch (resourceType) {
  427. case 'MAP':
  428. attributes.title = itemData.title!=null?itemData.title:'';
  429. break;
  430. case 'SERVICE':
  431. attributes.title = itemData.resTitle!=null?itemData.resTitle:'';
  432. attributes.tokenRefreshUrl = itemData.tokenRefreshUrl!=null?itemData.tokenRefreshUrl:'';
  433. attributes.refSysInfo.refSysID = itemData.metadata.refSysInfo!=null?itemData.metadata.refSysInfo.refSysID:'';
  434. attributes.refSysInfo.projection = itemData.metadata.refSysInfo!=null?itemData.metadata.refSysInfo.mdCoRefSys.projection:'';
  435. attributes.identifier.region = itemData.metadata.dataIdInfo!=null?itemData.metadata.dataIdInfo.dataIdent.dataExt.exDesc:'';
  436. attributes.bounds.west = itemData.metadata.dataIdInfo!=null?itemData.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.westBL:'';
  437. attributes.bounds.east = itemData.metadata.dataIdInfo!=null?itemData.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.eastBL:'';
  438. attributes.bounds.south = itemData.metadata.dataIdInfo!=null?itemData.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.southBL:'';
  439. attributes.bounds.north = itemData.metadata.dataIdInfo!=null?itemData.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.northBL:'';
  440. attributes.contact.personName = itemData.metadata.mdContact!=null?itemData.metadata.mdContact.rpIndName:'';
  441. attributes.contact.orgName = itemData.metadata.mdContact!=null?itemData.metadata.mdContact.rpOrgName:'';
  442. attributes.contact.address = itemData.metadata.mdContact!=null?itemData.metadata.mdContact.rpCntInfo.cntAddress.delPoint:'';
  443. attributes.contact.email = itemData.metadata.mdContact!=null?itemData.metadata.mdContact.rpCntInfo.cntAddress.EMailAdd:'';
  444. attributes.contact.voiceNum = itemData.metadata.mdContact!=null?itemData.metadata.mdContact.rpCntInfo.voiceNum:'';
  445. attributes.contact.faxNum = itemData.metadata.mdContact!=null?itemData.metadata.mdContact.rpCntInfo.faxNum:'';
  446. break;
  447. case 'SCENE':
  448. attributes.title = itemData.name!=null?itemData.name:'';
  449. break
  450. case 'DATA':
  451. attributes.title = itemData.fileName!=null?itemData.fileName.substring(0,itemData.fileName.lastIndexOf(".")):'';
  452. attributes.filePostfix = itemData.fileName!=null?itemData.fileName.substr(itemData.fileName.lastIndexOf(".")):'';
  453. attributes.dataMetaInfo = itemData.dataMetaInfo!=null?itemData.dataMetaInfo:{};
  454. break;
  455. case 'INSIGHTS_WORKSPACE':
  456. attributes.title = itemData.name!=null?itemData.name:'';
  457. break;
  458. case 'MAP_DASHBOARD':
  459. attributes.title = itemData.name!=null?itemData.name:'';
  460. break;
  461. }
  462. attributes.tags = itemData.tags!=null?itemData.tags.join(" "):[];
  463. attributes.description = itemData.description!=null?itemData.description:'';
  464. });
  465. }
  466. //修改表格属性值后 则会立刻调用此函数 {rowIndex:改变属性的数据索引 rowData:改变属性后的数据对象 changes:改变的属性值}
  467. function afterModifySelectFeature(rowIndex, rowData, changes){
  468. if(rowData.length !== 0 ){
  469. new Promise(() => {
  470. if(rowData.length !== 0) {
  471. updateSelectFeature(rowData,itemData);
  472. }
  473. return;
  474. })
  475. }
  476. }
  477. //调用资源update接口,模拟服务metadata对象(所有字段) 提交后端 防止因为后端返回metadata对象为空 造成属性提交报错的问题(如果有变化 就替换 否则提交默认值)
  478. var entity = {
  479. metadata: {
  480. dataIdInfo: {
  481. dataIdent: {
  482. idCitation: {
  483. resTitle: ""
  484. },
  485. idAbs: "",
  486. dataExt: {
  487. exDesc: "",
  488. geoEle: {
  489. geoBndBox: {
  490. westBL: "",
  491. eastBL: "",
  492. southBL: "",
  493. northBL: "",
  494. },
  495. },
  496. },
  497. },
  498. },
  499. refSysInfo: {
  500. refSysID: "",
  501. mdCoRefSys: {
  502. projection: ""
  503. }
  504. },
  505. mdContact: {
  506. rpIndName: "",
  507. rpOrgName: "",
  508. rpCntInfo: {
  509. cntAddress: {
  510. delPoint: "",
  511. EMailAdd: ""
  512. },
  513. voiceNum: "",
  514. faxNum: ""
  515. }
  516. }
  517. },
  518. }
  519. //构造属性对象 提交参数 更改属性值
  520. function updateSelectFeature(updated,data) {
  521. switch (updated.key){
  522. case "title":
  523. if(attributes.title === updated.value) {
  524. return;
  525. }
  526. attributes.title = updated.value;
  527. break;
  528. case "tags":
  529. if(attributes.tags === updated.value) {
  530. return;
  531. }
  532. attributes.tags = updated.value.split(",");
  533. break;
  534. case "description":
  535. if(attributes.description === updated.value) {
  536. return;
  537. }
  538. attributes.description = updated.value;
  539. break;
  540. case "tokenRefreshUrl":
  541. if(attributes.tokenRefreshUrl === updated.value) {
  542. return;
  543. }
  544. attributes.tokenRefreshUrl = updated.value;
  545. break;
  546. case "refSysID":
  547. if(attributes.refSysInfo.refSysID === updated.value) {
  548. return;
  549. }
  550. attributes.refSysInfo.refSysID = updated.value;
  551. break;
  552. case "projection":
  553. if(attributes.refSysInfo.projection === updated.value) {
  554. return;
  555. }
  556. attributes.refSysInfo.projection = updated.value;
  557. break;
  558. case "region":
  559. if(attributes.identifier.region === updated.value) {
  560. return;
  561. }
  562. attributes.identifier.region = updated.value;
  563. break;
  564. case "west":
  565. if(attributes.bounds.west === updated.value) {
  566. return;
  567. }
  568. attributes.bounds.west = updated.value;
  569. break;
  570. case "east":
  571. if(attributes.bounds.east === updated.value) {
  572. return;
  573. }
  574. attributes.bounds.east = updated.value;
  575. break;
  576. case "south":
  577. if(attributes.bounds.south === updated.value) {
  578. return;
  579. }
  580. attributes.bounds.south = updated.value;
  581. break;
  582. case "north":
  583. if(attributes.bounds.north === updated.value) {
  584. return;
  585. }
  586. attributes.bounds.north = updated.value;
  587. break;
  588. case "personName":
  589. if(attributes.contact.personName === updated.value) {
  590. return;
  591. }
  592. attributes.contact.personName = updated.value;
  593. break;
  594. case "orgName":
  595. if(attributes.contact.orgName === updated.value) {
  596. return;
  597. }
  598. attributes.contact.orgName = updated.value;
  599. break;
  600. case "address":
  601. if(attributes.contact.address === updated.value) {
  602. return;
  603. }
  604. attributes.contact.address = updated.value;
  605. break;
  606. case "email":
  607. if(attributes.contact.email === updated.value) {
  608. return;
  609. }
  610. attributes.contact.email = updated.value;
  611. break;
  612. case "voiceNum":
  613. if(attributes.contact.voiceNum === updated.value) {
  614. return;
  615. }
  616. attributes.contact.voiceNum = updated.value;
  617. break;
  618. case "faxNum":
  619. if(attributes.contact.faxNum === updated.value) {
  620. return;
  621. }
  622. attributes.contact.faxNum = updated.value;
  623. break;
  624. case "bounds":
  625. if(attributes.dataMetaInfo) {
  626. var bounds = attributes.dataMetaInfo.bounds!=null?attributes.dataMetaInfo.bounds:'';
  627. if(bounds === updated.value) {
  628. return;
  629. }
  630. }
  631. attributes.dataMetaInfo.bounds = updated.value;
  632. break;
  633. case "epsgCode":
  634. if(attributes.dataMetaInfo) {
  635. var epsgCode = attributes.dataMetaInfo.epsgCode!=null?attributes.dataMetaInfo.epsgCode:'';
  636. if(epsgCode === updated.value) {
  637. return;
  638. }
  639. }
  640. attributes.dataMetaInfo.epsgCode = updated.value;
  641. break;
  642. case "previewURL":
  643. if(attributes.dataMetaInfo) {
  644. var previewURL = attributes.dataMetaInfo.previewURL!=null?attributes.dataMetaInfo.previewURL:'';
  645. if( previewURL=== updated.value) {
  646. return;
  647. }
  648. }
  649. attributes.dataMetaInfo.previewURL = updated.value;
  650. break;
  651. case "providers":
  652. if(attributes.dataMetaInfo) {
  653. var providers = attributes.dataMetaInfo.providers!=null?attributes.dataMetaInfo.providers:'';
  654. if(providers === updated.value) {
  655. return;
  656. }
  657. }
  658. attributes.dataMetaInfo.providers = updated.value;
  659. break;
  660. }
  661. var item = new SuperMap.iPortalResource(iPortalUrl,{resourceId:data.id,resourceType:resourceType});
  662. item.load().then(()=>{
  663. switch (resourceType) {
  664. case 'MAP':
  665. item.sourceJSON.title = attributes.title;
  666. break;
  667. case 'SERVICE':
  668. entity.metadata.dataIdInfo.dataIdent.idCitation.resTitle = attributes.title;
  669. item.sourceJSON.tokenRefreshUrl = attributes.tokenRefreshUrl;
  670. entity.metadata.refSysInfo.refSysID = attributes.refSysInfo.refSysID;
  671. entity.metadata.refSysInfo.mdCoRefSys.projection = attributes.refSysInfo.projection;
  672. entity.metadata.dataIdInfo.dataIdent.dataExt.exDesc = attributes.identifier.region;
  673. entity.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.westBL = attributes.bounds.west;
  674. entity.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.eastBL = attributes.bounds.east;
  675. entity.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.southBL = attributes.bounds.south;
  676. entity.metadata.dataIdInfo.dataIdent.dataExt.geoEle.geoBndBox.northBL = attributes.bounds.north;
  677. entity.metadata.mdContact.rpIndName = attributes.contact.personName;
  678. entity.metadata.mdContact.rpOrgName = attributes.contact.orgName;
  679. entity.metadata.mdContact.rpCntInfo.cntAddress.delPoint = attributes.contact.address;
  680. entity.metadata.mdContact.rpCntInfo.cntAddress.EMailAdd = attributes.contact.email;
  681. entity.metadata.mdContact.rpCntInfo.voiceNum = attributes.contact.voiceNum;
  682. entity.metadata.mdContact.rpCntInfo.faxNum = attributes.contact.faxNum;
  683. item.sourceJSON.metadata = entity.metadata;
  684. break;
  685. case "DATA":
  686. item.sourceJSON.fileName = attributes.title + attributes.filePostfix;
  687. item.sourceJSON.dataMetaInfo = attributes.dataMetaInfo;
  688. break
  689. case "SCENE":
  690. item.sourceJSON.name = attributes.title;
  691. break;
  692. case "INSIGHTS_WORKSPACE":
  693. item.sourceJSON.name = attributes.title;
  694. break;
  695. case "MAP_DASHBOARD":
  696. item.sourceJSON.name = attributes.title;
  697. break;
  698. }
  699. item.sourceJSON.tags = attributes.tags;
  700. item.sourceJSON.description = attributes.description;
  701. item.update().then(res => {
  702. if(res.succeed) {
  703. widgets.alert.showAlert(resources.msg_updateSuccess, true);
  704. }else {
  705. widgets.alert.showAlert(resources.msg_updateFailure+","+res.error.errorMsg, false);
  706. }
  707. }).catch(()=>{
  708. });
  709. })
  710. }
  711. //共享设置代码块
  712. //搜索添加用户
  713. function searchUser(){
  714. var userName = $("#add-user-val").val();
  715. var nicknameInfosUrl = iPortalUrl+"/web/users/nicknameinfos.json?name="+userName + "&token=" + token;
  716. $.get(nicknameInfosUrl,(res)=>{
  717. if(res.length === 0){
  718. widgets.alert.showAlert(resources.msg_user_not_exist,false);
  719. }
  720. for(var item of res){
  721. if(item.roles.includes("ADMIN")){
  722. widgets.alert.showAlert(resources.msg_not_share_admin,false);
  723. break;
  724. }else if(!checkUser(true, item.name)){
  725. break;
  726. }
  727. putUserToSettingEntities(item.name,item.nickname,null);
  728. }
  729. })
  730. }
  731. // 检查选择的用户是否符合分享条件
  732. function checkUser(enableTips,username){
  733. //验证分享的用户列表中是否已存在该用户
  734. for(var user of usersSettingEntities){
  735. if(user.entityName === username || user.aliasName === username){
  736. if(enableTips) {
  737. widgets.alert.showAlert(resources.msg_user_added,false);
  738. }
  739. return false;
  740. }
  741. }
  742. return true;
  743. }
  744. // 构造用户实体参数对象
  745. function putUserToSettingEntities(name,nickname,id){
  746. var authorizeList = getAuthorizeList("SEARCH");//添加的用户默认具有搜索权限
  747. var entity = {
  748. "permissionType": null,
  749. "aliasName": nickname,
  750. "entityRoles": [],
  751. "entityType": "USER",
  752. "entityName": name,
  753. "entityId": id,
  754. "authorizeList": authorizeList
  755. };
  756. usersSettingEntities.push(entity);
  757. showUserShare();
  758. }
  759. // 根据查询的用户记录,渲染页面,进行共享设置
  760. function showUserShare() {
  761. $("#user_tbody").empty();
  762. var cloneUsersList = Object.assign([],usersSettingEntities);
  763. for (var i = 0; i < cloneUsersList.length; i++) {
  764. switch (resourceType) {
  765. case 'MAP':
  766. case 'SCENE':
  767. case 'INSIGHTS_WORKSPACE':
  768. var shareMapDOM = $("<tr>" +
  769. "<td>" + cloneUsersList[i].entityName + "</td>" +
  770. "<td>" +
  771. "<input type='checkbox'" +
  772. "value='search-user"+i+"'" +
  773. "onclick='clickSearchCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  774. "/>" +
  775. "</td>" +
  776. "<td>" +
  777. "<input type='checkbox'" +
  778. "value='view-user"+i+"'" +
  779. "onclick='clickViewCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  780. "/>" +
  781. "</td>" +
  782. "<td>" +
  783. "<input type='checkbox'" +
  784. "value='edit-user"+i+"'" +
  785. "onclick='clickEditCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  786. "/>" +
  787. "</td>" +
  788. "<td onclick='removeUsersSettingEntity("+i+")'>"+resources.text_input_value_delete+"</td>" +
  789. "</tr>")
  790. $("#user_tbody").append(shareMapDOM);
  791. break;
  792. case 'SERVICE':
  793. case 'MAP_DASHBOARD':
  794. var shareMapDOM = $("<tr>" +
  795. "<td>" + cloneUsersList[i].entityName + "</td>" +
  796. "<td>" +
  797. "<input type='checkbox'" +
  798. "value='search-user"+i+"'" +
  799. "onclick='clickSearchCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  800. "/>" +
  801. "</td>" +
  802. "<td>" +
  803. "<input type='checkbox'" +
  804. "value='view-user"+i+"'" +
  805. "onclick='clickViewCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  806. "/>" +
  807. "</td>" +
  808. "<td onclick='removeUsersSettingEntity("+i+")'>"+resources.text_input_value_delete+"</td>" +
  809. "</tr>")
  810. $("#user_tbody").append(shareMapDOM);
  811. break;
  812. case 'DATA':
  813. var shareMapDOM = $("<tr>" +
  814. "<td>" + cloneUsersList[i].entityName + "</td>" +
  815. "<td>" +
  816. "<input type='checkbox'" +
  817. "value='search-user"+i+"'" +
  818. "onclick='clickSearchCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  819. "/>" +
  820. "</td>" +
  821. "<td>" +
  822. "<input type='checkbox'" +
  823. "value='download-user"+i+"'" +
  824. "onclick='clickDownloadCheckBox("+JSON.stringify(cloneUsersList[i])+","+JSON.stringify("user")+")'"+
  825. "/>" +
  826. "</td>" +
  827. "<td onclick='removeUsersSettingEntity("+i+")'>"+resources.text_input_value_delete+"</td>" +
  828. "</tr>")
  829. $("#user_tbody").append(shareMapDOM);
  830. break;
  831. }
  832. cloneUsersList[i].authorizeList.forEach((authorizeListItem,index)=>{
  833. $("input[value='"+authorizeListItem+"-user"+i+"']").prop("checked", true);
  834. })
  835. }
  836. }
  837. //删除用户的共享权限设置
  838. function removeUsersSettingEntity(index) {
  839. var obj = this.usersSettingEntities[index];
  840. this.usersSettingEntities.splice(index,1);
  841. this.showUserShare();
  842. }
  843. // 根据查询的部门记录,渲染页面,进行共享设置
  844. function showDepartmentShare() {
  845. $("#department_tbody").empty();
  846. var cloneDepartmentList = Object.assign([],departmentSettingEntities);
  847. for (var i = 0; i < cloneDepartmentList.length; i++) {
  848. switch (resourceType) {
  849. case 'MAP':
  850. case 'SCENE':
  851. case 'INSIGHTS_WORKSPACE':
  852. var shareMapDOM = $("<tr>" +
  853. "<td>" + cloneDepartmentList[i].entityName + "</td>" +
  854. "<td>" +
  855. "<input type='checkbox'" +
  856. "value='search-department"+i+"'" +
  857. "onclick='clickSearchCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  858. "/>" +
  859. "</td>" +
  860. "<td>" +
  861. "<input type='checkbox'" +
  862. "value='view-department"+i+"'" +
  863. "onclick='clickViewCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  864. "/>" +
  865. "</td>" +
  866. "<td>" +
  867. "<input type='checkbox'" +
  868. "value='edit-department"+i+"'" +
  869. "onclick='clickEditCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  870. "/>" +
  871. "</td>" +
  872. "<td onclick='removeDepartmentSettingEntity("+i+")'>"+resources.text_input_value_delete+"</td>" +
  873. "</tr>")
  874. $("#department_tbody").append(shareMapDOM);
  875. break;
  876. case 'SERVICE':
  877. case 'MAP_DASHBOARD':
  878. var shareMapDOM = $("<tr>" +
  879. "<td>" + cloneDepartmentList[i].entityName + "</td>" +
  880. "<td>" +
  881. "<input type='checkbox'" +
  882. "value='search-department"+i+"'" +
  883. "onclick='clickSearchCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  884. "/>" +
  885. "</td>" +
  886. "<td>" +
  887. "<input type='checkbox'" +
  888. "value='view-department"+i+"'" +
  889. "onclick='clickViewCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  890. "/>" +
  891. "</td>" +
  892. "<td onclick='removeDepartmentSettingEntity("+i+")'>"+resources.text_input_value_delete+"</td>" +
  893. "</tr>")
  894. $("#department_tbody").append(shareMapDOM);
  895. break;
  896. case 'DATA':
  897. var shareMapDOM = $("<tr>" +
  898. "<td>" + cloneDepartmentList[i].entityName + "</td>" +
  899. "<td>" +
  900. "<input type='checkbox'" +
  901. "value='search-department"+i+"'" +
  902. "onclick='clickSearchCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  903. "/>" +
  904. "</td>" +
  905. "<td>" +
  906. "<input type='checkbox'" +
  907. "value='download-department"+i+"'" +
  908. "onclick='clickDownloadCheckBox("+JSON.stringify(cloneDepartmentList[i])+","+JSON.stringify("department")+")'"+
  909. "/>" +
  910. "</td>" +
  911. "<td onclick='removeDepartmentSettingEntity("+i+")'>"+resources.text_input_value_delete+"</td>" +
  912. "</tr>")
  913. $("#department_tbody").append(shareMapDOM);
  914. break;
  915. }
  916. cloneDepartmentList[i].authorizeList.forEach((authorizeListItem,index)=>{
  917. $("input[value='"+authorizeListItem+"-department"+i+"']").prop("checked", true);
  918. })
  919. }
  920. }
  921. // 检查输入的部门是否存在
  922. function checkDepartmentIsExist(name,departments) {
  923. var department = null;
  924. for(var dep of departments){
  925. if(dep.name === name){
  926. department = dep;
  927. break;
  928. }else {
  929. if(dep.childs){
  930. department = this.checkDepartmentIsExist(name,dep.childs);
  931. if(department){
  932. break;
  933. }
  934. }
  935. }
  936. }
  937. return department;
  938. }
  939. // 获取群组列表数据函数
  940. function getGroupList() {
  941. var groupUrl = iPortalUrl + "/web/groups/sharegroups.json?token=" + token;
  942. $.get(groupUrl,(res)=>{
  943. if(res.length>0) {
  944. groupList = res;
  945. return;
  946. }
  947. })
  948. }
  949. // 根据群组列表数据,渲染页面,进行共享设置
  950. function showGroupShare() {
  951. $("#group_tbody").empty();
  952. var cloneGroupsList = Object.assign([],groupsSettingEntities);
  953. for (var i = 0; i < cloneGroupsList.length; i++) {
  954. switch (resourceType) {
  955. case 'MAP':
  956. case 'SCENE':
  957. case 'INSIGHTS_WORKSPACE':
  958. var shareMapDOM = $("<tr>" +
  959. "<td>" + cloneGroupsList[i].entityName + "</td>" +
  960. "<td>" +
  961. "<input type='checkbox'" +
  962. "value='search-group"+i+"'" +
  963. "onclick='clickSearchCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  964. "/>" +
  965. "</td>" +
  966. "<td>" +
  967. "<input type='checkbox'" +
  968. "value='view-group"+i+"'" +
  969. "onclick='clickViewCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  970. "/>" +
  971. "</td>" +
  972. "<td>" +
  973. "<input type='checkbox'" +
  974. "value='edit-group"+i+"'" +
  975. "onclick='clickEditCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  976. "/>" +
  977. "</td>" +
  978. "</tr>")
  979. $("#group_tbody").append(shareMapDOM);
  980. break;
  981. case 'SERVICE':
  982. case 'MAP_DASHBOARD':
  983. var shareMapDOM = $("<tr>" +
  984. "<td>" + cloneGroupsList[i].entityName + "</td>" +
  985. "<td>" +
  986. "<input type='checkbox'" +
  987. "value='search-group"+i+"'" +
  988. "onclick='clickSearchCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  989. "/>" +
  990. "</td>" +
  991. "<td>" +
  992. "<input type='checkbox'" +
  993. "value='view-group"+i+"'" +
  994. "onclick='clickViewCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  995. "/>" +
  996. "</td>" +
  997. "</tr>")
  998. $("#group_tbody").append(shareMapDOM);
  999. break;
  1000. case 'DATA':
  1001. var shareMapDOM = $("<tr>" +
  1002. "<td>" + cloneGroupsList[i].entityName + "</td>" +
  1003. "<td>" +
  1004. "<input type='checkbox'" +
  1005. "value='search-group"+i+"'" +
  1006. "onclick='clickSearchCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  1007. "/>" +
  1008. "</td>" +
  1009. "<td>" +
  1010. "<input type='checkbox'" +
  1011. "value='download-group"+i+"'" +
  1012. "onclick='clickDownloadCheckBox("+JSON.stringify(cloneGroupsList[i])+","+JSON.stringify("group")+")'"+
  1013. "/>" +
  1014. "</td>" +
  1015. "</tr>")
  1016. $("#group_tbody").append(shareMapDOM);
  1017. break;
  1018. }
  1019. cloneGroupsList[i].authorizeList.forEach((authorizeListItem,index)=>{
  1020. $("input[value='"+authorizeListItem+"-group"+i+"']").prop("checked", true);
  1021. })
  1022. }
  1023. }
  1024. //删除部门的共享权限设置
  1025. function removeDepartmentSettingEntity(index){
  1026. let obj = this.departmentSettingEntities[index];
  1027. this.departmentSettingEntities.splice(index,1);
  1028. this.showDepartmentShare();
  1029. }
  1030. //点击共享设置前,确认弹框(初始化弹框内容)
  1031. function shareResource(ids){
  1032. // 获取群组列表数据
  1033. getGroupList();
  1034. // 获取登录用户信息数据
  1035. getLoginUserInfos();
  1036. groupsSettingEntities = [];
  1037. for(let group of groupList){
  1038. let settingEntity = {
  1039. "permissionType": "",
  1040. "aliasName": null,
  1041. "entityRoles": [],
  1042. "entityType": "IPORTALGROUP",
  1043. "entityName": group.groupName,
  1044. "entityId": group.id,
  1045. "authorizeList": []
  1046. };
  1047. groupsSettingEntities.push(settingEntity);
  1048. }
  1049. $('#shareModal').modal('show');
  1050. shareIds = ids ? [ids] : getDeleteAndShareCheckArr();
  1051. if(shareIds.length<=0) {
  1052. widgets.alert.showAlert(resources.msg_choise_resources_share, false);
  1053. return;
  1054. }
  1055. $("#public").empty();
  1056. $("#user_thead").empty();
  1057. $("#user_tbody").empty();
  1058. $("#group_thead").empty();
  1059. $("#group_tbody").empty();
  1060. $("#department_thead").empty();
  1061. $("#department_tbody").empty();
  1062. $("#add-user-val").val("");
  1063. $("#add-department-val").val("");
  1064. //公开
  1065. switch (resourceType) {
  1066. case 'MAP':
  1067. case 'SCENE':
  1068. case 'INSIGHTS_WORKSPACE':
  1069. sharePublicDOM = $("<div class='col-md-4 col-xl-4 gallery-item' id='shareCheckboxs'>" +
  1070. "<div class='publicPane sub-font' id='search'>" +
  1071. "<input type='checkbox'" +
  1072. "value='search'" +
  1073. "onchange='clickSearchCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1074. "/>" +
  1075. "&nbsp; <span>"+resources.text_user_search+"</span>" +
  1076. "</div>" +
  1077. "<div class='publicPane sub-font' id='view'>" +
  1078. "<input type='checkbox'" +
  1079. "value='view'" +
  1080. "onchange='clickViewCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1081. "/>" +
  1082. "&nbsp; <span>"+resources.text_user_view+"</span>" +
  1083. "</div>" +
  1084. "<div class='publicPane sub-font' id='edit'>" +
  1085. "<input type='checkbox'" +
  1086. "value='edit'" +
  1087. "onchange='clickEditCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1088. "/>" +
  1089. "&nbsp; <span>"+resources.text_user_editor+"</span>" +
  1090. "</div>" +
  1091. "</div>")
  1092. break;
  1093. case 'SERVICE':
  1094. case 'MAP_DASHBOARD':
  1095. sharePublicDOM = $("<div class='col-md-4 col-xl-4 gallery-item' id='shareCheckboxs'>" +
  1096. "<div class='publicPane sub-font' id='search'>" +
  1097. "<input type='checkbox'" +
  1098. "value='search'" +
  1099. "onchange='clickSearchCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1100. "/>" +
  1101. "&nbsp; <span>"+resources.text_user_search+"</span>" +
  1102. "</div>" +
  1103. "<div class='publicPane sub-font' id='view'>" +
  1104. "<input type='checkbox'" +
  1105. "value='view'" +
  1106. "onchange='clickViewCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1107. "/>" +
  1108. "&nbsp; <span>"+resources.text_user_view+"</span>" +
  1109. "</div>" +
  1110. "</div>")
  1111. break;
  1112. case 'DATA':
  1113. sharePublicDOM = $("<div class='col-md-4 col-xl-4 gallery-item' id='shareCheckboxs'>" +
  1114. "<div class='publicPane sub-font' id='search'>" +
  1115. "<input type='checkbox'" +
  1116. "value='search'" +
  1117. "onchange='clickSearchCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1118. "/>" +
  1119. "&nbsp; <span>"+resources.text_user_search+"</span>" +
  1120. "</div>" +
  1121. "<div class='publicPane sub-font' id='download'>" +
  1122. "<input type='checkbox'" +
  1123. "value='download'" +
  1124. "onchange='clickDownloadCheckBox("+JSON.stringify(publicSettingEntity).replace(/\“/g,"'")+","+JSON.stringify("public")+")'"+
  1125. "/>" +
  1126. "&nbsp; <span>"+resources.text_user_download+"</span>" +
  1127. "</div>" +
  1128. "</div>")
  1129. break;
  1130. }
  1131. initDepartmentUserGroupThead("user",resources.text_nickname);
  1132. initDepartmentUserGroupThead("department",resources.text_department);
  1133. initDepartmentUserGroupThead("group",resources.text_group);
  1134. $("#public").append(sharePublicDOM)
  1135. var item = new SuperMap.iPortalResource(iPortalUrl,{resourceId:shareIds[0],resourceType:resourceType});
  1136. item.load().then(()=>{
  1137. if(item.sourceJSON.authorizeSetting && item.sourceJSON.authorizeSetting.length > 0){
  1138. for(let entity of item.sourceJSON.authorizeSetting){
  1139. let permissionType = entity.permissionType || entity.dataPermissionType;
  1140. switch(entity.entityType) {
  1141. case "USER":
  1142. if(entity.entityName === "GUEST") {
  1143. //为其增加一权限属性,用于处理复选框数据双向绑定
  1144. var entityObj = Object.assign({},entity);
  1145. entityObj["authorizeList"] = getAuthorizeList(permissionType);
  1146. publicSettingEntity = entityObj;
  1147. }else {
  1148. if(!entity.entityName || userStateObj.userName === entity.entityName){
  1149. break;
  1150. }
  1151. var entityObj = Object.assign({},entity);
  1152. entityObj["authorizeList"] = getAuthorizeList(permissionType);
  1153. usersSettingEntities.push(entityObj);
  1154. }
  1155. break;
  1156. case "IPORTALGROUP":
  1157. var cloneGroupsEntities = Object.assign([],groupsSettingEntities)
  1158. for(var groupItem of cloneGroupsEntities){
  1159. if(groupItem.entityId === entity.entityId){
  1160. groupItem.authorizeList = getAuthorizeList(permissionType);
  1161. groupItem.permissionType = entity.permissionType;
  1162. break;
  1163. }
  1164. }
  1165. groupsSettingEntities = cloneGroupsEntities;
  1166. break;
  1167. case "DEPARTMENT":
  1168. var entityObj = Object.assign({},entity);
  1169. entityObj["authorizeList"] = getAuthorizeList(permissionType);
  1170. departmentSettingEntities.push(entityObj);
  1171. break;
  1172. }
  1173. }
  1174. }
  1175. publicSettingEntity.authorizeList.forEach((authorizeListItem,index)=>{
  1176. $("input[value='"+authorizeListItem+"']").prop("checked", true);
  1177. })
  1178. if(departmentSettingEntities.length>0) {
  1179. showDepartmentShare();
  1180. }
  1181. if(usersSettingEntities.length>0) {
  1182. showUserShare();
  1183. }
  1184. if(groupsSettingEntities.length>0) {
  1185. showGroupShare();
  1186. }
  1187. })
  1188. }
  1189. //初始化部门用户群组的表格头部内容
  1190. function initDepartmentUserGroupThead(renderDOMType,name){
  1191. var tr = document.createElement("tr");
  1192. //添加昵称(用户名)
  1193. var td_Name = document.createElement("th");
  1194. var text_Name = document.createTextNode(name);
  1195. td_Name.append(text_Name);
  1196. tr.append(td_Name);
  1197. $("#"+renderDOMType+"_thead").append(tr);
  1198. //添加可检索
  1199. var td_Name = document.createElement("th");
  1200. var text_Name = document.createTextNode(resources.text_is_search);
  1201. td_Name.append(text_Name);
  1202. tr.append(td_Name);
  1203. $("#"+renderDOMType+"_thead").append(tr);
  1204. switch (resourceType) {
  1205. case 'MAP':
  1206. case 'SCENE':
  1207. case 'INSIGHTS_WORKSPACE':
  1208. //可查看
  1209. var td_Value = document.createElement("th");
  1210. var text_Value = document.createTextNode(resources.text_is_view);
  1211. td_Value.append(text_Value);
  1212. tr.append(td_Value);
  1213. $("#"+renderDOMType+"_thead").append(tr);
  1214. //可编辑
  1215. var td_Value = document.createElement("th");
  1216. var text_Value = document.createTextNode(resources.text_is_edit);
  1217. td_Value.append(text_Value);
  1218. tr.append(td_Value);
  1219. $("#"+renderDOMType+"_thead").append(tr);
  1220. break;
  1221. case 'SERVICE':
  1222. case 'MAP_DASHBOARD':
  1223. //可查看
  1224. var td_Value = document.createElement("th");
  1225. var text_Value = document.createTextNode(resources.text_is_view);
  1226. td_Value.append(text_Value);
  1227. tr.append(td_Value);
  1228. $("#"+renderDOMType+"_thead").append(tr);
  1229. break;
  1230. case 'DATA':
  1231. //可下载
  1232. var td_Value = document.createElement("th");
  1233. var text_Value = document.createTextNode(resources.text_is_download);
  1234. td_Value.append(text_Value);
  1235. tr.append(td_Value);
  1236. $("#"+renderDOMType+"_thead").append(tr);
  1237. break;
  1238. }
  1239. if(renderDOMType === 'group') {
  1240. return;
  1241. }
  1242. var td_Value = document.createElement("th");
  1243. var text_Value = document.createTextNode(resources.btn_operate);
  1244. td_Value.append(text_Value);
  1245. tr.append(td_Value);
  1246. $("#"+renderDOMType+"_thead").append(tr);
  1247. }
  1248. //发送共享设置请求
  1249. function requestShareUrl(){
  1250. var resourceIds = shareIds;
  1251. var entities = getShareEntities();
  1252. queryShareParams = new SuperMap.iPortalShareParam({
  1253. ids:resourceIds,
  1254. entities:entities,
  1255. resourceType:resourceType
  1256. });
  1257. iPortal.updateResourcesShareSetting(queryShareParams).then(result=>{
  1258. $('#shareModal').modal('hide');
  1259. usersSettingEntities = [];
  1260. departmentSettingEntities = [];
  1261. groupsSettingEntities = [];
  1262. widgets.alert.showAlert(resources.msg_shareSuccess, true);
  1263. }).catch(err => {
  1264. widgets.alert.showAlert(resources.msg_shareFailed, false);
  1265. })
  1266. }
  1267. //关闭弹框后 清空实体参数对象 防止重复渲染
  1268. function removeUser(){
  1269. usersSettingEntities = [];
  1270. departmentSettingEntities = [];
  1271. groupsSettingEntities = [];
  1272. }
  1273. //获取共享的实体参数
  1274. function getShareEntities(){
  1275. shareSettingList = [];
  1276. //公开
  1277. addSettingEntity(publicSettingEntity);
  1278. //用户
  1279. for(var user of usersSettingEntities){
  1280. addSettingEntity(user);
  1281. }
  1282. //部门
  1283. for(var department of departmentSettingEntities){
  1284. addSettingEntity(department);
  1285. }
  1286. //群组
  1287. for(var group of groupsSettingEntities){
  1288. addSettingEntity(group);
  1289. }
  1290. return shareSettingList;
  1291. }
  1292. //生成分享的entities参数
  1293. function addSettingEntity(obj){
  1294. var settingEntity = dealShareSettingParam(obj);
  1295. if(settingEntity){
  1296. shareSettingList.push(settingEntity);
  1297. }
  1298. }
  1299. //处理共享设置的参数
  1300. function dealShareSettingParam(obj) {
  1301. var authorize = "";
  1302. if(!obj.authorizeList){
  1303. return null;
  1304. }
  1305. if(obj.authorizeList.includes("edit")){
  1306. authorize = obj.entityName === userStateObj.userName ? "DELETE" : "READWRITE";
  1307. }else if(obj.authorizeList.includes("view")){
  1308. authorize = "READ";
  1309. }else if(obj.authorizeList.includes("download")){
  1310. authorize = "DOWNLOAD";
  1311. }else if(obj.authorizeList.includes("search")){
  1312. authorize = "SEARCH";
  1313. }
  1314. if(authorize){
  1315. if(resourceType === "DATA") {
  1316. obj.dataPermissionType = authorize;
  1317. }
  1318. obj.permissionType = authorize;
  1319. let targetPermissionEntity = Object.assign({},obj);
  1320. delete targetPermissionEntity.authorizeList;
  1321. delete targetPermissionEntity.aliasName;
  1322. delete targetPermissionEntity.entityRoles;
  1323. return targetPermissionEntity;
  1324. }else {
  1325. return null;
  1326. }
  1327. }
  1328. //根据已有的权限生成authorizeList,用于复选框双向绑定
  1329. function getAuthorizeList(permissionType){
  1330. let authorizeList = [];
  1331. switch(permissionType){
  1332. case "SEARCH":
  1333. authorizeList = ["search"];
  1334. break;
  1335. case "READ":
  1336. authorizeList = ["search","view"];
  1337. break;
  1338. case "DOWNLOAD":
  1339. authorizeList = ["search","download"];
  1340. break;
  1341. case "READWRITE":
  1342. authorizeList = ["search","view","edit"];
  1343. break;
  1344. case "DELETE":
  1345. authorizeList = ["search","view","edit"];
  1346. break;
  1347. default:
  1348. break;
  1349. }
  1350. return authorizeList;
  1351. }
  1352. //点击可检索逻辑
  1353. function clickSearchCheckBox(obj,type){
  1354. if(!obj.authorizeList || (obj.authorizeList).indexOf("search") === -1){
  1355. obj.authorizeList = ["search"];
  1356. }else {
  1357. obj.authorizeList = [];
  1358. }
  1359. if(type === 'public') {
  1360. publicSettingEntity = obj;
  1361. if($("input[value='search']").is(':checked')){
  1362. obj.authorizeList.forEach(authorizeListItem=>{
  1363. $("input[value='"+authorizeListItem+"']").prop("checked", true);
  1364. $("input[value='view']").prop("checked", false);
  1365. $("input[value='edit']").prop("checked", false);
  1366. $("input[value='download']").prop("checked", false);
  1367. })
  1368. }else {
  1369. $("input[value='search']").prop("checked", false);
  1370. $("input[value='view']").prop("checked", false);
  1371. $("input[value='edit']").prop("checked", false);
  1372. $("input[value='download']").prop("checked", false);
  1373. }
  1374. }else if(type === 'user') {
  1375. usersSettingEntities.forEach((item,index)=>{
  1376. if(item.entityName === obj.entityName) {
  1377. usersSettingEntities[index] = obj;
  1378. }
  1379. if($("input[value='search-user"+index+"']").is(':checked')){
  1380. obj.authorizeList.forEach(authorizeListItem=>{
  1381. $("input[value='"+authorizeListItem+"-user"+index+"']").prop("checked", true);
  1382. $("input[value='view-user"+index+"']").prop("checked", false);
  1383. $("input[value='edit-user"+index+"']").prop("checked", false);
  1384. $("input[value='download-user"+index+"']").prop("checked", false);
  1385. })
  1386. }else {
  1387. $("input[value='search-user"+index+"']").prop("checked", false);
  1388. $("input[value='view-user"+index+"']").prop("checked", false);
  1389. $("input[value='edit-user"+index+"']").prop("checked", false);
  1390. $("input[value='download-user"+index+"']").prop("checked", false);
  1391. }
  1392. })
  1393. }else if(type === 'department') {
  1394. departmentSettingEntities.forEach((item,index)=>{
  1395. if(item.entityName === obj.entityName) {
  1396. departmentSettingEntities[index] = obj;
  1397. }
  1398. if($("input[value='search-department"+index+"']").is(':checked')){
  1399. obj.authorizeList.forEach(authorizeListItem=>{
  1400. $("input[value='"+authorizeListItem+"-department"+index+"']").prop("checked", true);
  1401. $("input[value='view-department"+index+"']").prop("checked", false);
  1402. $("input[value='edit-department"+index+"']").prop("checked", false);
  1403. $("input[value='download-department"+index+"']").prop("checked", false);
  1404. })
  1405. }else {
  1406. $("input[value='search-department"+index+"']").prop("checked", false);
  1407. $("input[value='view-department"+index+"']").prop("checked", false);
  1408. $("input[value='edit-department"+index+"']").prop("checked", false);
  1409. $("input[value='download-department"+index+"']").prop("checked", false);
  1410. }
  1411. })
  1412. }else if(type === 'group') {
  1413. groupsSettingEntities.forEach((item,index)=>{
  1414. if(item.entityName === obj.entityName) {
  1415. groupsSettingEntities[index] = obj;
  1416. }
  1417. if($("input[value='search-group"+index+"']").is(':checked')){
  1418. obj.authorizeList.forEach(authorizeListItem=>{
  1419. $("input[value='"+authorizeListItem+"-group"+index+"']").prop("checked", true);
  1420. $("input[value='view-group"+index+"']").prop("checked", false);
  1421. $("input[value='edit-group"+index+"']").prop("checked", false);
  1422. $("input[value='download-group"+index+"']").prop("checked", false);
  1423. })
  1424. }else {
  1425. $("input[value='search-group"+index+"']").prop("checked", false);
  1426. $("input[value='view-group"+index+"']").prop("checked", false);
  1427. $("input[value='edit-group"+index+"']").prop("checked", false);
  1428. $("input[value='download-group"+index+"']").prop("checked", false);
  1429. }
  1430. })
  1431. }
  1432. }
  1433. //点击可下载逻辑
  1434. function clickDownloadCheckBox(obj,type){
  1435. if(!obj.authorizeList || (obj.authorizeList).indexOf("download") === -1){
  1436. obj.authorizeList = ["search","download"];
  1437. }else if((obj.authorizeList).indexOf("search") !== -1){
  1438. obj.authorizeList = ["search"];
  1439. }
  1440. if(type === 'public') {
  1441. publicSettingEntity = obj;
  1442. }else if(type === 'user') {
  1443. usersSettingEntities.forEach((item,index)=>{
  1444. if(item.entityName === obj.entityName) {
  1445. usersSettingEntities[index] = obj;
  1446. if($("input[value='download-user"+index+"']").is(':checked')){
  1447. obj.authorizeList.forEach(authorizeListItem=>{
  1448. $("input[value='"+authorizeListItem+"-user"+index+"']").prop("checked", true);
  1449. })
  1450. }
  1451. }
  1452. })
  1453. }else if(type === 'department') {
  1454. departmentSettingEntities.forEach((item,index)=>{
  1455. if(item.entityName === obj.entityName) {
  1456. departmentSettingEntities[index] = obj;
  1457. if($("input[value='download-department"+index+"']").is(':checked')){
  1458. obj.authorizeList.forEach(authorizeListItem=>{
  1459. $("input[value='"+authorizeListItem+"-department"+index+"']").prop("checked", true);
  1460. })
  1461. }
  1462. }
  1463. })
  1464. }else if(type === 'group') {
  1465. groupsSettingEntities.forEach((item,index)=>{
  1466. if(item.entityName === obj.entityName) {
  1467. groupsSettingEntities[index] = obj;
  1468. if($("input[value='download-group"+index+"']").is(':checked')){
  1469. obj.authorizeList.forEach(authorizeListItem=>{
  1470. $("input[value='"+authorizeListItem+"-group"+index+"']").prop("checked", true);
  1471. })
  1472. }
  1473. }
  1474. })
  1475. }
  1476. }
  1477. //点击可查看逻辑
  1478. function clickViewCheckBox(obj,type){
  1479. if(!obj.authorizeList || (obj.authorizeList).indexOf("view") === -1){
  1480. obj.authorizeList = ["search","view"];
  1481. }else if((obj.authorizeList).indexOf("search") !== -1){
  1482. obj.authorizeList = ["search"];
  1483. }
  1484. if(type === 'public') {
  1485. publicSettingEntity = obj;
  1486. if($("input[value='view']").is(':checked')){
  1487. obj.authorizeList.forEach(authorizeListItem=>{
  1488. $("input[value='"+authorizeListItem+"']").prop("checked", true);
  1489. })
  1490. }else {
  1491. $("input[value='edit']").prop("checked", false);
  1492. }
  1493. }else if(type === 'user') {
  1494. usersSettingEntities.forEach((item,index)=>{
  1495. if(item.entityName === obj.entityName) {
  1496. usersSettingEntities[index] = obj;
  1497. if($("input[value='view-user"+index+"']").is(':checked')){
  1498. obj.authorizeList.forEach(authorizeListItem=>{
  1499. $("input[value='"+authorizeListItem+"-user"+index+"']").prop("checked", true);
  1500. $("input[value='edit-user"+index+"']").prop("checked", false);
  1501. })
  1502. }else {
  1503. $("input[value='edit-user"+index+"']").prop("checked", false);
  1504. }
  1505. }
  1506. })
  1507. }else if(type === 'department') {
  1508. departmentSettingEntities.forEach((item,index)=>{
  1509. if(item.entityName === obj.entityName) {
  1510. departmentSettingEntities[index] = obj;
  1511. if($("input[value='view-department"+index+"']").is(':checked')){
  1512. obj.authorizeList.forEach(authorizeListItem=>{
  1513. $("input[value='"+authorizeListItem+"-department"+index+"']").prop("checked", true);
  1514. $("input[value='edit-department"+index+"']").prop("checked", false);
  1515. })
  1516. }else {
  1517. $("input[value='edit-department"+index+"']").prop("checked", false);
  1518. }
  1519. }
  1520. })
  1521. }else if(type === 'group') {
  1522. groupsSettingEntities.forEach((item,index)=>{
  1523. if(item.entityName === obj.entityName) {
  1524. groupsSettingEntities[index] = obj;
  1525. if($("input[value='view-group"+index+"']").is(':checked')){
  1526. obj.authorizeList.forEach(authorizeListItem=>{
  1527. $("input[value='"+authorizeListItem+"-group"+index+"']").prop("checked", true);
  1528. $("input[value='edit-group"+index+"']").prop("checked", false);
  1529. })
  1530. }else {
  1531. $("input[value='edit-group"+index+"']").prop("checked", false);
  1532. }
  1533. }
  1534. })
  1535. }
  1536. }
  1537. //点击可编辑逻辑
  1538. function clickEditCheckBox(obj,type){
  1539. if(!obj.authorizeList || (obj.authorizeList).indexOf("edit") === -1){
  1540. obj.authorizeList = ["search","view","edit"];
  1541. }else if((obj.authorizeList).indexOf("view") !== -1){
  1542. obj.authorizeList = ["search","view"];
  1543. }
  1544. if(type === 'public') {
  1545. publicSettingEntity = obj;
  1546. if($("input[value='edit']").is(':checked')){
  1547. obj.authorizeList.forEach(authorizeListItem=>{
  1548. $("input[value='"+authorizeListItem+"']").prop("checked", true);
  1549. })
  1550. }
  1551. }else if(type === 'user') {
  1552. usersSettingEntities.forEach((item,index)=>{
  1553. if(item.entityName === obj.entityName) {
  1554. usersSettingEntities[index] = obj;
  1555. }
  1556. if($("input[value='edit-user"+index+"']").is(':checked')){
  1557. obj.authorizeList.forEach(authorizeListItem=>{
  1558. $("input[value='"+authorizeListItem+"-user"+index+"']").prop("checked", true);
  1559. })
  1560. }
  1561. })
  1562. }else if(type === 'department') {
  1563. departmentSettingEntities.forEach((item,index)=>{
  1564. if(item.entityName === obj.entityName) {
  1565. departmentSettingEntities[index] = obj;
  1566. }
  1567. if($("input[value='edit-department"+index+"']").is(':checked')){
  1568. obj.authorizeList.forEach(authorizeListItem=>{
  1569. $("input[value='"+authorizeListItem+"-department"+index+"']").prop("checked", true);
  1570. })
  1571. }
  1572. })
  1573. }else if(type === 'group') {
  1574. groupsSettingEntities.forEach((item,index)=>{
  1575. if(item.entityName === obj.entityName) {
  1576. groupsSettingEntities[index] = obj;
  1577. }
  1578. if($("input[value='edit-group"+index+"']").is(':checked')){
  1579. obj.authorizeList.forEach(authorizeListItem=>{
  1580. $("input[value='"+authorizeListItem+"-group"+index+"']").prop("checked", true);
  1581. })
  1582. }
  1583. })
  1584. }
  1585. }
  1586. // 选择资源类型 查询资源
  1587. function onSelectResourcesType(){
  1588. iPortal = new SuperMap.iPortal(iPortalUrl);
  1589. let type = $("#typeSelect").val();
  1590. resourceType = type;
  1591. queryParams = new SuperMap.iPortalQueryParam({
  1592. resourceType: type,
  1593. searchType:'MY_RES',
  1594. pageSize: 15,
  1595. currentPage: 1
  1596. });
  1597. queryResouces(queryParams);
  1598. }
  1599. </script>
  1600. </body>
  1601. </html>