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

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

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