EquipmentInfo.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <template>
  2. <div class="equipment-info-module">
  3. <common-title title="设备基本运行情况"></common-title>
  4. <div class="visualization-common-border box">
  5. <!-- <a-row>
  6. <a-col :span="12">
  7. 湿度实值
  8. </a-col>
  9. <a-col :span="12">
  10. 30%R.H
  11. </a-col>
  12. <a-col :span="12">
  13. 温度实值
  14. </a-col>
  15. <a-col :span="12">
  16. 20℃
  17. </a-col>
  18. <a-col :span="12">
  19. 辐射强度实值
  20. </a-col>
  21. <a-col :span="12">
  22. 20W/㎡
  23. </a-col>
  24. </a-row> -->
  25. <!-- <div id="demo1">
  26. <div>湿度实值</div>
  27. <div>温度实值</div>
  28. <div>辐射强度实值</div>
  29. </div>
  30. <div>
  31. <div>30%R.H</div>
  32. <div>20℃</div>
  33. <div>20W/㎡</div>
  34. </div> -->
  35. <!-- <div style="height: 32%;display: flex; justify-content: center; align-items: center; font-size: 39px;">程序运行</div> -->
  36. <div style="height: 32%; display: flex; justify-content: center; align-items: center; font-size: 26px">
  37. {{ runStatus == 1 ? '程序运行' : '定值运行' }}
  38. </div>
  39. <div style="height: 36%; display: flex; flex-direction: row">
  40. <!-- 左 -->
  41. <div class="le" style="margin: 0 0.1% 0 2.4%">
  42. <div style="height: 15%; display: flex; justify-content: space-between">
  43. <span style="font-size: 12px">温度</span>
  44. <span style="font-size: 11px">设定{{ targetT }}℃</span>
  45. </div>
  46. <div style="height: 70%; display: flex; justify-content: center; align-items: center">
  47. <span style="font-size: 35px">{{ template }}</span>
  48. </div>
  49. <div style="height: 15%; display: flex; justify-content: end; align-items: center">
  50. <span style="font-size: 12px">℃</span>
  51. </div>
  52. </div>
  53. <!-- 中 -->
  54. <div class="le" style="margin: 0 0.1% 0 1%">
  55. <div style="height: 15%; display: flex; justify-content: space-between">
  56. <span style="font-size: 12px">湿度</span>
  57. <span style="font-size: 11px">设定{{ targetH }}%R.H</span>
  58. </div>
  59. <div style="height: 70%; display: flex; justify-content: center; align-items: center">
  60. <span style="font-size: 35px">{{ humidity }}</span>
  61. </div>
  62. <div style="height: 15%; display: flex; justify-content: end; align-items: center">
  63. <span style="font-size: 12px">%R.H</span>
  64. </div>
  65. </div>
  66. <!-- 右 -->
  67. <div class="le" style="margin: 0 0.1% 0 1%">
  68. <div style="height: 15%; display: flex; justify-content: space-between">
  69. <span style="font-size: 12px">辐射强度</span>
  70. <span style="font-size: 11px">设定{{ targetF }}W/㎡</span>
  71. </div>
  72. <div style="height: 70%; display: flex; justify-content: center; align-items: center">
  73. <span style="font-size: 35px">{{ irradiation }}</span>
  74. </div>
  75. <div style="height: 15%; display: flex; justify-content: end; align-items: center">
  76. <span style="font-size: 12px">W/㎡</span>
  77. </div>
  78. </div>
  79. </div>
  80. <div style="height: 22%; margin-top: 2%">
  81. <div class="bo">
  82. <!-- <div style="width: 35%; padding-left: 2%">{{alarmTime}}</div>
  83. <div style="width: 65%;">{{ information }}</div> -->
  84. <div style="width: 35%; padding-left: 2%" class="scroll-text">
  85. <div>
  86. <div class="number">{{ time1 }}</div>
  87. <div class="number">{{ time2 }}</div>
  88. </div>
  89. </div>
  90. <div style="width: 65%" class="scroll-text">
  91. <div>
  92. <div class="number">{{ inform1 }}</div>
  93. <div class="number">{{ inform2 }}</div>
  94. </div>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import commonTitle from '../components/commonTitle.vue'
  103. export default {
  104. components: { commonTitle },
  105. name: '',
  106. props: {
  107. data: {
  108. type: Array,
  109. default: function () {
  110. return [] // 使用工厂函数返回默认值
  111. },
  112. },
  113. // alarmData,
  114. alarmData: {
  115. type: Array,
  116. default: function () {
  117. return [] // 使用工厂函数返回默认值
  118. },
  119. },
  120. },
  121. data() {
  122. return {
  123. intervalId: null,
  124. // 获取数据(总)
  125. dataList: [],
  126. // 温度
  127. template: '',
  128. // 温度输出
  129. outputT: '',
  130. // 升温/降温(0升温,1降温,3啥也不是)
  131. statusT: 3,
  132. // 目标温度
  133. targetT: '',
  134. // 斜率设定(温度)
  135. slopeT: '',
  136. // 起始温度
  137. startT: '',
  138. // 辐照强度
  139. irradiation: '0',
  140. // 吹风
  141. // 时间
  142. // 辐照强度设定
  143. targetF: '0',
  144. // 辐射强度起始
  145. startF: '',
  146. // 湿度
  147. humidity: '',
  148. // 湿度输出
  149. outputH: '',
  150. // 加湿/除湿(0加湿,1除湿,3啥也不是)
  151. statusH: 3,
  152. // 目标湿度
  153. targetH: '',
  154. // 起始湿度
  155. startH: '',
  156. // 运行方式设定
  157. runStatus: '',
  158. // 报警信息
  159. alarmTime: '',
  160. information: '',
  161. time1: '',
  162. time2: '',
  163. inform1: '',
  164. inform2: '',
  165. inform: ['暂无数据'],
  166. time: [],
  167. // 测试
  168. // inform: ['Data 1', 'Data 2', 'Data 3', 'Data 4', 'Data 5', 'Data 6', 'Data 7', 'Data 8', 'Data 9'],
  169. // time: ['time 1', 'time 2', 'time 3', 'time 4', 'time 5', 'time 6', 'time 7', 'time 8', 'time 9'],
  170. counter: 0,
  171. }
  172. },
  173. watch: {
  174. data: {
  175. handler(newValue, oldValue) {
  176. // console.log('7878999',newValue, oldValue)
  177. if (newValue.length === 0) return
  178. this.dataList = newValue
  179. this.getList()
  180. },
  181. immediate: true,
  182. deep: true,
  183. },
  184. alarmData: {
  185. handler(newValue, oldValue) {
  186. // console.log('7878999',newValue, oldValue)
  187. var isYuan = newValue && newValue.length === 1 && newValue[0] === '原数据'
  188. if (isYuan) return
  189. this.inform = newValue.map((res) => {
  190. return res.tagname
  191. })
  192. this.time = newValue.map((res) => {
  193. return res.logtime
  194. })
  195. this.showData()
  196. // var hasAlarm = newValue
  197. // var options = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };
  198. // // this.information = hasAlarm ? newValue.tagname : '暂无数据'
  199. // // this.alarmTime = hasAlarm ? new Date(newValue.logtime.time).toLocaleDateString('zh-CN', options) : ''
  200. // var nInform = this.inform
  201. // var nTime = this.time
  202. // // ['原数据']表示按照原来数据进行,数据并未改变;[]和其他有数据的情况进行赋值并重新获取方法
  203. // // console.log(hasAlarm.length === 1 && hasAlarm[0] === '原数据')
  204. // var isYuan = hasAlarm.length === 1 && hasAlarm[0] === '原数据'
  205. // this.inform = !isYuan ? newValue.map(res => {
  206. // return res.tagname
  207. // }): nInform
  208. // this.time = !isYuan ? newValue.map(res => {
  209. // return res.logtime
  210. // }): nTime
  211. // // console.log(789, this.inform)
  212. // if(!isYuan){
  213. // this.showData()
  214. // }
  215. },
  216. immediate: true,
  217. deep: true,
  218. },
  219. },
  220. created() {
  221. // this.showData()
  222. },
  223. mounted() {},
  224. methods: {
  225. getList() {
  226. // console.log(this.dataList)
  227. for (var i = 0; i < this.dataList.length; i++) {
  228. // console.log(i,this.dataList[i].Name)
  229. // 温度
  230. if (this.dataList[i].Name == '当前温度值') {
  231. this.template = this.dataList[i].Value
  232. }
  233. if (this.dataList[i].Name == '温度设定值') {
  234. this.targetT = this.dataList[i].Value
  235. }
  236. // 辐照
  237. // 湿度
  238. if (this.dataList[i].Name == '当前湿度值') {
  239. this.humidity = this.dataList[i].Value
  240. }
  241. if (this.dataList[i].Name == '湿度设定值') {
  242. this.targetH = this.dataList[i].Value
  243. }
  244. // 运行方式
  245. if (this.dataList[i].Name == '运行方式设定') {
  246. this.runStatus = this.dataList[i].Value
  247. }
  248. }
  249. },
  250. showData() {
  251. // console.log(7891,this.inform)
  252. // 如果还有数据未显示
  253. if (this.counter < this.inform.length) {
  254. // 显示当前计数器指向的数据
  255. // console.log(this.inform[this.counter]);
  256. // console.log(this.time[this.counter]);
  257. this.time1 = this.time[this.counter]
  258. this.inform1 = this.inform[this.counter]
  259. // 如果还有一条数据可以显示
  260. if (this.counter + 1 < this.inform.length) {
  261. // console.log(this.inform[this.counter + 1]);
  262. // console.log(this.time[this.counter + 1]);
  263. this.time2 = this.time[this.counter + 1]
  264. this.inform2 = this.inform[this.counter + 1]
  265. }
  266. if (this.counter + 1 == this.inform.length) {
  267. this.time2 = ''
  268. this.inform2 = ''
  269. this.counter = -2
  270. }
  271. // 更新计数器
  272. this.counter += 2
  273. // 设置下一次调用的定时器
  274. setTimeout(this.showData, 3000)
  275. }
  276. if (this.counter == this.inform.length) {
  277. this.counter = 0
  278. }
  279. },
  280. },
  281. // 销毁定时器
  282. beforeDestroy(){
  283. clearTimeout(this.refreshData)
  284. }
  285. }
  286. </script>
  287. <style scoped>
  288. @import '~@/assets/less/uStyle.less';
  289. </style>
  290. <style lang="less" scoped>
  291. .equipment-info-module {
  292. width: 100%;
  293. height: 100%;
  294. }
  295. .box {
  296. width: 100%;
  297. height: calc(100% - 26px);
  298. border-width: 8px 0 0 6px;
  299. // border: 1px solid rgb(255, 255, 255);
  300. // display: flex;
  301. // /* row (默认值) : 主轴为水平万向,起点在左端。*/
  302. // flex-direction: row;
  303. }
  304. // .box>div#demo1{
  305. // width: 50%;
  306. // height: 94%;
  307. // margin: 2%;
  308. // color: #eeeeee;
  309. // font-size: 15px;
  310. // // border: 1px solid rgb(255, 255, 255);
  311. // }
  312. // .box>div{
  313. // width: 70%;
  314. // height: 94%;
  315. // margin-top: 2%;
  316. // color: #eeeeee;
  317. // font-size: 15px;
  318. // // border: 1px solid rgb(255, 255, 255);
  319. // }
  320. // .box>div>div{
  321. // padding: 5%;
  322. // }
  323. .box > div {
  324. width: 100%;
  325. color: #eeeeee;
  326. // border: 1px solid rgb(255, 255, 255);
  327. }
  328. .le {
  329. height: 100%;
  330. width: 31%;
  331. // border: 1px solid rgb(255, 255, 255);
  332. background: linear-gradient(#207ab7, #207ab7) left top, linear-gradient(#207ab7, #207ab7) left top,
  333. linear-gradient(#207ab7, #207ab7) right top, linear-gradient(#207ab7, #207ab7) right top,
  334. linear-gradient(#207ab7, #207ab7) left bottom, linear-gradient(#207ab7, #207ab7) left bottom,
  335. linear-gradient(#207ab7, #207ab7) right bottom, linear-gradient(#207ab7, #207ab7) right bottom;
  336. background-repeat: no-repeat;
  337. background-size: 0.05vw 1vw, 1vw 0.05vw;
  338. padding: 5px 2px;
  339. }
  340. .le > div {
  341. width: 100%;
  342. padding: 0 3% 0 3%;
  343. // border: 1px solid rgb(255, 255, 255);
  344. color: #eeeeee;
  345. align-items: center;
  346. }
  347. .bo {
  348. height: 95%;
  349. width: 95.5%;
  350. // border: 1px solid rgb(255, 255, 255);
  351. margin: 0 0.1% 0.5% 2.4%;
  352. background: linear-gradient(#207ab7, #207ab7) left top, linear-gradient(#207ab7, #207ab7) left top,
  353. linear-gradient(#207ab7, #207ab7) right top, linear-gradient(#207ab7, #207ab7) right top,
  354. linear-gradient(#207ab7, #207ab7) left bottom, linear-gradient(#207ab7, #207ab7) left bottom,
  355. linear-gradient(#207ab7, #207ab7) right bottom, linear-gradient(#207ab7, #207ab7) right bottom;
  356. background-repeat: no-repeat;
  357. background-size: 0.05vw 1vw, 1vw 0.05vw;
  358. display: flex;
  359. align-items: center;
  360. flex-direction: row;
  361. }
  362. .bo > div {
  363. height: 100%;
  364. color: #eeeeee;
  365. font-size: 16px;
  366. // padding-top: 0.2%;
  367. // border: 1px solid rgb(255, 255, 255);
  368. display: flex;
  369. align-items: center;
  370. }
  371. .scroll-text {
  372. overflow: hidden;
  373. white-space: nowrap;
  374. }
  375. .number {
  376. display: block;
  377. animation: scrollNumber 3s infinite steps(1);
  378. }
  379. // @keyframes scrollNumber {
  380. // 0% {
  381. // transform: translateX(20%);
  382. // }
  383. // 100% {
  384. // transform: translateX(-20%);
  385. // }
  386. // }
  387. </style>