|
|
@@ -0,0 +1,244 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <div class="white-box">
|
|
|
+ <div class="filter-user" @keyup.enter="getMainData()" style="margin: 5px">
|
|
|
+ <el-input v-model="mainUserName" size="small" class="top-member" style="width: 300px; margin-top: 10px;">
|
|
|
+ <template slot="prepend">{{ $t('atlas.topMember') }}</template>
|
|
|
+ </el-input>
|
|
|
+ <el-input v-model="expandDeep" size="small" style="width: 200px; margin-top: 10px;" class="spread-depth">
|
|
|
+ <template slot="prepend">{{ $t('atlas.spreadDepth') }}</template>
|
|
|
+ </el-input>
|
|
|
+ <el-input v-model="periodNum" size="small" style="width: 150px;" v-show="false">
|
|
|
+ <template slot="prepend">{{ $t('atlas.periodNumber') }}</template>
|
|
|
+ </el-input>
|
|
|
+ <el-button type="primary" size="small" @click="getMainData()" style=" margin-top: 10px;">{{ $t('common.confirm') }}</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <el-tree :props="props" :data="treeData" node-key="USER_ID" @node-click="getChildData" ref="tree" :indent="0" default-expand-all :height="tool.getTableHeight(true)" style="margin-top: 15px;">
|
|
|
+ <span :id="'node_'+data.USER_ID" :class="'custom-tree-node '+data.className" slot-scope="{ node, data }">
|
|
|
+ <span :class="'el-icon-loading '+ data.displayNone"></span>
|
|
|
+ <span :class="data.icon"></span>
|
|
|
+ <span>
|
|
|
+ <el-tag type="danger">{{countTopDeep(data.TOP_NETWORK_DEEP, topDeep)}}</el-tag>
|
|
|
+ <el-tag>{{ node.label }}</el-tag>
|
|
|
+ <el-tag type="info">{{data.REAL_NAME}}</el-tag>
|
|
|
+ <el-tag type="danger">{{ $t('atlas.location') }}: {{ data.RELATIVE_LOCATION }}</el-tag>
|
|
|
+ <el-tag type="success">{{ data.DEC_LV_NAME }}</el-tag>
|
|
|
+ <el-tag type="warning">{{ $t('atlas.highest') }}: {{ data.EMP_LV_NAME }}, {{ data.CROWN_LV_NAME }}</el-tag>
|
|
|
+ <el-tag>{{ data.PERIOD_AT }}</el-tag>
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {fetchMainUserInfo, fetchNetwork, fetchNetworkList} from '@/api/atlas'
|
|
|
+import Pagination from '@/components/Pagination'
|
|
|
+import waves from '@/directive/waves'
|
|
|
+import tool from '@/utils/tool'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'network',
|
|
|
+ components: { Pagination },
|
|
|
+ directives: { waves },
|
|
|
+ filters: {
|
|
|
+ statusFilter(status) {
|
|
|
+ status = parseInt(status)
|
|
|
+ const statusMap = {
|
|
|
+ 0: 'info',
|
|
|
+ 1: 'success'
|
|
|
+ }
|
|
|
+ return statusMap[status]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ loading: true,
|
|
|
+ tabActiveName: 'first',
|
|
|
+ props: {
|
|
|
+ label: 'USER_NAME',
|
|
|
+ children: 'children',
|
|
|
+ icon: 'icon',
|
|
|
+ },
|
|
|
+ treeData: null,
|
|
|
+ expandDeep: 5,
|
|
|
+ topDeep: 0,
|
|
|
+ mainUserName: '',
|
|
|
+ periodNum: null,
|
|
|
+ listPeriodNum: null,
|
|
|
+ allData: null,
|
|
|
+ tableHeaders: null,
|
|
|
+ tableData: null,
|
|
|
+ currentPage: 1,
|
|
|
+ totalPages: 1,
|
|
|
+ totalCount: 1,
|
|
|
+ tool: tool,
|
|
|
+ filterForm: {
|
|
|
+ userName: null,
|
|
|
+ deep: 5,
|
|
|
+ periodNum: null,
|
|
|
+ page: 1,
|
|
|
+ pageSize: 20
|
|
|
+ },
|
|
|
+ listTopDeep: 0,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getMainData(null,true)
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getMainData(userName = null, getList = false) {
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('common.awaitData')
|
|
|
+ })
|
|
|
+ let params = {
|
|
|
+ periodNum: this.periodNum
|
|
|
+ }
|
|
|
+ if (this.mainUserName !== null) {
|
|
|
+ params = {userName: this.mainUserName, periodNum: this.periodNum}
|
|
|
+ }
|
|
|
+ this.loading = true
|
|
|
+ fetchMainUserInfo(params).then(response => {
|
|
|
+ this.treeData = response.data
|
|
|
+ this.topDeep = Number(response.data[0].TOP_NETWORK_DEEP)
|
|
|
+ this.listPeriodNum = response.data[0].listPeriodNum
|
|
|
+ if (getList) {
|
|
|
+ this.getListData()
|
|
|
+ }
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false
|
|
|
+ }, 1.5 * 1000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getChildData(data, node) {
|
|
|
+ let userId = data.USER_ID
|
|
|
+ let that = data
|
|
|
+ if (that.leaf) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ if (that.isExpanded) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ if (that.children !== null && that.children.length > 0) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ that.displayNone = ''
|
|
|
+
|
|
|
+ this.loading = true
|
|
|
+ fetchNetwork({id: userId, deep: this.expandDeep, periodNum: this.periodNum}).then(response => {
|
|
|
+ this.$refs.tree.updateKeyChildren(userId, response.data.allData)
|
|
|
+ this.listPeriodNum = response.data.periodNum
|
|
|
+ that.displayNone = 'display-none'
|
|
|
+ that.isExpanded = true
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false
|
|
|
+ }, 1.5 * 1000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getListData(page, pageSize) {
|
|
|
+ this.filterForm.page = page
|
|
|
+ this.filterForm.pageSize = pageSize
|
|
|
+ fetchNetworkList(this.filterForm).then(response => {
|
|
|
+ this.allData = response.data
|
|
|
+ this.listTopDeep = response.data.listTopDeep
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.loading = false
|
|
|
+ }, 1.5 * 1000)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ countTopDeep (deep, topDeep) {
|
|
|
+ return Number(deep) - Number(topDeep)
|
|
|
+ },
|
|
|
+ handleCurrentChange (page) {
|
|
|
+ this.getListData(page, this.pageSize)
|
|
|
+ },
|
|
|
+ handleSizeChange (pageSize) {
|
|
|
+ this.getListData(this.currentPage, pageSize)
|
|
|
+ },
|
|
|
+ handleFilter () {
|
|
|
+ this.getListData(1, this.pageSize)
|
|
|
+ this.tabActiveName = 'two'
|
|
|
+ },
|
|
|
+ handleShow (row) {
|
|
|
+ this.loading = true
|
|
|
+ this.filterForm.userName = row.SEE_USER_NAME
|
|
|
+ this.getListData(1, this.pageSize)
|
|
|
+ this.tabActiveName = 'two'
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+.filter-user{font-size: 14px;margin-bottom: 20px;}
|
|
|
+.filter-user:after{content: '';display: table;
|
|
|
+ clear: both;}
|
|
|
+.filter-user .el-input-group{float: left;margin-right: 15px;}
|
|
|
+.el-tree {
|
|
|
+ padding-bottom: 20px;
|
|
|
+ font-size: 14px;
|
|
|
+ overflow-x: auto;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tree .el-tag {
|
|
|
+ height: 20px;
|
|
|
+ line-height: 18px;vertical-align: middle;
|
|
|
+}
|
|
|
+.el-tree-node{position: relative;}
|
|
|
+
|
|
|
+.el-tree-node__content {
|
|
|
+ height: 30px;
|
|
|
+ line-height: 30px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tree-node__children {
|
|
|
+ overflow: unset;
|
|
|
+ position: relative;
|
|
|
+ padding: 0 0 0 16px;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tree-node > .el-tree-node__children {
|
|
|
+ overflow: unset;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tree-node:before {
|
|
|
+ position: absolute;
|
|
|
+ content: '';
|
|
|
+ top: 0px;
|
|
|
+ left: -4px;
|
|
|
+ height: 100%;
|
|
|
+ border-left: 1px solid #ccc;
|
|
|
+}
|
|
|
+.el-tree-node:last-child:before{height: 15px;}
|
|
|
+
|
|
|
+.custom-tree-node {
|
|
|
+ position: relative;
|
|
|
+ padding-left: 5px;
|
|
|
+}
|
|
|
+
|
|
|
+.first-node:before {
|
|
|
+ display: none;
|
|
|
+}
|
|
|
+
|
|
|
+.custom-tree-node:before {
|
|
|
+ position: absolute;
|
|
|
+ width: 8px;
|
|
|
+ content: '';
|
|
|
+ top: 15px;
|
|
|
+ left: -4px;
|
|
|
+ border-bottom: 1px solid #ccc;
|
|
|
+}
|
|
|
+
|
|
|
+.el-tree-node__expand-icon {
|
|
|
+ display: none !important;
|
|
|
+}
|
|
|
+
|
|
|
+.display-none {
|
|
|
+ display: none!important;
|
|
|
+}
|
|
|
+</style>
|