tabFunNumOverview.vue 7.4 KB

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