taskDetail.vue 29 KB

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