taskDetail.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987
  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. <!-- 搜索框 -->
  9. <uni-easyinput class="search_box" v-model="state.searchWord" trim="all" :styles="state.searchInputStyles"
  10. :placeholderStyle="state.searchInputPlaceholderStyle" placeholder="请输入关键字搜索" @input="HandleSearchInput">
  11. <template #left>
  12. <image src="@/static/image/overview/search.png" class="search_icon"></image>
  13. </template>
  14. </uni-easyinput>
  15. <view class="scroll_select">
  16. <uni-data-select v-for="(item,index) in state.selectData" :key="item.prop" v-model="state.selectProp[item.prop]" :clear="false" :placeholder="`请选择`" :localdata="item.list" @change="(val) => ChangeSelectData(val,index,item.list)"></uni-data-select>
  17. </view>
  18. <scroll-view class="scroll_tabs" scroll-x="true" scroll-left="0" :show-scrollbar="false">
  19. <view :class="['tab_item',{'selected':item.value==state.tabsSelected}]" v-for="item in state.tabList"
  20. :key="item.value" @click="SelectTabsValue(item.value)">
  21. {{item.label}}
  22. </view>
  23. </scroll-view>
  24. </view>
  25. </uv-sticky>
  26. <view class="scroll_view_box" :style="{'height': state.isSticky ? 'calc(100% - 396rpx)' : 'calc(100% - 96rpx)'}">
  27. <scroll-view
  28. class="scroll_view_y"
  29. :scroll-top="state.scrollTop"
  30. scroll-y="true"
  31. :refresher-enabled="false"
  32. :enable-back-to-top="true"
  33. :show-scrollbar="false"
  34. :scroll-with-animation="true"
  35. refresher-default-style="none"
  36. refresher-background="#F8F9FD"
  37. :refresher-triggered="state.isRefreshing"
  38. @scrolltolower="OnLoadMore"
  39. @refresherrefresh="OnRefresh"
  40. @scroll="OnScroll">
  41. <view class="refresh_loading" v-if="state.isRefreshing"><uni-load-more status="loading" /></view>
  42. <view class="page_content padding_btm">
  43. <view class="task_title">{{state?.details?.taskName}}</view>
  44. <view class="task_class_collect">
  45. <text class="class_item">{{state?.details?.departmentName}}</text>
  46. <text class="class_item">{{state?.details?.materialCategoryName}}</text>
  47. <text class="class_item">{{state?.details?.createdBy}}</text>
  48. </view>
  49. <view class="task_time">
  50. <view class="time_day">
  51. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.startTime)}}</text>
  52. <text class="time_item">至</text>
  53. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.endTime)}}</text>
  54. <text class="time_item" v-if="state.taskStatus!== 2 && remainingDays(state?.details?.endTime) > 0">剩余{{remainingDays(state?.details?.endTime)}}天</text>
  55. </view>
  56. <view :class="['task_status', statusClassMap[state.taskStatus]]">
  57. {{taskStatusMap[state.taskStatus]}}
  58. </view>
  59. </view>
  60. <view :class="['task_desc',{'over':!state.isExpand}]">
  61. 采集要求:{{state?.details?.collectionRequire}}
  62. </view>
  63. <view class="task_desc_all">
  64. 采集要求:{{state?.details?.collectionRequire}}
  65. </view>
  66. <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
  67. class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
  68. :type="!state.isExpand?'down':'up'"></uni-icons></view>
  69. </view>
  70. <!-- 间隔 -->
  71. <view class="row_gap"></view>
  72. <!-- 吸顶 -->
  73. <!-- <uv-sticky style="top:98rpx"> -->
  74. <view class="search_tabs">
  75. <!-- 搜索框 -->
  76. <uni-easyinput class="search_box" v-model="state.searchWord" trim="all" :styles="state.searchInputStyles"
  77. :placeholderStyle="state.searchInputPlaceholderStyle" placeholder="请输入关键字搜索" @input="HandleSearchInput">
  78. <template #left>
  79. <image src="@/static/image/overview/search.png" class="search_icon"></image>
  80. </template>
  81. </uni-easyinput>
  82. <view class="scroll_select">
  83. <uni-data-select v-for="(item,index) in state.selectData" :key="item.prop" v-model="state.selectProp[item.prop]" :clear="false" :placeholder="`请选择`" :localdata="item.list" @change="(val) => ChangeSelectData(val,index,item.list)"></uni-data-select>
  84. </view>
  85. <scroll-view class="scroll_tabs" scroll-x="true" scroll-left="0" :show-scrollbar="false">
  86. <view :class="['tab_item',{'selected':item.value==state.tabsSelected}]" v-for="item in state.tabList"
  87. :key="item.value" @click="SelectTabsValue(item.value)">
  88. {{item.label}}
  89. </view>
  90. </scroll-view>
  91. </view>
  92. <!-- </uv-sticky> -->
  93. <view class="page_content page_content_data">
  94. <view class="total">共 {{state[`${state.tabsSelected}List`]?.length || 0}} 人</view>
  95. <view class="list_item" v-for="item in state.tabListData" :Key="item.id">
  96. <view class="item_name_file">
  97. <view class="name_file">
  98. <text class="name">{{item.targetName}}</text>
  99. <text class="file_num" v-if="state?.[`${state.tabsSelected}Header`]?.includes('fileNum')">文件数量:{{item?.fileNum || 0}}</text>
  100. </view>
  101. <template v-if="state?.[`${state.tabsSelected}Header`]?.includes('fileNum') && item?.fileNum > 0 && state.tabsSelected!='notSubmit'">
  102. <!-- #ifdef APP-PLUS -->
  103. <!-- app端处理 -->
  104. <template v-if="['word','excel','pdf','txt'].includes(getFileTypeBySuffix(item?.taskTargetFileVos?.[0].fileType || ''))">
  105. <template v-if="item?.fileNum == 1">
  106. <cjx-previewOffice :value="item?.taskTargetFileVos?.[0].filePath" :name="item?.taskTargetFileVos?.[0].fileName" :type="getFileTypeBySuffix(item?.taskTargetFileVos?.[0].fileType)">
  107. <view class="btn">查看</view>
  108. </cjx-previewOffice>
  109. </template>
  110. <view v-else class="btn" @click="OpenPreviewFileDialog(item.taskTargetFileVos)">查看</view>
  111. </template>
  112. <view v-else class="btn" @click="OpenPreviewFileDialog(item.taskTargetFileVos)">查看</view>
  113. <!-- #endif -->
  114. <!-- #ifndef APP-PLUS -->
  115. <!-- 不包含app端 -->
  116. <view class="btn" @click="OpenPreviewFileDialog(item.taskTargetFileVos)">查看</view>
  117. <!-- #endif -->
  118. </template>
  119. </view>
  120. <view class="item_info">
  121. <template v-for="prop in state?.[`${state.tabsSelected}Header`]">
  122. <text v-if="['targetName','fileNum','reviewBy','reviewTime'].indexOf(prop) == -1" class="info_text">
  123. <template v-if="prop=='updateTime'">{{formatTimeWithoutSeconds(item[prop])}}</template>
  124. <template v-else>{{item[prop]}}</template>
  125. </text>
  126. </template>
  127. </view>
  128. <view class="item_info" v-if="state?.[`${state.tabsSelected}Header`]?.includes('reviewBy')">
  129. <text class="info_text">审核人:{{item.reviewBy}}</text>
  130. <text class="info_text">{{formatTimeWithoutSeconds(item.reviewTime)}}</text>
  131. </view>
  132. </view>
  133. <view class="no_data" v-if="!state.isLoading && state.tabListData.length == 0">
  134. <image class="no_data_img" src="@/static/image/bg/no_data.png"></image>
  135. <text class="no_data_text">暂无数据</text>
  136. </view>
  137. </view>
  138. <uni-load-more v-if="state.tabListData.length > 0" :status="state.loadStatus" />
  139. </scroll-view>
  140. </view>
  141. <!-- 查看文件弹框 -->
  142. <customPopupDialog class="file_preview" ref="popupFileDialogRef" title="查看文件" dialogWidth="670" :isMaskClick="false" :showDialogFooter="false">
  143. <view class="dialog_content_file">
  144. <view class="file_list_item" v-for="item in state.fileDialog.fileList" :Key="item.id">
  145. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  146. <view class="file_info">
  147. <view class="file_name">{{item.fileName}}</view>
  148. <view class="file_size">
  149. <text>{{getFileSize(item.fileSize)}}</text>
  150. <text>{{ formatTimeWithoutSeconds(item.createTime) }}</text>
  151. </view>
  152. </view>
  153. <view class="file_btn">
  154. <!-- #ifdef APP-PLUS -->
  155. <!-- app端处理 -->
  156. <template v-if="['word','excel','pdf','txt'].includes(getFileTypeBySuffix(item?.fileType || ''))">
  157. <cjx-previewOffice :value="item.filePath" :name="item.fileName" :type="getFileTypeBySuffix(item.fileType)">
  158. <text class="preview">预览</text>
  159. </cjx-previewOffice>
  160. </template>
  161. <text v-else class="preview" @click="ViewFile(item)">预览</text>
  162. <!-- #endif -->
  163. <!-- #ifndef APP-PLUS -->
  164. <!-- 不包含app端 -->
  165. <text class="preview" @click="ViewFile(item)">预览</text>
  166. <!-- #endif -->
  167. </view>
  168. </view>
  169. </view>
  170. </customPopupDialog>
  171. <!-- 图片 视频预览 -->
  172. <popupPreviewFile ref="imgVideoPreview" :fileType="state.previewPopup.fileType" :fileName="state.previewPopup.fileName" :filePath="state.previewPopup.filePath" @ToDownloadFile="ToDownloadFile"></popupPreviewFile>
  173. <!-- 默认指H5端 此插件只支持h5 PDF、Word、Excel、PPTX、TXT预览-->
  174. <!-- #ifdef H5 -->
  175. <wg-h5-preview-file ref="webPreviewFile" />
  176. <!-- #endif -->
  177. <!-- 文件、图片下载 -->
  178. <ss-download ref="ssdownload"></ss-download>
  179. </view>
  180. </template>
  181. <script setup>
  182. import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue';
  183. import uniDataSelect from '@/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue';
  184. import customPopupDialog from '@/components/customPopupDialog.vue';
  185. import ssDownload from '@/uni_modules/ss-download/components/ss-download/ss-download.vue';
  186. import popupPreviewFile from '@/components/popupPreviewFile.vue';//图片 音视频 zip等预览
  187. // #ifdef H5
  188. import wgH5PreviewFile from '@/components/wg-h5-preview-file/wg-h5-preview-file.vue';//web端文件预览 'word','excel','pptx','pdf','txt'
  189. // #endif
  190. // #ifdef APP-PLUS
  191. import cjxPreviewOffice from '@/uni_modules/cjx-previewOffice/components/cjx-previewOffice/cjx-previewOffice.vue';//APP端文件预览 'word','excel','pdf','txt'
  192. // #endif
  193. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  194. import uvSticky from '@/uni_modules/uv-sticky/components/uv-sticky/uv-sticky.vue'; //吸顶
  195. import navBar from '@/components/navBar.vue';
  196. import { remainingDays,getFileSize,getFileTypeBySuffix,formatTimeWithoutSeconds } from '@/common/common.js';
  197. import {
  198. GetCollectionTask,
  199. getTaskTargetList,
  200. getTaskSelectCommon
  201. } from '@/reqApi/notification.js';
  202. import {
  203. onLoad
  204. } from '@dcloudio/uni-app';
  205. import {
  206. reactive,
  207. ref,
  208. nextTick,
  209. getCurrentInstance,
  210. onMounted
  211. } from 'vue';
  212. const state = reactive({
  213. taskId: '', //任务id
  214. taskStatus:'',//任务状态 0-未开始 1-进行中 2-结束
  215. searchWord: '', //搜索关键词
  216. searchInputStyles: { //搜索框样式
  217. borderColor: '#DCDFE6',
  218. color: '#333333'
  219. },
  220. searchInputPlaceholderStyle: 'color: #C0C4CC;fontSize: 28rpx', //搜索框样式
  221. tabsSelected: '', //默认选中tab值
  222. tabList: [], //tab列表
  223. reviewTabList: [{
  224. label: '待审核',
  225. value: 'notReview'
  226. }, {
  227. label: '已审核',
  228. value: 'review'
  229. }, {
  230. label: '已驳回',
  231. value: 'reviewReason'
  232. }, {
  233. label: '待提交',
  234. value: 'notSubmit'
  235. }], //需审核
  236. noReviewTabList: [{
  237. label: '待提交',
  238. value: 'notSubmit'
  239. }, {
  240. label: '已提交',
  241. value: 'review'
  242. }], //无需审核
  243. showExpandBtn: false, //是否显示展开按钮
  244. isExpand: false, //是否展开
  245. pageSize: 50,
  246. pageNum: 1,
  247. scrollTop: 0,
  248. oldScrollTop: 0,
  249. isRefreshing: false, //设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发
  250. isLoading: true, //加载中
  251. noMoreData: false, //没有更多数据了
  252. loadStatus: 'more', //loading状态
  253. details: {}, //详情信息
  254. selectData:[],//筛选项
  255. selectProp:{},//筛选项字段及值
  256. notReviewList: [],//待审核
  257. notSubmitList: [],//待提交
  258. reviewList: [],//已审核
  259. reviewReasonList: [],//已驳回
  260. notReviewPagess: 0,//待审核分页
  261. notSubmitPages: 0,//待提交分页
  262. reviewPagess: 0,//已审核分页
  263. reviewReasonPagess: 0,//已驳回分页
  264. notReviewHeader: [],//待审核表头
  265. notSubmitHeader: [],//待提交表头
  266. reviewHeader: [],//已审核表头
  267. reviewReasonHeader: [],//已驳回表头
  268. tabListData: [], //列表数据
  269. searchBoxTop:0,//搜索框距离顶部的高度
  270. isSticky:false,//是否吸顶
  271. fileDialog:{//文件预览
  272. fileList:[]
  273. },
  274. previewPopup:{//文件预览弹框
  275. fileType:'',
  276. filePath:'',
  277. fileName:''
  278. }
  279. });
  280. const statusClassMap = {
  281. 0: 'status_pending',
  282. 1: 'status_published',
  283. 2: 'status_closed'
  284. };
  285. const taskStatusMap = {
  286. 0: '待开始',
  287. 1: '进行中',
  288. 2: '已结束'
  289. };
  290. const popupFileDialogRef = ref(null)
  291. const ssdownload = ref(null);//下载
  292. const imgVideoPreview = ref(null);//图片 视频
  293. const webPreviewFile = ref(null);//web端文件预览
  294. const appPreviewOfficeRef = ref(null);//APP端文件预览
  295. onLoad((option) => {
  296. state.taskId = option.taskId;
  297. state.taskStatus = option.taskStatus;
  298. })
  299. onMounted(async() => {
  300. await QueryCollectionTask();//获取指定的采集任务详情
  301. QueryTaskSelectCommon();//获取当前任务的筛选表头和数据表的表头
  302. OnLoadData(true,true); // 数据加载完成后触发 checkTextOverflow
  303. });
  304. //获取指定的采集任务详情
  305. const QueryCollectionTask = async () => {
  306. await GetCollectionTask(state.taskId).then(res=>{
  307. if(res.code == 200){
  308. state.details = res?.data || {};
  309. // 审核机制 0-无需审核 1-需要审核
  310. state.tabList = state.details.auditMechanism === 1 ? state.reviewTabList:state.noReviewTabList;
  311. state.tabsSelected = state.tabList?.[0]?.value || '';
  312. }
  313. })
  314. }
  315. //获取当前任务的筛选表头和数据表的表头
  316. const QueryTaskSelectCommon = () => {
  317. getTaskSelectCommon(state.taskId).then(res=>{
  318. if(res.code == 200){
  319. const list = res?.data?.commonSelect || [];
  320. const selectList = list.map(item=>({
  321. ...item,
  322. text:item.label,
  323. value:item.value ?? ''
  324. }))
  325. if(list.length > 0){
  326. const prop = list?.[0]?.prop || '';
  327. const value = list?.[0]?.value ?? '';
  328. //筛选项字段及字段对应的值
  329. state.selectData.push({
  330. prop:prop,
  331. list:selectList
  332. })
  333. state.selectProp[prop] = value;
  334. }
  335. const notReviewTableHeader = res?.data?.notReviewTableHeader || [];
  336. const notSubmitTableHeader = res?.data?.notSubmitTableHeader || [];
  337. const tableHeader = res?.data?.tableHeader || [];
  338. const tableHeaderProp = tableHeader.filter(item=>item.display).map(item=>item.prop);
  339. state.notReviewHeader = notReviewTableHeader.filter(item=>item.display).map(item=>item.prop);//待审核表头
  340. state.notSubmitHeader = notSubmitTableHeader.filter(item=>item.display).map(item=>item.prop);//待提交表头
  341. state.reviewHeader = tableHeaderProp;//已审核表头
  342. state.reviewReasonHeader = tableHeaderProp;//已驳回表头
  343. }
  344. })
  345. }
  346. //切换下拉框数据
  347. const ChangeSelectData = (val,index,list) => {
  348. const childrenData = list.find(item=>item.value === val)?.children || [];
  349. if(childrenData.length > 0){
  350. let childrenList = childrenData.map(item=>({
  351. ...item,
  352. text:item.label,
  353. value:item.value ?? ''
  354. }))
  355. const titleName = childrenData?.[0]?.titleName || '';
  356. const value = childrenData?.[0]?.value ?? '';
  357. console.log(childrenData?.[0]?.value,value,1232323,value!=='')
  358. const prop = childrenData?.[0]?.prop;
  359. if(value!==''){//添加全部
  360. childrenList.unshift({
  361. text:titleName,
  362. value:''
  363. })
  364. }else{
  365. const defaultVal = childrenList?.[0]?.value ?? '';
  366. state.selectProp[prop] = defaultVal;
  367. }
  368. state.selectData[index + 1] = {
  369. prop:prop,
  370. list:childrenList
  371. }
  372. }else{
  373. state.selectData.splice(index + 1);//删除
  374. Object.keys(state.selectProp).forEach((key,i)=>{
  375. if(i >= index + 1){
  376. delete state.selectProp[key]
  377. }
  378. })
  379. }
  380. OnLoadData(true);
  381. }
  382. const checkTextOverflow = () => {
  383. nextTick(() => {
  384. const instance = getCurrentInstance();
  385. // 安全保护
  386. if (!instance || !instance.proxy) {
  387. // 备用方案:全局查询(要求元素 class 唯一)
  388. let taskDescAllHeight = 0,
  389. taskDescHeight = 0;
  390. const query = uni.createSelectorQuery();
  391. query.select('.task_desc_all').boundingClientRect((rect) => {
  392. taskDescAllHeight = rect?.height || 0;
  393. });
  394. query.select('.task_desc').boundingClientRect((rect) => {
  395. taskDescHeight = rect?.height || 0;
  396. });
  397. query.select('.page_content_data').boundingClientRect((rect) => {
  398. state.searchBoxTop = rect?.top || 0;
  399. });
  400. query.exec(() => {
  401. // 所有回调执行完毕后触发
  402. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  403. });
  404. return;
  405. }
  406. let taskDescAllHeight = 0,
  407. taskDescHeight = 0;
  408. const query = uni.createSelectorQuery().in(instance.proxy);
  409. query.select('.task_desc_all').boundingClientRect((rect) => {
  410. taskDescAllHeight = rect?.height || 0;
  411. });
  412. query.select('.task_desc').boundingClientRect((rect) => {
  413. taskDescHeight = rect?.height || 0;
  414. });
  415. query.select('.page_content_data').boundingClientRect((rect) => {
  416. state.searchBoxTop = rect?.top || 0;
  417. });
  418. query.exec(() => {
  419. // 所有回调执行完毕后触发
  420. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  421. });
  422. });
  423. }
  424. // 展开收起切换
  425. const toggleExpand = () => {
  426. state.isExpand = !state.isExpand;
  427. nextTick(() => {
  428. const instance = getCurrentInstance();
  429. // 安全保护
  430. if (!instance || !instance.proxy) {
  431. // 备用方案:全局查询(要求元素 class 唯一)
  432. query.select('.page_content_data').boundingClientRect((rect) => {
  433. state.searchBoxTop = rect?.top || 0;
  434. });
  435. return;
  436. }
  437. query.select('.page_content_data').boundingClientRect((rect) => {
  438. state.searchBoxTop = rect?.top || 0;
  439. });
  440. });
  441. }
  442. //切换tab
  443. const SelectTabsValue = (val) => {
  444. state.tabsSelected = val;
  445. OnLoadData(true);
  446. }
  447. //搜索
  448. const HandleSearchInput = (val) => {
  449. state.searchWord = val;
  450. OnLoadData(true);
  451. }
  452. const ToSafeArr = (val) => {
  453. if (Array.isArray(val)) return val
  454. return val ? [val] : []
  455. }
  456. /*
  457. *详情
  458. * initPage:初始分页 从第一开始
  459. * initData:初始加载
  460. */
  461. const OnLoadData = (initPage,initData = false) => {
  462. state.isLoading = true;
  463. state.loadStatus = 'loading';
  464. if (initPage) {
  465. state.pageNum = 1; //如果是下拉刷新、重新查询 默认加载第一页
  466. getTaskTargetList({
  467. taskId: state.taskId,
  468. queryStr: state.searchWord,
  469. ...state.selectProp
  470. }).then(res => {
  471. if (res.code == 200) {
  472. const data = res?.data ?? {};
  473. // 列表全部数据
  474. state.notSubmitList = ToSafeArr(data.notSubmitList);//待提交
  475. state.notReviewList = ToSafeArr(data.notReviewList);//待审核
  476. const reviewData = ToSafeArr(data.reviewList);
  477. const submitData = ToSafeArr(data.submitList);
  478. state.reviewList = reviewData.length ? reviewData : submitData;//已审核
  479. state.reviewReasonList = ToSafeArr(data.reviewReasonList);//已驳回
  480. //处理分页-----
  481. const total = state[`${state.tabsSelected}List`]?.length || 0;
  482. state[`${state.tabsSelected}Pages`] = Math.ceil(total / state.pageSize);//总页数
  483. //默认加载
  484. state.tabListData = state?.[`${state.tabsSelected}List`]?.slice(0, state.pageSize) || [];
  485. //没有更多了
  486. state.noMoreData = state.pageNum == state[`${state.tabsSelected}Pages`];
  487. //分页+1
  488. state.pageNum++;
  489. state.isLoading = false;
  490. state.isRefreshing = false;//下拉刷新未被触发
  491. state.loadStatus = state.noMoreData?'no-more':'more';
  492. if(initData){
  493. checkTextOverflow();
  494. }
  495. }
  496. }).finally(() => {
  497. //返回到页面顶部
  498. if (initPage) {
  499. GoTop();
  500. }
  501. })
  502. }else{
  503. const start = (state.pageNum - 1) * state.pageSize;
  504. const end = start + state.pageSize;
  505. const list = state?.[`${state.tabsSelected}List`]?.slice(start, end) || [];
  506. state.tabListData = [...state.tabListData, ...list];
  507. state.noMoreData = state.pageNum == state[`${state.tabsSelected}Pages`];
  508. state.pageNum++;
  509. setTimeout(() => {
  510. state.isLoading = false;
  511. state.isRefreshing = false; //下拉刷新未被触发
  512. state.loadStatus = state.noMoreData?'no-more':'more';
  513. }, 0)
  514. }
  515. }
  516. // 自定义下拉刷新被触发 下拉刷新
  517. const OnRefresh = () => {
  518. state.isRefreshing = true; //下拉刷新已经被触发
  519. OnLoadData(true);
  520. }
  521. //滚动到底部/右边 触发上拉刷新
  522. const OnLoadMore = () => {
  523. if (state.isLoading || state.noMoreData) return;
  524. OnLoadData(false);
  525. }
  526. // 滚动时触发
  527. const OnScroll = (e) => {
  528. const scrollTop = e.detail.scrollTop;
  529. if(scrollTop > state.searchBoxTop){
  530. state.isSticky = true;
  531. }else{
  532. state.isSticky = false;
  533. }
  534. state.oldScrollTop = scrollTop;
  535. }
  536. //打开预览弹框
  537. const OpenPreviewFileDialog = (files) => {
  538. const fileList = files || [];
  539. state.fileDialog.fileList = fileList;
  540. const len = fileList?.length;
  541. if(len == 0){
  542. uni.showToast({ title: '暂无文件可查看!', icon: 'none' });
  543. }else if(len == 1){
  544. OpenPreviewPopup(fileList[0]);
  545. }else{
  546. popupFileDialogRef.value.OpenDialog();
  547. }
  548. }
  549. const ViewFile = (item) => {
  550. OpenPreviewPopup(item);
  551. }
  552. //文件预览
  553. const OpenPreviewPopup = (item) => {
  554. const fileType = getFileTypeBySuffix(item.fileType);
  555. state.previewPopup.fileType = fileType?fileType:item.fileType;
  556. state.previewPopup.filePath = item.filePath;
  557. state.previewPopup.fileName = item.fileName;
  558. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  559. // #ifdef H5
  560. nextTick(()=>{//h5文件预览
  561. webPreviewFile.value && webPreviewFile.value.preview({
  562. url: item.filePath,
  563. type: fileType
  564. });
  565. })
  566. // #endif
  567. // #ifdef APP-PLUS
  568. if(fileType == 'pptx'){
  569. imgVideoPreview.value.OpenDialog();
  570. }
  571. // #endif
  572. }else{
  573. imgVideoPreview.value.OpenDialog();
  574. }
  575. }
  576. //下载
  577. const ToDownloadFile = (item) => {
  578. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  579. let type = '';
  580. if(fileType == 'image'){
  581. type = '1';//1:图片 2 文档
  582. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  583. type = '2';
  584. }else{
  585. type = '';
  586. }
  587. ssdownload?.value?.toDownload({
  588. type:type,
  589. src:item.filePath,
  590. fileName:item.fileName
  591. });
  592. }
  593. //返回到顶部
  594. const GoTop = () => {
  595. // 解决view层不同步的问题
  596. state.scrollTop = state.oldScrollTop;
  597. nextTick(() => {
  598. state.scrollTop = 0
  599. });
  600. }
  601. //返回
  602. const GoBack = () => {
  603. uni.navigateBack({
  604. delta: 1
  605. });
  606. }
  607. </script>
  608. <style scoped lang="scss">
  609. .page_body{
  610. display: flex;
  611. flex-direction: column;
  612. height: 100%;
  613. min-height: auto;
  614. .scroll_view_box{
  615. width: 100%;
  616. display: flex;
  617. flex-direction: column;
  618. // height: calc(100% - 96rpx);
  619. }
  620. .scroll_view_y {
  621. height: 100%;
  622. .refresh_loading {
  623. padding: 10rpx 0;
  624. }
  625. }
  626. }
  627. .page_content {
  628. &.padding_btm {
  629. padding-bottom: 24rpx;
  630. .task_title {
  631. font-weight: 500;
  632. font-size: 32rpx;
  633. color: #333333;
  634. margin-top: 24rpx;
  635. }
  636. .task_class_collect {
  637. display: inline-flex;
  638. align-items: center;
  639. flex-wrap: wrap;
  640. width: 100%;
  641. margin-top: 16rpx;
  642. gap: 16rpx;
  643. .class_item {
  644. font-weight: 400;
  645. font-size: 24rpx;
  646. color: #999999;
  647. }
  648. }
  649. .task_time {
  650. display: flex;
  651. align-items: flex-start;
  652. width: 100%;
  653. margin-top: 16rpx;
  654. .time_day {
  655. display: inline-flex;
  656. align-items: center;
  657. flex-wrap: wrap;
  658. flex: 1;
  659. .time_item {
  660. font-weight: 400;
  661. font-size: 24rpx;
  662. line-height: 48rpx;
  663. color: #999999;
  664. &:nth-child(2) {
  665. margin: 0 8rpx;
  666. }
  667. &:nth-child(4) {
  668. color: #2E64FA;
  669. margin-left: 16rpx;
  670. }
  671. }
  672. }
  673. .task_status {
  674. display: inline-flex;
  675. align-items: center;
  676. height: 48rpx;
  677. padding: 0 12rpx;
  678. border-radius: 8rpx;
  679. font-weight: 400;
  680. font-size: 24rpx;
  681. &.status_pending {
  682. background: rgba(46, 100, 250, 0.1);
  683. color: #2E64FA;
  684. }
  685. &.status_published {
  686. background: rgba(82, 196, 26, 0.1);
  687. color: #2BC644;
  688. }
  689. &.status_closed {
  690. background: #6666661a;
  691. color: #666666;
  692. }
  693. }
  694. }
  695. .task_desc {
  696. margin-top: 24rpx;
  697. display: flex;
  698. width: 100%;
  699. padding-top: 24rpx;
  700. border-top: 2rpx solid #F3F3F3;
  701. font-weight: 400;
  702. font-size: 28rpx;
  703. color: #999999;
  704. line-height: 44rpx;
  705. box-sizing: border-box;
  706. position: relative;
  707. &.over {
  708. max-height: 168rpx;
  709. overflow: hidden;
  710. transition: all 0.25s;
  711. display: -webkit-box;
  712. -webkit-line-clamp: 3;
  713. -webkit-box-orient: vertical;
  714. }
  715. }
  716. .task_desc_all {
  717. display: flex;
  718. width: 100%;
  719. padding-top: 24rpx;
  720. border-top: 2rpx solid #F3F3F3;
  721. font-weight: 400;
  722. font-size: 28rpx;
  723. color: #999999;
  724. line-height: 44rpx;
  725. box-sizing: border-box;
  726. position: absolute;
  727. left: -9999px;
  728. top: 0;
  729. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  730. pointer-events: none;
  731. }
  732. .expand_btn {
  733. width: 100%;
  734. height: 40rpx;
  735. background-color: #FFFFFF;
  736. display: flex;
  737. justify-content: flex-end;
  738. align-items: center;
  739. .expand_text {
  740. font-weight: 400;
  741. font-size: 28rpx;
  742. color: #2E64FA;
  743. margin-right: 8rpx;
  744. }
  745. .expand_icon {
  746. font-size: 32rpx !important;
  747. color: #2E64FA !important;
  748. }
  749. }
  750. }
  751. }
  752. .row_gap {
  753. background-color: #F8F9FD;
  754. width: 100%;
  755. height: 24rpx;
  756. }
  757. :deep(.search_tabs){
  758. display: flex;
  759. width: 100%;
  760. flex-direction: column;
  761. background-color: #FFFFFF;
  762. .search_box {
  763. display: flex;
  764. align-items: center;
  765. box-sizing: border-box;
  766. width: 100%;
  767. padding: 24rpx;
  768. box-sizing: border-box;
  769. background-color: #FFFFFF;
  770. .is-input-border {
  771. border-radius: 8rpx;
  772. border: 2rpx solid #DCDFE6;
  773. border-color: #DCDFE6 !important;
  774. }
  775. .search_icon {
  776. width: 32rpx;
  777. height: 32rpx;
  778. margin-left: 24rpx;
  779. }
  780. .uni-easyinput__content-input {
  781. padding-left: 8rpx !important;
  782. font-size: 28rpx;
  783. color: #333333;
  784. height: 72rpx;
  785. }
  786. }
  787. }
  788. .scroll_select{
  789. width: 100%;
  790. display: flex;
  791. padding: 0 24rpx 24rpx;
  792. box-sizing: border-box;
  793. gap: 32rpx;
  794. :deep(.uni-stat__select){
  795. flex: 1;
  796. max-width: calc((100% - 32rpx * 2) / 3);
  797. min-width: 212rpx;
  798. width: auto;
  799. .uni-select{
  800. height: 72rpx;
  801. border-radius: 8rpx;
  802. border: 2rpx solid #DCDFE6;
  803. font-weight: 400;
  804. font-size: 28rpx;
  805. color: #333333;
  806. .uni-select__input-box{
  807. height: 72rpx;
  808. }
  809. .uni-icons{
  810. color: #909399;
  811. font-size: 24rpx;
  812. }
  813. }
  814. }
  815. }
  816. .scroll_tabs {
  817. margin-top:0;
  818. background-color: #FFFFFF;
  819. }
  820. .total {
  821. width: 100%;
  822. display: flex;
  823. font-weight: 400;
  824. font-size: 28rpx;
  825. color: #333333;
  826. padding: 24rpx 0;
  827. border-bottom: 2rpx solid #F3F3F3;
  828. }
  829. .list_item {
  830. display: flex;
  831. flex-direction: column;
  832. width: 100%;
  833. padding: 24rpx 0;
  834. border-bottom: 2rpx solid #F3F3F3;
  835. .item_name_file{
  836. display: flex;
  837. width: 100%;
  838. align-items: center;
  839. gap: 20rpx;
  840. .name_file{
  841. flex:1;
  842. gap: 20rpx;
  843. display: flex;
  844. align-items: center;
  845. .name{
  846. font-weight: 500;
  847. font-size: 32rpx;
  848. color: #333333;
  849. }
  850. .file_num{
  851. font-weight: 400;
  852. font-size: 24rpx;
  853. color: #2E64FA;
  854. }
  855. }
  856. :deep(.container){
  857. width: auto;
  858. .file_content{
  859. width: auto;
  860. }
  861. }
  862. .btn{
  863. width: 104rpx;
  864. height: 64rpx;
  865. border-radius: 8rpx;
  866. border: 2rpx solid #2E64FA;
  867. font-weight: 400;
  868. font-size: 28rpx;
  869. color: #2E64FA;
  870. display: inline-flex;
  871. align-items: center;
  872. justify-content: center;
  873. }
  874. }
  875. .item_info{
  876. margin-top: 16rpx;
  877. display: flex;
  878. gap: 16rpx;
  879. align-items: center;
  880. flex-wrap: wrap;
  881. .info_text{
  882. font-weight: 400;
  883. font-size: 24rpx;
  884. color: #999999;
  885. flex-shrink: 0;
  886. }
  887. }
  888. }
  889. .no_data{
  890. margin-top: 24rpx;
  891. }
  892. .file_preview{
  893. :deep(.dialog_content){
  894. padding: 24rpx 0 32rpx;
  895. }
  896. .dialog_content_file{
  897. display: flex;
  898. width: 100%;
  899. max-height: 440rpx;
  900. padding: 0 24rpx;
  901. box-sizing: border-box;
  902. overflow-y: auto;
  903. flex-direction: column;
  904. .file_list_item {
  905. display: flex;
  906. align-items: center;
  907. width: 100%;
  908. padding: 20rpx 24rpx;
  909. background: #FFFFFF;
  910. border-radius: 20rpx;
  911. border: 2rpx solid #EBEEF5;
  912. box-sizing: border-box;
  913. margin-top: 40rpx;
  914. &:nth-child(1){
  915. margin-top: 0;
  916. }
  917. gap:20rpx;
  918. .file_icon{
  919. flex-shrink: 0;
  920. width: 80rpx;
  921. height: 80rpx;
  922. }
  923. .file_info{
  924. flex:1;
  925. display: flex;
  926. flex-direction: column;
  927. overflow: hidden;
  928. .file_name{
  929. width: 100%;
  930. font-weight: 500;
  931. font-size: 28rpx;
  932. color: #333333;
  933. overflow: hidden;
  934. white-space: nowrap;
  935. text-overflow: ellipsis;
  936. }
  937. .file_size{
  938. display: flex;
  939. width: 100%;
  940. gap: 20rpx;
  941. font-weight: 400;
  942. font-size: 24rpx;
  943. color: #999999;
  944. margin-top: 8rpx;
  945. }
  946. }
  947. .file_btn{
  948. flex-shrink: 0;
  949. display: flex;
  950. gap:24rpx;
  951. font-weight: 400;
  952. font-size: 28rpx;
  953. .preview{
  954. color: #2E64FA;
  955. }
  956. }
  957. }
  958. }
  959. }
  960. </style>