warpKnitting.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <template>
  2. <van-nav-bar :title="$t('warpKnitting.name')" left-arrow @click-left="onClickLeft" />
  3. <van-pull-refresh v-model="loading" @refresh="onRefresh">
  4. <div class="warpKnitting">
  5. <div class="stat">
  6. <div class="title">
  7. <span>{{$t('common.equipmentStatus')}}</span>
  8. <div class="type">{{swichType ? $t('common.running') : $t('common.offline')}}</div>
  9. </div>
  10. <ul>
  11. <li>
  12. <div class="icon">
  13. <img src="@/assets/images/icon_ebc1.png" alt="">
  14. </div>
  15. <div class="text">EBC</div>
  16. <div class="btn">{{swichType ? $t('common.running') : $t('common.offline')}}</div>
  17. </li>
  18. <li>
  19. <div class="icon">
  20. <img src="@/assets/images/icon_jk1.png" alt="">
  21. </div>
  22. <div class="text">{{$t('equipment.jaka')}}</div>
  23. <div class="btn">{{swichType ? $t('common.running') : $t('common.offline')}}</div>
  24. </li>
  25. <li>
  26. <div class="icon">
  27. <img src="@/assets/images/icon_hy1.png" alt="">
  28. </div>
  29. <div class="text">{{$t('equipment.horizontalShift')}}</div>
  30. <div class="btn">{{swichType ? $t('common.running') : $t('common.offline')}}</div>
  31. </li>
  32. </ul>
  33. </div>
  34. <div class="speed">
  35. <div style="display: flex">
  36. <div class="icon">
  37. <img src="@/assets/images/icon_zzzs.png" alt="">
  38. </div>
  39. <div class="text">{{$t('warpKnitting.spindleSpeed')}}</div>
  40. </div>
  41. <div class="num">{{deviceData.status.main_speed / 2}} RPM</div>
  42. </div>
  43. <!-- <div class="commons-title">产量数据</div>
  44. <div class="chart-warp">
  45. <div class="chart-box" id="myCharts" ref="myCharts"></div>
  46. <div class="label-box">
  47. </div>
  48. </div> -->
  49. <div class="commons-title">EBC</div>
  50. <ul class="buchang">
  51. <li>
  52. <div class="icon">
  53. <i class="iconfont icon-icon_dqbc"></i>
  54. </div>
  55. <div class="text">{{$t('warpKnitting.currentClothLength')}}</div>
  56. <div class="btn">{{deviceData.status.bu_len / 100}} M</div>
  57. </li>
  58. <li>
  59. <div class="icon">
  60. <i class="iconfont icon-icon_sdbc"></i>
  61. </div>
  62. <div class="text">{{$t('warpKnitting.setClothLength')}}</div>
  63. <div class="btn">{{deviceData.parameter.max_bulen}} M</div>
  64. </li>
  65. <li>
  66. <div class="icon">
  67. <i class="iconfont icon-icon_midu"></i>
  68. </div>
  69. <div class="text">{{$t('warpKnitting.density')}}</div>
  70. <div class="btn">{{deviceData.parameter.bumi}} Row/cm</div>
  71. </li>
  72. </ul>
  73. <ul class="qianla">
  74. <li>
  75. <div class="icon">
  76. <i class="iconfont icon-icon_qianla"></i>
  77. </div>
  78. <div class="text">{{$t('warpKnitting.traction')}}</div>
  79. </li>
  80. <li>
  81. <div class="icon">
  82. <i class="iconfont icon-icon_juanzhou"></i>
  83. </div>
  84. <div class="text">{{$t('warpKnitting.crimp')}}</div>
  85. </li>
  86. </ul>
  87. <ul class="songjin">
  88. <li v-for="i in axisData" :key="i.index">
  89. <div style="display: flex">
  90. <div class="icon">
  91. <i class="iconfont icon-icon_songjingz"></i>
  92. </div>
  93. <div class="text" style="margin-left: 8px">
  94. {{$t('warpKnitting.warpLetOffAxis')}}
  95. </div>
  96. </div>
  97. <div class="num">
  98. <p>{{$t('warpKnitting.remainingTurns')}}: <span>{{i.curr}} N</span></p>
  99. <p>{{$t('warpKnitting.timeRemaining')}}: <span>{{i.time}} H</span></p>
  100. </div>
  101. </li>
  102. </ul>
  103. </div>
  104. </van-pull-refresh>
  105. </template>
  106. <script setup>
  107. import * as echarts from 'echarts'
  108. import { ref, onMounted,getCurrentInstance } from 'vue'
  109. import { useRouter } from 'vue-router'
  110. const proxy = getCurrentInstance().proxy
  111. const loading = ref(false)
  112. const onRefresh = () => {
  113. getDtl()
  114. setTimeout(() => {
  115. loading.value = false
  116. }, 500)
  117. }
  118. const swichType = ref(false)
  119. const router = useRouter()
  120. let deviceData = ref({
  121. status:{},
  122. parameter:{},
  123. })
  124. let axisData = ref([])
  125. const getDtl = () => {
  126. axisData.value = []
  127. proxy.post('/tdaDevice/data', { deviceId: router.currentRoute.value.params.id }).then(
  128. (res) => {
  129. for (let key in res.data.parameter) {
  130. if(key.substring(0,11) === 'axis_allnum'){
  131. axisData.value.push({
  132. axis:res.data.parameter[key],
  133. index:key.substring(12,13),
  134. curr:res.data.status['curr_num_' + key.substring(12,13)] || 0,
  135. time:res.data.status['left_time_' + key.substring(12,13)] || 0,
  136. })
  137. }
  138. }
  139. function up(x,y){
  140. return x.index -y.index;
  141. }
  142. axisData.value.sort(up)
  143. const time1 = new Date(res.data.eventTime).getTime()
  144. const time2 = new Date().getTime()
  145. if(time1 + 600000 - new Date().getTimezoneOffset() * 60 * 1000> time2){
  146. swichType.value = true
  147. }else{
  148. swichType.value = false
  149. }
  150. console.log(swichType.value)
  151. deviceData.value = res.data
  152. }
  153. )
  154. }
  155. const onClickLeft = () => history.back();
  156. getDtl()
  157. onMounted(() => {
  158. // const myChart = echarts.init(document.getElementById('myCharts'))
  159. const option = {
  160. grid: {
  161. top: '8%',
  162. left: '4%',
  163. right: '8%',
  164. bottom: '8%',
  165. containLabel: true,
  166. },
  167. tooltip: {
  168. trigger: 'axis',
  169. axisPointer: {
  170. type: 'cross',
  171. label: {
  172. backgroundColor: '#6a7985',
  173. },
  174. },
  175. },
  176. xAxis: {
  177. type: 'category',
  178. boundaryGap: false,
  179. data: ['0', '1', '2', '3', '4', '5', '6'],
  180. },
  181. yAxis: {
  182. type: 'value',
  183. },
  184. series: [
  185. {
  186. data: [135, 135, 122, 211, 345, 567, 654],
  187. type: 'line',
  188. symbolSize: 10,
  189. showSymbol: false,
  190. areaStyle: {
  191. opacity: 0,
  192. },
  193. stack: 'Total',
  194. smooth: true,
  195. lineStyle: {
  196. normal: {
  197. color: '#0084FF',
  198. width: 4,
  199. },
  200. },
  201. },
  202. {
  203. data: [150, 150, 150, 150, 150, 150, 150],
  204. type: 'line',
  205. symbolSize: 10,
  206. showSymbol: false,
  207. areaStyle: {
  208. opacity: 0,
  209. },
  210. lineStyle: {
  211. normal: {
  212. color: '#FF8C33',
  213. width: 4,
  214. },
  215. },
  216. },
  217. ],
  218. }
  219. //myChart.setOption(option)
  220. })
  221. </script>
  222. <style lang="scss" scoped>
  223. .warpKnitting {
  224. padding: 0 12px 80px;
  225. .chart-warp{
  226. background: #fff;
  227. .chart-box {
  228. height: 250px;
  229. }
  230. }
  231. .songjin {
  232. li {
  233. height: 74px;
  234. background: #ffffff;
  235. border-radius: 5px 5px 5px 5px;
  236. line-height: 50px;
  237. display: flex;
  238. justify-content: space-between;
  239. margin-top: 12px;
  240. padding: 12px;
  241. box-sizing: border-box;
  242. font-size: 14px;
  243. .icon {
  244. width: 50px;
  245. height: 50px;
  246. border-radius: 50%;
  247. background: #eeeeee;
  248. text-align: center;
  249. i{
  250. color: #0084FF;
  251. font-size: 24px;
  252. }
  253. }
  254. .num {
  255. margin-left: 8px;
  256. font-size: 14px;
  257. font-weight: 500;
  258. color: #333;
  259. p {
  260. margin: 0;
  261. line-height: 25px;
  262. color: #999999;
  263. }
  264. span {
  265. color: #333333;
  266. }
  267. }
  268. }
  269. }
  270. .qianla {
  271. display: flex;
  272. justify-content: space-between;
  273. margin-top: 12px;
  274. li {
  275. display: flex;
  276. width: 49%;
  277. line-height: 50px;
  278. padding: 12px;
  279. box-sizing: border-box;
  280. font-size: 14px;
  281. background: #ffffff;
  282. border-radius: 5px 5px 5px 5px;
  283. .icon {
  284. width: 50px;
  285. height: 50px;
  286. border-radius: 50%;
  287. background: #eeeeee;
  288. text-align: center;
  289. i{
  290. font-size: 24px;
  291. color: #0084ff;
  292. }
  293. }
  294. .text {
  295. margin-left: 8px;
  296. font-size: 14px;
  297. font-weight: 500;
  298. color: #333;
  299. }
  300. }
  301. }
  302. .buchang {
  303. display: flex;
  304. justify-content: space-between;
  305. text-align: center;
  306. li {
  307. width: 32%;
  308. background: #ffffff;
  309. border-radius: 5px 5px 5px 5px;
  310. line-height: 50px;
  311. padding: 12px;
  312. box-sizing: border-box;
  313. font-size: 14px;
  314. .icon {
  315. width: 50px;
  316. height: 50px;
  317. border-radius: 50%;
  318. background: #eeeeee;
  319. display: flex;
  320. justify-content: center;
  321. align-items: center;
  322. margin: 0 auto;
  323. i{
  324. color: #0084FF;
  325. font-size: 24px;
  326. }
  327. }
  328. .btn {
  329. font-size: 16px;
  330. font-weight: bold;
  331. line-height: 20px;
  332. }
  333. .text {
  334. line-height: 20px;
  335. margin: 12px 0 8px;
  336. }
  337. }
  338. }
  339. .speed {
  340. height: 74px;
  341. background: #ffffff;
  342. border-radius: 5px 5px 5px 5px;
  343. line-height: 50px;
  344. display: flex;
  345. justify-content: space-between;
  346. margin-top: 12px;
  347. padding: 12px;
  348. box-sizing: border-box;
  349. font-size: 14px;
  350. .icon {
  351. width: 50px;
  352. height: 50px;
  353. border-radius: 15px;
  354. display: flex;
  355. justify-content: center;
  356. align-items: center;
  357. margin-right: 12px;
  358. img{
  359. width: 100%;
  360. height: 100%;
  361. }
  362. }
  363. .num {
  364. font-size: 16px;
  365. font-weight: bold;
  366. }
  367. }
  368. .stat {
  369. background: #ffffff;
  370. border-radius: 5px 5px 5px 5px;
  371. margin-top: 12px;
  372. .title {
  373. display: flex;
  374. justify-content: space-between;
  375. align-items: center;
  376. height: 48px;
  377. line-height: 48px;
  378. padding: 0 12px;
  379. border-bottom: 1px solid #dddddd;
  380. .type {
  381. color: #00b0ff;
  382. font-size: 14px;
  383. width: 60px;
  384. height: 24px;
  385. background: #f1f1f1;
  386. color: #3fbf31;
  387. line-height: 24px;
  388. position: relative;
  389. border-radius: 12px 12px 12px 12px;
  390. padding-left: 20px;
  391. box-sizing: border-box;
  392. }
  393. .type:before {
  394. content: '';
  395. position: absolute;
  396. left: 6px;
  397. top: 6px;
  398. width: 12px;
  399. height: 12px;
  400. background: #3fbf31;
  401. border-radius: 50%;
  402. }
  403. }
  404. ul {
  405. display: flex;
  406. justify-content: space-between;
  407. align-items: center;
  408. padding: 20px 30px 22px;
  409. box-sizing: border-box;
  410. li {
  411. display: flex;
  412. flex-direction: column;
  413. align-items: center;
  414. .icon {
  415. width: 50px;
  416. height: 50px;
  417. border-radius: 15px;
  418. background: #eee;
  419. display: flex;
  420. justify-content: center;
  421. align-items: center;
  422. margin-bottom: 12px;
  423. img{
  424. width: 100%;
  425. height: 100%;
  426. }
  427. }
  428. .text {
  429. color: #333;
  430. font-size: 14px;
  431. }
  432. .btn {
  433. padding: 0 12px;
  434. height: 24px;
  435. background: #f1f1f1;
  436. border-radius: 12px 12px 12px 12px;
  437. margin-top: 8px;
  438. text-align: center;
  439. line-height: 24px;
  440. font-weight: 500;
  441. font-size: 14px;
  442. color: #3fbf31;
  443. }
  444. }
  445. }
  446. }
  447. }
  448. </style>