auditDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" title="任务详情" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <!-- 吸顶 -->
  6. <uv-sticky style="top:98rpx">
  7. <view class="search_tabs" v-if="state.isSticky">
  8. <scroll-view class="scroll_tabs" scroll-x="true" scroll-left="0" :show-scrollbar="false">
  9. <view :class="['tab_item',{'selected':item.value==state.tabsSelected}]" v-for="item in state.tabList"
  10. :key="item.value" @click="SelectTabsValue(item.value)">
  11. {{item.label}}
  12. </view>
  13. </scroll-view>
  14. </view>
  15. </uv-sticky>
  16. <view class="scroll_view_box">
  17. <scroll-view
  18. class="scroll_view_y"
  19. :scroll-top="state.scrollTop"
  20. scroll-y="true"
  21. :refresher-enabled="false"
  22. :enable-back-to-top="true"
  23. :show-scrollbar="false"
  24. :scroll-with-animation="true"
  25. refresher-default-style="none"
  26. refresher-background="#F8F9FD"
  27. :refresher-triggered="state.isRefreshing"
  28. @scrolltolower="OnLoadMore"
  29. @refresherrefresh="OnRefresh"
  30. @scroll="OnScroll">
  31. <view class="refresh_loading" v-if="state.isRefreshing"><uni-load-more status="loading" /></view>
  32. <view class="page_content padding_btm">
  33. <view class="task_title">{{state?.details?.taskName}}</view>
  34. <view class="task_class_collect">
  35. <text class="class_item">{{state?.details?.departmentName}}</text>
  36. <text class="class_item">{{state?.details?.materialCategoryName}}</text>
  37. <text class="class_item">{{state?.details?.createBy}}</text>
  38. </view>
  39. <view class="task_time">
  40. <view class="time_day">
  41. <text class="time_item">{{state?.details?.startTime}}</text>
  42. <text class="time_item">至</text>
  43. <text class="time_item">{{state?.details?.endTime}}</text>
  44. <text class="time_item" v-if="remainingDays(state?.details?.endTime) > 0">剩余{{remainingDays(state?.details?.endTime)}}天</text>
  45. </view>
  46. <view :class="['task_status', statusClassMap[state?.details?.taskStatus]]">
  47. {{taskStatusMap[state?.details.taskStatus]}}
  48. </view>
  49. </view>
  50. <view :class="['task_desc',{'over':!state.isExpand}]">
  51. 采集要求:{{state?.details?.collectionRequire}}
  52. </view>
  53. <view class="task_desc_all">
  54. 采集要求:{{state?.details?.collectionRequire}}
  55. </view>
  56. <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
  57. class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
  58. :type="!state.isExpand?'down':'up'"></uni-icons></view>
  59. </view>
  60. <!-- 间隔 -->
  61. <view class="row_gap"></view>
  62. <!-- 吸顶 -->
  63. <!-- <uv-sticky style="top:98rpx"> -->
  64. <view class="search_tabs">
  65. <scroll-view class="scroll_tabs" scroll-x="true" scroll-left="0" :show-scrollbar="false">
  66. <view :class="['tab_item',{'selected':item.value==state.tabsSelected}]" v-for="item in state.tabList"
  67. :key="item.value" @click="SelectTabsValue(item.value)">
  68. {{item.label}}
  69. </view>
  70. </scroll-view>
  71. </view>
  72. <!-- </uv-sticky> -->
  73. <view class="page_content page_content_data">
  74. <view class="total">共 {{state.pageList?.length || 0}} 人</view>
  75. <view class="list_item" v-for="item in state.pageList" :Key="item.id">
  76. <view class="item_name_file">
  77. <view class="name_file">
  78. <text class="name">{{item.targetName}}</text>
  79. <text class="file_num">文件数量:{{item?.taskTargetFileVos?.length || 0}}</text>
  80. </view>
  81. <view class="btn">{{state.tabsSelected>0?'查看':'审核'}}</view>
  82. </view>
  83. <view class="item_info">
  84. <text class="info_text">{{item.showInfo}}</text>
  85. <text class="info_text">{{item?.taskTargetFileVos?.[item.taskTargetFileVos.length -1]?.createTime}}</text>
  86. </view>
  87. </view>
  88. <view class="no_data" v-if="!state.isLoading && state.pageList.length == 0">
  89. <image class="no_data_img" src="@/static/image/bg/no_data.png"></image>
  90. <text class="no_data_text">暂无数据</text>
  91. </view>
  92. </view>
  93. <uni-load-more v-if="state.pageList.length > 0" :status="state.loadStatus" />
  94. </scroll-view>
  95. </view>
  96. </view>
  97. </template>
  98. <script setup>
  99. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  100. import uvSticky from '@/uni_modules/uv-sticky/components/uv-sticky/uv-sticky.vue'; //吸顶
  101. import navBar from '@/components/navBar.vue';
  102. import { remainingDays } from '@/common/common.js';
  103. import {getReviewTaskList} from '@/reqApi/notification.js';
  104. import {
  105. onLoad
  106. } from '@dcloudio/uni-app';
  107. import {
  108. reactive,
  109. ref,
  110. nextTick,
  111. getCurrentInstance,
  112. onMounted,
  113. onUnmounted
  114. } from 'vue';
  115. const state = reactive({
  116. taskId: '', //任务id
  117. tabsSelected: 0, //默认选中tab值
  118. tabList: [{
  119. label: '待审核',
  120. value: 0
  121. }, {
  122. label: '已审核',
  123. value: 1
  124. }, {
  125. label: '已驳回',
  126. value: 2
  127. }], //tab列表
  128. showExpandBtn: false, //是否显示展开按钮
  129. isExpand: false, //是否展开
  130. pageSize: 50,
  131. pageNum: 1,
  132. scrollTop: 0,
  133. oldScrollTop: 0,
  134. isRefreshing: false, //设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
  135. isLoading: true, //加载中
  136. noMoreData: false, //没有更多数据了
  137. loadStatus: 'more', //loading状态
  138. details: {}, //详情信息
  139. pageList: [], //列表数据
  140. searchBoxTop:0,//搜索框距离顶部的高度
  141. isSticky:false,//是否吸顶
  142. });
  143. const statusClassMap = {
  144. 1: 'status_published',
  145. 2: 'status_closed'
  146. };
  147. const taskStatusMap = {
  148. 1: '进行中',
  149. 2: '已结束'
  150. };
  151. onLoad((option) => {
  152. state.taskId = option.taskId;
  153. })
  154. onMounted(() => {
  155. state.details = uni.getStorageSync('collectReviewDetailInfo') || {};
  156. OnLoadData(true,true); // 数据加载完成后触发 checkTextOverflow
  157. });
  158. onUnmounted(() => {
  159. uni.removeStorageSync('collectReviewDetailInfo');//移除缓存
  160. })
  161. const checkTextOverflow = () => {
  162. nextTick(() => {
  163. const instance = getCurrentInstance();
  164. // 安全保护
  165. if (!instance || !instance.proxy) {
  166. // 备用方案:全局查询(要求元素 class 唯一)
  167. let taskDescAllHeight = 0,
  168. taskDescHeight = 0;
  169. const query = uni.createSelectorQuery();
  170. query.select('.task_desc_all').boundingClientRect((rect) => {
  171. taskDescAllHeight = rect?.height || 0;
  172. });
  173. query.select('.task_desc').boundingClientRect((rect) => {
  174. taskDescHeight = rect?.height || 0;
  175. });
  176. query.select('.page_content_data').boundingClientRect((rect) => {
  177. state.searchBoxTop = rect?.top || 0;
  178. });
  179. query.exec(() => {
  180. // 所有回调执行完毕后触发
  181. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  182. });
  183. return;
  184. }
  185. let taskDescAllHeight = 0,
  186. taskDescHeight = 0;
  187. const query = uni.createSelectorQuery().in(instance.proxy);
  188. query.select('.task_desc_all').boundingClientRect((rect) => {
  189. taskDescAllHeight = rect?.height || 0;
  190. });
  191. query.select('.task_desc').boundingClientRect((rect) => {
  192. taskDescHeight = rect?.height || 0;
  193. });
  194. query.select('.page_content_data').boundingClientRect((rect) => {
  195. state.searchBoxTop = rect?.top || 0;
  196. });
  197. query.exec(() => {
  198. // 所有回调执行完毕后触发
  199. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  200. });
  201. });
  202. }
  203. // 展开收起切换
  204. const toggleExpand = () => {
  205. state.isExpand = !state.isExpand;
  206. }
  207. //切换tab
  208. const SelectTabsValue = (val) => {
  209. state.tabsSelected = val;
  210. OnLoadData(true);
  211. }
  212. //搜索
  213. const HandleSearchInput = (val) => {
  214. state.searchWord = val;
  215. OnLoadData(true);
  216. }
  217. const ToSafeArr = (val) => {
  218. if (Array.isArray(val)) return val
  219. return val ? [val] : []
  220. }
  221. /*
  222. *详情
  223. * initPage:初始分页 从第一开始
  224. * initData:初始加载
  225. */
  226. const OnLoadData = (initPage,initData = false) => {
  227. // uni.showLoading({
  228. // title: '加载中'
  229. // });
  230. if (initPage) state.pageNum = 1;//如果是下拉刷新、重新查询 默认加载第一页
  231. state.isLoading = true;
  232. state.loadStatus = 'loading';
  233. getReviewTaskList({
  234. taskId: state.taskId,
  235. reviewStatus: state.tabsSelected,
  236. pageNum: state.pageNum,
  237. pageSize: state.pageSize
  238. }).then(res=>{
  239. if(res.code == 200){
  240. const total = Number(res?.data?.reviewInfoVoPageResult?.total) || 0;//总数
  241. const pages = Math.ceil(total / state.pageSize);//总页数
  242. const recordsData = res?.data?.reviewInfoVoPageResult?.records || [];
  243. state.pageList = initPage ? recordsData : [...state.pageList,...recordsData];
  244. state.noMoreData = state.pageNum == pages;
  245. state.pageNum++;
  246. if(initData){
  247. checkTextOverflow();
  248. }
  249. }
  250. }).finally(()=>{
  251. // uni.hideLoading();
  252. state.isLoading = false;
  253. state.isRefreshing = false;//下拉刷新未被触发
  254. if(state.noMoreData){
  255. state.loadStatus = 'no-more';
  256. }else{
  257. state.loadStatus = 'more';
  258. }
  259. //返回到页面顶部
  260. if(initPage){
  261. GoTop();
  262. }
  263. })
  264. }
  265. // 自定义下拉刷新被触发 下拉刷新
  266. const OnRefresh = () => {
  267. state.isRefreshing = true; //下拉刷新已经被触发
  268. OnLoadData(true);
  269. }
  270. //滚动到底部/右边 触发上拉刷新
  271. const OnLoadMore = () => {
  272. if (state.isLoading || state.noMoreData) return;
  273. OnLoadData(false);
  274. }
  275. // 滚动时触发
  276. const OnScroll = (e) => {
  277. const scrollTop = e.detail.scrollTop;
  278. if(scrollTop > state.searchBoxTop){
  279. state.isSticky = true;
  280. }else{
  281. state.isSticky = false;
  282. }
  283. state.oldScrollTop = scrollTop;
  284. }
  285. //返回到顶部
  286. const GoTop = () => {
  287. // 解决view层不同步的问题
  288. state.scrollTop = state.oldScrollTop;
  289. nextTick(() => {
  290. state.scrollTop = 0
  291. });
  292. }
  293. //返回
  294. const GoBack = () => {
  295. uni.navigateBack({
  296. delta: 1
  297. });
  298. }
  299. </script>
  300. <style scoped lang="scss">
  301. .page_body{
  302. height: 100%;
  303. min-height: auto;
  304. .scroll_view_box{
  305. width: 100%;
  306. display: flex;
  307. flex-direction: column;
  308. height: calc(100% - 96rpx);
  309. }
  310. .scroll_view_y {
  311. height: 100%;
  312. .refresh_loading {
  313. padding: 10rpx 0;
  314. }
  315. }
  316. }
  317. .page_content {
  318. &.padding_btm {
  319. padding-bottom: 24rpx;
  320. .task_title {
  321. font-weight: 500;
  322. font-size: 32rpx;
  323. color: #333333;
  324. margin-top: 24rpx;
  325. }
  326. .task_class_collect {
  327. display: inline-flex;
  328. align-items: center;
  329. flex-wrap: wrap;
  330. width: 100%;
  331. margin-top: 16rpx;
  332. gap: 16rpx;
  333. .class_item {
  334. font-weight: 400;
  335. font-size: 24rpx;
  336. color: #999999;
  337. }
  338. }
  339. .task_time {
  340. display: flex;
  341. align-items: flex-start;
  342. width: 100%;
  343. margin-top: 16rpx;
  344. .time_day {
  345. display: inline-flex;
  346. align-items: center;
  347. flex-wrap: wrap;
  348. flex: 1;
  349. .time_item {
  350. font-weight: 400;
  351. font-size: 24rpx;
  352. line-height: 48rpx;
  353. color: #999999;
  354. &:nth-child(2) {
  355. margin: 0 8rpx;
  356. }
  357. &:nth-child(4) {
  358. color: #2E64FA;
  359. margin-left: 16rpx;
  360. }
  361. }
  362. }
  363. .task_status {
  364. display: inline-flex;
  365. align-items: center;
  366. height: 48rpx;
  367. padding: 0 12rpx;
  368. border-radius: 8rpx;
  369. font-weight: 400;
  370. font-size: 24rpx;
  371. &.status_pending {
  372. background: rgba(46, 100, 250, 0.1);
  373. color: #2E64FA;
  374. }
  375. &.status_published {
  376. background: rgba(82, 196, 26, 0.1);
  377. color: #2BC644;
  378. }
  379. &.status_closed {
  380. background: #6666661a;
  381. color: #666666;
  382. }
  383. }
  384. }
  385. .task_desc {
  386. margin-top: 24rpx;
  387. display: flex;
  388. width: 100%;
  389. padding-top: 24rpx;
  390. border-top: 2rpx solid #F3F3F3;
  391. font-weight: 400;
  392. font-size: 28rpx;
  393. color: #999999;
  394. line-height: 44rpx;
  395. box-sizing: border-box;
  396. position: relative;
  397. &.over {
  398. max-height: 168rpx;
  399. overflow: hidden;
  400. transition: all 0.25s;
  401. display: -webkit-box;
  402. -webkit-line-clamp: 3;
  403. -webkit-box-orient: vertical;
  404. }
  405. }
  406. .task_desc_all {
  407. display: flex;
  408. width: 100%;
  409. padding-top: 24rpx;
  410. border-top: 2rpx solid #F3F3F3;
  411. font-weight: 400;
  412. font-size: 28rpx;
  413. color: #999999;
  414. line-height: 44rpx;
  415. box-sizing: border-box;
  416. position: absolute;
  417. left: -9999px;
  418. top: 0;
  419. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  420. pointer-events: none;
  421. }
  422. .expand_btn {
  423. width: 100%;
  424. height: 40rpx;
  425. background-color: #FFFFFF;
  426. display: flex;
  427. justify-content: flex-end;
  428. align-items: center;
  429. .expand_text {
  430. font-weight: 400;
  431. font-size: 28rpx;
  432. color: #2E64FA;
  433. margin-right: 8rpx;
  434. }
  435. .expand_icon {
  436. font-size: 32rpx !important;
  437. color: #2E64FA !important;
  438. }
  439. }
  440. }
  441. }
  442. .row_gap {
  443. background-color: #F8F9FD;
  444. width: 100%;
  445. height: 24rpx;
  446. }
  447. :deep(.search_tabs){
  448. display: flex;
  449. width: 100%;
  450. flex-direction: column;
  451. background-color: #FFFFFF;
  452. padding: 24rpx;
  453. border-bottom: 2rpx solid #F3F3F3;
  454. }
  455. .scroll_tabs {
  456. margin-top:0;
  457. padding: 0;
  458. background-color: #FFFFFF;
  459. }
  460. .total {
  461. width: 100%;
  462. display: flex;
  463. font-weight: 400;
  464. font-size: 28rpx;
  465. color: #333333;
  466. padding: 24rpx 0;
  467. border-bottom: 2rpx solid #F3F3F3;
  468. }
  469. .list_item {
  470. display: flex;
  471. flex-direction: column;
  472. width: 100%;
  473. padding: 24rpx 0;
  474. border-bottom: 2rpx solid #F3F3F3;
  475. .item_name_file{
  476. display: flex;
  477. width: 100%;
  478. align-items: center;
  479. gap: 20rpx;
  480. .name_file{
  481. flex:1;
  482. gap: 20rpx;
  483. display: flex;
  484. align-items: center;
  485. .name{
  486. font-weight: 500;
  487. font-size: 32rpx;
  488. color: #333333;
  489. }
  490. .file_num{
  491. font-weight: 400;
  492. font-size: 24rpx;
  493. color: #2E64FA;
  494. }
  495. }
  496. .btn{
  497. width: 104rpx;
  498. height: 64rpx;
  499. border-radius: 8rpx;
  500. border: 2rpx solid #2E64FA;
  501. font-weight: 400;
  502. font-size: 28rpx;
  503. color: #2E64FA;
  504. display: inline-flex;
  505. align-items: center;
  506. justify-content: center;
  507. }
  508. }
  509. .item_info{
  510. margin-top: 16rpx;
  511. display: flex;
  512. gap: 16rpx;
  513. align-items: center;
  514. flex-wrap: wrap;
  515. .info_text{
  516. font-weight: 400;
  517. font-size: 24rpx;
  518. color: #999999;
  519. flex-shrink: 0;
  520. }
  521. }
  522. }
  523. .no_data{
  524. margin-top: 24rpx;
  525. }
  526. </style>