taskDetail.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971
  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. const query = instance && instance.proxy
  386. ? uni.createSelectorQuery().in(instance.proxy)
  387. : uni.createSelectorQuery();
  388. query.select('.task_desc_all').boundingClientRect();
  389. query.select('.task_desc').boundingClientRect();
  390. query.select('.page_content_data').boundingClientRect();
  391. query.exec((res) => {
  392. const rectAll = res[0];
  393. const rectShort = res[1];
  394. const rectPageData = res[2];
  395. const taskDescAllHeight = rectAll?.height || 0;
  396. const taskDescHeight = rectShort?.height || 0;
  397. state.searchBoxTop = rectPageData?.top || 0;
  398. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  399. });
  400. });
  401. };
  402. // 展开收起切换
  403. const toggleExpand = () => {
  404. state.isExpand = !state.isExpand;
  405. nextTick(() => {
  406. const instance = getCurrentInstance();
  407. // 自动选择查询上下文,消除重复if‑else
  408. const query = instance && instance.proxy
  409. ? uni.createSelectorQuery().in(instance.proxy)
  410. : uni.createSelectorQuery();
  411. // 只注册查询,不在回调做赋值
  412. query.select('.page_content_data').boundingClientRect();
  413. // exec才真正执行查询,res[0]对应上面select的结果
  414. query.exec((res) => {
  415. const rect = res?.[0];
  416. state.searchBoxTop = rect?.top || 0;
  417. });
  418. });
  419. }
  420. //切换tab
  421. const SelectTabsValue = (val) => {
  422. state.tabsSelected = val;
  423. OnLoadData(true);
  424. }
  425. //搜索
  426. const HandleSearchInput = (val) => {
  427. state.searchWord = val;
  428. OnLoadData(true);
  429. }
  430. const ToSafeArr = (val) => {
  431. if (Array.isArray(val)) return val
  432. return val ? [val] : []
  433. }
  434. /*
  435. *详情
  436. * initPage:初始分页 从第一开始
  437. * initData:初始加载
  438. */
  439. const OnLoadData = (initPage,initData = false) => {
  440. state.isLoading = true;
  441. state.loadStatus = 'loading';
  442. if (initPage) {
  443. state.pageNum = 1; //如果是下拉刷新、重新查询 默认加载第一页
  444. getTaskTargetList({
  445. taskId: state.taskId,
  446. queryStr: state.searchWord,
  447. ...state.selectProp
  448. }).then(res => {
  449. if (res.code == 200) {
  450. const data = res?.data ?? {};
  451. // 列表全部数据
  452. state.notSubmitList = ToSafeArr(data.notSubmitList);//待提交
  453. state.notReviewList = ToSafeArr(data.notReviewList);//待审核
  454. const reviewData = ToSafeArr(data.reviewList);
  455. const submitData = ToSafeArr(data.submitList);
  456. state.reviewList = reviewData.length ? reviewData : submitData;//已审核
  457. state.reviewReasonList = ToSafeArr(data.reviewReasonList);//已驳回
  458. //处理分页-----
  459. const total = state[`${state.tabsSelected}List`]?.length || 0;
  460. state[`${state.tabsSelected}Pages`] = Math.ceil(total / state.pageSize);//总页数
  461. //默认加载
  462. state.tabListData = state?.[`${state.tabsSelected}List`]?.slice(0, state.pageSize) || [];
  463. //没有更多了
  464. state.noMoreData = state.pageNum == state[`${state.tabsSelected}Pages`];
  465. //分页+1
  466. state.pageNum++;
  467. state.isLoading = false;
  468. state.isRefreshing = false;//下拉刷新未被触发
  469. state.loadStatus = state.noMoreData?'no-more':'more';
  470. if(initData){
  471. checkTextOverflow();
  472. }
  473. }
  474. }).finally(() => {
  475. //返回到页面顶部
  476. if (initPage) {
  477. GoTop();
  478. }
  479. })
  480. }else{
  481. const start = (state.pageNum - 1) * state.pageSize;
  482. const end = start + state.pageSize;
  483. const list = state?.[`${state.tabsSelected}List`]?.slice(start, end) || [];
  484. state.tabListData = [...state.tabListData, ...list];
  485. state.noMoreData = state.pageNum == state[`${state.tabsSelected}Pages`];
  486. state.pageNum++;
  487. setTimeout(() => {
  488. state.isLoading = false;
  489. state.isRefreshing = false; //下拉刷新未被触发
  490. state.loadStatus = state.noMoreData?'no-more':'more';
  491. }, 0)
  492. }
  493. }
  494. // 自定义下拉刷新被触发 下拉刷新
  495. const OnRefresh = () => {
  496. state.isRefreshing = true; //下拉刷新已经被触发
  497. OnLoadData(true);
  498. }
  499. //滚动到底部/右边 触发上拉刷新
  500. const OnLoadMore = () => {
  501. if (state.isLoading || state.noMoreData) return;
  502. OnLoadData(false);
  503. }
  504. // 滚动时触发
  505. const OnScroll = (e) => {
  506. const scrollTop = e.detail.scrollTop;
  507. if(scrollTop > state.searchBoxTop){
  508. state.isSticky = true;
  509. }else{
  510. state.isSticky = false;
  511. }
  512. state.oldScrollTop = scrollTop;
  513. }
  514. //打开预览弹框
  515. const OpenPreviewFileDialog = (files) => {
  516. const fileList = files || [];
  517. state.fileDialog.fileList = fileList;
  518. const len = fileList?.length;
  519. if(len == 0){
  520. uni.showToast({ title: '暂无文件可查看!', icon: 'none' });
  521. }else if(len == 1){
  522. OpenPreviewPopup(fileList[0]);
  523. }else{
  524. popupFileDialogRef.value.OpenDialog();
  525. }
  526. }
  527. const ViewFile = (item) => {
  528. OpenPreviewPopup(item);
  529. }
  530. //文件预览
  531. const OpenPreviewPopup = (item) => {
  532. const fileType = getFileTypeBySuffix(item.fileType);
  533. state.previewPopup.fileType = fileType?fileType:item.fileType;
  534. state.previewPopup.filePath = item.filePath;
  535. state.previewPopup.fileName = item.fileName;
  536. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  537. // #ifdef H5
  538. nextTick(()=>{//h5文件预览
  539. webPreviewFile.value && webPreviewFile.value.preview({
  540. url: item.filePath,
  541. type: fileType
  542. });
  543. })
  544. // #endif
  545. // #ifdef APP-PLUS
  546. if(fileType == 'pptx'){
  547. imgVideoPreview.value.OpenDialog();
  548. }
  549. // #endif
  550. }else{
  551. imgVideoPreview.value.OpenDialog();
  552. }
  553. }
  554. //下载
  555. const ToDownloadFile = (item) => {
  556. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  557. let type = '';
  558. if(fileType == 'image'){
  559. type = '1';//1:图片 2 文档
  560. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  561. type = '2';
  562. }else{
  563. type = '';
  564. }
  565. ssdownload?.value?.toDownload({
  566. type:type,
  567. src:item.filePath,
  568. fileName:item.fileName
  569. });
  570. }
  571. //返回到顶部
  572. const GoTop = () => {
  573. // 解决view层不同步的问题
  574. state.scrollTop = state.oldScrollTop;
  575. nextTick(() => {
  576. state.scrollTop = 0
  577. });
  578. }
  579. //返回
  580. const GoBack = () => {
  581. uni.navigateBack({
  582. delta: 1
  583. });
  584. }
  585. </script>
  586. <style scoped lang="scss">
  587. .page_body{
  588. display: flex;
  589. flex-direction: column;
  590. height: 100%;
  591. min-height: auto;
  592. .scroll_view_box{
  593. width: 100%;
  594. display: flex;
  595. flex-direction: column;
  596. // height: calc(100% - 96rpx);
  597. }
  598. .scroll_view_y {
  599. height: 100%;
  600. .refresh_loading {
  601. padding: 10rpx 0;
  602. }
  603. }
  604. }
  605. .page_content {
  606. &.padding_btm {
  607. padding-bottom: 24rpx;
  608. .task_title {
  609. font-weight: 500;
  610. font-size: 32rpx;
  611. color: #333333;
  612. margin-top: 24rpx;
  613. }
  614. .task_class_collect {
  615. display: inline-flex;
  616. align-items: center;
  617. flex-wrap: wrap;
  618. width: 100%;
  619. margin-top: 16rpx;
  620. gap: 16rpx;
  621. .class_item {
  622. font-weight: 400;
  623. font-size: 24rpx;
  624. color: #999999;
  625. }
  626. }
  627. .task_time {
  628. display: flex;
  629. align-items: flex-start;
  630. width: 100%;
  631. margin-top: 16rpx;
  632. .time_day {
  633. display: inline-flex;
  634. align-items: center;
  635. flex-wrap: wrap;
  636. flex: 1;
  637. .time_item {
  638. font-weight: 400;
  639. font-size: 24rpx;
  640. line-height: 48rpx;
  641. color: #999999;
  642. &:nth-child(2) {
  643. margin: 0 8rpx;
  644. }
  645. &:nth-child(4) {
  646. color: #2E64FA;
  647. margin-left: 16rpx;
  648. }
  649. }
  650. }
  651. .task_status {
  652. display: inline-flex;
  653. align-items: center;
  654. height: 48rpx;
  655. padding: 0 12rpx;
  656. border-radius: 8rpx;
  657. font-weight: 400;
  658. font-size: 24rpx;
  659. &.status_pending {
  660. background: rgba(46, 100, 250, 0.1);
  661. color: #2E64FA;
  662. }
  663. &.status_published {
  664. background: rgba(82, 196, 26, 0.1);
  665. color: #2BC644;
  666. }
  667. &.status_closed {
  668. background: #6666661a;
  669. color: #666666;
  670. }
  671. }
  672. }
  673. .task_desc {
  674. margin-top: 24rpx;
  675. display: flex;
  676. width: 100%;
  677. padding-top: 24rpx;
  678. border-top: 2rpx solid #F3F3F3;
  679. font-weight: 400;
  680. font-size: 28rpx;
  681. color: #999999;
  682. line-height: 44rpx;
  683. box-sizing: border-box;
  684. position: relative;
  685. &.over {
  686. max-height: 168rpx;
  687. overflow: hidden;
  688. transition: all 0.25s;
  689. display: -webkit-box;
  690. -webkit-line-clamp: 3;
  691. -webkit-box-orient: vertical;
  692. }
  693. }
  694. .task_desc_all {
  695. display: flex;
  696. width: 100%;
  697. padding-top: 24rpx;
  698. border-top: 2rpx solid #F3F3F3;
  699. font-weight: 400;
  700. font-size: 28rpx;
  701. color: #999999;
  702. line-height: 44rpx;
  703. box-sizing: border-box;
  704. position: absolute;
  705. left: -9999px;
  706. top: 0;
  707. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  708. pointer-events: none;
  709. }
  710. .expand_btn {
  711. width: 100%;
  712. height: 40rpx;
  713. background-color: #FFFFFF;
  714. display: flex;
  715. justify-content: flex-end;
  716. align-items: center;
  717. .expand_text {
  718. font-weight: 400;
  719. font-size: 28rpx;
  720. color: #2E64FA;
  721. margin-right: 8rpx;
  722. }
  723. .expand_icon {
  724. font-size: 32rpx !important;
  725. color: #2E64FA !important;
  726. }
  727. }
  728. }
  729. }
  730. .row_gap {
  731. background-color: #F8F9FD;
  732. width: 100%;
  733. height: 24rpx;
  734. }
  735. :deep(.search_tabs){
  736. display: flex;
  737. width: 100%;
  738. flex-direction: column;
  739. background-color: #FFFFFF;
  740. .search_box {
  741. display: flex;
  742. align-items: center;
  743. box-sizing: border-box;
  744. width: 100%;
  745. padding: 24rpx;
  746. box-sizing: border-box;
  747. background-color: #FFFFFF;
  748. .is-input-border {
  749. border-radius: 8rpx;
  750. border: 2rpx solid #DCDFE6;
  751. border-color: #DCDFE6 !important;
  752. }
  753. .search_icon {
  754. width: 32rpx;
  755. height: 32rpx;
  756. margin-left: 24rpx;
  757. }
  758. .uni-easyinput__content-input {
  759. padding-left: 8rpx !important;
  760. font-size: 28rpx;
  761. color: #333333;
  762. height: 72rpx;
  763. }
  764. }
  765. }
  766. .scroll_select{
  767. width: 100%;
  768. display: flex;
  769. padding: 0 24rpx 24rpx;
  770. box-sizing: border-box;
  771. gap: 32rpx;
  772. :deep(.uni-stat__select){
  773. flex: 1;
  774. max-width: calc((100% - 32rpx * 2) / 3);
  775. min-width: 212rpx;
  776. width: auto;
  777. .uni-select{
  778. height: 72rpx;
  779. border-radius: 8rpx;
  780. border: 2rpx solid #DCDFE6;
  781. font-weight: 400;
  782. font-size: 28rpx;
  783. color: #333333;
  784. .uni-select__input-box{
  785. height: 72rpx;
  786. }
  787. .uni-icons{
  788. color: #909399;
  789. font-size: 24rpx;
  790. }
  791. }
  792. }
  793. }
  794. .scroll_tabs {
  795. margin-top:0;
  796. background-color: #FFFFFF;
  797. }
  798. .total {
  799. width: 100%;
  800. display: flex;
  801. font-weight: 400;
  802. font-size: 28rpx;
  803. color: #333333;
  804. padding: 24rpx 0;
  805. border-bottom: 2rpx solid #F3F3F3;
  806. }
  807. .list_item {
  808. display: flex;
  809. flex-direction: column;
  810. width: 100%;
  811. padding: 24rpx 0;
  812. border-bottom: 2rpx solid #F3F3F3;
  813. .item_name_file{
  814. display: flex;
  815. width: 100%;
  816. align-items: center;
  817. gap: 20rpx;
  818. .name_file{
  819. flex:1;
  820. gap: 20rpx;
  821. display: flex;
  822. align-items: center;
  823. .name{
  824. font-weight: 500;
  825. font-size: 32rpx;
  826. color: #333333;
  827. }
  828. .file_num{
  829. font-weight: 400;
  830. font-size: 24rpx;
  831. color: #2E64FA;
  832. }
  833. }
  834. :deep(.container){
  835. width: auto;
  836. .file_content{
  837. width: auto;
  838. }
  839. }
  840. .btn{
  841. width: 104rpx;
  842. height: 64rpx;
  843. border-radius: 8rpx;
  844. border: 2rpx solid #2E64FA;
  845. font-weight: 400;
  846. font-size: 28rpx;
  847. color: #2E64FA;
  848. display: inline-flex;
  849. align-items: center;
  850. justify-content: center;
  851. }
  852. }
  853. .item_info{
  854. margin-top: 16rpx;
  855. display: flex;
  856. gap: 16rpx;
  857. align-items: center;
  858. flex-wrap: wrap;
  859. .info_text{
  860. font-weight: 400;
  861. font-size: 24rpx;
  862. color: #999999;
  863. flex-shrink: 0;
  864. }
  865. }
  866. }
  867. .no_data{
  868. margin-top: 24rpx;
  869. }
  870. .file_preview{
  871. :deep(.dialog_content){
  872. padding: 24rpx 0 32rpx;
  873. }
  874. .dialog_content_file{
  875. display: flex;
  876. width: 100%;
  877. max-height: 440rpx;
  878. padding: 0 24rpx;
  879. box-sizing: border-box;
  880. overflow-y: auto;
  881. flex-direction: column;
  882. .file_list_item {
  883. display: flex;
  884. align-items: center;
  885. width: 100%;
  886. padding: 20rpx 24rpx;
  887. background: #FFFFFF;
  888. border-radius: 20rpx;
  889. border: 2rpx solid #EBEEF5;
  890. box-sizing: border-box;
  891. margin-top: 40rpx;
  892. &:nth-child(1){
  893. margin-top: 0;
  894. }
  895. gap:20rpx;
  896. .file_icon{
  897. flex-shrink: 0;
  898. width: 80rpx;
  899. height: 80rpx;
  900. }
  901. .file_info{
  902. flex:1;
  903. display: flex;
  904. flex-direction: column;
  905. overflow: hidden;
  906. .file_name{
  907. width: 100%;
  908. font-weight: 500;
  909. font-size: 28rpx;
  910. color: #333333;
  911. overflow: hidden;
  912. white-space: nowrap;
  913. text-overflow: ellipsis;
  914. }
  915. .file_size{
  916. display: flex;
  917. width: 100%;
  918. gap: 20rpx;
  919. font-weight: 400;
  920. font-size: 24rpx;
  921. color: #999999;
  922. margin-top: 8rpx;
  923. }
  924. }
  925. .file_btn{
  926. flex-shrink: 0;
  927. display: flex;
  928. gap:24rpx;
  929. font-weight: 400;
  930. font-size: 28rpx;
  931. .preview{
  932. color: #2E64FA;
  933. }
  934. }
  935. }
  936. }
  937. }
  938. </style>