network-line-opt.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <div v-loading="loading">
  3. <div class="white-box">
  4. <el-tabs v-model="tabActiveName">
  5. <el-tab-pane label="安置链路图" name="first" v-if="permission.hasPermission(`atlas/network-line`)">
  6. <div class="filter-user">
  7. <el-input v-model="mainUserName" size="small" style="width:300px;">
  8. <template slot="prepend">会员编号</template>
  9. </el-input>
  10. <el-input v-model="periodNum" size="small" style="width:150px;">
  11. <template slot="prepend">期数</template>
  12. </el-input>
  13. <el-button type="primary" size="small" @click="getMainData()">确定</el-button>
  14. <span class="l-height">不添默认为当前期数</span>
  15. </div>
  16. <el-timeline>
  17. <el-timeline-item class="out-side">
  18. <el-tag class="tag-header llt-header" color="white">会员编号</el-tag>
  19. <el-tag class="tag-header llt-header" color="white">姓名</el-tag>
  20. <el-tag class="tag-header llt-header" color="white">级别</el-tag>
  21. <el-tag class="tag-header llt-header" color="white">聘级</el-tag>
  22. <el-tag class="tag-header llt-header" color="white">加入期数</el-tag>
  23. <el-tag class="tag-header llt-header" color="white">区位</el-tag>
  24. <el-tag class="tag-header llt-header" color="white">状态</el-tag>
  25. </el-timeline-item>
  26. <el-timeline-item
  27. class="out-side"
  28. v-for="(timeLine, index) in timeLineData"
  29. :key="index"
  30. icon="el-icon-top"
  31. type="primary"
  32. size="large">
  33. <el-tag class="tag-header">{{timeLine.USER_NAME}}</el-tag>
  34. <el-tag class="tag-header" type="success">{{timeLine.REAL_NAME}}</el-tag>
  35. <el-tag class="tag-header" type="warning">{{timeLine.DEC_LV_NAME}}</el-tag>
  36. <el-tag class="tag-header" type="warning">{{timeLine.EMP_LV_NAME}}</el-tag>
  37. <el-tag class="tag-header">{{timeLine.PERIOD_AT}}</el-tag>
  38. <el-tag class="tag-header" type="danger">{{timeLine.LOCATION}}</el-tag>
  39. <el-tag class="tag-header">{{timeLine.STATUS_NAME}}</el-tag>
  40. </el-timeline-item>
  41. </el-timeline>
  42. </el-tab-pane>
  43. <el-tab-pane label="安置链路列表" name="two" v-if="permission.hasPermission(`user/network-line-list`)">
  44. <div class="filter-user">
  45. <el-input v-model="filterForm.userName" size="small" style="width:300px;">
  46. <template slot="prepend">会员编号</template>
  47. </el-input>
  48. <el-input v-model="filterForm.deep" size="small" style="width:150px;">
  49. <template slot="prepend">深度</template>
  50. </el-input>
  51. <el-input v-model="filterForm.periodNum" size="small" style="width:150px;">
  52. <template slot="prepend">期数</template>
  53. </el-input>
  54. <el-button type="primary" size="small" @click="handleFilter">确定</el-button>
  55. </div>
  56. <el-table :data="tableData" stripe style="width: 100%;" :height="tool.getTableHeight(true)">
  57. <el-table-column v-for="(tableHeader, key) in tableHeaders" :key="key" :label="tableHeader.header" :width="tableHeader.other.width ? tableHeader.other.width : ''">
  58. <template slot-scope="scope">
  59. <template v-if="scope.row[tableHeader.index].other.tag" >
  60. <el-tag :type="scope.row[tableHeader.index].other.tag.type ? scope.row[tableHeader.index].other.tag.type : null" :size="scope.row[tableHeader.index].other.tag.size ? scope.row[tableHeader.index].other.tag.size : null" :class="scope.row[tableHeader.index].other.tag.class ? scope.row[tableHeader.index].other.tag.class : null" >{{scope.row[tableHeader.index].value}}</el-tag>
  61. </template>
  62. <template v-else-if="scope.row[tableHeader.index].other.progress" >
  63. <el-progress type="circle" :percentage="Number.parseInt(percentList['MOVE_PERCENT'][scope.row.ID])"
  64. :width="50"
  65. :stroke-width="3"></el-progress>
  66. </template>
  67. <template v-else>
  68. <div v-html="scope.row[tableHeader.index].value"></div>
  69. </template>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <div class="white-box-footer">
  74. <el-button type="success" size="small" @click="handleExport"
  75. v-show="permission.hasPermission(`atlas/network-line-list-export`)">Export Excel
  76. </el-button>
  77. <pagination :total="totalCount" :page_size="pageSize" @size-change="handleSizeChange" @current-change="handleCurrentChange"></pagination>
  78. </div>
  79. </el-tab-pane>
  80. </el-tabs>
  81. </div>
  82. </div>
  83. </template>
  84. <script>
  85. import network from '@/utils/network'
  86. import tool from '@/utils/tool'
  87. import store from '@/utils/vuexStore'
  88. import permission from '@/utils/permission'
  89. import Pagination from '@/components/Pagination'
  90. import baseInfo from '@/utils/baseInfo'
  91. export default {
  92. name: 'atlas_network-line-opt',
  93. components: {Pagination},
  94. mounted() {
  95. this.getData()
  96. store.state.socket.onMessageCallback = this.onMessageCallback
  97. },
  98. data() {
  99. return {
  100. loading: true,
  101. tabActiveName: 'first',
  102. permission: permission,
  103. //relation
  104. props: {
  105. label: 'USER_NAME',
  106. children: 'children',
  107. //isLeaf: 'leaf',
  108. icon: 'icon',
  109. },
  110. timeLineData: null,
  111. expandDeep: 2,
  112. topDeep: 0,
  113. mainUserName: '',
  114. periodNum: null,
  115. listPeriodNum: null,
  116. allData: null,
  117. tableHeaders: null,
  118. tableData: null,
  119. currentPage: 1,
  120. totalPages: 1,
  121. totalCount: 1,
  122. pageSize: 20,
  123. tool: tool,
  124. filterForm: {
  125. userName: null,
  126. deep: null,
  127. periodNum: null,
  128. },
  129. listTopDeep: 0,
  130. }
  131. },
  132. methods: {
  133. getData() {
  134. this.$message({
  135. message: '正在获取数据,请稍后',
  136. })
  137. this.periodNum = baseInfo.nowPeriodNum()
  138. this.filterForm.periodNum = baseInfo.nowPeriodNum()
  139. if (permission.hasPermission(`atlas/network-line-list`)) {
  140. this.tabActiveName = 'two'
  141. }
  142. if (permission.hasPermission(`atlas/network-line`)) {
  143. this.tabActiveName = 'first'
  144. }
  145. this.loading = false
  146. },
  147. getMainData (userName = null, getList = false) {
  148. this.$message({
  149. message: '正在获取数据,请稍后',
  150. })
  151. let thisObj = this
  152. let requestData = {
  153. periodNum: this.periodNum
  154. }
  155. if (this.mainUserName !== null) {
  156. requestData = {userName: this.mainUserName,periodNum: this.periodNum}
  157. }
  158. network.getData('atlas/network-line', requestData).then(response => {
  159. thisObj.timeLineData = response.list
  160. thisObj.loading = false
  161. }).catch(response => {
  162. thisObj.loading = false
  163. })
  164. },
  165. countTopDeep(deep,topDeep){
  166. return Number(deep)-Number(topDeep)
  167. },
  168. handleCurrentChange (page) {
  169. this.getListData(page, this.pageSize)
  170. },
  171. handleSizeChange (pageSize) {
  172. this.getListData(this.currentPage, pageSize)
  173. },
  174. handleFilter () {
  175. this.getListData(1, this.pageSize)
  176. this.tabActiveName = 'two'
  177. },
  178. handleShow(row) {
  179. this.loading = true
  180. this.filterForm.userName = row.USER_NAME
  181. this.getListData(1, this.pageSize)
  182. this.tabActiveName = 'two'
  183. },
  184. getListData (page, pageSize) {
  185. let obj = this
  186. network.getPageData(this, 'atlas/network-line-list', page, pageSize, this.filterForm, function (response) {
  187. obj.allData = response
  188. obj.listPeriodNum = response.periodNum
  189. obj.listTopDeep = response.listTopDeep
  190. })
  191. },
  192. onMessageCallback(data) {
  193. //this.getData(this.currentPage, this.pageSize, false)
  194. },
  195. handleExport(){
  196. this.$confirm(`确定要导出当前数据吗?`, 'Notice', {
  197. confirmButtonText: 'confirm', // 确定
  198. cancelButtonText: 'cancel', // 取消
  199. type: 'warning'
  200. }).then(() => {
  201. return network.getData(`atlas/network-line-list-export`, this.filterForm)
  202. }).then(response => {
  203. this.$message({
  204. message: response,
  205. type: 'success'
  206. })
  207. }).catch(response => {
  208. })
  209. },
  210. }
  211. }
  212. </script>
  213. <style>
  214. .l-height{line-height: 32px;}
  215. .out-side{white-space:nowrap;}
  216. .tag-header{width:150px;text-align: center;}
  217. .llt-header{color: #2b2b2b;font-size: medium}
  218. .el-timeline-item__content .tag-header{border-color: #fff;}
  219. .filter-user{font-size: 14px;margin-bottom: 20px;}
  220. .filter-user:after{content: '';display: table;
  221. clear: both;}
  222. .filter-user .el-input-group{position: relative;}
  223. .filter-user .el-input-group,.filter-user .el-button{float: left;margin-right: 15px;}
  224. .el-timeline {
  225. padding-top:20px;
  226. padding-bottom:20px;
  227. font-size: 14px;
  228. overflow-x: auto;
  229. }
  230. .el-timeline .el-tag {
  231. height: 20px;
  232. line-height: 18px;vertical-align: middle;
  233. }
  234. </style>