xunCha.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="box">
  3. <u-navbar :autoBack="true" title="巡查管理" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#000000"></u-navbar>
  4. <view class="ranking_menu">
  5. <view @click="rankingTab(index)" class="ranking_item" :class="{ active2: menuTab == index }" v-for="(item, index) in rankingList" :key="item.index">
  6. <view class="tab_tit">
  7. {{ item.title }}
  8. </view>
  9. </view>
  10. </view>
  11. <!-- 时间 -->
  12. <view class="tab_box">
  13. <view @click="tabBtn(index)" class="tab_item" v-for="(item, index) in recordTab" :key="item.index" :class="{ active: index === tab }">
  14. <view class="tab_tit">
  15. {{ item.title }}
  16. </view>
  17. </view>
  18. </view>
  19. <view class="tit_box">
  20. <view style="width: 158rpx" class="">志愿者</view>
  21. <view style="width: 158rpx">文物名称</view>
  22. <view style="width: 158rpx">巡查时间</view>
  23. <view style="width: 158rpx">文物状况</view>
  24. <view style="width: 158rpx">操作</view>
  25. </view>
  26. <view class="jl_box">
  27. <scroll-view v-if="recordList.length > 0" style="height: 1000rpx" scroll-y="true" @scrolltolower="LoadMore">
  28. <view>
  29. <view class="jl_item" v-for="item in recordList" :key="item.id">
  30. <view class="bk" style="line-height: 120rpx">{{ item.name }}</view>
  31. <view class="bk" style="line-height: 120rpx; overflow-x: auto; white-space: nowrap">
  32. {{ item.cr_title }}
  33. </view>
  34. <view class="bk">
  35. {{ item.progress == 3 ? item.submit_time : item.progress == 2 ? item.submit_time : item.progress == -1 ? item.submit_time : '' }}
  36. </view>
  37. <view class="bk" style="line-height: 120rpx">
  38. {{ item.status_text }}
  39. </view>
  40. <!-- <view v-if="item.status == '-2'" class="bk" style="display: flex; justify-content: space-around">
  41. <view class="ck">提醒</view>
  42. </view> -->
  43. <view @click="checkBtn(item.id)" class="bk" style="display: flex; justify-content: space-around">
  44. <view class="ck">查看</view>
  45. </view>
  46. </view>
  47. </view>
  48. </scroll-view>
  49. <view v-else>
  50. <u-empty text="暂无数据" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"></u-empty>
  51. </view>
  52. </view>
  53. <!-- 日历 -->
  54. <uv-calendars ref="calendars" mode="range" lunar @confirm="confirmOk" />
  55. </view>
  56. </template>
  57. <script>
  58. let that;
  59. export default {
  60. data() {
  61. return {
  62. tab: -1,
  63. time: '' /* 时间筛选 */,
  64. result: '' /* 自定义时间 */,
  65. menuTab: 0,
  66. progressId: 0 /* 任务状态id */,
  67. page: 1,
  68. status: '',
  69. isLoading: false,
  70. rankingList: [
  71. {
  72. title: '待巡查',
  73. id: '0'
  74. },
  75. {
  76. title: '待审核',
  77. id: 2
  78. },
  79. {
  80. title: '已通过',
  81. id: 3
  82. },
  83. {
  84. title: '驳回',
  85. id: -1
  86. },
  87. {
  88. title: '未提交',
  89. id: -2
  90. },
  91. {
  92. title: '正常',
  93. status: 1
  94. },
  95. {
  96. title: '异常',
  97. status: 2
  98. }
  99. ],
  100. recordTab: [
  101. {
  102. title: '今天',
  103. time: 'today'
  104. },
  105. {
  106. title: '本周',
  107. time: 'week'
  108. },
  109. {
  110. title: '上周',
  111. time: 'last week'
  112. },
  113. {
  114. title: '本月',
  115. time: 'month'
  116. },
  117. {
  118. title: '上月',
  119. time: 'last month'
  120. },
  121. {
  122. title: '今年',
  123. time: 'year'
  124. },
  125. {
  126. title: '去年',
  127. time: 'last year'
  128. },
  129. {
  130. title: '自定义',
  131. time: ''
  132. }
  133. ],
  134. recordList: [] /* 巡查任务列表 */
  135. };
  136. },
  137. onLoad() {
  138. that = this;
  139. this.getPatrolTask();
  140. },
  141. methods: {
  142. // 巡查任务列表
  143. getPatrolTask(id) {
  144. this.isLoading = true;
  145. this.$api.getPatrolTask(
  146. { status: this.status, custom_time: this.result || '', created_at: this.time, main_body_id: 1, page: this.page, pageSize: 30, progress: id ? id : this.progressId },
  147. function (res) {
  148. if (res.code == 1) {
  149. that.isLoading = false;
  150. that.recordList = [...that.recordList, ...res.data];
  151. // console.log(that.recordList, '任务');
  152. }
  153. }
  154. );
  155. },
  156. LoadMore() {
  157. // console.log(454);
  158. if (this.isLoading) {
  159. return;
  160. } else {
  161. // console.log(69666);
  162. this.page++;
  163. this.getPatrolTask(this.progressId);
  164. }
  165. },
  166. // 查看巡查详情
  167. checkBtn(id) {
  168. uni.navigateTo({
  169. url: '/user_fenbao/houTai/taskDEetailsPage?id=' + id
  170. });
  171. },
  172. // 时间筛选
  173. tabBtn(i) {
  174. this.page = 1;
  175. if (this.tab === i) {
  176. this.tab = -1;
  177. this.time = '';
  178. return;
  179. }
  180. this.tab = i;
  181. this.recordList = [];
  182. this.time = this.recordTab[i].time;
  183. if (this.recordTab[i].title != '自定义') {
  184. this.result = '';
  185. this.getPatrolTask(this.progressId);
  186. }
  187. if (this.recordTab[i].title == '自定义') {
  188. this.$refs.calendars.open();
  189. }
  190. },
  191. // 状态筛选
  192. rankingTab(i) {
  193. this.page = 1;
  194. this.recordList = [];
  195. this.menuTab = i;
  196. this.status = this.rankingList[i].status || '';
  197. this.progressId = this.rankingList[i].id;
  198. if (this.rankingList[i].title == '正常' || this.rankingList[i].title == '异常') {
  199. this.progressId = 3;
  200. this.getPatrolTask();
  201. } else {
  202. this.getPatrolTask(this.rankingList[i].id);
  203. }
  204. },
  205. confirmOk(e) {
  206. console.log(e);
  207. this.page = 1;
  208. this.result = `${e.range.before} - ${e.range.after}`;
  209. // console.log(this.result, '自定义');
  210. this.recordList = [];
  211. this.getPatrolTask(this.progressId);
  212. },
  213. close() {}
  214. }
  215. };
  216. </script>
  217. <style>
  218. .box {
  219. width: 100%;
  220. padding-bottom: 50rpx;
  221. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
  222. background-size: 100% 100%;
  223. background-attachment: fixed;
  224. background-repeat: repeat-y;
  225. height: 100%;
  226. }
  227. .uv-toolbar__wrapper__confirm.data-v-58504ea1 {
  228. color: #3c9cff !important;
  229. }
  230. .tab_box {
  231. width: 94%;
  232. margin: auto;
  233. margin-top: 40rpx;
  234. align-items: center;
  235. display: flex;
  236. justify-content: space-between;
  237. }
  238. .tab_item {
  239. width: 125rpx;
  240. height: 62rpx;
  241. background-image: url('/static/img/sj_tit2.png');
  242. background-size: 100% 100%;
  243. }
  244. .tab_tit {
  245. font-weight: 700;
  246. font-size: 28rpx;
  247. line-height: 62rpx;
  248. color: #95543f;
  249. text-align: center;
  250. }
  251. .active {
  252. background-image: url('/static/img/sj_tit.png') !important;
  253. background-size: 100% 100%;
  254. }
  255. .tit {
  256. font-weight: 700;
  257. font-size: 32rpx;
  258. line-height: 50rpx;
  259. align-items: center;
  260. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  261. -webkit-background-clip: text;
  262. -webkit-text-fill-color: transparent;
  263. text-align: center;
  264. }
  265. .jl_box {
  266. /* height: 500rpx; */
  267. margin: auto;
  268. text-align: center;
  269. /* overflow: scroll; */
  270. }
  271. .tit_box {
  272. display: flex;
  273. height: 60rpx;
  274. line-height: 60rpx;
  275. font-weight: 700;
  276. font-size: 28rpx;
  277. text-align: center;
  278. margin-top: 40rpx;
  279. justify-content: space-around;
  280. background-color: #e4c3a6;
  281. }
  282. .jl_item {
  283. display: flex;
  284. justify-content: space-around;
  285. font-size: 30rpx;
  286. margin-bottom: -4rpx;
  287. border-bottom: 4rpx solid #e7cbad;
  288. }
  289. .bk {
  290. align-items: center;
  291. width: 100%;
  292. height: 120rpx;
  293. border-top: 4rpx solid #e7cbad;
  294. border-right: 4rpx solid #e7cbad;
  295. }
  296. .ck {
  297. width: 100rpx;
  298. height: 50rpx;
  299. line-height: 50rpx;
  300. margin-top: 15rpx;
  301. background-color: #e7cbad;
  302. }
  303. .ranking_menu {
  304. width: 90%;
  305. margin: auto;
  306. margin-top: 50rpx;
  307. display: flex;
  308. justify-content: space-between;
  309. font-size: 28rpx;
  310. color: rgba(68, 68, 68, 0.6);
  311. text-align: center;
  312. line-height: 60rpx;
  313. }
  314. .ranking_item {
  315. width: 260rpx;
  316. height: 62rpx;
  317. }
  318. .active2 {
  319. background-image: url('/static/img/gr_tab.png');
  320. background-size: 100% 100%;
  321. }
  322. </style>