tabFunNumOverview.vue 9.5 KB

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