admin
2020-11-10 e130e13ef0cc4a827aa2c8d9e47d619a4cea40d0
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<!DOCTYPE html>
<html>
 
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="chrome=1" />
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
        <title>客户端网页资源</title>
        <link rel="stylesheet" type="text/css" href="../../css/doui.min.css" />
        <script src="../../js/doui.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="../../js/requestHost.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
            doui.importLoad({
                importArray: [
                    // 雷打不动
                    getHostPath() + "js/jquery.min.js",
                    getHostPath() + "js/vue.min.js",
                    // 字体图标
                    getHostPath() + "fontAdmin/iconfont.css",
                    getHostPath() + "font/iconfont.css",
                    // dom模板
                    getHostPath() + "css/admin-all.css",
                    getHostPath() + "js/admin-creat.js",
                ],
            });
        </script>
    </head>
 
    <body class="fontPC">
        <div class="winSizeBox">
 
            <!-- =============================================================== 搜索筛选(顶部) -->
            <div id="thisHeader" style="width:7.5rem;"></div>
 
            <!-- =============================================================== 表格 -->
            <div id="thisTable" class="admin-main-overHeader"></div>
 
        </div>
    </body>
 
</html>
 
 
<script type="text/javascript">
    // ==================================================================================== 页面数据
    doui.onReady({
        success: function() {
            // ----------------------------------------------------- 顶部
            // 创建顶部dom
            adminDom.header.creat({
                el: "#thisHeader",
            });
            // 输入搜索
            adminDom.header.input({
                placeholder: "标识 / 说明",
            });
            // 筛选项
            adminDom.header.screen({
                show: false,
            });
            // 切换
            adminDom.header.change({
                show: true,
                list: [{
                        key: "4",
                        value: "返利券安卓"
                    },
                    {
                        key: "9",
                        value: "返利券IOS"
                    },
                ],
            });
 
 
            // ----------------------------------------------------- 表格
            // 创建表格dom
            adminDom.table.creat({
                el: "#thisTable",
                touchSearch: function(optC) {
                    doui.showLoading({
                        content: "加载列表"
                    });
                    doui.request({
                        type: "jsonp",
                        url: gethttp() + "/admin/new/api/v1/clientParams/query",
                        data: {
                            pageIndex: optC.table.page, // 页码
                            pageSize: optC.table.pageSize, // 每页数量
                            key: optC.input[0].result, // 搜索关键字
                            systemId: optC.change.result, // 系统id
                        },
                        success: function(res) {
                            doui.hideLoading();
                            if (res.code != 0) {
                                doui.showToast({
                                    content: res.msg
                                });
                            } else {
                                // 申明 表格内容数据
                                var mo_tr = []; // tr组
                                for (var i = 0, mo = res.data.result_list; i < mo.length; i++) {
                                    // 当前行
                                    var thatTr = {
                                        check: false,
                                        td: [{
                                                title: "ID",
                                                key: mo[i].id,
                                                value: mo[i].id
                                            },
                                            {
                                                title: "标识",
                                                key: mo[i].key,
                                                value: mo[i].key,
                                                "class": "font-gray"
                                            },
                                            {
                                                title: "说明",
                                                key: mo[i].name,
                                                value: mo[i].name
                                            },
                                            {
                                                title: "有效值",
                                                key: mo[i].value,
                                                value: mo[i].value
                                            },
                                            {
                                                title: "更新时间",
                                                key: mo[i].updatetime,
                                                value: mo[i].updatetime,
                                                "class": "font-gray"
                                            },
                                            {
                                                title: "最小版本",
                                                key: mo[i].version,
                                                value: mo[i].version
                                            },
                                        ],
                                    };
                                    // 有效值分析
                                    if (typeof(thatTr.td[3].key) == "object") {
                                        thatTr.td[3].key = JSON.stringify(thatTr.td[3].key);
                                    }
                                    // 时间转化
                                    if (thatTr.td[4].key) {
                                        doui.timestampToDate({
                                            timestamp: thatTr.td[4].key,
                                            success: function(res) {
                                                thatTr.td[4].value = res;
                                            }
                                        });
                                    }
                                    // 将当前行放入tr组
                                    mo_tr.push(thatTr);
                                }
                                // 更新表格的数据
                                adminDom.table.opt({
                                    pageMax: res.data.pe.totalPage
                                }); // 最大页码
                                adminDom.table.tbody({
                                    tr: mo_tr
                                }); // 内容数据
                            }
                        }
                    });
                }
            });
            // 表格设置
            adminDom.table.opt({
                pageSize: 20,
            });
            // 表格头排
            adminDom.table.thead({
                th: [{
                        title: "ID",
                        width: "",
                        orderUp: "",
                        orderDown: ""
                    },
                    {
                        title: "标识",
                        width: "1.4rem",
                        orderUp: "",
                        orderDown: "",
                        edit: {
                            type: "text",
                            placeholder: "help",
                        },
                    },
                    {
                        title: "说明",
                        width: "1.4rem",
                        orderUp: "",
                        orderDown: "",
                        edit: {
                            type: "text",
                            placeholder: "帮助中心",
                        },
                    },
                    {
                        title: "有效值",
                        width: "1.4rem",
                        orderUp: "",
                        orderDown: "",
                        edit: {
                            type: "text",
                            placeholder: "http://apph5.yeshitv.com/AppPage/1.8.0/all_help_index.html",
                        },
                    },
                    {
                        title: "更新时间",
                        width: "",
                        orderUp: "",
                        orderDown: ""
                    },
                    {
                        title: "最小版本",
                        width: "",
                        orderUp: "",
                        orderDown: ""
                    },
                ]
            });
            // 工具栏
            adminDom.table.tools({
                show: true,
                list: [{
                        "title": "新建",
                        "name": "add",
                        "icon": "fi fi-plus"
                    },
                    {
                        "title": "删除",
                        "name": "del",
                        "icon": "fi fi-trash"
                    },
                    {
                        "title": "修改",
                        "name": "edit",
                        "icon": "fi fi-edit-box"
                    },
                ],
                touch: function(back) {
                    // 新建列表
                    if (back.toolName == "add") {
                        // 修改弹框创建
                        adminDom.editTan.creat({
                            el: ".winSizeBox",
                            touchSubmit: function(thereData) {
                                // 当前数据
                                var item = thereData.list;
                                // 系统平台
                                var zu_mo = new Array();
                                zu_mo.push(vm_header.change.result);
                                // 信息上传
                                doui.showLoading("正在新建");
                                doui.request({
                                    type: "jsonp",
                                    url: gethttp() + "/admin/new/api/v1/clientParams/saveAdd",
                                    data: {
                                        key: item[1].key, // 类型
                                        name: item[2].key, // 名字
                                        value: item[3].key,
                                        idArray: zu_mo,
                                    },
                                    success: function(res) {
                                        doui.hideLoading();
                                        if (res.code != 0) {
                                            doui.showToast(res.msg);
                                        } else {
                                            doui.showToast("新建成功");
                                            adminDom.editTan.remove();
                                            vm_table.search();
                                        }
                                    }
                                });
                            },
                        });
                        adminDom.editTan.opt({
                            title: "新建"
                        });
                        adminDom.editTan.thereData({
                            show: false,
                        });
                    }
 
                    // 删除列表
                    else if (back.toolName == "del") {
                        // 被选中的行id组构建
                        var zu_id = new Array();
                        for (var i = 0, mo = back.list; i < mo.length; i++) {
                            zu_id.push(mo[i][0].key);
                        }
                        // 发起请求
                        doui.showLoading("正在删除");
                        doui.request({
                            type: "jsonp",
                            url: gethttp() + "/admin/new/api/v1/clientParams/delete",
                            data: {
                                idArray: zu_id
                            },
                            success: function(res) {
                                doui.hideLoading();
                                if (res.code != 0) {
                                    doui.showToast(res.msg);
                                } else {
                                    doui.showToast("删除成功");
                                    vm_table.search();
                                }
                            }
                        });
                    }
 
                    // 修改列表
                    else if (back.toolName == "edit") {
                        if (back.list.length > 1) {
                            doui.showToast({
                                content: "一次只能操作一个"
                            });
                            return false;
                        }
                        // 修改弹框创建
                        adminDom.editTan.creat({
                            el: ".winSizeBox",
                            touchSubmit: function(thereData) {
                                // 当前数据
                                var item = thereData.list;
                                // 系统平台
                                var zu_mo = new Array();
                                zu_mo.push(vm_header.change.result);
                                // 信息上传
                                doui.showLoading("正在修改");
                                doui.request({
                                    type: "jsonp",
                                    url: gethttp() + "/admin/new/api/v1/clientParams/saveModify",
                                    data: {
                                        id: item[0].key,
                                        key: item[1].key, // 类型
                                        name: item[2].key, // 名字
                                        value: item[3].key,
                                    },
                                    success: function(res) {
                                        doui.hideLoading();
                                        if (res.code != 0) {
                                            doui.showToast(res.msg);
                                        } else {
                                            doui.showToast("修改成功");
                                            adminDom.editTan.remove();
                                            vm_table.search();
                                        }
                                    }
                                });
                            },
                        });
                        adminDom.editTan.opt({
                            title: "修改"
                        });
                        adminDom.editTan.thereData({
                            show: true,
                            list: back.list[0]
                        });
                    }
 
                }
            });
 
 
            // ----------------------------------------------------- 初始行为
            // 模拟搜索点击
            vm_table.search();
        }
    });
</script>