facilitystate.vue 8.5 KB

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