Quellcode durchsuchen

平台添加设备管理

gzb
wangzhonglu vor 8 Monaten
Ursprung
Commit
d8fe749ea4

+ 23
- 7
src/router/platform.js Datei anzeigen

@@ -65,10 +65,12 @@ export default {
65 65
       }
66 66
     },
67 67
     {
68
-      path: "deviceImport",
68
+      path: "deviceManageImport",
69 69
       component: () =>
70
-        import("@/views/platformSection/deviceImport/deviceImport.vue"),
71
-      name: "deviceImport",
70
+        import(
71
+          "@/views/platformSection/deviceManage/deviceManageImport/deviceManageImport.vue"
72
+        ),
73
+      name: "deviceManageImport",
72 74
       meta: {
73 75
         keepAlive: true,
74 76
         isAuth: true,
@@ -76,13 +78,27 @@ export default {
76 78
       }
77 79
     },
78 80
     {
79
-      path: "deviceExport",
80
-      component: () => import("@/views/platformSection/log/deviceExport.vue"),
81
-      name: "deviceExport",
81
+      path: "deviceManageExport",
82
+      component: () =>
83
+        import(
84
+          "@/views/platformSection/deviceManage/deviceManageExport/deviceManageExport.vue"
85
+        ),
86
+      name: "deviceManageExport",
82 87
       meta: {
83 88
         keepAlive: true,
84 89
         isAuth: true,
85
-        title: "平台管控-设备导出"
90
+        title: "平台管控-设备管理-设备导出"
91
+      }
92
+    },
93
+    {
94
+      path: "logDeviceExport",
95
+      component: () =>
96
+        import("@/views/platformSection/log/logDeviceExport.vue"),
97
+      name: "logDeviceExport",
98
+      meta: {
99
+        keepAlive: true,
100
+        isAuth: true,
101
+        title: "平台管控-日志-设备导出"
86 102
       }
87 103
     },
88 104
     {

src/views/platformSection/log/deviceExport.vue → src/views/platformSection/deviceManage/deviceManageExport/deviceManageExport.vue Datei anzeigen


src/views/platformSection/deviceImport/batch.vue → src/views/platformSection/deviceManage/deviceManageImport/batch.vue Datei anzeigen


src/views/platformSection/deviceImport/detail.vue → src/views/platformSection/deviceManage/deviceManageImport/detail.vue Datei anzeigen


src/views/platformSection/deviceImport/deviceImport.vue → src/views/platformSection/deviceManage/deviceManageImport/deviceManageImport.vue Datei anzeigen


+ 34
- 5
src/views/platformSection/index.vue Datei anzeigen

@@ -48,9 +48,31 @@
48 48
             >
49 49
           </div>
50 50
         </div>
51
-        <router-link tag="div" to="/platform/deviceImport" class="module_item">
52
-          <span>设备导入</span>
53
-        </router-link>
51
+        <div
52
+          :class="[
53
+            'module_item drop_down',
54
+            deviceManageSelected ? 'selected' : ''
55
+          ]"
56
+        >
57
+          <span class="module_title">设备管理</span>
58
+          <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
59
+          <div class="drop_down_list" v-if="routeDropdown">
60
+            <router-link
61
+              @click.native="routeDropdownChange()"
62
+              tag="div"
63
+              to="/platform/deviceManageImport"
64
+              class="drop_down_list_item"
65
+              >设备导入</router-link
66
+            >
67
+            <router-link
68
+              @click.native="routeDropdownChange()"
69
+              tag="div"
70
+              to="/platform/deviceManageExport"
71
+              class="drop_down_list_item"
72
+              >设备导出</router-link
73
+            >
74
+          </div>
75
+        </div>
54 76
         <div :class="['module_item drop_down', logSelected ? 'selected' : '']">
55 77
           <span class="module_title">日志</span>
56 78
           <Icon class="arrow_dropdown" type="md-arrow-dropdown" :size="20" />
@@ -58,7 +80,7 @@
58 80
             <router-link
59 81
               @click.native="routeDropdownChange()"
60 82
               tag="div"
61
-              to="/platform/deviceExport"
83
+              to="/platform/logDeviceExport"
62 84
               class="drop_down_list_item"
63 85
               >设备导出</router-link
64 86
             >
@@ -94,9 +116,16 @@ export default {
94 116
     networkManageSelected() {
95 117
       return this.$route.path.includes("/platform/whitelistLibrary");
96 118
     },
119
+    // 设备管理路由选中
120
+    deviceManageSelected() {
121
+      return (
122
+        this.$route.path.includes("/platform/deviceManageImport") ||
123
+        this.$route.path.includes("/platform/deviceManageExport")
124
+      );
125
+    },
97 126
     // 日志路由选中
98 127
     logSelected() {
99
-      return this.$route.path.includes("/platform/deviceExport");
128
+      return this.$route.path.includes("/platform/logDeviceExport");
100 129
     }
101 130
   },
102 131
   methods: {

+ 187
- 0
src/views/platformSection/log/logDeviceExport.vue Datei anzeigen

@@ -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>

Laden…
Abbrechen
Speichern