ソースを参照

平台-设备导入

gzb
wangzhonglu 9ヶ月前
コミット
a5d6a1580b

+ 21
- 6
src/api/device_manager.js ファイルの表示

@@ -41,29 +41,44 @@ export const device_manager_export_id = (data) =>
41 41
 export const device_manager_detail_d = (data) =>
42 42
   setRequest("device_manager/detail_d", data);
43 43
 /**
44
- * 11.3.1设备导入--列表
44
+ * 11.3.1设备导入--列表(按详情)
45 45
  */
46 46
 export const deviceAuth_list = (data) => setRequest("deviceAuth/list", data);
47 47
 /**
48
- * 11.3.2设备导入--新增
48
+ * 11.3.1.2设备导入--列表(按批次)
49
+ */
50
+export const deviceAuth_list_batch = (data) =>
51
+  setRequest("deviceAuth/list_batch", data);
52
+/**
53
+ * 11.3.2设备导入--新增(按详情)
49 54
  */
50 55
 export const deviceAuth_add = (data) => setRequest("deviceAuth/add", data);
51 56
 /**
52
- * 11.3.3设备导入--更新
57
+ * 11.3.3设备导入--更新(按详情)
53 58
  */
54 59
 export const deviceAuth_edit = (data) => setRequest("deviceAuth/edit", data);
55 60
 /**
56
- * 11.3.4设备导入--删除
61
+ * 11.3.4设备导入--删除(按详情)
57 62
  */
58 63
 export const deviceAuth_delete = (data) =>
59 64
   setRequest("deviceAuth/delete", data);
60 65
 /**
61
- * 11.3.4.2设备导入--批量删除
66
+ * 11.3.4.2设备导入--批量删除(按详情)
62 67
  */
63 68
 export const deviceAuth_batch_delete = (data) =>
64 69
   setRequest("deviceAuth/batch_delete", data);
65 70
 /**
66
- * 11.3.4.2设备导入--批量删除
71
+ * 11.3.5设备导入--导入
67 72
  */
68 73
 export const deviceAuth_import = (data) =>
69 74
   setRequest("deviceAuth/import", data);
75
+/**
76
+ * 11.3.6设备导入--详情(按批次)
77
+ */
78
+export const deviceAuth_list_sn = (data) =>
79
+  setRequest("deviceAuth/list_sn", data);
80
+/**
81
+ * 11.3.7设备导入--删除(按批次)
82
+ */
83
+export const deviceAuth_delete_db = (data) =>
84
+  setRequest("deviceAuth/delete_db", data);

+ 475
- 0
src/views/platformSection/deviceImport/batch.vue ファイルの表示

