|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <div class="divBox">
|
|
|
3
|
+ <el-card class="box-card">
|
|
|
4
|
+ <div slot="header" class="clearfix">
|
|
|
5
|
+ <el-button size="small" type="primary" @click="onAdd">添加</el-button>
|
|
|
6
|
+ </div>
|
|
|
7
|
+ <el-table
|
|
|
8
|
+ :data="tableData.data"
|
|
|
9
|
+ style="width: 100%"
|
|
|
10
|
+ size="small"
|
|
|
11
|
+ row-key="id"
|
|
|
12
|
+ default-expand-all
|
|
|
13
|
+ v-loading="listLoading"
|
|
|
14
|
+ >
|
|
|
15
|
+ <el-table-column
|
|
|
16
|
+ prop="id"
|
|
|
17
|
+ label="ID"
|
|
|
18
|
+ min-width="60"
|
|
|
19
|
+ />
|
|
|
20
|
+ <el-table-column
|
|
|
21
|
+ prop="title"
|
|
|
22
|
+ label="范围名称"
|
|
|
23
|
+ min-width="150"
|
|
|
24
|
+ :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
25
|
+ />
|
|
|
26
|
+ <el-table-column
|
|
|
27
|
+ prop="start"
|
|
|
28
|
+ label="范围开始"
|
|
|
29
|
+ min-width="150"
|
|
|
30
|
+ />
|
|
|
31
|
+ <el-table-column
|
|
|
32
|
+ prop="end"
|
|
|
33
|
+ label="范围结束"
|
|
|
34
|
+ min-width="150"
|
|
|
35
|
+ />
|
|
|
36
|
+ <el-table-column
|
|
|
37
|
+ prop="type"
|
|
|
38
|
+ label="类型"
|
|
|
39
|
+ min-width="150"
|
|
|
40
|
+ />
|
|
|
41
|
+
|
|
|
42
|
+ <el-table-column
|
|
|
43
|
+ prop="jd"
|
|
|
44
|
+ label="京豆"
|
|
|
45
|
+ min-width="150"
|
|
|
46
|
+ />
|
|
|
47
|
+
|
|
|
48
|
+ <el-table-column
|
|
|
49
|
+ prop="value"
|
|
|
50
|
+ label="贡献值"
|
|
|
51
|
+ min-width="150"
|
|
|
52
|
+ />
|
|
|
53
|
+
|
|
|
54
|
+ <el-table-column
|
|
|
55
|
+ prop="create_time"
|
|
|
56
|
+ label="创建时间"
|
|
|
57
|
+ min-width="150"
|
|
|
58
|
+ />
|
|
|
59
|
+ <el-table-column label="操作" min-width="100" fixed="right">
|
|
|
60
|
+ <template slot-scope="scope">
|
|
|
61
|
+ <el-button type="text" size="small" @click="onEdit(scope.row.id)">编辑</el-button>
|
|
|
62
|
+ <el-button type="text" size="small" @click="handleDelete(scope.row.id, scope.$index)">删除</el-button>
|
|
|
63
|
+ </template>
|
|
|
64
|
+ </el-table-column>
|
|
|
65
|
+ </el-table>
|
|
|
66
|
+ </el-card>
|
|
|
67
|
+ </div>
|
|
|
68
|
+</template>
|
|
|
69
|
+
|
|
|
70
|
+<script>
|
|
|
71
|
+import {
|
|
|
72
|
+ createContributionTable,
|
|
|
73
|
+ updateContributionTable,
|
|
|
74
|
+ ContributionLst,
|
|
|
75
|
+ changeContributionStatus,
|
|
|
76
|
+ contributionDelApi
|
|
|
77
|
+} from '@/api/system'
|
|
|
78
|
+export default {
|
|
|
79
|
+ name: 'Classify',
|
|
|
80
|
+ data() {
|
|
|
81
|
+ return {
|
|
|
82
|
+ tableData: {
|
|
|
83
|
+ data: [],
|
|
|
84
|
+ total: 0
|
|
|
85
|
+ },
|
|
|
86
|
+ listLoading: true
|
|
|
87
|
+ }
|
|
|
88
|
+ },
|
|
|
89
|
+ mounted() {
|
|
|
90
|
+ this.getList()
|
|
|
91
|
+ },
|
|
|
92
|
+ methods: {
|
|
|
93
|
+ // 列表
|
|
|
94
|
+ getList() {
|
|
|
95
|
+ this.listLoading = true
|
|
|
96
|
+ ContributionLst().then(res => {
|
|
|
97
|
+ this.tableData.data = res.data.list
|
|
|
98
|
+ this.tableData.total = res.data.count
|
|
|
99
|
+ this.listLoading = false
|
|
|
100
|
+ }).catch(res => {
|
|
|
101
|
+ this.listLoading = false
|
|
|
102
|
+ this.$message.error(res.message)
|
|
|
103
|
+ })
|
|
|
104
|
+ },
|
|
|
105
|
+ pageChange(page) {
|
|
|
106
|
+ this.tableData.page = page
|
|
|
107
|
+ this.getList()
|
|
|
108
|
+ },
|
|
|
109
|
+ handleSizeChange(val) {
|
|
|
110
|
+ this.tableData.limit = val
|
|
|
111
|
+ this.getList()
|
|
|
112
|
+ },
|
|
|
113
|
+ onchangeIsShow(row) {
|
|
|
114
|
+ changeContributionStatus(row.id, row.status).then(({ message }) => {
|
|
|
115
|
+ this.$message.success(message)
|
|
|
116
|
+ }).catch(({ message }) => {
|
|
|
117
|
+ this.$message.error(message)
|
|
|
118
|
+ })
|
|
|
119
|
+ },
|
|
|
120
|
+ // 添加
|
|
|
121
|
+ onAdd() {
|
|
|
122
|
+ this.$modalForm(createContributionTable()).then(() => this.getList())
|
|
|
123
|
+ },
|
|
|
124
|
+ // 编辑
|
|
|
125
|
+ onEdit(id) {
|
|
|
126
|
+ this.$modalForm(updateContributionTable(id)).then(() => this.getList())
|
|
|
127
|
+ },
|
|
|
128
|
+ // 删除
|
|
|
129
|
+ handleDelete(id, idx) {
|
|
|
130
|
+ this.$modalSure().then(() => {
|
|
|
131
|
+ contributionDelApi(id).then(({ message }) => {
|
|
|
132
|
+ this.$message.success(message)
|
|
|
133
|
+ this.getList()
|
|
|
134
|
+ }).catch(({ message }) => {
|
|
|
135
|
+ this.$message.error(message)
|
|
|
136
|
+ })
|
|
|
137
|
+ })
|
|
|
138
|
+ }
|
|
|
139
|
+ }
|
|
|
140
|
+}
|
|
|
141
|
+</script>
|
|
|
142
|
+
|
|
|
143
|
+<style scoped lang="stylus">
|
|
|
144
|
+</style>
|