report.vue 9.0 KB

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