|
|
|
1
|
+{include file="common/head"/}
|
|
|
|
2
|
+<div class="admin-main layui-anim layui-anim-upbit">
|
|
|
|
3
|
+ <fieldset class="layui-elem-field layui-field-title">
|
|
|
|
4
|
+ <legend>{:$title}</legend>
|
|
|
|
5
|
+ </fieldset>
|
|
|
|
6
|
+ <div class="demoTable">
|
|
|
|
7
|
+ 商家:
|
|
|
|
8
|
+ <div class="layui-input-inline">
|
|
|
|
9
|
+ <input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off">
|
|
|
|
10
|
+ </div>
|
|
|
|
11
|
+
|
|
|
|
12
|
+ 商家来源:
|
|
|
|
13
|
+ <div class="layui-input-inline layui-form">
|
|
|
|
14
|
+ <div class="layui-input-8">
|
|
|
|
15
|
+ <select name="class" id="channel" lay-filter="myselect">
|
|
|
|
16
|
+ <option value="1">合作</option>
|
|
|
|
17
|
+ <option value="2">推广</option>
|
|
|
|
18
|
+ <option value="3">测试</option>
|
|
|
|
19
|
+ </select>
|
|
|
|
20
|
+ </div>
|
|
|
|
21
|
+ </div>
|
|
|
|
22
|
+
|
|
|
|
23
|
+ 厂商:
|
|
|
|
24
|
+ <div class="layui-input-inline layui-form">
|
|
|
|
25
|
+ <div class="layui-input-8">
|
|
|
|
26
|
+ <select name="class" id="manufacturer" lay-filter="manufacturer">
|
|
|
|
27
|
+ <option value="1">铱方</option>
|
|
|
|
28
|
+ <option value="2">极钛</option>
|
|
|
|
29
|
+ </select>
|
|
|
|
30
|
+ </div>
|
|
|
|
31
|
+ </div>
|
|
|
|
32
|
+ <button class="layui-btn" id="search" data-type="reload">查询</button>
|
|
|
|
33
|
+ </div>
|
|
|
|
34
|
+ <table class="layui-table" id="list" lay-filter="list"></table>
|
|
|
|
35
|
+</div>
|
|
|
|
36
|
+<script type="text/html" id="toolbarDemo">
|
|
|
|
37
|
+ <div class="layui-btn-container">
|
|
|
|
38
|
+ <button class="layui-btn layui-btn-sm" lay-event="getCheckData">添加到灰度用户</button>
|
|
|
|
39
|
+ </div>
|
|
|
|
40
|
+</script>
|
|
|
|
41
|
+{include file="common/foot"/}
|
|
|
|
42
|
+<script>
|
|
|
|
43
|
+ layui.use(['table','form','laydate'], function() {
|
|
|
|
44
|
+ var table = layui.table,laydate = layui.laydate,$ = layui.jquery;
|
|
|
|
45
|
+ var tableIn = table.render({
|
|
|
|
46
|
+ elem: '#list',
|
|
|
|
47
|
+ url: '{:url("device_list")}',
|
|
|
|
48
|
+ method: 'post',
|
|
|
|
49
|
+ title: '商家设备列表',
|
|
|
|
50
|
+ page:true,
|
|
|
|
51
|
+ toolbar: '#toolbarDemo',
|
|
|
|
52
|
+ cols: [[
|
|
|
|
53
|
+ {checkbox:true,fixed: true},
|
|
|
|
54
|
+ {field: 'id', title: '{:lang("id")}',width:100,fixed: true},
|
|
|
|
55
|
+ {field: 'sid',title: '商家编号',width:100},
|
|
|
|
56
|
+ {field: 'sellername', title: '所属商家'},
|
|
|
|
57
|
+ {field: 'device', title: '设备编号'},
|
|
|
|
58
|
+ {field: 'type', title: '厂商'},
|
|
|
|
59
|
+ {field: 'version', title: '设备版本号'},
|
|
|
|
60
|
+ ]],
|
|
|
|
61
|
+ done: function(res, curr, count){
|
|
|
|
62
|
+ }
|
|
|
|
63
|
+ ,id: 'testReload'
|
|
|
|
64
|
+ ,page: true
|
|
|
|
65
|
+ ,limit:15
|
|
|
|
66
|
+ });
|
|
|
|
67
|
+
|
|
|
|
68
|
+ //搜索
|
|
|
|
69
|
+ $('#search').on('click', function() {
|
|
|
|
70
|
+ //关键字
|
|
|
|
71
|
+ var key = $('#key').val();
|
|
|
|
72
|
+ //传参
|
|
|
|
73
|
+ tableIn.reload({ page: {page: 1},where: {key: key,channel: $('#channel').val(),manufacturer: $('#manufacturer').val()}});
|
|
|
|
74
|
+ });
|
|
|
|
75
|
+
|
|
|
|
76
|
+ var $ = layui.$, active = {
|
|
|
|
77
|
+ reload: function(){
|
|
|
|
78
|
+ var key = $('#key');
|
|
|
|
79
|
+ var channel = $('#channel');
|
|
|
|
80
|
+ //执行重载
|
|
|
|
81
|
+ table.reload('testReload', {
|
|
|
|
82
|
+ page: {
|
|
|
|
83
|
+ curr: 1 //重新从第 1 页开始
|
|
|
|
84
|
+ }
|
|
|
|
85
|
+ ,where: {
|
|
|
|
86
|
+ key: {
|
|
|
|
87
|
+ id: key.val(),
|
|
|
|
88
|
+ channel: channel.val()
|
|
|
|
89
|
+ }
|
|
|
|
90
|
+ }
|
|
|
|
91
|
+ });
|
|
|
|
92
|
+ }
|
|
|
|
93
|
+ };
|
|
|
|
94
|
+
|
|
|
|
95
|
+ //设置为灰度用户
|
|
|
|
96
|
+ table.on('toolbar(list)', function(obj){
|
|
|
|
97
|
+ var checkStatus = table.checkStatus(obj.config.id);
|
|
|
|
98
|
+ switch(obj.event){
|
|
|
|
99
|
+ case 'getCheckData':
|
|
|
|
100
|
+ var data = checkStatus.data;
|
|
|
|
101
|
+ arr = new Array();
|
|
|
|
102
|
+ if (data.length > 0) {
|
|
|
|
103
|
+ for (var i = 0; i < data.length; i++) {
|
|
|
|
104
|
+ arr.push(data[i]['id']);
|
|
|
|
105
|
+ }
|
|
|
|
106
|
+ }
|
|
|
|
107
|
+ if(arr.length <= 0){
|
|
|
|
108
|
+ layer.alert('请选择一部分设备在进行操作');return;
|
|
|
|
109
|
+ }
|
|
|
|
110
|
+ //发送设备ID
|
|
|
|
111
|
+ layer.confirm('确定将选中设备设为灰度用户?' , function(index){
|
|
|
|
112
|
+ $.post("{:url('add_gray_user')}",{id:arr},function(res){
|
|
|
|
113
|
+ if(res.code==1){
|
|
|
|
114
|
+ layer.msg(res.msg,{time:1000,icon:1});
|
|
|
|
115
|
+ //表格重载
|
|
|
|
116
|
+ var demoReload = $('#demoReload');
|
|
|
|
117
|
+ table.reload('testReload', {
|
|
|
|
118
|
+ page: {
|
|
|
|
119
|
+ curr: 1 //重新从第 1 页开始
|
|
|
|
120
|
+ }
|
|
|
|
121
|
+ ,where: {
|
|
|
|
122
|
+ key: {
|
|
|
|
123
|
+ id: demoReload.val()
|
|
|
|
124
|
+ }
|
|
|
|
125
|
+ }
|
|
|
|
126
|
+ });
|
|
|
|
127
|
+ }else{
|
|
|
|
128
|
+ layer.msg(res.msg,{time:1000,icon:2});
|
|
|
|
129
|
+ }
|
|
|
|
130
|
+ });
|
|
|
|
131
|
+ layer.close(index);
|
|
|
|
132
|
+ });
|
|
|
|
133
|
+ //layer.alert(JSON.stringify(data));
|
|
|
|
134
|
+ break;
|
|
|
|
135
|
+ };
|
|
|
|
136
|
+ });
|
|
|
|
137
|
+ })
|
|
|
|
138
|
+</script> |