@@ -0,0 +1,475 @@
1
+<template>
2
+  <div>
3
+    <div class="search_header">
4
+      <div class="search_left">
5
+        <Select
6
+          v-model="searchForm.regionid"
7
+          :transfer="true"
8
+          @on-change="searchList()"
9
+          style="margin-right: 16px; width: 150px"
10
+        >
11
+          <Option :value="0">所有区域</Option>
12
+          <Option
13
+            v-for="regionItem in searchForm.regionList"
14
+            :value="regionItem.regionid"
15
+            :key="regionItem.regionid"
16
+            >{{ regionItem.regionName }}</Option
17
+          >
18
+        </Select>
19
+        <DatePicker
20
+          v-model="searchForm.dataRange"
21
+          @on-change="searchList()"
22
+          :transfer="true"
23
+          type="daterange"
24
+          placeholder="请选择年月日进行搜索"
25
+          style="width: 220px"
26
+        ></DatePicker>
27
+      </div>
28
+      <div class="search_right">
29
+        <Button type="primary" class="primary_btn" @click="toImport()"
30
+          >导入</Button
31
+        >
32
+      </div>
33
+    </div>
34
+    <div class="table_wrap">
35
+      <Table :columns="columns" :data="searchForm.list">
36
+        <template slot-scope="{ row }" slot="actionSlot">
37
+          <div class="action_list">
38
+            <div @click="toView(row)">查看</div>
39
+            <div class="action_del" @click="toDel(row)">删除</div>
40
+          </div>
41
+        </template>
42
+      </Table>
43
+    </div>
44
+    <div class="page_wrap">
45
+      <Page
46
+        :transfer="true"
47
+        :total="searchForm.total"
48
+        :current="searchForm.page"
49
+        :page-size="searchForm.size"
50
+        :page-size-opts="[10, 20, 40, 60]"
51
+        @on-change="pageChange"
52
+        @on-page-size-change="pageSizeChange"
53
+        show-total
54
+        show-sizer
55
+      ></Page>
56
+    </div>
57
+    <Modal
58
+      class="modal1"
59
+      :mask-closable="false"
60
+      v-model="importInfo.show"
61
+      title="导入"
62
+    >
63
+      <Form
64
+        v-if="importInfo.show"
65
+        ref="importForm"
66
+        :model="importInfo"
67
+        :rules="rules"
68
+        :label-width="100"
69
+      >
70
+        <FormItem label="所属区域" prop="regionid">
71
+          <Select
72
+            :transfer="true"
73
+            v-model="importInfo.regionid"
74
+            placeholder="请选择所属区域"
75
+          >
76
+            <Option
77
+              v-for="regionItem in searchForm.regionList"
78
+              :value="regionItem.regionid"
79
+              :key="regionItem.regionid"
80
+              >{{ regionItem.regionName }}</Option
81
+            >
82
+          </Select>
83
+        </FormItem>
84
+        <FormItem label="上传文件" class="require">
85
+          <div style="display: flex">
86
+            <Upload
87
+              action
88
+              :show-upload-list="false"
89
+              :before-upload="
90
+                (file) => {
91
+                  upLoadExcel(file);
92
+                  return false;
93
+                }
94
+              "
95
+              accept=".xlsx,.xls"
96
+            >
97
+              <Button type="primary" class="primary_btn">上传excel</Button>
98
+            </Upload>
99
+            <div style="margin-left: 16px; color: #7c8db5">
100
+              支持格式:xlsx/xls文件
101
+            </div>
102
+          </div>
103
+          <div v-if="importInfo.file">{{ importInfo.file.name }}</div>
104
+        </FormItem>
105
+      </Form>
106
+      <div slot="footer">
107
+        <Button @click="importInfo.show = false">取消</Button>
108
+        <Button @click="saveFileInfo()" type="primary" class="primary_btn"
109
+          >保存</Button
110
+        >
111
+      </div>
112
+    </Modal>
113
+    <Modal
114
+      class="modal1"
115
+      :mask-closable="false"
116
+      v-model="viewInfo.show"
117
+      title="查看"
118
+    >
119
+      <div class="view_title">{{ viewInfo.regionName }}</div>
120
+      <div class="view_main">
121
+        <div
122
+          class="sn_item"
123
+          v-for="(snItem, snIndex) in viewInfo.snList"
124
+          :key="snIndex"
125
+        >
126
+          {{ snItem }}
127
+        </div>
128
+      </div>
129
+      <div slot="footer" style="text-align: center">
130
+        <Button @click="viewInfo.show = false">关闭</Button>
131
+      </div>
132
+    </Modal>
133
+    <Modal
134
+      class="modal1"
135
+      :mask-closable="false"
136
+      v-model="importErrorInfo.show"
137
+      title="提示"
138
+    >
139
+      <div
140
+        style="margin-bottom: 16px; font-size: 18px"
141
+        v-if="importErrorInfo.snDuplicate.length > 0"
142
+      >
143
+        以下SN重复:
144
+      </div>
145
+      <div
146
+        style="margin-bottom: 16px; font-size: 18px"
147
+        v-if="
148
+          importErrorInfo.snDuplicate.length === 0 &&
149
+          importErrorInfo.snExisted.length > 0
150
+        "
151
+      >
152
+        以下SN已存在:
153
+      </div>
154
+      <div class="view_main" v-if="importErrorInfo.snDuplicate.length > 0">
155
+        <div
156
+          class="sn_item"
157
+          v-for="(snItem, snIndex) in importErrorInfo.snDuplicate"
158
+          :key="snIndex"
159
+        >
160
+          {{ snItem }}
161
+        </div>
162
+      </div>
163
+      <div
164
+        class="view_main"
165
+        v-if="
166
+          importErrorInfo.snDuplicate.length === 0 &&
167
+          importErrorInfo.snExisted.length > 0
168
+        "
169
+      >
170
+        <div
171
+          class="sn_item"
172
+          v-for="(snItem, snIndex) in importErrorInfo.snExisted"
173
+          :key="snIndex"
174
+        >
175
+          {{ snItem }}
176
+        </div>
177
+      </div>
178
+      <div slot="footer" style="text-align: center">
179
+        <Button @click="importErrorInfo.show = false">关闭</Button>
180
+      </div>
181
+    </Modal>
182
+  </div>
183
+</template>
184
+
185
+<script>
186
+import { region_list_sel_pt } from "@/api/region";
187
+import {
188
+  deviceAuth_list_batch,
189
+  deviceAuth_delete_db,
190
+  deviceAuth_import,
191
+  deviceAuth_list_sn
192
+} from "@/api/device_manager";
193
+import { dateFormat } from "@/utils";
194
+export default {
195
+  data() {
196
+    return {
197
+      dateFormat,
198
+      rules: {
199
+        regionid: [
200
+          {
201
+            required: true,
202
+            type: "number",
203
+            message: "请选择所属区域",
204
+            trigger: "change"
205
+          }
206
+        ]
207
+      },
208
+      searchForm: {
209
+        regionid: 0,
210
+        regionList: [],
211
+        dataRange: [],
212
+        page: 1,
213
+        size: 10,
214
+        list: [],
215
+        total: 0
216
+      },
217
+      viewInfo: {
218
+        show: false,
219
+        regionName: null,
220
+        snList: []
221
+      },
222
+      importInfo: {
223
+        show: false,
224
+        regionid: null,
225
+        file: null
226
+      },
227
+      importErrorInfo: {
228
+        show: false,
229
+        // 重复SN列表
230
+        snDuplicate: [],
231
+        // 已存在SN列表
232
+        snExisted: []
233
+      },
234
+      columns: [
235
+        {
236
+          title: "序号",
237
+          align: "center",
238
+          width: 70,
239
+          render: (h, params) => {
240
+            return h(
241
+              "span",
242
+              params.index +
243
+                (this.searchForm.page - 1) * this.searchForm.size +
244
+                1
245
+            );
246
+          }
247
+        },
248
+        {
249
+          title: "所属区域",
250
+          key: "regionName",
251
+          align: "center"
252
+        },
253
+        {
254
+          title: "导入时间",
255
+          key: "createtime",
256
+          width: 190,
257
+          align: "center"
258
+        },
259
+        {
260
+          title: "导入数量",
261
+          key: "importNum",
262
+          align: "center"
263
+        },
264
+        {
265
+          title: "操作人",
266
+          key: "updatename",
267
+          align: "center"
268
+        },
269
+        {
270
+          title: "操作时间",
271
+          key: "updatetime",
272
+          width: 190,
273
+          align: "center"
274
+        },
275
+        {
276
+          title: "操作",
277
+          slot: "actionSlot",
278
+          width: 130,
279
+          align: "center"
280
+        }
281
+      ]
282
+    };
283
+  },
284
+  created() {
285
+    this.getRegionList();
286
+    this.searchList();
287
+  },
288
+  computed: {
289
+    powerParams() {
290
+      return this.$store.getters.powerParams;
291
+    }
292
+  },
293
+  methods: {
294
+    // 获取搜索区域列表
295
+    getRegionList() {
296
+      region_list_sel_pt({}).then((data) => {
297
+        if (data.code === 0) {
298
+          this.searchForm.regionList = data.obj;
299
+        } else {
300
+          this.$Message.error(data.msg);
301
+        }
302
+      });
303
+    },
304
+    // 搜索
305
+    searchList() {
306
+      this.searchForm.page = 1;
307
+      this.getList();
308
+    },
309
+    // 页码改变
310
+    pageChange(page) {
311
+      this.searchForm.page = page;
312
+      this.getList();
313
+    },
314
+    // 每页显示数量改变
315
+    pageSizeChange(size) {
316
+      this.searchForm.size = size;
317
+      this.searchForm.page = 1;
318
+      this.getList();
319
+    },
320
+    // 获取列表
321
+    getList() {
322
+      let _begindate = this.searchForm.dataRange[0];
323
+      _begindate = _begindate ? dateFormat(_begindate, "yyyy-MM-dd") : null;
324
+      let _enddate = this.searchForm.dataRange[1];
325
+      _enddate = _enddate ? dateFormat(_enddate, "yyyy-MM-dd") : null;
326
+      deviceAuth_list_batch({
327
+        rtype: this.powerParams.rtype,
328
+        regionid: this.searchForm.regionid,
329
+        page: this.searchForm.page,
330
+        size: this.searchForm.size,
331
+        begindate: _begindate,
332
+        enddate: _enddate
333
+      }).then((data) => {
334
+        if (data.code === 0) {
335
+          this.searchForm.list = data.obj.data;
336
+          this.searchForm.total = data.obj.total;
337
+        } else {
338
+          this.$Message.error(data.msg);
339
+        }
340
+      });
341
+    },
342
+    toImport() {
343
+      this.importInfo = {
344
+        show: true,
345
+        regionid: null,
346
+        file: null
347
+      };
348
+    },
349
+    upLoadExcel(file) {
350
+      this.importInfo.file = null;
351
+      let str = file.name.split(".");
352
+      let suffix = str[str.length - 1];
353
+      suffix = suffix.toLowerCase();
354
+      if (suffix !== "xlsx" && suffix !== "xls") {
355
+        this.$Message.warning("文件格式不正确");
356
+        return;
357
+      }
358
+      this.importInfo.file = file;
359
+    },
360
+    saveFileInfo() {
361
+      this.$refs.importForm.validate((valid) => {
362
+        if (valid) {
363
+          if (!this.importInfo.file) {
364
+            this.$Message.error("请上传文件");
365
+            return;
366
+          }
367
+          this.importInfo.show = false;
368
+          let formData = new FormData();
369
+          formData.append("file", this.importInfo.file);
370
+          formData.append("regionid", this.importInfo.regionid);
371
+          deviceAuth_import(formData).then((data) => {
372
+            if (data.code === 0) {
373
+              if (data.obj.code === 1) {
374
+                this.importErrorInfo = {
375
+                  show: true,
376
+                  // 重复SN列表
377
+                  snDuplicate: data.obj.snDuplicate || [],
378
+                  // 已存在SN列表
379
+                  snExisted: data.obj.snExisted || []
380
+                };
381
+              } else {
382
+                this.searchList();
383
+                this.$Message.success(data.msg);
384
+              }
385
+            } else {
386
+              this.$Message.error(data.msg);
387
+            }
388
+          });
389
+        }
390
+      });
391
+    },
392
+    toView(row) {
393
+      this.viewInfo = {
394
+        show: true,
395
+        regionName: row.regionName,
396
+        snList: []
397
+      };
398
+      deviceAuth_list_sn({
399
+        dbid: row.dbid
400
+      }).then((data) => {
401
+        if (data.code === 0) {
402
+          this.viewInfo.snList = data.obj;
403
+        } else {
404
+          this.$Message.error(data.msg);
405
+        }
406
+      });
407
+    },
408
+    // 删除
409
+    toDel(row) {
410
+      this.$Modal.confirm({
411
+        title: "提示",
412
+        content: `您确定要批量删除 ${row.importNum} 条数据吗?`,
413
+        onOk: () => {
414
+          deviceAuth_delete_db({
415
+            rtype: this.powerParams.rtype,
416
+            dbid: row.dbid
417
+          }).then((data) => {
418
+            if (data.code === 0) {
419
+              this.searchList();
420
+              this.$Message.success(data.msg);
421
+            } else {
422
+              this.$Message.error(data.msg);
423
+            }
424
+          });
425
+        },
426
+        onCancel: () => {}
427
+      });
428
+    }
429
+  }
430
+};
431
+</script>
432
+
433
+<style lang="less" scoped>
434
+.search_header {
435
+  display: flex;
436
+  justify-content: space-between;
437
+  align-items: center;
438
+  margin: 16px 16px;
439
+  .search_left {
440
+    display: flex;
441
+    justify-content: flex-start;
442
+    align-items: center;
443
+  }
444
+  .search_right {
445
+    display: flex;
446
+    justify-content: flex-start;
447
+    align-items: center;
448
+    .primary_btn {
449
+      margin-left: 16px;
450
+    }
451
+  }
452
+}
453
+.view_title {
454
+  margin-bottom: 16px;
455
+  font-size: 18px;
456
+  font-weight: bold;
457
+  text-align: center;
458
+}
459
+.view_main {
460
+  display: flex;
461
+  justify-content: flex-start;
462
+  flex-wrap: wrap;
463
+  .sn_item {
464
+    margin-top: -1px;
465
+    margin-left: -1px;
466
+    padding: 0 4px;
467
+    width: 25%;
468
+    font-size: 16px;
469
+    line-height: 30px;
470
+    text-align: center;
471
+    word-break: break-all;
472
+    border: 1px solid #ced9f2;
473
+  }
474
+}
475
+</style>

