EquipmentInfo.vue 12 KB

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