tabFunNumOverview.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div id="tabFunNumOverview">
  3. <!-- 查询 新增 -->
  4. <div class="query-area" style="padding:10px;">
  5. <el-input :placeholder="`请输入表号功能号`" v-model="tabFunNum" @keyup.enter.native="getOverViewList()" style="width:240px;">
  6. <i slot="suffix" class="el-input__icon el-icon-search" @click="getOverViewList()"></i>
  7. </el-input>
  8. <p style="overflow: hidden;float:right;">
  9. <el-button style="height:32px" @click='handleDrawer({},3)'>新增自定义</el-button>
  10. </p>
  11. </div>
  12. <!-- 数据表格 -->
  13. <div class="table-area">
  14. <el-table :data="tableData" style="width: 100%" height="calc(100% - 32px)" v-loading="loading" :header-cell-style="headerStyle" >
  15. <el-table-column prop='' label='' show-overflow-tooltip width="35" header-align='center'>
  16. <template slot-scope="scope">
  17. <el-tooltip v-if="scope.row.DataQuality!=0" content="已断数,请检查" effect="dark" placement="top">
  18. <i class="el-icon-warning-outline" style="float:left;margin: 0 5px;color: red;font-size:18px;"></i>
  19. </el-tooltip>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop='MeterFunc' label='表号-功能号' show-overflow-tooltip min-width="100" header-align='left'></el-table-column>
  23. <el-table-column prop='Data.Data' label='查看分精度' show-overflow-tooltip min-width="90" header-align='center' align='center'>
  24. <template slot-scope="scope">
  25. <el-button style="padding:7px 15px;" @click="handleDrawer(scope.row, 0)"><i class="el-icon-s-data" style="font-size:15px;"></i></el-button>
  26. </template>
  27. </el-table-column>
  28. <el-table-column prop='Data.Time' label='对应值 - 获取时间' show-overflow-tooltip min-width="270" header-align='center' align='center' style="position:relative;">
  29. <template slot-scope="scope">
  30. <div style="width:175px;display:inline-block;">
  31. <span style="line-height:29px;">{{ scope.row.Data? (scope.row.Data.Data || '--'): '--' }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  32. <span style="line-height:29px;">{{ scope.row.Data? scope.row.Data.Time : '' }}</span>
  33. </div>
  34. <span style="width:55.33px;display:inline-block;padding-left:10px;">
  35. <el-button class="dialog-btn" @click="refreshThisRow(scope.row)"><i class="el-icon-refresh"></i></el-button>
  36. </span>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop='RelatedPoint' label='涉及子系统点位(数据来源)' show-overflow-tooltip min-width="150" align='center'>
  40. <template slot-scope="scope">
  41. <span style="display:inline-block;width:16px;line-height:29px;">{{ scope.row.RelatedPoint }}</span>
  42. <span style="width:55.33px;display:inline-block;padding-left:10px;">
  43. <el-button class="dialog-btn" v-if="scope.row.RelatedPoint" @click="handleDrawer(scope.row, 1)"><i class="el-icon-coin"></i></el-button>
  44. </span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop='RelatedInstance' label='涉及的对象实例(应用到)' show-overflow-tooltip min-width="150" align='center'>
  48. <template slot-scope="scope">
  49. <span style="display:inline-block;width:16px;line-height:29px;">{{ scope.row.RelatedInstance }}</span>
  50. <span style="width:55.33px;display:inline-block;padding-left:10px;">
  51. <el-button class="dialog-btn" v-if="scope.row.RelatedInstance" @click="handleDrawer(scope.row, 2)"><i class="el-icon-coin"></i></el-button>
  52. </span>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. <!-- 分页 -->
  57. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="pageSizes"
  58. :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="allTableData.length"
  59. style="float:right;margin-top:10px;padding:2px 5px;">
  60. </el-pagination>
  61. </div>
  62. <!-- 对话框和抽屉统一放在drawers中 -->
  63. <!-- 对话框 -->
  64. <el-dialog :title="'< ' + drawers[0].objId + ' > 的历史数据'" :visible.sync="drawers[0].drawer">
  65. <historyChart :tabFunNum='drawers[0].objId'></historyChart>
  66. </el-dialog>
  67. <!-- 抽屉 -->
  68. <el-drawer :title="'< ' + drawers[1].objId + ' > 的子系统点位'" :visible.sync="drawers[1].drawer" :direction="drawers[1].direction" size="35%">
  69. <dataSource :tabFunNum='drawers[1].objId'></dataSource>
  70. </el-drawer>
  71. <el-drawer :title="'< ' + drawers[2].objId + ' > 的对象实例'" :visible.sync="drawers[2].drawer" :direction="drawers[2].direction" size="35%">
  72. <objectInstance :tabFunNum='drawers[2].objId' :reValue='drawers[2].value'></objectInstance>
  73. </el-drawer>
  74. <el-dialog title="新增表号功能号" :visible.sync="drawers[3].drawer">
  75. <addTabFunNum @closeDrawer="closeDrawer()" @reloadData="reloadData()"></addTabFunNum>
  76. </el-dialog>
  77. </div>
  78. </template>
  79. <script>
  80. import { Message } from 'element-ui';
  81. import {
  82. getTabFunNumOverview
  83. } from '@/api/scan/request'
  84. import historyChart from './historyChart'
  85. import dataSource from './dataSource'
  86. import objectInstance from './objectInstance'
  87. import addTabFunNum from './addTabFunNum'
  88. export default {
  89. data() {
  90. return {
  91. //表格头样式
  92. headerStyle: {
  93. backgroundColor: '#e1e4e5',
  94. color: '#2b2b2b',
  95. lineHeight: '30px'
  96. },
  97. allTableData: [],//所有表格数据
  98. pageSizes: [10, 20, 50, 100],
  99. pageSize: 50,
  100. currentPage: 1,
  101. loading: false,//加载
  102. tabFunNum: null,//表号功能号
  103. //抽屉
  104. drawers: [
  105. { drawer: false, direction: 'rtl', objId: '' },
  106. { drawer: false, direction: 'rtl', objId: '' },
  107. { drawer: false, direction: 'rtl', objId: '', value: '' },
  108. { drawer: false, direction: 'rtl', objId: '' }
  109. ]
  110. }
  111. },
  112. methods: {
  113. //抽屉处理
  114. handleDrawer(row, index) {
  115. if (index == 2 || index == 1) {
  116. //实例数量大于0才能打开
  117. if ((row.RelatedInstance > 0 && index == 2) || (row.RelatedPoint > 0 && index == 1)) {
  118. this.drawers[index].value = row.Data ? row.Data.Data : '';
  119. this.drawers[index].objId = row.MeterFunc;
  120. this.drawers[index].drawer = true;
  121. }
  122. }
  123. else {
  124. if (index != 3)
  125. this.drawers[index].objId = row.MeterFunc;
  126. this.drawers[index].drawer = true;
  127. }
  128. },
  129. //获取统计数据
  130. getOverViewList() {
  131. this.loading = true;
  132. getTabFunNumOverview({ MeterFunc: this.tabFunNum }, res => {
  133. this.allTableData = res.Content;
  134. this.loading = false;
  135. });
  136. },
  137. //刷新当前行数据
  138. refreshThisRow(row) {
  139. let index = this.tableData.indexOf(row);
  140. let pa = {
  141. MeterFunc: row.MeterFunc
  142. }
  143. getTabFunNumOverview(pa, res => {
  144. if (res.Content[0].Data) {
  145. this.tableData[index].Data.Data = res.Content[0].Data.Data;
  146. this.tableData[index].Data.Time = res.Content[0].Data.Time;
  147. }
  148. this.tableData[index].DataQuality = res.Content[0].DataQuality;
  149. this.tableData[index].RelatedInstance = res.Content[0].RelatedInstance;
  150. this.tableData[index].RelatedPoint = res.Content[0].RelatedPoint;
  151. Message.success('已刷新');
  152. });
  153. },
  154. //分页更换size
  155. handleSizeChange(val) {
  156. this.pageSize = val;
  157. },
  158. //分页更换页
  159. handleCurrentChange(val) {
  160. this.currentPage = val;
  161. },
  162. //子组件关闭抽屉
  163. closeDrawer() {
  164. this.drawers[3].drawer = false;
  165. },
  166. //新建自定义后重载页面
  167. reloadData() {
  168. this.$emit('reloadData');
  169. },
  170. init() {
  171. this.getOverViewList();
  172. }
  173. },
  174. mounted() {
  175. this.init();
  176. },
  177. computed: {
  178. //根据分页,获取要展示的tableData
  179. tableData: function () {
  180. return this.allTableData.slice(
  181. (this.currentPage - 1) * this.pageSize,
  182. (this.currentPage * this.pageSize < this.allTableData.length) ? this.currentPage * this.pageSize : this.allTableData.length);
  183. }
  184. },
  185. components: {
  186. historyChart,
  187. dataSource,
  188. objectInstance,
  189. addTabFunNum
  190. }
  191. }
  192. </script>
  193. <style lang="less" scoped>
  194. #tabFunNumOverview {
  195. border-top: 5px solid #eee;
  196. height: calc(100% - 5px);
  197. width: 100%;
  198. overflow: hidden;
  199. }
  200. .table-area {
  201. height: calc(100% - 72px);
  202. padding: 0px 10px 10px 10px;
  203. }
  204. .table-area i {
  205. text-align: right;
  206. font-size: 12px;
  207. cursor: pointer;
  208. float: right;
  209. }
  210. .dialog-btn{
  211. display:none;
  212. height:29px;
  213. }
  214. /deep/ .el-drawer__body {
  215. height: 90%;
  216. }
  217. /deep/ .el-table__body-wrapper tr:hover{
  218. .dialog-btn{
  219. display:inline;
  220. }
  221. }
  222. /deep/ .el-dialog__body {
  223. padding-bottom:20px;
  224. }
  225. </style>