|
@@ -45,8 +45,8 @@
|
45
|
45
|
<el-table-column label="操作" min-width="160" align="center" fixed="right">
|
46
|
46
|
<template slot-scope="{ row }">
|
47
|
47
|
<template>
|
48
|
|
- <span v-if="row.status == statusTypes.ENABLE" class="btn c-FF604D">禁用</span>
|
49
|
|
- <span v-else-if="row.status == statusTypes.DISABLE" class="btn c-007AFF">启用</span>
|
|
48
|
+ <span v-if="row.status == statusTypes.ENABLE" class="btn c-FF604D" @click="onClickSetStatus({ conf_id: row.conf_id, status: statusTypes.DISABLE })">禁用</span>
|
|
49
|
+ <span v-else-if="row.status == statusTypes.DISABLE" class="btn c-007AFF" @click="onClickSetStatus({ conf_id: row.conf_id, status: statusTypes.ENABLE })">启用</span>
|
50
|
50
|
</template>
|
51
|
51
|
<span class="btn c-00b38a" @click="onClickEditWarnBtn(row.group_id)">编辑</span>
|
52
|
52
|
</template>
|
|
@@ -139,6 +139,41 @@ export default {
|
139
|
139
|
this.pagination.page = currentPage
|
140
|
140
|
this.handleGetList()
|
141
|
141
|
},
|
|
142
|
+ // 监听点击“禁用/启用”
|
|
143
|
+ async onClickSetStatus({ conf_id, status }) {
|
|
144
|
+ try {
|
|
145
|
+ await this.$confirm(`确定${status == statusTypes.ENABLE ? '启用' : '禁用'}当前预警吗?`, '提示', {
|
|
146
|
+ confirmButtonText: '确定',
|
|
147
|
+ cancelButtonText: '取消',
|
|
148
|
+ type: 'warning'
|
|
149
|
+ })
|
|
150
|
+ this.handleSetStatus({ conf_id, status })
|
|
151
|
+ } catch (error) {
|
|
152
|
+ console.log('error => ', error)
|
|
153
|
+ }
|
|
154
|
+ },
|
|
155
|
+ // 执行设置“禁用/启用”
|
|
156
|
+ async handleSetStatus({ conf_id, status }) {
|
|
157
|
+ try {
|
|
158
|
+ this.loading = true
|
|
159
|
+ const url = `${this.URL.BASEURL}${this.URL.customerAlerts_updateConfStatus}`
|
|
160
|
+ const params = {
|
|
161
|
+ conf_id,
|
|
162
|
+ status,
|
|
163
|
+ }
|
|
164
|
+ const { data: res = {} } = await this.$axios.post(url, params)
|
|
165
|
+ if (res && res.errno == 0) {
|
|
166
|
+ this.$message.success('操作成功')
|
|
167
|
+ this.handleGetList()
|
|
168
|
+ } else if (res.errno != 4002) {
|
|
169
|
+ this.$message.warning(res.err)
|
|
170
|
+ }
|
|
171
|
+ } catch (error) {
|
|
172
|
+ console.log(error)
|
|
173
|
+ } finally {
|
|
174
|
+ this.loading = false
|
|
175
|
+ }
|
|
176
|
+ },
|
142
|
177
|
|
143
|
178
|
// S 新建预警、编辑预警
|
144
|
179
|
// 监听点击“新建预警”
|