submitDetail.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  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 @click="DeleteAllFiles" :class="['del',{'disabled':!state?.targetFileList?.taskTargetFileVos?.length}]">删除全部</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. const query = instance && instance.proxy
  391. ? uni.createSelectorQuery().in(instance.proxy)
  392. : uni.createSelectorQuery();
  393. query.select('.task_desc_all').boundingClientRect();
  394. query.select('.task_desc').boundingClientRect();
  395. query.exec((res) => {
  396. const rectAll = res[0];
  397. const rectShort = res[1];
  398. const taskDescAllHeight = rectAll?.height || 0;
  399. const taskDescHeight = rectShort?.height || 0;
  400. state.showExpandBtn = taskDescAllHeight > taskDescHeight + 1;
  401. });
  402. });
  403. }
  404. // 展开收起切换
  405. const toggleExpand = () => {
  406. state.isExpand = !state.isExpand;
  407. }
  408. //获取当前教师提交的文件列表
  409. const GetTaskTargetFileList = (init,type) => {
  410. getTaskTargetFileList(state.targetId).then(res=>{
  411. if(res.code == 200){
  412. state.targetFileList = res.data || {};
  413. //对比审核状态是否发生变化同时更新缓存数据
  414. if(!init){
  415. uni.setStorageSync('isLoadSubmitMaterialIndex',true);//返回是否重新更新提交材料首页
  416. updateCacheData(type);
  417. }
  418. }
  419. })
  420. }
  421. //单个删除
  422. const HandleDeleteFileList = (item) => {
  423. if(state?.targetFileList?.targetStatus === 2 || state?.targetFileList?.targetStatus === 4){
  424. return false
  425. }
  426. const { filePath, id } = item;
  427. state.confirmDialog = {
  428. type:'del',
  429. content:'是否删除当前文件?',
  430. fileUrls:[filePath],
  431. targetFileIds:[id]
  432. };
  433. popupConfirmDialogRef.value.OpenDialog();
  434. }
  435. //删除全部
  436. const DeleteAllFiles = () => {
  437. let fileUrls = [],targetFileIds = [];
  438. const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  439. if(taskTargetFileVos.length > 0){
  440. taskTargetFileVos.forEach(item => {
  441. fileUrls.push(item.filePath);
  442. targetFileIds.push(item.id)
  443. })
  444. state.confirmDialog = {
  445. type:'del',
  446. content:'是否删除全部当前文件?',
  447. fileUrls:fileUrls,
  448. targetFileIds:targetFileIds
  449. };
  450. popupConfirmDialogRef.value.OpenDialog();
  451. }
  452. }
  453. //提交
  454. const UpdateTaskTarget = () => {
  455. const taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  456. if(taskTargetFileVos.length == 0){
  457. uni.showToast({
  458. title: '请上传提交文件!',
  459. icon: 'none'
  460. });
  461. return false
  462. }
  463. state.confirmDialog = {
  464. type:'submit',
  465. content:'是否提交当前任务?',
  466. fileUrls:[],
  467. targetFileIds:[]
  468. };
  469. popupConfirmDialogRef.value.OpenDialog();
  470. }
  471. //重新提交
  472. const UpdateTaskTargetReset = () => {
  473. // 审核中/已提交重新编辑前必须先清空附件,避免旧文件和新文件混在一起
  474. if (state?.targetFileList?.taskTargetFileVos?.length > 0) {
  475. uni.showToast({
  476. title: '请删除全部在重新提交!',
  477. icon: 'none'
  478. });
  479. return
  480. }
  481. state.confirmDialog = {
  482. type:'submit',
  483. content:'是否重新编辑当前任务?',
  484. fileUrls:[],
  485. targetFileIds:[]
  486. };
  487. popupConfirmDialogRef.value.OpenDialog();
  488. }
  489. //确定删除 确定提交
  490. const DialogConfirm = () => {
  491. if(state.confirmDialog.type == 'del'){//单个删除 批量删除
  492. DelFileList();
  493. }else if(state.confirmDialog.type == 'submit') {//提交
  494. submitTaskTarget();
  495. }
  496. }
  497. const DelFileList = async() => {
  498. const res = await DeleteFileList({ fileUrls: state.confirmDialog.fileUrls })
  499. if (res.code !== 200) {
  500. uni.showToast({
  501. title: res.msg,
  502. icon: 'none'
  503. });
  504. return false
  505. }
  506. const resData = await DelTaskTargetFileList({
  507. targetId: state.targetId,
  508. targetFileIds: state.confirmDialog.targetFileIds
  509. })
  510. if (resData.code === 200) {
  511. uni.showToast({
  512. title: '删除成功!',
  513. icon: 'none'
  514. });
  515. GetTaskTargetFileList(false,'del');
  516. }
  517. }
  518. //提交
  519. const submitTaskTarget = () => {
  520. updateTaskTarget(state.targetId).then(res => {
  521. if (res.code === 200) {
  522. uni.showToast({
  523. title: '提交成功!',
  524. icon: 'none'
  525. });
  526. GetTaskTargetFileList(false,'submit');
  527. }
  528. })
  529. }
  530. //对比审核状态是否发生变化同时更新缓存数据
  531. const updateCacheData = (type) => {
  532. const targetStatus = state?.targetFileList?.targetStatus;
  533. let taskTargetList = state?.details?.taskTargetVos || [];
  534. if (state.auditStatus !== targetStatus) {
  535. // 状态变化,删除目标项
  536. taskTargetList.forEach(item=>{
  537. if(item.id == state.targetId){
  538. item.isShow = 1;//删除状态
  539. }
  540. })
  541. } else {
  542. // 状态未变且非提交(上传或删除)操作,更新文件列表
  543. if (type !== 'submit'){
  544. const targetItem = taskTargetList.find(item => item.id === state.targetId);
  545. if (targetItem) {
  546. targetItem.taskTargetFileVos = state?.targetFileList?.taskTargetFileVos || [];
  547. targetItem.fileNum = targetItem.taskTargetFileVos.length;
  548. }
  549. }else{
  550. taskTargetList.forEach(item=>{
  551. if(item.id == state.targetId){
  552. item.isShow = 0;//显示
  553. }
  554. })
  555. }
  556. }
  557. // 关键:将结果写回 state
  558. if (state?.details) {
  559. state.details.taskTargetVos = taskTargetList;
  560. uni.setStorageSync('submitMaterialDetailInfo',state.details);
  561. uni.setStorageSync('isLoadSubmitMaterialTaskDetail',true);//返回是否重新更新任务详情数据
  562. }
  563. }
  564. //返回
  565. const GoBack = () => {
  566. uni.navigateBack({
  567. delta: 1
  568. });
  569. }
  570. </script>
  571. <style scoped lang="scss">
  572. .page_body{
  573. height: 100%;
  574. display: flex;
  575. flex-direction: column;
  576. min-height: auto;
  577. }
  578. .page_content_height{
  579. display: flex;
  580. flex-direction: column;
  581. width: 100%;
  582. // height: calc(100% - 240rpx);
  583. flex:1;
  584. overflow: auto;
  585. }
  586. .page_content {
  587. &.padding_btm {
  588. padding-bottom: 24rpx;
  589. .task_title {
  590. font-weight: 500;
  591. font-size: 32rpx;
  592. color: #333333;
  593. margin-top: 24rpx;
  594. }
  595. .task_class_collect {
  596. display: inline-flex;
  597. align-items: center;
  598. flex-wrap: wrap;
  599. width: 100%;
  600. margin-top: 16rpx;
  601. gap: 16rpx;
  602. .class_item {
  603. font-weight: 400;
  604. font-size: 24rpx;
  605. color: #999999;
  606. }
  607. }
  608. .task_time {
  609. display: flex;
  610. align-items: flex-start;
  611. width: 100%;
  612. margin-top: 16rpx;
  613. .time_day {
  614. display: inline-flex;
  615. align-items: center;
  616. flex-wrap: wrap;
  617. flex: 1;
  618. .time_item {
  619. font-weight: 400;
  620. font-size: 24rpx;
  621. line-height: 48rpx;
  622. color: #999999;
  623. &:nth-child(2) {
  624. margin: 0 8rpx;
  625. }
  626. &:nth-child(4) {
  627. color: #2E64FA;
  628. margin-left: 16rpx;
  629. }
  630. }
  631. }
  632. .task_status {
  633. display: inline-flex;
  634. align-items: center;
  635. height: 48rpx;
  636. padding: 0 12rpx;
  637. border-radius: 8rpx;
  638. font-weight: 400;
  639. font-size: 24rpx;
  640. &.status_pending {
  641. background: rgba(46, 100, 250, 0.1);
  642. color: #2E64FA;
  643. }
  644. &.status_published {
  645. background: rgba(82, 196, 26, 0.1);
  646. color: #2BC644;
  647. }
  648. &.status_closed {
  649. background: #6666661a;
  650. color: #666666;
  651. }
  652. }
  653. }
  654. .task_desc {
  655. margin-top: 24rpx;
  656. display: flex;
  657. width: 100%;
  658. padding-top: 24rpx;
  659. border-top: 2rpx solid #F3F3F3;
  660. font-weight: 400;
  661. font-size: 28rpx;
  662. color: #999999;
  663. line-height: 44rpx;
  664. box-sizing: border-box;
  665. position: relative;
  666. &.over {
  667. max-height: 168rpx;
  668. overflow: hidden;
  669. transition: all 0.25s;
  670. display: -webkit-box;
  671. -webkit-line-clamp: 3;
  672. -webkit-box-orient: vertical;
  673. }
  674. }
  675. .task_desc_all {
  676. display: flex;
  677. width: 100%;
  678. padding-top: 24rpx;
  679. border-top: 2rpx solid #F3F3F3;
  680. font-weight: 400;
  681. font-size: 28rpx;
  682. color: #999999;
  683. line-height: 44rpx;
  684. box-sizing: border-box;
  685. position: absolute;
  686. left: -9999px;
  687. top: 0;
  688. visibility: hidden; // 不可见但占据空间(不影响布局,因为absolute)
  689. pointer-events: none;
  690. }
  691. .expand_btn {
  692. width: 100%;
  693. height: 40rpx;
  694. background-color: #FFFFFF;
  695. display: flex;
  696. justify-content: flex-end;
  697. align-items: center;
  698. .expand_text {
  699. font-weight: 400;
  700. font-size: 28rpx;
  701. color: #2E64FA;
  702. margin-right: 8rpx;
  703. }
  704. .expand_icon {
  705. font-size: 32rpx !important;
  706. color: #2E64FA !important;
  707. }
  708. }
  709. }
  710. }
  711. .row_gap {
  712. background-color: #F8F9FD;
  713. width: 100%;
  714. height: 24rpx;
  715. }
  716. .target_status {
  717. width: 100%;
  718. display: flex;
  719. align-items: center;
  720. padding: 24rpx 0;
  721. border-bottom: 2rpx solid #F3F3F3;
  722. .target_tag{
  723. flex: 1;
  724. font-weight: 500;
  725. font-size: 32rpx;
  726. color: #333333;
  727. .info_text{
  728. flex-shrink: 0;
  729. margin-right: 12rpx;
  730. }
  731. }
  732. .status_tag{
  733. font-size: 24rpx;
  734. text-align: center;
  735. padding: 8rpx 12rpx;
  736. font-weight: 400;
  737. border-radius: 8rpx;
  738. flex-shrink: 0;
  739. &.notSubmitList {
  740. background: rgba(46,100,250,0.1);
  741. color: #2E64FA;
  742. }
  743. &.notReviewList {
  744. background: rgba(251,159,52,0.1);
  745. color: #FB9F34;
  746. }
  747. &.reviewReasonList {
  748. background: rgba(245,108,108,0.1);
  749. color: #F56C6C;
  750. }
  751. &.reviewList {
  752. background: rgba(43,198,68,0.1);
  753. color: #2BC644;
  754. }
  755. }
  756. }
  757. .upload_box{
  758. margin-top: 24rpx;
  759. width: 100%;
  760. background-color: #FAFBFF;
  761. border-radius: 20rpx;
  762. border: 2rpx dashed #CCCED4;
  763. display: flex;
  764. box-sizing: border-box;
  765. align-items: center;
  766. padding: 22rpx 0 22rpx 40rpx;
  767. .upload_icon{
  768. width: 64rpx;
  769. height: 64rpx;
  770. margin-right: 24rpx;
  771. flex-shrink: 0;
  772. }
  773. .upload_text{
  774. flex:1;
  775. display: flex;
  776. flex-direction: column;
  777. .upload_title{
  778. font-weight: 400;
  779. font-size: 28rpx;
  780. color: #666666;
  781. }
  782. .upload_desc{
  783. margin-top: 8rpx;
  784. font-weight: 400;
  785. font-size: 20rpx;
  786. color: #CCCED4;
  787. }
  788. }
  789. }
  790. .list_item {
  791. display: flex;
  792. align-items: center;
  793. width: 100%;
  794. padding: 20rpx 24rpx;
  795. background: #FFFFFF;
  796. border-radius: 20rpx;
  797. border: 2rpx solid #EBEEF5;
  798. box-sizing: border-box;
  799. margin-top: 24rpx;
  800. gap:20rpx;
  801. .file_icon{
  802. flex-shrink: 0;
  803. width: 80rpx;
  804. height: 80rpx;
  805. }
  806. .file_info{
  807. flex:1;
  808. display: flex;
  809. flex-direction: column;
  810. overflow: hidden;
  811. .file_name{
  812. width: 100%;
  813. font-weight: 500;
  814. font-size: 28rpx;
  815. color: #333333;
  816. overflow: hidden;
  817. white-space: nowrap;
  818. text-overflow: ellipsis;
  819. }
  820. .file_size{
  821. display: flex;
  822. width: 100%;
  823. gap: 20rpx;
  824. font-weight: 400;
  825. font-size: 24rpx;
  826. color: #999999;
  827. margin-top: 8rpx;
  828. }
  829. }
  830. .file_btn{
  831. flex-shrink: 0;
  832. display: flex;
  833. gap:24rpx;
  834. font-weight: 400;
  835. font-size: 28rpx;
  836. .del{
  837. color: #F56C6C;
  838. &.disabled{
  839. color: #C0C4CC;
  840. }
  841. }
  842. .download{
  843. color: #2E64FA;
  844. }
  845. }
  846. }
  847. .page_foot{
  848. // position: fixed;
  849. // display: flex;
  850. // align-items: center;
  851. // left: 0;
  852. // right: 0;
  853. // bottom: 0;
  854. display: flex;
  855. align-items: center;
  856. width: 100%;
  857. padding: 0 24rpx;
  858. box-sizing: border-box;
  859. height: 130rpx;
  860. background-color: #FFFFFF;
  861. gap: 32rpx;
  862. .del{
  863. display: flex;
  864. align-items: center;
  865. justify-content: center;
  866. width: 240rpx;
  867. height: 90rpx;
  868. box-sizing: border-box;
  869. border-radius: 8rpx;
  870. border: 2rpx solid #F56C6C;
  871. font-weight: 400;
  872. font-size: 28rpx;
  873. color: #F56C6C;
  874. &.disabled{
  875. color: #C0C4CC;
  876. border: 2rpx solid #C0C4CC;
  877. }
  878. }
  879. .submit {
  880. flex:1;
  881. height: 90rpx;
  882. background-color: #2E64FA;
  883. border-radius: 8rpx;
  884. display: flex;
  885. justify-content: center;
  886. align-items: center;
  887. font-weight: 500;
  888. font-size: 28rpx;
  889. color: #FFFFFF;
  890. &.disabled{
  891. background-color: #C0C4CC;
  892. }
  893. }
  894. }
  895. </style>