fix: 优化手机号区号更新为空及展示问题

This commit is contained in:
jiangweidong
2023-04-10 16:43:49 +08:00
committed by Jiangjie.Bai
parent 023fb03490
commit 2361b16c30
5 changed files with 17 additions and 9 deletions

View File

@@ -1,10 +1,11 @@
<template>
<div>
<el-input v-model="rawValue.phone" placeholder="请输入手机号码" @change="OnInputChange">
<el-input v-model="rawValue.phone" :placeholder="$tc('users.inputPhone')" @input="OnInputChange">
<el-select
slot="prepend"
:value="rawValue.code"
style="width: 80px;"
:placeholder="$tc('common.Select')"
style="width: 90px;"
@change="OnChange"
>
<el-option
@@ -51,14 +52,18 @@ export default {
]
}
},
computed: {},
computed: {
fullPhone() {
return `${this.rawValue.code} ${this.rawValue.phone}`
}
},
mounted() {
this.rawValue = this.value
this.rawValue = this.value || {}
if (!this.rawValue?.code) {
this.rawValue.code = '+86'
this.rawValue.phone = ''
} else {
const value = `${this.rawValue.code}${this.rawValue.phone}`
this.$emit('input', value)
this.$emit('input', this.fullPhone)
}
},
methods: {
@@ -67,8 +72,7 @@ export default {
this.OnInputChange()
},
OnInputChange() {
const value = `${this.rawValue.code}${this.rawValue.phone}`
this.$emit('input', value)
this.$emit('input', this.fullPhone)
}
}
}

View File

@@ -1720,6 +1720,7 @@
"Set": "Set",
"Login": "Users login",
"InviteSuccess": "Invite success",
"inputPhone": "Please enter your mobile phone number",
"FileEncryptionPassword": "File encryption password",
"OrgRoles": "Org roles",
"RoleUsers": "Role users",

View File

@@ -1712,6 +1712,7 @@
"Set": "設定",
"Login": "ユーザー登録",
"InviteSuccess": "成功招待",
"inputPhone": "携帯電話の番号をお願いします",
"FileEncryptionPassword": "ファイル暗号化パスワード",
"RoleUsers": "承認されたユーザー",
"RoleInfo": "ロール情報",

View File

@@ -1708,6 +1708,7 @@
"Set": "已设置",
"Login": "用户登录",
"InviteSuccess": "邀请成功",
"inputPhone": "请输入手机号码",
"FileEncryptionPassword": "文件加密密码",
"RoleUsers": "授权用户",
"RoleInfo": "角色信息",

View File

@@ -180,7 +180,8 @@ export default {
{
key: this.$t('users.Phone'),
formatter: () => {
return <div>{this.object.phone.phone}</div>
const phoneObj = this.object.phone
return <div>{phoneObj?.code} {phoneObj?.phone}</div>
}
},
'wecom_id', 'dingtalk_id', 'feishu_id',