yueyazhui 4 months ago
parent
commit
b08fc3e8fd

+ 2 - 1
package.json

@@ -75,6 +75,7 @@
     "sortablejs": "1.8.4",
     "spark-md5": "^3.0.2",
     "throttle-debounce": "^2.1.0",
+    "uuid": "^10.0.0",
     "vcrontab": "^0.3.5",
     "vue": "2.6.10",
     "vue-count-to": "1.0.13",
@@ -130,4 +131,4 @@
     "> 1%",
     "last 2 versions"
   ]
-}
+}

+ 7 - 1
src/utils/jnpf.js

@@ -5,6 +5,7 @@ import define from '@/utils/define'
 import request from '@/utils/request'
 import { Message } from 'element-ui'
 import CryptoJS from 'crypto-js'
+import { v4 as uuidv4 } from 'uuid'
 const STORAGEPREFIX = 'jnpf_'
 const STORAGETYPE = window.localStorage
 
@@ -464,6 +465,11 @@ const jnpf = {
     return appId;
   },
   onlineUtils: {
+    // UUID
+    uuid() {
+      const uuid = uuidv4();
+      return uuid;
+    },
     // 获取用户信息
     getUserInfo() {
       const userInfo = store.getters.userInfo;
@@ -510,4 +516,4 @@ const jnpf = {
     }
   }
 }
-export default jnpf
+export default jnpf

+ 14 - 4
src/views/governmentCloud/knowledgeBase/Detail.vue

@@ -3,9 +3,14 @@
     size="100%" :before-close="handleDrawerClose" class="JNPF-common-drawer" append-to-body>
     <div class="JNPF-flex-main">
       <div class="box">
-        <div class="title"><h1>{{ dataForm.title }}</h1></div>
+        <div class="title">
+          <h1>{{ dataForm.title }}</h1>
+        </div>
         <div class="publishTime">发布时间:{{ dataForm.publishTime }}</div>
-        <div class="label">{{ dataForm.label }}</div>
+        <div class="label">
+          <el-tag style="margin-right: 10px;" v-for="item in dataForm.labelList"
+            :key="item">{{ item }}</el-tag>
+        </div>
         <div class="content">
           <div v-html="dataForm.content"></div>
         </div>
@@ -21,9 +26,12 @@
 .content {
   width: 100%;
   margin-top: 20px;
-  height: 80vh;
+  height: 70vh;
   overflow-y: auto;
 }
+.label {
+  margin-top: 20px;
+}
 </style>
 
 <script>
@@ -40,7 +48,8 @@ export default {
         label: "",
         content: "",
         publishTime: null,
-        relatedKnowledgeList: []
+        relatedKnowledgeList: [],
+        labelList: []
       },
     };
   },
@@ -50,6 +59,7 @@ export default {
       this.loading = true
       getKnowledgeInfo(id).then(res => {
         this.dataForm = res.data
+        this.dataForm.labelList = JSON.parse(this.dataForm.label) || []
         this.loading = false
       }).catch(() => {
         this.loading = false

+ 9 - 0
src/views/governmentCloud/knowledgeBase/index.vue

@@ -50,6 +50,12 @@
       <div class="JNPF-common-layout-main JNPF-flex-main">
         <JNPF-table v-loading="listLoading" :data="tableData" row-key="id" v-if="refreshTable">
           <el-table-column prop="title" label="标题" />
+          <el-table-column prop="publishTime" label="发布时间" />
+          <el-table-column label="标签">
+            <template slot-scope="scope">
+              <el-tag v-for="item in scope.row.labelList" :key="item">{{ item }}</el-tag>
+            </template>
+          </el-table-column>
           <el-table-column label="操作" width="100">
             <template slot-scope="scope">
               <el-button type="text" @click="handleDetail(scope.row.id)">详情</el-button>
@@ -161,6 +167,9 @@ export default {
       this.listLoading = true
       getKnowledgeList(this.listQuery).then(res => {
         this.tableData = res.data.records
+        this.tableData.forEach(item => {
+          this.$set(item, "labelList", JSON.parse(item.label))
+        })
         this.total = res.data.total
         this.listLoading = false
       }).catch(() => {