|
@@ -21,7 +21,7 @@
|
|
|
:model="ruleForm"
|
|
|
status-icon
|
|
|
:size="'mini'"
|
|
|
- :rules="rulesThis"
|
|
|
+ :rules="rules"
|
|
|
label-width="80px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
@@ -60,7 +60,7 @@
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item v-loading="departLoading" label="部门">
|
|
|
+ <el-form-item v-loading="departLoading" label="部门" prop="itemid">
|
|
|
<el-cascader
|
|
|
v-model="ruleForm.itemid"
|
|
|
:disabled="!companyNo"
|
|
@@ -68,6 +68,7 @@
|
|
|
:options="departData"
|
|
|
:props="{value:'id',label:'name',children:'child',expandTrigger:'hover'}"
|
|
|
placeholder="请选择部门"
|
|
|
+ @change="handleDepartChange"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
@@ -94,44 +95,11 @@ import asyncRequest from '@/apis/service/interest/account'
|
|
|
import companyHelper from '@/mixins/companyHelper'
|
|
|
import resToken from '@/mixins/resToken'
|
|
|
|
|
|
-import {
|
|
|
- isMobile,
|
|
|
- isEmoticon
|
|
|
-} from '@/utils/validate'
|
|
|
-
|
|
|
export default {
|
|
|
name: 'Account',
|
|
|
mixins: [resToken, companyHelper],
|
|
|
props: ['showModel', 'id', 'isDetail', 'sitem'],
|
|
|
data() {
|
|
|
- const validatename = (_, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('真实姓名不能为空!'))
|
|
|
- } else {
|
|
|
- if (value.length < 2 || value.length > 12) {
|
|
|
- callback(new Error('真实姓名规则为2~12位!'))
|
|
|
- } else {
|
|
|
- if (isEmoticon(value)) {
|
|
|
- callback(new Error('真实姓名规则为2~12位!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const validatemobile = (rule, value, callback) => {
|
|
|
- if (value === '') {
|
|
|
- callback(new Error('手机号不能为空!'))
|
|
|
- } else {
|
|
|
- if (!isMobile(value)) {
|
|
|
- callback(new Error('手机号格式不正确!'))
|
|
|
- } else {
|
|
|
- callback()
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return {
|
|
|
companyNo: '',
|
|
|
roleList: [],
|
|
@@ -155,24 +123,11 @@ export default {
|
|
|
platformoptions: [],
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
- nickname: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- validator: validatename,
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ],
|
|
|
- mobile: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- validator: validatemobile,
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ],
|
|
|
- role_id: [
|
|
|
+ itemid: [
|
|
|
{
|
|
|
+ type: 'array',
|
|
|
required: true,
|
|
|
- message: '请选择角色',
|
|
|
+ message: '请选择部门',
|
|
|
trigger: 'change'
|
|
|
}
|
|
|
]
|
|
@@ -199,6 +154,10 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleDepartChange() {
|
|
|
+ console.log(11)
|
|
|
+ this.$nextTick(() => this.$refs.ruleForm.validateField('itemid'))
|
|
|
+ },
|
|
|
async initForm() {
|
|
|
this.loading = true
|
|
|
|
|
@@ -210,11 +169,11 @@ export default {
|
|
|
if (this.id === 'add') {
|
|
|
this.rulesThis = this.rules
|
|
|
} else {
|
|
|
- if (this.isDetail) {
|
|
|
- this.rulesThis = {}
|
|
|
- } else {
|
|
|
- this.rulesThis = this.rules
|
|
|
- }
|
|
|
+ // if (this.isDetail) {
|
|
|
+ // this.rulesThis = {}
|
|
|
+ // } else {
|
|
|
+ // this.rulesThis = this.rules
|
|
|
+ // }
|
|
|
}
|
|
|
this.loading = false
|
|
|
},
|
|
@@ -339,10 +298,10 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
async submitForm() {
|
|
|
- if (!this.ruleForm.itemid || this.ruleForm.itemid.length === 0) {
|
|
|
- this.$message.warning('请选择部门')
|
|
|
- return
|
|
|
- }
|
|
|
+ // if (!this.ruleForm.itemid || this.ruleForm.itemid.length === 0) {
|
|
|
+ // this.$message.warning('请选择部门')
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
await this.$refs.ruleForm.validate(async(valid) => {
|
|
|
if (valid) {
|