zhengnaiwen_citu 5 месяцев назад
Родитель
Сommit
9b31fc69df
1 измененных файлов с 17 добавлено и 58 удалено
  1. 17 58
      src/views/dataChart/shareChart/index.vue

+ 17 - 58
src/views/dataChart/shareChart/index.vue

@@ -1,22 +1,19 @@
 <template>
   <div class="pa-3 white">
-    <m-search class="mb-3" :items="searchItems" v-model="searchValue" @search="onSearch"></m-search>
-    <m-table
-      v-loading="loading"
-      :items="items"
-      :headers="headers"
-      :page-size="pageInfo.size"
-      :page-current="pageInfo.current"
-      :total="total"
-      @page-change="onPageChange"
-    >
-      <template #permission="{ row }">
-        <el-tag :type="row.permission === 1 ? 'success' : 'warning'">{{ row.permission === 1 ? '已发布' : '未发布' }}</el-tag>
-      </template>
-      <template #actions="{ row }">
-        <m-button type="primary" text @click="onDetails(row)">查看</m-button>
-      </template>
-    </m-table>
+    <el-empty v-if="items.length === 0"></el-empty>
+    <m-card
+      v-for="item in items"
+      :key="item.id"
+      class="mb-3"
+      :title="item.name"
+      :description="item.description"
+      :author="item.author"
+      :createDate="item.createDate"
+      :permission="item.permission"
+      :url="item.url"
+      :id="item.id"
+      @details="onDetails(item)"
+    ></m-card>
   </div>
 </template>
 
@@ -28,37 +25,13 @@ export default {
   name: 'ShareChart',
   data () {
     return {
-      searchValue: {},
-      searchItems: [
-        {
-          label: '名称',
-          prop: 'name',
-          type: 'input',
-          options: {
-            placeholder: '请输入名称'
-          }
-        }
-      ],
-      searchValues: {
-        name: null
-      },
-      headers: [
-        { label: '名称', prop: 'name' },
-        { label: '制作者', prop: 'author' },
-        { label: '状态', prop: 'permission', align: 'center' },
-        { label: '描述', prop: 'description' },
-        { label: '制作时间', prop: 'createDate' },
-        { label: '操作', prop: 'actions' }
-      ],
       items: [],
-      total: 0,
-      pageInfo: {
-        current: 1,
-        size: 10
-      },
       loading: false
     }
   },
+  created () {
+    this.onInit()
+  },
   methods: {
     async onInit () {
       this.loading = true
@@ -87,21 +60,7 @@ export default {
       } finally {
         this.loading = false
       }
-    },
-    onDetails (item) {
-      this.refs.templateRefs.open(item)
-    },
-    onSearch () {
-      this.pageInfo.current = 1
-      this.onInit()
-    },
-    onPageChange (index) {
-      this.pageInfo.current = index
-      this.onInit()
     }
-  },
-  created () {
-    this.onInit()
   }
 }
 </script>