|
@@ -0,0 +1,187 @@
|
|
1
|
+<template>
|
|
2
|
+ <div class="main_root">
|
|
3
|
+ <div class="search_header">
|
|
4
|
+ <div class="search_left">
|
|
5
|
+ <Input
|
|
6
|
+ v-model="searchForm.name"
|
|
7
|
+ placeholder="请输入名称"
|
|
8
|
+ search
|
|
9
|
+ @on-search="searchList()"
|
|
10
|
+ style="width: 150px"
|
|
11
|
+ />
|
|
12
|
+ </div>
|
|
13
|
+ <Button type="primary" class="primary_btn" @click="toExport()"
|
|
14
|
+ >导出</Button
|
|
15
|
+ >
|
|
16
|
+ </div>
|
|
17
|
+ <div class="table_wrap">
|
|
18
|
+ <Table :columns="columns" :data="searchForm.list">
|
|
19
|
+ <template slot-scope="{ row }" slot="actionSlot">
|
|
20
|
+ <div class="action_list">
|
|
21
|
+ <div @click="toExport(row)">导出</div>
|
|
22
|
+ </div>
|
|
23
|
+ </template>
|
|
24
|
+ </Table>
|
|
25
|
+ </div>
|
|
26
|
+ <div class="page_wrap">
|
|
27
|
+ <Page
|
|
28
|
+ :transfer="true"
|
|
29
|
+ :total="searchForm.total"
|
|
30
|
+ :current="searchForm.page"
|
|
31
|
+ :page-size="searchForm.size"
|
|
32
|
+ :page-size-opts="[10, 20, 40, 60]"
|
|
33
|
+ @on-change="pageChange"
|
|
34
|
+ @on-page-size-change="pageSizeChange"
|
|
35
|
+ show-total
|
|
36
|
+ show-sizer
|
|
37
|
+ ></Page>
|
|
38
|
+ </div>
|
|
39
|
+ </div>
|
|
40
|
+</template>
|
|
41
|
+
|
|
42
|
+<script>
|
|
43
|
+import { exportToExcel } from "@/utils/exportToExcel";
|
|
44
|
+import { logDeviceBind_list, logDeviceBind_list_all } from "@/api/log";
|
|
45
|
+export default {
|
|
46
|
+ data() {
|
|
47
|
+ return {
|
|
48
|
+ searchForm: {
|
|
49
|
+ name: "",
|
|
50
|
+ page: 1,
|
|
51
|
+ size: 10,
|
|
52
|
+ list: [],
|
|
53
|
+ total: 0
|
|
54
|
+ },
|
|
55
|
+ columns: [
|
|
56
|
+ {
|
|
57
|
+ title: "序号",
|
|
58
|
+ align: "center",
|
|
59
|
+ width: 70,
|
|
60
|
+ render: (h, params) => {
|
|
61
|
+ return h(
|
|
62
|
+ "span",
|
|
63
|
+ params.index +
|
|
64
|
+ (this.searchForm.page - 1) * this.searchForm.size +
|
|
65
|
+ 1
|
|
66
|
+ );
|
|
67
|
+ }
|
|
68
|
+ },
|
|
69
|
+ {
|
|
70
|
+ title: "区域名称",
|
|
71
|
+ key: "regionName",
|
|
72
|
+ align: "center"
|
|
73
|
+ },
|
|
74
|
+ {
|
|
75
|
+ title: "学校数",
|
|
76
|
+ key: "schoolnum",
|
|
77
|
+ align: "center"
|
|
78
|
+ },
|
|
79
|
+ {
|
|
80
|
+ title: "用户数",
|
|
81
|
+ key: "usernum",
|
|
82
|
+ align: "center"
|
|
83
|
+ },
|
|
84
|
+ {
|
|
85
|
+ title: "设备数",
|
|
86
|
+ key: "snnum",
|
|
87
|
+ align: "center"
|
|
88
|
+ },
|
|
89
|
+ {
|
|
90
|
+ title: "操作",
|
|
91
|
+ slot: "actionSlot",
|
|
92
|
+ width: 90,
|
|
93
|
+ align: "center"
|
|
94
|
+ }
|
|
95
|
+ ]
|
|
96
|
+ };
|
|
97
|
+ },
|
|
98
|
+ created() {
|
|
99
|
+ this.searchList();
|
|
100
|
+ },
|
|
101
|
+ computed: {
|
|
102
|
+ powerParams() {
|
|
103
|
+ return this.$store.getters.powerParams;
|
|
104
|
+ }
|
|
105
|
+ },
|
|
106
|
+ methods: {
|
|
107
|
+ // 搜索
|
|
108
|
+ searchList() {
|
|
109
|
+ this.searchForm.page = 1;
|
|
110
|
+ this.getList();
|
|
111
|
+ },
|
|
112
|
+ // 页码改变
|
|
113
|
+ pageChange(page) {
|
|
114
|
+ this.searchForm.page = page;
|
|
115
|
+ this.getList();
|
|
116
|
+ },
|
|
117
|
+ // 每页显示数量改变
|
|
118
|
+ pageSizeChange(size) {
|
|
119
|
+ this.searchForm.size = size;
|
|
120
|
+ this.searchForm.page = 1;
|
|
121
|
+ this.getList();
|
|
122
|
+ },
|
|
123
|
+ // 获取列表
|
|
124
|
+ getList() {
|
|
125
|
+ logDeviceBind_list({
|
|
126
|
+ rtype: this.powerParams.rtype,
|
|
127
|
+ objectid: this.powerParams.objectid,
|
|
128
|
+ page: this.searchForm.page,
|
|
129
|
+ size: this.searchForm.size,
|
|
130
|
+ name: this.searchForm.name
|
|
131
|
+ }).then((data) => {
|
|
132
|
+ if (data.code === 0) {
|
|
133
|
+ this.searchForm.list = data.obj.data;
|
|
134
|
+ this.searchForm.total = data.obj.total;
|
|
135
|
+ } else {
|
|
136
|
+ this.$Message.error(data.msg);
|
|
137
|
+ }
|
|
138
|
+ });
|
|
139
|
+ },
|
|
140
|
+ toExport(row) {
|
|
141
|
+ let form = {
|
|
142
|
+ rtype: this.powerParams.rtype,
|
|
143
|
+ objectid: this.powerParams.objectid
|
|
144
|
+ };
|
|
145
|
+ if (row) {
|
|
146
|
+ form.regionid = row.regionid;
|
|
147
|
+ }
|
|
148
|
+ logDeviceBind_list_all(form).then((data) => {
|
|
149
|
+ if (data.code === 0) {
|
|
150
|
+ exportToExcel(
|
|
151
|
+ [
|
|
152
|
+ {
|
|
153
|
+ list: data.obj.map((item) => {
|
|
154
|
+ return {
|
|
155
|
+ 区域名称: item.regionName,
|
|
156
|
+ 学校数: item.schoolnum,
|
|
157
|
+ 用户数: item.usernum,
|
|
158
|
+ 设备数: item.snnum
|
|
159
|
+ };
|
|
160
|
+ }),
|
|
161
|
+ name: "设备导出"
|
|
162
|
+ }
|
|
163
|
+ ],
|
|
164
|
+ `设备导出`
|
|
165
|
+ );
|
|
166
|
+ } else {
|
|
167
|
+ this.$Message.error(data.msg);
|
|
168
|
+ }
|
|
169
|
+ });
|
|
170
|
+ }
|
|
171
|
+ }
|
|
172
|
+};
|
|
173
|
+</script>
|
|
174
|
+
|
|
175
|
+<style lang="less" scoped>
|
|
176
|
+.search_header {
|
|
177
|
+ display: flex;
|
|
178
|
+ justify-content: space-between;
|
|
179
|
+ align-items: center;
|
|
180
|
+ margin: 16px 16px;
|
|
181
|
+ .search_left {
|
|
182
|
+ display: flex;
|
|
183
|
+ justify-content: flex-start;
|
|
184
|
+ align-items: center;
|
|
185
|
+ }
|
|
186
|
+}
|
|
187
|
+</style>
|