+ 428
- 0
src/views/platformSection/deviceImport/detail.vue ファイルの表示

@@ -0,0 +1,428 @@
1
+<template>
2
+  <div>
3
+    <div class="search_header">
4
+      <div class="search_left">
5
+        <Select
6
+          v-model="searchForm.regionid"
7
+          @on-change="searchList()"
8
+          style="margin-right: 16px; width: 150px"
9
+        >
10
+          <Option :value="0">所有区域</Option>
11
+          <Option
12
+            v-for="regionItem in searchForm.regionList"
13
+            :value="regionItem.regionid"
14
+            :key="regionItem.regionid"
15
+            >{{ regionItem.regionName }}</Option
16
+          >
17
+        </Select>
18
+        <Select
19
+          v-model="searchForm.snState"
20
+          @on-change="searchList()"
21
+          style="margin-right: 16px; width: 150px"
22
+        >
23
+          <Option :value="-1">所有状态</Option>
24
+          <Option :value="0">正常</Option>
25
+          <Option :value="1">注销</Option>
26
+        </Select>
27
+        <Input
28
+          v-model="searchForm.sn"
29
+          placeholder="请输入序列号模糊搜索"
30
+          search
31
+          @on-search="searchList()"
32
+          style="width: 200px"
33
+        />
34
+      </div>
35
+      <div class="search_right">
36
+        <Button type="primary" class="primary_btn" @click="toAdd()"
37
+          >新建</Button
38
+        >
39
+        <Button type="primary" class="primary_btn" @click="toBatchDelete()"
40
+          >批量删除</Button
41
+        >
42
+      </div>
43
+    </div>
44
+    <div class="table_wrap">
45
+      <Table
46
+        :columns="columns"
47
+        :data="searchForm.list"
48
+        @on-selection-change="tableSelectionChange"
49
+      >
50
+        <template slot-scope="{ row }" slot="snStateSlot">
51
+          <div class="action_list">
52
+            <div class="action_success" v-if="row.snState === 0">正常</div>
53
+            <div class="action_error" v-else-if="row.snState === 1">注销</div>
54
+          </div>
55
+        </template>
56
+        <template slot-scope="{ row }" slot="actionSlot">
57
+          <div class="action_list">
58
+            <div @click="toEdit(row)">编辑</div>
59
+            <div class="action_del" @click="toDel(row)">删除</div>
60
+          </div>
61
+        </template>
62
+      </Table>
63
+    </div>
64
+    <div class="page_wrap">
65
+      <Page
66
+        :transfer="true"
67
+        :total="searchForm.total"
68
+        :current="searchForm.page"
69
+        :page-size="searchForm.size"
70
+        :page-size-opts="[10, 20, 40, 60]"
71
+        @on-change="pageChange"
72
+        @on-page-size-change="pageSizeChange"
73
+        show-total
74
+        show-sizer
75
+      ></Page>
76
+    </div>
77
+    <!-- 新建/编辑 -->
78
+    <Modal
79
+      class="modal1"
80
+      :mask-closable="false"
81
+      v-model="addInfo.show"
82
+      :title="addInfo.daid ? '编辑' : '新建'"
83
+    >
84
+      <Form
85
+        v-if="addInfo.show"
86
+        ref="addForm"
87
+        :model="addInfo"
88
+        :rules="rules"
89
+        :label-width="100"
90
+      >
91
+        <FormItem label="所属区域" prop="regionid">
92
+          <Select
93
+            :transfer="true"
94
+            v-model="addInfo.regionid"
95
+            placeholder="请选择所属区域"
96
+          >
97
+            <Option
98
+              v-for="regionItem in searchForm.regionList"
99
+              :value="regionItem.regionid"
100
+              :key="regionItem.regionid"
101
+              >{{ regionItem.regionName }}</Option
102
+            >
103
+          </Select>
104
+        </FormItem>
105
+        <FormItem label="SN序列号" prop="sn">
106
+          <Input v-model="addInfo.sn" placeholder="请输入SN序列号"></Input>
107
+        </FormItem>
108
+        <FormItem v-if="addInfo.daid" label="所属状态" prop="snState">
109
+          <RadioGroup v-model="addInfo.snState">
110
+            <Radio :label="0">正常</Radio>
111
+            <Radio :label="1">注销</Radio>
112
+          </RadioGroup>
113
+        </FormItem>
114
+      </Form>
115
+      <div slot="footer">
116
+        <Button @click="addInfo.show = false">取消</Button>
117
+        <Button @click="saveAddInfo()" type="primary" class="primary_btn"
118
+          >保存</Button
119
+        >
120
+      </div>
121
+    </Modal>
122
+  </div>
123
+</template>
124
+
125
+<script>
126
+import { region_list_sel_pt } from "@/api/region";
127
+import {
128
+  deviceAuth_list,
129
+  deviceAuth_add,
130
+  deviceAuth_edit,
131
+  deviceAuth_delete,
132
+  deviceAuth_batch_delete
133
+} from "@/api/device_manager";
134
+export default {
135
+  data() {
136
+    return {
137
+      rules: {
138
+        regionid: [
139
+          {
140
+            required: true,
141
+            type: "number",
142
+            message: "请选择所属区域",
143
+            trigger: "change"
144
+          }
145
+        ],
146
+        sn: [
147
+          {
148
+            required: true,
149
+            message: "请输入SN序列号",
150
+            trigger: "change"
151
+          }
152
+        ],
153
+        snState: [
154
+          {
155
+            required: true,
156
+            type: "number",
157
+            message: "请选择所属状态",
158
+            trigger: "change"
159
+          }
160
+        ]
161
+      },
162
+      addInfo: {
163
+        daid: null,
164
+        rversion: null,
165
+        show: false,
166
+        regionid: null,
167
+        sn: null,
168
+        snState: null
169
+      },
170
+      searchForm: {
171
+        regionid: 0,
172
+        snState: -1,
173
+        regionList: [],
174
+        sn: "",
175
+        page: 1,
176
+        size: 10,
177
+        list: [],
178
+        total: 0
179
+      },
180
+      // 批量删除
181
+      batchDeleteList: [],
182
+      columns: [
183
+        {
184
+          type: "selection",
185
+          width: 60,
186
+          align: "center"
187
+        },
188
+        {
189
+          title: "序号",
190
+          align: "center",
191
+          width: 70,
192
+          render: (h, params) => {
193
+            return h(
194
+              "span",
195
+              params.index +
196
+                (this.searchForm.page - 1) * this.searchForm.size +
197
+                1
198
+            );
199
+          }
200
+        },
201
+        {
202
+          title: "所属区域",
203
+          key: "regionName",
204
+          align: "center"
205
+        },
206
+        {
207
+          title: "SN",
208
+          key: "sn",
209
+          align: "center"
210
+        },
211
+        {
212
+          title: "状态",
213
+          slot: "snStateSlot",
214
+          width: 90,
215
+          align: "center"
216
+        },
217
+        {
218
+          title: "创建人",
219
+          key: "createname",
220
+          align: "center"
221
+        },
222
+        {
223
+          title: "创建时间",
224
+          key: "createtime",
225
+          width: 190,
226
+          align: "center"
227
+        },
228
+        {
229
+          title: "操作人",
230
+          key: "updatename",
231
+          align: "center"
232
+        },
233
+        {
234
+          title: "操作时间",
235
+          key: "updatetime",
236
+          width: 190,
237
+          align: "center"
238
+        },
239
+        {
240
+          title: "操作",
241
+          slot: "actionSlot",
242
+          width: 130,
243
+          align: "center"
244
+        }
245
+      ]
246
+    };
247
+  },
248
+  created() {
249
+    this.getRegionList();
250
+    this.searchList();
251
+  },
252
+  computed: {
253
+    powerParams() {
254
+      return this.$store.getters.powerParams;
255
+    }
256
+  },
257
+  methods: {
258
+    // 获取搜索区域列表
259
+    getRegionList() {
260
+      region_list_sel_pt({}).then((data) => {
261
+        if (data.code === 0) {
262
+          this.searchForm.regionList = data.obj;
263
+        } else {
264
+          this.$Message.error(data.msg);
265
+        }
266
+      });
267
+    },
268
+    // 搜索
269
+    searchList() {
270
+      this.searchForm.page = 1;
271
+      this.getList();
272
+    },
273
+    // 页码改变
274
+    pageChange(page) {
275
+      this.searchForm.page = page;
276
+      this.getList();
277
+    },
278
+    // 每页显示数量改变
279
+    pageSizeChange(size) {
280
+      this.searchForm.size = size;
281
+      this.searchForm.page = 1;
282
+      this.getList();
283
+    },
284
+    tableSelectionChange(list) {
285
+      this.batchDeleteList = list.map((item) => {
286
+        return {
287
+          daid: item.daid
288
+        };
289
+      });
290
+    },
291
+    // 获取列表
292
+    getList() {
293
+      this.batchDeleteList = [];
294
+      deviceAuth_list({
295
+        rtype: this.powerParams.rtype,
296
+        objectid: this.powerParams.objectid,
297
+        regionid: this.searchForm.regionid,
298
+        page: this.searchForm.page,
299
+        size: this.searchForm.size,
300
+        sn: this.searchForm.sn
301
+      }).then((data) => {
302
+        if (data.code === 0) {
303
+          this.searchForm.list = data.obj.data;
304
+          this.searchForm.total = data.obj.total;
305
+        } else {
306
+          this.$Message.error(data.msg);
307
+        }
308
+      });
309
+    },
310
+    toAdd() {
311
+      this.addInfo = {
312
+        daid: null,
313
+        rversion: null,
314
+        show: true,
315
+        regionid: null,
316
+        sn: null,
317
+        snState: null
318
+      };
319
+    },
320
+    saveAddInfo() {
321
+      this.$refs.addForm.validate((valid) => {
322
+        if (valid) {
323
+          this.addInfo.show = false;
324
+          let api =
325
+            this.addInfo.daid && this.addInfo.rversion
326
+              ? deviceAuth_edit
327
+              : deviceAuth_add;
328
+          let form = {
329
+            rtype: this.powerParams.rtype,
330
+            objectid: this.powerParams.objectid,
331
+            regionid: this.addInfo.regionid,
332
+            sn: this.addInfo.sn
333
+          };
334
+          if (this.addInfo.daid && this.addInfo.rversion) {
335
+            form.daid = this.addInfo.daid;
336
+            form.snState = this.addInfo.snState;
337
+            form.rversion = this.addInfo.rversion;
338
+          }
339
+          api(form).then((data) => {
340
+            if (data.code === 0) {
341
+              this.searchList();
342
+              this.$Message.success(data.msg);
343
+            } else {
344
+              this.$Message.error(data.msg);
345
+            }
346
+          });
347
+        }
348
+      });
349
+    },
350
+    toEdit(row) {
351
+      this.addInfo = {
352
+        daid: row.daid,
353
+        rversion: row.rversion,
354
+        show: true,
355
+        regionid: row.regionid,
356
+        sn: row.sn,
357
+        snState: row.snState
358
+      };
359
+    },
360
+    // 删除
361
+    toDel(row) {
362
+      this.$Modal.confirm({
363
+        title: "提示",
364
+        content: `您确定删除【${row.sn}】吗?`,
365
+        onOk: () => {
366
+          deviceAuth_delete({
367
+            rtype: this.powerParams.rtype,
368
+            objectid: this.powerParams.objectid,
369
+            daid: row.daid,
370
+            rversion: row.rversion
371
+          }).then((data) => {
372
+            if (data.code === 0) {
373
+              this.searchList();
374
+              this.$Message.success(data.msg);
375
+            } else {
376
+              this.$Message.error(data.msg);
377
+            }
378
+          });
379
+        },
380
+        onCancel: () => {}
381
+      });
382
+    },
383
+    toBatchDelete() {
384
+      if (this.batchDeleteList.length === 0) {
385
+        this.$Message.error("请选择数据");
386
+        return;
387
+      }
388
+      this.$Modal.confirm({
389
+        title: "提示",
390
+        content: `您确定要批量删除选中的 ${this.batchDeleteList.length} 条数据吗?`,
391
+        onOk: () => {
392
+          deviceAuth_batch_delete(this.batchDeleteList).then((data) => {
393
+            if (data.code === 0) {
394
+              this.searchList();
395
+              this.$Message.success(data.msg);
396
+            } else {
397
+              this.$Message.error(data.msg);
398
+            }
399
+          });
400
+        },
401
+        onCancel: () => {}
402
+      });
403
+    }
404
+  }
405
+};
406
+</script>
407
+
408
+<style lang="less" scoped>
409
+.search_header {
410
+  display: flex;
411
+  justify-content: space-between;
412
+  align-items: center;
413
+  margin: 16px 16px;
414
+  .search_left {
415
+    display: flex;
416
+    justify-content: flex-start;
417
+    align-items: center;
418
+  }
419
+  .search_right {
420
+    display: flex;
421
+    justify-content: flex-start;
422
+    align-items: center;
423
+    .primary_btn {
424
+      margin-left: 16px;
425
+    }
426
+  }
427
+}
428
+</style>

