Blame view

assets/syspages/js/rbac/license.js 5.31 KB
d4144fa9   Andy   add license 页面
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
  
  var liFun={
      init:function () {
          liFun.initTable();
      },
      initTable:function(){
          $('#licenseTable').bootstrapTable('destroy').bootstrapTable({
              striped:true,//表格显示条纹
              pagination: false, //启动分页
              pageNumber:1, //当前第几页
              pageSize: 1,  //每页显示的记录数
              pageList: [1],  //记录数可选列表
              sidePagination: 'server',//表示服务端分页
              queryParamsType: 'limit',
              method:'POST',//请求方法
              paginationPreText: '<',
              paginationNextText: '>',
              ajax:tableLoadRequest,//自定义ajax加载数据
              uniqueId:'id',
              columns: [
                  {
                      field: 'issCompany',
                      title: '<span class="person-icon"> </span>授权码发行公司',
                      width: '15%',
                      align: "left",
                      formatter:commonObj.replacenull
                  },
                  {
                      field: 'grantType',
                      title: '<span class="type-icon"> </span>授权类型',
                      width: '10%',
                      align: "left",
                      formatter:commonObj.replacenull
                  },
                  {
                      field: 'grantComName',
                      title: '<span class="person-icon"> </span>授权公司',
                      width: '10%',
                      align: "left",
                      formatter:commonObj.replacenull
                  },
                  {
                      field: 'license',
                      title: '<span class="id-icon"> </span>License授权码',
                      width: '20%',
                      align: "left",
                      formatter:function(value,row,index){
                          var operStr ='<div style="max-width: 200px; color:#1E95CD" class="ITD-cursor-pointer ITD-hidden-nowrap LicesePop" data-toggle="tooltip" title="'+value+'"> '+value+'</div>';
                          return operStr;
                      },
                  },
                  {
                      field: 'iat',
                      title: '<span class="time-icon"> </span>创建时间',
                      width: '15%',
                      align: "left",
                      formatter:commonObj.replacenull
                  },
                  {
                      field: 'ext',
                      title: '<span class="time-icon"> </span>过期时间',
                      width: '15%',
                      align: "left",
                      formatter:commonObj.replacenull
                  },
              ],
              formatTableUnit:function(value,row,index){
                  return {
                      css: {
                          "white-space":"nowrap"
                      }
                  }
              },
              formatLoadingMessage:function(){
                  return "数据正在加载中...";
              },
  
          });
      },
  
  };
  liFun.init();
  
  documentBindFunc.on('click','#licenseAddbtn',function () {
      $('#login_error').addClass('display-none').text('');
      $('#login-licenseMsg').val('');
      $('#license_addmodel').modal('show');
  });
  
  //确定 事件 (上报license 授权码)
  documentBindFunc.on('click','#addsubmit',function () {
      updateSysLicense();
  });
  //上报license 授权码
  function updateSysLicense() {
      var licenseID=$('#login-licenseMsg').val();
      if(licenseID==null||licenseID==''||licenseID==undefined){
          $('#login_error').removeClass('display-none').text('License授权码不能为空');
          return;
      }
      var req = {
          sysCode:sysComm.sysCode,
          orgId: fn.getOrgId(),
          license: licenseID
      };
      var licenseAjax = {
          method: "post",
          url: dataUrl.util.updateSysLicenseByOrgId(),
          data: JSON.stringify(req),
          contentType: 'application/json; charset=utf-8',
          dataType: 'json',
          success: function (res) {
              if (res.code == '8888') {
                  $('#login-licenseMsg').val('');
                  $('#license_addmodel').modal('hide');
                  liFun.initTable();
              } else {
                  console.log(res);
              }
          }
      };
      sysAjax(licenseAjax);
  };
  /**
   * 自定义table AJAX请求
   * @param {Object} params
   */
  function tableLoadRequest(params){
      //设置请求参数
      var pageNum = 1;
      var req= {
          baseRequest:{
              pageNum:pageNum,
              pageSize:params.data.limit
          },
          // sysCode:sysCode,
          orgId: fn.getOrgId(),
      };
      var easyUIOps = {
          method: params.type,
          url: dataUrl.util.querySysLicense(),
          data: JSON.stringify(req),
          contentType: 'application/json; charset=utf-8',
          dataType:'json',
          success: function(res){
              if(res.code == '8888'){
                  console.log(res.data)
                  params.success(res.data);
                  $('#licenseTable').bootstrapTable('insertRow',{index:1,row:{issCompany:res.data.issCompany,grantType:res.data.grantType,grantComName:res.data.grantComName,license:res.data.license,iat:res.data.iat,ext:res.data.ext}});
                  /*$("[data-toggle='tooltip']").tooltip({
                      delay: {show: 500, hide: 100},
                  });*/
  
  
              }else{
                  console.log(res);
              }
          }
      };
      sysAjax(easyUIOps);
  }