report.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='我的报告'></cus-header>
  4. <!-- <div class="tabs adf">
  5. <div class="t_pre" :class="{'active':tidx===2,'inactive':tidx!==2}" @tap="changeTab(2)">个人报告</div>
  6. <div class="t_pre" :class="{'active':tidx===1,'inactive':tidx!==1}" @tap="changeTab(1)">团队报告</div>
  7. </div> -->
  8. <template v-if="list.length">
  9. <div class="list">
  10. <div class="l_item" v-for="(item,index) in list" :key="index">
  11. <div class="li_title">{{item.reportName||''}}</div>
  12. <div class="li_pre">报告时间:<span>{{item.createDate||''}}</span></div>
  13. <div class="li_pre" v-if="item.type==1">作答人数:<span>{{item.finishNum||0}}/{{item.answerNum||0}}</span></div>
  14. <!-- <div class="li_pre">项目名称:<span>{{item.programName||''}}</span></div> -->
  15. <div class="li_pre">团队名称:<span>{{item.teamName||''}}</span></div>
  16. <div class="li_jd adfacjb" v-if="item.type==1">
  17. <div class="lj_l">
  18. <div class="ljl_box" :style="{'width':((item.finishNum||0)/(item.answerNum||0)*100)+'%'}"></div>
  19. </div>
  20. <div class="lj_r">进度<span>{{item.finishNum||0}}/{{item.answerNum||0}}</span></div>
  21. </div>
  22. <div class="li_actions">
  23. <div class="li_edit" v-if="canEditEvaluation(item)" @tap="openEvaluation(item)">评估修改</div>
  24. <div class="li_view" @tap="viewReport(item)">查看</div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <template v-else>
  30. <page-empty :height="'calc(100vh - 200px)'"></page-empty>
  31. </template>
  32. <view class="edit_mask" v-if="editVisible" @tap.stop="closeEvaluation">
  33. <view class="edit_dialog" @tap.stop>
  34. <view class="edit_title">修改评估内容</view>
  35. <view class="edit_label">总体评估结果</view>
  36. <textarea class="edit_textarea" maxlength="20000" v-model="editForm.overallAssessment" placeholder="请输入总体评估结果"></textarea>
  37. <view class="edit_label">团队发展建议</view>
  38. <textarea class="edit_textarea" maxlength="20000" v-model="editForm.developmentAdvice" placeholder="请输入团队发展建议"></textarea>
  39. <view class="edit_actions">
  40. <view class="edit_cancel" @tap="closeEvaluation">取消</view>
  41. <view class="edit_submit" :class="{disabled: editSubmitting}" @tap="submitEvaluation">{{editSubmitting?'提交中':'保存提交'}}</view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import pageEmpty from '@/components/pageEmpty/index.vue'
  49. import { canEditEvaluation, EVALUATION_PROCESSING_PROMPT, normalizeEvaluationForm } from '@/utils/reportEvaluationEdit.js'
  50. export default {
  51. components:{ pageEmpty },
  52. data(){
  53. return {
  54. tidx:1,
  55. list:[],
  56. editVisible:false,
  57. editSubmitting:false,
  58. editReportId:'',
  59. editForm:{overallAssessment:'',developmentAdvice:''}
  60. }
  61. },
  62. onLoad() {
  63. this.getReportList();
  64. },
  65. methods:{
  66. changeTab(idx){
  67. this.tidx = idx;
  68. this.getReportList();
  69. },
  70. getReportList(){
  71. this.$api.get('/core/report/member/personalReportList').then(res=>{
  72. if(res.data.code!==0) return this.$showToast(res.data.msg)
  73. this.list = res.data.data;
  74. })
  75. },
  76. canEditEvaluation(item){
  77. return canEditEvaluation(item);
  78. },
  79. openEvaluation(item){
  80. if(!this.canEditEvaluation(item)) return;
  81. this.editReportId = item.reportId;
  82. this.editSubmitting = false;
  83. this.editVisible = true;
  84. this.$api.get('/core/report/evaluation/'+item.reportId).then(res=>{
  85. if(res.data.code!==0){ this.closeEvaluation(); return this.$showToast(res.data.msg); }
  86. const data = res.data.data || {};
  87. if(data.processing){ this.closeEvaluation(); return this.$showToast('评估分析正在重新生成中,请稍候'); }
  88. this.editForm = normalizeEvaluationForm(data);
  89. })
  90. },
  91. closeEvaluation(){
  92. if(this.editSubmitting) return;
  93. this.editVisible = false;
  94. this.editReportId = '';
  95. },
  96. submitEvaluation(){
  97. if(this.editSubmitting) return;
  98. if(!this.editForm.overallAssessment.trim()) return this.$showToast('请输入总体评估结果');
  99. if(!this.editForm.developmentAdvice.trim()) return this.$showToast('请输入团队发展建议');
  100. this.editSubmitting = true;
  101. this.$api.post('/core/report/evaluation/'+this.editReportId, this.editForm).then(res=>{
  102. if(res.data.code!==0) return this.$showToast(res.data.msg);
  103. this.editVisible = false;
  104. this.getReportList();
  105. uni.showModal({title:'温馨提示', content:EVALUATION_PROCESSING_PROMPT, showCancel:false, confirmText:'确定', confirmColor:'#007A69'});
  106. }).finally(()=>{ this.editSubmitting = false; });
  107. },
  108. viewReport(item){
  109. if(!item.fileUrl) return this.$showToast('报告pdf为空,请联系教练。')
  110. uni.navigateTo({
  111. url:`/pages/reportDetail?pdfUrl=${item.fileUrl}&reportId=${item.reportId}&fileName=${item.programName}-${item.reportName}`
  112. })
  113. }
  114. }
  115. }
  116. </script>
  117. <style scoped lang="less">
  118. .page{
  119. background: #F7F7F7;
  120. padding-bottom: 40rpx;
  121. box-sizing: border-box;
  122. .tabs{
  123. width: 100%;
  124. height: 90rpx;
  125. background: #FFFFFF;
  126. .t_pre{
  127. width: 50%;
  128. height: 90rpx;
  129. font-family: PingFang-SC, PingFang-SC;
  130. font-weight: bold;
  131. font-size: 32rpx;
  132. color: #666666;
  133. line-height: 90rpx;
  134. text-align: center;
  135. position: relative;
  136. &.active{
  137. color: #33A7A7;
  138. &::after{
  139. content: '';
  140. width: 148rpx;
  141. height: 6rpx;
  142. background: #33A7A7;
  143. border-radius: 9rpx;
  144. position: absolute;
  145. left: 50%;
  146. margin-left: -74rpx;
  147. bottom: 0;
  148. }
  149. }
  150. &.inactive{
  151. color: #666666 !important;
  152. &::after{
  153. content: '';
  154. width: 148rpx;
  155. height: 6rpx;
  156. background: #FFFFFF !important;
  157. border-radius: 9rpx;
  158. position: absolute;
  159. left: 50%;
  160. margin-left: -74rpx;
  161. bottom: 0;
  162. }
  163. }
  164. }
  165. }
  166. .list{
  167. padding: 0 24rpx;
  168. overflow: hidden;
  169. .l_item{
  170. margin-top: 20rpx;
  171. background: #FFFFFF;
  172. border-radius: 16rpx;
  173. padding: 40rpx 24rpx;
  174. position: relative;
  175. .li_title{
  176. width: calc(100% - 100rpx);
  177. font-family: PingFang-SC, PingFang-SC;
  178. font-weight: bold;
  179. font-size: 30rpx;
  180. color: #252525;
  181. line-height: 30rpx;
  182. overflow: hidden;
  183. text-overflow: ellipsis;
  184. white-space: nowrap;
  185. }
  186. .li_pre{
  187. margin-top: 40rpx;
  188. font-family: PingFangSC, PingFang SC;
  189. font-weight: 400;
  190. font-size: 26rpx;
  191. color: #86909C;
  192. line-height: 26rpx;
  193. overflow: hidden;
  194. text-overflow: ellipsis;
  195. white-space: nowrap;
  196. span{
  197. color: #1D2129;
  198. }
  199. }
  200. .li_jd{
  201. margin-top: 27rpx;
  202. .lj_l{
  203. width: calc(100% - 181rpx);
  204. height: 10rpx;
  205. background: #EFEFEF;
  206. border-radius: 5rpx;
  207. position: relative;
  208. .ljl_box{
  209. height: 100%;
  210. background: #FFD750;
  211. border-radius: 5rpx;
  212. position: absolute;
  213. left: 0;
  214. top: 0;
  215. }
  216. }
  217. .lj_r{
  218. font-family: PingFangSC, PingFang SC;
  219. font-weight: 400;
  220. font-size: 24rpx;
  221. color: #A6A6A6;
  222. line-height: 24rpx;
  223. span{
  224. color: #1D2129;
  225. margin-left: 8rpx;
  226. }
  227. }
  228. }
  229. .li_view{
  230. width: 88rpx;
  231. height: 54rpx;
  232. background: #833478;
  233. border-radius: 24rpx;
  234. font-family: PingFang-SC, PingFang-SC;
  235. font-weight: bold;
  236. font-size: 24rpx;
  237. color: #FFFFFF;
  238. line-height: 54rpx;
  239. text-align: center;
  240. position: absolute;
  241. top: 40rpx;
  242. right: 24rpx;
  243. }
  244. .li_actions{
  245. position:absolute;
  246. top:40rpx;
  247. right:24rpx;
  248. display:flex;
  249. gap:12rpx;
  250. .li_edit,.li_view{
  251. position:static;
  252. width:112rpx;
  253. }
  254. .li_edit{height:54rpx;background:#33A7A7;border-radius:24rpx;font-family:PingFang-SC, PingFang-SC;font-weight:bold;font-size:24rpx;color:#FFFFFF;line-height:54rpx;text-align:center;}
  255. }
  256. }
  257. }
  258. }
  259. .edit_mask{
  260. position:fixed;
  261. z-index:20;
  262. left:0;right:0;top:0;bottom:0;
  263. background:rgba(0,0,0,.45);
  264. display:flex;
  265. align-items:center;
  266. justify-content:center;
  267. .edit_dialog{
  268. width:650rpx;
  269. background:#fff;
  270. border-radius:16rpx;
  271. padding:34rpx 28rpx 26rpx;
  272. .edit_title{text-align:center;font-size:34rpx;font-weight:bold;color:#252525;margin-bottom:28rpx;}
  273. .edit_label{font-size:28rpx;font-weight:bold;color:#333;margin:18rpx 0 12rpx;}
  274. .edit_textarea{width:100%;height:180rpx;box-sizing:border-box;background:#f7f7f7;border-radius:8rpx;padding:18rpx;font-size:26rpx;color:#333;}
  275. .edit_actions{display:flex;justify-content:flex-end;gap:20rpx;margin-top:28rpx;}
  276. .edit_cancel,.edit_submit{padding:18rpx 28rpx;border-radius:10rpx;font-size:28rpx;}
  277. .edit_cancel{color:#666;background:#f2f2f2;}.edit_submit{color:#fff;background:#833478;}.edit_submit.disabled{opacity:.5;}
  278. }
  279. }
  280. </style>