Procházet zdrojové kódy

前台搜索页增加点击量记录、隐藏申请页面、根据文件状态来判断是否可以看详情

chaihaorui před 1 rokem
rodič
revize
2d1779d55a

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

@@ -32,5 +32,9 @@ export default {
32 32
   // 消息队列权限列表
33 33
   getMqsPrivs(params) {
34 34
     return axios.get('/resourceDirectory/getMqsPrivs', { params });
35
+  },
36
+  // 增加点击量
37
+  addResourceViews(params) {
38
+    return axios.get('/resourceApply/addResourceViews', { params });
35 39
   }
36 40
 }

+ 1 - 1
src/pages/homepage/components/cardWrap.vue

@@ -43,7 +43,7 @@
43 43
           </el-button>
44 44
         </el-input>
45 45
         <el-button class="btn-space" @click="jumpToFilePage">文件</el-button>
46
-        <el-button class="btn-space" @click="jumpToApplyPage">申请</el-button>
46
+        <!-- <el-button class="btn-space" @click="jumpToApplyPage">申请</el-button> -->
47 47
       </div>
48 48
     </div>
49 49
     <div style="background: #f1f2f5; height: 10px; width: 100%;"></div>

+ 50 - 13
src/pages/homepage/components/searchPage.vue

@@ -22,7 +22,7 @@
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 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
+            <div v-else :class="getCardClass()" v-for="(item, idx) in list" :key="idx" @click="jumpToDetailPage(item)">
26 26
               <!-- 主题库和专题库块 -->
27 27
               <div v-if="activeName === 'first' || activeName === 'second'" class="title title-block clearfix">
28 28
                 <p class="left">
@@ -48,6 +48,12 @@
48 48
                 <el-col :span="12">
49 49
                   所属主题:{{item.l1}}
50 50
                 </el-col>
51
+                <el-col :span="12" v-if="pageType !== 'collect'">
52
+                  <el-button v-if="!item.applyType" type="text" @click="() => handleApply(item)">申请</el-button>
53
+                  <span v-if="item.applyType === '1'">状态:待审批</span>
54
+                  <span v-if="item.applyType === '2'">状态:审批通过</span>
55
+                  <el-button v-if="item.applyType === '3'" type="text" @click="() => handleApply(item)">审批驳回</el-button>
56
+                </el-col>
51 57
               </el-row>
52 58
               <!-- 指标编码块 -->
53 59
               <div v-if="activeName === 'third'" class="title title-block clearfix">
@@ -76,6 +82,12 @@
76 82
                 <el-col :span="12">
77 83
                   所属部门:{{item.ownerDepartment}}
78 84
                 </el-col>
85
+                <el-col :span="12" v-if="pageType !== 'collect'">
86
+                  <el-button v-if="!item.applyType" type="text" @click="() => handleApply(item)">申请</el-button>
87
+                  <span v-if="item.applyType === '1'">状态:待审批</span>
88
+                  <span v-if="item.applyType === '2'">状态:审批通过</span>
89
+                  <el-button v-if="item.applyType === '3'" type="text" @click="() => handleApply(item)">审批驳回</el-button>
90
+                </el-col>
79 91
               </el-row>
80 92
               <el-row v-if="activeName === 'third'" style="color: rgb(91,91,91);line-height: 40px;">
81 93
                 <el-col :span="12">
@@ -133,6 +145,12 @@
133 145
                 <el-col v-if="serviceType === 'MQ'" :span="12">
134 146
                   描述:{{item.description}}
135 147
                 </el-col>
148
+                <el-col :span="12" v-if="pageType !== 'collect'">
149
+                  <el-button v-if="!item.applyType" type="text" @click="() => handleApply(item)">申请</el-button>
150
+                  <span v-if="item.applyType === '1'">状态:待审批</span>
151
+                  <span v-if="item.applyType === '2'">状态:审批通过</span>
152
+                  <el-button v-if="item.applyType === '3'" type="text" @click="() => handleApply(item)">审批驳回</el-button>
153
+                </el-col>
136 154
               </el-row>
137 155
             </div>
138 156
             <el-pagination
@@ -155,6 +173,9 @@
155 173
 
156 174
 <script>
157 175
 import api from "@/api/homepage/search.js";
176
+import detailApi from "@/api/homepage/entityDetail.js";
177
+import applyApi from "@/api/homepage/apply.js";
178
+
158 179
 const resourceTypeMap = {
159 180
   first: 'theme',
160 181
   second: 'specialSubject',
@@ -210,19 +231,35 @@ export default {
210 231
       console.log(`当前页: ${val}`);
211 232
       this.getSearchData()
212 233
     },
213
-    jumpToDetailPage(id) {
214
-      const resourceTypeMapA = {
215
-        first: 'theme',
216
-        second: 'special',
217
-        third: 'target',
218
-        fourth: this.serviceType === 'API' ? 'api' : 'message'
234
+    jumpToDetailPage(item) {
235
+      const {id, applyType} = item
236
+      if (applyType === '2') { // 2 代表审批通过
237
+        detailApi.addResourceViews({resourceType: resourceTypeMap[this.activeName]}).then(res=> {})
238
+        const resourceTypeMapA = {
239
+          first: 'theme',
240
+          second: 'special',
241
+          third: 'target',
242
+          fourth: this.serviceType === 'API' ? 'api' : 'message'
243
+        }
244
+        let type = resourceTypeMapA[this.activeName]
245
+        this.$router.push({
246
+          name: "entityDetail",
247
+          path: "/entityDetail",
248
+          query: {id: id, type}
249
+        });
219 250
       }
220
-      let type = resourceTypeMapA[this.activeName]
221
-      this.$router.push({
222
-        name: "entityDetail",
223
-        path: "/entityDetail",
224
-        query: {id: id, type}
225
-      });
251
+    },
252
+    handleApply(row) {
253
+      const {id, name} = row
254
+      applyApi.applyResource({resourceId: id, resourceName: name, resourceType: resourceTypeMap[this.activeName]}).then(res => {
255
+        if (res.success) {
256
+          this.$message({
257
+            message: '申请成功!',
258
+            type: 'success'
259
+          })
260
+          this.getSearchData()
261
+        }
262
+      })
226 263
     },
227 264
     handleSearch() {
228 265
       this.initData()