+ 32
- 497
src/views/platformSection/deviceImport/deviceImport.vue ファイルの表示

@@ -1,521 +1,56 @@
1 1
 <template>
2 2
   <div class="main_root">
3
-    <div class="search_header">
4
-      <div class="search_left">
5
-        <Select
6
-          v-model="searchForm.regionid"
7
-          style="margin-right: 16px; width: 150px"
8
-        >
9
-          <Option :value="0">所有区域</Option>
10
-          <Option
11
-            v-for="regionItem in searchForm.regionList"
12
-            :value="regionItem.regionid"
13
-            :key="regionItem.regionid"
14
-            >{{ regionItem.regionName }}</Option
15
-          >
16
-        </Select>
17
-        <Input
18
-          v-model="searchForm.sn"
19
-          placeholder="请输入序列号模糊搜索"
20
-          search
21
-          @on-search="searchList()"
22
-          style="width: 200px"
23
-        />
24
-      </div>
25
-      <div class="search_right">
26
-        <Button type="primary" class="primary_btn" @click="toImport()"
27
-          >导入</Button
28
-        >
29
-        <Button type="primary" class="primary_btn" @click="toAdd()"
30
-          >新建</Button
31
-        >
32
-        <Button type="primary" class="primary_btn" @click="toBatchDelete()"
33
-          >批量删除</Button
34
-        >
35
-      </div>
36
-    </div>
37
-    <div class="table_wrap">
38
-      <Table
39
-        :columns="columns"
40
-        :data="searchForm.list"
41
-        @on-selection-change="tableSelectionChange"
3
+    <div class="menu_info">
4
+      <div
5
+        :class="['menu_item', selectedMenu === 1 ? 'selected' : '']"
6
+        @click="selectedMenu = 1"
42 7
       >
