ThirdAppWeEnterpriseConfigForm.vue
7.0 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<template>
<div class="base-collapse">
<div class="header"> 企业微信集成 </div>
<a-collapse expand-icon-position="right" :bordered="false">
<a-collapse-panel key="1">
<template #header>
<div style="font-size: 16px"> 1.获取对接信息</div>
</template>
<div class="base-desc">从企业微信平台获取对接信息,即可开始集成以及同步通讯录</div>
<div style="margin-top: 5px">
<a href="https://help.qiaoqiaoyun.com/expand/dingding.html" target="_blank">如何获取对接信息?</a>
</div>
</a-collapse-panel>
</a-collapse>
<div>
<a-collapse expand-icon-position="right" :bordered="false">
<a-collapse-panel key="2">
<template #header>
<div style="width: 100%; justify-content: space-between; display: flex">
<div style="font-size: 16px"> 2.对接信息录入</div>
</div>
</template>
<div class="flex-flow">
<div class="base-title">Agentld</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.agentId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">AppKey</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.clientId" readonly />
</div>
</div>
<div class="flex-flow">
<div class="base-title">AppSecret</div>
<div class="base-message">
<a-input-password v-model:value="appConfigData.clientSecret" readonly />
</div>
</div>
<div style="margin-top: 20px; width: 100%; text-align: right">
<a-button @click="weEnterpriseEditClick">编辑</a-button>
</div>
</a-collapse-panel>
</a-collapse>
<div class="sync-padding">
<div style="font-size: 16px; width: 100%"> 3.数据同步</div>
<div style="margin-top: 20px" class="base-desc">
从企业微信同步到敲敲云
<a style="margin-left: 10px" @click="seeBindWeChat">查看已绑定的企业微信用户</a>
<div style="float: right">
<a-button @loading="btnLoading" @click="thirdUserByWechat">同步</a-button>
</div>
</div>
</div>
</div>
</div>
<ThirdAppConfigModal @register="registerAppConfigModal" @success="handleSuccess" />
<ThirdAppBindWeEnterpriseModal @register="registerBindAppConfigModal" @success="handleBindSuccess" />
</template>
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue';
import { getThirdConfigByTenantId } from './ThirdApp.api';
import ThirdAppConfigModal from './ThirdAppConfigModal.vue';
import { useModal } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { getTenantId } from '@/utils/auth';
import ThirdAppBindWeEnterpriseModal from './ThirdAppBindWeEnterpriseModal.vue';
import { Modal } from "ant-design-vue";
export default defineComponent({
name: 'ThirdAppWeEnterpriseConfigForm',
components: {
ThirdAppConfigModal,
ThirdAppBindWeEnterpriseModal,
},
setup() {
const btnLoading = ref<boolean>(false);
//第三方配置数据
const appConfigData = ref<any>({
agentId: '',
clientId: '',
clientSecret: '',
});
//企业微信钉钉配置modal
const [registerAppConfigModal, { openModal }] = useModal();
const [registerBindAppConfigModal, { openModal: openBindModal }] = useModal();
const { createMessage } = useMessage();
/**
* 初始化数据
*
* @param params
*/
async function initThirdAppConfigData(params) {
let values = await getThirdConfigByTenantId(params);
if (values) {
appConfigData.value = values;
}
}
/**
* 企业微信编辑
*/
async function weEnterpriseEditClick() {
let tenantId = getTenantId();
openModal(true, {
tenantId: tenantId,
thirdType: 'wechat_enterprise',
});
}
/**
* 获取企业微信绑定的用户
*/
async function thirdUserByWechat() {
openBindModal(true, { izBind: false });
}
/**
* 成功回调
*/
function handleSuccess() {
let tenantId = getTenantId();
initThirdAppConfigData({ tenantId: tenantId, thirdType: 'wechat_enterprise' });
}
/**
* 绑定成功返回值
*
* @param options
* @param item
*/
function handleBindSuccess(options, item) {
console.log("options:::",options)
console.log("item:::",item)
if (item.success) {
if (options != null) {
Modal.success(options);
} else {
createMessage.warning(item.message);
}
} else {
if (options && options.title) {
Modal.warning(options);
} else {
createMessage.warning({
content: '同步失败,请检查对接信息录入中是否填写正确,并确认是否已开启企业微信配置!',
duration: 5,
});
}
}
}
/**
* 查看已绑定的企业微信
*/
function seeBindWeChat() {
openBindModal(true,{ izBind: true })
}
onMounted(() => {
let tenantId = getTenantId();
initThirdAppConfigData({ tenantId: tenantId, thirdType: 'wechat_enterprise' });
});
return {
appConfigData,
weEnterpriseEditClick,
registerAppConfigModal,
registerBindAppConfigModal,
handleSuccess,
btnLoading,
thirdUserByWechat,
handleBindSuccess,
seeBindWeChat,
};
},
});
</script>
<style lang="less" scoped>
.header {
align-items: center;
box-sizing: border-box;
display: flex;
height: 50px;
justify-content: space-between;
font-weight: 700;
font-size: 18px;
color: @text-color;
}
.flex-flow {
display: flex;
min-height: 0;
}
.sync-padding {
padding: 12px 0 16px;
color: @text-color;
}
.base-collapse {
margin-top: 20px;
padding: 0 24px;
font-size: 20px;
.base-desc {
font-size: 14px;
color: @text-color;
}
.base-title {
width: 100px;
text-align: left;
height: 50px;
line-height: 50px;
}
.base-message {
width: 100%;
height: 50px;
line-height: 50px;
}
:deep(.ant-collapse-header) {
padding: 12px 0 16px;
}
:deep(.ant-collapse-content-box) {
padding-left: 0;
}
}
/*begin 兼容暗夜模式*/
//暗黑模式下卡片的边框设置成none
[data-theme='dark'] .base-collapse .ant-collapse {
border: none !important;
}
/*end 兼容暗夜模式*/
/*文档按钮问号样式*/
.sync-text {
margin-left: 2px;
cursor: pointer;
position: relative;
top: 2px;
}
</style>