Commit 77c17659 by 胡悦

修改字典数据路由和禁用提示

1 parent 64d9ec70
...@@ -44,6 +44,24 @@ ...@@ -44,6 +44,24 @@
</template> </template>
<template v-else-if="item.type == 'select'"> <template v-else-if="item.type == 'select'">
<el-select <el-select
v-if="item.visibleFunc"
v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'"
:filterable="item.filterable || false"
@change="selectChange"
@visible-change="item.visibleFunc"
>
<el-option
v-for="i in item.options"
:key="i[item.value] || i.value"
:label="i[item.key] || i.label"
:value="i[item.value] || i.value"
:disabled="i.disabled"
>
</el-option>
</el-select>
<el-select
v-else
v-model="ruleForm[item.prop]" v-model="ruleForm[item.prop]"
:placeholder="item.placeholder || '请选择'" :placeholder="item.placeholder || '请选择'"
:filterable="item.filterable || false" :filterable="item.filterable || false"
...@@ -163,6 +181,9 @@ export default { ...@@ -163,6 +181,9 @@ export default {
}, },
update(e) { update(e) {
this.$forceUpdate() this.$forceUpdate()
},
visibleChange(e) {
console.log(1212)
} }
} }
} }
......
...@@ -36,7 +36,7 @@ const routes = [ ...@@ -36,7 +36,7 @@ const routes = [
component: () => import('../views/dictionaryManage/index.vue') component: () => import('../views/dictionaryManage/index.vue')
}, },
{ {
path: '/dictionaryData', path: '/dictionaryManage/dictionaryData',
name: 'dictionaryData', name: 'dictionaryData',
component: () => import('../views/dictionaryManage/dictionaryData/index.vue') component: () => import('../views/dictionaryManage/dictionaryData/index.vue')
}, },
......
...@@ -228,9 +228,9 @@ export default { ...@@ -228,9 +228,9 @@ export default {
{ label: '角色:', prop: 'roleId', type: 'select', options: [], key: 'roleName', value: 'roleId', filterable: true }, { label: '角色:', prop: 'roleId', type: 'select', options: [], key: 'roleName', value: 'roleId', filterable: true },
{ label: '邮箱:', prop: 'email', type: 'input' }, { label: '邮箱:', prop: 'email', type: 'input' },
{ label: '手机:', prop: 'phoneNumber', type: 'input', maxlength: 11 }, { label: '手机:', prop: 'phoneNumber', type: 'input', maxlength: 11 },
{ label: '性别:', prop: 'gender', type: 'select', options: [], key: 'dictLabel', value: 'dictValue' }, { label: '性别:', prop: 'gender', type: 'select', options: [], key: 'dictLabel', value: 'dictValue', visibleFunc: this.genderChange },
{ label: '状态:', prop: 'enableStatus', type: 'switch' }, { label: '状态:', prop: 'enableStatus', type: 'switch' },
{ label: '岗位:', prop: 'position', type: 'select', options: [], key: 'dictLabel', value: 'dictValue' } { label: '岗位:', prop: 'position', type: 'select', options: [], key: 'dictLabel', value: 'dictValue', visibleFunc: this.positionChange }
], ],
userRules: { userRules: {
account: [{ required: true, message: '请输入登录名称', trigger: 'blur' }, account: [{ required: true, message: '请输入登录名称', trigger: 'blur' },
...@@ -516,18 +516,37 @@ export default { ...@@ -516,18 +516,37 @@ export default {
this.userData[this.userData.length - 1].options = res.data this.userData[this.userData.length - 1].options = res.data
}) })
}, },
// 获取性别列表
getSex() { getSex() {
dictInfo('sys_user_sex').then(res => { dictInfo('sys_user_sex').then(res => {
res.data.map(item => { res.data.map(item => {
if (!item.disabled) this.sexList.push(item) if (!item.disabled) this.sexList.push(item)
}) })
console.log(this.sexList)
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'gender') { if (item.prop == 'gender') {
item.options = res.data item.options = res.data
} }
}) })
}) })
},
// 字典禁用处理
disabledDict(name, text) {
this.userData.map(item => {
if (item.prop == name) {
if (item.options[0].typeDisabled) this.$message({
type: 'error',
message: `${text}已停用,请联系管理员解决`
})
}
})
},
// 性别下拉框出现/隐藏回调
genderChange(e) {
if (e) this.disabledDict('gender', '性别')
},
// 岗位下拉框出现/隐藏回调
positionChange(e) {
if (e) this.disabledDict('position', '岗位')
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!