index.vue
5.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!--
* @Author: your name
* @Date: 2022-03-02 18:28:20
* @LastEditTime: 2022-03-14 18:24:08
* @LastEditors: Please set LastEditors
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \scrm-micro-settings\src\views\approvalConfig\index.vue
-->
<template>
<div>
<div class="page-tips">
<img src="../../../src/assets/img/Shape.png" alt="" />
<span>企微管理员通过在企微后台创建审批模板,设置好审批人员后,将对应审批模板的ID复制到下方需要调用该审批的模块,该模块即可调用审批。</span>
</div>
<div class="config-page" :style="{ 'min-height': clientHeight + 'px' }">
<div class="page-title">
审批配置
<GLButton type="text" class="guide-btn" @click="jumpGuide" fn="审批模板创建指引">查看创建审批模板指引</GLButton>
<!-- <el-button type="text" class="guide-btn" @click="jumpGuide">查看创建审批模板指引></el-button> -->
</div>
<div class="config-list">
<div class="config-item" v-for="(item, index) in configList" :key="item.id">
<div class="config-title">
<span>{{ item.title }}</span>
</div>
<div class="config-content">
<span class="config-label">{{ item.name }}</span>
<el-input class="config-input" :placeholder="item.placeholder" :disabled="item.disabled" :size="size" v-model="config[item.model]" clearable></el-input>
<el-button-group class="config-btn" v-if="!item.disabled">
<el-button type="text" @click="cancel(item.model, index)">取消</el-button>
<el-button type="text" @click="submit(item.model, index)">确定</el-button>
</el-button-group>
<el-button-group v-else class="config-btn">
<el-button type="text" @click="edit(index)">编辑</el-button>
</el-button-group>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import util from '@/utils/util'
export default {
name: 'ApprovalConfig',
data() {
return {
input: '',
config: {
approveTemplateId: ''
// input1: '3'
},
oldConfig: {},
configList: [
{
id: 1,
title: '定向礼包',
name: '审批模板ID:',
model: 'approveTemplateId',
placeholder: '请将模板ID粘贴到此处,不填写则不调用审批',
disabled: true
// },
// {
// id: 2,
// title: '定向礼包',
// name: '审批模板ID:',
// model: 'input1',
// placeholder: '请将模板ID粘贴到此处,不填写则不调用审批',
// disabled: true
}
],
clientHeight: 500
}
},
created() {
this.getApprove()
},
mounted() {
this.clientHeight = document.documentElement.scrollHeight - 140
},
methods: {
// 编辑
edit(index) {
this.configList[index].disabled = false
},
// 提交
submit(model, index) {
this.oldConfig[model] = this.config[model]
this.configList[index].disabled = true
const params = {
merchantId: this.$globalState.session.merchantId,
approveTemplateId: this.config.approveTemplateId
}
this.$apis.approvalConfig.saveApprove(params).then(res => {
if (res) {
this.$message({
type: 'success',
message: '操作成功'
})
} else {
this.$message({
type: 'error',
message: '操作失败'
})
}
})
},
// 取消
cancel(model, index) {
console.log(this.oldConfig[model])
this.config[model] = this.oldConfig[model]
this.configList[index].disabled = true
},
// 调整环审批模板指引
jumpGuide() {
this.$router.push({ path: '/approvalConfig/createGuide' })
},
getApprove() {
const merchantId = this.$globalState.session.merchantId
// const merchantId = 44209572
this.$apis.approvalConfig.getApproveDetail({ merchantId }).then(res => {
this.config.approveTemplateId = res
this.oldConfig = util.deepClone(this.config)
})
}
}
}
</script>
<style scoped lang="scss">
.page-tips {
display: flex;
align-items: center;
font-size: 14px;
font-weight: 400;
line-height: 20px;
padding: 10px 16px;
border: 1px solid #5850ff;
border-radius: 4px;
background-color: #e6e9ff;
margin-bottom: 10px;
img {
width: 14px;
height: 14px;
margin-right: 8px;
}
}
.config-page {
background-color: #fff;
.page-title {
font-size: 16px;
font-weight: 500;
color: #333;
padding: 15px 20px;
border-bottom: 1px solid #d8d8d8;
.guide-btn {
text-decoration: underline;
margin-left: 16px;
}
}
.config-list {
padding: 32px 20px;
.config-item {
margin-bottom: 20px;
}
.config-title {
font-size: 14px;
font-weight: 500;
color: #333;
margin-bottom: 16px;
span {
position: relative;
display: inline-block;
width: 76px;
text-align: center;
z-index: 0;
&::after {
content: '';
display: inline-block;
position: absolute;
width: 100%;
height: 9px;
background-color: #e6e5ff;
left: 0;
bottom: 0;
z-index: -1;
}
}
}
.config-content {
.config-label {
display: inline-block;
width: 118px;
font-size: 14px;
font-weight: 400;
color: #333333;
text-align: right;
}
.config-input {
width: 415px;
}
.config-btn {
.el-button {
margin-left: 12px;
}
}
}
}
}
</style>