Blame view

public/assets/js/backend/antis/contract/comment.js 7.95 KB
2db47680   hexiaodong   chore: 初始提交 php 遗...
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {

  

      var Controller = {

          index: function () {

  

              // 初始化表格参数配置

              Table.api.init();

  

              //绑定事件

              $('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {

                  var panel = $($(this).attr("href"));

                  if (panel.length > 0) {

                      Controller.table[panel.attr("id")].call(this);

                      $(this).on('click', function (e) {

                          $($(this).attr("href")).find(".btn-refresh").trigger("click");

                      });

                  }

                  //移除绑定的事件

                  $(this).unbind('shown.bs.tab');

              });

  

              //必须默认触发shown.bs.tab事件

              $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");

          },

          table: {

              first: function () {

                  // 初始化表格参数配置

                  Table.api.init({

                      extend: {

                          index_url: 'antis/contract/comment/index',

                          table: 'comment'

                      }

                  });

  

                  var table = $("#table");

  

                  // 初始化表格

                  table.bootstrapTable({

                      url: 'antis/contract/comment/index?type=0',

                      toolbar: '#toolbar',

                      sortName: 'id',

                      columns: [

                          [

                              {field: 'state', checkbox: true},

                              {

                                  field : 'record.content', title : '跟进内容', fixedColumns : true, formatter : function (value, row, index) {

  

                                      if(row.record){

                                          return "<a href='javascript:void(0);' data-id='" + row.record.id + "' class='show-record'>" +  row.record.content + "</a>";

                                      }else{

                                          return row.record.id;

                                      }

  

                                  },operate:false

                              },

                              {field: 'content', title: __('评论内容')},

                              {field: 'staff.name', title: __('创建人'),operate:false},

                              {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},

  

                          ]

                      ],

                      //启用普通表单搜索

                      commonSearch: true,

                      searchFormVisible: true,

                  });

                  $(document).on('click', '.show-record', function (data) {

                      var area = [$(window).width() > 1200 ? '1200px' : '95%', $(window).height() > 800 ? '800px' : '95%'];

                      var options = {

                          shadeClose : false,

                          shade      : [0.3, '#393D49'],

                          area       : area,

                          callback   : function (value) {

                              //在回调函数里可以调用你的业务代码实现前端的各种逻辑和效果

                          }

                      };

                      Fast.api.open("antis/customer/record/detail?ids=" + $(this).data('id'), '跟进详情', options);

                  });

                  // 为表格绑定事件

                  Table.api.bindevent(table);

                  $('.search').hide();

                  $('.btn-import').hide();

              },

              second: function () {

                  // 初始化表格参数配置

                  Table.api.init({

                      extend: {

                          index_url: 'antis/contract/comment/index',

                          table: 'comment'

                      }

                  });

  

                  var table = $("#table1");

  

                  // 初始化表格

                  table.bootstrapTable({

                      url: 'antis/contract/comment/index?type=1',

                      toolbar: '#toolbar1',

                      sortName: 'id',

                      columns: [

                          [

                              {field: 'state', checkbox: true},

                              {

                                  field : 'record.content', title : '跟进内容', fixedColumns : true, formatter : function (value, row, index) {

  

                                      if(row.record){

                                          return "<a href='javascript:void(0);' data-id='" + row.record.id + "' class='show-record'>" +  row.record.content + "</a>";

                                      }else{

                                          return row.record.id;

                                      }

  

                                  },operate:false

                              },

                              {field: 'content', title: __('评论内容')},

                              {field: 'staff.name', title: __('创建人'),operate:false},

                              {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},

  

                          ]

                      ],

                      //启用普通表单搜索

                      commonSearch: true,

                      searchFormVisible: true,

                  });

                  // 为表格绑定事件

                  Table.api.bindevent(table);

                  $('.search').hide();

                  $('.btn-import').hide();

              },

              third: function () {

                  // 初始化表格参数配置

                  Table.api.init({

                      extend: {

                          index_url: 'antis/contract/comment/index',

                          table: 'comment'

                      }

                  });

  

                  var table = $("#table2");

  

                  // 初始化表格

                  table.bootstrapTable({

                      url: 'antis/contract/comment/index?type=2',

                      toolbar: '#toolbar2',

                      sortName: 'id',

                      columns: [

                          [

                              {field: 'state', checkbox: true},

                              {

                                  field : 'record.content', title : '跟进内容', fixedColumns : true, formatter : function (value, row, index) {

  

                                      if(row.record){

                                          return "<a href='javascript:void(0);' data-id='" + row.record.id + "' class='show-record'>" +  row.record.content + "</a>";

                                      }else{

                                          return row.record.id;

                                      }

  

                                  },operate:false

                              },

                              {field: 'content', title: __('评论内容')},

                              {field: 'staff.name', title: __('创建人'),operate:false},

                              {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},

  

                          ]

                      ],

                      //启用普通表单搜索

                      commonSearch: true,

                      searchFormVisible: true,

                  });

                  // 为表格绑定事件

                  Table.api.bindevent(table);

                  $('.search').hide();

                  $('.btn-import').hide();

              },

          },

          add: function () {

              Controller.api.bindevent();

  

          },

          api: {

              bindevent: function () {

                  Form.api.bindevent($("form[role=form]"));

              },

              formatter: {

  

              }

          }

  

      };

      return Controller;

  });