|
@@ -1,5 +1,5 @@
|
1
|
1
|
<template>
|
2
|
|
- <div v-loading="loading">
|
|
2
|
+ <div v-loading="loading" class="inviteRuleList-wrap">
|
3
|
3
|
<div class="screenBox" style="align-items: center;padding-right:16px">
|
4
|
4
|
<div class="flex-align-center" style="flex:1">
|
5
|
5
|
<!-- 搜索配置 -->
|
|
@@ -32,20 +32,20 @@
|
32
|
32
|
<div>{{scope.row.join_type == 1 ? '顺序拉群' : (scope.row.join_type == 2 ? '随机拉群' : '-')}}</div>
|
33
|
33
|
</template>
|
34
|
34
|
</el-table-column>
|
35
|
|
- <el-table-column label="规则状态" align="center" min-width="140">
|
36
|
|
- <template slot-scope="scope">
|
37
|
|
- <div>{{scope.row.status == 1 ? '启用' : (scope.row.status == 0 ? '禁用' : '-')}}</div>
|
|
35
|
+
|
|
36
|
+ <el-table-column label="配置状态" align="center" min-width="120">
|
|
37
|
+ <template slot-scope="{ row }">
|
|
38
|
+ <el-switch v-if="row.status !== ''" v-model="row.status" :active-value="1" :inactive-value="0" disabled @click.native="onClickStatus(row)" />
|
|
39
|
+ <div v-else> - </div>
|
38
|
40
|
</template>
|
39
|
41
|
</el-table-column>
|
|
42
|
+
|
40
|
43
|
<el-table-column min-width="140" label="操作" align="center" fixed="right">
|
41
|
44
|
<template slot-scope="scope">
|
42
|
45
|
<div class="flex" style="justify-content:center">
|
43
|
|
- <div :class="['pointer','table_button',scope.row.status == 1 ? 'c-FF604D' :'c-007AFF']" v-if="scope.row.status == 1 || scope.row.status == 0" @click="setEnableOrForbidden(scope.row)">
|
44
|
|
- {{scope.row.status == 1 ? '禁用' : scope.row.status == 0 ? '启用':''}}
|
45
|
|
- </div>
|
46
|
46
|
<div class="c-00B38A pointer table_button" @click="goDetail(scope.row)">编辑</div>
|
47
|
47
|
<el-popconfirm @confirm="deleEvent(scope.row)" :title="`确定删除【${scope.row.title}】群发消息?`">
|
48
|
|
- <div slot="reference" class="c-00B38A pointer table_button">删除</div>
|
|
48
|
+ <div slot="reference" class="c-FF604D pointer table_button">删除</div>
|
49
|
49
|
</el-popconfirm>
|
50
|
50
|
</div>
|
51
|
51
|
</template>
|
|
@@ -135,42 +135,42 @@ export default {
|
135
|
135
|
this.detail_rule_id = data.rule_id;
|
136
|
136
|
this.massMsgFlag = true
|
137
|
137
|
},
|
138
|
|
- setEnableOrForbidden (item) {
|
139
|
|
- if (item.status != 1 && item.status != 0) {
|
140
|
|
- return
|
141
|
|
- }
|
142
|
|
- this.$confirm(`确定${item.status == 1 ? '禁用' : '启用'}【${item.title}】?`, '提示', {
|
143
|
|
- confirmButtonText: '确定',
|
144
|
|
- cancelButtonText: '取消',
|
145
|
|
- type: 'warning'
|
146
|
|
- }).then(() => {
|
147
|
|
- this.$loading(this.$loadingConfig);
|
148
|
|
- this.$axios.get(this.URL.BASEURL + this.URL.inviteRule_editStatus, {
|
149
|
|
- params: {
|
150
|
|
- rule_id: item.rule_id,
|
151
|
|
- status: item.status == 1 ? 0 : 1
|
152
|
|
- }
|
153
|
|
- }).then((res) => {
|
154
|
|
- var res = res.data;
|
155
|
|
- this.$loading(this.$loadingConfig).close();
|
156
|
|
- if (res && res.errno == 0) {
|
157
|
|
- this.$message({
|
158
|
|
- message: '操作成功!',
|
159
|
|
- type: 'success'
|
160
|
|
- })
|
161
|
|
- this.init(1)
|
162
|
|
- } else {
|
163
|
|
- this.$message({
|
164
|
|
- message: res.err,
|
165
|
|
- type: 'warning'
|
166
|
|
- })
|
167
|
|
- }
|
168
|
|
- }).catch(() => {
|
169
|
|
- this.$loading(this.$loadingConfig).close();
|
|
138
|
+ // 监听点击切换"状态"
|
|
139
|
+ async onClickStatus(row) {
|
|
140
|
+ try {
|
|
141
|
+ await this.$confirm(`确定${row.status == 0 ? '启用' : '禁用'}【${row.title}】?`, '提示', {
|
|
142
|
+ confirmButtonText: '确定',
|
|
143
|
+ cancelButtonText: '取消',
|
|
144
|
+ type: 'warning'
|
170
|
145
|
})
|
171
|
|
- }).catch(() => {
|
172
|
|
- })
|
|
146
|
+ this.handleChangeStatus(row)
|
|
147
|
+ } catch (error) {
|
|
148
|
+ console.log(error)
|
|
149
|
+ }
|
173
|
150
|
},
|
|
151
|
+ // 执行“切换状态”
|
|
152
|
+ async handleChangeStatus({ rule_id, status }) {
|
|
153
|
+ try {
|
|
154
|
+ this.loading = true
|
|
155
|
+ const url = `${this.URL.BASEURL}${this.URL.inviteRule_editStatus}`
|
|
156
|
+ const params = {
|
|
157
|
+ rule_id,
|
|
158
|
+ status: status == 1 ? 0 : 1,
|
|
159
|
+ }
|
|
160
|
+ const { data: res = {} } = await this.$axios.get(url, { params })
|
|
161
|
+ if (res && res.errno == 0) {
|
|
162
|
+ this.$message.success('操作成功')
|
|
163
|
+ this.init()
|
|
164
|
+ } else if (res.errno != 4002) {
|
|
165
|
+ this.$message.warning(res.err)
|
|
166
|
+ }
|
|
167
|
+ } catch (error) {
|
|
168
|
+ console.log(error)
|
|
169
|
+ } finally {
|
|
170
|
+ this.loading = false
|
|
171
|
+ }
|
|
172
|
+ },
|
|
173
|
+
|
174
|
174
|
init (page, type) {
|
175
|
175
|
if (type != 'export') {
|
176
|
176
|
this.page = page ? page : this.page;
|
|
@@ -204,10 +204,7 @@ export default {
|
204
|
204
|
this.pages = res.rst.pageInfo.pages;
|
205
|
205
|
}
|
206
|
206
|
} else if (res.errno != 4002) {
|
207
|
|
- this.$message({
|
208
|
|
- message: res.err,
|
209
|
|
- type: "warning"
|
210
|
|
- })
|
|
207
|
+ this.$message.warning(res.err)
|
211
|
208
|
}
|
212
|
209
|
}).catch((err) => {
|
213
|
210
|
this.loading = false
|
|
@@ -255,14 +252,13 @@ export default {
|
255
|
252
|
min-width: 26px;
|
256
|
253
|
}
|
257
|
254
|
|
258
|
|
-.status-wrap {
|
259
|
|
- width: 100%;
|
260
|
|
- .reason {
|
261
|
|
- width: 100%;
|
262
|
|
- overflow:hidden;
|
263
|
|
- white-space: nowrap;
|
264
|
|
- text-overflow: ellipsis;
|
265
|
|
- -o-text-overflow:ellipsis;
|
|
255
|
+.inviteRuleList-wrap {
|
|
256
|
+ /deep/ .el-switch.is-disabled .el-switch__core {
|
|
257
|
+ cursor: pointer;
|
|
258
|
+ }
|
|
259
|
+ /deep/ .el-switch.is-disabled {
|
|
260
|
+ opacity: 1;
|
266
|
261
|
}
|
267
|
262
|
}
|
|
263
|
+
|
268
|
264
|
</style>
|