facilitystate.vue 11 KB

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