facilitystate.vue 9.1 KB

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