张延森 4 年前
父节点
当前提交
31ad6e9832

+ 7
- 0
src/api/activity.js 查看文件

32
   }))
32
   }))
33
 }
33
 }
34
 
34
 
35
+export function deleteActivity(id) {
36
+  return pureResponseData(request({
37
+    url: `/api/admin/activity/${id}`,
38
+    method: 'delete'
39
+  }))
40
+}
41
+
35
 export function getEnrollList(params) {
42
 export function getEnrollList(params) {
36
   return pureResponseData(request({
43
   return pureResponseData(request({
37
     url: `/api/admin/activityEnroll`,
44
     url: `/api/admin/activityEnroll`,

+ 9
- 0
src/api/customer.js 查看文件

8
     params
8
     params
9
   }))
9
   }))
10
 }
10
 }
11
+
12
+export function exportCustomerList(params) {
13
+  return request({
14
+    url: `/api/admin/person/export`,
15
+    method: 'get',
16
+    responseType: 'blob',
17
+    params
18
+  })
19
+}

+ 7
- 0
src/api/news.js 查看文件

24
   }))
24
   }))
25
 }
25
 }
26
 
26
 
27
+export function deleteNews(id) {
28
+  return pureResponseData(request({
29
+    url: `/api/admin/news/${id}`,
30
+    method: 'delete'
31
+  }))
32
+}
33
+
27
 export function getNewsList(params) {
34
 export function getNewsList(params) {
28
   return pureResponseData(request({
35
   return pureResponseData(request({
29
     url: `/api/admin/news`,
36
     url: `/api/admin/news`,

+ 0
- 1
src/utils/request.js 查看文件

48
       const url = window.URL.createObjectURL(new Blob([response.data]))
48
       const url = window.URL.createObjectURL(new Blob([response.data]))
49
       const download = document.createElement('a')
49
       const download = document.createElement('a')
50
       download.setAttribute('href', url)
50
       download.setAttribute('href', url)
51
-      debugger
52
       download.setAttribute('download', unescape(decodeURIComponent(fileName).replace(/\\/g, '%')))
51
       download.setAttribute('download', unescape(decodeURIComponent(fileName).replace(/\\/g, '%')))
53
       download.click()
52
       download.click()
54
       return
53
       return

+ 18
- 5
src/views/activity/List.vue 查看文件

7
       </el-tooltip>
7
       </el-tooltip>
8
     </div>
8
     </div>
9
     <el-table
9
     <el-table
10
-      v-loading="listLoading"
10
+      v-loading="loading.list"
11
       :data="list"
11
       :data="list"
12
       element-loading-text="Loading"
12
       element-loading-text="Loading"
13
       border
13
       border
33
       <el-table-column label="操作" align="center" width="200">
33
       <el-table-column label="操作" align="center" width="200">
34
         <template slot-scope="scope">
34
         <template slot-scope="scope">
35
           <el-button size="mini" type="primary" plain @click="handleEdit(scope.row)">编辑</el-button>
35
           <el-button size="mini" type="primary" plain @click="handleEdit(scope.row)">编辑</el-button>
36
+          <el-button size="mini" type="danger" plain @click="handleDelete(scope.row)">删除</el-button>
36
         </template>
37
         </template>
37
       </el-table-column>
38
       </el-table-column>
38
     </el-table>
39
     </el-table>
46
 </template>
47
 </template>
47
 
48
 
48
 <script>
49
 <script>
49
-import { getActivityList } from '@/api/activity'
50
+import { getActivityList, deleteActivity } from '@/api/activity'
50
 
51
 
51
 export default {
52
 export default {
52
   components: {
53
   components: {
91
   data() {
92
   data() {
92
     return {
93
     return {
93
       list: null,
94
       list: null,
94
-      listLoading: true,
95
+      loading: {
96
+        list: false
97
+      },
95
       detailRouter: null,
98
       detailRouter: null,
96
       page: {
99
       page: {
97
         total: 0,
100
         total: 0,
110
   },
113
   },
111
   methods: {
114
   methods: {
112
     fetchData() {
115
     fetchData() {
113
-      this.listLoading = true
116
+      this.loading.list = true
114
       getActivityList({
117
       getActivityList({
115
         ...this.filters,
118
         ...this.filters,
116
         typeId: this.typeId,
119
         typeId: this.typeId,
119
       }).then(res => {
122
       }).then(res => {
120
         this.list = res.records
123
         this.list = res.records
121
         this.page.total = res.total
124
         this.page.total = res.total
122
-        this.listLoading = false
125
+        this.loading.list = false
123
       })
126
       })
124
     },
127
     },
125
 
128
 
138
       })
141
       })
139
     },
142
     },
140
 
143
 
144
+    handleDelete(row) {
145
+      this.$confirm('确认删除当前记录?', { type: 'warning' }).then(() => {
146
+        this.loading.list = true
147
+        deleteActivity(row.activityId).then(() => {
148
+          this.list = this.list.filter(x => x.activityId !== row.activityId)
149
+          this.loading.list = false
150
+        })
151
+      })
152
+    },
153
+
141
     handlePageChange({ current, size }) {
154
     handlePageChange({ current, size }) {
142
       this.page.current = current
155
       this.page.current = current
143
       this.page.size = size
156
       this.page.size = size

+ 15
- 7
src/views/customer/index.vue 查看文件

3
     <div class="customer-header">
3
     <div class="customer-header">
4
       <FilterForm @search="handleSearch" @reset="handleSearch" />
4
       <FilterForm @search="handleSearch" @reset="handleSearch" />
5
       <el-tooltip content="导出" placement="top">
5
       <el-tooltip content="导出" placement="top">
6
-        <el-button type="primary" icon="el-icon-position" @click="handleExport" />
6
+        <el-button type="primary" :loading="loading.export" @click="handleExport">导出</el-button>
7
       </el-tooltip>
7
       </el-tooltip>
8
     </div>
8
     </div>
9
     <el-table
9
     <el-table
10
-      v-loading="listLoading"
10
+      v-loading="loading.list"
11
       :data="list"
11
       :data="list"
12
       element-loading-text="Loading"
12
       element-loading-text="Loading"
13
       border
13
       border
51
 </template>
51
 </template>
52
 
52
 
53
 <script>
53
 <script>
54
-import { getCustomerList } from '@/api/customer'
54
+import { getCustomerList, exportCustomerList } from '@/api/customer'
55
 
55
 
56
 export default {
56
 export default {
57
   components: {
57
   components: {
89
   data() {
89
   data() {
90
     return {
90
     return {
91
       list: null,
91
       list: null,
92
-      listLoading: true,
92
+      loading: {
93
+        list: false,
94
+        export: false
95
+      },
93
       page: {
96
       page: {
94
         total: 0,
97
         total: 0,
95
         size: 10,
98
         size: 10,
106
   },
109
   },
107
   methods: {
110
   methods: {
108
     fetchData() {
111
     fetchData() {
109
-      this.listLoading = true
112
+      this.loading.list = true
110
       getCustomerList({
113
       getCustomerList({
111
         ...this.filters,
114
         ...this.filters,
112
         pageNum: this.page.current,
115
         pageNum: this.page.current,
114
       }).then(res => {
117
       }).then(res => {
115
         this.list = res.records
118
         this.list = res.records
116
         this.page.total = res.total
119
         this.page.total = res.total
117
-        this.listLoading = false
120
+        this.loading.list = false
118
       })
121
       })
119
     },
122
     },
120
 
123
 
121
-    handleExport() {},
124
+    handleExport() {
125
+      this.loading.export = true
126
+      exportCustomerList(this.filters).then(() => {
127
+        this.loading.export = false
128
+      })
129
+    },
122
 
130
 
123
     handlePageChange({ current, size }) {
131
     handlePageChange({ current, size }) {
124
       this.page.current = current
132
       this.page.current = current

+ 18
- 5
src/views/news/List.vue 查看文件

7
       </el-tooltip>
7
       </el-tooltip>
8
     </div>
8
     </div>
9
     <el-table
9
     <el-table
10
-      v-loading="listLoading"
10
+      v-loading="loading.list"
11
       :data="list"
11
       :data="list"
12
       element-loading-text="Loading"
12
       element-loading-text="Loading"
13
       border
13
       border
42
       <el-table-column label="操作" align="center" width="200">
42
       <el-table-column label="操作" align="center" width="200">
43
         <template slot-scope="scope">
43
         <template slot-scope="scope">
44
           <el-button size="mini" type="primary" plain @click="handleEdit(scope.row)">编辑</el-button>
44
           <el-button size="mini" type="primary" plain @click="handleEdit(scope.row)">编辑</el-button>
45
+          <el-button size="mini" type="danger" plain @click="handleDelete(scope.row)">删除</el-button>
45
         </template>
46
         </template>
46
       </el-table-column>
47
       </el-table-column>
47
     </el-table>
48
     </el-table>
55
 </template>
56
 </template>
56
 
57
 
57
 <script>
58
 <script>
58
-import { getNewsList } from '@/api/news'
59
+import { getNewsList, deleteNews } from '@/api/news'
59
 
60
 
60
 export default {
61
 export default {
61
   components: {
62
   components: {
96
   data() {
97
   data() {
97
     return {
98
     return {
98
       list: null,
99
       list: null,
99
-      listLoading: true,
100
+      loading: {
101
+        list: false
102
+      },
100
       detailRouter: null,
103
       detailRouter: null,
101
       page: {
104
       page: {
102
         total: 0,
105
         total: 0,
115
   },
118
   },
116
   methods: {
119
   methods: {
117
     fetchData() {
120
     fetchData() {
118
-      this.listLoading = true
121
+      this.loading.list = true
119
       getNewsList({
122
       getNewsList({
120
         ...this.filters,
123
         ...this.filters,
121
         typeId: this.typeId,
124
         typeId: this.typeId,
124
       }).then(res => {
127
       }).then(res => {
125
         this.list = res.records
128
         this.list = res.records
126
         this.page.total = res.total
129
         this.page.total = res.total
127
-        this.listLoading = false
130
+        this.loading.list = false
128
       })
131
       })
129
     },
132
     },
130
 
133
 
149
       })
152
       })
150
     },
153
     },
151
 
154
 
155
+    handleDelete(row) {
156
+      this.$confirm('确认删除当前记录?', { type: 'warning' }).then(() => {
157
+        this.loading.list = true
158
+        deleteNews(row.newsId).then(() => {
159
+          this.list = this.list.filter(x => x.newsId !== row.newsId)
160
+          this.loading.list = false
161
+        })
162
+      })
163
+    },
164
+
152
     handleSearch(searchParams) {
165
     handleSearch(searchParams) {
153
       this.filters = {
166
       this.filters = {
154
         ...this.filters,
167
         ...this.filters,

+ 7
- 3
src/views/recommender/index.vue 查看文件

3
     <div class="recommender-header">
3
     <div class="recommender-header">
4
       <FilterForm @search="handleSearch" @reset="handleSearch" />
4
       <FilterForm @search="handleSearch" @reset="handleSearch" />
5
       <el-tooltip content="导出" placement="top">
5
       <el-tooltip content="导出" placement="top">
6
-        <el-button type="primary" icon="el-icon-position" @click="handleExport" />
6
+        <el-button type="primary" :loading="loading.export" @click="handleExport">导出</el-button>
7
       </el-tooltip>
7
       </el-tooltip>
8
     </div>
8
     </div>
9
     <el-table
9
     <el-table
152
       list: null,
152
       list: null,
153
       loading: {
153
       loading: {
154
         list: false,
154
         list: false,
155
-        dialog: false
155
+        dialog: false,
156
+        export: false
156
       },
157
       },
157
       dialogVisible: false,
158
       dialogVisible: false,
158
       current: {},
159
       current: {},
185
     },
186
     },
186
 
187
 
187
     handleExport() {
188
     handleExport() {
188
-      exportRecommenderList(this.filters)
189
+      this.loading.export = true
190
+      exportRecommenderList(this.filters).then(() => {
191
+        this.loading.export = false
192
+      })
189
     },
193
     },
190
 
194
 
191
     handlePageChange({ current, size }) {
195
     handlePageChange({ current, size }) {