Commit c0e80b69 by 胡悦

修复bug

1 parent 77c17659
...@@ -181,9 +181,6 @@ export default { ...@@ -181,9 +181,6 @@ export default {
}, },
update(e) { update(e) {
this.$forceUpdate() this.$forceUpdate()
},
visibleChange(e) {
console.log(1212)
} }
} }
} }
......
...@@ -178,9 +178,7 @@ export default { ...@@ -178,9 +178,7 @@ export default {
// 弹窗 // 弹窗
dictDataDialogTitle: '新增字典', dictDataDialogTitle: '新增字典',
dictDataVisible: false, dictDataVisible: false,
dictDataForm: { dictDataForm: {},
enableStatus: true
},
dictDataData: [ dictDataData: [
{ label: '字典类型:', prop: 'dictType', type: 'input', readonly: true }, { label: '字典类型:', prop: 'dictType', type: 'input', readonly: true },
{ label: '字典标签:', prop: 'dictLabel', type: 'input', maxlength: 20 }, { label: '字典标签:', prop: 'dictLabel', type: 'input', maxlength: 20 },
...@@ -202,6 +200,7 @@ export default { ...@@ -202,6 +200,7 @@ export default {
mounted() { mounted() {
this.searchForm.name = this.$route.params.row.dictName this.searchForm.name = this.$route.params.row.dictName
this.dictDataForm.dictType = this.$route.params.row.dictType this.dictDataForm.dictType = this.$route.params.row.dictType
this.dictDataForm.enableStatus = this.$route.params.row.enableStatus
}, },
methods: { methods: {
// 重置搜索条件 // 重置搜索条件
...@@ -234,6 +233,9 @@ export default { ...@@ -234,6 +233,9 @@ export default {
api = editDictData api = editDictData
delete params.delFlag delete params.delFlag
delete params.disabled delete params.disabled
delete params.deleted
delete params.typeDeleted
delete params.typeDisabled
} }
api(params).then(res => { api(params).then(res => {
if (res.code == 200) { if (res.code == 200) {
......
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
}, },
dictionaryData: [ dictionaryData: [
{ label: '字典名称:', prop: 'dictName', type: 'input', maxlength: 20 }, { label: '字典名称:', prop: 'dictName', type: 'input', maxlength: 20 },
{ label: '字典类型', prop: 'dictType', type: 'input', maxlength: 50 }, { label: '字典类型', prop: 'dictType', type: 'input', maxlength: 50, readonly: false },
{ label: '状态', prop: 'enableStatus', type: 'switch' }, { label: '状态', prop: 'enableStatus', type: 'switch' },
{ label: '备注', prop: 'remark', type: 'input', inputText: 'textarea', maxlength: 200, showWordLimit: true } { label: '备注', prop: 'remark', type: 'input', inputText: 'textarea', maxlength: 200, showWordLimit: true }
], ],
...@@ -252,10 +252,23 @@ export default { ...@@ -252,10 +252,23 @@ export default {
switch (pType) { switch (pType) {
case 'create': case 'create':
this.dictionaryDialogTitle = '新增字典' this.dictionaryDialogTitle = '新增字典'
this.dictionaryForm = {
enableStatus: true
}
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = false
}
})
this.handleClose() this.handleClose()
break break
case 'edit': case 'edit':
this.dictionaryDialogTitle = '编辑字典' this.dictionaryDialogTitle = '编辑字典'
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = true
}
})
this.editEvent(scope) this.editEvent(scope)
break break
case 'delete': case 'delete':
......
...@@ -350,7 +350,12 @@ export default { ...@@ -350,7 +350,12 @@ export default {
superiorName: '', superiorName: '',
enableStatus: true enableStatus: true
} }
this.userForm.gender = this.sexList.length > 0 ? this.sexList[0].dictValue : '' let gender = ''
if (this.sexList.length > 0) {
gender = this.sexList[0].dictValue
}
// this.userForm.gender = this.sexList.length > 0 ? this.sexList[0].dictValue + '' : ''
this.$set(this.userForm, 'gender', gender)
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'superiorName') { if (item.prop == 'superiorName') {
item.hidden = true item.hidden = true
...@@ -377,7 +382,6 @@ export default { ...@@ -377,7 +382,6 @@ export default {
this.userDialogTitle = '编辑用户' this.userDialogTitle = '编辑用户'
this.userForm = JSON.parse(JSON.stringify(res.data)) this.userForm = JSON.parse(JSON.stringify(res.data))
this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false
// this.userForm.gender = this.userForm.gender + ''
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'superiorName') { if (item.prop == 'superiorName') {
item.hidden = this.userForm.deptDepth == 0 item.hidden = this.userForm.deptDepth == 0
...@@ -392,7 +396,7 @@ export default { ...@@ -392,7 +396,7 @@ export default {
item.options.map(j => { item.options.map(j => {
if (j.dictValue == this.userForm.position) isFlag = true if (j.dictValue == this.userForm.position) isFlag = true
}) })
if (!isFlag) this.userForm.position = '' this.userForm.position = isFlag ? this.userForm.position + '' : ''
} }
}) })
this.handleClose(res.data) this.handleClose(res.data)
...@@ -510,34 +514,62 @@ export default { ...@@ -510,34 +514,62 @@ export default {
// 岗位列表 // 岗位列表
getPosti(value) { getPosti(value) {
dictInfo('sys_position').then(res => { dictInfo('sys_position').then(res => {
res.data.map(item => { if (res.data.length > 0) {
if (!item.disabled) this.positionList.length > 0 ? this.positionList.push(item) : '' this.deleteDict(res.data, 'position', this.positionList)
}) }
this.userData[this.userData.length - 1].options = res.data
}) })
}, },
// 获取性别列表 // 获取性别列表
getSex() { getSex() {
dictInfo('sys_user_sex').then(res => { dictInfo('sys_user_sex2').then(res => {
res.data.map(item => { if (res.data.length > 0) {
if (!item.disabled) this.sexList.push(item) this.deleteDict(res.data, 'gender', this.sexList)
}
})
},
/**
* 字典删除处理
* 参数:1.data: 字典数据, Array
* 2.name: 字段名, String
* 3.list: 可选择项的数组,Array
*/
deleteDict(data, name, list) {
const arr = []
if (!data[0].typeDeleted) {
// 过滤未删除列表
data.map(item => {
if (!item.deleted) arr.push(item)
}) })
this.userData.map(item => { this.userData.map(item => {
if (item.prop == 'gender') { if (item.prop == name) {
item.options = res.data item.options = arr
} }
}) })
arr && arr.map(i => {
if (!i.disabled) list.push(i)
}) })
}
}, },
// 字典禁用处理 /**
disabledDict(name, text) { * 字典禁用处理
* 参数:1.name,字段名, String
* 2.label,字典名称,Strign
*/
disabledDict(name, label) {
this.userData.map(item => { this.userData.map(item => {
if (item.prop == name) { if (item.prop == name) {
if (item.options[0].typeDisabled) this.$message({ if (item.options[0].typeDeleted) {
this.$message({
type: 'error',
message: `${label}已删除,请联系管理员解决`
})
} else if (item.options[0].typeDisabled) {
this.$message({
type: 'error', type: 'error',
message: `${text}已停用,请联系管理员解决` message: `${label}已停用,请联系管理员解决`
}) })
} }
}
}) })
}, },
// 性别下拉框出现/隐藏回调 // 性别下拉框出现/隐藏回调
...@@ -547,6 +579,9 @@ export default { ...@@ -547,6 +579,9 @@ export default {
// 岗位下拉框出现/隐藏回调 // 岗位下拉框出现/隐藏回调
positionChange(e) { positionChange(e) {
if (e) this.disabledDict('position', '岗位') if (e) this.disabledDict('position', '岗位')
},
selectChange(e) {
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!