OperationCard.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view class="operation">
  3. <view
  4. class="operation__header"
  5. :class="
  6. dourceData.local_model == '1'
  7. ? 'operation__header--info'
  8. : 'operation__header--warn'
  9. "
  10. >{{ dourceData.name }}
  11. <view
  12. :class="
  13. dourceData.local_model == '1'
  14. ? 'operation__header--infoing'
  15. : 'operation__header--warning'
  16. "
  17. >
  18. {{ dourceData.local_model == '1' ? '远程' : '本地' }}
  19. </view>
  20. </view>
  21. <view class="operation__model">
  22. 模式
  23. <view class="operation__model--container">
  24. <view
  25. class="hand"
  26. @click="changeClick('hand')"
  27. :class="{ active: dourceData.run_model == '0' }"
  28. >手动</view
  29. >
  30. <view
  31. class="auto"
  32. @click="changeClick('auto')"
  33. :class="{ active: dourceData.run_model == '1' }"
  34. >自动</view
  35. >
  36. </view>
  37. </view>
  38. <view class="operation__body">
  39. <view class="operation__body-content">
  40. <view class="operation__body-content--title">展开</view>
  41. <view class="operation__body-content--desc">
  42. <u-switch
  43. :disabled="this.dourceData.local_model == '0'"
  44. v-model="runStatus"
  45. active-color="#14A478"
  46. inactive-color="#C3CAD8"
  47. size="36"
  48. ></u-switch>
  49. </view>
  50. </view>
  51. <view class="operation__body-content">
  52. <view class="operation__body-content--title">收拢</view>
  53. <view class="operation__body-content--desc">
  54. <u-switch
  55. :disabled="this.dourceData.local_model == '0'"
  56. v-model="closeStatus"
  57. active-color="#14A478"
  58. inactive-color="#C3CAD8"
  59. size="36"
  60. ></u-switch>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. export default {
  68. name: 'OperationCard',
  69. props: {
  70. dourceData: {
  71. type: Object,
  72. default: () => ({}),
  73. },
  74. },
  75. computed: {
  76. runStatus: {
  77. get() {
  78. // 展开
  79. return this.dourceData.down_status == '1';
  80. },
  81. set(val) {
  82. this.$emit('run-status', this.dourceData);
  83. },
  84. },
  85. closeStatus: {
  86. get() {
  87. // 收拢
  88. return this.dourceData.up_status == '1';
  89. },
  90. set(val) {
  91. this.$emit('close-status', this.dourceData);
  92. },
  93. },
  94. },
  95. data() {
  96. return {
  97. info: 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/info.png',
  98. warning:
  99. 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/warning.png',
  100. };
  101. },
  102. methods: {
  103. changeClick(type) {
  104. if (this.dourceData.local_model == '0') {
  105. return;
  106. }
  107. this.$emit('change-click', {
  108. type,
  109. dourceData: this.dourceData,
  110. });
  111. },
  112. },
  113. };
  114. </script>
  115. <style scoped lang="scss">
  116. .operation {
  117. justify-content: center;
  118. border-radius: 4px;
  119. background: #eff2fa;
  120. margin-bottom: 32rpx;
  121. position: relative;
  122. &__header {
  123. height: 64rpx;
  124. line-height: 64rpx;
  125. color: #333333;
  126. font-family: 'Source Han Sans CN VF';
  127. font-size: 28rpx;
  128. font-weight: 500;
  129. padding: 0 32rpx;
  130. position: relative;
  131. &--infoing {
  132. width: 150rpx;
  133. height: 56rpx;
  134. line-height: 50rpx;
  135. position: absolute;
  136. right: 0rpx;
  137. top: 0rpx;
  138. background: url('https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/info.png')
  139. no-repeat center center;
  140. background-size: 100%;
  141. color: #0085ff;
  142. text-align: center;
  143. font-family: 'Source Han Sans CN VF';
  144. font-size: 28rpx;
  145. font-weight: 400;
  146. }
  147. &--warning {
  148. width: 150rpx;
  149. height: 56rpx;
  150. line-height: 50rpx;
  151. position: absolute;
  152. right: 0rpx;
  153. top: 0rpx;
  154. background: url('https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/image/zhongshui/warning.png')
  155. no-repeat center center;
  156. background-size: 100%;
  157. text-align: center;
  158. font-family: 'Source Han Sans CN VF';
  159. font-size: 28rpx;
  160. font-weight: 400;
  161. color: #eeac19;
  162. }
  163. }
  164. &__header--info {
  165. background: linear-gradient(180deg, #eff4ff 20.24%, #eff2fa 100%);
  166. }
  167. &__header--warn {
  168. background: linear-gradient(180deg, #fffaef 20.24%, #eff2fa 100%);
  169. }
  170. &__model {
  171. display: flex;
  172. height: 80rpx;
  173. align-items: center;
  174. justify-content: space-between;
  175. border-radius: 16rpx;
  176. color: #333333;
  177. font-family: 'Source Han Sans CN VF';
  178. font-size: 28rpx;
  179. font-weight: 500;
  180. padding: 0 32rpx;
  181. color: #333333;
  182. font-family: 'Source Han Sans CN VF';
  183. font-size: 28rpx;
  184. margin-top: 16rpx;
  185. &--container {
  186. display: flex;
  187. align-items: center;
  188. justify-content: space-between;
  189. width: 164rpx;
  190. height: 48rpx;
  191. background: #ffffff;
  192. border-radius: 8rpx;
  193. padding: 0 6rpx;
  194. .hand {
  195. width: 50%;
  196. border-radius: 8rpx;
  197. text-align: center;
  198. height: 40rpx;
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. font-family: 'Source Han Sans CN VF';
  203. font-size: 24rpx;
  204. font-weight: 400;
  205. color: #687a74;
  206. }
  207. .auto {
  208. width: 50%;
  209. border-radius: 8rpx;
  210. text-align: center;
  211. display: flex;
  212. align-items: center;
  213. justify-content: center;
  214. height: 40rpx;
  215. font-family: 'Source Han Sans CN VF';
  216. font-size: 24rpx;
  217. font-weight: 400;
  218. color: #687a74;
  219. }
  220. .active {
  221. background: #14a478;
  222. color: #ffffff;
  223. }
  224. }
  225. }
  226. &__body {
  227. display: grid;
  228. grid-template-columns: repeat(2, 1fr);
  229. grid-gap: 24rpx;
  230. padding: 30rpx;
  231. padding-top: 24rpx;
  232. &-content {
  233. height: 72rpx;
  234. background: #ffffff;
  235. border-radius: 16rpx;
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. padding: 0 16rpx;
  240. }
  241. }
  242. }
  243. </style>