generateList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view class="gbox">
  3. <u-list @scrolltolower="scrolltolower" height="100%">
  4. <u-list-item v-for="(item, index) in list" :key="index">
  5. <view class="gbox-item">
  6. <view class="gbox-item-top adf">
  7. <view class="gbox-item-top-type">{{typeCfg[item.type]||'基础版'}}</view>
  8. <view class="gbox-item-top-title">{{item.reportName||''}}</view>
  9. </view>
  10. <view class="gbox-item-p adf">
  11. <view class="gbox-item-p-left">团队名称:</view>
  12. <view class="gbox-item-p-right">{{item.teamName||''}}</view>
  13. </view>
  14. <view class="gbox-item-p adf">
  15. <view class="gbox-item-p-left">报告状态:</view>
  16. <view class="gbox-item-p-right" :style="{'color':stateColor[item.state]}">{{stateDict[item.state]}}</view>
  17. </view>
  18. <view class="gbox-item-p adf">
  19. <view class="gbox-item-p-left">创建时间:</view>
  20. <view class="gbox-item-p-right">{{item.createDate||''}}</view>
  21. </view>
  22. <view class="gbox-item-bottom adfacjb">
  23. <view class="gbox-item-bottom-left adfac"></view>
  24. <div class="gbox-item-bottom-rightbox adfac" v-if="item.type==1">
  25. <view class="gbox-item-bottom-right" style="margin-right: 20rpx;" @click="reviewPdf(item)" v-if="item.state==1&&!item.fileUrl">预览</view>
  26. <view class="gbox-item-bottom-right" style="margin-right: 20rpx;" @click="askReport(item)" v-if="item.state==1&&item.fileUrl">提问</view>
  27. <view class="gbox-item-bottom-right" @click="reviewReport(item)" v-if="item.state==1">查看报告</view>
  28. <view class="gbox-item-bottom-right" @click="reSendReport(item)" v-if="item.state==-1">重新生成</view>
  29. </div>
  30. <div class="gbox-item-bottom-rightbox adfac" v-else-if="item.type==2">
  31. <view class="gbox-item-bottom-right" style="margin-right: 20rpx;" @click="reviewPdf(item)" v-if="item.state==1">预览</view>
  32. <view class="gbox-item-bottom-right" style="margin-right: 20rpx;" @click="askReport(item)" v-if="item.state==1&&item.fileUrl">提问</view>
  33. <view class="gbox-item-bottom-right" style="margin-right: 20rpx;" @click="reviewReport(item)" v-if="item.state==1&&item.fileUrl">查看报告</view>
  34. <view class="gbox-item-bottom-right" @click="sendReport(item)" v-if="item.state!=-1">发送报告</view>
  35. <view class="gbox-item-bottom-right" @click="reSendReport(item)" v-if="item.state==-1">重新生成</view>
  36. </div>
  37. </view>
  38. </view>
  39. </u-list-item>
  40. </u-list>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. props:{
  46. list:{
  47. typeof:Array,
  48. default:[]
  49. }
  50. },
  51. data(){
  52. return {
  53. typeCfg:{
  54. 1:'基础版',
  55. 2:'专业版',
  56. 3:'专家版'
  57. },
  58. stateDict:{
  59. '0':'生成中',
  60. '1':'生成成功',
  61. '-1':'生成失败'
  62. },
  63. stateColor:{
  64. '0':'#FFD750',
  65. '1':'#33A7A7',
  66. '-1':'#F4657A'
  67. }
  68. }
  69. },
  70. methods:{
  71. scrolltolower(){
  72. this.$emit('scrolltolower')
  73. },
  74. reviewPdf(item){
  75. let url = `/pagesHome/pdf?reportId=${item.reportId}`;
  76. if(item.type==2) url = `/pagesHome/pdfZyb?reportId=${item.reportId}`
  77. uni.navigateTo({ url })
  78. },
  79. reviewReport(item){
  80. if(!item.fileUrl) return this.$showToast('报告pdf为空,请稍后再试。')
  81. uni.navigateTo({
  82. url:'/pages/webView?src='+item.fileUrl
  83. })
  84. },
  85. askReport(item){
  86. uni.navigateTo({
  87. url:`/pages/reportAsk?pdfUrl=${item.fileUrl}&fileName=${this.typeCfg[item.type]||'基础版'}-${item.reportName}`
  88. })
  89. },
  90. sendReport(item){
  91. if(!item.fileUrl) return this.$showModal('该报告尚未生成PDF文件,请等待生成后发送。')
  92. uni.showModal({
  93. title:'发送报告',
  94. content:`是否将“${item.reportName||''}”发送给团队成员`,
  95. success: (res) => {
  96. if(res.confirm){
  97. this.$api.get(`/core/report/sendReport/${item.reportId}`).then(({data:res})=>{
  98. if(res.code!==0) return this.$showToast(res.msg)
  99. uni.navigateTo({
  100. url:'/pagesHome/sendResult?result='+res.code
  101. })
  102. })
  103. }
  104. }
  105. })
  106. },
  107. reSendReport(item){
  108. this.$api.get(`/core/report/regenerateReport/${item.reportId}`).then(({data:res})=>{
  109. if(res.code!==0) return this.$showToast(res.msg)
  110. this.$emit('reSendReport')
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style scoped lang="scss">
  117. .gbox{
  118. height: 100%;
  119. &-item{
  120. margin-top: 20rpx;
  121. background: #FFFFFF;
  122. border-radius: 24rpx;
  123. padding: 40rpx 24rpx 10rpx;
  124. position: relative;
  125. &-top{
  126. &-type{
  127. width: 98rpx;
  128. height: 36rpx;
  129. padding: 2rpx 13rpx;
  130. box-sizing: border-box;
  131. background: #FFF7DC;
  132. border-radius: 6rpx;
  133. font-family: PingFangSC, PingFang SC;
  134. font-weight: 400;
  135. font-size: 24rpx;
  136. color: #BA9B31;
  137. line-height: 33rpx;
  138. }
  139. &-title{
  140. width: calc(100% - 98rpx);
  141. font-family: PingFang-SC, PingFang-SC;
  142. font-weight: bold;
  143. font-size: 32rpx;
  144. color: #002846;
  145. line-height: 32rpx;
  146. text-indent: 17rpx;
  147. }
  148. }
  149. &-p{
  150. margin-top: 36rpx;
  151. &>view{
  152. font-family: PingFangSC, PingFang SC;
  153. font-weight: 400;
  154. font-size: 24rpx;
  155. color: #667E90;
  156. line-height: 24rpx;
  157. }
  158. &-left{
  159. width: 134rpx;
  160. }
  161. &-right{
  162. width: calc(100% - 134rpx);
  163. }
  164. &-progress{
  165. width: calc(100% - 134rpx);
  166. &-l{
  167. width: 410rpx;
  168. height: 12rpx;
  169. background: #F0F2F8;
  170. border-radius: 6rpx;
  171. position: relative;
  172. &-current{
  173. height: 12rpx;
  174. background: #FFDF73;
  175. border-radius: 6rpx;
  176. position: absolute;
  177. left: 0;
  178. top: 0;
  179. }
  180. }
  181. &-r{
  182. width: calc(100% - 410rpx);
  183. font-family: PingFangSC, PingFang SC;
  184. font-weight: 400;
  185. font-size: 24rpx;
  186. color: #002846;
  187. line-height: 24rpx;
  188. text-align: right;
  189. }
  190. }
  191. }
  192. &-bottom{
  193. margin-top: 30rpx;
  194. border-top: 1rpx solid #EFEFEF;
  195. padding-top: 18rpx;
  196. &-left{
  197. &>view{
  198. font-family: PingFangSC, PingFang SC;
  199. font-weight: 400;
  200. font-size: 24rpx;
  201. color: #667E90;
  202. line-height: 24rpx;
  203. }
  204. }
  205. &-right{
  206. padding: 17rpx 20rpx;
  207. background: linear-gradient( 90deg, #33A7A7 0%, #4DB2B2 100%);
  208. border-radius: 30rpx;
  209. font-family: PingFang-SC, PingFang-SC;
  210. font-weight: bold;
  211. font-size: 24rpx;
  212. color: #FFFFFF;
  213. line-height: 26rpx;
  214. letter-spacing: 2rpx;
  215. }
  216. }
  217. }
  218. }
  219. </style>