asd26269546 1 год назад
Родитель
Сommit
e5a6f7ed88
2 измененных файлов с 20 добавлено и 2 удалено
  1. 1 1
      src/components/byTable/index.vue
  2. 19 1
      src/views/index.vue

+ 1 - 1
src/components/byTable/index.vue

@@ -749,7 +749,7 @@ export default defineComponent({
     z-index: 100;
     display: none;
     white-space: nowrap;
-    min-width: 80px;
+    min-width: 100%;
     li {
       list-style: none;
       font-size: 12px;

+ 19 - 1
src/views/index.vue

@@ -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)