|
@@ -4,17 +4,32 @@
|
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
|
<a-row>
|
|
<a-row>
|
|
<a-col :span="24">
|
|
<a-col :span="24">
|
|
- <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="username">
|
|
|
|
- <span slot="label">
|
|
|
|
- 用户名称
|
|
|
|
- <a-tooltip title="用户名称不为邮箱格式且sso中无当前用户时需设置密码">
|
|
|
|
- <a-icon type="question-circle-o" />
|
|
|
|
- </a-tooltip>
|
|
|
|
- </span>
|
|
|
|
- <a-input v-model="model.username" placeholder="请输入用户名称" :disabled="userDisabled" @blur="handleBlur"></a-input>
|
|
|
|
|
|
+ <a-form-model-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="interlockUserType">
|
|
|
|
+ <j-dict-select-tag
|
|
|
|
+ type="radio"
|
|
|
|
+ v-model="model.interlockUserType"
|
|
|
|
+ dictCode="interlock_user_type"
|
|
|
|
+ @change="changeType"
|
|
|
|
+ :disabled="userDisabled"
|
|
|
|
+ placeholder="请选择类型"/>
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
</a-col>
|
|
</a-col>
|
|
- <template v-if="!isEmail">
|
|
|
|
|
|
+ <!-- 前端将邮箱用户和非邮箱用户分开输入 -->
|
|
|
|
+ <template v-if="model.interlockUserType === 'email'">
|
|
|
|
+ <a-col :span="24">
|
|
|
|
+ <a-form-model-item label="用户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="usernameEmail">
|
|
|
|
+ <a-input v-model="model.usernameEmail" placeholder="请输入用户名称" :disabled="userDisabled"></a-input>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="model.interlockUserType === 'normal'">
|
|
|
|
+ <a-col :span="24">
|
|
|
|
+ <a-form-model-item label="用户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="usernameNormal">
|
|
|
|
+ <a-input v-model="model.usernameNormal" placeholder="请输入用户名称" :disabled="userDisabled" @blur="handleBlur"></a-input>
|
|
|
|
+ </a-form-model-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-if="model.interlockUserType === 'normal' && !isExistSSO && !userDisabled">
|
|
<a-col :span="24">
|
|
<a-col :span="24">
|
|
<a-form-model-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="password">
|
|
<a-form-model-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="password">
|
|
<a-input-password autocomplete="new-password" v-model="model.password" placeholder="请输入登录密码" />
|
|
<a-input-password autocomplete="new-password" v-model="model.password" placeholder="请输入登录密码" />
|
|
@@ -86,6 +101,7 @@
|
|
import { httpAction, getAction } from '@/api/manage'
|
|
import { httpAction, getAction } from '@/api/manage'
|
|
import { validateDuplicateValue } from '@/utils/util'
|
|
import { validateDuplicateValue } from '@/utils/util'
|
|
import cookie from 'js-cookie'
|
|
import cookie from 'js-cookie'
|
|
|
|
+import { postAction } from '../../../../api/manage'
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: 'InterlockUserForm',
|
|
name: 'InterlockUserForm',
|
|
@@ -103,6 +119,7 @@
|
|
return {
|
|
return {
|
|
userDisabled: false, // 修改时用户名不可修改
|
|
userDisabled: false, // 修改时用户名不可修改
|
|
model:{
|
|
model:{
|
|
|
|
+ interlockUserType: 'email'
|
|
},
|
|
},
|
|
labelCol: {
|
|
labelCol: {
|
|
xs: { span: 24 },
|
|
xs: { span: 24 },
|
|
@@ -114,22 +131,28 @@
|
|
},
|
|
},
|
|
confirmLoading: false,
|
|
confirmLoading: false,
|
|
validatorRules: {
|
|
validatorRules: {
|
|
- username: [
|
|
|
|
- { required: true, message: '请输入用户名称!', },
|
|
|
|
|
|
+ interlockUserType: [
|
|
|
|
+ { required: true, message: '请选择类型!', },
|
|
|
|
+ ],
|
|
|
|
+ usernameEmail: [
|
|
|
|
+ { required: true,
|
|
|
|
+ pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
|
|
|
|
+ message: '请输入邮箱格式的用户名称!'
|
|
|
|
+ },
|
|
|
|
+ { validator: (rule, value, callback) => validateDuplicateValue('interlock_user', 'username', value, this.model.id, callback)},
|
|
|
|
+ ],
|
|
|
|
+ usernameNormal: [
|
|
|
|
+ { required: true, message: '请输入用户名称!'},
|
|
{ validator: (rule, value, callback) => validateDuplicateValue('interlock_user', 'username', value, this.model.id, callback)},
|
|
{ validator: (rule, value, callback) => validateDuplicateValue('interlock_user', 'username', value, this.model.id, callback)},
|
|
- // {
|
|
|
|
- // pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
|
|
|
|
- // message: '邮箱格式不正确'
|
|
|
|
- // },
|
|
|
|
],
|
|
],
|
|
password: [
|
|
password: [
|
|
{ required: true,
|
|
{ required: true,
|
|
- // pattern:/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
|
|
|
|
|
|
+ pattern:/^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,20}$/,
|
|
message: '密码由8位数字、大小写字母和特殊符号组成!' },
|
|
message: '密码由8位数字、大小写字母和特殊符号组成!' },
|
|
{ validator: this.validateToNextPassword,trigger: 'change' }
|
|
{ validator: this.validateToNextPassword,trigger: 'change' }
|
|
],
|
|
],
|
|
confirmpassword: [
|
|
confirmpassword: [
|
|
- { required: true, message: '请重新输入登录密码!',},
|
|
|
|
|
|
+ { required: true, message: '请再次输入登录密码!',},
|
|
{ validator: this.compareToFirstPassword,}
|
|
{ validator: this.compareToFirstPassword,}
|
|
],
|
|
],
|
|
},
|
|
},
|
|
@@ -170,7 +193,7 @@
|
|
indeterminateManageHeader: false,
|
|
indeterminateManageHeader: false,
|
|
viewHeader: false,
|
|
viewHeader: false,
|
|
indeterminateViewHeader: false,
|
|
indeterminateViewHeader: false,
|
|
- isEmail: true, // 用户是否为邮箱格式
|
|
|
|
|
|
+ isExistSSO: true, // 用户是否为非邮箱格式且sso中无当前用户 true存在false不存在
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -208,12 +231,25 @@
|
|
const value = e.target.value;
|
|
const value = e.target.value;
|
|
this.confirmDirty = this.confirmDirty || !!value
|
|
this.confirmDirty = this.confirmDirty || !!value
|
|
},
|
|
},
|
|
|
|
+ changeType(){
|
|
|
|
+ // this.$refs.form.clearValidate(['username']);
|
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
|
+ },
|
|
handleBlur(){
|
|
handleBlur(){
|
|
- const emailRegExp = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/
|
|
|
|
- if(emailRegExp.test(this.model.username)){
|
|
|
|
- // 判断sso中是否有当前账户
|
|
|
|
- }
|
|
|
|
- this.isEmail = emailRegExp.test(this.model.username)
|
|
|
|
|
|
+ // 本地测试
|
|
|
|
+ // if(this.model.usernameNormal === 'asd'){
|
|
|
|
+ // this.isExistSSO = false
|
|
|
|
+ // } else {
|
|
|
|
+ // this.isExistSSO = true
|
|
|
|
+ // }
|
|
|
|
+ // 判断sso中是否有当前账户
|
|
|
|
+ postAction('/iotedgeCollectData/iotedgeCollectData/ifUserInSoo', {userName: this.model.username}).then(res => {
|
|
|
|
+ if(res.success){
|
|
|
|
+ this.isExistSSO = res.result
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.warning(res.message)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
// 新增
|
|
// 新增
|
|
async add () {
|
|
async add () {
|
|
@@ -258,8 +294,14 @@
|
|
// 获取当前选择账户的详情以及权限等
|
|
// 获取当前选择账户的详情以及权限等
|
|
getAction(this.url.queryById, {id: record.id}).then(response => {
|
|
getAction(this.url.queryById, {id: record.id}).then(response => {
|
|
this.model = Object.assign({}, response.result);
|
|
this.model = Object.assign({}, response.result);
|
|
|
|
+ // 根据类型将userName赋值
|
|
|
|
+ if(this.model.interlockUserType === 'email'){
|
|
|
|
+ this.model.usernameEmail = this.model.username
|
|
|
|
+ } else {
|
|
|
|
+ this.model.usernameNormal = this.model.username
|
|
|
|
+ }
|
|
this.model.isSystem = this.model.role === '0' ? true : false
|
|
this.model.isSystem = this.model.role === '0' ? true : false
|
|
- // console.log('model', this.model)
|
|
|
|
|
|
+ console.log('model', this.model)
|
|
var systemLimitList = response.result.systemLimitList
|
|
var systemLimitList = response.result.systemLimitList
|
|
// 重组数据
|
|
// 重组数据
|
|
var arr = interlockOrgData.map(ele => {
|
|
var arr = interlockOrgData.map(ele => {
|
|
@@ -544,6 +586,8 @@
|
|
// 触发表单验证
|
|
// 触发表单验证
|
|
this.$refs.form.validate(valid => {
|
|
this.$refs.form.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ // 根据类型赋值userName
|
|
|
|
+ this.model.username = this.model.interlockUserType === 'email' ? this.model.usernameEmail : this.model.usernameNormal
|
|
// console.log(this.tpmTreeData)
|
|
// console.log(this.tpmTreeData)
|
|
// 二维转一维
|
|
// 二维转一维
|
|
var arr = []
|
|
var arr = []
|