history.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <div>
  3. <div class="table-page-search-wrapper">
  4. <a-form layout="inline" :model="queryParams" ref="queryForm">
  5. <a-row :gutter="24">
  6. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  7. <a-form-item label="设备名称">
  8. <j-search-select-tag v-model="queryParams.equipmentid" dict="tpm_equipment,equipmentname,id" style="width: 100%"/>
  9. </a-form-item>
  10. </a-col>
  11. <a-col :xl="6" :lg="11" :md="12" :sm="24">
  12. <a-form-item label="查询日期">
  13. <a-date-picker v-model="queryParams.date" placeholder="选择日期" style="width:100%;" @change="handleQuery" />
  14. </a-form-item>
  15. </a-col>
  16. <!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">
  17. <a-form-item label="参数类型">
  18. <j-dict-select-tag v-model="queryParams.tagtype" placeholder="请输入优先级" dictCode="tpm_tag_type"/>
  19. </a-form-item>
  20. </a-col> -->
  21. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  22. <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
  23. <a-button type="primary" @click="handleQuery" icon="search">查询</a-button>
  24. </span>
  25. </a-col>
  26. </a-row>
  27. </a-form>
  28. </div>
  29. <!-- table区域-begin -->
  30. <div>
  31. <a-table
  32. ref="table"
  33. size="middle"
  34. :scroll="{ x: true }"
  35. bordered
  36. rowKey="id"
  37. :columns="columns"
  38. :dataSource="dataSource"
  39. :pagination="ipagination"
  40. class="j-table-force-nowrap"
  41. >
  42. <template slot="htmlSlot" slot-scope="text">
  43. <div v-html="text"></div>
  44. </template>
  45. <template slot="imgSlot" slot-scope="text, record">
  46. <span v-if="!text" style="font-size: 12px; font-style: italic">无图片</span>
  47. <img
  48. v-else
  49. :src="getImgView(text)"
  50. :preview="record.equipmentid"
  51. height="25px"
  52. alt=""
  53. style="max-width: 80px; font-size: 12px; font-style: italic"
  54. />
  55. </template>
  56. <template slot="fileSlot" slot-scope="text">
  57. <span v-if="!text" style="font-size: 12px; font-style: italic">无文件</span>
  58. <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
  59. 下载
  60. </a-button>
  61. </template>
  62. </a-table>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import { mixinDevice } from '@/utils/mixin'
  68. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  69. import { httpAction, getAction } from '@/api/manage'
  70. import { pvdata } from '../../module_ems/photovoltaic/pvdata'
  71. export default {
  72. name: 'history',
  73. mixins: [JeecgListMixin, mixinDevice],
  74. data() {
  75. return {
  76. loading: true,
  77. // 数据
  78. tpmequiponoffsectionList: [],
  79. // 查询参数
  80. queryParams: {
  81. date: '',
  82. pageNum: 1,
  83. pageSize: 1000,
  84. equipmentid: '1780110297413861377',
  85. // tagtype: null,
  86. },
  87. dataSource: [],
  88. url: {
  89. list: '/tpmParams/tpmParams/list',
  90. },
  91. // 表头
  92. columns: [
  93. {
  94. title: '序号',
  95. dataIndex: '',
  96. key: 'rowIndex',
  97. width: 60,
  98. align: 'center',
  99. customRender: function (t, r, index) {
  100. return parseInt(index) + 1;
  101. },
  102. },
  103. {
  104. title: '点位名称',
  105. align: 'center',
  106. // dataIndex: 'tagname',
  107. dataIndex: 'MeterCode',
  108. },
  109. {
  110. title: '时间',
  111. align: 'center',
  112. // dataIndex: 'logtime',
  113. dataIndex: 'Time',
  114. },
  115. {
  116. title: '值',
  117. align: 'center',
  118. // dataIndex: 'tagvalue2',
  119. dataIndex: 'Power',
  120. },
  121. ],
  122. }
  123. },
  124. created() {},
  125. mounted() {
  126. this.$nextTick(() => {
  127. var now = this.dateformat(new Date()).substring(0, 10)
  128. this.queryParams.date = now
  129. this.handleQuery()
  130. // this.getTest()
  131. })
  132. },
  133. methods: {
  134. /** 重置按钮操作 */
  135. resetQuery() {
  136. this.handleQuery()
  137. },
  138. dateformat(date) {
  139. var year = date.getFullYear()
  140. var month = date.getMonth() + 1
  141. month = month < 10 ? '0' + month : month
  142. var strDate = date.getDate()
  143. strDate = strDate < 10 ? '0' + strDate : strDate
  144. var hour = date.getHours()
  145. hour = hour < 10 ? '0' + hour : hour
  146. var minute = date.getMinutes()
  147. minute = minute < 10 ? '0' + minute : minute
  148. var second = date.getSeconds()
  149. second = second < 10 ? '0' + second : second
  150. return year + '-' + month + '-' + strDate + ' ' + hour + ':' + minute + ':' + second
  151. },
  152. // 后端好了需要删掉
  153. getTest() {
  154. var _this = this;
  155. _this.ipagination.current = 1
  156. var rowid=0;
  157. pvdata.mdcurveanalysisdata.forEach((item) => {
  158. item.data.forEach((i) => {
  159. i.id = rowid;
  160. _this.dataSource.push(i);
  161. rowid++;
  162. })
  163. })
  164. },
  165. handleQuery() {
  166. var _this = this
  167. if (!this.queryParams.equipmentid) {
  168. this.$message.error('请选择设备!')
  169. return
  170. }
  171. if (!this.queryParams.date) {
  172. this.$message.error('请选择查询日期!')
  173. return
  174. }
  175. _this.loading = true
  176. getAction(this.url.list, _this.queryParams).then((response) => {
  177. _this.dataSource = response.result
  178. this.loading = false
  179. })
  180. },
  181. },
  182. }
  183. </script>
  184. <style lang="less" scoped>
  185. @import '~@/assets/less/uStyle.less';
  186. </style>
  187. <style lang="less">
  188. .trend-charts {
  189. padding: 10px;
  190. margin-top: 10px;
  191. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  192. }
  193. </style>