Commit c971c490 authored by 张伯涛's avatar 张伯涛

1.记住筛选项问题默认参数修改

2.用户管理模块的部门树接口查询修改
parent 82ae223d
......@@ -20,11 +20,11 @@ export function getDataCache(routerPath) {
if (param){
return param
} else {
const paramNew = '{"page":1,"rows":10}'
const paramNew = '{}'
return paramNew
}
} else {
const paramNew = '{"page":1,"rows":10}'
const paramNew = '{}'
return paramNew
}
}
......
......@@ -274,8 +274,9 @@ export default {
next()
},
created() {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
// this.queryParams.operTime = this.$parseDate(new Date(), 'YYYY-MM')
this.getList()
},
......
......@@ -230,8 +230,9 @@ export default {
// const param = JSON.parse(filterData)
// this.queryParams = { ...param }
// }
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
this.getList()
},
methods: {
......
......@@ -319,8 +319,9 @@ export default {
// const param = JSON.parse(filterData)
// this.queryParams = { ...param }
// }
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
// this.queryParams.operTime = this.$parseDate(new Date(), 'YYYY-MM')
this.getList()
},
......
......@@ -246,8 +246,9 @@ export default {
next()
},
created() {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
this.getList()
},
methods: {
......
......@@ -293,8 +293,9 @@ export default {
next()
},
created() {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
const dictId = this.$route.params && this.$route.params.dictId
this.getType(dictId)
this.getTypeList()
......
......@@ -309,8 +309,9 @@ export default {
next()
},
created() {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
this.getList()
},
methods: {
......
......@@ -362,8 +362,9 @@ export default {
next()
},
created() {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path))
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
this.getList()
},
methods: {
......
......@@ -409,7 +409,9 @@ export default {
next()
},
created() {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
this.getList() // 列表查询
},
methods: {
......
......@@ -274,7 +274,8 @@
<treeSelect
v-model="form.deptId"
:disable-branch-nodes="true"
:options="deptChildren"
:options="deptOptionsTree"
:normalizer="normalizer"
:show-count="true"
placeholder="请选择归属部门"
@input="changeValue"
......@@ -416,7 +417,7 @@ import {
// userLoginManage
} from '@/api/system/user'
import { getToken } from '@/utils/auth'
import { treeSelect } from '@/api/system/dept'
import { treeSelect, listDept } from '@/api/system/dept'
import TreeSelect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getListRole } from '@/api/system/role'
......@@ -526,7 +527,7 @@ export default {
},
defaultProps: {
children: 'children',
label: 'label'
label: 'deptName'
},
ruleForm: {
newPassword: '',
......@@ -628,8 +629,9 @@ export default {
}
},
created() {
// 分页参数初始化为{"page":1,"rows":10},如需自定义分页参数,自行修改
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
if (JSON.parse(getDataCache(this.$route.path)) !== {}) {
this.queryParams = JSON.parse(getDataCache(this.$route.path)) // 获取存储的筛选项
}
this.getList() // 列表查询
this.getTreeSelect() // 查询部门下拉树结构
this.getRole() // 查询角色下拉
......@@ -670,6 +672,17 @@ export default {
changeValue() {
this.$refs.form.validateField('id')
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.businessId,
label: node.deptName,
children: node.children
}
},
a() {
},
/** 查询用户列表 */
......@@ -689,15 +702,16 @@ export default {
},
/** 查询部门下拉树结构 */
getTreeSelect() {
treeSelect().then(response => {
this.deptOptionsTree = response.data.concat({
id: -1,
label: '无部门人员',
children: undefined
})
if (response.data && response.data.length > 0) {
this.deptOptions = response.data[0].children
}
listDept().then(response => {
// this.deptOptionsTree = response.data.concat({
// id: -1,
// label: '无部门人员',
// children: undefined
// })
this.deptOptionsTree = this.handleTree(response.data, 'businessId')
// if (response.data && response.data.length > 0) {
// this.deptOptions = response.data[0].children
// }
})
},
/** 查询子部门 */
......@@ -718,13 +732,13 @@ export default {
// 筛选节点
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
return data.deptName.indexOf(value) !== -1
},
// 节点单击事件
handleNodeClick(data) {
// TODO: clear this log
// TODO: clear this log
this.queryParams.deptId = data.id
this.queryParams.deptId = data.businessId
this.getList()
},
// 点击部门空白处
......@@ -808,7 +822,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.getChildrenDept(0)
// this.getChildrenDept(0)
this.open = true
this.title = '添加用户'
},
......@@ -828,7 +842,7 @@ export default {
// this.form.postId = response.data.deptId
this.title = '修改用户'
})
this.getChildrenDept(userId)
// this.getChildrenDept(userId)
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment