auditResult.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. ssdownload?.value?.toDownload({
  117. type:'2',
  118. src:state.fileContent.filePath,
  119. fileName:state.fileContent.fileName
  120. });
  121. }else{
  122. nextTick(()=>{
  123. appPreviewOfficeRef.value && appPreviewOfficeRef.value.open();
  124. })
  125. }
  126. // #endif
  127. }
  128. }
  129. //通过
  130. const HandlePassHonor = () => {
  131. if(state.taskStatus==2 || (state.taskStatus==1 && state.reviewStatus == 1)){
  132. return false
  133. }
  134. HandleRejectOrPass(1)
  135. }
  136. //驳回
  137. const HandleRejectHonor = () => {
  138. if(state.taskStatus==2 || (state.taskStatus==1 && state.reviewStatus == 2)){
  139. return false
  140. }
  141. popupDelDialogRef.value.OpenDialog();
  142. }
  143. //驳回 确定按钮
  144. const DialogConfirm = () => {
  145. if(state.rejectReason == '' || state.rejectReason == null){
  146. uni.showToast({
  147. title: '请填写驳回原因!',
  148. icon: 'none'
  149. })
  150. return false
  151. }
  152. HandleRejectOrPass(2)
  153. }
  154. const HandleRejectOrPass = (status) => {
  155. const params = {
  156. taskTargetId: state.taskTargetId,
  157. reviewStatus: status
  158. }
  159. if(status == 2){
  160. params.reviewContent = state.rejectReason;
  161. }
  162. const apiFn = state.reviewStatus === 0 ? updateReviewStatus : ChangeReviewStatus;
  163. apiFn(params).then(res=>{
  164. if(res.code == 200){
  165. uni.showToast({
  166. title: status == 2?'驳回成功!':'审核通过!',
  167. icon: 'none'
  168. })
  169. uni.setStorageSync('isLoadReviewMaterialDetailList', true);//刷新荣誉审核列表
  170. GoBack();
  171. }
  172. })
  173. }
  174. const GoBack = () => {
  175. uni.navigateBack({
  176. delta: 1
  177. });
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .page_body{
  182. display: flex;
  183. flex-direction: column;
  184. height: 100%;
  185. min-height: auto;
  186. }
  187. .page_content{
  188. flex:1;
  189. //height: calc(100% - 390rpx);
  190. overflow: auto;
  191. .img_width{
  192. width: 100%;
  193. height: auto;
  194. max-height: 100%;
  195. }
  196. .other_file{
  197. height: 100%;
  198. display: flex;
  199. width: 100%;
  200. box-sizing: border-box;
  201. flex-direction: column;
  202. align-items: center;
  203. justify-content: center;
  204. text-align: center;
  205. font-size: 28rpx;
  206. color: #333;
  207. word-break: break-all;
  208. }
  209. }
  210. .page_foot{
  211. // position: fixed;
  212. // left:0;
  213. // right: 0;
  214. // bottom: 0;
  215. width: 100%;
  216. padding: 40rpx 24rpx 38rpx 24rpx;
  217. box-sizing: border-box;
  218. box-shadow: inset 0px 2rpx 0px 0px #F3F3F3;
  219. background-color:#FFFFFF;
  220. gap: 30rpx;
  221. display: flex;
  222. .btn{
  223. height: 90rpx;
  224. display: flex;
  225. justify-content: center;
  226. align-items: center;
  227. border-radius: 8rpx;
  228. font-weight: 500;
  229. font-size: 28rpx;
  230. flex: 1;
  231. box-sizing: border-box;
  232. }
  233. .btn_reject{
  234. border: 2rpx solid #F56C6C;
  235. color: #F56C6C;
  236. &.disabled{
  237. border: 2rpx solid #C0C4CC;
  238. color: #C0C4CC;
  239. }
  240. }
  241. .btn_pass{
  242. background-color: #2E64FA !important;
  243. color: #FFFFFF;
  244. &.disabled{
  245. background-color: #F3F3F3 !important;
  246. color: #C0C4CC;
  247. }
  248. }
  249. }
  250. .dialog_content_input{
  251. width: 100%;
  252. display: flex;
  253. flex-direction: column;
  254. box-sizing: border-box;
  255. .dialog_desc{
  256. font-weight: 400;
  257. font-size: 32rpx;
  258. color: #303133;
  259. }
  260. :deep(.uni-easyinput){
  261. margin-top: 20rpx;
  262. font-size: 28rpx;
  263. .is-input-border{
  264. border-radius: 8rpx;
  265. border-color: #E9E9E9 !important;
  266. }
  267. .uni-easyinput__content-textarea{
  268. height: 400rpx;
  269. min-height: 400rpx;
  270. font-size: 28rpx;
  271. margin:20rpx 24rpx 20rpx 14rpx;
  272. }
  273. .input-padding{
  274. padding-left: 10rpx;
  275. }
  276. }
  277. }
  278. </style>