taskDetail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" title="任务详情" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content padding_btm">
  6. <view class="task_title">{{state?.details?.taskName}}</view>
  7. <view class="task_class_collect">
  8. <text class="class_item">{{state?.details?.departmentName}}</text>
  9. <text class="class_item">{{state?.details?.materialCategoryName}}</text>
  10. <text class="class_item">{{state?.details?.createdBy}}</text>
  11. </view>
  12. <view class="task_time">
  13. <view class="time_day">
  14. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.startTime)}}</text>
  15. <text class="time_item">至</text>
  16. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.endTime)}}</text>
  17. <text class="time_item" v-if="state?.details?.taskStatus === 1 && remainingDays(state?.details?.endTime)">剩余{{remainingDays(state?.details?.endTime)}}</text>
  18. </view>
  19. <view :class="['task_status', statusClassMap[state?.details?.taskStatus]]">
  20. {{taskStatusMap[state?.details?.taskStatus]}}
  21. </view>
  22. </view>
  23. <view :class="['task_desc',{'over':!state.isExpand}]">
  24. 采集要求:{{state?.details?.collectionRequire}}
  25. </view>
  26. <view class="task_desc_all">
  27. 采集要求:{{state?.details?.collectionRequire}}
  28. </view>
  29. <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
  30. class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
  31. :type="!state.isExpand?'down':'up'"></uni-icons></view>
  32. </view>
  33. <!-- 间隔 -->
  34. <view class="row_gap"></view>
  35. <view class="page_content">
  36. <view class="total">
  37. <view class="status_tag" :class="state.auditStatus">
  38. <text>{{ tabStatusClassMap[state.auditStatus] }}:{{ state?.details?.taskTargetNum }}</text>
  39. </view>
  40. </view>
  41. <template v-for="item in (state?.details?.taskTargetVos || [])">
  42. <view class="list_item" v-if="item.isShow!==1" :Key="item.id">
  43. <view class="item_name_file">
  44. <view class="name_file">
  45. <text class="name">{{item.targetName}}</text>
  46. <text class="file_num">文件数量:{{item?.fileNum || 0}}</text>
  47. </view>
  48. <view class="btn" @click="HandleDetail(item.id)">{{state.auditStatus == 'notSubmitList'?'立即提交':'查看'}}</view>
  49. </view>
  50. <view class="item_info">
  51. <template v-for="text in ['departmentName','departmentGroupName','subjectName','gradeName','classTypeName','className','updateTime']">
  52. <text class="info_text" v-if="item?.[text]" :key="text">
  53. <template v-if="text=='updateTime'">{{formatTimeWithoutSeconds(item?.[text])}}</template>
  54. <template v-else>{{item?.[text]}}</template>
  55. </text>
  56. </template>
  57. </view>
  58. </view>
  59. </template>
  60. </view>
  61. </view>
  62. </template>
  63. <script setup>
  64. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  65. import navBar from '@/components/navBar.vue';
  66. import { remainingDays,formatTimeWithoutSeconds } from '@/common/common.js';
  67. import {onLoad,onShow} from '@dcloudio/uni-app';
  68. import {
  69. reactive,
  70. ref,
  71. nextTick,
  72. getCurrentInstance,
  73. onMounted,
  74. onUnmounted
  75. } from 'vue';
  76. const state = reactive({
  77. taskId: '', //任务id
  78. auditStatus:'',//审核状态
  79. showExpandBtn: false, //是否显示展开按钮
  80. isExpand: false, //是否展开
  81. details: {}, //详情信息
  82. });
  83. const statusClassMap = {
  84. 1: 'status_published',
  85. 2: 'status_closed'
  86. };
  87. const taskStatusMap = {
  88. 1: '进行中',
  89. 2: '已结束'
  90. };
  91. const tabStatusClassMap = {
  92. 'notSubmitList':'待提交',// 待提交
  93. 'notReviewList':'审核中',// 审核中
  94. 'reviewReasonList':'已驳回',// 已驳回
  95. 'reviewList':'已提交'// 已提交
  96. };
  97. onShow(()=>{
  98. const isLoadSubmitMaterialTaskDetail = uni.getStorageSync('isLoadSubmitMaterialTaskDetail');
  99. if(isLoadSubmitMaterialTaskDetail){
  100. OnLoadData();
  101. }
  102. })
  103. onUnmounted(()=>{
  104. uni.removeStorageSync('isLoadSubmitMaterialTaskDetail');
  105. })
  106. onLoad((option) => {
  107. state.taskId = option.taskId;
  108. state.auditStatus = option.auditStatus;
  109. })
  110. onMounted(() => {
  111. OnLoadData();
  112. checkTextOverflow();
  113. });
  114. const OnLoadData = () => {
  115. state.details = uni.getStorageSync('submitMaterialDetailInfo') || {};
  116. const taskTargetData = state?.details?.taskTargetVos || [];
  117. state.details.taskTargetNum = taskTargetData.filter(item=>item.isShow!=1)?.length;
  118. }
  119. const checkTextOverflow = () => {
  120. nextTick(() => {
  121. const instance = getCurrentInstance();
  122. // 安全保护
  123. if (!instance || !instance.proxy) {
  124. // 备用方案:全局查询(要求元素 class 唯一)
  125. let taskDescAllHeight = 0,
  126. taskDescHeight = 0;
  127. const query = uni.createSelectorQuery();
  128. query.select('.task_desc_all').boundingClientRect((rect) => {
  129. taskDescAllHeight = rect?.height || 0;
  130. });
  131. query.select('.task_desc').boundingClientRect((rect) => {
  132. taskDescHeight = rect?.height || 0;
  133. });
  134. query.exec(() => {
  135. // 所有回调执行完毕后触发
  136. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  137. });
  138. return;
  139. }
  140. let taskDescAllHeight = 0,
  141. taskDescHeight = 0;
  142. const query = uni.createSelectorQuery().in(instance.proxy);
  143. query.select('.task_desc_all').boundingClientRect((rect) => {
  144. taskDescAllHeight = rect?.height || 0;
  145. });
  146. query.select('.task_desc').boundingClientRect((rect) => {
  147. taskDescHeight = rect?.height || 0;
  148. });
  149. query.exec(() => {
  150. // 所有回调执行完毕后触发
  151. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  152. });
  153. });
  154. }
  155. // 展开收起切换
  156. const toggleExpand = () => {
  157. state.isExpand = !state.isExpand;
  158. }
  159. //提交材料
  160. const HandleDetail = (targetId) => {
  161. let auditStatus = '';
  162. if(state.auditStatus == 'notSubmitList'){
  163. auditStatus = '1';
  164. }else if(state.auditStatus == 'notReviewList'){
  165. auditStatus = '2';
  166. }else if(state.auditStatus == 'reviewReasonList'){
  167. auditStatus = '3';
  168. }else if(state.auditStatus == 'reviewList'){
  169. auditStatus = '4';
  170. }else{
  171. auditStatus = '';
  172. }
  173. uni.navigateTo({
  174. url: `/pages/materialCollection/submitMaterial/submitDetail?taskId=${state.taskId}&targetId=${targetId}&auditStatus=${auditStatus}`
  175. });
  176. }
  177. //返回
  178. const GoBack = () => {
  179. uni.navigateBack({
  180. delta: 1
  181. });
  182. }
  183. </script>
  184. <style scoped lang="scss">
  185. .page_content {
  186. &.padding_btm {
  187. padding-bottom: 24rpx;
  188. .task_title {
  189. font-weight: 500;
  190. font-size: 32rpx;
  191. color: #333333;
  192. margin-top: 24rpx;
  193. }
  194. .task_class_collect {
  195. display: inline-flex;
  196. align-items: center;
  197. flex-wrap: wrap;
  198. width: 100%;
  199. margin-top: 16rpx;
  200. gap: 16rpx;
  201. .class_item {
  202. font-weight: 400;
  203. font-size: 24rpx;
  204. color: #999999;
  205. }
  206. }
  207. .task_time {
  208. display: flex;
  209. align-items: flex-start;
  210. width: 100%;
  211. margin-top: 16rpx;
  212. .time_day {
  213. display: inline-flex;
  214. align-items: center;
  215. flex-wrap: wrap;
  216. flex: 1;
  217. .time_item {
  218. font-weight: 400;
  219. font-size: 24rpx;
  220. line-height: 48rpx;
  221. color: #999999;
  222. &:nth-child(2) {
  223. margin: 0 8rpx;
  224. }
  225. &:nth-child(4) {
  226. color: #2E64FA;
  227. margin-left: 16rpx;
  228. }
  229. }
  230. }
  231. .task_status {
  232. display: inline-flex;
  233. align-items: center;
  234. height: 48rpx;
  235. padding: 0 12rpx;
  236. border-radius: 8rpx;
  237. font-weight: 400;
  238. font-size: 24rpx;
  239. &.status_pending {
  240. background: rgba(46, 100, 250, 0.1);
  241. color: #2E64FA;
  242. }
  243. &.status_published {
  244. background: rgba(82, 196, 26, 0.1);
  245. color: #2BC644;
  246. }
  247. &.status_closed {
  248. background: #6666661a;
  249. color: #666666;
  250. }
  251. }
  252. }
  253. .task_desc {
  254. margin-top: 24rpx;
  255. display: flex;
  256. width: 100%;
  257. padding-top: 24rpx;
  258. border-top: 2rpx solid #F3F3F3;
  259. font-weight: 400;
  260. font-size: 28rpx;
  261. color: #999999;
  262. line-height: 44rpx;
  263. box-sizing: border-box;
  264. position: relative;
  265. &.over {
  266. max-height: 168rpx;
  267. overflow: hidden;
  268. transition: all 0.25s;
  269. display: -webkit-box;
  270. -webkit-line-clamp: 3;
  271. -webkit-box-orient: vertical;
  272. }
  273. }
  274. .task_desc_all {
  275. display: flex;
  276. width: 100%;
  277. padding-top: 24rpx;
  278. border-top: 2rpx solid #F3F3F3;
  279. font-weight: 400;
  280. font-size: 28rpx;
  281. color: #999999;
  282. line-height: 44rpx;
  283. box-sizing: border-box;
  284. position: absolute;
  285. left: -9999px;
  286. top: 0;
  287. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  288. pointer-events: none;
  289. }
  290. .expand_btn {
  291. width: 100%;
  292. height: 40rpx;
  293. background-color: #FFFFFF;
  294. display: flex;
  295. justify-content: flex-end;
  296. align-items: center;
  297. .expand_text {
  298. font-weight: 400;
  299. font-size: 28rpx;
  300. color: #2E64FA;
  301. margin-right: 8rpx;
  302. }
  303. .expand_icon {
  304. font-size: 32rpx !important;
  305. color: #2E64FA !important;
  306. }
  307. }
  308. }
  309. }
  310. .row_gap {
  311. background-color: #F8F9FD;
  312. width: 100%;
  313. height: 24rpx;
  314. }
  315. .total {
  316. width: 100%;
  317. display: flex;
  318. padding: 24rpx 0;
  319. border-bottom: 2rpx solid #F3F3F3;
  320. .status_tag{
  321. font-size: 24rpx;
  322. text-align: center;
  323. padding: 8rpx 12rpx;
  324. font-weight: 400;
  325. border-radius: 8rpx;
  326. flex-shrink: 0;
  327. &.notSubmitList {
  328. background: rgba(46,100,250,0.1);
  329. color: #2E64FA;
  330. }
  331. &.notReviewList {
  332. background: rgba(251,159,52,0.1);
  333. color: #FB9F34;
  334. }
  335. &.reviewReasonList {
  336. background: rgba(245,108,108,0.1);
  337. color: #F56C6C;
  338. }
  339. &.reviewList {
  340. background: rgba(43,198,68,0.1);
  341. color: #2BC644;
  342. }
  343. }
  344. }
  345. .list_item {
  346. display: flex;
  347. flex-direction: column;
  348. width: 100%;
  349. padding: 24rpx 0;
  350. border-bottom: 2rpx solid #F3F3F3;
  351. .item_name_file{
  352. display: flex;
  353. width: 100%;
  354. align-items: center;
  355. gap: 20rpx;
  356. .name_file{
  357. flex:1;
  358. gap: 20rpx;
  359. display: flex;
  360. align-items: center;
  361. .name{
  362. font-weight: 500;
  363. font-size: 32rpx;
  364. color: #333333;
  365. }
  366. .file_num{
  367. font-weight: 400;
  368. font-size: 24rpx;
  369. color: #2E64FA;
  370. }
  371. }
  372. .btn{
  373. padding: 12rpx 24rpx;
  374. border-radius: 8rpx;
  375. border: 2rpx solid #2E64FA;
  376. font-weight: 400;
  377. font-size: 28rpx;
  378. color: #2E64FA;
  379. display: inline-flex;
  380. align-items: center;
  381. justify-content: center;
  382. }
  383. }
  384. .item_info{
  385. margin-top: 16rpx;
  386. display: flex;
  387. gap: 16rpx;
  388. align-items: center;
  389. flex-wrap: wrap;
  390. .info_text{
  391. font-weight: 400;
  392. font-size: 24rpx;
  393. color: #999999;
  394. flex-shrink: 0;
  395. }
  396. }
  397. }
  398. </style>