|
@@ -0,0 +1,137 @@
|
|
1
|
+<template>
|
|
2
|
+ <div>
|
|
3
|
+ <div>
|
|
4
|
+ <el-button type="primary" size="small">创建规则</el-button>
|
|
5
|
+ </div>
|
|
6
|
+ <el-table v-loading="loading" ref="multipleTable" :height='height' :data="tableData" tooltip-effect="dark" style="margin-top: 10px; width: 100%">
|
|
7
|
+ <el-table-column prop="title" label="规则名称" show-overflow-tooltip align="center" width="170" />
|
|
8
|
+ <el-table-column label="创建人" align="center" width="170">
|
|
9
|
+ <template slot-scope="{ row }">
|
|
10
|
+ <div class="customerServiceTagBox">
|
|
11
|
+ <div class="customerServiceTag">
|
|
12
|
+ <i class="el-icon-user-solid" />
|
|
13
|
+ {{ row.creator_name }}
|
|
14
|
+ </div>
|
|
15
|
+ </div>
|
|
16
|
+ </template>
|
|
17
|
+ </el-table-column>
|
|
18
|
+ <el-table-column label="使用成员" align="center">
|
|
19
|
+ <template slot-scope="scope">
|
|
20
|
+ <template>
|
|
21
|
+ <div class="customerServiceTagBox biaoqian">
|
|
22
|
+ <div class="customerServiceTag" v-for="(item, idx) in scope.row.user_listArr" :key="idx">
|
|
23
|
+ <i class="el-icon-s-custom" />
|
|
24
|
+ {{ item }}
|
|
25
|
+ </div>
|
|
26
|
+ </div>
|
|
27
|
+ </template>
|
|
28
|
+ </template>
|
|
29
|
+ </el-table-column>
|
|
30
|
+ <el-table-column prop="desc" label="规则" show-overflow-tooltip align="center" />
|
|
31
|
+ <el-table-column label="操作" align="center" width="200">
|
|
32
|
+ <template slot-scope="{ row }">
|
|
33
|
+ <div class="flex" style="justify-content:center">
|
|
34
|
+ <template>
|
|
35
|
+ <div v-if="row.status == 1" class="pointer c-FF604D" style="margin:0 6px" @click="onClickSetStatus(row, 0)">禁用</div>
|
|
36
|
+ <div v-else class="pointer c-007AFF" style="margin:0 6px" @click="onClickSetStatus(row, 1)">启用</div>
|
|
37
|
+ </template>
|
|
38
|
+ <div class="c-00B38A pointer" style="margin:0 6px">编辑</div>
|
|
39
|
+ <div class="c-00B38A pointer" style="margin:0 6px">详情</div>
|
|
40
|
+ </div>
|
|
41
|
+ </template>
|
|
42
|
+ </el-table-column>
|
|
43
|
+ </el-table>
|
|
44
|
+ <div class="pagination" v-show="total>0">
|
|
45
|
+ <el-pagination background :current-page="filter.page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
|
|
46
|
+ </el-pagination>
|
|
47
|
+ </div>
|
|
48
|
+ </div>
|
|
49
|
+</template>
|
|
50
|
+<script>
|
|
51
|
+export default {
|
|
52
|
+ data () {
|
|
53
|
+ return {
|
|
54
|
+ loading: false,
|
|
55
|
+ filter: {
|
|
56
|
+ page: 1,
|
|
57
|
+ page_size: 20,
|
|
58
|
+ },
|
|
59
|
+ pages: 0,
|
|
60
|
+ total: 0,
|
|
61
|
+ tableData: [],
|
|
62
|
+ height: ''
|
|
63
|
+ }
|
|
64
|
+ },
|
|
65
|
+ created () {
|
|
66
|
+ this.height = document.documentElement.clientHeight - 200 > 400 ? document.documentElement.clientHeight - 200 : 400
|
|
67
|
+ this.handleGetList()
|
|
68
|
+ },
|
|
69
|
+ methods: {
|
|
70
|
+ async onClickSetStatus(row, status) {
|
|
71
|
+ try {
|
|
72
|
+ await this.$confirm(`确定${status == 1 ? '启用' : '禁用'}【${row.title}】?`, '提示', {
|
|
73
|
+ confirmButtonText: '确定',
|
|
74
|
+ cancelButtonText: '取消',
|
|
75
|
+ type: 'warning'
|
|
76
|
+ })
|
|
77
|
+ this.handleSetStatus(row.id, status)
|
|
78
|
+ } catch (error) {
|
|
79
|
+ console.log('error => ', error)
|
|
80
|
+ }
|
|
81
|
+ },
|
|
82
|
+ async handleSetStatus(rule_id, status) {
|
|
83
|
+ try {
|
|
84
|
+ this.loading = true
|
|
85
|
+ const url = `${this.URL.BASEURL}${this.URL.sop_changeStatus}`
|
|
86
|
+ const params = { rule_id, status }
|
|
87
|
+ const { data: res = {} } = await this.$axios.get(url, { params })
|
|
88
|
+ if (res && res.errno == 0) {
|
|
89
|
+ this.$message.success('操作成功')
|
|
90
|
+ this.handleGetList()
|
|
91
|
+ } else {
|
|
92
|
+ this.$message.warning(res.err)
|
|
93
|
+ }
|
|
94
|
+ } catch (error) {
|
|
95
|
+ console.log('error => ', error)
|
|
96
|
+ } finally {
|
|
97
|
+ this.loading = false
|
|
98
|
+ }
|
|
99
|
+ },
|
|
100
|
+ async handleGetList() {
|
|
101
|
+ try {
|
|
102
|
+ this.loading = true
|
|
103
|
+ const url = `${this.URL.BASEURL}${this.URL.sop_ruleList}`
|
|
104
|
+ const params = {
|
|
105
|
+ page: this.filter.page,
|
|
106
|
+ page_size: this.filter.page_size
|
|
107
|
+ }
|
|
108
|
+ const { data: res = {} } = await this.$axios.get(url, { params })
|
|
109
|
+ if (res && res.errno == 0) {
|
|
110
|
+ res.rst.data.forEach(item => {
|
|
111
|
+ item.user_listArr = item.user_list.split(',')
|
|
112
|
+ })
|
|
113
|
+ this.tableData = res.rst.data;
|
|
114
|
+ this.total = res.rst.pageInfo.total;
|
|
115
|
+ this.pages = res.rst.pageInfo.pages;
|
|
116
|
+ } else if (res.errno != 4002) {
|
|
117
|
+ this.$message.warning(res.err)
|
|
118
|
+ }
|
|
119
|
+ } catch (error) {
|
|
120
|
+ console.log('error => ', error)
|
|
121
|
+ } finally {
|
|
122
|
+ this.loading = false
|
|
123
|
+ }
|
|
124
|
+ },
|
|
125
|
+ handleCurrentChange(page) {
|
|
126
|
+ this.filter.page = page
|
|
127
|
+ this.handleGetList()
|
|
128
|
+ }
|
|
129
|
+ }
|
|
130
|
+}
|
|
131
|
+</script>
|
|
132
|
+<style lang="scss" scoped>
|
|
133
|
+@import "@/style/list.scss";
|
|
134
|
+.tableInfo {
|
|
135
|
+ height: 50px;
|
|
136
|
+}
|
|
137
|
+</style>
|