auditDetail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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 offsetTop="0" customNavHeight="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" :style="{'height': state.isSticky ? 'calc(100% - 296rpx)' : 'calc(100% - 96rpx)'}">
  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">{{formatTimeWithoutSeconds(state?.details?.startTime)}}</text>
  42. <text class="time_item">至</text>
  43. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.endTime)}}</text>
  44. <text class="time_item" v-if="remainingDays(state?.details?.endTime)">剩余{{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" @click="handleAudit(item)">{{state.tabsSelected>0?'查看':'审核'}}</view>
  82. </view>
  83. <view class="item_info">
  84. <text class="info_text">{{item.showInfo}}</text>
  85. <text class="info_text">{{formatTimeWithoutSeconds(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,formatTimeWithoutSeconds } from '@/common/common.js';
  103. import {getReviewTaskList} from '@/reqApi/notification.js';
  104. import {
  105. onLoad,
  106. onShow
  107. } from '@dcloudio/uni-app';
  108. import {
  109. reactive,
  110. ref,
  111. nextTick,
  112. getCurrentInstance,
  113. onMounted,
  114. onUnmounted
  115. } from 'vue';
  116. const state = reactive({
  117. taskId: '', //任务id
  118. tabsSelected: 0, //默认选中tab值
  119. tabList: [{
  120. label: '待审核',
  121. value: 0
  122. }, {
  123. label: '已审核',
  124. value: 1
  125. }, {
  126. label: '已驳回',
  127. value: 2
  128. }], //tab列表
  129. showExpandBtn: false, //是否显示展开按钮
  130. isExpand: false, //是否展开
  131. pageSize: 50,
  132. pageNum: 1,
  133. scrollTop: 0,
  134. oldScrollTop: 0,
  135. isRefreshing: false, //设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
  136. isLoading: true, //加载中
  137. noMoreData: false, //没有更多数据了
  138. loadStatus: 'more', //loading状态
  139. details: {}, //详情信息
  140. pageList: [], //列表数据
  141. searchBoxTop:0,//搜索框距离顶部的高度
  142. isSticky:false,//是否吸顶
  143. });
  144. const statusClassMap = {
  145. 1: 'status_published',
  146. 2: 'status_closed'
  147. };
  148. const taskStatusMap = {
  149. 1: '进行中',
  150. 2: '已结束'
  151. };
  152. onShow(()=>{
  153. const isLoadReviewMaterialDetailList = uni.getStorageSync('isLoadReviewMaterialDetailList');
  154. if(isLoadReviewMaterialDetailList){//审核驳回通过返回刷新列表
  155. OnLoadData(true);
  156. }
  157. })
  158. onLoad((option) => {
  159. state.taskId = option.taskId;
  160. })
  161. onMounted(() => {
  162. state.details = uni.getStorageSync('collectReviewDetailInfo') || {};
  163. OnLoadData(true,true); // 数据加载完成后触发 checkTextOverflow
  164. });
  165. onUnmounted(() => {
  166. // uni.removeStorageSync('isLoadReviewMaterialDetailList');//移除缓存
  167. uni.removeStorageSync('collectReviewDetailInfo');//移除缓存
  168. })
  169. const checkTextOverflow = () => {
  170. nextTick(() => {
  171. const instance = getCurrentInstance();
  172. const query = instance && instance.proxy
  173. ? uni.createSelectorQuery().in(instance.proxy)
  174. : uni.createSelectorQuery();
  175. query.select('.task_desc_all').boundingClientRect();
  176. query.select('.task_desc').boundingClientRect();
  177. query.select('.page_content_data').boundingClientRect();
  178. query.exec((res) => {
  179. const rectAll = res[0];
  180. const rectShort = res[1];
  181. const rectPageData = res[2];
  182. const taskDescAllHeight = rectAll?.height || 0;
  183. const taskDescHeight = rectShort?.height || 0;
  184. state.searchBoxTop = rectPageData?.top || 0;
  185. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  186. });
  187. });
  188. }
  189. // 展开收起切换
  190. const toggleExpand = () => {
  191. state.isExpand = !state.isExpand;
  192. nextTick(() => {
  193. const instance = getCurrentInstance();
  194. // 自动选择查询上下文,消除重复if‑else
  195. const query = instance && instance.proxy
  196. ? uni.createSelectorQuery().in(instance.proxy)
  197. : uni.createSelectorQuery();
  198. // 只注册查询,不在回调做赋值
  199. query.select('.page_content_data').boundingClientRect();
  200. // exec才真正执行查询,res[0]对应上面select的结果
  201. query.exec((res) => {
  202. const rect = res?.[0];
  203. state.searchBoxTop = rect?.top || 0;
  204. });
  205. });
  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 handleAudit = (item) => {
  295. uni.setStorageSync('reviewMaterialDetailData', item);//详情数据
  296. uni.navigateTo({
  297. url: `/pages/materialCollection/reviewMaterial/auditResult?taskStatus=${state?.details.taskStatus}`
  298. });
  299. };
  300. //返回
  301. const GoBack = () => {
  302. uni.navigateBack({
  303. delta: 1
  304. });
  305. }
  306. </script>
  307. <style scoped lang="scss">
  308. .page_body{
  309. display: flex;
  310. flex-direction: column;
  311. height: 100%;
  312. min-height: auto;
  313. .scroll_view_box{
  314. width: 100%;
  315. display: flex;
  316. flex-direction: column;
  317. // height: calc(100% - 96rpx);
  318. }
  319. .scroll_view_y {
  320. height: 100%;
  321. .refresh_loading {
  322. padding: 10rpx 0;
  323. }
  324. }
  325. }
  326. .page_content {
  327. &.padding_btm {
  328. padding-bottom: 24rpx;
  329. .task_title {
  330. font-weight: 500;
  331. font-size: 32rpx;
  332. color: #333333;
  333. margin-top: 24rpx;
  334. }
  335. .task_class_collect {
  336. display: inline-flex;
  337. align-items: center;
  338. flex-wrap: wrap;
  339. width: 100%;
  340. margin-top: 16rpx;
  341. gap: 16rpx;
  342. .class_item {
  343. font-weight: 400;
  344. font-size: 24rpx;
  345. color: #999999;
  346. }
  347. }
  348. .task_time {
  349. display: flex;
  350. align-items: flex-start;
  351. width: 100%;
  352. margin-top: 16rpx;
  353. .time_day {
  354. display: inline-flex;
  355. align-items: center;
  356. flex-wrap: wrap;
  357. flex: 1;
  358. .time_item {
  359. font-weight: 400;
  360. font-size: 24rpx;
  361. line-height: 48rpx;
  362. color: #999999;
  363. &:nth-child(2) {
  364. margin: 0 8rpx;
  365. }
  366. &:nth-child(4) {
  367. color: #2E64FA;
  368. margin-left: 16rpx;
  369. }
  370. }
  371. }
  372. .task_status {
  373. display: inline-flex;
  374. align-items: center;
  375. height: 48rpx;
  376. padding: 0 12rpx;
  377. border-radius: 8rpx;
  378. font-weight: 400;
  379. font-size: 24rpx;
  380. &.status_pending {
  381. background: rgba(46, 100, 250, 0.1);
  382. color: #2E64FA;
  383. }
  384. &.status_published {
  385. background: rgba(82, 196, 26, 0.1);
  386. color: #2BC644;
  387. }
  388. &.status_closed {
  389. background: #6666661a;
  390. color: #666666;
  391. }
  392. }
  393. }
  394. .task_desc {
  395. margin-top: 24rpx;
  396. display: flex;
  397. width: 100%;
  398. padding-top: 24rpx;
  399. border-top: 2rpx solid #F3F3F3;
  400. font-weight: 400;
  401. font-size: 28rpx;
  402. color: #999999;
  403. line-height: 44rpx;
  404. box-sizing: border-box;
  405. position: relative;
  406. &.over {
  407. max-height: 168rpx;
  408. overflow: hidden;
  409. transition: all 0.25s;
  410. display: -webkit-box;
  411. -webkit-line-clamp: 3;
  412. -webkit-box-orient: vertical;
  413. }
  414. }
  415. .task_desc_all {
  416. display: flex;
  417. width: 100%;
  418. padding-top: 24rpx;
  419. border-top: 2rpx solid #F3F3F3;
  420. font-weight: 400;
  421. font-size: 28rpx;
  422. color: #999999;
  423. line-height: 44rpx;
  424. box-sizing: border-box;
  425. position: absolute;
  426. left: -9999px;
  427. top: 0;
  428. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  429. pointer-events: none;
  430. }
  431. .expand_btn {
  432. width: 100%;
  433. height: 40rpx;
  434. background-color: #FFFFFF;
  435. display: flex;
  436. justify-content: flex-end;
  437. align-items: center;
  438. .expand_text {
  439. font-weight: 400;
  440. font-size: 28rpx;
  441. color: #2E64FA;
  442. margin-right: 8rpx;
  443. }
  444. .expand_icon {
  445. font-size: 32rpx !important;
  446. color: #2E64FA !important;
  447. }
  448. }
  449. }
  450. }
  451. .row_gap {
  452. background-color: #F8F9FD;
  453. width: 100%;
  454. height: 24rpx;
  455. }
  456. :deep(.search_tabs){
  457. display: flex;
  458. width: 100%;
  459. flex-direction: column;
  460. background-color: #FFFFFF;
  461. padding: 24rpx;
  462. border-bottom: 2rpx solid #F3F3F3;
  463. }
  464. .scroll_tabs {
  465. margin-top:0;
  466. padding: 0;
  467. background-color: #FFFFFF;
  468. }
  469. .total {
  470. width: 100%;
  471. display: flex;
  472. font-weight: 400;
  473. font-size: 28rpx;
  474. color: #333333;
  475. padding: 24rpx 0;
  476. border-bottom: 2rpx solid #F3F3F3;
  477. }
  478. .list_item {
  479. display: flex;
  480. flex-direction: column;
  481. width: 100%;
  482. padding: 24rpx 0;
  483. border-bottom: 2rpx solid #F3F3F3;
  484. .item_name_file{
  485. display: flex;
  486. width: 100%;
  487. align-items: center;
  488. gap: 20rpx;
  489. .name_file{
  490. flex:1;
  491. gap: 20rpx;
  492. display: flex;
  493. align-items: center;
  494. .name{
  495. font-weight: 500;
  496. font-size: 32rpx;
  497. color: #333333;
  498. }
  499. .file_num{
  500. font-weight: 400;
  501. font-size: 24rpx;
  502. color: #2E64FA;
  503. }
  504. }
  505. .btn{
  506. width: 104rpx;
  507. height: 64rpx;
  508. border-radius: 8rpx;
  509. border: 2rpx solid #2E64FA;
  510. font-weight: 400;
  511. font-size: 28rpx;
  512. color: #2E64FA;
  513. display: inline-flex;
  514. align-items: center;
  515. justify-content: center;
  516. }
  517. }
  518. .item_info{
  519. margin-top: 16rpx;
  520. display: flex;
  521. gap: 16rpx;
  522. align-items: center;
  523. flex-wrap: wrap;
  524. .info_text{
  525. font-weight: 400;
  526. font-size: 24rpx;
  527. color: #999999;
  528. flex-shrink: 0;
  529. }
  530. }
  531. }
  532. .no_data{
  533. margin-top: 24rpx;
  534. }
  535. </style>