Commit 3281f89e by yuwei

2.0.0项目初始化

parent ba79ac97
...@@ -1685,14 +1685,6 @@ ...@@ -1685,14 +1685,6 @@
"integrity": "sha1-0pHGpOl5ibXGHZrPOWrk/hM6cY0=", "integrity": "sha1-0pHGpOl5ibXGHZrPOWrk/hM6cY0=",
"dev": true "dev": true
}, },
"@ztree/ztree_v3": {
"version": "3.5.41",
"resolved": "https://registry.npmjs.org/@ztree/ztree_v3/-/ztree_v3-3.5.41.tgz",
"integrity": "sha512-vfsv9F0VyTuTAy4KqR2jfMOIQqDSFd5/yBT1Sldajhv93SqowI1CGZ1qK7HhOgoy+ag1xoUpNebsuW9ywH5jag==",
"requires": {
"jquery": ">=1.4.4"
}
},
"accepts": { "accepts": {
"version": "1.3.7", "version": "1.3.7",
"resolved": "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz", "resolved": "https://registry.npm.taobao.org/accepts/download/accepts-1.3.7.tgz",
...@@ -6915,11 +6907,6 @@ ...@@ -6915,11 +6907,6 @@
} }
} }
}, },
"jquery": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.4.1.tgz",
"integrity": "sha512-36+AdBzCL+y6qjw5Tx7HgzeGCzC81MDDgaUP8ld2zhx58HdqXGoBd+tHdrBMiyjGQs0Hxs/MLZTu/eHNJJuWPw=="
},
"js-base64": { "js-base64": {
"version": "2.5.1", "version": "2.5.1",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz",
...@@ -11628,15 +11615,6 @@ ...@@ -11628,15 +11615,6 @@
} }
} }
}, },
"vue-giant-tree": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/vue-giant-tree/-/vue-giant-tree-0.1.2.tgz",
"integrity": "sha512-CrQOUJkim+S86wcBBjeZyoXheECEALN6CciiTl1oUkkuYx4obZ5gB/lVz27u1N1BZDp5ODfCSRlYcL+aM/qQhg==",
"requires": {
"@ztree/ztree_v3": "^3.5.40",
"jquery": "^3.4.1"
}
},
"vue-hot-reload-api": { "vue-hot-reload-api": {
"version": "2.3.4", "version": "2.3.4",
"resolved": "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-hot-reload-api%2Fdownload%2Fvue-hot-reload-api-2.3.4.tgz", "resolved": "https://registry.npm.taobao.org/vue-hot-reload-api/download/vue-hot-reload-api-2.3.4.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fvue-hot-reload-api%2Fdownload%2Fvue-hot-reload-api-2.3.4.tgz",
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
"path-to-regexp": "^6.1.0", "path-to-regexp": "^6.1.0",
"screenfull": "^5.0.0", "screenfull": "^5.0.0",
"vue": "^2.6.10", "vue": "^2.6.10",
"vue-giant-tree": "^0.1.2",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",
"vuex": "^3.1.2" "vuex": "^3.1.2"
}, },
......
...@@ -3,12 +3,15 @@ ...@@ -3,12 +3,15 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="4"> <el-col :span="4">
<el-card class="box-card" shadow="always" :body-style="{ height: bodyHeight }" style="overflow-y: auto;"> <el-card class="box-card" shadow="always" :body-style="{ height: bodyHeight }" style="overflow-y: auto;">
<tree <el-tree
:nodes="deptNodes" :data="deptOptions"
:setting="setting" default-expand-all
@onCheck="onCheck" ref="dept"
@onCreated="handleCreated" node-key="id"
/> empty-text="加载中,请稍后"
:props="defaultProps"
@node-click="handleNodeClick"
></el-tree>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="20"> <el-col :span="20">
...@@ -196,13 +199,10 @@ ...@@ -196,13 +199,10 @@
<script> <script>
import { listUser } from '@/api/system/user' import { listUser } from '@/api/system/user'
import { listDept } from '@/api/system/dept' import { listDept } from '@/api/system/dept'
import tree from 'vue-giant-tree' import { construct } from '@/utils/json-tree'
export default { export default {
name: 'UserList', name: 'UserList',
components: {
tree
},
data () { data () {
return { return {
bodyHeight: document.body.offsetHeight - 130 + 'px', bodyHeight: document.body.offsetHeight - 130 + 'px',
...@@ -272,37 +272,19 @@ export default { ...@@ -272,37 +272,19 @@ export default {
}, },
// 高级搜索 展开/关闭 // 高级搜索 展开/关闭
advanced: false, advanced: false,
// ztree树组件 // 部门列表
ztreeObj: null, deptOptions: [],
setting: { defaultProps: {
check: { children: "children",
enable: true, label: "deptName"
chkStyle: 'radio', }
radioType: 'all'
},
data: {
key: {
name: 'deptName'
},
simpleData: {
enable: true,
idKey: 'id',
pIdKey: 'parentId',
rootPId: '0'
}
}
},
deptNodes: []
} }
}, },
created () { created () {
this.getList() this.getList()
this.getDeptList() this.getDeptTree()
this.initCols() this.initCols()
}, },
destroyed () {
this.ztreeObj.destroy()
},
methods: { methods: {
/** 查询用户列表 */ /** 查询用户列表 */
getList () { getList () {
...@@ -316,11 +298,17 @@ export default { ...@@ -316,11 +298,17 @@ export default {
} }
}) })
}, },
/** 查询部门列表 */ /** 查询部门树结构 */
getDeptList () { getDeptTree () {
listDept().then(response => { listDept().then(response => {
const { data } = response if (response.success) {
this.deptNodes = data const { data } = response
this.deptOptions = construct(data, {
id: 'id',
pid: 'parentId',
children: 'children'
})
}
}) })
}, },
initCols () { initCols () {
...@@ -346,10 +334,6 @@ export default { ...@@ -346,10 +334,6 @@ export default {
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.$refs['queryForm'].resetFields() this.$refs['queryForm'].resetFields()
this.ztreeObj.cancelSelectedNode()
this.ztreeObj
.getCheckedNodes(true)
.forEach(node => this.ztreeObj.checkNode(node, false, false, false))
this.handleQuery() this.handleQuery()
}, },
/** 刷新列表 */ /** 刷新列表 */
...@@ -420,6 +404,11 @@ export default { ...@@ -420,6 +404,11 @@ export default {
this.queryParams.pageNum = val this.queryParams.pageNum = val
this.getList() this.getList()
}, },
/** 节点单击事件 */
handleNodeClick (data) {
this.queryParams.deptId = data.id;
this.getList();
},
toggleAdvanced () { toggleAdvanced () {
this.advanced = !this.advanced this.advanced = !this.advanced
}, },
...@@ -440,14 +429,6 @@ export default { ...@@ -440,14 +429,6 @@ export default {
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="success">{status_dictText}</el-tag>
} }
},
handleCreated (ztreeObj) {
this.ztreeObj = ztreeObj
this.ztreeObj.expandAll(true)
},
onCheck (event, treeId, treeNode) {
this.queryParams.deptId = treeNode.id
this.handleQuery()
} }
} }
} }
......
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