Bladeren bron

优化及bug修复

zhuhao 1 jaar geleden
bovenliggende
commit
565ea01617

+ 3 - 21
src/views/event/components/view/table.vue

@@ -13,11 +13,9 @@
         sortable="custom">
         <template slot-scope="scope">
           <div v-if="['name', 'reportProjectNum', 'patentProjectNum'].includes(item.value)">
-            <el-link @click="handleItem(scope.row, item.value)">{{ scope.row[item.value] }}</el-link>
+            <el-link @click="handleItem(scope.row, item.value)" v-html="$commonJS.getColumnData(scope.row, item)"></el-link>
           </div>
-          <div v-else-if="['scenarioId', 'eventDate'].includes(item.value)" v-html="getColumnData(scope.row, item.value)">
-          </div>
-          <div v-else>{{ scope.row[item.value] ? scope.row[item.value] : '--' }}</div>
+          <div v-else v-html="$commonJS.getColumnData(scope.row, item)"></div>
         </template>
       </el-table-column>
 
@@ -255,28 +253,12 @@ export default {
         order,
       }
       this.sort = this.$commonJS.getSortData(params)
-      
+
       this.params.current = 0
       this.disabled = false
       this.tableData.splice(0)
       this.getList()
     },
-    // 数据处理
-    getColumnData(row, key) {
-      if (key == 'scenarioId') {
-        if (row.scenarioName) {
-          return row.scenarioName
-        } else {
-          return '--'
-        }
-      }else if (key == 'eventDate') {
-        if (row.eventDate) {
-          return row.eventDate.slice(0, 10)
-        } else {
-          return '--'
-        }
-      }
-    },
 
   },
 };

+ 2 - 18
src/views/patentMining/components/view/commonTable.vue

@@ -14,13 +14,9 @@
         :label="item.name" align="center" sortable="custom">
         <template slot-scope="scope">
           <div v-if="['name'].includes(item.value)">
-            <el-link @click="handleItem(scope.row, item.value)">{{ scope.row[item.value] }}</el-link>
+            <el-link @click="handleItem(scope.row, item.value)" v-html="$commonJS.getColumnData(scope.row, item)"></el-link>
           </div>
-          <!-- <div v-else-if="['state'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row, item)">
-          </div> -->
-          <div v-else-if="['ifSearch','state'].includes(item.value)" v-html="getColumn(scope.row, item.value)">
-          </div>
-          <div v-else>{{ scope.row[item.value] ? scope.row[item.value] : '--' }}</div>
+          <div v-else v-html="$commonJS.getColumnData(scope.row, item)"></div>
         </template>
       </el-table-column>
 
@@ -212,18 +208,6 @@ export default {
       this.tableData.splice(0)
       this.getList()
     },
-    // 数据处理
-    getColumn(row, key) {
-      if (key == 'ifSearch') {
-        if (row[key] == true) {
-          return '是'
-        } else {
-          return '否'
-        }
-      }else if (key == 'state') {
-        return this.statusObj[row[key]]
-      }
-    },
   },
 };
 </script>

+ 1 - 1
src/views/product/components/view/categoryTable.vue

@@ -13,7 +13,7 @@
       <el-table-column v-for="item in column" :render-header=" $commonJS.renderHeaderMethods" :key="item.value" :prop="item.value" :label="item.name" align="center" sortable="custom">
         <template slot-scope="scope">
           <div v-if="['name'].includes(item.value)">
-            <el-link @click="handleItem(scope.row, item.value)" :type="isChoose?'primary':'default'">{{ scope.row[item.value] }}</el-link>
+            <el-link @click="handleItem(scope.row, item.value)" :type="isChoose?'primary':'default'" v-html="$commonJS.getColumnData(scope.row, item)"></el-link>
           </div>
           <div v-else v-html="$commonJS.getColumnData(scope.row, item)">
           </div>

+ 1 - 1
src/views/product/components/view/productTable.vue

@@ -17,7 +17,7 @@
       <el-table-column v-for="item in column" :render-header=" $commonJS.renderHeaderMethods" :key="item.value" :prop="item.value" :label="item.name" align="center" sortable="custom">
         <template slot-scope="scope">
           <div v-if="['name'].includes(item.value)">
-            <el-link @click="handleItem(scope.row, item.value)" :type="isChoose?'primary':'default'">{{ scope.row[item.value] }}</el-link>
+            <el-link @click="handleItem(scope.row, item.value)" :type="isChoose?'primary':'default'" v-html="$commonJS.getColumnData(scope.row, item)"></el-link>
           </div>
           <div v-else v-html="$commonJS.getColumnData(scope.row, item)">
           </div>

+ 1 - 1
src/views/project/components/view/table.vue

@@ -12,7 +12,7 @@
         <el-table-column v-for="item in column.filter(item=>!item.ifHidden)" :render-header=" $commonJS.renderHeaderMethods" :key="item.value" :prop="item.value" :label="item.name" sortable="custom" align="center">
           <template slot-scope="scope">
             <div v-if="['name','reportProjectNum'].includes(item.value)">
-              <el-link @click="handleClick(scope.row, item.value)">{{ scope.row[item.value] }}</el-link>
+              <el-link @click="handleClick(scope.row, item.value)" v-html="$commonJS.getColumnData(scope.row, item)"></el-link>
             </div>
             <div v-else v-html="$commonJS.getColumnData(scope.row, item)"></div>
           </template>

+ 4 - 15
src/views/report/components/view/table.vue

@@ -14,11 +14,10 @@
         <el-table-column v-for="item in column" :key="item.value" :prop="item.value" :render-header=" $commonJS.renderHeaderMethods" :label="item.name" sortable="custom" align="center">
           <template slot-scope="scope">
             <div v-if="['name'].includes(item.value)">
-              <el-link @click="handleItem(scope.row,item.value)">{{ scope.row[item.value] }}</el-link>
+              <el-link @click="handleItem(scope.row,item.value)" v-html="$commonJS.getColumnData(scope.row,item)"></el-link>
             </div>
-            <div v-else-if="['eventName','cronNames'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row,item)"></div>
-            <div v-else-if="['status'].includes(item.value)" v-html="getColumn(scope.row,item.value)"></div>
-            <div v-else>{{ scope.row[item.value] }}</div>
+            <div v-else-if="['eventNames','cronNames'].includes(item.value)" v-html="$commonJS.getColumnData(scope.row,item)"></div>
+            <div v-else v-html="$commonJS.getColumnData(scope.row,item)"></div>
           </template>
         </el-table-column>
 
@@ -136,7 +135,7 @@ export default {
   },
   methods: {
      //更新数据
-     updateData(){
+    updateData() {
       if(this.action.type == 1){
         if(this.tableData.length == 1){
           return false
@@ -242,16 +241,6 @@ export default {
       this.tableData.splice(0)
       this.getList()
     },
-    // 数据处理
-    getColumn(row, key) {
-      if (key == 'status') {
-        if (row[key]) {
-          return statusName[row[key]]
-        } else {
-          return '--'
-        }
-      }
-    },
   },
 };
 </script>