xunCha.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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)" 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(item) {
  168. console.log(item);
  169. uni.navigateTo({
  170. url: '/user_fenbao/houTai/taskDEetailsPage?id=' + item.id + '&cr_title=' + item.cr_title
  171. });
  172. },
  173. // 时间筛选
  174. tabBtn(i) {
  175. this.page = 1;
  176. if (this.tab === i) {
  177. this.tab = -1;
  178. this.time = '';
  179. return;
  180. }
  181. this.tab = i;
  182. this.recordList = [];
  183. this.time = this.recordTab[i].time;
  184. if (this.recordTab[i].title != '自定义') {
  185. this.result = '';
  186. this.getPatrolTask(this.progressId);
  187. }
  188. if (this.recordTab[i].title == '自定义') {
  189. this.$refs.calendars.open();
  190. }
  191. },
  192. // 状态筛选
  193. rankingTab(i) {
  194. this.page = 1;
  195. this.recordList = [];
  196. this.menuTab = i;
  197. this.status = this.rankingList[i].status || '';
  198. this.progressId = this.rankingList[i].id;
  199. if (this.rankingList[i].title == '正常' || this.rankingList[i].title == '异常') {
  200. this.progressId = 3;
  201. this.getPatrolTask();
  202. } else {
  203. this.getPatrolTask(this.rankingList[i].id);
  204. }
  205. },
  206. confirmOk(e) {
  207. console.log(e);
  208. this.page = 1;
  209. this.result = `${e.range.before} - ${e.range.after}`;
  210. // console.log(this.result, '自定义');
  211. this.recordList = [];
  212. this.getPatrolTask(this.progressId);
  213. },
  214. close() {}
  215. }
  216. };
  217. </script>
  218. <style>
  219. .box {
  220. width: 100%;
  221. padding-bottom: 50rpx;
  222. background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
  223. background-size: 100% 100%;
  224. background-attachment: fixed;
  225. background-repeat: repeat-y;
  226. height: 100%;
  227. }
  228. .uv-toolbar__wrapper__confirm.data-v-58504ea1 {
  229. color: #3c9cff !important;
  230. }
  231. .tab_box {
  232. width: 94%;
  233. margin: auto;
  234. margin-top: 40rpx;
  235. align-items: center;
  236. display: flex;
  237. justify-content: space-between;
  238. }
  239. .tab_item {
  240. width: 125rpx;
  241. height: 62rpx;
  242. background-image: url('/static/img/sj_tit2.png');
  243. background-size: 100% 100%;
  244. }
  245. .tab_tit {
  246. font-weight: 700;
  247. font-size: 28rpx;
  248. line-height: 62rpx;
  249. color: #95543f;
  250. text-align: center;
  251. }
  252. .active {
  253. background-image: url('/static/img/sj_tit.png') !important;
  254. background-size: 100% 100%;
  255. }
  256. .tit {
  257. font-weight: 700;
  258. font-size: 32rpx;
  259. line-height: 50rpx;
  260. align-items: center;
  261. background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
  262. -webkit-background-clip: text;
  263. -webkit-text-fill-color: transparent;
  264. text-align: center;
  265. }
  266. .jl_box {
  267. /* height: 500rpx; */
  268. margin: auto;
  269. text-align: center;
  270. /* overflow: scroll; */
  271. }
  272. .tit_box {
  273. display: flex;
  274. height: 60rpx;
  275. line-height: 60rpx;
  276. font-weight: 700;
  277. font-size: 28rpx;
  278. text-align: center;
  279. margin-top: 40rpx;
  280. justify-content: space-around;
  281. background-color: #e4c3a6;
  282. }
  283. .jl_item {
  284. display: flex;
  285. justify-content: space-around;
  286. font-size: 30rpx;
  287. margin-bottom: -4rpx;
  288. border-bottom: 4rpx solid #e7cbad;
  289. }
  290. .bk {
  291. align-items: center;
  292. width: 100%;
  293. height: 120rpx;
  294. border-top: 4rpx solid #e7cbad;
  295. border-right: 4rpx solid #e7cbad;
  296. }
  297. .ck {
  298. width: 100rpx;
  299. height: 50rpx;
  300. line-height: 50rpx;
  301. margin-top: 15rpx;
  302. background-color: #e7cbad;
  303. }
  304. .ranking_menu {
  305. width: 90%;
  306. margin: auto;
  307. margin-top: 50rpx;
  308. display: flex;
  309. justify-content: space-between;
  310. font-size: 28rpx;
  311. color: rgba(68, 68, 68, 0.6);
  312. text-align: center;
  313. line-height: 60rpx;
  314. }
  315. .ranking_item {
  316. width: 260rpx;
  317. height: 62rpx;
  318. }
  319. .active2 {
  320. background-image: url('/static/img/gr_tab.png');
  321. background-size: 100% 100%;
  322. }
  323. </style>