index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <div class="app-container harmonicReport">
  3. <!-- 筛选start -->
  4. <div class="filter-container">
  5. <div class="left">
  6. <div>
  7. <div class="filter-item">
  8. 选择站点:
  9. <el-select
  10. v-model="store.state.siteId"
  11. placeholder="请选择"
  12. style="width: 220px"
  13. clearable
  14. filterable
  15. @change="linkDevice()"
  16. >
  17. <el-option
  18. v-for="site in store.state.siteList"
  19. :key="site"
  20. :label="site.siteName"
  21. :value="site.id"
  22. ></el-option>
  23. </el-select>
  24. </div>
  25. <div class="filter-item">
  26. 选择设备:
  27. <el-select
  28. v-model="deviceCode"
  29. placeholder="请选择"
  30. style="width: 150px"
  31. >
  32. <el-option
  33. v-for="device in deviceList"
  34. :key="device"
  35. :label="device.deviceName"
  36. :value="device.deviceCode"
  37. ></el-option>
  38. <!-- <el-option label="设备1" value="DA00021026"></el-option> -->
  39. </el-select>
  40. </div>
  41. <div class="filter-item">
  42. 时间:
  43. <el-date-picker
  44. v-model="dateTime"
  45. :type="dateType"
  46. placeholder="请选择"
  47. style="width: 150px"
  48. :clearable="false"
  49. :editable="false"
  50. ></el-date-picker>
  51. <el-radio-group
  52. v-model="listTabPosition"
  53. @change="listTabsChange(listTabPosition)"
  54. style="display: inline-block; position: relative; top: -3px"
  55. >
  56. <el-radio-button label="dayValue">按日</el-radio-button>
  57. <el-radio-button label="monthValue">按月</el-radio-button>
  58. </el-radio-group>
  59. <!-- <el-button
  60. class="search-button timeTab"
  61. @click="num = 0"
  62. :type="num == 0 ? 'primary' : ''"
  63. >
  64. 按日
  65. </el-button>
  66. <el-button
  67. class="search-button timeTab"
  68. @click="num = 1"
  69. :type="num == 1 ? 'primary' : ''"
  70. style="margin-left: 0 !important"
  71. >
  72. 按月
  73. </el-button> -->
  74. </div>
  75. <el-button type="primary" class="search-button" @click="listSelect()">
  76. 搜索
  77. </el-button>
  78. </div>
  79. </div>
  80. </div>
  81. <!-- 筛选end -->
  82. <el-button
  83. class="search-button timeTab"
  84. @click="num2 = 0"
  85. :type="num2 == 0 ? 'primary' : ''"
  86. >
  87. 曲线
  88. </el-button>
  89. <el-button
  90. class="search-button timeTab"
  91. @click="num2 = 1"
  92. :type="num2 == 1 ? 'primary' : ''"
  93. style="margin-left: 0 !important"
  94. >
  95. 表格
  96. </el-button>
  97. <div v-if="num2 == 0">
  98. <div v-for="curve in curveComList" :key="curve">
  99. <curve-com :curveComList="curve" v-loading="loading"></curve-com>
  100. </div>
  101. <!-- <curve-comA></curve-comA>
  102. <curve-comB></curve-comB>
  103. <curve-comC></curve-comC> -->
  104. </div>
  105. <table-com v-if="num2 == 1" :tableList="tableList"></table-com>
  106. </div>
  107. </template>
  108. <script>
  109. import curveCom from './curveCom'
  110. // import curveComA from './curveComA'
  111. // import curveComB from './curveComB'
  112. // import curveComC from './curveComC'
  113. import tableCom from './tableCom'
  114. import { useStore } from 'vuex'
  115. import { defineComponent, onMounted, ref } from 'vue'
  116. import * as api from '@/api/powerQuality/harmonicReport'
  117. import { ElMessage } from 'element-plus'
  118. import { ElNotification } from 'element-plus'
  119. export default defineComponent({
  120. name: 'VariableList',
  121. components: {
  122. curveCom,
  123. // curveComA,
  124. // curveComB,
  125. // curveComC,
  126. tableCom,
  127. },
  128. setup() {
  129. const store = useStore()
  130. const loading=ref(false)
  131. const dateType = ref('date')
  132. const listTabPosition = ref('dayValue')
  133. // const deviceCode = ref('')
  134. const deviceCode = ref('DA00021026')
  135. const deviceList = ref([])
  136. const dateTime = ref(new Date())
  137. const tableList = ref([]) //表格子页面数据传递存储
  138. const curveComList = ref([
  139. {
  140. name: 'A相电流(A)',
  141. icontitle: 'Ia',
  142. dateList: [],
  143. data: [],
  144. },
  145. {
  146. name: 'B相电流(A)',
  147. icontitle: 'Ib',
  148. dateList: [],
  149. data: [],
  150. },
  151. {
  152. name: 'C相电流(A)',
  153. icontitle: 'Ic',
  154. dateList: [],
  155. data: [],
  156. },
  157. ])
  158. function linkDevice() {
  159. deviceSelect()
  160. }
  161. function deviceSelect() {
  162. api.deviceListOne({ siteId: store.state.siteId }).then((requset) => {
  163. if (requset.status === 'SUCCESS') {
  164. deviceList.value = requset.data
  165. deviceCode.value = requset.data[0] ? requset.data[0].deviceCode : ''
  166. listTabsChange('dayValue')
  167. } else {
  168. ElMessage.error(requset.msg)
  169. }
  170. })
  171. }
  172. const listTabsChange = (value) => {
  173. value == 'dayValue'
  174. ? (dateType.value = 'date')
  175. : (dateType.value = 'month')
  176. }
  177. function listSelect() {
  178. loading.value=true
  179. let list = {}
  180. if (listTabPosition.value == 'dayValue') {
  181. store.commit('getNowFormatDate', dateTime.value)
  182. list = {
  183. deviceCode: deviceCode.value,
  184. startTime: store.state.dateList + ' ' + '00:00:00',
  185. endTime: store.state.dateList + ' ' + '23:59:59',
  186. }
  187. } else {
  188. store.commit('getCurrentMonthLast', dateTime.value)
  189. list = {
  190. deviceCode: deviceCode.value,
  191. startTime: store.state.monthList[0] + ' ' + '00:00:00',
  192. endTime: store.state.monthList[1] + ' ' + '23:59:59',
  193. }
  194. }
  195. if(!deviceCode.value){
  196. ElNotification({
  197. title: '提示',
  198. message: '请选择左侧设备信息',
  199. type: 'warning',
  200. })
  201. }else{
  202. api.rtRealScore(list).then((requset) => {
  203. setTimeout(()=>{
  204. loading.value=false
  205. },200)
  206. if (requset.status === 'SUCCESS') {
  207. tableList.value = requset.data
  208. if (tableList.value.length==0) {
  209. ElMessage.warning('暂无结果')
  210. }
  211. curveComList.value[0].data = []
  212. curveComList.value[0].dateList = []
  213. curveComList.value[1].data = []
  214. curveComList.value[1].dateList = []
  215. curveComList.value[2].data = []
  216. curveComList.value[2].dateList = []
  217. requset.data.map((val) => {
  218. curveComList.value[0].data.push(val.ia)
  219. curveComList.value[0].dateList.push(val.dataTime)
  220. curveComList.value[1].data.push(val.ib)
  221. curveComList.value[1].dateList.push(val.dataTime)
  222. curveComList.value[2].data.push(val.ic)
  223. curveComList.value[2].dateList.push(val.dataTime)
  224. })
  225. } else {
  226. ElMessage.error(requset.msg)
  227. }
  228. })
  229. }
  230. }
  231. onMounted(() => {
  232. deviceSelect()
  233. listSelect()
  234. })
  235. return {
  236. listTabsChange,
  237. listSelect,
  238. deviceSelect,
  239. linkDevice,
  240. store,
  241. dateType,
  242. dateTime,
  243. tableList,
  244. deviceCode,
  245. deviceList,
  246. curveComList,
  247. listTabPosition,
  248. num: ref(0),
  249. num2: ref(0),
  250. select: 1,
  251. currentPage4: 4,
  252. showDialog: false,
  253. tabPosition: 'one',
  254. input: '',
  255. region: '',
  256. loading
  257. }
  258. },
  259. })
  260. </script>
  261. <style lang="scss" scoped>
  262. </style>