facilitystate.vue 11 KB

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