43
-        <template slot-scope="{ row }" slot="snStateSlot">
44
-          <div class="action_list">
45
-            <div class="action_success" v-if="row.snState === 0">正常</div>
46
-            <div class="action_error" v-else-if="row.snState === 1">注销</div>
47
-          </div>
48
-        </template>
49
-        <template slot-scope="{ row }" slot="actionSlot">
50
-          <div class="action_list">
51
-            <div @click="toEdit(row)">编辑</div>
52
-            <div class="action_del" @click="toDel(row)">删除</div>
53
-          </div>
54
-        </template>
55
-      </Table>
56
-    </div>
57
-    <div class="page_wrap">
58
-      <Page
59
-        :transfer="true"
60
-        :total="searchForm.total"
61
-        :current="searchForm.page"
62
-        :page-size="searchForm.size"
63
-        :page-size-opts="[10, 20, 40, 60]"
64
-        @on-change="pageChange"
65
-        @on-page-size-change="pageSizeChange"
66
-        show-total
67
-        show-sizer
68
-      ></Page>
69
-    </div>
70
-    <!-- 新建/编辑 -->
71
-    <Modal
72
-      class="modal1"
73
-      :mask-closable="false"
74
-      v-model="addInfo.show"
75
-      :title="addInfo.daid ? '编辑' : '新建'"
76
-    >
77
-      <Form
78
-        v-if="addInfo.show"
79
-        ref="addForm"
80
-        :model="addInfo"
81
-        :rules="rules"
82
-        :label-width="100"
83
-      >
84
-        <FormItem label="所属区域" prop="regionid">
85
-          <Select
86
-            :transfer="true"
87
-            v-model="addInfo.regionid"
88
-            placeholder="请选择所属区域"
89
-          >
90
-            <Option
91
-              v-for="regionItem in searchForm.regionList"
92
-              :value="regionItem.regionid"
93
-              :key="regionItem.regionid"
94
-              >{{ regionItem.regionName }}</Option
95
-            >
96
-          </Select>
97
-        </FormItem>
98
-        <FormItem label="SN序列号" prop="sn">
99
-          <Input v-model="addInfo.sn" placeholder="请输入SN序列号"></Input>
100
-        </FormItem>
101
-        <FormItem v-if="addInfo.daid" label="所属状态" prop="snState">
102
-          <RadioGroup v-model="addInfo.snState">
103
-            <Radio :label="0">正常</Radio>
104
-            <Radio :label="1">注销</Radio>
105
-          </RadioGroup>
106
-        </FormItem>
107
-      </Form>
108
-      <div slot="footer">
109
-        <Button @click="addInfo.show = false">取消</Button>
110
-        <Button @click="saveAddInfo()" type="primary" class="primary_btn"
111
-          >保存</Button
112
-        >
8
+        按批次
113 9
       </div>
