Browse Source

统一表格样式

gzb
wangzhonglu 10 months ago
parent
commit
2e944e602a
2 changed files with 114 additions and 10 deletions
  1. 27
    0
      src/assets/less/common.less
  2. 87
    10
      src/views/platformSection/regionManage/regionManage.vue

+ 27
- 0
src/assets/less/common.less View File

@@ -56,6 +56,7 @@ body,
56 56
 }
57 57
 // iview表格全局自定义样式
58 58
 .ivu-table {
59
+  color: #798CB5;
59 60
   background-color: #ffffff66;
60 61
   .ivu-table-header,
61 62
   .ivu-table-fixed-header {
@@ -63,6 +64,7 @@ body,
63 64
       background-color: #e9f0ff;
64 65
       th {
65 66
         padding: 12px 0;
67
+        color: #253A70;
66 68
         line-height: 1;
67 69
         background-color: #e9f0ff;
68 70
       }
@@ -72,10 +74,17 @@ body,
72 74
   .ivu-table-fixed-right .ivu-table-tbody tr,
73 75
   .ivu-table-body .ivu-table-tbody tr {
74 76
     &.ivu-table-row-hover {
77
+      color: #253A70;
75 78
       background-color: #ffffff;
76 79
       box-shadow: 6px 1px 9px 0 #0879cd24;
77 80
       td {
78 81
         background-color: #ffffff;
82
+        .action_list {
83
+          color: #339DFF;
84
+          .action_del {
85
+            color: #F0153F;
86
+          }
87
+        }
79 88
       }
80 89
     }
81 90
     td {
@@ -346,4 +355,22 @@ fieldset[disabled] .ivu-input,
346 355
   border-radius: 15px;
347 356
   border: 1px solid #e9f0f9;
348 357
   background-color: #fff;
358
+}
359
+.table_wrap {
360
+  margin: 0 16px;
361
+  border: 1px solid #e8eaec;
362
+  border-bottom: none;
363
+  .action_list {
364
+    display: flex;
365
+    justify-content: center;
366
+    align-items: center;
367
+    > div {
368
+      margin: 0 4px;
369
+      padding: 0 4px;
370
+    }
371
+  }
372
+}
373
+.page_wrap {
374
+  padding: 16px;
375
+  text-align: right;
349 376
 }

+ 87
- 10
src/views/platformSection/regionManage/regionManage.vue View File

@@ -4,16 +4,43 @@
4 4
       <Input
5 5
         v-model="searchForm.name"
6 6
         placeholder="请输入区域名称"
7
+        search
8
+        @on-search="searchList()"
7 9
         style="width: 150px"
8 10
       />
9 11
       <Button type="primary" class="primary_btn">新建</Button>
10 12
     </div>
11
-    <Table :columns="columns" :data="searchForm.list">
12
-      <template slot-scope="{ row }" slot="updatetimeSlot">
13
-        <div>{{ date_format(row.updatetime) }}</div>
14
-      </template>
15
-    </Table>
16
-    <Page :total="100" show-sizer />
13
+    <div class="table_wrap">
14
+      <Table :columns="columns" :data="searchForm.list">
15
+        <template slot-scope="{ row }" slot="createtimeSlot">
16
+          <div>{{ date_format(row.createtime) }}</div>
17
+        </template>
18
+        <template slot-scope="{ row }" slot="updatetimeSlot">
19
+          <div>{{ date_format(row.updatetime) }}</div>
20
+        </template>
21
+        <template slot-scope="{ row }" slot="actionSlot">
22
+          <div class="action_list">
23
+            <div @click="toEnter(row)">进入</div>
24
+            <div @click="toView(row)">查看</div>
25
+            <div @click="toEdit(row)">编辑</div>
26
+            <div class="action_del" @click="toDel(row)">删除</div>
27
+          </div>
28
+        </template>
29
+      </Table>
30
+    </div>
31
+    <div class="page_wrap">
32
+      <Page
33
+        :transfer="true"
34
+        :total="searchForm.total"
35
+        :current="searchForm.page"
36
+        :page-size="searchForm.size"
37
+        :page-size-opts="[10, 20, 40, 60]"
38
+        @on-change="pageChange"
39
+        @on-page-size-change="pageSizeChange"
40
+        show-total
41
+        show-sizer
42
+      ></Page>
43
+    </div>
17 44
   </div>
18 45
 </template>
19 46
 
@@ -46,7 +73,7 @@ export default {
46 73
         },
47 74
         {
48 75
           title: "区域名称",
49
-          key: "dbname",
76
+          key: "areaname",
50 77
           align: "center"
51 78
         },
52 79
         {
@@ -75,14 +102,64 @@ export default {
75 102
         },
76 103
         {
77 104
           title: "操作",
78
-          slot: "action",
79
-          width: 80,
105
+          slot: "actionSlot",
106
+          width: 220,
80 107
           align: "center"
81 108
         }
82 109
       ]
83 110
     };
84 111
   },
85
-  methods: {}
112
+  created() {
113
+    this.searchList();
114
+  },
115
+  methods: {
116
+    searchList() {
117
+      this.searchForm.page = 1;
118
+      this.getList();
119
+    },
120
+    pageChange(page) {
121
+      this.searchForm.page = page;
122
+      this.getList();
123
+    },
124
+    pageSizeChange(size) {
125
+      this.searchForm.size = size;
126
+      this.searchForm.page = 1;
127
+      this.getList();
128
+    },
129
+    getList() {
130
+      this.searchForm.list = [
131
+        {
132
+          id: 1,
133
+          areaname: "区域一",
134
+          createname: "区域一",
135
+          createtime: 1710838418,
136
+          updatename: "区域一",
137
+          updatetime: 1710838430
138
+        },
139
+        {
140
+          id: 2,
141
+          areaname: "区域二",
142
+          createname: "区域一",
143
+          createtime: 1710838418,
144
+          updatename: "区域一",
145
+          updatetime: 1710838430
146
+        },
147
+        {
148
+          id: 3,
149
+          areaname: "区域三",
150
+          createname: "区域一",
151
+          createtime: 1710838418,
152
+          updatename: "区域一",
153
+          updatetime: 1710838430
154
+        }
155
+      ];
156
+      this.searchForm.total = 3;
157
+    },
158
+    toEnter() {},
159
+    toView() {},
160
+    toEdit() {},
161
+    toDel() {}
162
+  }
86 163
 };
87 164
 </script>
88 165
 

Loading…
Cancel
Save