diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index 1abf829a..7c15bae5 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -447,7 +447,8 @@
"enable": "Enabled",
"disable": "Disabled",
"local_creation": "Local",
- "feishu": "Feishu",
+ "lark": "Lark",
+ "larksuite": "Larksuite",
"dingtalk": "DingTalk",
"wechat_for_business": "WeChat for business",
"1240_results": "{msg} results",
diff --git a/frontend/src/i18n/ko-KR.json b/frontend/src/i18n/ko-KR.json
index 81df893a..9d389ead 100644
--- a/frontend/src/i18n/ko-KR.json
+++ b/frontend/src/i18n/ko-KR.json
@@ -447,7 +447,8 @@
"enable": "활성화",
"disable": "비활성화",
"local_creation": "로컬 생성",
- "feishu": "페이슈",
+ "lark": "페이슈",
+ "larksuite": "페이수 (Pei-su)",
"dingtalk": "딩톡",
"wechat_for_business": "기업용 위챗",
"1240_results": "{msg}개 결과 ",
diff --git a/frontend/src/i18n/zh-CN.json b/frontend/src/i18n/zh-CN.json
index 48f0567b..d3a9b69f 100644
--- a/frontend/src/i18n/zh-CN.json
+++ b/frontend/src/i18n/zh-CN.json
@@ -447,7 +447,8 @@
"enable": "启用",
"disable": "禁用",
"local_creation": "本地创建",
- "feishu": "飞书",
+ "lark": "飞书",
+ "larksuite": "国际飞书",
"dingtalk": "钉钉",
"wechat_for_business": "企业微信",
"1240_results": "{msg} 个结果 ",
diff --git a/frontend/src/views/login/xpack/QrTab.vue b/frontend/src/views/login/xpack/QrTab.vue
index 261d5343..77e3a9c0 100644
--- a/frontend/src/views/login/xpack/QrTab.vue
+++ b/frontend/src/views/login/xpack/QrTab.vue
@@ -6,12 +6,8 @@
name="wecom"
>
-
-
+
+
@@ -51,7 +47,7 @@
- {{ t('system.international_feishu') }}
+ {{ t('user.larksuite') }}
diff --git a/frontend/src/views/system/platform/wecom/WecomEdit.vue b/frontend/src/views/system/platform/PlatformForm.vue
similarity index 60%
rename from frontend/src/views/system/platform/wecom/WecomEdit.vue
rename to frontend/src/views/system/platform/PlatformForm.vue
index b93488ee..74de4849 100644
--- a/frontend/src/views/system/platform/wecom/WecomEdit.vue
+++ b/frontend/src/views/system/platform/PlatformForm.vue
@@ -4,72 +4,50 @@ import { ElMessage, ElLoading } from 'element-plus-secondary'
import { request } from '@/utils/request'
import { useI18n } from 'vue-i18n'
import type { FormInstance, FormRules } from 'element-plus-secondary'
+import { settingMapping } from './common/SettingTemplate'
const { t } = useI18n()
const dialogVisible = ref(false)
const loadingInstance = ref
| null>(null)
-const wecomForm = ref()
-interface WecomkForm {
- corpid?: string
- agent_id?: string
- corpsecret?: string
-}
+const platformForm = ref()
+
const state = reactive({
- form: reactive({
- agent_id: '',
- corpid: '',
- corpsecret: '',
- }),
+ form: reactive({}),
+ settingList: [] as any[],
})
const origin = ref(6)
const id = ref()
-const rule = reactive({
- agent_id: [
- {
- required: true,
- message: t('common.require'),
- trigger: 'blur',
- },
- {
- min: 5,
- max: 20,
- message: t('common.input_limit', [5, 20]),
- trigger: 'blur',
- },
- ],
- corpid: [
- {
- required: true,
- message: t('common.require'),
- trigger: 'blur',
- },
- {
- min: 5,
- max: 20,
- message: t('common.input_limit', [5, 20]),
- trigger: 'blur',
- },
- ],
- corpsecret: [
- {
- required: true,
- message: t('common.require'),
- trigger: 'blur',
- },
- {
- min: 5,
- max: 100,
- message: t('common.input_limit', [5, 100]),
- trigger: 'blur',
- },
- ],
-})
-
+const rule = reactive({})
+const formTitle = ref('')
+const busiMapping = {
+ 6: 'wecom',
+ 7: 'dingtalk',
+ 8: 'lark',
+ 9: 'larksuite',
+} as any
+const initForm = (row: any) => {
+ state.settingList.forEach((item: any) => {
+ const key = item.realKey
+ rule[key] = [
+ {
+ required: true,
+ message: t('common.require'),
+ trigger: 'blur',
+ },
+ {
+ min: 5,
+ max: 255,
+ message: t('common.input_limit', [5, 255]),
+ trigger: 'blur',
+ },
+ ]
+ state.form[key] = row[key]
+ })
+}
const edit = (row: any) => {
- state.form = {
- agent_id: row.agent_id,
- corpid: row.corpid,
- corpsecret: row.corpsecret,
- }
+ state.settingList = settingMapping[row.type]
+ initForm(row)
+ origin.value = row.type
+ formTitle.value = row.title
if (row?.id) {
id.value = row.id
}
@@ -86,7 +64,7 @@ const submitForm = async (formEl: FormInstance | undefined) => {
const data = {
id: origin.value,
type: origin.value,
- name: 'wecom',
+ name: busiMapping[origin.value],
config: JSON.stringify(param),
}
const method = id.value
@@ -122,10 +100,15 @@ const resetForm = (formEl: FormInstance | undefined) => {
formEl.resetFields()
dialogVisible.value = false
id.value = null
+ origin.value = 6
+ formTitle.value = ''
+ state.settingList = []
+ const keys = Object.keys(rule)
+ keys.forEach((key: string) => delete rule[key])
}
const reset = () => {
- resetForm(wecomForm.value)
+ resetForm(platformForm.value)
}
const showLoading = () => {
@@ -137,28 +120,34 @@ const closeLoading = () => {
loadingInstance.value?.close()
}
-const validate = () => {
- const url = '/system/authentication/status'
- const config_data = state.form
- const data = {
- type: origin.value,
- name: 'wecom',
- config: JSON.stringify(config_data),
- }
- showLoading()
- request
- .patch(url, data)
- .then((res) => {
- if (res) {
- ElMessage.success(t('ds.connection_success'))
- } else {
- ElMessage.error(t('ds.connection_failed'))
- }
- })
- .finally(() => {
- closeLoading()
- emits('saved')
- })
+const validate = async (formEl: FormInstance | undefined) => {
+ if (!formEl) return
+ await formEl.validate((valid) => {
+ if (!valid) {
+ return
+ }
+ const url = '/system/authentication/status'
+ const config_data = state.form
+ const data = {
+ type: origin.value,
+ name: busiMapping[origin.value],
+ config: JSON.stringify(config_data),
+ }
+ showLoading()
+ request
+ .patch(url, data)
+ .then((res) => {
+ if (res) {
+ ElMessage.success(t('ds.connection_success'))
+ } else {
+ ElMessage.error(t('ds.connection_failed'))
+ }
+ })
+ .finally(() => {
+ closeLoading()
+ emits('saved')
+ })
+ })
}
defineExpose({
@@ -169,46 +158,46 @@ defineExpose({
-
-
-
-
-
-
-
-
-
+
+
diff --git a/frontend/src/views/system/platform/wecom/WecomInfo.vue b/frontend/src/views/system/platform/PlatformInfo.vue
similarity index 69%
rename from frontend/src/views/system/platform/wecom/WecomInfo.vue
rename to frontend/src/views/system/platform/PlatformInfo.vue
index f53ed258..ecefe258 100644
--- a/frontend/src/views/system/platform/wecom/WecomInfo.vue
+++ b/frontend/src/views/system/platform/PlatformInfo.vue
@@ -4,9 +4,9 @@