index.vue 6.2 KB

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