index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div>
  3. <Head :headText='headText'></Head>
  4. <div class='nav-right'>
  5. <img class='nav-icon' v-if='chillerIsNotExecutedCount!=undefined' src='@/assets/shape.png' alt />
  6. <span class='nav-text1' v-if='chillerIsNotExecutedCount!=undefined'>今日已收到 {{chillerCount}} 条策略,其中有 {{chillerIsNotExecutedCount}} 条未执行</span>
  7. <span class='nav-text' v-else>今天已收到 {{chillerCommand.chillerCount || 0}} 条策略</span>
  8. <span class='nav-look MicrYaHei' @click='lookSnapshot' v-if='parseInt(chillerCommand.chillerCount)||parseInt(chillerCount )> 0'>查看</span>
  9. </div>
  10. <div class='strategyContainer'>
  11. <div class='strate-left'>
  12. <div class='strate-left-1'>今天营业时间</div>
  13. <div
  14. class='strate-left-2'
  15. >{{chillerOrg.openTime?( chillerOrg.openTime.slice(0,2)+':'+chillerOrg.openTime.slice(2,4)):"--"}} - {{chillerOrg.endTime?(chillerOrg.endTime.slice(0,2)+':'+chillerOrg.endTime.slice(2,4)):"--"}}</div>
  16. <div class='strate-left-1'>当前运行模式</div>
  17. <div class='strate-left-2'>{{chillerOrg.model || '--'}}</div>
  18. <div class='strate-left-box'>
  19. <div class='strate-left-info-1'>通风策略</div>
  20. <div
  21. class='strate-left-info'
  22. >开启时间:{{chillerOrg.freshAirEqOpenTime?(chillerOrg.freshAirEqOpenTime.slice(0,2)+":"+chillerOrg.freshAirEqOpenTime.slice(2,4)):"--"}} - {{chillerOrg.freshAirEqCloseTime?(chillerOrg.freshAirEqCloseTime.slice(0,2)+":"+chillerOrg.freshAirEqCloseTime.slice(2,4)):"--"}}</div>
  23. <div class='strate-left-info'>新风机组:{{chillerOrg.freshAirHandlingUnit}}</div>
  24. <div class='strate-left-info'>组合式空调机组:{{chillerOrg.airHandlingUnit}}</div>
  25. </div>
  26. </div>
  27. <div class='starte-right'>
  28. <p class='strate-right-title'>当前状态</p>
  29. <water-unit :data='chillerOrg ' :type='1'></water-unit>
  30. <animation-box
  31. v-if='Object.keys(chillerCommand).length>0||chillerHourList.length>0'
  32. :data='chillerOrg'
  33. :chillerHourList='chillerHourList'
  34. :chillerCommandQ='chillerCommand'
  35. ></animation-box>
  36. </div>
  37. </div>
  38. <el-dialog title='提示' :visible.sync='showTodayStrategy' width='1260px'>
  39. <today-strategy v-if='tableData.length>0 && idArr.length>0' :data='tableData' :idArr='idArr'></today-strategy>
  40. </el-dialog>
  41. </div>
  42. </template>
  43. <script>
  44. import Head from '../main/index'
  45. import animationBox from './animationBox'
  46. import waterUnit from './waterUnit'
  47. import TodayStrategy from '@/components/todayStrategy.vue'
  48. import { queryCommand, getCommand } from '@/api/strategy/strategy.js'
  49. export default {
  50. data() {
  51. return {
  52. headText: '当日运行策略',
  53. navText: true,
  54. showTodayStrategy: false,
  55. tableData: [],
  56. chillerCommand: {},
  57. chillerCount: 0,
  58. chillerIsNotExecutedCount: 0,
  59. today: '',
  60. now: '',
  61. chillerOrg: {},
  62. chillerHourList: [],
  63. idArr: []
  64. }
  65. },
  66. components: {
  67. Head,
  68. animationBox,
  69. waterUnit,
  70. TodayStrategy
  71. },
  72. methods: {
  73. lookSnapshot() {
  74. this.showTodayStrategy = true
  75. this.getData()
  76. // console.log(this.$store.state);
  77. },
  78. formatTime() {
  79. let year = new Date().getFullYear()
  80. let month = new Date().getMonth() + 1 >= 10 ? new Date().getMonth() + 1 : '0' + (new Date().getMonth() + 1)
  81. let date = new Date().getDate() >= 10 ? new Date().getDate() : '0' + new Date().getDate()
  82. return (this.today = year + '' + month + '' + date)
  83. },
  84. getPer5Time() {
  85. let now = new Date().getTime()
  86. let datetime = now - 5 * 60 * 1000
  87. let hours = new Date(datetime).getHours() < 10 ? '0' + new Date(datetime).getHours() : new Date(datetime).getHours()
  88. let minute = new Date(datetime).getMinutes() < 10 ? '0' + new Date(datetime).getMinutes() : new Date(datetime).getMinutes()
  89. return (this.now = hours + '' + minute)
  90. },
  91. getChiller() {
  92. let params = {
  93. getParams: {}
  94. }
  95. queryCommand(params).then(res => {
  96. console.log(res)
  97. this.chillerCount = res.chillerCount || 0
  98. this.chillerIsNotExecutedCount = res.chillerIsNotExecutedCount ? res.chillerIsNotExecutedCount : 0
  99. this.chillerOrg = res.chillerOrg || {}
  100. this.chillerCommand = res.chillerCommand || {}
  101. this.chillerHourList = res.chillerHourList
  102. })
  103. },
  104. getData() {
  105. this.idArr = []
  106. let params = {
  107. postParams: {
  108. criteria: {
  109. projectId: this.$store.state.projectId,
  110. date: this.today,
  111. status: {
  112. $in: [2, 4]
  113. }
  114. }
  115. }
  116. }
  117. console.log(this.$store.state.userInfo.userId)
  118. // return
  119. getCommand(params).then(res => {
  120. this.tableData = res.content ? res.content : []
  121. if (this.tableData.length > 0) {
  122. this.tableData.forEach(el => {
  123. this.idArr.push(el.appealId)
  124. })
  125. }
  126. console.log(this.tableData)
  127. })
  128. }
  129. },
  130. mounted() {
  131. this.formatTime()
  132. this.getPer5Time()
  133. // let vm = this
  134. // setInterval(function(){
  135. // vm.getData()
  136. // },1500)
  137. // this.getQuickData();
  138. this.getChiller()
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .nav-right {
  144. height: 48px;
  145. position: fixed;
  146. right: 24px;
  147. top: 48px;
  148. z-index: 1;
  149. display: flex;
  150. align-items: center;
  151. .nav-text {
  152. height: 22px;
  153. font-size: 14px;
  154. font-family: PingFangSC-Regular, PingFang SC;
  155. font-weight: 400;
  156. color: rgba(31, 36, 41, 1);
  157. line-height: 20px;
  158. }
  159. .nav-text1 {
  160. margin: 0 4px;
  161. height: 20px;
  162. font-size: 14px;
  163. font-family: PingFangSC-Regular, PingFang SC;
  164. font-weight: 400;
  165. color: rgba(245, 78, 69, 1);
  166. line-height: 20px;
  167. }
  168. .nav-icon {
  169. width: 16px;
  170. height: 14px;
  171. }
  172. .nav-look {
  173. height: 22px;
  174. font-size: 14px;
  175. color: rgba(0, 145, 255, 1);
  176. line-height: 22px;
  177. margin: 0 12px;
  178. cursor: pointer;
  179. }
  180. }
  181. .strategyContainer {
  182. background: #fff;
  183. display: flex;
  184. .strate-left {
  185. min-width: 224px;
  186. background: #fff;
  187. border-right: 1px solid #f7f9fa;
  188. margin-left: 16px;
  189. .strate-left-1 {
  190. margin-top: 24px;
  191. color: #646c73;
  192. font-size: 14px;
  193. }
  194. .strate-left-2 {
  195. margin-top: 8px;
  196. font-size: 20px;
  197. }
  198. .strate-left-box {
  199. width: 192px;
  200. height: 150px;
  201. border-radius: 6px;
  202. background: #e4e5e7;
  203. margin-top: 67px;
  204. .strate-left-info-1 {
  205. padding-top: 20px;
  206. padding-left: 20px;
  207. font-size: 16px;
  208. color: #1f2429;
  209. }
  210. .strate-left-info {
  211. padding-left: 20px;
  212. font-size: 14px;
  213. margin-top: 8px;
  214. color: #646c73;
  215. }
  216. }
  217. }
  218. .starte-right {
  219. margin-right: 30px;
  220. flex: 1;
  221. .starte-right-title {
  222. height: 74px;
  223. line-height: 74px;
  224. color: #1f2429;
  225. font-size: 22px;
  226. }
  227. }
  228. }
  229. </style>