facilitystate.vue 14 KB

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