114
-    </Modal>
115
-    <Modal
116
-      class="modal1"
117
-      :mask-closable="false"
118
-      v-model="importInfo.show"
119
-      title="导入"
120
-    >
121
-      <Form
122
-        v-if="importInfo.show"
123
-        ref="importForm"
124
-        :model="importInfo"
125
-        :rules="rules"
126
-        :label-width="100"
10
+      <div
11
+        :class="['menu_item', selectedMenu === 2 ? 'selected' : '']"
12
+        @click="selectedMenu = 2"
127 13
       >
128
-        <FormItem label="所属区域" prop="regionid">
129
-          <Select
130
-            :transfer="true"
131
-            v-model="importInfo.regionid"
132
-            placeholder="请选择所属区域"
133
-          >
134
-            <Option
135
-              v-for="regionItem in searchForm.regionList"
136
-              :value="regionItem.regionid"
137
-              :key="regionItem.regionid"
138
-              >{{ regionItem.regionName }}</Option
139
-            >
140
-          </Select>
141
-        </FormItem>
142
-        <FormItem label="上传文件" class="require">
143
-          <div style="display: flex">
144
-            <Upload
145
-              action
146
-              :show-upload-list="false"
147
-              :before-upload="
148
-                (file) => {
149
-                  upLoadExcel(file);
150
-                  return false;
151
-                }
152
-              "
153
-              accept=".xlsx,.xls"
154
-            >
155
-              <Button type="primary" class="primary_btn">上传excel</Button>
156
-            </Upload>
157
-            <div style="margin-left: 16px; color: #7c8db5">
158
-              支持格式:xlsx/xls文件
159
-            </div>
160
-          </div>
161
-          <div v-if="importInfo.file">{{ importInfo.file.name }}</div>
162
-        </FormItem>
163
-      </Form>
164
-      <div slot="footer">
165
-        <Button @click="importInfo.show = false">取消</Button>
166
-        <Button @click="saveFileInfo()" type="primary" class="primary_btn"
167
-          >保存</Button
168
-        >
14
+        按详情
169 15
       </div>
170
-    </Modal>
16
+    </div>
17
+    <Batch v-if="selectedMenu === 1"></Batch>
18
+    <Detail v-else-if="selectedMenu === 2"></Detail>
171 19
   </div>
172 20
 </template>
173 21
 
174 22
 <script>
