auditResult.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <template>
  2. <view class="page_body">
  3. <!-- 头部 -->
  4. <nav-bar height="216" :title="state.pageTitle" :onlyTitle="false" :showHeadSearchInput="false" :showFilterPicker="false" :showTabs="false" :showTabBtns="true" :tabBtns="state.tabBtns" rightWidth="0rpx" @CommonFilterData="CommonFilterData" @GoBack="GoBack"></nav-bar>
  5. <view class="page_content">
  6. <template v-if="state.fileContent">
  7. <!-- 图片 -->
  8. <image v-if="state.fileContent.docType=='image'" class="img_width" :src="state.fileContent.filePath" mode="aspectFit"></image>
  9. <template v-else>
  10. <!-- #ifdef H5 -->
  11. <wg-h5-preview-file ref="webPreviewFile" :showCloseBtn="false" />
  12. <!-- #endif -->
  13. <!-- #ifdef APP-PLUS -->
  14. <template v-if="['word','excel','pdf'].includes(state.fileContent.docType)">
  15. <cjx-previewOffice ref="appPreviewOfficeRef" :value="state.fileContent.filePath" :type="state.fileContent.docType" :showCloseBtn="false" :showHeader="false" :closeOnClickModal="false"></cjx-previewOffice>
  16. </template>
  17. <view v-else class="other_file"><text>不支持预览,请点击下载: </text><text style="color: #2e64fa;font-size: 28rpx;" @click="ToDownloadFile">{{state.fileContent.fileName}}</text></view>
  18. <!-- #endif -->
  19. </template>
  20. </template>
  21. </view>
  22. <view class="page_foot">
  23. <button :class="['btn','btn_reject',{'disabled':state.taskStatus==2 || (state.taskStatus==1 && state.reviewStatus == 2)}]" type="primary" plain="true" :loading="state.loading" @click="HandleRejectHonor">驳回</button>
  24. <button :class="['btn','btn_pass',{'disabled':state.taskStatus==2 || (state.taskStatus==1 && state.reviewStatus == 1)}]" type="primary" :loading="state.loading" @click="HandlePassHonor">通过</button>
  25. </view>
  26. <customPopupDialog ref="popupDelDialogRef" title="驳回" dialogWidth="702" :isMaskClick="false" :showDialogClose="false" @DialogConfirm="DialogConfirm">
  27. <view class="dialog_content_input">
  28. <view class="dialog_desc">请填写驳回原因方便教师修改</view>
  29. <uni-easyinput type="textarea" v-model="state.rejectReason" :maxlength="200" :style="state.easyinputStyle" placeholderStyle="font-weight: 400;font-size: 28rpx;color: #999999;" placeholder="请输入驳回原因…"></uni-easyinput>
  30. </view>
  31. </customPopupDialog>
  32. <!-- 文件、图片下载 -->
  33. <ss-download ref="ssdownload"></ss-download>
  34. </view>
  35. </template>
  36. <script setup>
  37. import navBar from '@/components/navBar.vue';
  38. import uvUpload from '@/uni_modules/uv-upload/components/uv-upload/uv-upload.vue';
  39. import customPopupDialog from '@/components/customPopupDialog.vue';
  40. import uniEasyinput from '@/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue';
  41. // #ifdef H5
  42. import wgH5PreviewFile from '@/components/wg-h5-preview-file/wg-h5-preview-file.vue';//web端文件预览 'word','excel','pptx','pdf','txt'
  43. // #endif
  44. // #ifdef APP-PLUS
  45. import cjxPreviewOffice from '@/uni_modules/cjx-previewOffice/components/cjx-previewOffice/cjx-previewOffice.vue';//APP端文件预览 'word','excel','pdf','txt'
  46. // #endif
  47. import ssDownload from '@/uni_modules/ss-download/components/ss-download/ss-download.vue';
  48. import {updateReviewStatus,ChangeReviewStatus} from '@/reqApi/notification.js';
  49. import { getFileTypeBySuffix } from '@/common/common.js';
  50. import {
  51. reactive,
  52. ref,
  53. nextTick,
  54. onUnmounted
  55. } from 'vue';
  56. import { onLoad } from '@dcloudio/uni-app';
  57. const state = reactive({
  58. taskStatus:'',
  59. reviewStatus:'',
  60. taskTargetId:'',
  61. loading:false,
  62. pageTitle:'',
  63. tabBtns:[],
  64. fileContent:null,//文件内容
  65. rejectReason:'',//驳回原因
  66. easyinputStyle:{
  67. color: '#303133',
  68. borderColor: '#E9E9E9'
  69. }
  70. })
  71. const popupDelDialogRef = ref(null);
  72. const webPreviewFile = ref(null);//web端文件预览
  73. const appPreviewOfficeRef = ref(null);//APP端文件预览
  74. const ssdownload = ref(null);//下载
  75. onLoad((option) => {
  76. state.taskStatus = Number(option.taskStatus);//任务状态
  77. uni.removeStorageSync('isLoadReviewMaterialDetailList');//是否更新列表
  78. const detailData = uni.getStorageSync('reviewMaterialDetailData');//数据
  79. state.pageTitle = detailData?.targetName || '';
  80. state.reviewStatus = detailData?.reviewStatus || '';//审核状态
  81. state.taskTargetId = detailData?.taskTargetId || '';
  82. const fileList = detailData?.taskTargetFileVos || [];
  83. state.tabBtns = fileList.map(item => ({
  84. ...item,
  85. docType: getFileTypeBySuffix(item.fileType),
  86. label: item.fileName,
  87. value: item.id,
  88. }));
  89. state.fileContent = state.tabBtns.length ? state.tabBtns[0] : null;
  90. GetFileContent();
  91. })
  92. onUnmounted(()=>{
  93. uni.removeStorageSync('reviewMaterialDetailData');//删除缓存数据
  94. })
  95. //切换条件选择器
  96. const CommonFilterData = (filterOptions,type) => {
  97. const tabBtnSelected = filterOptions.tabBtnSelected;
  98. if(type == 'tabBtns'){
  99. state.fileContent = state.tabBtns.find(item=>item.id == tabBtnSelected);
  100. GetFileContent();
  101. }
  102. }
  103. const GetFileContent = () => {
  104. const docType = state?.fileContent?.docType || '';
  105. if(['word','excel','pptx','pdf','txt'].includes(docType)){
  106. // #ifdef H5
  107. nextTick(()=>{//h5文件预览
  108. webPreviewFile.value && webPreviewFile.value.preview({
  109. url: state.fileContent.filePath,
  110. type: state.fileContent.docType
  111. });
  112. })
  113. // #endif
  114. // #ifdef APP-PLUS
  115. if(docType != 'pptx'){
  116. nextTick(()=>{
  117. appPreviewOfficeRef.value && appPreviewOfficeRef.value.open();
  118. })
  119. }else{
  120. appPreviewOfficeRef.value && appPreviewOfficeRef.value.close();
  121. }
  122. // #endif
  123. }else{
  124. webPreviewFile.value && webPreviewFile.value.close();
  125. appPreviewOfficeRef.value && appPreviewOfficeRef.value.close();
  126. }
  127. }
  128. //下载
  129. const ToDownloadFile = () => {
  130. ssdownload?.value?.toDownload({
  131. type:'2',
  132. src:state.fileContent.filePath,
  133. fileName:state.fileContent.fileName
  134. });
  135. }
  136. //通过
  137. const HandlePassHonor = () => {
  138. if(state.taskStatus==2 || (state.taskStatus==1 && state.reviewStatus == 1)){
  139. return false
  140. }
  141. HandleRejectOrPass(1)
  142. }
  143. //驳回
  144. const HandleRejectHonor = () => {
  145. if(state.taskStatus==2 || (state.taskStatus==1 && state.reviewStatus == 2)){
  146. return false
  147. }
  148. popupDelDialogRef.value.OpenDialog();
  149. }
  150. //驳回 确定按钮
  151. const DialogConfirm = () => {
  152. if(state.rejectReason == '' || state.rejectReason == null){
  153. uni.showToast({
  154. title: '请填写驳回原因!',
  155. icon: 'none'
  156. })
  157. return false
  158. }
  159. HandleRejectOrPass(2)
  160. }
  161. const HandleRejectOrPass = (status) => {
  162. const params = {
  163. taskTargetId: state.taskTargetId,
  164. reviewStatus: status
  165. }
  166. if(status == 2){
  167. params.reviewContent = state.rejectReason;
  168. }
  169. const apiFn = state.reviewStatus === 0 ? updateReviewStatus : ChangeReviewStatus;
  170. apiFn(params).then(res=>{
  171. if(res.code == 200){
  172. uni.showToast({
  173. title: status == 2?'驳回成功!':'审核通过!',
  174. icon: 'none'
  175. })
  176. uni.setStorageSync('isLoadReviewMaterialDetailList', true);//刷新荣誉审核列表
  177. GoBack();
  178. }
  179. })
  180. }
  181. const GoBack = () => {
  182. uni.navigateBack({
  183. delta: 1
  184. });
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .page_body{
  189. display: flex;
  190. flex-direction: column;
  191. height: 100%;
  192. min-height: auto;
  193. }
  194. .page_content{
  195. flex:1;
  196. //height: calc(100% - 390rpx);
  197. overflow: auto;
  198. .img_width{
  199. width: 100%;
  200. height: auto;
  201. max-height: 100%;
  202. }
  203. .other_file{
  204. height: 100%;
  205. display: flex;
  206. width: 100%;
  207. box-sizing: border-box;
  208. flex-direction: column;
  209. align-items: center;
  210. justify-content: center;
  211. text-align: center;
  212. font-size: 28rpx;
  213. color: #333;
  214. word-break: break-all;
  215. }
  216. }
  217. .page_foot{
  218. // position: fixed;
  219. // left:0;
  220. // right: 0;
  221. // bottom: 0;
  222. width: 100%;
  223. padding: 40rpx 24rpx 38rpx 24rpx;
  224. box-sizing: border-box;
  225. box-shadow: inset 0px 2rpx 0px 0px #F3F3F3;
  226. background-color:#FFFFFF;
  227. gap: 30rpx;
  228. display: flex;
  229. .btn{
  230. height: 90rpx;
  231. display: flex;
  232. justify-content: center;
  233. align-items: center;
  234. border-radius: 8rpx;
  235. font-weight: 500;
  236. font-size: 28rpx;
  237. flex: 1;
  238. box-sizing: border-box;
  239. }
  240. .btn_reject{
  241. border: 2rpx solid #F56C6C;
  242. color: #F56C6C;
  243. &.disabled{
  244. border: 2rpx solid #C0C4CC;
  245. color: #C0C4CC;
  246. }
  247. }
  248. .btn_pass{
  249. background-color: #2E64FA !important;
  250. color: #FFFFFF;
  251. &.disabled{
  252. background-color: #F3F3F3 !important;
  253. color: #C0C4CC;
  254. }
  255. }
  256. }
  257. .dialog_content_input{
  258. width: 100%;
  259. display: flex;
  260. flex-direction: column;
  261. box-sizing: border-box;
  262. .dialog_desc{
  263. font-weight: 400;
  264. font-size: 32rpx;
  265. color: #303133;
  266. }
  267. :deep(.uni-easyinput){
  268. margin-top: 20rpx;
  269. font-size: 28rpx;
  270. .is-input-border{
  271. border-radius: 8rpx;
  272. border-color: #E9E9E9 !important;
  273. }
  274. .uni-easyinput__content-textarea{
  275. height: 400rpx;
  276. min-height: 400rpx;
  277. font-size: 28rpx;
  278. margin:20rpx 24rpx 20rpx 14rpx;
  279. }
  280. .input-padding{
  281. padding-left: 10rpx;
  282. }
  283. }
  284. }
  285. </style>