Blame view

assets/syspages/js/dictionarymanage.js 4.04 KB
10646c94   Andy   add
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
  /**
   * Created by chenbiao on 2017/11/13.
   */
  //
  
  (function() {
      var fun = {
  
          init: function() {
              //初始化下拉框
              // fun.initSelect();
              fun.createTableData();
          },
          //生成表格数据
          createTableData: function() {
              $('#recordtable').bootstrapTable('destroy').bootstrapTable({
                  striped: true, //表格显示条纹
                  pagination: true, //启动分页
                  pageNumber: 1, //当前第几页
                  showColumns: false,
                  pageSize: 10, //每页显示的记录数
                  pageList: [10, 15, 20], //记录数可选列表
                  sidePagination: 'server', //表示服务端分页
                  queryParamsType: 'limit',
                  method: 'POST', //请求方法
                  // fixedColumns:true,
                  // fixedNumber:1,
                  // leftFixedColumns: true,
                  // leftFixedNumber: 2,
                  paginationPreText: '<',
                  paginationNextText: '>',
                  ajax: tableLoadRequest, //自定义ajax加载数据
                  uniqueId: 'id',
                  columns: [
                      {
                          field: 'codeKind',
                          title: '<span class="information-icon"></span>字典编号',
                          width: '5%',
                          align: 'left',
                          formatter:commonObj.replacenull
                      },
                      {
                          field: 'codeName',
                          title: '<span class="dictionary-icon"></span>字典名称',
                          width: '10%',
                          align: 'left',
                          formatter:commonObj.replacenull
                      },
                      {
                          field: 'codeValue',
                          title: '<span class="business-icon"></span>字典项编号',
                          width: '5%',
                          align: 'left',
                          formatter:commonObj.replacenull
                      },
                      {
                          field: 'codeValueName',
                          title: '<span class="dictionary-icon"></span>字典项名称',
                          width: '8%',
                          align: 'left',
                          formatter:commonObj.replacenull
                      },
                      {
                          field: 'createDate',
                          title: '<span class="time-icon"></span>创建时间',
                          width: '10%',
                          align: 'left',
                          formatter:commonObj.timeFormatter
                      }
                  ]
              });
  
          },
  
          /*获取查询参数*/
          getQueryParam: function() {
              var codeKind = $("#codeKind").val();
              var codeName = $("#codeName").val();
  
              var req = {
                  codeKind: codeKind,
                  codeName: codeName
              };
              console.log(req);
              return req;
          },
  
      };
  
      //初始执行
      fun.init();
     documentBindFunc.on('click', '#queryBtn', function() {
          fun.createTableData();
      });
  
  
      /**
       * 自定义table AJAX请求
       * @param {Object} params
       */
      function tableLoadRequest(params) {
          var req = fun.getQueryParam();
          //设置请求参数
          var pageNum = (params.data.offset / params.data.limit) + 1;
  
          //条件查询
          req.baseRequest = {
              pageNum: pageNum,
              pageSize: params.data.limit
          };
          req.sysCode = sysComm.sysCode;
          var opt = {
              method: 'post',
              url: dataUrl.util.getdatadicinfo(),
              data: JSON.stringify(req),
              contentType: 'application/json; charset=utf-8',
              dataType: 'json',
              success: function(res) {
                  console.log(res);
                  if(res.code == '8888') {
                      params.success(res.data);
                  }
              }
          };
          sysAjax(opt);
      }
  })
  ();