瀏覽代碼

数据资源目录前台搜索页接口联调

chaihaorui 1 年之前
父節點
當前提交
286a347546
共有 3 個文件被更改,包括 129 次插入155 次删除
  1. 0 4
      src/api/homepage/homepage.js
  2. 13 0
      src/api/homepage/search.js
  3. 116 151
      src/pages/homepage/components/searchPage.vue

+ 0 - 4
src/api/homepage/homepage.js

@@ -2,10 +2,6 @@
2 2
 import axios from "@/util/ajax";
3 3
 
4 4
 export default {
5
-    // 获取最新资讯
6
-    // getLatestInfo() {
7
-    //     return axios.post('/xyjc/index-content/latest-info');
8
-    // },
9 5
     // 获取资源数据
10 6
     resourceData(params) {
11 7
         return axios.get('/resourceDirectory/homeStatisticalTotal', { params });

+ 13 - 0
src/api/homepage/search.js

@@ -0,0 +1,13 @@
1
+// 前台首页
2
+import axios from "@/util/ajax";
3
+
4
+export default {
5
+    // 获取目录数据
6
+    menuInfo(params) {
7
+        return axios.get('/resourceDirectory/getMenuInfo', { params });
8
+    },
9
+    // 获取查询数据列表
10
+    searchData(params) {
11
+        return axios.get('/resourceDirectory/searchEsData', { params });
12
+    }
13
+}

+ 116 - 151
src/pages/homepage/components/searchPage.vue

@@ -13,15 +13,16 @@
13 13
         <div class="flex">
14 14
           <div class="tree-wrap">
15 15
             <el-button-group v-if="activeName === 'fourth'">
16
-              <el-button :type="serviceType === 'API' ? 'primary' : ''" @click="serviceType = 'API'" size="small">API服务</el-button>
17
-              <el-button :type="serviceType === 'MQ' ? 'primary' : ''" @click="serviceType = 'MQ'" size="small">消息队列</el-button>
16
+              <el-button :type="serviceType === 'API' ? 'primary' : ''" @click="serviceBtnClick('API')" size="small">API服务</el-button>
17
+              <el-button :type="serviceType === 'MQ' ? 'primary' : ''" @click="serviceBtnClick('MQ')" size="small">消息队列</el-button>
18 18
             </el-button-group>
19 19
             <div>{{item.name}}</div>
20 20
             <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
21 21
           </div>
22 22
           <div class="list-wrap">
23 23
             <div v-if="pageType === 'collect'" ><el-button :type="'primary'" @click="batchCancelCollect" size="small">批量取消收藏</el-button></div>
24
-            <div :class="getCardClass()" v-for="(item, idx) in list" :key="idx" @click="jumpToDetailPage(item.id)">
24
+            <div v-if="list.length === 0" class="empty-block">暂无数据</div>
25
+            <div v-else :class="getCardClass()" v-for="(item, idx) in list" :key="idx" @click="jumpToDetailPage(item.id)">
25 26
               <!-- 主题库和专题库块 -->
26 27
               <div v-if="activeName === 'first' || activeName === 'second'" class="title title-block clearfix">
27 28
                 <p class="left">
@@ -36,14 +37,14 @@
36 37
                 </div>
37 38
               </div>
38 39
               <el-row v-if="activeName === 'first' || activeName === 'second'" style="color: rgb(91,91,91);line-height: 40px;">
39
-                <el-col :span="12">
40
+                <el-col :span="12" class="text-overflow" :title="item.tbName">
40 41
                   英文名称:{{item.tbName}}
41 42
                 </el-col>
42 43
                 <el-col :span="12">
43 44
                   更新时间:{{item.updateTime}}
44 45
                 </el-col>
45 46
                 <el-col :span="12">
46
-                  所属主题:{{item.topic}}
47
+                  所属主题:{{item.l1}}
47 48
                 </el-col>
48 49
               </el-row>
49 50
               <!-- 指标编码块 -->
@@ -52,11 +53,11 @@
52 53
                   <el-checkbox v-if="pageType === 'collect'" class="checkbox" v-model="item.checked" @click.stop="" @change="(e) => checkboxChange(e, item.id)"></el-checkbox>
53 54
                 </span>
54 55
                 <img src="../../../assets/image/u652.svg" alt="">
55
-                指标名称:{{item.logicTbName}}
56
+                指标名称:{{item.name}}
56 57
               </p>
57 58
               <el-row v-if="activeName === 'third'" style="color: rgb(91,91,91);line-height: 40px;">
58 59
                 <el-col :span="12">
59
-                  所属目录:{{item.tbName}}
60
+                  所属目录:{{item.l1}}
60 61
                 </el-col>
61 62
                 <el-col :span="12">
62 63
                   更新时间:{{item.updateTime}}
@@ -64,12 +65,12 @@
64 65
               </el-row>
65 66
               <el-row v-if="activeName === 'third'" style="color: rgb(91,91,91);line-height: 40px;">
66 67
                 <el-col :span="12">
67
-                  所属部门:{{item.depart}}
68
+                  所属部门:{{item.ownerDepartment}}
68 69
                 </el-col>
69 70
               </el-row>
70 71
               <el-row v-if="activeName === 'third'" style="color: rgb(91,91,91);line-height: 40px;">
71 72
                 <el-col :span="12">
72
-                  指标编码:{{item.indexCode}}
73
+                  指标编码:{{item.code}}
73 74
                 </el-col>
74 75
               </el-row>
75 76
               <!-- 服务块 -->
@@ -78,39 +79,48 @@
78 79
                   <el-checkbox v-if="pageType === 'collect'"  class="checkbox" v-model="item.checked" @click.stop="" @change="(e) => checkboxChange(e, item.id)"></el-checkbox>
79 80
                 </span>
80 81
                 <img src="../../../assets/image/u652.svg" alt="">
81
-                {{ serviceType === 'API' ? '序号:' : 'Topic名称:'}}{{item.logicTbName}}
82
+                <span v-if="serviceType === 'API'">序号:{{item.id}}</span>
83
+                <span v-if="serviceType === 'MQ'">Topic名称:{{item.name}}</span>
82 84
               </p>
83 85
               <el-row v-if="activeName === 'fourth'" style="color: rgb(91,91,91);line-height: 40px;">
84
-                <el-col :span="12">
85
-                  {{ serviceType === 'API' ? 'API名称:' : '集成应用:'}}{{item.tbName}}
86
+                <el-col v-if="serviceType === 'API'" :span="12">
87
+                  API名称:{{item.NAME}}
86 88
                 </el-col>
87
-                <el-col :span="12">
88
-                  {{ serviceType === 'API' ? '更新时间:' : '提供部门:'}}{{item.updateTime}}
89
+                <el-col v-if="serviceType === 'MQ'" :span="12">
90
+                  集成应用:{{item.appName}}
89 91
                 </el-col>
90
-              </el-row>
91
-              <el-row v-if="activeName === 'fourth'" style="color: rgb(91,91,91);line-height: 40px;">
92
-                <el-col :span="12">
93
-                  {{ serviceType === 'API' ? 'API描述:' : 'topic分区数:'}}{{item.apiDesc}}
92
+                <el-col v-if="serviceType === 'API'" :span="12">
93
+                  更新时间:{{item.updateTime}}
94 94
                 </el-col>
95
-                <el-col :span="12">
96
-                  {{ serviceType === 'API' ? '提供部门:' : '使用部门:'}}{{item.depart}}
95
+                <el-col v-if="serviceType === 'MQ'" :span="12">
96
+                  topic分区数:{{item.partitions}}
97 97
                 </el-col>
98 98
               </el-row>
99 99
               <el-row v-if="activeName === 'fourth'" style="color: rgb(91,91,91);line-height: 40px;">
100
-                <el-col :span="12">
101
-                  {{ serviceType === 'API' ? '服务归属系统名称:' : '副本数:'}}{{item.sysName}}
100
+                <el-col v-if="serviceType === 'API'" :span="12">
101
+                  API描述:{{item.remark}}
102 102
                 </el-col>
103
-                <el-col :span="12">
104
-                  {{ serviceType === 'API' ? '使用部门:' : '老化时间(小时):'}}{{item.useDepart}}
103
+                <el-col v-if="serviceType === 'MQ'" :span="12">
104
+                  老化时间(小时):{{item.retentionTime}}
105
+                </el-col>
106
+                <el-col v-if="serviceType === 'API'" :span="12">
107
+                  使用系统:{{item.apiBindedAppNames}}
108
+                </el-col>
109
+                <el-col v-if="serviceType === 'MQ'" :span="12">
110
+                  副本数:{{item.replication}}
105 111
                 </el-col>
106 112
               </el-row>
107
-              <el-row v-if="activeName === 'fourth' && serviceType === 'MQ'" style="color: rgb(91,91,91);line-height: 40px;">
108
-                <el-col :span="12">
109
-                  描述:{{item.desc}}
113
+              <el-row v-if="activeName === 'fourth'" style="color: rgb(91,91,91);line-height: 40px;">
114
+                <el-col v-if="serviceType === 'API'" :span="12">
115
+                  服务归属系统名称:{{item.romaAppName}}
116
+                </el-col>
117
+                <el-col v-if="serviceType === 'MQ'" :span="12">
118
+                  描述:{{item.description}}
110 119
                 </el-col>
111 120
               </el-row>
112 121
             </div>
113 122
             <el-pagination
123
+              v-if="total > 0"
114 124
               style="float: right;margin-bottom: 10px;"
115 125
               @size-change="handleSizeChange"
116 126
               @current-change="handleCurrentChange"
@@ -128,140 +138,51 @@
128 138
 </template>
129 139
 
130 140
 <script>
141
+import api from "@/api/homepage/search.js";
131 142
 export default {
132 143
   data() {
133 144
     return {
134 145
       activeName: 'first',
135
-      searchWords: this.$route.query.searchword || '',
136
-      data: [{
137
-        label: '一级 1',
138
-        children: [{
139
-          label: '二级 1-1',
140
-          children: [{
141
-            label: '三级 1-1-1'
142
-          }]
143
-        }]
144
-      }, {
145
-        label: '一级 2',
146
-        children: [{
147
-          label: '二级 2-1',
148
-          children: [{
149
-            label: '三级 2-1-1'
150
-          }]
151
-        }, {
152
-          label: '二级 2-2',
153
-          children: [{
154
-            label: '三级 2-2-1'
155
-          }]
156
-        }]
157
-      }, {
158
-        label: '一级 3',
159
-        children: [{
160
-          label: '二级 3-1',
161
-          children: [{
162
-            label: '三级 3-1-1'
163
-          }]
164
-        }, {
165
-          label: '二级 3-2',
166
-          children: [{
167
-            label: '三级 3-2-1'
168
-          }]
169
-        }]
170
-      }],
146
+      searchWords: this.$route.query.searchword || undefined,
147
+      data: [],
171 148
       defaultProps: {
172
-        children: 'children',
173
-        label: 'label'
149
+        children: 'childrens',
150
+        label: 'name'
174 151
       },
175
-      list: [
176
-        {
177
-          id: '111',
178
-          logicTbName: '周期性维护计划注销信息',
179
-          tbName: 'periodic_maintenance_plan_cancel',
180
-          updateTime: '2022-07-06 09:23:44',
181
-          topic: '人力资源管理',
182
-          indexCode: 'ZB001080',
183
-          depart: 'sunpu',
184
-          apiDesc: 'degegwgwgwg',
185
-          useDepart: '部门XXX',
186
-          sysName: 'app-tfs',
187
-          desc: '暂无'
188
-        },
189
-        {
190
-          id: '222',
191
-          logicTbName: '周期性维护计划注销信息',
192
-          tbName: 'periodic_maintenance_plan_cancel',
193
-          updateTime: '2022-07-06 09:23:44',
194
-          topic: '人力资源管理',
195
-          indexCode: 'ZB001080',
196
-          depart: 'sunpu',
197
-          apiDesc: 'degegwgwgwg',
198
-          useDepart: '部门XXX',
199
-          sysName: 'app-tfs',
200
-          desc: '暂无'
201
-        },
202
-        {
203
-          id: '333',
204
-          logicTbName: '周期性维护计划注销信息',
205
-          tbName: 'periodic_maintenance_plan_cancel',
206
-          updateTime: '2022-07-06 09:23:44',
207
-          topic: '人力资源管理',
208
-          indexCode: 'ZB001080',
209
-          depart: 'sunpu',
210
-          apiDesc: 'degegwgwgwg',
211
-          useDepart: '部门XXX',
212
-          sysName: 'app-tfs',
213
-          desc: '暂无'
214
-        },
215
-        {
216
-          id: '444',
217
-          logicTbName: '周期性维护计划注销信息',
218
-          tbName: 'periodic_maintenance_plan_cancel',
219
-          updateTime: '2022-07-06 09:23:44',
220
-          topic: '人力资源管理',
221
-          indexCode: 'ZB001080',
222
-          depart: 'sunpu',
223
-          apiDesc: 'degegwgwgwg',
224
-          useDepart: '部门XXX',
225
-          sysName: 'app-tfs',
226
-          desc: '暂无'
227
-        },
228
-        {
229
-          id: '555',
230
-          logicTbName: '周期性维护计划注销信息',
231
-          tbName: 'periodic_maintenance_plan_cancel',
232
-          updateTime: '2022-07-06 09:23:44',
233
-          topic: '人力资源管理',
234
-          indexCode: 'ZB001080',
235
-          depart: 'sunpu',
236
-          apiDesc: 'degegwgwgwg',
237
-          useDepart: '部门XXX',
238
-          sysName: 'app-tfs',
239
-          desc: '暂无'
240
-        },
241
-      ],
152
+      list: [],
242 153
       currentPage: 1,
243 154
       pageSize: 5,
244
-      total: 1000,
155
+      total: 0,
245 156
       serviceType: 'API', // API-API服务,MQ-消息队列
246 157
       pageType: this.$route.query.pageType || 'all', // all-全量搜索,theme-只有主题库搜索,topic-只有专题库搜索,index-只有指标搜索,service-只有服务搜索,collect-我的收藏全量搜索
158
+      menuId: undefined
247 159
     };
248 160
   },
249 161
   created() {},
250 162
   mounted() {
251 163
     document.documentElement.scrollTop = 0;
164
+    this.getMenu()
165
+    this.getSearchData()
252 166
   },
253 167
   methods: {
254 168
     handleClick(tab, event) {
255 169
       this.activeName = tab.name;
170
+      this.menuId = undefined
171
+      this.currentPage = 1
172
+      this.getMenu()
173
+      this.getSearchData()
256 174
     },
257 175
     handleNodeClick(data) {
258 176
       console.log(data);
177
+      this.menuId = data.id
178
+      this.getSearchData()
259 179
     },
260 180
     handleSizeChange(val) {
261 181
       console.log(`每页 ${val} 条`);
262 182
     },
263 183
     handleCurrentChange(val) {
264 184
       console.log(`当前页: ${val}`);
185
+      this.getSearchData()
265 186
     },
266 187
     jumpToDetailPage(id) {
267 188
       let type = 'theme'
@@ -284,7 +205,7 @@ export default {
284 205
       });
285 206
     },
286 207
     handleSearch() {
287
-      
208
+      this.getSearchData()
288 209
     },
289 210
     getCardClass() {
290 211
       let ret = 'entity-card'
@@ -311,23 +232,10 @@ export default {
311 232
     },
312 233
     initTabList() {
313 234
       let tabList = [
314
-        {
315
-          name: '主题库',
316
-          id: 'first',
317
-          num: 0
318
-        },
319
-        {
320
-          name: '专题库',
321
-          id: 'second',
322
-          num: 0},
323
-        {
324
-          name: '指标',
325
-          id: 'third',
326
-          num: 0},
327
-        {
328
-          name: '服务',
329
-          id: 'fourth',
330
-          num: 0}
235
+        {name: '主题库',id: 'first',num: 0},
236
+        {name: '专题库',id: 'second',num: 0},
237
+        {name: '指标',id: 'third',num: 0},
238
+        {name: '服务',id: 'fourth',num: 0}
331 239
       ]
332 240
       if (this.$route.query.pageType === 'theme') {
333 241
         tabList = [{ name: '主题库', id: 'first', num: 0 }]
@@ -346,6 +254,52 @@ export default {
346 254
         this.activeName = 'fourth'
347 255
       }
348 256
       return tabList
257
+    },
258
+    getMenu() {
259
+      const params = {resourceType: 'theme'}
260
+      if (this.$route.query.pageType === 'topic' || this.activeName === 'second') {
261
+        params.resourceType = 'specialSubject'
262
+      }
263
+      if (this.$route.query.pageType === 'index' || this.activeName === 'third') {
264
+        params.resourceType = 'index'
265
+      }
266
+      if (this.$route.query.pageType === 'service' || this.activeName === 'fourth') {
267
+        params.resourceType = 'service'
268
+      }
269
+      api.menuInfo(params).then(res => {
270
+        if (res.success) {
271
+          this.data = res.data
272
+        }
273
+      })
274
+    },
275
+    serviceBtnClick(key) {
276
+      this.serviceType = key
277
+      this.menuId = undefined
278
+      this.currentPage = 1
279
+      this.getMenu()
280
+      this.getSearchData()
281
+    },
282
+    getSearchData() {
283
+      const params = {
284
+        resourceType: 'theme', pageNum: this.currentPage, 
285
+        pageSize: this.pageSize, menuId: this.menuId,
286
+        keyword: this.searchWords
287
+      }
288
+      if (this.$route.query.pageType === 'topic' || this.activeName === 'second') {
289
+        params.resourceType = 'specialSubject'
290
+      }
291
+      if (this.$route.query.pageType === 'index' || this.activeName === 'third') {
292
+        params.resourceType = 'index'
293
+      }
294
+      if (this.$route.query.pageType === 'service' || this.activeName === 'fourth') {
295
+        params.resourceType = this.serviceType === 'API' ? 'api' : 'mqs'
296
+      }
297
+      api.searchData(params).then(res => {
298
+        if(res.success) {
299
+          this.total = res.data.total
300
+          this.list = res.data.records
301
+        }
302
+      })
349 303
     }
350 304
   }
351 305
 };
@@ -385,6 +339,11 @@ export default {
385 339
     }
386 340
     .list-wrap {
387 341
       width: 75%;
342
+      .empty-block{
343
+        height: 300px;
344
+        text-align: center;
345
+        line-height: 200px;
346
+      }
388 347
       .entity-card {
389 348
         cursor: pointer;
390 349
         width: 100%;
@@ -418,6 +377,12 @@ export default {
418 377
       .checkbox{
419 378
         z-index: 10;
420 379
       }
380
+      .text-overflow{
381
+        white-space: nowrap;
382
+        overflow: hidden;
383
+        text-overflow: ellipsis;
384
+        padding-right: 10px;
385
+      }
421 386
     }
422 387
   }
423 388
   .clearfix{