facilitystate.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <view class="facilitystate-container">
  3. <view class="facilitystate-title-warp">
  4. <view class="facilitystate-title">
  5. <view class="radius-user"></view>使用中
  6. </view>
  7. <view class="facilitystate-subtitle">
  8. <view class="radius-close"></view>
  9. 已关闭</view>
  10. </view>
  11. <view class="facilitystate-list">
  12. <image :src="ggbCurrent.value == 1?bucketOpenTop:bucketCloseTop" class="bucketOpenTop2" />
  13. <image :src="sfbCurrent.value == 1?bucketOpenTop:bucketCloseTop" class="bucketOpenTop"/>
  14. <view class="facilitystate-list__left-label">
  15. <view class="facilitystate-item__left-label-text" style="margin-bottom: 2rpx;">瞬时 L/min :</view>
  16. <view class="facilitystate-item__left-label-text">累计L:</view>
  17. </view>
  18. <view class="facilitystate-list__left">
  19. <view
  20. class="facilitystate-item"
  21. :style="{width:100/(alreadyfertilizerBucketList.length)+'%'}"
  22. :class="index == alreadyfertilizerBucketList.length - 1?'facilitystate-item--last':''"
  23. v-for="(item, index) in alreadyfertilizerBucketList"
  24. :key="index"
  25. >
  26. <view class="facilitystate-item__label">
  27. <view class="facilitystate-item__label-text">{{getTopDeviceName(item.childrenList)}}</view>
  28. <view class="facilitystate-item__label-value">{{getBottomDeviceName(item.childrenList)}}</view>
  29. </view>
  30. <view class="facilitystate-item__image">
  31. <image :src="getJSCurrentValue(item.childrenList)?bucketOpen:bucketClose" class="bucketClose" v-if="isHave"/>
  32. <view v-if="index == alreadyfertilizerBucketList.length - 1? false:true">
  33. <image :src="bottomLine" class="facilitystate-item__bg3"/>
  34. <!--一条直线有下一个有waterChannel的时候应该展示-->
  35. <image :src="line" class="facilitystate-item-line__bg" v-if="isHaveNextWaterChannel(index)"/>
  36. <!--一条直线有下一个没有waterChannel的时候应该展示并且isHavewaterChannel=true-->
  37. <image :src="lineTopBorder" class="facilitystate-item-line__bg3" v-if="!isHaveNextWaterChannel(index) && isHavewaterChannel(item.childrenList)"/>
  38. <!--一条直线有下一个有waterChannel的时候应该展示并且isHavewaterChannel=true的时候展示-->
  39. <image :src="lineHeight" class="facilitystate-item-lineheight__bg" v-if="isHaveNextWaterChannel(index) && isHavewaterChannel(item.childrenList)"/>
  40. <image :src="bottomLine" class="facilitystate-item__bg"/>
  41. <image :src="lineHeight" class="facilitystate-item__line"/>
  42. </view>
  43. <view v-else>
  44. <image :src="lineTopBorder" class="facilitystate-item-line__bg2" v-if="isHavewaterChannel(item.childrenList)"/>
  45. <image :src="lineBottomBorder" class="facilitystate-item__bg2"/>
  46. <image :src="lineBottomBorder" class="facilitystate-item__bg4"/>
  47. <!-- <image :src="lastBorder" class="facilitystate-item__line2"/> -->
  48. </view>
  49. <view class="facilitystate-item-fan">
  50. <view class="fertTopBottom">
  51. <text class="fertTopBottom-text">{{item.sfDisplayname || item.sfName}}</text>
  52. <image :src="getJBCurrentValue(item.childrenList)? fanRun : fan" class="fan" :class="{'fan-run': getJBCurrentValue(item.childrenList)}" />
  53. </view>
  54. </view>
  55. <image :src="getXSCurrentValue(item.childrenList)?bucketOpen:bucketClose" class="bucketClose1" />
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <irrigatedArea :irrigatedAreaList="irrigatedAreaList"/>
  61. </view>
  62. </template>
  63. <script>
  64. import fertTopBottom from '../assets/fertTopBottom.png';
  65. import line from '../assets/line.png';
  66. import lineBottomBorder from '../assets/lineBottomBorder.png';
  67. import lineBottomBorderLittle from '../assets/lineBottomBorderLittle.png';
  68. import lineTopBorderLittle from '../assets/lineTopBorderLittle.png';
  69. import lineHeight from '../assets/lineHeight.png';
  70. import lineOne from '../assets/lineOne.png';
  71. import bottomLine from '../assets/bottomLine.png';
  72. import lineTopBorder from '../assets/lineTopBorder.png';
  73. import lineTopAndBottom from '../assets/lineTopAndBottom.png';
  74. import lineTopBottom from '../assets/lineTopBottom.png';
  75. import fertTopBottomRadius from '../assets/fertTopBottomRadius.png';
  76. import lastBorder from '../assets/lastBorder.png';
  77. import irrigatedArea from './irrigatedArea.vue';
  78. import fan from '../assets/fan.png';
  79. import fanRun from '../assets/fanRun.png';
  80. import bucketOpenTop from '../assets/bucketOpenTop.png';
  81. import bucketCloseTop from '../assets/bucketCloseTop.png';
  82. import bucketClose from '../assets/bucketClose.png';
  83. import bucketOpen from '../assets/bucketOpen.png';
  84. export default {
  85. props:{
  86. irrigatedAreaList:{
  87. type:Array,
  88. default:()=>[]
  89. },
  90. alreadyfertilizerBucketList:{
  91. type:Array,
  92. default:()=>[]
  93. },
  94. ggbCurrent:{
  95. type:Object,
  96. default:()=>{}
  97. },
  98. sfbCurrent:{
  99. type:Object,
  100. default:()=>{}
  101. }
  102. },
  103. components:{
  104. irrigatedArea
  105. },
  106. data() {
  107. return {
  108. fan,
  109. line,
  110. fanRun,
  111. lastBorder,
  112. lineTopBottom,
  113. fertTopBottom,
  114. lineTopBorderLittle,
  115. lineBottomBorder,
  116. lineHeight,
  117. lineBottomBorderLittle,
  118. lineOne,
  119. bottomLine,
  120. lineTopBorder,
  121. lineTopAndBottom,
  122. bucketOpenTop,
  123. bucketOpenTopStatus:false,
  124. bucketOpenTopStatus2:false,
  125. bucketCloseTop,
  126. bucketClose,
  127. bucketOpen,
  128. fertTopBottomRadius,
  129. isHave:false,
  130. };
  131. },
  132. methods:{
  133. getTopDeviceName(list){
  134. let current = {}
  135. list?.forEach(item =>{
  136. if(item.sfType === '6'){
  137. const name = item.sfDisplayname || item.sfName;
  138. if(name.indexOf('瞬时') != -1){
  139. current = item
  140. }
  141. }
  142. })
  143. return current?.value || '0'
  144. },
  145. isHavewaterChannel(childList = []){
  146. let isHaveWater = false;
  147. for(let i = 0;i< childList.length;i++){
  148. const item = childList[i];
  149. if(item.sfType === '8'){
  150. isHaveWater = true
  151. }
  152. }
  153. return isHaveWater;
  154. },
  155. isHaveNextWaterChannel(currentIndex){
  156. let isNextHaveWater;
  157. for(let i = currentIndex+1;i< this.alreadyfertilizerBucketList.length;i++){
  158. // const item = this.alreadyfertilizerBucketList[i];
  159. isNextHaveWater = false;
  160. for(let j = i;j< this.alreadyfertilizerBucketList.length;j++){
  161. const currentItem = this.alreadyfertilizerBucketList[j];
  162. isNextHaveWater = this.isHavewaterChannel(currentItem.childrenList || []);
  163. if(isNextHaveWater){
  164. return true
  165. }
  166. }
  167. }
  168. return isNextHaveWater
  169. },
  170. getBottomDeviceName(list){
  171. let current = {}
  172. list?.forEach(item =>{
  173. if(item.sfType === '6'){
  174. const name = item.sfDisplayname || item.sfName;
  175. if(name.indexOf('累计') != -1){
  176. current = item
  177. }
  178. }
  179. })
  180. return current?.value || '0'
  181. },
  182. getJSCurrentValue(list){
  183. // 进水阀
  184. let current = {};
  185. list?.forEach(item =>{
  186. if(item.sfType === '8'){
  187. const name = item.sfCode;
  188. current = item;
  189. this.isHave = true;
  190. }
  191. })
  192. return current?.value == 1
  193. },
  194. getJBCurrentValue(list){
  195. // 搅拌机
  196. let current = {};
  197. list?.forEach(item =>{
  198. if(item.sfType === '3'){
  199. const name = item.sfCode;
  200. current = item
  201. }
  202. })
  203. return current?.value == 1
  204. },
  205. getXSCurrentValue(list){
  206. // 吸水泵
  207. let current = {};
  208. list?.forEach(item =>{
  209. if(item.sfType === '2'){
  210. const name = item.sfCode;
  211. current = item
  212. }
  213. })
  214. return current?.value == 1
  215. },
  216. handleClick(item){
  217. item.fan = !item.fan;
  218. },
  219. handleOpenClick(){
  220. this.bucketOpenTopStatus = !this.bucketOpenTopStatus;
  221. },
  222. handleOpenClick1(){
  223. this.bucketOpenTopStatus2 = !this.bucketOpenTopStatus2;
  224. },
  225. handleBucketCloseClick(item){
  226. item.isTopStatus = !item.isTopStatus;
  227. },
  228. handleBucketCloseClick1(item){
  229. item.isBottomStatus = !item.isBottomStatus;
  230. }
  231. }
  232. };
  233. </script>
  234. <style scoped lang="scss">
  235. .facilitystate-container {
  236. padding: 16rpx 0rpx;
  237. justify-content: space-between;
  238. border-radius: 16rpx;
  239. position: relative;
  240. .facilitystate-title-warp{
  241. position: absolute;
  242. right: 32rpx;
  243. top: 10rpx;
  244. display: flex;
  245. align-items: center;
  246. color: #374d59;
  247. font-family: "Source Han Sans CN VF";
  248. font-size: 24rpx;
  249. font-weight: 400;
  250. .facilitystate-title{
  251. display: flex;
  252. align-items: center;
  253. margin-right: 32rpx;
  254. .radius-user{
  255. width: 16rpx;
  256. height: 16rpx;
  257. border-radius: 50%;
  258. background: #14A478;
  259. margin-right:8rpx;
  260. }
  261. }
  262. .facilitystate-subtitle{
  263. display: flex;
  264. align-items: center;
  265. .radius-close{
  266. width: 16rpx;
  267. height: 16rpx;
  268. border-radius: 50%;
  269. background: #7A8291;
  270. margin-right:8rpx;
  271. }
  272. }
  273. }
  274. .facilitystate-list {
  275. background: url('https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/newindex/beijing.png') no-repeat;
  276. background-size: 100%;
  277. height: 376rpx;
  278. width: 690rpx;
  279. display: flex;
  280. margin-bottom: 16rpx;
  281. position: relative;
  282. &__left-label{
  283. align-self: stretch;
  284. color: #687a74;
  285. text-align: right;
  286. font-family: "Source Han Sans CN VF";
  287. font-size: 24rpx;
  288. font-weight: 400;
  289. position: absolute;
  290. left: 30rpx;
  291. top: 120rpx;
  292. }
  293. .bucketOpenTop{
  294. width: 20rpx;
  295. height: 20rpx;
  296. position: absolute;
  297. left: 120rpx;
  298. top: 328rpx;
  299. }
  300. .bucketOpenTop2{
  301. width: 20rpx;
  302. height: 20rpx;
  303. position: absolute;
  304. left: 200rpx;
  305. top: 72rpx;
  306. }
  307. &__left{
  308. height: 100%;
  309. display: flex;
  310. margin-left: 160rpx;
  311. justify-content: space-between;
  312. width: 100%;
  313. }
  314. .facilitystate-item {
  315. display: flex;
  316. flex-direction: column;
  317. justify-content: center;
  318. align-items: center;
  319. height: 228rpx;
  320. margin-top: 112rpx;
  321. position:relative;
  322. &__label{
  323. display: flex;
  324. flex-direction: column;
  325. justify-content: center;
  326. align-items: center;
  327. width: 100%;
  328. text-align: center;
  329. margin-bottom: 5rpx;
  330. }
  331. &__label-text,&__label-value {
  332. color: #042118;
  333. font-family: "Source Han Sans CN VF";
  334. font-size: 24rpx;
  335. font-weight: 400;
  336. height: 36rpx;
  337. width:90%;
  338. margin: 0 auto;
  339. // 超出隐藏
  340. overflow: hidden;
  341. text-overflow: ellipsis;
  342. white-space: nowrap;
  343. }
  344. &__image {
  345. width: 100%;
  346. height: 140rpx;
  347. position: relative;
  348. .facilitystate-item-fan{
  349. position: absolute;
  350. top: 20rpx;
  351. left:0;
  352. bottom:0;
  353. right:0;
  354. margin: auto;
  355. z-index:100;
  356. }
  357. .bucketClose{
  358. position: absolute;
  359. width: 20rpx;
  360. height: 20rpx;
  361. left: 50%;
  362. transform: translateX(-25%);
  363. top: 6rpx;
  364. z-index:100;
  365. }
  366. .bucketClose1{
  367. position: absolute;
  368. width: 20rpx;
  369. height: 20rpx;
  370. left: 50%;
  371. transform: translateX(-25%);
  372. bottom: -6rpx;
  373. z-index:100;
  374. }
  375. }
  376. .facilitystate-item-line__bg{
  377. position:absolute;
  378. width: 102%;
  379. height: 4rpx;
  380. top: 0rpx;
  381. }
  382. &__bg{
  383. position:absolute;
  384. width: 100%;
  385. left:0;
  386. height: 36rpx;
  387. bottom: -16rpx;
  388. }
  389. &__bg3{
  390. position:absolute;
  391. width: 100%;
  392. left:0;
  393. height: 36rpx;
  394. top: 0rpx;
  395. // 旋转180度
  396. transform: rotate(180deg);
  397. }
  398. .facilitystate-item-lineheight__bg{
  399. height: 32rpx;
  400. width: 4rpx;
  401. position:absolute;
  402. left:0;
  403. right: 0;
  404. margin: auto;
  405. }
  406. &__line{
  407. position: absolute;
  408. width: 8rpx;
  409. height: 20rpx;
  410. left: 50%;
  411. bottom: 0;
  412. transform: translateX(-50%);
  413. }
  414. .facilitystate-item-line__bg2{
  415. position:absolute;
  416. top: 0;
  417. width:50%;
  418. height: 32rpx;
  419. }
  420. .facilitystate-item-line__bg4{
  421. position:absolute;
  422. top: 0;
  423. width:50%;
  424. height: 32rpx;
  425. }
  426. .facilitystate-item-line__bg3{
  427. position:absolute;
  428. top: 0;
  429. width:50%;
  430. height: 32rpx;
  431. }
  432. &__bg2{
  433. width: 55%;
  434. height: 32rpx;
  435. left: -6rpx;
  436. position:absolute;
  437. bottom: -16rpx;
  438. }
  439. &__bg4{
  440. width: 55%;
  441. height: 32rpx;
  442. left: -6rpx;
  443. position:absolute;
  444. top: 0rpx;
  445. transform: rotateX(180deg);
  446. }
  447. &__line2{
  448. position: absolute;
  449. width: 16rpx;
  450. height: 153rpx;
  451. top: -1rpx;
  452. margin-left: -6rpx;
  453. transform: translateX(-50%);
  454. }
  455. .fertTopBottom{
  456. width: 70rpx;
  457. height: 94rpx;
  458. margin: 0 auto;
  459. margin-top: 12rpx;
  460. background: url('https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/newindex/bucket.png') no-repeat center center;
  461. background-size: 100% 100%;
  462. display: flex;
  463. flex-direction: column;
  464. justify-content: center;
  465. align-items: center;
  466. .fertTopBottom-text{
  467. width: 70rpx;
  468. font-size: 24rpx;
  469. color: #FFB800;
  470. text-align: center;
  471. // 超出隐藏
  472. overflow: hidden;
  473. text-overflow: ellipsis;
  474. white-space: nowrap;
  475. }
  476. .fan{
  477. width: 40rpx;
  478. height:40rpx;
  479. margin-left: 10rpx;
  480. }
  481. .fan-run{
  482. animation: rotate .5s linear infinite;
  483. @keyframes rotate {
  484. from {
  485. transform: rotate(0deg);
  486. }
  487. to {
  488. transform: rotate(360deg);
  489. }
  490. }
  491. }
  492. }
  493. }
  494. .facilitystate-item--last{
  495. width: 100rpx;
  496. display: flex;
  497. }
  498. }
  499. }
  500. </style>