submitDetail.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="96" title="提交材料" :onlyTitle="true" :showHeaderborder="true" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content_height">
  6. <view class="page_content padding_btm">
  7. <view class="task_title">{{state?.details?.taskName}}</view>
  8. <view class="task_class_collect">
  9. <text class="class_item">{{state?.details?.departmentName}}</text>
  10. <text class="class_item">{{state?.details?.materialCategoryName}}</text>
  11. <text class="class_item">{{state?.details?.createdBy}}</text>
  12. </view>
  13. <view class="task_time">
  14. <view class="time_day">
  15. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.startTime)}}</text>
  16. <text class="time_item">至</text>
  17. <text class="time_item">{{formatTimeWithoutSeconds(state?.details?.endTime)}}</text>
  18. <text class="time_item" v-if="state?.details?.taskStatus === 1 && remainingDays(state?.details?.endTime)">剩余{{remainingDays(state?.details?.endTime)}}</text>
  19. </view>
  20. <view :class="['task_status', statusClassMap[state?.details?.taskStatus]]">
  21. {{taskStatusMap[state?.details?.taskStatus]}}
  22. </view>
  23. </view>
  24. <view :class="['task_desc',{'over':!state.isExpand}]">
  25. 采集要求:{{state?.details?.collectionRequire}}
  26. </view>
  27. <view class="task_desc_all">
  28. 采集要求:{{state?.details?.collectionRequire}}
  29. </view>
  30. <view class="expand_btn" v-if="state.showExpandBtn" @click="toggleExpand"><text
  31. class="expand_text">{{!state.isExpand?'展开':'收起'}}</text><uni-icons class="expand_icon"
  32. :type="!state.isExpand?'down':'up'"></uni-icons></view>
  33. </view>
  34. <!-- 间隔 -->
  35. <view class="row_gap"></view>
  36. <view class="page_content">
  37. <view class="target_status">
  38. <view class="target_tag">
  39. <template v-for="text in ['departmentName','departmentGroupName','subjectName','gradeName','classTypeName','className']">
  40. <text class="info_text" v-if="state?.targetFileList?.[text]" :key="text">{{state?.targetFileList?.[text]}}</text>
  41. </template>
  42. </view>
  43. <template v-if="state?.details?.auditMechanism === 1">
  44. <view v-if="state?.targetFileList?.targetStatus=== 1" class="status_tag notSubmitList">
  45. <text>待提交</text>
  46. </view>
  47. <view v-if="state?.targetFileList?.targetStatus=== 3" class="status_tag reviewReasonList">
  48. <text>已驳回</text>
  49. </view>
  50. <view v-if="state?.targetFileList?.targetStatus=== 2" class="status_tag notReviewList">
  51. <text>审核中</text>
  52. </view>
  53. <view v-if="state?.targetFileList?.targetStatus=== 4" class="status_tag reviewList">
  54. <text>已提交</text>
  55. </view>
  56. </template>
  57. <template v-if="state?.details?.auditMechanism === 0">
  58. <view v-if="state?.targetFileList?.targetStatus=== 1" class="status_tag notSubmitList">
  59. <text>待提交</text>
  60. </view>
  61. <view v-else class="status_tag reviewList">
  62. <text>已提交</text>
  63. </view>
  64. </template>
  65. </view>
  66. <!-- 上传按钮 提交状态 1待提交 2审核中 3已驳回 4已提交 -->
  67. <!-- maxSize:单文件上限 MB;0 表示不限制 maxCount:列表最多文件数 -->
  68. <kex-file-uploader
  69. ref="fileUploader"
  70. v-model="files"
  71. mode="headless"
  72. :multiple="true"
  73. :auto-upload="true"
  74. :upload-url="`${apiBaseUrl}/api/v1/teach/oss/file/oss/upload_file_list`"
  75. :upload-options="{
  76. name: 'files',
  77. header: {
  78. Authorization: token
  79. },
  80. formData: {
  81. taskId:state.taskId,
  82. targetId:state.targetId
  83. },
  84. }"
  85. :max-count="20"
  86. :maxSize="100"
  87. formats="doc,docx,xls,xlsx,ppt,pptx,png,jpg,jpeg,gif,bmp"
  88. @uploadSuccess="onUploadSuccess">
  89. </kex-file-uploader>
  90. <view class="upload_box" @click="FileChooseUploader" v-if="state?.targetFileList?.targetStatus === 1 && state?.details?.taskStatus !== 2">
  91. <image class="upload_icon" src="@/static/image/icon/upload_icon.png"></image>
  92. <view class="upload_text">
  93. <view class="upload_title">点击上传文件</view>
  94. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  95. </view>
  96. </view>
  97. <view class="upload_box" v-if="(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4) && state?.details?.taskStatus !== 2">
  98. <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
  99. <view class="upload_text">
  100. <view class="upload_title">点击重新编辑可再提交</view>
  101. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  102. </view>
  103. </view>
  104. <view class="upload_box" v-if="state?.targetFileList?.targetStatus === 3 && state?.details?.taskStatus !== 2">
  105. <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
  106. <view class="upload_text">
  107. <view class="upload_title">请先删除全部文件,再提交调整后的合规材料</view>
  108. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  109. </view>
  110. </view>
  111. <view class="upload_box" v-if="state?.details?.taskStatus == 2">
  112. <image class="upload_icon" src="@/static/image/icon/upload_locked.png"></image>
  113. <view class="upload_text">
  114. <view class="upload_title">已结束不可再提交</view>
  115. <view class="upload_desc">支持Word、Excel、PPT、图片(最大100MB)</view>
  116. </view>
  117. </view>
  118. <view class="list_item" @click="OpenPreviewFile(item)" v-for="item in (state?.targetFileList?.taskTargetFileVos || [])" :Key="item.id">
  119. <!-- #ifdef APP-PLUS -->
  120. <!-- app端处理 -->
  121. <template v-if="['word','excel','pdf','txt'].includes(getFileTypeBySuffix(item.fileType))">
  122. <cjx-previewOffice :value="item.filePath" :name="item.fileName" :type="getFileTypeBySuffix(item.fileType)">
  123. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  124. <view class="file_info">
  125. <view class="file_name">{{item.fileName}}</view>
  126. <view class="file_size">
  127. <text>{{getFileSize(item.fileSize)}}</text>
  128. <text>{{ formatTimeWithoutSeconds(item.createTime) }}</text>
  129. </view>
  130. </view>
  131. <view class="file_btn">
  132. <text @click.stop="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
  133. <text class="download" @click.stop="ToDownloadFile(item)">下载</text>
  134. </view>
  135. </cjx-previewOffice>
  136. </template>
  137. <template v-else>
  138. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  139. <view class="file_info">
  140. <view class="file_name">{{item.fileName}}</view>
  141. <view class="file_size">
  142. <text>{{getFileSize(item.fileSize)}}</text>
  143. <text>{{ formatTimeWithoutSeconds(item.createTime) }}</text>
  144. </view>
  145. </view>
  146. <view class="file_btn">
  147. <text @click.stop="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
  148. <text class="download" @click.stop="ToDownloadFile(item)">下载</text>
  149. </view>
  150. </template>
  151. <!-- #endif -->
  152. <!-- #ifndef APP-PLUS -->
  153. <!-- 不包含app端 -->
  154. <image class="file_icon" src="@/static/image/icon/file.png"></image>
  155. <view class="file_info">
  156. <view class="file_name">{{item.fileName}}</view>
  157. <view class="file_size">
  158. <text>{{getFileSize(item.fileSize)}}</text>
  159. <text>{{ formatTimeWithoutSeconds(item.createTime) }}</text>
  160. </view>
  161. </view>
  162. <view class="file_btn">
  163. <text @click.stop="HandleDeleteFileList(item)" :class="['del',{'disabled':state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4}]">删除</text>
  164. <text class="download" @click.stop="ToDownloadFile(item)">下载</text>
  165. </view>
  166. <!-- #endif -->
  167. </view>
  168. </view>
  169. </view>
  170. <view class="page_foot" v-if="state?.details?.taskStatus!=2">
  171. <!-- 提交状态 1待提交 2审核中 3已驳回 4已提交 -->
  172. <template v-if="(state?.targetFileList?.targetStatus === 1 || state?.targetFileList?.targetStatus === 3)">
  173. <view @click="DeleteAllFiles" :class="['del',{'disabled':!state?.targetFileList?.taskTargetFileVos?.length}]">删除全部</view>
  174. <view :class="['submit',{'disabled':state?.targetFileList?.targetStatus === 3}]" @click="UpdateTaskTarget">提交</view>
  175. </template>
  176. <template v-else>
  177. <view class="del disabled">删除全部</view>
  178. <view class="submit" @click="UpdateTaskTargetReset">重新编辑</view>
  179. </template>
  180. </view>
  181. <!-- 删除确认框 -->
  182. <popupDialog ref="popupConfirmDialogRef" :showFootBorder="true" :content="state.confirmDialog.content" @DialogConfirm="DialogConfirm" />
  183. <!-- 图片 视频预览 -->
  184. <popupPreviewFile ref="imgVideoPreview" :fileType="state.previewPopup.fileType" :fileName="state.previewPopup.fileName" :filePath="state.previewPopup.filePath" @ToDownloadFile="ToDownloadFile"></popupPreviewFile>
  185. <!-- 默认指H5端 此插件只支持h5 PDF、Word、Excel、PPTX、TXT预览-->
  186. <!-- #ifdef H5 -->
  187. <wg-h5-preview-file ref="webPreviewFile" />
  188. <!-- #endif -->
  189. <!-- 文件、图片下载 -->
  190. <ss-download ref="ssdownload"></ss-download>
  191. </view>
  192. </template>
  193. <script setup>
  194. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  195. import ssDownload from '@/uni_modules/ss-download/components/ss-download/ss-download.vue';
  196. import popupDialog from '@/components/popupDialog.vue';
  197. import popupPreviewFile from '@/components/popupPreviewFile.vue';//图片 音视频 zip等预览
  198. // #ifdef H5
  199. import wgH5PreviewFile from '@/components/wg-h5-preview-file/wg-h5-preview-file.vue';//web端文件预览 'word','excel','pptx','pdf','txt'
  200. // #endif
  201. // #ifdef APP-PLUS
  202. import cjxPreviewOffice from '@/uni_modules/cjx-previewOffice/components/cjx-previewOffice/cjx-previewOffice.vue';//APP端文件预览 'word','excel','pdf','txt'
  203. // #endif
  204. import kexFileUploader from '@/uni_modules/kex-file-uploader/components/kex-file-uploader/kex-file-uploader.vue';
  205. import navBar from '@/components/navBar.vue';
  206. import { remainingDays,getFileSize,getFileTypeBySuffix,formatTimeWithoutSeconds } from '@/common/common.js';
  207. import {getTaskTargetFileList,DeleteFileList,DelTaskTargetFileList,updateTaskTarget,uploadTaskTargetFileList} from '@/reqApi/notification.js';
  208. import {onLoad} from '@dcloudio/uni-app';
  209. import config from '@/config.js'; // 引入配置文件
  210. import {
  211. reactive,
  212. ref,
  213. nextTick,
  214. getCurrentInstance,
  215. computed,
  216. onMounted
  217. } from 'vue';
  218. const state = reactive({
  219. taskId: '', //任务id
  220. targetId:'',//
  221. auditStatus:'',//审核状态
  222. showExpandBtn: false, //是否显示展开按钮
  223. isExpand: false, //是否展开
  224. details: {}, //详情信息
  225. targetFileList:{},
  226. confirmDialog:{
  227. type:'',
  228. content:'',
  229. fileUrls:[],
  230. targetFileIds:[]
  231. },
  232. previewPopup:{
  233. fileType:'',
  234. filePath:'',
  235. fileName:''
  236. }
  237. });
  238. const popupConfirmDialogRef = ref(null);
  239. const imgVideoPreview = ref(null);//图片 视频
  240. const webPreviewFile = ref(null);//web端文件预览
  241. const appPreviewOfficeRef = ref(null);//APP端文件预览
  242. const fileUploader = ref(null);
  243. const ssdownload = ref(null);//下载
  244. const files = ref([]);
  245. const token = ref(uni.getStorageSync('token'));
  246. const apiBaseUrl = ref('');
  247. const statusClassMap = {
  248. 1: 'status_published',
  249. 2: 'status_closed'
  250. };
  251. const taskStatusMap = {
  252. 1: '进行中',
  253. 2: '已结束'
  254. };
  255. onLoad((option) => {
  256. state.taskId = option.taskId;
  257. state.targetId = option.targetId;
  258. state.auditStatus = Number(option.auditStatus);
  259. })
  260. onMounted(() => {
  261. state.details = uni.getStorageSync('submitMaterialDetailInfo') || {};
  262. uni.removeStorageSync('isLoadSubmitMaterialTaskDetail');//返回是否重新更新任务详情数据
  263. uni.removeStorageSync('isLoadSubmitMaterialIndex');//返回是否重新更新提交材料首页
  264. getApiBaseUrl();//上传接口地址
  265. GetTaskTargetFileList(true);
  266. checkTextOverflow();
  267. });
  268. //上传接口地址
  269. const getApiBaseUrl = () => {
  270. if (process.env.NODE_ENV === 'development') {//本地开发环境
  271. const SYSTEM_INFO = uni.getSystemInfoSync();//获取系统信息的同步接口
  272. apiBaseUrl.value = SYSTEM_INFO.uniPlatform === 'web' ? config.proxyBaseUrl:config.apiBaseUrl;//读取配置文件的apiBaseUrl变量
  273. } else {//生产/测试环境
  274. apiBaseUrl.value = config.apiBaseUrl
  275. }
  276. }
  277. //选择文件上传
  278. const FileChooseUploader = () => {
  279. fileUploader.value && fileUploader.value.choose();
  280. }
  281. const onUploadSuccess = ({
  282. index,
  283. file, // 当前文件
  284. url, // 优先为解析出的远程地址
  285. statusCode,
  286. data, // 解析后的服务端 JSON(失败则为原始字符串)
  287. res, // 原始回调
  288. fileList // 当前全部
  289. }) => {
  290. console.log(res)
  291. const result = JSON.parse(res.data || res.result);
  292. const list = result?.data || [];
  293. const fileInfoList = list.map(item => ({
  294. ...item,
  295. filePath: item.fileUrl
  296. }))
  297. UploadTargetFileList(fileInfoList);
  298. }
  299. //具体采集任务保存上传的文件地址
  300. const UploadTargetFileList = (fileInfoList) => {
  301. uploadTaskTargetFileList({
  302. fileInfoList,
  303. taskId:state.taskId,
  304. targetId:state.targetId
  305. }).then(res=>{
  306. if (res.code === 200) {
  307. uni.showToast({
  308. title: '上传成功!',
  309. icon: 'none'
  310. });
  311. GetTaskTargetFileList(false,'upload');
  312. }
  313. })
  314. }
  315. //预览
  316. const OpenPreviewFile = (item) => {
  317. const fileType = getFileTypeBySuffix(item.fileType);
  318. state.previewPopup.fileType = fileType?fileType:item.fileType;
  319. state.previewPopup.filePath = item.filePath;
  320. state.previewPopup.fileName = item.fileName;
  321. if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  322. // #ifdef H5
  323. nextTick(()=>{//h5文件预览
  324. webPreviewFile.value && webPreviewFile.value.preview({
  325. url: item.filePath,
  326. type: fileType
  327. });
  328. })
  329. // #endif
  330. // #ifdef APP-PLUS
  331. if(fileType == 'pptx'){
  332. imgVideoPreview.value.OpenDialog();
  333. }
  334. // #endif
  335. }else{
  336. imgVideoPreview.value.OpenDialog();
  337. }
  338. // const fileType = item.fileType;
  339. // if(IsImageExts(fileType)){//图片预览
  340. // state.previewPopup.filePath = item.filePath;
  341. // imgVideoPreview.value.OpenDialog();
  342. // }else{//文件预览
  343. // // 1. 先下载文件到本地临时目录
  344. // uni.downloadFile({
  345. // url: item.filePath,
  346. // success: (downloadRes) => {
  347. // if (downloadRes.statusCode === 200) {
  348. // // 2. 下载成功后,得到临时文件路径 tempFilePath
  349. // const localPath = downloadRes.tempFilePath;
  350. // // 3. 构造 file 对象(必须有 path)
  351. // const fileObj = {
  352. // name: item.fileName,
  353. // path: localPath, // 关键字段
  354. // size: item.fileSize // 可选
  355. // };
  356. // // 4. 调用 kex-file-uploader 的 openDocument 方法预览
  357. // fileUploader.value?.openDocument({
  358. // file: fileObj,
  359. // success: () => console.log('预览成功'),
  360. // fail: (err) => console.error('预览失败', err)
  361. // });
  362. // }
  363. // },
  364. // fail: (err) => {
  365. // uni.showToast({ title: '文件下载失败', icon: 'none' });
  366. // }
  367. // });
  368. // }
  369. }
  370. //下载
  371. const ToDownloadFile = (item) => {
  372. const fileType = getFileTypeBySuffix(item.fileType);//文件类型
  373. let type = '';
  374. if(fileType == 'image'){
  375. type = '1';//1:图片 2 文档
  376. }else if(['word','excel','pptx','pdf','txt'].includes(fileType)){
  377. type = '2';
  378. }else{
  379. type = '';
  380. }
  381. ssdownload?.value?.toDownload({
  382. type:type,
  383. src:item.filePath,
  384. fileName:item.fileName
  385. });
  386. }
  387. const checkTextOverflow = () => {
  388. nextTick(() => {
  389. const instance = getCurrentInstance();
  390. // 安全保护
  391. if (!instance || !instance.proxy) {
  392. // 备用方案:全局查询(要求元素 class 唯一)
  393. let taskDescAllHeight = 0,
  394. taskDescHeight = 0;
  395. const query = uni.createSelectorQuery();
  396. query.select('.task_desc_all').boundingClientRect((rect) => {
  397. taskDescAllHeight = rect?.height || 0;
  398. });
  399. query.select('.task_desc').boundingClientRect((rect) => {
  400. taskDescHeight = rect?.height || 0;
  401. });
  402. query.exec(() => {
  403. // 所有回调执行完毕后触发
  404. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  405. });
  406. return;
  407. }
  408. let taskDescAllHeight = 0,
  409. taskDescHeight = 0;
  410. const query = uni.createSelectorQuery().in(instance.proxy);
  411. query.select('.task_desc_all').boundingClientRect((rect) => {
  412. taskDescAllHeight = rect?.height || 0;
  413. });
  414. query.select('.task_desc').boundingClientRect((rect) => {
  415. taskDescHeight = rect?.height || 0;
  416. });
  417. query.exec(() => {
  418. // 所有回调执行完毕后触发
  419. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  420. });
  421. });
  422. }
  423. // 展开收起切换
  424. const toggleExpand = () => {
  425. state.isExpand = !state.isExpand;
  426. }
  427. //获取当前教师提交的文件列表
  428. const GetTaskTargetFileList = (init,type) => {
  429. getTaskTargetFileList(state.targetId).then(res=>{
  430. if(res.code == 200){
  431. state.targetFileList = res.data || {};
  432. //对比审核状态是否发生变化同时更新缓存数据
  433. if(!init){
  434. uni.setStorageSync('isLoadSubmitMaterialIndex',true);//返回是否重新更新提交材料首页
  435. updateCacheData(type);
  436. }
  437. }
  438. })
  439. }
  440. //单个删除
  441. const HandleDeleteFileList = (item) => {
  442. if(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4){
  443. return false
  444. }
  445. const { filePath, id } = item;
  446. state.confirmDialog = {
  447. type:'del',
  448. content:'是否删除当前文件?',
  449. fileUrls:[filePath],
  450. targetFileIds:[id]
  451. };
  452. popupConfirmDialogRef.value.OpenDialog();
  453. }
  454. //删除全部
  455. const DeleteAllFiles = () => {
  456. let fileUrls = [],targetFileIds = [];
  457. const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  458. if(taskTargetFileVos.length > 0){
  459. taskTargetFileVos.forEach(item => {
  460. fileUrls.push(item.filePath);
  461. targetFileIds.push(item.id)
  462. })
  463. state.confirmDialog = {
  464. type:'del',
  465. content:'是否删除全部当前文件?',
  466. fileUrls:fileUrls,
  467. targetFileIds:targetFileIds
  468. };
  469. popupConfirmDialogRef.value.OpenDialog();
  470. }
  471. }
  472. //提交
  473. const UpdateTaskTarget = () => {
  474. const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  475. if(taskTargetFileVos.length == 0){
  476. uni.showToast({
  477. title: '请上传提交文件!',
  478. icon: 'none'
  479. });
  480. return false
  481. }
  482. state.confirmDialog = {
  483. type:'submit',
  484. content:'是否提交当前任务?',
  485. fileUrls:[],
  486. targetFileIds:[]
  487. };
  488. popupConfirmDialogRef.value.OpenDialog();
  489. }
  490. //重新提交
  491. const UpdateTaskTargetReset = () => {
  492. state.confirmDialog = {
  493. type:'submit',
  494. content:'是否重新编辑当前任务?',
  495. fileUrls:[],
  496. targetFileIds:[]
  497. };
  498. popupConfirmDialogRef.value.OpenDialog();
  499. }
  500. //确定删除 确定提交
  501. const DialogConfirm = () => {
  502. if(state.confirmDialog.type == 'del'){//单个删除 批量删除
  503. DelFileList();
  504. }else if(state.confirmDialog.type == 'submit') {//提交
  505. submitTaskTarget();
  506. }
  507. }
  508. const DelFileList = async() => {
  509. const res = await DeleteFileList({ fileUrls: state.confirmDialog.fileUrls })
  510. if (res.code !== 200) {
  511. uni.showToast({
  512. title: res.msg,
  513. icon: 'none'
  514. });
  515. return false
  516. }
  517. const resData = await DelTaskTargetFileList({
  518. targetId: state.targetId,
  519. targetFileIds: state.confirmDialog.targetFileIds
  520. })
  521. if (resData.code === 200) {
  522. uni.showToast({
  523. title: '删除成功!',
  524. icon: 'none'
  525. });
  526. GetTaskTargetFileList(false,'del');
  527. }
  528. }
  529. //提交
  530. const submitTaskTarget = () => {
  531. updateTaskTarget(state.targetId).then(res => {
  532. if (res.code === 200) {
  533. uni.showToast({
  534. title: '提交成功!',
  535. icon: 'none'
  536. });
  537. GetTaskTargetFileList(false,'submit');
  538. }
  539. })
  540. }
  541. //对比审核状态是否发生变化同时更新缓存数据
  542. const updateCacheData = (type) => {
  543. const targetStatus = state?.targetFileList?.targetStatus;
  544. let taskTargetList = state?.details?.taskTargetVos || [];
  545. if (state.auditStatus !== targetStatus) {
  546. // 状态变化,删除目标项
  547. taskTargetList.forEach(item=>{
  548. if(item.id == state.targetId){
  549. item.isShow = 1;//删除状态
  550. }
  551. })
  552. } else {
  553. // 状态未变且非提交(上传或删除)操作,更新文件列表
  554. if (type !== 'submit'){
  555. const targetItem = taskTargetList.find(item => item.id === state.targetId);
  556. if (targetItem) {
  557. targetItem.taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  558. targetItem.fileNum = targetItem.taskTargetFileVos.length;
  559. }
  560. }else{
  561. taskTargetList.forEach(item=>{
  562. if(item.id == state.targetId){
  563. item.isShow = 0;//显示
  564. }
  565. })
  566. }
  567. }
  568. // 关键:将结果写回 state
  569. if (state?.details) {
  570. state.details.taskTargetVos = taskTargetList;
  571. uni.setStorageSync('submitMaterialDetailInfo',state.details);
  572. uni.setStorageSync('isLoadSubmitMaterialTaskDetail',true);//返回是否重新更新任务详情数据
  573. }
  574. }
  575. //返回
  576. const GoBack = () => {
  577. uni.navigateBack({
  578. delta: 1
  579. });
  580. }
  581. </script>
  582. <style scoped lang="scss">
  583. .page_body{
  584. height: 100%;
  585. display: flex;
  586. flex-direction: column;
  587. min-height: auto;
  588. }
  589. .page_content_height{
  590. display: flex;
  591. flex-direction: column;
  592. width: 100%;
  593. // height: calc(100% - 240rpx);
  594. flex:1;
  595. overflow: auto;
  596. }
  597. .page_content {
  598. &.padding_btm {
  599. padding-bottom: 24rpx;
  600. .task_title {
  601. font-weight: 500;
  602. font-size: 32rpx;
  603. color: #333333;
  604. margin-top: 24rpx;
  605. }
  606. .task_class_collect {
  607. display: inline-flex;
  608. align-items: center;
  609. flex-wrap: wrap;
  610. width: 100%;
  611. margin-top: 16rpx;
  612. gap: 16rpx;
  613. .class_item {
  614. font-weight: 400;
  615. font-size: 24rpx;
  616. color: #999999;
  617. }
  618. }
  619. .task_time {
  620. display: flex;
  621. align-items: flex-start;
  622. width: 100%;
  623. margin-top: 16rpx;
  624. .time_day {
  625. display: inline-flex;
  626. align-items: center;
  627. flex-wrap: wrap;
  628. flex: 1;
  629. .time_item {
  630. font-weight: 400;
  631. font-size: 24rpx;
  632. line-height: 48rpx;
  633. color: #999999;
  634. &:nth-child(2) {
  635. margin: 0 8rpx;
  636. }
  637. &:nth-child(4) {
  638. color: #2E64FA;
  639. margin-left: 16rpx;
  640. }
  641. }
  642. }
  643. .task_status {
  644. display: inline-flex;
  645. align-items: center;
  646. height: 48rpx;
  647. padding: 0 12rpx;
  648. border-radius: 8rpx;
  649. font-weight: 400;
  650. font-size: 24rpx;
  651. &.status_pending {
  652. background: rgba(46, 100, 250, 0.1);
  653. color: #2E64FA;
  654. }
  655. &.status_published {
  656. background: rgba(82, 196, 26, 0.1);
  657. color: #2BC644;
  658. }
  659. &.status_closed {
  660. background: #6666661a;
  661. color: #666666;
  662. }
  663. }
  664. }
  665. .task_desc {
  666. margin-top: 24rpx;
  667. display: flex;
  668. width: 100%;
  669. padding-top: 24rpx;
  670. border-top: 2rpx solid #F3F3F3;
  671. font-weight: 400;
  672. font-size: 28rpx;
  673. color: #999999;
  674. line-height: 44rpx;
  675. box-sizing: border-box;
  676. position: relative;
  677. &.over {
  678. max-height: 168rpx;
  679. overflow: hidden;
  680. transition: all 0.25s;
  681. display: -webkit-box;
  682. -webkit-line-clamp: 3;
  683. -webkit-box-orient: vertical;
  684. }
  685. }
  686. .task_desc_all {
  687. display: flex;
  688. width: 100%;
  689. padding-top: 24rpx;
  690. border-top: 2rpx solid #F3F3F3;
  691. font-weight: 400;
  692. font-size: 28rpx;
  693. color: #999999;
  694. line-height: 44rpx;
  695. box-sizing: border-box;
  696. position: absolute;
  697. left: -9999px;
  698. top: 0;
  699. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  700. pointer-events: none;
  701. }
  702. .expand_btn {
  703. width: 100%;
  704. height: 40rpx;
  705. background-color: #FFFFFF;
  706. display: flex;
  707. justify-content: flex-end;
  708. align-items: center;
  709. .expand_text {
  710. font-weight: 400;
  711. font-size: 28rpx;
  712. color: #2E64FA;
  713. margin-right: 8rpx;
  714. }
  715. .expand_icon {
  716. font-size: 32rpx !important;
  717. color: #2E64FA !important;
  718. }
  719. }
  720. }
  721. }
  722. .row_gap {
  723. background-color: #F8F9FD;
  724. width: 100%;
  725. height: 24rpx;
  726. }
  727. .target_status {
  728. width: 100%;
  729. display: flex;
  730. align-items: center;
  731. padding: 24rpx 0;
  732. border-bottom: 2rpx solid #F3F3F3;
  733. .target_tag{
  734. flex: 1;
  735. font-weight: 500;
  736. font-size: 32rpx;
  737. color: #333333;
  738. .info_text{
  739. flex-shrink: 0;
  740. margin-right: 12rpx;
  741. }
  742. }
  743. .status_tag{
  744. font-size: 24rpx;
  745. text-align: center;
  746. padding: 8rpx 12rpx;
  747. font-weight: 400;
  748. border-radius: 8rpx;
  749. flex-shrink: 0;
  750. &.notSubmitList {
  751. background: rgba(46,100,250,0.1);
  752. color: #2E64FA;
  753. }
  754. &.notReviewList {
  755. background: rgba(251,159,52,0.1);
  756. color: #FB9F34;
  757. }
  758. &.reviewReasonList {
  759. background: rgba(245,108,108,0.1);
  760. color: #F56C6C;
  761. }
  762. &.reviewList {
  763. background: rgba(43,198,68,0.1);
  764. color: #2BC644;
  765. }
  766. }
  767. }
  768. .upload_box{
  769. margin-top: 24rpx;
  770. width: 100%;
  771. background-color: #FAFBFF;
  772. border-radius: 20rpx;
  773. border: 2rpx dashed #CCCED4;
  774. display: flex;
  775. box-sizing: border-box;
  776. align-items: center;
  777. padding: 22rpx 0 22rpx 40rpx;
  778. .upload_icon{
  779. width: 64rpx;
  780. height: 64rpx;
  781. margin-right: 24rpx;
  782. flex-shrink: 0;
  783. }
  784. .upload_text{
  785. flex:1;
  786. display: flex;
  787. flex-direction: column;
  788. .upload_title{
  789. font-weight: 400;
  790. font-size: 28rpx;
  791. color: #666666;
  792. }
  793. .upload_desc{
  794. margin-top: 8rpx;
  795. font-weight: 400;
  796. font-size: 20rpx;
  797. color: #CCCED4;
  798. }
  799. }
  800. }
  801. .list_item {
  802. display: flex;
  803. align-items: center;
  804. width: 100%;
  805. padding: 20rpx 24rpx;
  806. background: #FFFFFF;
  807. border-radius: 20rpx;
  808. border: 2rpx solid #EBEEF5;
  809. box-sizing: border-box;
  810. margin-top: 24rpx;
  811. gap:20rpx;
  812. .file_icon{
  813. flex-shrink: 0;
  814. width: 80rpx;
  815. height: 80rpx;
  816. }
  817. .file_info{
  818. flex:1;
  819. display: flex;
  820. flex-direction: column;
  821. overflow: hidden;
  822. .file_name{
  823. width: 100%;
  824. font-weight: 500;
  825. font-size: 28rpx;
  826. color: #333333;
  827. overflow: hidden;
  828. white-space: nowrap;
  829. text-overflow: ellipsis;
  830. }
  831. .file_size{
  832. display: flex;
  833. width: 100%;
  834. gap: 20rpx;
  835. font-weight: 400;
  836. font-size: 24rpx;
  837. color: #999999;
  838. margin-top: 8rpx;
  839. }
  840. }
  841. .file_btn{
  842. flex-shrink: 0;
  843. display: flex;
  844. gap:24rpx;
  845. font-weight: 400;
  846. font-size: 28rpx;
  847. .del{
  848. color: #F56C6C;
  849. &.disabled{
  850. color: #C0C4CC;
  851. }
  852. }
  853. .download{
  854. color: #2E64FA;
  855. }
  856. }
  857. }
  858. .page_foot{
  859. // position: fixed;
  860. // display: flex;
  861. // align-items: center;
  862. // left: 0;
  863. // right: 0;
  864. // bottom: 0;
  865. display: flex;
  866. align-items: center;
  867. width: 100%;
  868. padding: 0 24rpx;
  869. box-sizing: border-box;
  870. height: 130rpx;
  871. background-color: #FFFFFF;
  872. gap: 32rpx;
  873. .del{
  874. display: flex;
  875. align-items: center;
  876. justify-content: center;
  877. width: 240rpx;
  878. height: 90rpx;
  879. box-sizing: border-box;
  880. border-radius: 8rpx;
  881. border: 2rpx solid #F56C6C;
  882. font-weight: 400;
  883. font-size: 28rpx;
  884. color: #F56C6C;
  885. &.disabled{
  886. color: #C0C4CC;
  887. border: 2rpx solid #C0C4CC;
  888. }
  889. }
  890. .submit {
  891. flex:1;
  892. height: 90rpx;
  893. background-color: #2E64FA;
  894. border-radius: 8rpx;
  895. display: flex;
  896. justify-content: center;
  897. align-items: center;
  898. font-weight: 500;
  899. font-size: 28rpx;
  900. color: #FFFFFF;
  901. &.disabled{
  902. background-color: #C0C4CC;
  903. }
  904. }
  905. }
  906. </style>