dingxin 6 vuotta sitten
vanhempi
commit
97c381ff0c

+ 24
- 4
VUECODE/smart-property-manage/src/views/social/announcement/index.vue Näytä tiedosto

@@ -37,10 +37,7 @@
37 37
       <el-table-column prop="sort" label="权重" align="center"/>
38 38
       <el-table-column prop="status" label="状态" align="center">
39 39
         <template slot-scope="scope">
40
-          <span v-if="scope.row.status==0">{{ '已作废' }}</span>
41
-          <span v-if="scope.row.status==1">{{ '已发布' }}</span>
42
-          <span v-if="scope.row.status==2">{{ '草稿' }}</span>
43
-          <span v-if="scope.row.createDate < scope.row.updateDate">{{ '已修改' }}</span>
40
+          <span>{{ getStatus(scope.row) }}</span>
44 41
         </template>
45 42
       </el-table-column>
46 43
       <el-table-column prop="createDate" label="发布时间" align="center"><template slot-scope="scope">{{ formatDate(scope.row.createDate) }}</template></el-table-column>
@@ -112,6 +109,29 @@ export default {
112 109
       value = value < 10 ? '0' + value : value
113 110
       return value
114 111
     },
112
+    getStatus(row) { // 获取状态
113
+      let statusName = ''
114
+
115
+      // 判断状态
116
+      switch (row.status) {
117
+        case '0':
118
+          statusName = '已作废'
119
+          break
120
+        case '1':
121
+          statusName = '已发布'
122
+          break
123
+        case '2':
124
+          statusName = '草稿'
125
+          break
126
+      }
127
+
128
+      // 如果修改时间和创建时间不一致, 就显示已修改
129
+      if (row.status === '1' && (row.updateDate > row.createDate)) {
130
+        statusName = '已修改'
131
+      }
132
+
133
+      return statusName
134
+    },
115 135
     dataQuery() { // 查询数据
116 136
       this.listLoading = true
117 137
       this.$store.dispatch('ListAnnouncement', this.listQuery).then((res) => {