$(function () { initSystemName(); initActionType(); var appid = getAppId() != null ? getAppId() : null; var proxypath = "http://192.168.20.106:8066"; // var proxypath = "http://192.168.20.106:8066"; $("#jqGrid").jqGrid({ ajaxGridOptions:{ xhrFields:{ withCredentials:false } }, url: proxypath + '/serverRegister/queryServer', datatype: "json", colModel: [ { label: '服务名称', name: 'SERVERNAME', index: 'SERVERNAME', width: 50, align: 'center' }, { label: '服务地址', name: 'SERVERURL', index: 'SERVERURL', width: 50, align: 'center' }, { label: '代理后服务地址', name: 'PROXYSERVERURL', index: 'PROXYSERVERURL', width: 50, align: 'center' }, { label: '资源ID', name: 'RESOURCEID', index: 'RESOURCEID', width: 80, align: 'center' }, { label: '来源系统', name: 'FROMSYS', index: 'FROMSYS', width: 80, align: 'center' }, { label: '是否公开', name: 'ISPUBLIC', index: 'ISPUBLIC', width: 80, align: 'center' // ,formatter:function(value,grid,rows,state) { // var id = rows.resourceid; // if (id != null) { // var html = "" // +rows.title+""; // return html; // } else { // return ""; // } // } }, { label: '后缀ID', name: 'SUFFIX', index: 'SUFFIX', width: 80, align: 'center' // ,formatter:function(value,grid,rows,state){ // var date =rows.dodate; // var d=date.substring(0,11); // return date; // } }, { label: '是否上线', name: 'ENABLE', index: 'ENABLE', align: 'center', width: 50 }, { label: '主键', name: 'ID', index: 'ID', align: 'center', width: 50 }, // { // label: '操作', name: 'right', index: 'right', align: 'center', width: 100, formatter: function (value, grid, rows, state) { // var df = rows.id // var ddd = "password('" + df + "')"; // var ccc = "date('" + df + "')"; // var fff = "term('" + df + "')"; // return '' + '  ' + '' + '  ' + '' // } // }, { label: '操作', name: 'right', index: 'right', align: 'center', width: 100, formatter: function (value, grid, rows, state) { //debugger var id = grid.rowId; var userid = rows.ID; var resourceid = rows.RESOURCEID; var template = ` `; return template; //return '' + '  ' + '' + '  ' + '' } }, ], mtype: 'POST', postData: { 'appid': appid }, viewrecords: true, height: "auto", rowNum: 10, //rowList : [10,30,50], rownumbers: true, rownumWidth: 50, autowidth: true, pager: "#jqGridPager", jsonReader: { root: "data", // page: "page.currPage", page: "1", total: "totalpage", // total: "total", // records: "page.totalCount" records: "total" }, prmNames: { page: "page", rows: "limit", order: "order" }, gridComplete: function () { //闅愯棌grid搴曢儴婊氬姩鏉� $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x": "hidden" }); }, onSortCol: function (index, colindex, sortorder) { jQuery("#jqGrid").jqGrid('setGridParam', { page: $(".ui-pg-input").val() }); } }); $("#jqGrid").jqGrid('setLabel', 'rn', '序号', { 'text-align': 'center' }, ''); }); var vm = new Vue({ el: '#rapp', data: { showList: true, title: null, action: {} }, methods: { query: function () { // if (!checkDate()) { // // $("#End_Date").focus(); // // $("#End_Date").focus(); // return false; // } vm.reload(); }, add: function () { vm.showList = false; vm.title = "鏂板"; vm.action = {}; }, update: function (userid, id) { //var id = $("#jqGrid").jqGrid('getGridParam', 'selrow'); var selectRows = $("#jqGrid").jqGrid('getRowData', id); var params = encodeURIComponent("ENABLE=" + selectRows.ENABLE + "&FROMSYS=" + selectRows.FROMSYS + "&ID=" + selectRows.ID + "&ISPUBLIC=" + selectRows.ISPUBLIC + "&PROXYSERVERURL=" + selectRows.PROXYSERVERURL + "&RESOURCEID=" + selectRows.RESOURCEID + "&SERVERNAME=" + selectRows.SERVERNAME + "&SERVERURL=" + selectRows.SERVERURL + "&SUFFIX=" + selectRows.SUFFIX) window.open("newResourcelist_edit.html?" + params, "_blank"); // var actionid = getSelectedRow(); // if (actionid == null) { // return; // } // vm.showList = false; // vm.title = "淇敼"; // vm.getInfo(actionid) }, saveOrUpdate: function () { var url = vm.action.actionid == null ? "log/action/save" : "log/action/update"; $.ajax({ type: "POST", url: restServerBaseURL + url, contentType: "application/json", data: JSON.stringify(vm.action), success: function (r) { if (r.code === 0) { alert('鎿嶄綔鎴愬姛', function () { vm.reload(); }); } else { alert(r.msg); } } }); }, del: function (userid) { //debugger // var actionids = getSelectedRows(); // if (actionids == null) { // return; // } // confirm('真的删除行吗?', function () { // $.ajax({ // type: "POST", // url: restServerBaseURL + "log/action/delete", // contentType: "application/json", // data: JSON.stringify(actionids), // success: function (r) { // if (r.code == 0) { // alert('鎿嶄綔鎴愬姛', function () { // vm.reload(); // }); // } else { // alert(r.msg); // } // } // }); // }); confirm('确定要删除选中的记录?', function () { $.ajax({ type: "get", url: terraProxyUrl + "serverRegister/delArcGisServer", data: { id: userid }, dataType: 'text', success: function (r) { if (r === "删除服务成功") { alert('操作成功', function () { vm.reload(); }); } else { alert(r.msg); } } }); }); }, getInfo: function (actionid) { $.get(restServerBaseURL + "log/action/info/" + actionid, function (r) { vm.action = r.action; }); }, reload: function () { var UserName = $("#UserName").val(); var SerName = $("#SerName").val(); vm.showList = true; var page = $("#jqGrid").jqGrid('getGridParam', 'page'); $("#jqGrid").jqGrid('setGridParam', { postData: { 'zyid': UserName, 'servername': SerName, 'fromsys': '', 'suffix': '' }, page: 1 }).trigger("reloadGrid"); }, refresh: function () { vm.showList = true; window.location.reload(); } } }); var systemList; function initSystemName() { var local = window.location.href; $.ajax({ type: "GET", url: restServerBaseURL + "sys/systeminfo/queryListAll", contentType: "application/json", success: function (msg) { systemList = msg.systemList; jQuery("#appidName").append(""); var appid = ''; if (getAppId() != null) { appid = getAppId(); } jQuery.each(systemList, function (i, item) { if (appid == item.appid) { jQuery("#appidName").append(""); } else { jQuery("#appidName").append(""); } }); } }); } function getTokenPanel(resourceid,) { try { $("body").remove($("#tokenPanel")); } catch (ex) { } var template = ` `; var content = `
资源编号
持续时间
使用者    
`; template = template.replace('customHtml', content) $("body").append(template) var modal = $("#tokenPanel") modal.modal(); } function getToken() { // switch (identyinfo) { // case "0": identyinfo = '浙江'; break; // case "1": identyinfo = '广州'; break; // } var expiration, identyinfo, resourceid, tims; resourceid = $("#resourceid").val(); expiration = parseFloat($("#expiration").val()); identyinfo = $("#identyinfo").val(); tims = $("#times").val(); expiration = parseFloat(tims) * expiration; $.ajax({ url: terraProxyUrl + 'serverRegister/genToken?userid=servdl&password=servdl123' + '&resourceid=' + resourceid + '&expiration=' + expiration + '&identyinfo=' + identyinfo, type: 'get', contentType: "application/json;charset=utf-8", success: function (data) { var result = data//JSON.parse(data); alert("成功获取token,可选择复制"); $("#temptoken").val(result.data); var modal = $("#tokenPanel") modal.modal("hide"); try { $("body").remove($("#tokenPanel")); } catch (ex) { } }, error: function (s1, s2, s3) { alert("error"); } }); } // function getToken(resourceid, expiration, identyinfo) { // switch (identyinfo) { // case "0": identyinfo = '浙江'; break; // case "1": identyinfo = '广州'; break; // } // debugger // $.ajax({ // url: terraProxyUrl + 'serverRegister/genToken?userid=servdl&password=servdl123' + '&resourceid=' + // resourceid + '&expiration=' + expiration + '&identyinfo=' + identyinfo, // type: 'get', // contentType: "application/json;charset=utf-8", // success: function (data) { // var result = JSON.parse(data); // alert("成功获取token,可选择复制"); // $("#temptoken").val(result.data) // }, // error: function (s1, s2, s3) { // alert("error"); // } // }); // } function findUserByWord() { var username = $("#UserName").val(); $("#UserName").autocomplete({ source: restServerBaseURL + 'org/user/findUserByWord?keyWord=' + encodeURI(encodeURI(username)), //璇锋眰鐨剈rl minLength: 1, }); } function initActionType() { var local = window.location.href; $.ajax({ type: "GET", url: restServerBaseURL + "log/action/actionType", contentType: "application/json", success: function (msg) { var list = msg.actionTypes; jQuery("#actionType").append(""); jQuery.each(list, function (i, item) { jQuery("#actionType").append(""); }); } }); } //鎵撳紑璧勬簮鏌ョ湅椤甸潰 function openZY(id) { $.ajax({ type: "GET", url: LanCatalogBaseURL + "api/cheackZYIsExist?resourceid=" + id, contentType: "application/json", success: function (data) { if (data) { window.open(LanCatalogBaseURL + "res/ZiYuan/ZiYuanBaseInfo?resourceid=" + id, "_blank"); } else { alert("璇ヨ祫婧愬凡鍒犻櫎锛�"); } } }); } function checkDate() { var beginDate = $("#Begin_Date").val(); var endDate = $("#End_Date").val(); if (beginDate != "" && endDate != "") { var pubdatestart = new Date(beginDate.replace(/-/g, "/")); var pubdateend = new Date(endDate.replace(/-/g, "/")); if (pubdatestart > pubdateend) { alert("缁撴潫鏃堕棿涓嶈兘灏忎簬寮€濮嬫椂闂达紒", function () { $("#End_Date").focus(); $("#End_Date").focus(); }); return false; } else { return true; } } else { return true; } } //选择一条记录 function getSelectedRow() { var grid = $("#jqGrid"); var rowKey = grid.getGridParam("selrow"); if (!rowKey) { alert("请选择一条记录"); return; } var selectedIDs = grid.getGridParam("selarrrow"); if (selectedIDs.length > 1) { alert("只能选择一条记录"); return; } return selectedIDs[0]; } function jsCopy() { var e = document.getElementById("temptoken"); e.removeAttribute("disabled"); e.select(); document.execCommand("Copy"); e.setAttribute("disabled", "disabled"); alert("成功复制Token"); }