魏熙美 преди 6 години
родител
ревизия
4fc407ae2a
променени са 3 файла, в които са добавени 149 реда и са изтрити 0 реда
  1. 20
    0
      src/views/index.js
  2. 98
    0
      src/views/news/index.vue
  3. 31
    0
      src/views/news/type/index.vue

+ 20
- 0
src/views/index.js Целия файл

@@ -134,6 +134,26 @@ const pages = [
134 134
       }
135 135
     ]
136 136
   },
137
+  {
138
+    path: '/news',
139
+    name: 'news',
140
+    component: () => import('./index.vue'),
141
+    meta: {
142
+      menuShow: true,
143
+      title: '咨迅管理',
144
+    },
145
+    children: [
146
+      {
147
+        path: '/news/type/list',
148
+        name: 'news-type-list',
149
+        component: () => import('./news/index.vue'),
150
+        meta: {
151
+          menuShow: true,
152
+          title: '咨迅类型',
153
+        },
154
+      }
155
+    ]
156
+  },
137 157
 ]
138 158
 
139 159
 const flatten = (rts, parents = []) => {

+ 98
- 0
src/views/news/index.vue Целия файл

@@ -0,0 +1,98 @@
1
+<template>
2
+    <div id="root">
3
+        <div class="operation-class">
4
+           <el-button type="primary">新增</el-button>
5
+            &nbsp;
6
+            <el-select v-model="form.buildingId" placeholder="项目">
7
+                <el-option
8
+                        v-for="item in buildingList"
9
+                        :key="item.buildingId"
10
+                        :label="item.buildingName"
11
+                        :value="item.buildingId">
12
+                </el-option>
13
+            </el-select>
14
+        </div>
15
+        <div class="body">
16
+            <el-table
17
+                    :data="[]"
18
+                    height="250"
19
+                    border
20
+                    style="width: 100%">
21
+                <el-table-column
22
+                        prop="date"
23
+                        label="类型图"
24
+                        align="center">
25
+                    <template slot-scope="scope">
26
+                        <img :src="scope.row.news_type_img" width="50" height="50"/>
27
+                    </template>
28
+                </el-table-column>
29
+                <el-table-column
30
+                        prop="newsTypeName"
31
+                        label="名称"
32
+                        align="center">
33
+                </el-table-column>
34
+                <el-table-column
35
+                        prop="newsTypeId"
36
+                        align="center"
37
+                        label="操作">
38
+                    <template slot-scope="scope">
39
+                        <router-link :to="{ name:'newsTypeEdi', query: { id: scope.row.newsTypeId } }">编辑</router-link>
40
+                        <span @click="deleteNews(scope.row.newsTypeId)">删除</span>
41
+                    </template>
42
+                </el-table-column>
43
+            </el-table>
44
+        </div>
45
+        <div class="block">
46
+            <el-pagination
47
+                    @size-change="handleSizeChange"
48
+                    @current-change="handleCurrentChange"
49
+                    :current-page="form.pageNum"
50
+                    :page-sizes="[1, 10, 20, 30, 40]"
51
+                    :page-size="form.pageSize"
52
+                    layout="total, sizes, prev, pager, next, jumper"
53
+                    :total="total">
54
+            </el-pagination>
55
+        </div>
56
+    </div>
57
+</template>
58
+
59
+<script>
60
+    export default {
61
+        name: "newsIndex",
62
+        data() {
63
+            return {
64
+                buildingList: [],
65
+                form: {
66
+                    buildingId: '',
67
+                    pageNum: 0,
68
+                    pageSize: 10
69
+                },
70
+                total: 0
71
+            }
72
+        },
73
+        methods: {
74
+            deleteNews(id) {
75
+                // 删除操作
76
+            },
77
+            handleSizeChange(val) {
78
+                console.log(`每页 ${val} 条`);
79
+            },
80
+            handleCurrentChange(val) {
81
+                console.log(`当前页: ${val}`);
82
+            }
83
+        }
84
+    }
85
+</script>
86
+
87
+<style scoped>
88
+.operation-class {
89
+    margin-left: 20px;
90
+}
91
+.body {
92
+    margin-top: 10px;
93
+}
94
+.block {
95
+    display: flex;
96
+    justify-content: flex-end;
97
+}
98
+</style>

+ 31
- 0
src/views/news/type/index.vue Целия файл

@@ -0,0 +1,31 @@
1
+<template>
2
+    <div id="root">
3
+        <div class="operation-class">
4
+           <el-button type="primary">新增</el-button>
5
+            <el-select v-model="buildingId" placeholder="项目" style="margin-left: 20px;">
6
+                <el-option
7
+                        v-for="item in buildingList"
8
+                        :key="item.buildingId"
9
+                        :label="item.buildingName"
10
+                        :value="item.buildingId">
11
+                </el-option>
12
+            </el-select>
13
+        </div>
14
+    </div>
15
+</template>
16
+
17
+<script>
18
+    export default {
19
+        name: "newsTypeIndex",
20
+        data() {
21
+            return {
22
+                buildingList: [],
23
+                buildingId: ''
24
+            }
25
+        }
26
+    }
27
+</script>
28
+
29
+<style scoped>
30
+
31
+</style>