Browse Source

Merge branch 'master' of http://121.42.53.174:3000/jiapeng/console-front.git

yunkai 8 years ago
parent
commit
a2454c9bb2
4 changed files with 240 additions and 1 deletions
  1. 14 0
      css/model/sys/pictable.css
  2. 49 0
      html/model/sys/pictable/index.html
  3. 1 1
      html/test.html
  4. 176 0
      js/model/sys/pictable/index.js

+ 14 - 0
css/model/sys/pictable.css

@ -0,0 +1,14 @@
1
@charset "utf-8";
2
.sys_pictable_index .queryForm{
3
    position: relative;
4
}
5
.sys_pictable_index .queryForm .icon-search{
6
    position: absolute;
7
    top:7px;
8
    right:15px;
9
    font-size:25px;
10
}
11
.sys_pictable_index .table-opt .icon {
12
    margin: 10px;
13
    font-size: 20px;
14
}

+ 49 - 0
html/model/sys/pictable/index.html

@ -0,0 +1,49 @@
1
<div class="sys_pictable_index">
2
    <div class="modal-ctrl">
3
        <i class="icon icon-times"></i>
4
    </div>
5
6
7
    <div class="container dt-form">
8
        <div class="row">
9
            <div class="col-2 item-caption">名称</div>
10
            <div class="col-4">
11
                <div class="form-item dyn-select queried"  name="name"></div>
12
            </div>
13
            <!--<div class="col-2 item-caption">查看</div>-->
14
            <div class="col-6">
15
                <div class="btn opt-query">查看</div>
16
            </div>
17
        </div>
18
19
    </div>
20
    <div id="type" style="height:400px"></div>
21
    <div class="container dt-tpl-2">
22
        <div>用户流量</div>
23
        <table class="table table-bordered">
24
            <thead>
25
            <tr>
26
                <th>时间</th>
27
                <th>新认领客户</th>
28
                <th>新认领成功客户</th>
29
                <th>累计认领成功客户</th>
30
                <th>累计认领客户</th>
31
            </tr>
32
            </thead>
33
            <tbody>
34
            <tr ch-dir="list">
35
                <td>{{createTime}}</td>
36
                <td>{{znum-count}}</td>
37
                <td>{{jnum-count}}</td>
38
                <td>{{ljnum}}</td>
39
                <td>{{lznum}}</td>
40
            </tr>
41
            </tbody>
42
            <tbody ch-dir="array.empty">
43
            <tr>
44
                <td colspan="7">表格暂无数据</td>
45
            </tr>
46
            </tbody>
47
        </table>
48
    </div>
49
</div>

+ 1 - 1
html/test.html

@ -59,7 +59,7 @@
59 59
	<script>
60 60
		$(function() {
61 61
			$.use(["spa", "util", "form"], function(spa, util, fb) {
62
				fb.build($(".dt-form"));
62
				fb.build($(".dt-form"),{qq:{maxShowCount:15}});
63 63

64 64
			});
65 65
		});

+ 176 - 0
js/model/sys/pictable/index.js