175
-import { region_list_sel_pt } from "@/api/region";
176
-import {
177
-  deviceAuth_list,
178
-  deviceAuth_add,
179
-  deviceAuth_edit,
180
-  deviceAuth_delete,
181
-  deviceAuth_batch_delete,
182
-  deviceAuth_import
183
-} from "@/api/device_manager";
23
+import Batch from "./batch.vue";
24
+import Detail from "./detail.vue";
184 25
 export default {
26
+  components: {
27
+    Batch,
28
+    Detail
29
+  },
185 30
   data() {
186 31
     return {
187
-      rules: {
188
-        regionid: [
189
-          {
190
-            required: true,
191
-            type: "number",
192
-            message: "请选择所属区域",
193
-            trigger: "change"
194
-          }
195
-        ],
196
-        sn: [
197
-          {
198
-            required: true,
199
-            message: "请输入SN序列号",
200
-            trigger: "change"
201
-          }
202
-        ],
203
-        snState: [
204
-          {
205
-            required: true,
206
-            type: "number",
207
-            message: "请选择所属状态",
208
-            trigger: "change"
209
-          }
210
-        ]
211
-      },
212
-      addInfo: {
213
-        daid: null,
214
-        rversion: null,
215
-        show: false,
216
-        regionid: null,
217
-        sn: null,
218
-        snState: null
219
-      },
220
-      searchForm: {
221
-        regionid: 0,
222
-        regionList: [],
223
-        sn: "",
224
-        page: 1,
225
-        size: 10,
226
-        list: [],
227
-        total: 0
228
-      },
229
-      importInfo: {
230
-        show: false,
231
-        regionid: null,
232
-        file: null
233
-      },
234
-      // 批量删除
235
-      batchDeleteList: [],
236
-      columns: [
237
-        {
238
-          type: "selection",
239
-          width: 60,
240
-          align: "center"
241
-        },
242
-        {
243
-          title: "序号",
244
-          align: "center",
245
-          width: 70,
246
-          render: (h, params) => {
247
-            return h(
248
-              "span",
249
-              params.index +
250
-                (this.searchForm.page - 1) * this.searchForm.size +
251
-                1
252
-            );
253
-          }
254
-        },
255
-        {
256
-          title: "所属区域",
257
-          key: "regionName",
258
-          align: "center"
259
-        },
260
-        {
261
-          title: "SN",
262
-          key: "sn",
263
-          align: "center"
264
-        },
265
-        {
266
-          title: "状态",
267
-          slot: "snStateSlot",
268
-          width: 90,
269
-          align: "center"
270
-        },
271
-        {
272
-          title: "创建人",
273
-          key: "createname",
274
-          align: "center"
275
-        },
276
-        {
277
-          title: "创建时间",
278
-          key: "createtime",
279
-          width: 190,
280
-          align: "center"
281
-        },
282
-        {
283
-          title: "操作人",
284
-          key: "updatename",
285
-          align: "center"
286
-        },
287
-        {
288
-          title: "操作时间",
289
-          key: "updatetime",
290
-          width: 190,
291
-          align: "center"
292
-        },
293
-        {
294
-          title: "操作",
295
-          slot: "actionSlot",
296
-          width: 130,
297
-          align: "center"
298
-        }
299
-      ]
32
+      selectedMenu: 1
300 33
     };
301
-  },
302
-  created() {
303
-    this.getRegionList();
304
-    this.searchList();
305
-  },
306
-  computed: {
307
-    powerParams() {
308
-      return this.$store.getters.powerParams;
309
-    }
310
-  },
311
-  methods: {
312
-    // 获取搜索区域列表
313
-    getRegionList() {
314
-      region_list_sel_pt({}).then((data) => {
315
-        if (data.code === 0) {
316
-          this.searchForm.regionList = data.obj;
317
-        } else {
318
-          this.$Message.error(data.msg);
319
-        }
320
-      });
321
-    },
322
-    // 搜索
323
-    searchList() {
324
-      this.searchForm.page = 1;
325
-      this.getList();
326
-    },
327
-    // 页码改变
328
-    pageChange(page) {
329
-      this.searchForm.page = page;
330
-      this.getList();
331
-    },
332
-    // 每页显示数量改变
333
-    pageSizeChange(size) {
334
-      this.searchForm.size = size;
335
-      this.searchForm.page = 1;
336
-      this.getList();
337
-    },
338
-    tableSelectionChange(list) {
339
-      this.batchDeleteList = list.map((item) => {
340
-        return {
341
-          daid: item.daid
342
-        };
343
-      });
344
-    },
345
-    // 获取列表
346
-    getList() {
347
-      this.batchDeleteList = [];
348
-      deviceAuth_list({
349
-        rtype: this.powerParams.rtype,
350
-        objectid: this.powerParams.objectid,
351
-        regionid: this.searchForm.regionid,
352
-        page: this.searchForm.page,
353
-        size: this.searchForm.size,
354
-        sn: this.searchForm.sn
355
-      }).then((data) => {
356
-        if (data.code === 0) {
357
-          this.searchForm.list = data.obj.data;
358
-          this.searchForm.total = data.obj.total;
359
-        } else {
360
-          this.$Message.error(data.msg);
361
-        }
362
-      });
363
-    },
364
-    toImport() {
365
-      this.importInfo = {
366
-        show: true,
367
-        regionid: null,
368
-        file: null
369
-      };
370
-    },
371
-    upLoadExcel(file) {
372
-      this.importInfo.file = null;
373
-      let str = file.name.split(".");
374
-      let suffix = str[str.length - 1];
375
-      suffix = suffix.toLowerCase();
376
-      if (suffix !== "xlsx" && suffix !== "xls") {
377
-        this.$Message.warning("文件格式不正确");
378
-        return;
379
-      }
380
-      this.importInfo.file = file;
381
-    },
382
-    saveFileInfo() {
383
-      this.$refs.importForm.validate((valid) => {
384
-        if (valid) {
385
-          if (!this.importInfo.file) {
386
-            this.$Message.error("请上传文件");
387
-            return;
388
-          }
389
-          this.importInfo.show = false;
390
-          let formData = new FormData();
391
-          formData.append("file", this.importInfo.file);
392
-          formData.append("regionid", this.importInfo.regionid);
393
-          deviceAuth_import(formData).then((data) => {
394
-            if (data.code === 0) {
395
-              this.searchList();
396
-              this.$Message.success(data.msg);
397
-            } else {
398
-              this.$Message.error(data.msg);
399
-            }
400
-          });
401
-        }
402
-      });
403
-    },
404
-    toAdd() {
405
-      this.addInfo = {
406
-        daid: null,
407
-        rversion: null,
408
-        show: true,
409
-        regionid: null,
410
-        sn: null,
411
-        snState: null
412
-      };
413
-    },
414
-    saveAddInfo() {
415
-      this.$refs.addForm.validate((valid) => {
416
-        if (valid) {
417
-          this.addInfo.show = false;
418
-          let api =
419
-            this.addInfo.daid && this.addInfo.rversion
420
-              ? deviceAuth_edit
421
-              : deviceAuth_add;
422
-          let form = {
423
-            rtype: this.powerParams.rtype,
424
-            objectid: this.powerParams.objectid,
425
-            regionid: this.addInfo.regionid,
426
-            sn: this.addInfo.sn
427
-          };
428
-          if (this.addInfo.daid && this.addInfo.rversion) {
429
-            form.daid = this.addInfo.daid;
430
-            form.snState = this.addInfo.snState;
431
-            form.rversion = this.addInfo.rversion;
432
-          }
433
-          api(form).then((data) => {
434
-            if (data.code === 0) {
435
-              this.searchList();
436
-              this.$Message.success(data.msg);
437
-            } else {
438
-              this.$Message.error(data.msg);
439
-            }
440
-          });
441
-        }
442
-      });
443
-    },
444
-    toEdit(row) {
445
-      this.addInfo = {
446
-        daid: row.daid,
447
-        rversion: row.rversion,
448
-        show: true,
449
-        regionid: row.regionid,
450
-        sn: row.sn,
451
-        snState: row.snState
452
-      };
453
-    },
454
-    // 删除
455
-    toDel(row) {
456
-      this.$Modal.confirm({
457
-        title: "提示",
458
-        content: `您确定删除【${row.sn}】吗?`,
459
-        onOk: () => {
460
-          deviceAuth_delete({
461
-            rtype: this.powerParams.rtype,
462
-            objectid: this.powerParams.objectid,
463
-            daid: row.daid,
464
-            rversion: row.rversion
465
-          }).then((data) => {
466
-            if (data.code === 0) {
467
-              this.searchList();
468
-              this.$Message.success(data.msg);
469
-            } else {
470
-              this.$Message.error(data.msg);
471
-            }
472
-          });
473
-        },
474
-        onCancel: () => {}
475
-      });
476
-    },
477
-    toBatchDelete() {
478
-      if (this.batchDeleteList.length === 0) {
479
-        this.$Message.error("请选择数据");
480
-        return;
481
-      }
482
-      this.$Modal.confirm({
483
-        title: "提示",
484
-        content: `您确定删除选中数据吗?`,
485
-        onOk: () => {
486
-          deviceAuth_batch_delete(this.batchDeleteList).then((data) => {
487
-            if (data.code === 0) {
488
-              this.searchList();
489
-              this.$Message.success(data.msg);
490
-            } else {
491
-              this.$Message.error(data.msg);
492
-            }
493
-          });
494
-        },
495
-        onCancel: () => {}
496
-      });
497
-    }
498 34
   }
499 35
 };
