Browse Source

Merge remote-tracking branch 'origin/gzb' into wzl

gzb
wangzhonglu 9 months ago
parent
commit
07e8a43929

+ 9
- 0
src/api/appgroup.js View File

@@ -72,6 +72,15 @@ export const app_list_app = (data) => setRequest("app/list_app", data);
72 72
  */
73 73
 export const app_detail_app = (data) => setRequest("app/detail_app", data);
74 74
 
75
+/**
76
+ * 5.2.10 应用-启用
77
+ */
78
+export const app_edit_enable = (data) => setRequest("app/edit_enable", data);
79
+
80
+/**
81
+ * 5.2.11 应用-禁用
82
+ */
83
+export const app_edit_unenable = (data) => setRequest("app/edit_unenable", data);
75 84
 /**
76 85
  * 5.3 设备-列表(分组下设备)
77 86
  */

+ 1
- 1
src/components/Checkbox/CheckboxDevice.vue View File

@@ -90,7 +90,7 @@ export default {
90 90
       }
91 91
     },
92 92
     //设置默认选中
93
-    getCheckedRole(val) {
93
+    getCheckedDevices(val) {
94 94
       this.checkAllSingleGroup = [];
95 95
       this.module.devices.forEach((item) => {
96 96
         val.map((value) => {

+ 531
- 158
src/views/regionSection/applicationManage/applicationManage.vue
File diff suppressed because it is too large
View File


+ 697
- 4
src/views/regionSection/networkManage/whitelist.vue View File

@@ -1,14 +1,707 @@
1 1
 <template>
2
-  <div class="main_root">白名单</div>
2
+  <div class="main_root">
3
+    <div class="search_header">
4
+      <div class="search_left">
5
+        <Input
6
+          v-model="searchForm.whiteName"
7
+          placeholder="请输入名称"
8
+          search
9
+          @on-search="searchList()"
10
+          style="width: 150px"
11
+        />
12
+      </div>
13
+      <Button type="primary" class="primary_btn" @click="toAdd()">新建</Button>
14
+    </div>
15
+    <div class="table_wrap">
16
+      <Table :columns="columns" :data="searchForm.list">
17
+        <template slot-scope="{ row }" slot="whiteName">
18
+          <div class="name_slot">
19
+            <div class="name_content" :title="row.whiteName">
20
+              {{ row.whiteName }}
21
+            </div>
22
+            <div v-if="row.whiteType === 2" class="app_tag">公用</div>
23
+          </div>
24
+        </template>
25
+        <template slot-scope="{ row }" slot="actionSlot">
26
+          <div class="action_list">
27
+            <div @click="toView(row)">查看</div>
28
+            <div @click="toEdit(row)">编辑</div>
29
+            <div class="action_del" @click="toDel(row)">删除</div>
30
+          </div>
31
+        </template>
32
+      </Table>
33
+    </div>
34
+    <div class="page_wrap">
35
+      <Page
36
+        :transfer="true"
37
+        :total="searchForm.total"
38
+        :current="searchForm.page"
39
+        :page-size="searchForm.size"
40
+        :page-size-opts="[10, 20, 40, 60]"
41
+        @on-change="pageChange"
42
+        @on-page-size-change="pageSizeChange"
43
+        show-total
44
+        show-sizer
45
+      ></Page>
46
+    </div>
47
+    <!-- 新建/编辑 -->
48
+    <Modal
49
+      class="modal1 white"
50
+      :mask-closable="false"
51
+      v-model="whiteLibraryInfo.show"
52
+      :title="whiteLibraryInfo.whiteid ? '编辑' : '新建'"
53
+    >
54
+      <Form
55
+        v-if="whiteLibraryInfo.show"
56
+        ref="addForm"
57
+        :model="whiteLibraryInfo"
58
+        :rules="rules"
59
+        :label-width="90"
60
+        inline
61
+      >
62
+        <FormItem label="名称" prop="whiteName" style="width: 100%">
63
+          <Input
64
+            v-model="whiteLibraryInfo.whiteName"
65
+            placeholder="请输入名称"
66
+          ></Input>
67
+        </FormItem>
68
+        <FormItem label="简介" style="width: 100%">
69
+          <Input
70
+            v-model="whiteLibraryInfo.comm"
71
+            type="textarea"
72
+            :rows="4"
73
+            :maxlength="255"
74
+            placeholder="请输入简介"
75
+          ></Input>
76
+          <div class="appcomm">
77
+            应用简介不能超过255个字符<span class="red">{{
78
+              whiteLibraryInfo.comm.length
79
+            }}</span
80
+            >/255
81
+          </div>
82
+        </FormItem>
83
+        <FormItem label="网址" prop="website" style="width: 100%">
84
+          <Input
85
+            type="textarea"
86
+            :rows="4"
87
+            v-model="whiteLibraryInfo.website"
88
+            placeholder="请填写正确的IP地址或者域名,多个IP或域名之间用英文分号隔开"
89
+          ></Input>
90
+          <div style="color: #7c8db5">
91
+            说明:IP例如:192.168.1.200或者192.168.1.200/24,域名例如:new.iflytek.com
92
+          </div>
93
+        </FormItem>
94
+        <FormItem label="选择学校" style="width: 100%" class="require">
95
+          <RadioGroup v-model="whiteLibraryInfo.targetSchool">
96
+            <Radio :label="1">所有学校</Radio>
97
+            <Radio :label="2">自定义学校</Radio>
98
+          </RadioGroup>
99
+          <div class="targetSchool" v-if="whiteLibraryInfo.targetSchool === 2">
100
+            <div class="allSchool">
101
+              <Input
102
+                v-model="whiteLibraryInfo.schoolname"
103
+                placeholder="请输入关键字"
104
+                search
105
+                @on-search="getSchool"
106
+              ></Input>
107
+              <div class="school_list">
108
+                <Tree
109
+                  @on-check-change="getSelectedNodes"
110
+                  :data="school_list"
111
+                  show-checkbox
112
+                ></Tree>
113
+              </div>
114
+            </div>
115
+            <div class="selectSchool">
116
+              <div class="school_num">
117
+                已选<span class="num">{{ select_schools.length }}</span
118
+                >所学校
119
+              </div>
120
+              <div class="school_list">
121
+                <span
122
+                  class="school_item"
123
+                  v-for="(item, index) in this.select_schools"
124
+                  :key="item.schoolid"
125
+                >
126
+                  <span class="title" :title="item.title">{{
127
+                    item.title
128
+                  }}</span>
129
+                  <img
130
+                    @click="delSchool(item)"
131
+                    class="del"
132
+                    src="../../../assets/img/guanbi_red.png"
133
+                  />
134
+                </span>
135
+              </div>
136
+            </div>
137
+          </div>
138
+        </FormItem>
139
+      </Form>
140
+      <div slot="footer">
141
+        <Button @click="whiteLibraryInfo.show = false">取消</Button>
142
+        <Button @click="saveAddInfo()" type="primary">保存</Button>
143
+      </div>
144
+    </Modal>
145
+    <!-- 查看 -->
146
+    <Modal
147
+      class="modal1"
148
+      :mask-closable="false"
149
+      v-model="viewInfo.show"
150
+      title="查看"
151
+    >
152
+      <div class="view_title">
153
+        <div>{{ viewInfo.whiteName }}</div>
154
+        <div v-if="viewInfo.whiteType === 2" class="wltype_1">公共</div>
155
+      </div>
156
+      <Form :label-width="80" inline>
157
+        <FormItem label="简介" style="margin-bottom: 0; width: 100%">{{
158
+          viewInfo.comm
159
+        }}</FormItem>
160
+        <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
161
+          viewInfo.website
162
+        }}</FormItem>
163
+        <FormItem label="授权" style="margin-bottom: 0; width: 100%">
164
+          <Table border :columns="columns1" :data="viewInfo.schools"> </Table>
165
+        </FormItem>
166
+      </Form>
167
+      <div slot="footer" style="text-align: center">
168
+        <Button @click="viewInfo.show = false">关闭</Button>
169
+      </div>
170
+    </Modal>
171
+  </div>
3 172
 </template>
4 173
 
5 174
 <script>
175
+import {
176
+  white_list,
177
+  white_edit,
178
+  white_add,
179
+  white_detail,
180
+  white_delete
181
+} from "@/api/whiteLibrary";
182
+import { region_list_rs } from "@/api/region";
6 183
 export default {
7 184
   data() {
8
-    return {};
185
+    return {
186
+      searchForm: {
187
+        whiteName: "",
188
+        regionid: "",
189
+        page: 1,
190
+        size: 10,
191
+        list: [],
192
+        total: 0
193
+      },
194
+      rules: {
195
+        whiteName: [
196
+          {
197
+            required: true,
198
+            message: "请输入名称",
199
+            trigger: "change"
200
+          }
201
+        ],
202
+        website: [
203
+          {
204
+            required: true,
205
+            message: "请输入网址",
206
+            trigger: "change"
207
+          }
208
+        ],
209
+        versionname: [
210
+          {
211
+            required: true,
212
+            message: "请输入版本名称",
213
+            trigger: "change"
214
+          }
215
+        ]
216
+      },
217
+      // 新建/编辑
218
+      whiteLibraryInfo: {
219
+        show: false,
220
+        whiteid: null,
221
+        rversion: null,
222
+        whiteName: "",
223
+        targetSchool: 1,
224
+        website: "",
225
+        regionid: "",
226
+        comm: "",
227
+        schoolids: []
228
+      },
229
+      // 查看
230
+      viewInfo: {
231
+        show: false,
232
+        whiteName: "",
233
+        // 1app 2网页
234
+        wltype: 1,
235
+        website: "",
236
+        versionname: "",
237
+        comm: "",
238
+        whiteAddress: ""
239
+      },
240
+      userInfo: {},
241
+      curRegion: [],
242
+      school_list: [],
243
+      select_schools: [],
244
+      columns: [
245
+        {
246
+          title: "序号",
247
+          align: "center",
248
+          width: 70,
249
+          render: (h, params) => {
250
+            return h(
251
+              "span",
252
+              params.index +
253
+                (this.searchForm.page - 1) * this.searchForm.size +
254
+                1
255
+            );
256
+          }
257
+        },
258
+        {
259
+          title: "名称",
260
+          slot: "whiteName",
261
+          align: "center"
262
+        },
263
+        {
264
+          title: "网址",
265
+          key: "website",
266
+          align: "center"
267
+        },
268
+        {
269
+          title: "操作人",
270
+          key: "updatename",
271
+          width: 140,
272
+          align: "center"
273
+        },
274
+        {
275
+          title: "操作时间",
276
+          key: "updatetime",
277
+          width: 190,
278
+          align: "center"
279
+        },
280
+        {
281
+          title: "操作",
282
+          slot: "actionSlot",
283
+          width: 180,
284
+          align: "center"
285
+        }
286
+      ],
287
+      columns1: [
288
+        {
289
+          title: "序号",
290
+          align: "center",
291
+          width: 70,
292
+          type: "index"
293
+        },
294
+        {
295
+          title: "学校名称",
296
+          key: "schoolName",
297
+          align: "center"
298
+        },
299
+        {
300
+          title: "所属区域",
301
+          key: "regionName",
302
+          align: "center"
303
+        },
304
+        {
305
+          title: "操作时间",
306
+          key: "createtime",
307
+          align: "center"
308
+        }
309
+      ]
310
+    };
9 311
   },
10
-  methods: {}
312
+  created() {
313
+    this.userInfo = JSON.parse(
314
+      localStorage.getItem("xh_control_userInfo")
315
+    ).content;
316
+    this.init();
317
+    this.searchList();
318
+  },
319
+  methods: {
320
+    init() {
321
+      //获取区域学校
322
+      region_list_rs({ regionid: this.userInfo.regionid }).then((res) => {
323
+        if (res.code === 0) {
324
+          this.getHandleData(res.obj[0]);
325
+          this.curRegion = res.obj;
326
+        } else {
327
+          this.$Message.error(res.msg);
328
+        }
329
+      });
330
+    },
331
+    delSchool(item) {
332
+      this.select_schools = this.select_schools.filter(
333
+        (v) => v.schoolid != item.schoolid
334
+      );
335
+      //取消选择
336
+      this.getSelectSchool(this.school_list[0], item.schoolid, 0);
337
+    },
338
+    //选中区域学校
339
+    getSelectedNodes(data) {
340
+      this.select_schools = data.filter((v) => v.schoolid);
341
+    },
342
+    getSelectSchool(node, schoolid, type) {
343
+      if (schoolid) {
344
+        //删除
345
+        if (node.schoolid && node.schoolid === schoolid) {
346
+          let checked = type ? true : false;
347
+          this.$set(node, "checked", checked);
348
+        }
349
+      } else {
350
+        //保存
351
+        if (node.schoolid) {
352
+          this.whiteLibraryInfo.schoolids.push(node.schoolid);
353
+        }
354
+      }
355
+      if (node.children && node.children.length > 0) {
356
+        for (let child of node.children) {
357
+          this.getSelectSchool(child, schoolid, type);
358
+        }
359
+      }
360
+    },
361
+    getSchool() {
362
+      //获取区域学校
363
+      region_list_rs({
364
+        regionid: this.userInfo.regionid,
365
+        regionName: this.whiteLibraryInfo.schoolname
366
+      }).then((res) => {
367
+        if (res.code === 0) {
368
+          this.getHandleData(res.obj[0]);
369
+          this.school_list = res.obj;
370
+        } else {
371
+          this.$Message.error(res.msg);
372
+        }
373
+      });
374
+    },
375
+    getHandleData(node) {
376
+      node.title = node.regionName;
377
+      node.expand = true;
378
+      if (node.children && node.children.length > 0) {
379
+        for (let child of node.children) {
380
+          this.getHandleData(child);
381
+        }
382
+      }
383
+    },
384
+    // 搜索
385
+    searchList() {
386
+      this.searchForm.page = 1;
387
+      this.getList();
388
+    },
389
+    // 页码改变
390
+    pageChange(page) {
391
+      this.searchForm.page = page;
392
+      this.getList();
393
+    },
394
+    // 每页显示数量改变
395
+    pageSizeChange(size) {
396
+      this.searchForm.size = size;
397
+      this.searchForm.page = 1;
398
+      this.getList();
399
+    },
400
+    // 获取列表
401
+    getList() {
402
+      white_list({
403
+        page: this.searchForm.page,
404
+        size: this.searchForm.size,
405
+        whiteName: this.searchForm.whiteName,
406
+        regionid: this.userInfo.regionid
407
+      }).then((data) => {
408
+        if (data.code === 0) {
409
+          this.searchForm.list = data.obj.data;
410
+          this.searchForm.total = data.obj.total;
411
+        } else {
412
+          this.$Message.error(data.msg);
413
+        }
414
+      });
415
+    },
416
+    // 新建
417
+    toAdd() {
418
+      this.school_list = JSON.parse(JSON.stringify(this.curRegion));
419
+      this.whiteLibraryInfo = {
420
+        show: true,
421
+        whiteid: null,
422
+        rversion: null,
423
+        whiteName: "",
424
+        targetSchool: 1,
425
+        website: "",
426
+        regionid: "",
427
+        comm: "",
428
+        schoolids: []
429
+      };
430
+    },
431
+    // 保存新建
432
+    saveAddInfo() {
433
+      this.$refs.addForm.validate((valid) => {
434
+        if (valid) {
435
+          if (this.whiteLibraryInfo.targetSchool === 1) {
436
+            //获取全部学校
437
+            this.getSelectSchool(this.curRegion[0], null);
438
+          } else {
439
+            //获取选中学校
440
+            for (let school of this.select_schools) {
441
+              this.whiteLibraryInfo.schoolids.push(school.schoolid);
442
+            }
443
+          }
444
+          if (this.whiteLibraryInfo.schoolids.length === 0) {
445
+            this.$Message.error("请选择学校!");
446
+            return;
447
+          }
448
+          let api = this.whiteLibraryInfo.whiteid ? white_edit : white_add;
449
+          let form = {
450
+            whiteName: this.whiteLibraryInfo.whiteName,
451
+            targetSchool: this.whiteLibraryInfo.targetSchool,
452
+            regionid: this.userInfo.regionid,
453
+            website: this.whiteLibraryInfo.website,
454
+            comm: this.whiteLibraryInfo.comm,
455
+            schoolids: this.whiteLibraryInfo.schoolids
456
+          };
457
+          //编辑
458
+          if (this.whiteLibraryInfo.whiteid && this.whiteLibraryInfo.rversion) {
459
+            form.whiteid = this.whiteLibraryInfo.whiteid;
460
+            form.rversion = this.whiteLibraryInfo.rversion;
461
+          }
462
+          api(form).then((data) => {
463
+            if (data.code === 0) {
464
+              this.whiteLibraryInfo.show = false;
465
+              this.searchList();
466
+              this.$Message.success(data.msg);
467
+            } else {
468
+              this.$Message.error(data.msg);
469
+            }
470
+          });
471
+        }
472
+      });
473
+    },
474
+    // 查看
475
+    toView(row) {
476
+      white_detail({ whiteid: row.whiteid }).then((res) => {
477
+        if (res.code === 0) {
478
+          this.viewInfo = {
479
+            show: true,
480
+            whiteid: res.obj.whiteid,
481
+            rversion: res.obj.rversion,
482
+            whiteName: res.obj.whiteName,
483
+            targetSchool: res.obj.targetSchool,
484
+            website: res.obj.website,
485
+            regionid: res.obj.regionid,
486
+            comm: res.obj.comm,
487
+            schools: res.obj.schools
488
+          };
489
+        } else {
490
+          this.$Message.error(res.msg);
491
+        }
492
+      });
493
+    },
494
+    // 编辑
495
+    toEdit(row) {
496
+      this.school_list = JSON.parse(JSON.stringify(this.curRegion));
497
+      white_detail({ whiteid: row.whiteid }).then((res) => {
498
+        if (res.code === 0) {
499
+          this.whiteLibraryInfo = {
500
+            show: true,
501
+            whiteid: res.obj.whiteid,
502
+            rversion: res.obj.rversion,
503
+            whiteName: res.obj.whiteName,
504
+            targetSchool: res.obj.targetSchool,
505
+            website: res.obj.website,
506
+            regionid: res.obj.regionid,
507
+            comm: res.obj.comm,
508
+            schoolids: []
509
+          };
510
+          if (this.whiteLibraryInfo.targetSchool === 2) {
511
+            //回显学校
512
+            this.select_schools = res.obj.schools.map((v) => {
513
+              //默认选择学校
514
+              this.getSelectSchool(this.school_list[0], v.schoolid, 1);
515
+              v.title = v.schoolName;
516
+              return v;
517
+            });
518
+          }
519
+        } else {
520
+          this.$Message.error(res.msg);
521
+        }
522
+      });
523
+    },
524
+    // 删除
525
+    toDel(row) {
526
+      this.$Modal.confirm({
527
+        title: "提示",
528
+        content: "您确定删除选中数据吗?",
529
+        onOk: () => {
530
+          white_delete({
531
+            whiteid: row.whiteid,
532
+            rversion: row.rversion
533
+          }).then((data) => {
534
+            if (data.code === 0) {
535
+              this.searchList();
536
+              this.$Message.success(data.msg);
537
+            } else {
538
+              this.$Message.error(data.msg);
539
+            }
540
+          });
541
+        },
542
+        onCancel: () => {}
543
+      });
544
+    }
545
+  }
11 546
 };
12 547
 </script>
13 548
 
14
-<style lang="less" scoped></style>
549
+<style lang="less" scoped>
550
+.search_header {
551
+  display: flex;
552
+  justify-content: space-between;
553
+  align-items: center;
554
+  margin: 16px 16px;
555
+  .search_left {
556
+    display: flex;
557
+    justify-content: flex-start;
558
+    align-items: center;
559
+  }
560
+}
561
+.white {
562
+  .appcomm {
563
+    height: 20px;
564
+    line-height: 20px;
565
+    text-align: right;
566
+    color: #b8c2d9;
567
+    font-size: 14px;
568
+    .red {
569
+      display: inline-block;
570
+      margin: 0 4px;
571
+      color: #f0153f;
572
+    }
573
+  }
574
+  .targetSchool {
575
+    width: 100%;
576
+    height: 400px;
577
+    border: 1px solid #ced9f2;
578
+    border-radius: 8px;
579
+    margin-top: 10px;
580
+    display: flex;
581
+    .allSchool {
582
+      border-right: 1px solid #ced9f2;
583
+      width: 50%;
584
+      padding: 10px;
585
+      .school_list {
586
+        margin-top: 10px;
587
+        height: calc(100% - 42px);
588
+        overflow-y: auto;
589
+      }
590
+    }
591
+    .selectSchool {
592
+      width: 50%;
593
+      padding: 10px;
594
+      .school_num {
595
+        height: 32px;
596
+        display: flex;
597
+        align-items: center;
598
+        .num {
599
+          color: #339cff;
600
+          font-weight: bold;
601
+          margin: 0 2px;
602
+        }
603
+      }
604
+      .school_list {
605
+        margin-top: 10px;
606
+        height: calc(100% - 42px);
607
+        overflow-y: auto;
608
+        .school_item {
609
+          display: inline-block;
610
+          width: calc(50% - 10px);
611
+          height: 28px;
612
+          line-height: 28px;
613
+          border-radius: 6px;
614
+          font-size: 14px;
615
+          padding: 0 30px 0 10px;
616
+          margin-right: 10px;
617
+          margin-bottom: 10px;
618
+          background: #f3f4fc;
619
+          position: relative;
620
+          .title {
621
+            display: inline-block;
622
+            width: calc(100% - 10px);
623
+            white-space: nowrap;
624
+            text-overflow: ellipsis;
625
+            overflow: hidden;
626
+          }
627
+          .del {
628
+            width: 20px;
629
+            height: 20px;
630
+            object-fit: cover;
631
+            position: absolute;
632
+            right: 10px;
633
+            top: 4px;
634
+            cursor: pointer;
635
+          }
636
+        }
637
+      }
638
+    }
639
+  }
640
+}
641
+.view_title {
642
+  display: flex;
643
+  justify-content: center;
644
+  align-items: center;
645
+  margin-bottom: 16px;
646
+  font-size: 18px;
647
+  font-weight: bold;
648
+  text-align: center;
649
+  .wltype_1 {
650
+    margin-left: 10px;
651
+    padding: 0 10px;
652
+    line-height: 20px;
653
+    color: #fff;
654
+    font-weight: normal;
655
+    font-size: 12px;
656
+    border-radius: 4px;
657
+    background: #7854f6;
658
+  }
659
+  .wltype_2 {
660
+    margin-left: 10px;
661
+    padding: 0 10px;
662
+    line-height: 20px;
663
+    color: #fff;
664
+    font-weight: normal;
665
+    font-size: 12px;
666
+    border-radius: 4px;
667
+    background: #52c41a;
668
+  }
669
+}
670
+.name_slot {
671
+  display: flex;
672
+  justify-content: center;
673
+  align-items: center;
674
+  .name_content {
675
+    max-width: calc(100% - 38px);
676
+    overflow: hidden;
677
+    text-overflow: ellipsis;
678
+    white-space: nowrap;
679
+  }
680
+  .app_tag {
681
+    margin-left: 4px;
682
+    width: 32px;
683
+    text-align: center;
684
+    color: #fff;
685
+    line-height: 1.6;
686
+    font-size: 12px;
687
+    border-radius: 5px;
688
+    background-color: #7854f6;
689
+  }
690
+  .web_tag {
691
+    margin-left: 4px;
692
+    width: 32px;
693
+    text-align: center;
694
+    color: #fff;
695
+    line-height: 1.6;
696
+    font-size: 12px;
697
+    border-radius: 5px;
698
+    background-color: #52c41a;
699
+  }
700
+}
701
+.white_address {
702
+  max-width: 100%;
703
+  overflow: hidden;
704
+  text-overflow: ellipsis;
705
+  white-space: nowrap;
706
+}
707
+</style>

+ 411
- 4
src/views/regionSection/networkManage/whitelistLibrary.vue View File

@@ -1,14 +1,421 @@
1 1
 <template>
2
-  <div class="main_root">白名单库</div>
2
+  <div class="main_root">
3
+    <div class="search_header">
4
+      <div class="search_left">
5
+        <Input
6
+          v-model="searchForm.aname"
7
+          placeholder="请输入名称"
8
+          search
9
+          @on-search="searchList()"
10
+          style="width: 150px"
11
+        />
12
+      </div>
13
+      <Button type="primary" class="primary_btn" @click="toAdd()">新建</Button>
14
+    </div>
15
+    <div class="table_wrap">
16
+      <Table :columns="columns" :data="searchForm.list">
17
+        <template slot-scope="{ row }" slot="nameSlot">
18
+          <div class="name_slot">
19
+            <div class="name_content" :title="row.name">{{ row.name }}</div>
20
+            <div v-if="row.wltype === 1" class="app_tag">APP</div>
21
+            <div v-else-if="row.wltype === 2" class="web_tag">网址</div>
22
+          </div>
23
+        </template>
24
+        <template slot-scope="{ row }" slot="whiteAddressSlot">
25
+          <div class="white_address" :title="row.whiteAddress">
26
+            {{ row.whiteAddress }}
27
+          </div>
28
+        </template>
29
+        <template slot-scope="{ row }" slot="actionSlot">
30
+          <div class="action_list">
31
+            <div @click="addwhite(row)">添加到白名单</div>
32
+          </div>
33
+        </template>
34
+      </Table>
35
+    </div>
36
+    <div class="page_wrap">
37
+      <Page
38
+        :transfer="true"
39
+        :total="searchForm.total"
40
+        :current="searchForm.page"
41
+        :page-size="searchForm.size"
42
+        :page-size-opts="[10, 20, 40, 60]"
43
+        @on-change="pageChange"
44
+        @on-page-size-change="pageSizeChange"
45
+        show-total
46
+        show-sizer
47
+      ></Page>
48
+    </div>
49
+    <!-- 新建/编辑 -->
50
+    <Modal
51
+      class="modal1"
52
+      :mask-closable="false"
53
+      v-model="whiteLibraryInfo.show"
54
+      :title="whiteLibraryInfo.whiteid ? '编辑' : '新建'"
55
+    >
56
+      <Form
57
+        v-if="whiteLibraryInfo.show"
58
+        ref="addForm"
59
+        :model="whiteLibraryInfo"
60
+        :rules="rules"
61
+        :label-width="90"
62
+        inline
63
+      >
64
+        <FormItem label="名称" prop="name" style="width: 100%">
65
+          <Input
66
+            v-model="whiteLibraryInfo.name"
67
+            placeholder="请输入名称"
68
+          ></Input>
69
+        </FormItem>
70
+        <FormItem label="类型" prop="wltype" style="width: 100%">
71
+          <RadioGroup v-model="whiteLibraryInfo.wltype">
72
+            <Radio :label="1">APP</Radio>
73
+            <Radio :label="2">网址</Radio>
74
+          </RadioGroup>
75
+        </FormItem>
76
+        <template v-if="whiteLibraryInfo.wltype === 1">
77
+          <FormItem
78
+            label="版本名称"
79
+            prop="versionname"
80
+            style="width: calc(50% - 10px)"
81
+          >
82
+            <Input
83
+              v-model="whiteLibraryInfo.versionname"
84
+              placeholder="请输入版本名称"
85
+            ></Input>
86
+          </FormItem>
87
+          <FormItem label="包名" prop="website" style="width: calc(50% - 10px)">
88
+            <Input
89
+              v-model="whiteLibraryInfo.website"
90
+              placeholder="请输入包名"
91
+            ></Input>
92
+          </FormItem>
93
+        </template>
94
+        <FormItem label="简介" prop="comm" style="width: 100%">
95
+          <Input
96
+            v-model="whiteLibraryInfo.comm"
97
+            placeholder="请输入简介"
98
+          ></Input>
99
+        </FormItem>
100
+        <FormItem label="网址" prop="whiteAddress" style="width: 100%">
101
+          <Input
102
+            type="textarea"
103
+            v-model="whiteLibraryInfo.whiteAddress"
104
+            placeholder="请填写正确的IP地址或者域名,多个IP或域名之间用英文分号隔开"
105
+          ></Input>
106
+          <div style="color: #7c8db5">
107
+            说明:IP例如:192.168.1.200或者192.168.1.200/24,域名例如:new.iflytek.com
108
+          </div>
109
+        </FormItem>
110
+      </Form>
111
+      <div slot="footer">
112
+        <Button @click="whiteLibraryInfo.show = false">取消</Button>
113
+        <Button @click="saveAddInfo()" type="primary">保存</Button>
114
+      </div>
115
+    </Modal>
116
+    <!-- 查看 -->
117
+    <Modal
118
+      class="modal1"
119
+      :mask-closable="false"
120
+      v-model="viewInfo.show"
121
+      title="查看"
122
+    >
123
+      <div class="view_title">
124
+        <div>{{ viewInfo.name }}</div>
125
+        <div v-if="viewInfo.wltype === 1" class="wltype_1">APP</div>
126
+        <div v-if="viewInfo.wltype === 2" class="wltype_2">网址</div>
127
+      </div>
128
+      <Form :label-width="80" inline>
129
+        <template v-if="viewInfo.wltype === 1">
130
+          <FormItem
131
+            label="版本名称"
132
+            style="margin-bottom: 0; width: calc(50% - 10px)"
133
+            >{{ viewInfo.versionname }}</FormItem
134
+          >
135
+          <FormItem
136
+            label="包名"
137
+            style="margin-bottom: 0; width: calc(50% - 10px)"
138
+            >{{ viewInfo.website }}</FormItem
139
+          >
140
+        </template>
141
+        <FormItem label="简介" style="margin-bottom: 0; width: 100%">{{
142
+          viewInfo.comm
143
+        }}</FormItem>
144
+        <FormItem label="网址" style="margin-bottom: 0; width: 100%">{{
145
+          viewInfo.whiteAddress
146
+        }}</FormItem>
147
+      </Form>
148
+      <div slot="footer" style="text-align: center">
149
+        <Button @click="viewInfo.show = false">关闭</Button>
150
+      </div>
151
+    </Modal>
152
+  </div>
3 153
 </template>
4 154
 
5 155
 <script>
156
+import {
157
+  whiteLibrary_list,
158
+  whiteLibrary_add,
159
+  whiteLibrary_edit,
160
+  whiteLibrary_delete, whiteLibrary_add_white
161
+} from "@/api/whiteLibrary";
6 162
 export default {
7 163
   data() {
8
-    return {};
164
+    return {
165
+      searchForm: {
166
+        name: "",
167
+        page: 1,
168
+        size: 10,
169
+        list: [],
170
+        total: 0
171
+      },
172
+      rules: {
173
+        name: [
174
+          {
175
+            required: true,
176
+            message: "请输入名称",
177
+            trigger: "change"
178
+          }
179
+        ],
180
+        wltype: [
181
+          {
182
+            required: true,
183
+            type: "number",
184
+            message: "请选择状态",
185
+            trigger: "change"
186
+          }
187
+        ],
188
+        versionname: [
189
+          {
190
+            required: true,
191
+            message: "请输入版本名称",
192
+            trigger: "change"
193
+          }
194
+        ]
195
+      },
196
+      // 新建/编辑
197
+      whiteLibraryInfo: {
198
+        show: false,
199
+        whiteid: null,
200
+        rversion: null,
201
+        name: "",
202
+        // 1app 2网页
203
+        wltype: 1,
204
+        website: "",
205
+        versionname: "",
206
+        comm: "",
207
+        whiteAddress: ""
208
+      },
209
+      // 查看
210
+      viewInfo: {
211
+        show: false,
212
+        name: "",
213
+        // 1app 2网页
214
+        wltype: 1,
215
+        website: "",
216
+        versionname: "",
217
+        comm: "",
218
+        whiteAddress: ""
219
+      },
220
+      userInfo: {},
221
+      columns: [
222
+        {
223
+          title: "序号",
224
+          align: "center",
225
+          width: 70,
226
+          render: (h, params) => {
227
+            return h(
228
+              "span",
229
+              params.index +
230
+                (this.searchForm.page - 1) * this.searchForm.size +
231
+                1
232
+            );
233
+          }
234
+        },
235
+        {
236
+          title: "应用名称",
237
+          slot: "nameSlot",
238
+          align: "center"
239
+        },
240
+        {
241
+          title: "版本名称",
242
+          key: "versionName",
243
+          align: "center"
244
+        },
245
+        {
246
+          title: "版本号",
247
+          key: "rversion",
248
+          align: "center"
249
+        },
250
+        {
251
+          title: "包名",
252
+          key: "website",
253
+          align: "center"
254
+        },
255
+        {
256
+          title: "操作人",
257
+          key: "updatename",
258
+          width: 140,
259
+          align: "center"
260
+        },
261
+        {
262
+          title: "操作时间",
263
+          key: "updatetime",
264
+          width: 190,
265
+          align: "center"
266
+        },
267
+        {
268
+          title: "操作",
269
+          slot: "actionSlot",
270
+          width: 180,
271
+          align: "center"
272
+        }
273
+      ]
274
+    };
9 275
   },
10
-  methods: {}
276
+  created() {
277
+    this.userInfo = JSON.parse(
278
+      localStorage.getItem("xh_control_userInfo")
279
+    ).content;
280
+    this.searchList();
281
+  },
282
+  methods: {
283
+    // 搜索
284
+    searchList() {
285
+      this.searchForm.page = 1;
286
+      this.getList();
287
+    },
288
+    // 页码改变
289
+    pageChange(page) {
290
+      this.searchForm.page = page;
291
+      this.getList();
292
+    },
293
+    // 每页显示数量改变
294
+    pageSizeChange(size) {
295
+      this.searchForm.size = size;
296
+      this.searchForm.page = 1;
297
+      this.getList();
298
+    },
299
+    // 获取列表
300
+    getList() {
301
+      whiteLibrary_list({
302
+        page: this.searchForm.page,
303
+        size: this.searchForm.size,
304
+        name: this.searchForm.name
305
+      }).then((data) => {
306
+        if (data.code === 0) {
307
+          this.searchForm.list = data.obj.data;
308
+          console.log(this.searchForm.list);
309
+          this.searchForm.total = data.obj.total;
310
+        } else {
311
+          this.$Message.error(data.msg);
312
+        }
313
+      });
314
+    },
315
+    // 添加到白名单
316
+    addwhite(row) {
317
+      this.$Modal.confirm({
318
+        title: "提示",
319
+        content:
320
+          '确定要将 "<span style="color: #339dff">' +
321
+          row.name +
322
+          '</span>" 加到白名单?',
323
+        onOk: () => {
324
+          whiteLibrary_add_white({
325
+            wlid: row.wlid,
326
+            regionid: this.userInfo.regionid
327
+          }).then((data) => {
328
+            if (data.code === 0) {
329
+              this.searchList();
330
+              this.$Message.success(data.msg);
331
+            } else {
332
+              this.$Message.error(data.msg);
333
+            }
334
+          });
335
+        },
336
+        onCancel: () => {}
337
+      });
338
+    }
339
+  }
11 340
 };
12 341
 </script>
13 342
 
14
-<style lang="less" scoped></style>
343
+<style lang="less" scoped>
344
+.search_header {
345
+  display: flex;
346
+  justify-content: space-between;
347
+  align-items: center;
348
+  margin: 16px 16px;
349
+  .search_left {
350
+    display: flex;
351
+    justify-content: flex-start;
352
+    align-items: center;
353
+  }
354
+}
355
+.view_title {
356
+  display: flex;
357
+  justify-content: center;
358
+  align-items: center;
359
+  margin-bottom: 16px;
360
+  font-size: 18px;
361
+  font-weight: bold;
362
+  text-align: center;
363
+  .wltype_1 {
364
+    margin-left: 10px;
365
+    padding: 0 10px;
366
+    line-height: 20px;
367
+    color: #fff;
368
+    font-weight: normal;
369
+    font-size: 12px;
370
+    border-radius: 4px;
371
+    background: #7854f6;
372
+  }
373
+  .wltype_2 {
374
+    margin-left: 10px;
375
+    padding: 0 10px;
376
+    line-height: 20px;
377
+    color: #fff;
378
+    font-weight: normal;
379
+    font-size: 12px;
380
+    border-radius: 4px;
381
+    background: #52c41a;
382
+  }
383
+}
384
+.name_slot {
385
+  display: flex;
386
+  justify-content: center;
387
+  align-items: center;
388
+  .name_content {
389
+    max-width: calc(100% - 38px);
390
+    overflow: hidden;
391
+    text-overflow: ellipsis;
392
+    white-space: nowrap;
393
+  }
394
+  .app_tag {
395
+    margin-left: 4px;
396
+    width: 32px;
397
+    text-align: center;
398
+    color: #fff;
399
+    line-height: 1.6;
400
+    font-size: 12px;
401
+    border-radius: 5px;
402
+    background-color: #7854f6;
403
+  }
404
+  .web_tag {
405
+    margin-left: 4px;
406
+    width: 32px;
407
+    text-align: center;
408
+    color: #fff;
409
+    line-height: 1.6;
410
+    font-size: 12px;
411
+    border-radius: 5px;
412
+    background-color: #52c41a;
413
+  }
414
+}
415
+.white_address {
416
+  max-width: 100%;
417
+  overflow: hidden;
418
+  text-overflow: ellipsis;
419
+  white-space: nowrap;
420
+}
421
+</style>

Loading…
Cancel
Save