@ -0,0 +1,176 @@
1
;
2
spa_define(function () {
3
    return $.use(["spa", "code", "form", "util", "dict"], function (spa, code, form, util, dict) {
4
        return {
5
            main: function () {
6
                var root = spa.findInMain(".sys_pictable_index");
7
                var cr = code.parseCode(root.find(".dt-tpl-2"));
8
                var myChart = echarts.init(document.getElementById('type'));
9
10
                var dynUser = {ready: true};
11
12
                util.get("../ajax/sys/user/all",null,function(data){
13
                    var items =dynUser.items = [];
14
                    data.forEach(function(item){
15
                        items.push({code:item.id,caption:item.name});
16
                    });
17
                    root.find(".dyn-select").attr("defVal",util.data("loginUser").id);
18
                    dynUser.formRef = form.build(root.find(".dt-form"),{name:dynUser});
19
                });
20
21
                cr.shell("count", function (env) {
22
                    var v = env.cd[this.k];
23
                    if (v === 0) {
24
                        return 0;
25
                    }
26
                    return v;
27
                });
28
29
                var loadChart = function () {
30
                    util.get("../ajax/sys/user/pictable/"+util.data("loginUser").id,null,function (data) {
31
                        var colors = ['#c23531', '#82C8FA'];
32
                        var option = {
33
                            color: colors,
34
                            title: {
35
                                text: '个人业绩统计',
36
                                subtext: '最近7天'
37
                            },
38
                            tooltip: {
39
                                trigger: 'axis'
40
                            },
41
                            legend: {
42
                                data: ['新增用户', '新增激活用户']
43
                            },
44
                            xAxis: {
45
                                data: data.map(function (item) {
46
                                    return item.createTime;
47
                                }),
48
                                boundaryGap: false
49
                            },
50
                            yAxis: {
51
                                splitLine: {
52
                                    show: false
53
                                },
54
                                boundaryGap: false,
55
                                type: "value",
56
                                interval: 1,
57
                                min: 0
58
                            },
59
                            toolbox: {
60
                                show: true,
61
                                feature: {
62
                                    dataZoom: {
63
                                        yAxisIndex: 'none'
64
                                    },
65
                                    dataView: {readOnly: true},
66
                                    magicType: {type: ['line', 'bar']},
67
                                    restore: {},
68
                                    saveAsImage: {}
69
                                }
70
                            },
71
                            dataZoom: [{
72
                                startValue: ""
73
                            }, {
74
                                type: 'inside'
75
                            }],
76
                            visualMap: {
77
                                top: 10,
78
                                right: 10,
79
                            },
80
                            series: [{
81
                                name: '新增用户',
82
                                type: 'line',
83
                                data: data.map(function (item) {
84
                                    return item.znum;
85
                                }),
86
                            }, {
87
                                name: '新增激活用户',
88
                                type: 'line',
89
                                data: data.map(function (item) {
90
                                    return item.jnum;
91
                                })
92
                            }
93
                            ]
94
                        };
95
                        cr.val(data);
96
                        myChart.setOption(option);
97
                    })
98
                };
99
                root.find(".opt-query").on("click", function () {
100
                    $.util.get("../ajax/sys/user/pictable/" + dynUser.formRef.val().name, null, function (data) {
101
                        var colors = ['#c23531', '#82C8FA'];
102
                        var option = {
103
                            color: colors,
104
                            title: {
105
                                text: '个人业绩统计',
106
                                subtext: '最近7天'
107
                            },
108
                            tooltip: {
109
                                trigger: 'axis'
110
                            },
111
                            legend: {
112
                                data: ['新增用户', '新增激活用户']
113
                            },
114
                            xAxis: {
115
                                data: data.map(function (item) {
116
                                    return item.createTime;
117
                                }),
118
                                boundaryGap: false
119
                            },
120
                            yAxis: {
121
                                splitLine: {
122
                                    show: false
123
                                },
124
                                boundaryGap: false,
125
                                type: "value",
126
                                interval: 1,
127
                                min: 0
128
                            },
129
                            toolbox: {
130
                                show: true,
131
                                feature: {
132
                                    dataZoom: {
133
                                        yAxisIndex: 'none'
134
                                    },
135
                                    dataView: {readOnly: true},
136
                                    magicType: {type: ['line', 'bar']},
137
                                    restore: {},
138
                                    saveAsImage: {}
139
                                }
140
                            },
141
                            dataZoom: [{
142
                                startValue: ""
143
                            }, {
144
                                type: 'inside'
145
                            }],
146
                            visualMap: {
147
                                top: 10,
148
                                right: 10,
149
                            },
150
                            series: [{
151
                                name: '新增用户',
152
                                type: 'line',
153
                                data: data.map(function (item) {
154
                                    return item.znum;
155
                                }),
156
                            }, {
157
                                name: '新增激活用户',
158
                                type: 'line',
159
                                data: data.map(function (item) {
160
                                    return item.jnum;
161
                                })
162
                            }
163
                            ]
164
                        };
165
                        myChart.setOption(option);
166
                        cr.val(data);
167
                    });
168
                });
169
                cr.listen(dict.doTransfer);
170
                loadChart();
171
172
173
            }
174
        }
175
    });
176
});