facilitystate.vue 14 KB

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