facilitystate.vue 8.4 KB

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