Commit 098fd495 by 冒粤蓉
2 parents 9693285e c0e80b69
......@@ -181,9 +181,6 @@ export default {
},
update(e) {
this.$forceUpdate()
},
visibleChange(e) {
console.log(1212)
}
}
}
......
......@@ -178,9 +178,7 @@ export default {
// 弹窗
dictDataDialogTitle: '新增字典',
dictDataVisible: false,
dictDataForm: {
enableStatus: true
},
dictDataForm: {},
dictDataData: [
{ label: '字典类型:', prop: 'dictType', type: 'input', readonly: true },
{ label: '字典标签:', prop: 'dictLabel', type: 'input', maxlength: 20 },
......@@ -202,6 +200,7 @@ export default {
mounted() {
this.searchForm.name = this.$route.params.row.dictName
this.dictDataForm.dictType = this.$route.params.row.dictType
this.dictDataForm.enableStatus = this.$route.params.row.enableStatus
},
methods: {
// 重置搜索条件
......@@ -234,6 +233,9 @@ export default {
api = editDictData
delete params.delFlag
delete params.disabled
delete params.deleted
delete params.typeDeleted
delete params.typeDisabled
}
api(params).then(res => {
if (res.code == 200) {
......
......@@ -181,7 +181,7 @@ export default {
},
dictionaryData: [
{ 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: 'remark', type: 'input', inputText: 'textarea', maxlength: 200, showWordLimit: true }
],
......@@ -252,10 +252,23 @@ export default {
switch (pType) {
case 'create':
this.dictionaryDialogTitle = '新增字典'
this.dictionaryForm = {
enableStatus: true
}
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = false
}
})
this.handleClose()
break
case 'edit':
this.dictionaryDialogTitle = '编辑字典'
this.dictionaryData.map(item => {
if (item.prop == 'dictType') {
item.readonly = true
}
})
this.editEvent(scope)
break
case 'delete':
......
......@@ -350,7 +350,12 @@ export default {
superiorName: '',
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 => {
if (item.prop == 'superiorName') {
item.hidden = true
......@@ -377,7 +382,6 @@ export default {
this.userDialogTitle = '编辑用户'
this.userForm = JSON.parse(JSON.stringify(res.data))
this.userForm.enableStatus = res.data.enableStatus == 1 ? true : false
// this.userForm.gender = this.userForm.gender + ''
this.userData.map(item => {
if (item.prop == 'superiorName') {
item.hidden = this.userForm.deptDepth == 0
......@@ -392,7 +396,7 @@ export default {
item.options.map(j => {
if (j.dictValue == this.userForm.position) isFlag = true
})
if (!isFlag) this.userForm.position = ''
this.userForm.position = isFlag ? this.userForm.position + '' : ''
}
})
this.handleClose(res.data)
......@@ -510,33 +514,61 @@ export default {
// 岗位列表
getPosti(value) {
dictInfo('sys_position').then(res => {
res.data.map(item => {
if (!item.disabled) this.positionList.length > 0 ? this.positionList.push(item) : ''
})
this.userData[this.userData.length - 1].options = res.data
if (res.data.length > 0) {
this.deleteDict(res.data, 'position', this.positionList)
}
})
},
// 获取性别列表
getSex() {
dictInfo('sys_user_sex').then(res => {
res.data.map(item => {
if (!item.disabled) this.sexList.push(item)
dictInfo('sys_user_sex2').then(res => {
if (res.data.length > 0) {
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 => {
if (item.prop == 'gender') {
item.options = res.data
if (item.prop == name) {
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 => {
if (item.prop == name) {
if (item.options[0].typeDisabled) this.$message({
type: 'error',
message: `${text}已停用,请联系管理员解决`
})
if (item.options[0].typeDeleted) {
this.$message({
type: 'error',
message: `${label}已删除,请联系管理员解决`
})
} else if (item.options[0].typeDisabled) {
this.$message({
type: 'error',
message: `${label}已停用,请联系管理员解决`
})
}
}
})
},
......@@ -547,6 +579,9 @@ export default {
// 岗位下拉框出现/隐藏回调
positionChange(e) {
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!