|
@@ -30,8 +30,8 @@
|
30
|
30
|
<el-table-column label="操作" min-width="160" align="center">
|
31
|
31
|
<template slot-scope="{ row }">
|
32
|
32
|
<el-button type="primary" size="mini" @click="onClickEditPlatform(row)">编辑</el-button>
|
33
|
|
- <el-button type="danger" size="mini" v-if="row.enable == 1">禁用</el-button>
|
34
|
|
- <el-button type="primary" size="mini" v-else>启用</el-button>
|
|
33
|
+ <el-button v-if="row.enable == 1" type="danger" size="mini" @click="onClickEnable(row, 0)">禁用</el-button>
|
|
34
|
+ <el-button v-else type="primary" size="mini" @click="onClickEnable(row, 1)">启用</el-button>
|
35
|
35
|
</template>
|
36
|
36
|
</el-table-column>
|
37
|
37
|
</el-table>
|
|
@@ -113,6 +113,8 @@ export default {
|
113
|
113
|
this.pagination.page = currentPage
|
114
|
114
|
this.handleGetPlatform()
|
115
|
115
|
},
|
|
116
|
+
|
|
117
|
+ // S 添加 & 编辑平台
|
116
|
118
|
// 监听点击"添加平台"
|
117
|
119
|
onClickAddPlatform() {
|
118
|
120
|
this.currentPlatformInfo = {}
|
|
@@ -133,7 +135,54 @@ export default {
|
133
|
135
|
handleAddPlatformCancel() {
|
134
|
136
|
this.addPlatformDialogVisible = false
|
135
|
137
|
},
|
|
138
|
+ // E 添加 & 编辑平台
|
136
|
139
|
|
|
140
|
+ // S 禁用、启用平台
|
|
141
|
+ // 监听点击"禁用"、"启用"按钮
|
|
142
|
+ async onClickEnable(currentPlatform, eventCode) {
|
|
143
|
+ try {
|
|
144
|
+ const h = this.$createElement
|
|
145
|
+ await this.$confirm('', {
|
|
146
|
+ message:h('div', null, [
|
|
147
|
+ h('span', null, `确定${eventCode === 0 ? '禁用' : '启用'}`),
|
|
148
|
+ h('span', { style:'color: #32B38A;' }, `${currentPlatform.name}`),
|
|
149
|
+ h('span', null, '吗?'),
|
|
150
|
+ ]),
|
|
151
|
+ confirmButtonText: '确定',
|
|
152
|
+ cancelButtonText: '取消',
|
|
153
|
+ type: 'warning',
|
|
154
|
+ })
|
|
155
|
+ this.handleEnable(currentPlatform, eventCode)
|
|
156
|
+ } catch (error) {
|
|
157
|
+ console.log(error)
|
|
158
|
+ }
|
|
159
|
+ },
|
|
160
|
+ // 执行"禁用"、"启用"
|
|
161
|
+ async handleEnable(currentPlatform, eventCode) {
|
|
162
|
+ try {
|
|
163
|
+ let url = `${this.URL.BASEURL}${this.URL.xxx}`
|
|
164
|
+ const params = {
|
|
165
|
+ id: currentPlatform.id,
|
|
166
|
+ enable: eventCode,
|
|
167
|
+ }
|
|
168
|
+ console.log('url => ', url)
|
|
169
|
+ console.log('params => ', params)
|
|
170
|
+ return // mock
|
|
171
|
+ this.loading = true
|
|
172
|
+ const { data: res = {} } = await this.$axios.post(url, params)
|
|
173
|
+ if (res && res.errno == 0) {
|
|
174
|
+ this.$message.success('操作成功')
|
|
175
|
+ this.handleGetPlatform()
|
|
176
|
+ } else if (res.errno != 4002) {
|
|
177
|
+ this.$message.warning(res.err || '操作失败')
|
|
178
|
+ }
|
|
179
|
+ } catch (error) {
|
|
180
|
+ console.log('error => ', error)
|
|
181
|
+ } finally {
|
|
182
|
+ this.loading = false
|
|
183
|
+ }
|
|
184
|
+ },
|
|
185
|
+ // E 禁用、启用平台
|
137
|
186
|
}
|
138
|
187
|
}
|
139
|
188
|
</script>
|