Entrapment.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <view class="entrapment">
  3. <view class="entrapment-card">
  4. <view class="entrapment-card__header" v-if="isShowHeader">
  5. <view class="entrapment-card__title edit-title">诱捕器</view>
  6. <!-- <view class="entrapment-card__update">
  7. <uni-icons type="loop" color="#1B76FF"></uni-icons>
  8. <text class="text">更新</text>
  9. </view> -->
  10. </view>
  11. <view class="entrapment-card__list">
  12. <view class="entrapment-card__item" v-for="item in dataSource.trap_record_list" :key="item.id">
  13. <view class="entrapment-card__text">{{item.trap_number}}<text
  14. class="status">{{item.report_status?`(${item.report_status})`:''}}</text></view>
  15. <view class="entrapment-card__btn" v-if="isEdit">
  16. <u-button v-if="!item.report_status" type="primary" text="填写" size="small"
  17. @click="handleEditEntrapmentInfo(item)">
  18. </u-button>
  19. <view class="entrapment-card__update" v-else @click="handleEditEntrapmentInfo(item)">
  20. <uni-icons type="loop" color="#1B76FF"></uni-icons>
  21. <text class="text">更新</text>
  22. </view>
  23. </view>
  24. <view class="entrapment-card__btn" v-else>
  25. <u-button type="primary" text="查看" size="small" @click="handleEditEntrapmentInfo(item)">
  26. </u-button>
  27. </view>
  28. <!-- -->
  29. </view>
  30. </view>
  31. </view>
  32. <u-popup :show="show" @close="close" @open="open" :closeOnClickOverlay="true" :safeAreaInsetTop="true">
  33. <!-- 注意,如果需要兼容微信小程序,最好通过setRules方法设置rules规则 -->
  34. <PopUpContentComponent :dataSource="entrapmentBaseInfo" @close="close" />
  35. <!-- <view class="entrapment-form">
  36. <view class="entrapment-form__header">
  37. <view class="entrapment-form__card">诱捕器:K2654114</view>
  38. </view>
  39. <view class="entrapment-form__form">
  40. <u--form labelPosition="left" :model="entrapmentFormModel" ref="entrapmentForm">
  41. <u-form-item label="" prop="userInfo.name" borderBottom ref="item1">
  42. <view class="entrapment-form__item">
  43. <view class="entrapment-form__label">
  44. <image src="@/static/image/task/pest/pest.png" mode="aspectFit" class="icon">
  45. </image>
  46. <text class="text">有害生物</text>
  47. <view class="fill-icon">
  48. <uni-icons type="arrowright" size="12" color="#fff"></uni-icons>
  49. </view>
  50. </view>
  51. <u--input border="none" type="number" v-model="value">
  52. <template slot="prefix">
  53. <image src="@/static/image/task/pest/statistics.png" mode="aspectFit"
  54. class="icon"></image>
  55. </template>
  56. <template slot="suffix">
  57. <text>头</text>
  58. </template>
  59. </u--input>
  60. <view class="entrapment-form__close">
  61. <uni-icons type="clear"></uni-icons>
  62. </view>
  63. </view>
  64. </u-form-item>
  65. </u--form>
  66. </view>
  67. <view class="entrapment-form__content">
  68. <view class="entrapment-form__content__btn">
  69. <u-button type="primary" :plain="true" icon="plus" text="增加" size="small"></u-button>
  70. </view>
  71. <view class="entrapment-form__actions">
  72. <view class="entrapment-form__action green">
  73. <image src="@/static/image/task/pest/pest-none.png" mode="aspectFit" class="img"></image>
  74. <text class="text">无虫</text>
  75. </view>
  76. <view class="entrapment-form__action pink">
  77. <image src="@/static/image/task/pest/bring.png" mode="aspectFit" class="img"></image>
  78. <text class="text">带回</text>
  79. </view>
  80. <view class="entrapment-form__action blue">
  81. <image src="@/static/image/task/pest/submit.png" mode="aspectFit" class="img"></image>
  82. <text class="text">提交</text>
  83. </view>
  84. </view>
  85. </view>
  86. </view> -->
  87. </u-popup>
  88. </view>
  89. </template>
  90. <script>
  91. import PopUpContentComponent from './EntrapmentAdd.vue'
  92. export default {
  93. props: {
  94. dataSource: {
  95. type: Object,
  96. default: () => ({})
  97. },
  98. isEdit: {
  99. type: Boolean,
  100. default: false,
  101. },
  102. isShowHeader: {
  103. type: Boolean,
  104. default: false,
  105. }
  106. },
  107. components: {
  108. PopUpContentComponent
  109. },
  110. data() {
  111. return {
  112. show: false,
  113. entrapmentFormModel: {
  114. pestList: []
  115. },
  116. rules: {},
  117. currentEditEntrapmentInfo: {},
  118. entrapmentBaseInfo: {}
  119. }
  120. },
  121. methods: {
  122. open() {
  123. console.log('open');
  124. },
  125. close() {
  126. this.show = false
  127. console.log('close');
  128. },
  129. handleEditEntrapmentInfo(row) {
  130. this.show = true;
  131. this.currentEditEntrapmentInfo = row;
  132. this.entrapmentBaseInfo = {
  133. id: row.id,
  134. trap_number: row.trap_number,
  135. comtype: this.isEdit,
  136. taskStatus:this.dataSource.task_status
  137. };
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss" scoped>
  143. .entrapment {
  144. width: 100%;
  145. box-sizing: border-box;
  146. padding: 40rpx 24rpx;
  147. .entrapment-card {
  148. &__header {
  149. display: flex;
  150. align-items: center;
  151. justify-content: space-between;
  152. font-weight: 500;
  153. color: #1B76FF;
  154. font-size: 12px;
  155. line-height: 18px;
  156. margin-bottom: 28rpx;
  157. .edit-title {
  158. font-size: 14px;
  159. color: #333;
  160. line-height: 40rpx;
  161. padding-bottom: 10rpx;
  162. @include hairline-bottom(rgba(151, 151, 151, 0.09));
  163. }
  164. }
  165. &__update {
  166. font-weight: 500;
  167. color: #1B76FF;
  168. font-size: 12px;
  169. line-height: 18px;
  170. .text {
  171. margin-left: 10rpx;
  172. }
  173. }
  174. &__list {
  175. margin-bottom: 36rpx;
  176. }
  177. &__item {
  178. display: flex;
  179. align-items: center;
  180. justify-content: space-between;
  181. padding: 24rpx 0;
  182. font-size: 16px;
  183. line-height: 22px;
  184. color: #333;
  185. font-weight: 400;
  186. @include hairline-bottom(rgba(151, 151, 151, 0.09));
  187. &:last-child {
  188. @include hairline-bottom(transparent);
  189. }
  190. }
  191. &__text {
  192. .status {
  193. color: #1B76FF;
  194. }
  195. }
  196. }
  197. .entrapment-form {
  198. &__header {
  199. width: 540rpx;
  200. height: 144rpx;
  201. border-radius: 70rpx;
  202. margin: 0 auto;
  203. margin-top: -72rpx;
  204. background-image: url(~@/static/image/task/pest/bg.png);
  205. background-repeat: no-repeat;
  206. background-size: 100% 100%;
  207. overflow: hidden;
  208. }
  209. &__card {
  210. padding: 0 68rpx;
  211. height: 100%;
  212. font-size: 14px;
  213. line-height: 144rpx;
  214. color: #fff;
  215. }
  216. &__form {
  217. margin-top: -30rpx;
  218. padding: 76rpx;
  219. margin-bottom: 20rpx;
  220. border-bottom: 1px solid rgba(2, 2, 2, 0.3);
  221. }
  222. &__item {
  223. position: relative;
  224. flex: 1;
  225. display: flex;
  226. justify-content: space-between;
  227. align-items: center;
  228. padding: 20rpx 24rpx;
  229. background: #F8F8F8;
  230. margin-bottom: 40rpx;
  231. .icon {
  232. width: 38rpx;
  233. height: 38rpx;
  234. }
  235. ::v-deep .u-input__content__field-wrapper {
  236. border-bottom: 1rpx solid #3183FF;
  237. }
  238. }
  239. &__label {
  240. display: flex;
  241. align-items: center;
  242. margin-right: 100rpx;
  243. .icon {
  244. width: 50rpx;
  245. height: 50rpx;
  246. }
  247. .text {
  248. font-size: 12px;
  249. line-height: 18px;
  250. color: #555555;
  251. margin: 0 24rpx;
  252. }
  253. .fill-icon {
  254. display: flex;
  255. justify-content: center;
  256. align-items: center;
  257. width: 26rpx;
  258. height: 26rpx;
  259. background-color: #1B76FF;
  260. border-radius: 50%;
  261. line-height: 26rpx;
  262. }
  263. }
  264. &__content {
  265. padding: 36rpx 76rpx;
  266. }
  267. &__actions {
  268. padding: 140rpx 30rpx;
  269. display: flex;
  270. justify-content: space-between;
  271. align-items: center;
  272. }
  273. &__action {
  274. display: flex;
  275. flex-direction: column;
  276. justify-content: center;
  277. align-items: center;
  278. width: 100rpx;
  279. height: 100rpx;
  280. border-radius: 50%;
  281. background: #4CD964;
  282. box-shadow: 0px 1px 9px 0px rgba(169, 169, 169, 0.5);
  283. .img {
  284. width: 40rpx;
  285. height: 40rpx;
  286. }
  287. .text {
  288. color: #fff;
  289. font-size: 12px;
  290. line-height: 14px;
  291. }
  292. }
  293. &__close {
  294. position: absolute;
  295. padding: 20rpx;
  296. right: -60rpx;
  297. top: 50%;
  298. transform: translateY(-50%);
  299. }
  300. }
  301. }
  302. </style>