perf: i18n System Settings -> General,Org,Notifications

This commit is contained in:
Bai
2024-05-20 18:39:12 +08:00
parent cee00b0382
commit 2ffcf7bd26
17 changed files with 77 additions and 172 deletions

View File

@@ -6,7 +6,7 @@
<div style="height: 100%">
<el-tabs
v-if="tabIndices.length > 0"
v-if="tabIndices.length > 1"
slot="submenu"
v-model="iActiveMenu"
class="page-submenu"

View File

@@ -24,7 +24,7 @@ export default {
name: 'Basic',
component: () => import('@/views/settings/Basic'),
meta: {
title: i18n.t('Basic'),
title: i18n.t('BasicSettings'),
icon: 'basic',
permissions: ['settings.view_setting']
}
@@ -414,7 +414,7 @@ export default {
path: '/settings/tasks',
component: empty,
meta: {
title: i18n.t('TaskList'),
title: i18n.t('SystemTasks'),
icon: 'tasks',
permissions: ['ops.view_celerytask']
},
@@ -424,7 +424,7 @@ export default {
name: 'TaskList',
component: () => import('@/views/settings/Task/index.vue'),
meta: {
title: i18n.t('TaskList'),
title: i18n.t('SystemTasks'),
permissions: ['ops.view_celerytask']
}
},

View File

@@ -20,7 +20,7 @@ export default {
[
this.$t('Basic'),
[
'FORGOT_PASSWORD_URL', 'LOGIN_REDIRECT_MSG_ENABLED'
'EMAIL_SUFFIX', 'FORGOT_PASSWORD_URL', 'LOGIN_REDIRECT_MSG_ENABLED'
]
]
],

View File

@@ -24,25 +24,13 @@ export default {
data() {
return {
fields: [
[
this.$t('BasicInfo'), [
'SITE_URL' // 'USER_GUIDE_URL',
]
],
[this.$t('NavHelp'), [
'HELP_DOCUMENT_URL', 'HELP_SUPPORT_URL'
]]
[this.$t('Basic'), ['SITE_URL']], // 'USER_GUIDE_URL',]
[this.$t('Navigation'), ['HELP_DOCUMENT_URL', 'HELP_SUPPORT_URL']]
],
fieldsMeta: {
SITE_URL: {
rules: [rules.Required]
},
HELP_DOCUMENT_URL: {
helpText: this.$t('HelpDocumentTip')
},
HELP_SUPPORT_URL: {
helpText: this.$t('HelpSupportTip')
rules: [rules.Required],
helpText: this.$t('SiteURLTip')
}
},
successUrl: { name: 'Basic' },

View File

@@ -1,11 +1,11 @@
<template>
<div>
<el-button size="mini" type="primary" @click="visible = !visible"> {{ $t("Setting") }} </el-button>
<el-button size="mini" type="primary" icon="el-icon-setting" @click="visible = !visible"> {{ $t("Settings...") }} </el-button>
<Dialog
v-if="visible"
:show-cancel="false"
:show-confirm="false"
:title="$tc('CreateUserSetting')"
:title="$tc('Template')"
:visible.sync="visible"
width="70%"
@confirm="onConfirm()"
@@ -21,7 +21,7 @@ import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm
import { Dialog } from '@/components'
export default {
name: 'EmailContent',
name: 'EmailTemplate',
components: {
GenericCreateUpdateForm,
Dialog
@@ -30,8 +30,12 @@ export default {
return {
visible: false,
fields: [
'EMAIL_CUSTOM_USER_CREATED_SUBJECT', 'EMAIL_CUSTOM_USER_CREATED_HONORIFIC',
'EMAIL_CUSTOM_USER_CREATED_BODY'
[this.$t('General'), ['EMAIL_SUBJECT_PREFIX']],
[this.$t('User creation'),
[
'EMAIL_CUSTOM_USER_CREATED_SUBJECT', 'EMAIL_CUSTOM_USER_CREATED_HONORIFIC', 'EMAIL_CUSTOM_USER_CREATED_BODY'
]
]
],
successUrl: { name: 'Settings', params: { activeMenu: 'EmailContent' }},
fieldsMeta: {

View File

@@ -1,94 +0,0 @@
<template>
<div>
<el-button size="mini" type="primary" @click="visible = !visible"> {{ $t("Setting") }} </el-button>
<Dialog
v-if="visible"
:destroy-on-close="true"
:show-cancel="false"
:show-confirm="false"
:title="$tc('SMTP')"
:visible.sync="visible"
width="70%"
@confirm="onConfirm()"
>
<GenericCreateUpdateForm v-bind="$data" />
</Dialog>
</div>
</template>
<script>
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm/index.vue'
import { Dialog } from '@/components'
import { UpdateToken } from '@/components/Form/FormFields'
export default {
name: 'SMTP',
components: {
GenericCreateUpdateForm,
Dialog
},
data() {
return {
visible: false,
encryptedFields: ['EMAIL_HOST_PASSWORD'],
fields: [
[
this.$t('BasicInfo'),
[
'EMAIL_PROTOCOL', 'EMAIL_HOST', 'EMAIL_PORT', 'EMAIL_HOST_USER',
'EMAIL_HOST_PASSWORD', 'EMAIL_USE_SSL', 'EMAIL_USE_TLS'
]
]
],
successUrl: { name: 'Settings', params: { activeMenu: 'EmailContent' }},
fieldsMeta: {
EMAIL_PORT: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
EMAIL_HOST_PASSWORD: {
component: UpdateToken
},
'EMAIL_CUSTOM_USER_CREATED_BODY': {
el: {
type: 'textarea',
rows: 3
}
},
EMAIL_USE_SSL: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
EMAIL_USE_TLS: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
}
},
url: '/api/v1/settings/setting/?category=email',
submitMethod() {
return 'patch'
},
onConfirm() {
},
cleanFormValue(data) {
if (!data['EMAIL_HOST_PASSWORD']) {
delete data['EMAIL_HOST_PASSWORD']
}
if (data['EMAIL_USE_SSL'] === null) {
delete data['EMAIL_USE_SSL']
}
if (data['EMAIL_USE_TLS'] === null) {
delete data['EMAIL_USE_TLS']
}
if (data['EMAIL_PORT'] === null) {
delete data['EMAIL_PORT']
}
return data
}
}
},
methods: {}
}
</script>
<style scoped>
</style>

View File

@@ -6,15 +6,14 @@
v-bind="$data"
/>
</IBox>
</template>
<script>
import { IBox } from '@/components'
import { GenericCreateUpdateForm } from '@/layout/components'
import { testEmailSetting } from '@/api/settings'
import EmailContent from './EmailContent.vue'
import SMTP from './SMTP.vue'
import EmailTemplate from './EmailTemplate.vue'
import { UpdateToken } from '@/components/Form/FormFields'
import rules from '@/components/Form/DataForm/rules'
export default {
@@ -26,39 +25,41 @@ export default {
data() {
const vm = this
return {
encryptedFields: ['EMAIL_HOST_PASSWORD'],
fields: [
[
this.$t('Server'),
[
'SMTP'
]
],
[
this.$t('MailSend'),
[
'EMAIL_FROM', 'EMAIL_SUBJECT_PREFIX'
]
],
[
this.$t('EmailContent'),
[
'CREATE_USER_MSG'
]
],
[
this.$t('Other'),
[
'EMAIL_RECIPIENT', 'EMAIL_SUFFIX'
]
[this.$t('Server'), [
'EMAIL_PROTOCOL',
'EMAIL_HOST',
'EMAIL_PORT',
'EMAIL_HOST_USER',
'EMAIL_HOST_PASSWORD',
'EMAIL_FROM',
'EMAIL_USE_SSL',
'EMAIL_USE_TLS'
]
],
[this.$t('Other'), ['CREATE_USER_MSG']],
[this.$t('Test'), ['EMAIL_RECIPIENT']]
],
fieldsMeta: {
EMAIL_PORT: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
EMAIL_HOST_PASSWORD: {
component: UpdateToken
},
EMAIL_HOST_USER: {
rules: [
rules.EmailCheck,
rules.Required
]
},
EMAIL_CUSTOM_USER_CREATED_BODY: {
el: {
type: 'textarea',
rows: 3
}
},
EMAIL_FROM: {
rules: [
rules.EmailCheck
@@ -69,13 +70,16 @@ export default {
rules.EmailCheck
]
},
CREATE_USER_MSG: {
label: this.$t('CreateUserSetting'),
component: EmailContent
EMAIL_USE_SSL: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
SMTP: {
label: this.$t('SMTP'),
component: SMTP
EMAIL_USE_TLS: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
CREATE_USER_MSG: {
label: this.$t('EmailTemplate'),
component: EmailTemplate,
helpTip: this.$t('EmailTemplateHelpTip')
}
},
hasDetailInMsg: false,
@@ -104,6 +108,9 @@ export default {
if (data[key] === null) {
delete data[key]
}
if (!data['EMAIL_HOST_PASSWORD']) {
delete data['EMAIL_HOST_PASSWORD']
}
}
)
return data

View File

@@ -1,6 +1,6 @@
<template>
<div>
<el-button size="mini" type="primary" @click="visible=true">{{ $t('Setting') }}</el-button>
<el-button size="mini" type="primary" icon="el-icon-setting" @click="visible=true">{{ $t('Settings...') }}</el-button>
<Dialog
v-if="visible"
:destroy-on-close="true"

View File

@@ -39,14 +39,14 @@ export default {
],
fields: [
[
this.$t('BasicInfo'),
this.$t('Basic'),
[
'CMPP2_HOST', 'CMPP2_PORT', 'CMPP2_SP_ID', 'CMPP2_SP_SECRET', 'CMPP2_SRC_ID', 'CMPP2_SERVICE_ID',
'CMPP2_VERIFY_SIGN_NAME', 'CMPP2_VERIFY_TEMPLATE_CODE'
]
],
[
this.$t('Other'),
this.$t('Test'),
[
'SMS_TEST_PHONE'
]

View File

@@ -37,19 +37,19 @@ export default {
],
fields: [
[
this.$t('BasicInfo'),
this.$t('Basic'),
[
'ALIBABA_ACCESS_KEY_ID', 'ALIBABA_ACCESS_KEY_SECRET'
]
],
[
this.$t('VerifySignTmpl'),
this.$t('Template'),
[
'ALIBABA_VERIFY_SIGN_NAME', 'ALIBABA_VERIFY_TEMPLATE_CODE'
]
],
[
this.$t('Other'),
this.$t('Test'),
[
'SMS_TEST_PHONE'
]

View File

@@ -37,13 +37,13 @@ export default {
],
fields: [
[
this.$t('BasicInfo'),
this.$t('Basic'),
[
'CUSTOM_SMS_URL', 'CUSTOM_SMS_REQUEST_METHOD', 'CUSTOM_SMS_API_PARAMS'
]
],
[
this.$t('Other'),
this.$t('Test'),
[
'SMS_TEST_PHONE'
]

View File

@@ -41,7 +41,7 @@ export default {
],
fields: [
[
this.$t('Other'),
this.$t('Test'),
[
'SMS_TEST_PHONE'
]

View File

@@ -39,19 +39,19 @@ export default {
],
fields: [
[
this.$t('BasicInfo'),
this.$t('Basic'),
[
'HUAWEI_APP_KEY', 'HUAWEI_APP_SECRET', 'HUAWEI_SMS_ENDPOINT'
]
],
[
this.$t('VerifySignTmpl'),
this.$t('Template'),
[
'HUAWEI_SIGN_CHANNEL_NUM', 'HUAWEI_VERIFY_SIGN_NAME', 'HUAWEI_VERIFY_TEMPLATE_CODE'
]
],
[
this.$t('Other'),
this.$t('Test'),
[
'SMS_TEST_PHONE'
]

View File

@@ -37,19 +37,19 @@ export default {
],
fields: [
[
this.$t('BasicInfo'),
this.$t('Basic'),
[
'TENCENT_SECRET_ID', 'TENCENT_SECRET_KEY', 'TENCENT_SDKAPPID'
]
],
[
this.$t('VerifySignTmpl'),
this.$t('Template'),
[
'TENCENT_VERIFY_SIGN_NAME', 'TENCENT_VERIFY_TEMPLATE_CODE'
]
],
[
this.$t('Other'),
this.$t('Test'),
[
'SMS_TEST_PHONE'
]

View File

@@ -30,7 +30,7 @@ export default {
]
],
[
this.$t('SMSProvider'), [
this.$t('Provider'), [
'ALIYUN', 'QCLOUD', 'HUAWEICLOUD', 'CMPP2', 'SMSCustom', 'SMSFileCustom'
]
]

View File

@@ -36,7 +36,7 @@
<el-table-column :label="$tc('Actions')" width="200">
<template v-slot="scope">
<el-button v-if="!scope.row.children" type="small" @click="onOpenDialog(scope.row)">
{{ $t('ChangeReceiver') }}
{{ $t('EditRecipient') }}
</el-button>
</template>
</el-table-column>
@@ -45,7 +45,7 @@
<SelectDialog
v-if="dialogVisible"
:selected-users="dialogSelectedUsers"
:title="$tc('ChangeReceiver')"
:title="$tc('EditRecipient')"
:visible.sync="dialogVisible"
@cancel="dialogVisible=false"
@submit="onDialogSelectSubmit"

View File

@@ -3,7 +3,7 @@
<GenericListPage :header-actions="headerActions" :table-config="tableConfig" />
<Dialog
:show-buttons="false"
:title="$tc('Setting')"
:title="$tc('General')"
:visible.sync="visible"
>
<GenericCreateUpdateForm v-bind="form" @submitSuccess="visible=false" />
@@ -110,7 +110,7 @@ export default {
canCreate: this.$hasPerm('orgs.add_organization'),
extraActions: [
{
title: this.$t('Setting'),
title: this.$t('Settings...'),
icon: 'el-icon-setting',
callback: () => {
this.visible = true