Selaa lähdekoodia

'添加项目去重'

zhangyu 4 vuotta sitten
vanhempi
commit
a8543f2fe7

+ 9 - 2
src/framework/layout/PageHeader.vue

@@ -61,16 +61,23 @@ export default {
                 label: '最近使用',
                 options: []
             }]
-            const projectHistory = cacheInfo[this.userInfo.userName] || []
+            const projectHistory = cacheInfo[this.userInfo.userName] || [];
+            let copyProjects = JSON.parse(JSON.stringify(this.projects));
             options[0].options = projectHistory.map(projectId => {
                 let obj = this.projects.find(project => {
                     return project.id === projectId
+                });
+                let index = copyProjects.findIndex(project => {
+                    return project.id === projectId
                 })
+                if (index != -1) {
+                    copyProjects.splice(index, 1);
+                }
                 return obj?obj:[]
             })
 
             let helpObj = {}
-            this.projects.forEach(p => {
+            copyProjects.forEach(p => {
                 const label = getFirstLetter((p.name || p.id).slice(0, 1))
                 if (helpObj[label]) {
                     helpObj[label].push(p)

+ 3 - 3
src/views/data_admin/buildAssets/report.vue

@@ -1,13 +1,13 @@
 <template>
   <div class="saga-report">
     <section class="saga-report-section">
-      <el-row :gutter="20"  v-for="(item,index) in errorReport" style="margin-bottom: 10px">
+      <el-row :gutter="20"  v-for="(item,index) in errorReport" :key="item.Id" style="margin-bottom: 10px">
           <el-col :span="12">
             <h3>{{index +1}}.{{item.Name}}</h3>
             <div class="problem-description">{{item.Note}}</div>
             <h5>问题创建人:{{item.Author}}</h5>
           </el-col>
-          <el-col :span="12" v-if="item.Pic" v-for="pic in item.Pic">
+          <el-col :span="12" v-show="item.Pic" v-for="pic in item.Pic" :key="pic.Key">
             <h4 style="font-size: 14px">现场照片</h4>
             <el-image
               :src="`/image-service/common/image_get?systemId=dataPlatform&key=${pic.Key}`"
@@ -34,7 +34,7 @@
 
     },
     created() {
-      console.log(this.errorReport)
+      console.log("lisa gagagg",this.errorReport)
     }
 
   }