Commit 6e669f80 by xinla

会话员工检索数据问题

1 parent c8501828
...@@ -13,13 +13,19 @@ ...@@ -13,13 +13,19 @@
<el-tree <el-tree
ref="tree" ref="tree"
class="filter-tree" class="filter-tree"
:data="treeData"
:props="defaultProps" :props="defaultProps"
:filter-node-method="filterNode" :filter-node-method="filterNode"
highlight-current highlight-current
node-key="id"
@node-click="handleNodeClick" @node-click="handleNodeClick"
:default-expand-all="true" :default-expanded-keys="defaultExpandedKeys"
:load="loadNode"
lazy
> >
<!--
:data="treeData"
:default-expand-all="true"
:expand-on-click-node="false" -->
</el-tree> </el-tree>
</div> </div>
</el-col> </el-col>
...@@ -28,22 +34,10 @@ ...@@ -28,22 +34,10 @@
<div class="name pd15">{{ talkName }}</div> <div class="name pd15">{{ talkName }}</div>
<el-tabs v-model="activeName" @tab-click="tabClick(true)"> <el-tabs v-model="activeName" @tab-click="tabClick(true)">
<el-tab-pane label="内部联系人" name="0"> <el-tab-pane label="内部联系人" name="0">
<userList <userList v-if="activeName == 0" :personList="personList" :loading="loading" @chatFn="chatFn"> </userList>
v-if="activeName == 0"
:personList="personList"
:loading="loading"
@chatFn="chatFn"
>
</userList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="外部联系人" name="1"> <el-tab-pane label="外部联系人" name="1">
<userList <userList v-if="activeName == 1" :personList="personList" :loading="loading" @chatFn="chatFn"> </userList>
v-if="activeName == 1"
:personList="personList"
:loading="loading"
@chatFn="chatFn"
>
</userList>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="群聊" name="2"> <el-tab-pane label="群聊" name="2">
<grouplist <grouplist
...@@ -61,16 +55,9 @@ ...@@ -61,16 +55,9 @@
<el-empty v-else :image-size="100" description="请选择员工"></el-empty> <el-empty v-else :image-size="100" description="请选择员工"></el-empty>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<chatListClass <chatListClass v-show="queryChat.receiveName" :queryChat="queryChat"></chatListClass>
v-show="queryChat.receiveName"
:queryChat="queryChat"
></chatListClass>
<el-empty <el-empty v-if="!queryChat.receiveName" description="请选择联系人" :image-size="100"></el-empty>
v-if="!queryChat.receiveName"
description="请选择联系人"
:image-size="100"
></el-empty>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
...@@ -94,10 +81,12 @@ export default { ...@@ -94,10 +81,12 @@ export default {
fromId: '', fromId: '',
// employName: '', // employName: '',
talkName: '', talkName: '',
treeData: [], // treeData: [],
defaultExpandedKeys: [],
defaultProps: { defaultProps: {
label: 'name', label: 'name',
children: 'children' children: 'children',
isLeaf: 'isLeaf'
}, },
activeName: '0', activeName: '0',
chat: {}, chat: {},
...@@ -113,7 +102,7 @@ export default { ...@@ -113,7 +102,7 @@ export default {
// } // }
}, },
mounted() { mounted() {
this.getTree() // this.getTree()
//this.getAmount() //this.getAmount()
}, },
methods: { methods: {
...@@ -131,12 +120,12 @@ export default { ...@@ -131,12 +120,12 @@ export default {
roomId: data.receiver roomId: data.receiver
} }
}, },
getTree() { // getTree() {
apiOrg.getTree().then(({ data }) => { // apiOrg.getTree().then(({ data }) => {
this.treeData = this.handleTree(data) // let treeData = (this.treeData = this.handleTree(data))
this.handleNodeClick(this.treeData[0], true) // this.handleNodeClick(this.treeData[0], true)
}) // })
}, // },
tabClick(flag) { tabClick(flag) {
this.personList = [] this.personList = []
if (!this.fromId) { if (!this.fromId) {
...@@ -182,19 +171,41 @@ export default { ...@@ -182,19 +171,41 @@ export default {
if (!value) return true if (!value) return true
return data.name.indexOf(value) !== -1 return data.name.indexOf(value) !== -1
}, },
loadNode(node, resolve) {
handleNodeClick(data, add) { if (node.level == 0) {
if (!data.userId) { apiOrg.getTree().then(({ data }) => {
let treeData = this.handleTree(data)
// this.handleNodeClick(this.treeData[0], true)
treeData[0] && (this.defaultExpandedKeys = [treeData[0].id])
resolve(treeData)
})
} else {
if (node.data.userId) {
resolve([])
} else {
let querys = { let querys = {
pageNum: '1', pageNum: '1',
pageSize: '999', pageSize: '999',
department: data.id isActivate: '',
department: node.data.id
} }
apiOrg.getList(querys).then(({ rows }) => { apiOrg.getList(querys).then(({ rows }) => {
this.$set(data, 'children', []) // if (!data.children) {
// this.$set(data, 'children', [])
// }
data.children = rows // data.children.push(...rows)
let arr = node.data.children ? node.data.children.concat(rows || []) : rows || []
arr.forEach((element) => {
element.isLeaf = !!element.userId
}) })
resolve(arr)
})
}
}
},
handleNodeClick(data, add) {
if (!data.userId) {
} else { } else {
this.talkName = data.name this.talkName = data.name
this.fromId = data.userId this.fromId = data.userId
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!