taskDetail.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. const query = instance && instance.proxy
  123. ? uni.createSelectorQuery().in(instance.proxy)
  124. : uni.createSelectorQuery();
  125. query.select('.task_desc_all').boundingClientRect();
  126. query.select('.task_desc').boundingClientRect();
  127. query.exec((res) => {
  128. const rectAll = res[0];
  129. const rectShort = res[1];
  130. const taskDescAllHeight = rectAll?.height || 0;
  131. const taskDescHeight = rectShort?.height || 0;
  132. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  133. });
  134. });
  135. }
  136. // 展开收起切换
  137. const toggleExpand = () => {
  138. state.isExpand = !state.isExpand;
  139. }
  140. //提交材料
  141. const HandleDetail = (targetId) => {
  142. let auditStatus = '';
  143. if(state.auditStatus == 'notSubmitList'){
  144. auditStatus = '1';
  145. }else if(state.auditStatus == 'notReviewList'){
  146. auditStatus = '2';
  147. }else if(state.auditStatus == 'reviewReasonList'){
  148. auditStatus = '3';
  149. }else if(state.auditStatus == 'reviewList'){
  150. auditStatus = '4';
  151. }else{
  152. auditStatus = '';
  153. }
  154. uni.navigateTo({
  155. url: `/pages/materialCollection/submitMaterial/submitDetail?taskId=${state.taskId}&targetId=${targetId}&auditStatus=${auditStatus}`
  156. });
  157. }
  158. //返回
  159. const GoBack = () => {
  160. uni.navigateBack({
  161. delta: 1
  162. });
  163. }
  164. </script>
  165. <style scoped lang="scss">
  166. .page_content {
  167. &.padding_btm {
  168. padding-bottom: 24rpx;
  169. .task_title {
  170. font-weight: 500;
  171. font-size: 32rpx;
  172. color: #333333;
  173. margin-top: 24rpx;
  174. }
  175. .task_class_collect {
  176. display: inline-flex;
  177. align-items: center;
  178. flex-wrap: wrap;
  179. width: 100%;
  180. margin-top: 16rpx;
  181. gap: 16rpx;
  182. .class_item {
  183. font-weight: 400;
  184. font-size: 24rpx;
  185. color: #999999;
  186. }
  187. }
  188. .task_time {
  189. display: flex;
  190. align-items: flex-start;
  191. width: 100%;
  192. margin-top: 16rpx;
  193. .time_day {
  194. display: inline-flex;
  195. align-items: center;
  196. flex-wrap: wrap;
  197. flex: 1;
  198. .time_item {
  199. font-weight: 400;
  200. font-size: 24rpx;
  201. line-height: 48rpx;
  202. color: #999999;
  203. &:nth-child(2) {
  204. margin: 0 8rpx;
  205. }
  206. &:nth-child(4) {
  207. color: #2E64FA;
  208. margin-left: 16rpx;
  209. }
  210. }
  211. }
  212. .task_status {
  213. display: inline-flex;
  214. align-items: center;
  215. height: 48rpx;
  216. padding: 0 12rpx;
  217. border-radius: 8rpx;
  218. font-weight: 400;
  219. font-size: 24rpx;
  220. &.status_pending {
  221. background: rgba(46, 100, 250, 0.1);
  222. color: #2E64FA;
  223. }
  224. &.status_published {
  225. background: rgba(82, 196, 26, 0.1);
  226. color: #2BC644;
  227. }
  228. &.status_closed {
  229. background: #6666661a;
  230. color: #666666;
  231. }
  232. }
  233. }
  234. .task_desc {
  235. margin-top: 24rpx;
  236. display: flex;
  237. width: 100%;
  238. padding-top: 24rpx;
  239. border-top: 2rpx solid #F3F3F3;
  240. font-weight: 400;
  241. font-size: 28rpx;
  242. color: #999999;
  243. line-height: 44rpx;
  244. box-sizing: border-box;
  245. position: relative;
  246. &.over {
  247. max-height: 168rpx;
  248. overflow: hidden;
  249. transition: all 0.25s;
  250. display: -webkit-box;
  251. -webkit-line-clamp: 3;
  252. -webkit-box-orient: vertical;
  253. }
  254. }
  255. .task_desc_all {
  256. display: flex;
  257. width: 100%;
  258. padding-top: 24rpx;
  259. border-top: 2rpx solid #F3F3F3;
  260. font-weight: 400;
  261. font-size: 28rpx;
  262. color: #999999;
  263. line-height: 44rpx;
  264. box-sizing: border-box;
  265. position: absolute;
  266. left: -9999px;
  267. top: 0;
  268. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  269. pointer-events: none;
  270. }
  271. .expand_btn {
  272. width: 100%;
  273. height: 40rpx;
  274. background-color: #FFFFFF;
  275. display: flex;
  276. justify-content: flex-end;
  277. align-items: center;
  278. .expand_text {
  279. font-weight: 400;
  280. font-size: 28rpx;
  281. color: #2E64FA;
  282. margin-right: 8rpx;
  283. }
  284. .expand_icon {
  285. font-size: 32rpx !important;
  286. color: #2E64FA !important;
  287. }
  288. }
  289. }
  290. }
  291. .row_gap {
  292. background-color: #F8F9FD;
  293. width: 100%;
  294. height: 24rpx;
  295. }
  296. .total {
  297. width: 100%;
  298. display: flex;
  299. padding: 24rpx 0;
  300. border-bottom: 2rpx solid #F3F3F3;
  301. .status_tag{
  302. font-size: 24rpx;
  303. text-align: center;
  304. padding: 8rpx 12rpx;
  305. font-weight: 400;
  306. border-radius: 8rpx;
  307. flex-shrink: 0;
  308. &.notSubmitList {
  309. background: rgba(46,100,250,0.1);
  310. color: #2E64FA;
  311. }
  312. &.notReviewList {
  313. background: rgba(251,159,52,0.1);
  314. color: #FB9F34;
  315. }
  316. &.reviewReasonList {
  317. background: rgba(245,108,108,0.1);
  318. color: #F56C6C;
  319. }
  320. &.reviewList {
  321. background: rgba(43,198,68,0.1);
  322. color: #2BC644;
  323. }
  324. }
  325. }
  326. .list_item {
  327. display: flex;
  328. flex-direction: column;
  329. width: 100%;
  330. padding: 24rpx 0;
  331. border-bottom: 2rpx solid #F3F3F3;
  332. .item_name_file{
  333. display: flex;
  334. width: 100%;
  335. align-items: center;
  336. gap: 20rpx;
  337. .name_file{
  338. flex:1;
  339. gap: 20rpx;
  340. display: flex;
  341. align-items: center;
  342. .name{
  343. font-weight: 500;
  344. font-size: 32rpx;
  345. color: #333333;
  346. }
  347. .file_num{
  348. font-weight: 400;
  349. font-size: 24rpx;
  350. color: #2E64FA;
  351. }
  352. }
  353. .btn{
  354. padding: 12rpx 24rpx;
  355. border-radius: 8rpx;
  356. border: 2rpx solid #2E64FA;
  357. font-weight: 400;
  358. font-size: 28rpx;
  359. color: #2E64FA;
  360. display: inline-flex;
  361. align-items: center;
  362. justify-content: center;
  363. }
  364. }
  365. .item_info{
  366. margin-top: 16rpx;
  367. display: flex;
  368. gap: 16rpx;
  369. align-items: center;
  370. flex-wrap: wrap;
  371. .info_text{
  372. font-weight: 400;
  373. font-size: 24rpx;
  374. color: #999999;
  375. flex-shrink: 0;
  376. }
  377. }
  378. }
  379. </style>