| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- <template>
- <detail
- :onManager="onManager"
- :data="data"
- :base-info="baseInfo"
- :extraInfo="extraInfo"
- :hiddenKeys="['project_domain', 'tenant', 'status']"
- :show-desc="false"
- :is-edit-name="false" />
- </template>
- <script>
- import {
- getConfigTypeTableColumn,
- getAttirubuteTableColumn,
- } from '../utils/columns'
- import {
- getEnabledTableColumn,
- // getSwitchTableColumn
- } from '@/utils/common/tableColumn'
- export default {
- name: 'NotifyConfigDetail',
- props: {
- data: {
- type: Object,
- required: true,
- },
- onManager: {
- type: Function,
- required: true,
- },
- },
- data () {
- return {
- baseInfo: [
- getConfigTypeTableColumn(),
- getAttirubuteTableColumn(),
- ],
- configInfo: {
- email: [
- {
- title: this.$t('system.text_255'),
- items: [
- {
- field: 'hostname',
- title: this.$t('system.text_269'),
- formatter: ({ row }) => {
- return row.content?.hostname || '-'
- },
- },
- {
- field: 'hostport',
- title: this.$t('system.text_270'),
- formatter: ({ row }) => {
- return row.content?.hostport || '-'
- },
- },
- {
- field: 'username',
- title: this.$t('system.text_126'),
- formatter: ({ row }) => {
- return row.content?.username || '-'
- },
- },
- getEnabledTableColumn({ title: 'SSL', field: 'content.ssl_global' }),
- {
- field: 'sender_address',
- title: this.$t('iam.sender_address'),
- formatter: ({ row }) => {
- return row.content?.sender_address || '-'
- },
- },
- // getSwitchTableColumn({
- // field: 'content.ssl_global',
- // title: 'SSL',
- // change: val => {
- // this.onManager('update', {
- // id: this.data.id,
- // managerArgs: {
- // data: { content: { ...this.data.content, ssl_global: val } },
- // },
- // })
- // },
- // }),
- ],
- },
- ],
- mobile: [
- {
- title: this.$t('system.text_255'),
- items: [
- {
- field: 'sms_driver',
- title: this.$t('notify.configs.sms_driver'),
- formatter: ({ row }) => {
- if (row.content && row.content.sms_driver) {
- if (row.content.sms_driver === 'smsaliyun') {
- return this.$t('providers.aliyun')
- } else if (row.content.sms_driver === 'smshuawei') {
- return this.$t('providers.huawei')
- }
- }
- return '-'
- },
- },
- {
- field: 'access_key_id',
- title: 'Access Key ID',
- formatter: ({ row }) => {
- return row.content?.access_key_id || '-'
- },
- },
- {
- field: 'signature',
- title: this.$t('system.text_288'),
- formatter: ({ row }) => {
- return row.content?.signature || '-'
- },
- },
- ],
- },
- {
- title: this.$t('system.mobile_cn_tpl'),
- items: [
- {
- field: 'verifiyCode',
- title: this.$t('system.text_295'),
- formatter: ({ row }) => {
- return this.smsTplInfo?.verifiyCode || '-'
- },
- },
- {
- field: 'alertsCode',
- title: this.$t('system.alert_tpl'),
- formatter: ({ row }) => {
- return this.smsTplInfo?.alertsCode || '-'
- },
- },
- {
- field: 'errorCode',
- title: this.$t('system.error_login_tpl'),
- formatter: ({ row }) => {
- return this.smsTplInfo?.errorCode || '-'
- },
- },
- ],
- },
- {
- title: this.$t('system.mobile_en_tpl'),
- items: [
- {
- field: 'verifiyCodeUn',
- title: this.$t('system.text_295'),
- formatter: ({ row }) => {
- return this.smsTplInfo?.verifiyCodeUn || '-'
- },
- },
- {
- field: 'alertsCode',
- title: this.$t('system.alert_tpl'),
- formatter: ({ row }) => {
- return this.smsTplInfo?.alertsCodeUn || '-'
- },
- },
- {
- field: 'errorCode',
- title: this.$t('system.error_login_tpl'),
- formatter: ({ row }) => {
- return this.smsTplInfo?.errorCodeUn || '-'
- },
- },
- ],
- },
- ],
- feishu: [
- {
- title: this.$t('system.text_255'),
- items: [
- {
- field: 'app_id',
- title: 'AppID',
- formatter: ({ row }) => {
- return row.content?.app_id || '-'
- },
- },
- ],
- },
- ],
- dingtalk: [
- {
- title: this.$t('system.text_255'),
- items: [
- {
- field: 'agent_id',
- title: 'AgentId',
- formatter: ({ row }) => {
- return row.content?.agent_id || '-'
- },
- },
- {
- field: 'app_key',
- title: 'AppKey',
- formatter: ({ row }) => {
- return row.content?.app_key || '-'
- },
- },
- ],
- },
- ],
- workwx: [
- {
- title: this.$t('system.text_255'),
- items: [
- {
- field: 'corp_id',
- title: this.$t('system.wecom.corp_id'),
- formatter: ({ row }) => {
- return row.content?.corp_id || '-'
- },
- },
- {
- field: 'agent_id',
- title: 'AgentId',
- formatter: ({ row }) => {
- return row.content?.agent_id || '-'
- },
- },
- ],
- },
- ],
- },
- smsTplInfo: {},
- }
- },
- computed: {
- extraInfo () {
- return this.configInfo[this.data.type] || []
- },
- },
- created () {
- this.notifytemplatesManager = new this.$Manager('notifytemplates', 'v1')
- this.fetchNotifyTpl()
- },
- destroyed () {
- this.notifytemplatesManager = null
- },
- methods: {
- fetchNotifyTpl () {
- const { type } = this.data
- if (type !== 'mobile') return
- this.notifytemplatesManager.list({ params: { contact_type: type } })
- .then(res => {
- const { data: { data } } = res
- data.forEach(v => {
- if (v.lang === 'cn') {
- switch (v.topic) {
- case 'VERIFY':
- this.$set(this.smsTplInfo, 'verifiyCode', v.content)
- break
- case 'MONITOR':
- this.$set(this.smsTplInfo, 'alertsCode', v.content)
- break
- case 'USER_LOGIN_EXCEPTION':
- this.$set(this.smsTplInfo, 'errorCode', v.content)
- break
- }
- }
- if (v.lang === 'en') {
- switch (v.topic) {
- case 'VERIFY':
- this.$set(this.smsTplInfo, 'verifiyCodeUn', v.content)
- break
- case 'MONITOR':
- this.$set(this.smsTplInfo, 'alertsCodeUn', v.content)
- break
- case 'USER_LOGIN_EXCEPTION':
- this.$set(this.smsTplInfo, 'errorCodeUn', v.content)
- break
- }
- }
- })
- })
- .catch(err => {
- console.error(err)
- })
- },
- },
- }
- </script>
|