ソースを参照

学校-白名单库

gzb
wangzhonglu 9ヶ月前
コミット
48c1a7f348
2個のファイルの変更198行の追加4行の削除
  1. 5
    0
      src/api/whiteLibrary.js
  2. 193
    4
      src/views/schoolSection/networkManage/whitelistLibrary.vue

+ 5
- 0
src/api/whiteLibrary.js ファイルの表示

@@ -9,6 +9,11 @@ export const whiteLibrary_list = (data) =>
9 9
  * 4.1.2白名单库--添加
10 10
  */
11 11
 export const whiteLibrary_add = (data) => setRequest("whiteLibrary/add", data);
12
+/**
13
+ * 4.1.2白名单库--添加到白名单
14
+ */
15
+export const whiteLibrary_add_white = (data) =>
16
+  setRequest("whiteLibrary/add_white", data);
12 17
 /**
13 18
  * 4.1.3白名单库--更新
14 19
  */

+ 193
- 4
src/views/schoolSection/networkManage/whitelistLibrary.vue ファイルの表示

@@ -1,14 +1,203 @@
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
+    </div>
14
+    <div class="table_wrap">
15
+      <Table :columns="columns" :data="searchForm.list">
16
+        <template slot-scope="{ row }" slot="nameSlot">
17
+          <div class="name_slot">
18
+            <div class="name_content" :title="row.name">{{ row.name }}</div>
19
+            <div v-if="row.wltype === 1" class="app_tag">APP</div>
20
+            <div v-else-if="row.wltype === 2" class="web_tag">网址</div>
21
+          </div>
22
+        </template>
23
+        <template slot-scope="{ row }" slot="actionSlot">
24
+          <div class="action_list">
25
+            <div @click="addToWhitelist(row)">添加到白名单</div>
26
+          </div>
27
+        </template>
28
+      </Table>
29
+    </div>
30
+    <div class="page_wrap">
31
+      <Page
32
+        :transfer="true"
33
+        :total="searchForm.total"
34
+        :current="searchForm.page"
35
+        :page-size="searchForm.size"
36
+        :page-size-opts="[10, 20, 40, 60]"
37
+        @on-change="pageChange"
38
+        @on-page-size-change="pageSizeChange"
39
+        show-total
40
+        show-sizer
41
+      ></Page>
42
+    </div>
43
+  </div>
3 44
 </template>
4 45
 
5 46
 <script>
47
+import { whiteLibrary_list, whiteLibrary_add_white } from "@/api/whiteLibrary";
6 48
 export default {
7 49
   data() {
8
-    return {};
50
+    return {
51
+      searchForm: {
52
+        name: "",
53
+        page: 1,
54
+        size: 10,
55
+        list: [],
56
+        total: 0
57
+      },
58
+      columns: [
59
+        {
60
+          title: "序号",
61
+          align: "center",
62
+          width: 70,
63
+          render: (h, params) => {
64
+            return h(
65
+              "span",
66
+              params.index +
67
+                (this.searchForm.page - 1) * this.searchForm.size +
68
+                1
69
+            );
70
+          }
71
+        },
72
+        {
73
+          title: "应用名称",
74
+          slot: "nameSlot",
75
+          align: "center"
76
+        },
77
+        {
78
+          title: "版本名称",
79
+          key: "versionName",
80
+          align: "center"
81
+        },
82
+        {
83
+          title: "包名",
84
+          key: "website",
85
+          align: "center"
86
+        },
87
+        {
88
+          title: "操作人",
89
+          key: "updatename",
90
+          width: 140,
91
+          align: "center"
92
+        },
93
+        {
94
+          title: "操作时间",
95
+          key: "updatetime",
96
+          width: 190,
97
+          align: "center"
98
+        },
99
+        {
100
+          title: "操作",
101
+          slot: "actionSlot",
102
+          width: 140,
103
+          align: "center"
104
+        }
105
+      ]
106
+    };
9 107
   },
10
-  methods: {}
108
+  created() {
109
+    this.searchList();
110
+  },
111
+  methods: {
112
+    // 搜索
113
+    searchList() {
114
+      this.searchForm.page = 1;
115
+      this.getList();
116
+    },
117
+    // 页码改变
118
+    pageChange(page) {
119
+      this.searchForm.page = page;
120
+      this.getList();
121
+    },
122
+    // 每页显示数量改变
123
+    pageSizeChange(size) {
124
+      this.searchForm.size = size;
125
+      this.searchForm.page = 1;
126
+      this.getList();
127
+    },
128
+    // 获取列表
129
+    getList() {
130
+      whiteLibrary_list({
131
+        page: this.searchForm.page,
132
+        size: this.searchForm.size,
133
+        name: this.searchForm.name
134
+      }).then((data) => {
135
+        if (data.code === 0) {
136
+          this.searchForm.list = data.obj.data;
137
+          this.searchForm.total = data.obj.total;
138
+        } else {
139
+          this.$Message.error(data.msg);
140
+        }
141
+      });
142
+    },
143
+    // 添加到白名单
144
+    addToWhitelist(row) {
145
+      whiteLibrary_add_white({
146
+        wlid: row.wlid,
147
+        regionid: row.regionid
148
+      }).then((data) => {
149
+        if (data.code === 0) {
150
+          this.searchList();
151
+        } else {
152
+          this.$Message.error(data.msg);
153
+        }
154
+      });
155
+    }
156
+  }
11 157
 };
12 158
 </script>
13 159
 
14
-<style lang="less" scoped></style>
160
+<style lang="less" scoped>
161
+.search_header {
162
+  display: flex;
163
+  justify-content: space-between;
164
+  align-items: center;
165
+  margin: 16px 16px;
166
+  .search_left {
167
+    display: flex;
168
+    justify-content: flex-start;
169
+    align-items: center;
170
+  }
171
+}
172
+.name_slot {
173
+  display: flex;
174
+  justify-content: center;
175
+  align-items: center;
176
+  .name_content {
177
+    max-width: calc(100% - 38px);
178
+    overflow: hidden;
179
+    text-overflow: ellipsis;
180
+    white-space: nowrap;
181
+  }
182
+  .app_tag {
183
+    margin-left: 4px;
184
+    width: 32px;
185
+    text-align: center;
186
+    color: #fff;
187
+    line-height: 1.6;
188
+    font-size: 12px;
189
+    border-radius: 5px;
190
+    background-color: #7854f6;
191
+  }
192
+  .web_tag {
193
+    margin-left: 4px;
194
+    width: 32px;
195
+    text-align: center;
196
+    color: #fff;
197
+    line-height: 1.6;
198
+    font-size: 12px;
199
+    border-radius: 5px;
200
+    background-color: #52c41a;
201
+  }
202
+}
203
+</style>

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