500 36
 </script>
501 37
 
502 38
 <style lang="less" scoped>
503
-.search_header {
39
+.menu_info {
504 40
   display: flex;
505
-  justify-content: space-between;
41
+  justify-content: flex-start;
506 42
   align-items: center;
507
-  margin: 16px 16px;
508
-  .search_left {
509
-    display: flex;
510
-    justify-content: flex-start;
511
-    align-items: center;
512
-  }
513
-  .search_right {
514
-    display: flex;
515
-    justify-content: flex-start;
516
-    align-items: center;
517
-    .primary_btn {
518
-      margin-left: 16px;
43
+  margin: 16px;
44
+  font-size: 16px;
45
+  color: #7c8db5;
46
+  .menu_item {
47
+    margin-right: 16px;
48
+    padding: 0 4px 6px;
49
+    border-bottom: 2px solid transparent;
50
+    cursor: pointer;
51
+    &.selected {
52
+      color: #339dff;
53
+      border-color: #339dff;
519 54
     }
520 55
   }
521 56
 }

+ 20
- 9
src/views/schoolSection/networkManage/whitelist.vue ファイルの表示

@@ -102,16 +102,27 @@
102 102
         <div>{{ viewInfo.whiteName }}</div>
103 103
         <div v-if="viewInfo.whiteType === 2" class="public">公用</div>
104 104
       </div>
105
-      <Input
106
-        v-if="viewInfo.comm"
107
-        v-model="viewInfo.comm"
108
-        disabled
109
-        type="textarea"
110
-      />
111 105
       <Form :label-width="46">
112
-        <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
113
-          viewInfo.website
114
-        }}</FormItem>
106
+        <FormItem
107
+          label="简介"
108
+          style="
109
+            margin-bottom: 0;
110
+            width: 100%;
111
+            word-break: break-all;
112
+            word-wrap: break-word;
113
+          "
114
+          >{{ viewInfo.comm }}</FormItem
115
+        >
116
+        <FormItem
117
+          label="网址"
118
+          style="
119
+            margin-bottom: 0;
120
+            width: 100%;
121
+            word-break: break-all;
122
+            word-wrap: break-word;
123
+          "
124
+          >{{ viewInfo.website }}</FormItem
125
+        >
115 126
       </Form>
116 127
       <div slot="footer" style="text-align: center">
117 128
         <Button @click="viewInfo.show = false">关闭</Button>

+ 2
- 2
src/views/schoolSection/setting/deviceSetting.vue ファイルの表示

@@ -24,9 +24,9 @@
24 24
       <div class="require">
25 25
         学校强制绑定设备开关打开后,每个学生只能绑定一台设备,一旦和设备绑定将不能在其他设备上登录,需要更换设备时,需要管理员对该学生进行解绑操作。
26 26
       </div>
27
-      <div class="require">
27
+      <!-- <div class="require">
28 28
         SD卡功能设置开启后,该学校的所有设备SD功能均可使用,如果需要单独控制可以在设备管理中对单个设备进行开启或关闭操作。
29
-      </div>
29
+      </div> -->
30 30
       <div class="require">
31 31
         隐藏图库,相机开启后,该学校的所有设备桌面不再显示图库,相机。
32 32
       </div>

読み込み中…
キャンセル
保存