|
@@ -64,7 +64,11 @@
|
|
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
|
|
>
|
|
|
<el-table-column prop="deptName" label="名称" />
|
|
|
- <el-table-column prop="onLineTime" label="在线时长" />
|
|
|
+ <el-table-column prop="onLineTime" label="在线时长">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.onLineTime }}h
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -178,6 +182,10 @@ const getData = (() => {
|
|
|
pageSize:5,
|
|
|
}).then(res=>{
|
|
|
onLineInfoData.value = res.data.deptList
|
|
|
+ onLineInfoData.value.unshift({
|
|
|
+ deptName:'我的时长',
|
|
|
+ onLineTime:res.data.onLineTime
|
|
|
+ })
|
|
|
//递归将数据内的deptList 改成 children
|
|
|
const changeData = (data) => {
|
|
|
data.forEach(item => {
|
|
@@ -185,6 +193,16 @@ const getData = (() => {
|
|
|
item.children = item.deptList
|
|
|
changeData(item.deptList)
|
|
|
}
|
|
|
+ if(item.userList && item.userList.length > 0) {
|
|
|
+
|
|
|
+ item.children = item.children.concat(item.userList.map(item=> {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ deptName:item.userName,
|
|
|
+ onLineTime:item.onLineTime
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
changeData(onLineInfoData.value)
|