reviewCheck.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <van-nav-bar
  3. title="巡检记录"
  4. left-arrow
  5. @click-left="onClickLeft"
  6. safe-area-inset-top
  7. />
  8. <div class="page_check">
  9. <div class="search_pannel">
  10. <div class="pannel_left">
  11. <van-image
  12. :src="require('@/assets/position.svg')"
  13. width="16"
  14. height="16"
  15. fit="contain"
  16. />
  17. <span>{{ name }}</span>
  18. <van-image
  19. :src="require('@/assets/arrow-right.svg')"
  20. width="24"
  21. height="24"
  22. fit="contain"
  23. />
  24. </div>
  25. <div class="pannel_right" @click="toPath">
  26. <van-image
  27. :src="require('@/assets/search.svg')"
  28. width="16"
  29. height="16"
  30. fit="contain"
  31. />
  32. </div>
  33. </div>
  34. <div class="drop_down">
  35. <van-dropdown-menu active-color="#1989fa">
  36. <van-dropdown-item
  37. v-model="checkType"
  38. @change="handelChange('checkType', checkType)"
  39. :title="checkTypeTitle"
  40. :options="checkTypeList"
  41. />
  42. <van-dropdown-item
  43. v-model="checkPerson"
  44. @change="handelChange('checkPerson', checkPerson)"
  45. :title="checkPersonTitle"
  46. :options="checkPersonList"
  47. />
  48. </van-dropdown-menu>
  49. </div>
  50. <div class="list_total">
  51. <span>共有</span>
  52. <v-count-up
  53. :end-val="total"
  54. class="count_up"
  55. options="{ separator: ',' }"
  56. />
  57. <span>条记录</span>
  58. </div>
  59. <div class="check_info">
  60. <div class="info_list">
  61. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  62. <van-list
  63. v-model:loading="loading"
  64. :finished="finished"
  65. :error="error"
  66. error-text="请求失败,点击重新加载"
  67. finished-text="没有更多了"
  68. @load="onLoad"
  69. >
  70. <div v-for="item in list" :key="item.id" class="list_item">
  71. <span class="header">{{ item.position }}</span>
  72. <span>巡检类型:{{ item.checkType }}</span>
  73. <span>巡检人员:{{ item.checkPerson }}</span>
  74. <span>联系电话:{{ item.contactPhone }}</span>
  75. <span>巡检时间:{{ item.checkTime }}</span>
  76. </div>
  77. </van-list>
  78. </van-pull-refresh>
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import VCountUp from "./CountUp";
  85. export default {
  86. components: {
  87. "v-count-up": VCountUp,
  88. },
  89. data() {
  90. return {
  91. loading: false,
  92. name: "电商园四期-B座",
  93. checkType: "",
  94. checkPerson: "",
  95. checkTypeTitle: "巡检类型",
  96. checkPersonTitle: "巡检人员",
  97. checkTypeList: [
  98. { text: "安保", value: 1 },
  99. { text: "保洁", value: 2 },
  100. ],
  101. checkPersonList: [
  102. { text: "张三", value: 1 },
  103. { text: "李四", value: 2 },
  104. ],
  105. total: 3,
  106. list: [
  107. {
  108. position: "B座13楼1301",
  109. checkType: 1,
  110. checkPerson: "张浩",
  111. contactPhone: 13212341111,
  112. checkTime: "2022-09-20 10:34:22",
  113. },
  114. ],
  115. loading: false,
  116. refreshing: false,
  117. finished: false,
  118. };
  119. },
  120. methods: {
  121. onLoad() {
  122. setTimeout(() => {
  123. if (this.refreshing) {
  124. this.list = [];
  125. this.refreshing = false;
  126. }
  127. for (let i = 0; i < 10; i++) {
  128. this.list.push(this.list.length + 1);
  129. }
  130. this.loading = false;
  131. if (this.list.length >= 40) {
  132. this.finished = true;
  133. }
  134. }, 1000);
  135. },
  136. onRefresh() {
  137. // 清空列表数据
  138. this.finished = false;
  139. // 重新加载数据
  140. // 将 loading 设置为 true,表示处于加载状态
  141. this.loading = true;
  142. this.onLoad();
  143. },
  144. // change事件可以拿到的是value
  145. handelChange(type, val) {
  146. console.log(type, val);
  147. if (type == "checkType") {
  148. // 这里打印出来的值就是我们想要的text
  149. this.checkTypeTitle = this.checkTypeList.filter(
  150. (item) => item.value === val
  151. )[0].text;
  152. }
  153. if (type == "checkPerson") {
  154. // 这里打印出来的值就是我们想要的text
  155. this.checkPersonTitle = this.checkPersonList.filter(
  156. (item) => item.value === val
  157. )[0].text;
  158. }
  159. },
  160. onClickLeft() {},
  161. },
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. .page_check {
  166. height: 100%;
  167. .search_pannel {
  168. padding: 10px 16px;
  169. background: #5c8fff;
  170. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
  171. display: flex;
  172. align-items: center;
  173. .pannel_left {
  174. display: flex;
  175. align-items: center;
  176. span {
  177. height: 24px;
  178. font-size: 16px;
  179. font-weight: 400;
  180. color: #ffffff;
  181. line-height: 24px;
  182. text-shadow: 0px 2px 4px rgba(0, 0, 0, 0.04);
  183. text-indent: 4px;
  184. }
  185. }
  186. .pannel_left,
  187. .pannel_right {
  188. flex: 1;
  189. }
  190. .pannel_right {
  191. text-align: right;
  192. }
  193. }
  194. .drop_down {
  195. /deep/ {
  196. --van-gray-4: #999999;
  197. --van-dropdown-menu-title-text-color: #0c1935;
  198. }
  199. }
  200. .list_total {
  201. padding: 0 16px;
  202. margin: 8px 0;
  203. display: flex;
  204. text-align: left;
  205. span {
  206. height: 16px;
  207. font-size: 12px;
  208. font-weight: 400;
  209. color: #999999;
  210. line-height: 16px;
  211. }
  212. .count_up {
  213. font-size: 16px;
  214. font-weight: 500;
  215. color: #fa5555;
  216. margin: 0 2px;
  217. }
  218. }
  219. .check_info {
  220. padding: 0 16px;
  221. height: calc(
  222. 100% - var(--van-nav-bar-height) - var(--van-dropdown-menu-height) - 76px
  223. );
  224. .info_list {
  225. height: 100%;
  226. overflow-y: auto;
  227. .list_item {
  228. background: #ffffff;
  229. box-shadow: 0px 0px 10px 0px rgba(153, 153, 153, 0.15);
  230. border-radius: 4px;
  231. margin-bottom: 12px;
  232. padding: 12px 16px;
  233. display: flex;
  234. flex-direction: column;
  235. align-items: flex-start;
  236. &:nth-last-child(1) {
  237. margin-bottom: 0;
  238. }
  239. .header {
  240. height: 22px;
  241. font-size: 16px;
  242. font-weight: 600;
  243. color: #313836;
  244. line-height: 22px;
  245. margin-bottom: 8px;
  246. }
  247. span {
  248. height: 18px;
  249. font-size: 14px;
  250. font-weight: 400;
  251. color: #999999;
  252. line-height: 18px;
  253. margin-bottom: 4px;
  254. &:nth-last-child(1) {
  255. margin-bottom: 0;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. }
  262. </style>