pdf.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898
  1. <template>
  2. <view class="page-wrappe">
  3. <cus-header title=' ' bgColor="transparent"></cus-header>
  4. <view id="pdfContainer" class="pdf-container" :style="{'transform':'scale('+scale+')', 'height': containerScaledHeight + 'px'}" v-if="reportData">
  5. <!-- 封面 -->
  6. <view class="cd_box fm2 adffc" style="border: none;margin-top: 20px;height: 868px;">
  7. <img class="fm2-logo" src="https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fm_logo.png">
  8. <img class="fm2-logo2" src="https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fm_logo2.png">
  9. <img class="fm2-perill" src="https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fm_perill.png">
  10. <view class="fm2-line"></view>
  11. <view class="fm2-p">团队发展动态评估报告(个人版)</view>
  12. <view class="fm2-texts adf">
  13. <view class="fm2-texts-pre"><span>客户公司:</span>{{ reportData.teamInfo.enterpriseName||'' }}</view>
  14. <view class="fm2-texts-pre"><span>团队名称:</span>{{ reportData.teamInfo.teamName||'' }}</view>
  15. <view class="fm2-texts-pre"><span>评估发起人:</span>{{ reportData.teamInfo.initiator||'' }}</view>
  16. <view class="fm2-texts-pre"><span>报告生成时间:</span>{{ reportData.teamInfo.reportDate||'' }}</view>
  17. </view>
  18. <view class="fm2-tip">免责声明:本团队测评报告基于您方团队填写的测评数据及相关信息生成,深圳创衡管理顾问有限公司不对报告内容的真实性、准确性和完整性负责。本报告仅供您了解团队情况、优化管理决策提供参考。报告结论不构成任何法律、商业或投资建议,亦不替代专业咨询意见。我方不对因使用本报告内容而产生的任何直接或间接损失承担责任。</view>
  19. </view>
  20. <!-- 介绍 -->
  21. <view class="cd_box" style="border: none;">
  22. <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_title_bg.png)','padding':'0 8px 0 22px'}">
  23. <view class="vt-left" style="color: #FFFFFF;">PERILL模型介绍</view>
  24. <view class="vt-right">团队发展动态评估报告(个人版)</view>
  25. </view>
  26. <view class="v2-box">
  27. <img class="vb-img1" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_box_img1.png'">
  28. <view class="v2-p">
  29. PERILL团队发展动态评估源于团队教练辅导领域的先驱、管理思维与团队绩效领域的权威、全球顶尖团队教练David Clutterbuck教授及其团队通过深入研究,提炼出影响团队绩效的140多个基于实证的因素,整合而成的团队评估和提升工具-PERILL模型。
  30. </view>
  31. <view class="v2-p" style="margin-top: 8px;">
  32. 创衡国际基于10多年来在全球与200多家具有前瞻性的国际公司以及国内具有行业代表性公司的合作经验,结合CCMI的PERILL评估工具,在中国推出的团队发展动态评估系统,旨在帮助团队更全面、更有效地从六个维度评估团队的发展现状,为支持团队成为高价值创造团队提供全景式的客观评估。
  33. </view>
  34. <view class="v2-p" style="margin-top: 8px;">
  35. PERILL团队发展动态评估(个人版)的主体内容由<span>{{ reportData.teamInfo.questionCount||0 }}</span>个关于团队的描述组成。
  36. </view>
  37. </view>
  38. <view class="v2-six">
  39. <view class="vsix-title">PERILL六大纬度</view>
  40. <view class="vsix-p">PERILL评估提供了一个复杂的团队系统概览,它并非针对孤立的问题,也不是简单的优缺点,而是着眼于团队系统的复杂性。它通过6个影响因素(如下所述)提出问题,以揭示团队系统各要素之间的联系,以及这些联系如何影响团队的高效运作能力。</view>
  41. <view class="vsix-boxs">
  42. <view class="vsb adfac" v-for="(item,index) in sixWd" :key="index">
  43. <img class="vsb-img" :src="item.img"/>
  44. <view class="vsb-right">
  45. <view class="vsbr-top adfac">
  46. <view class="vsbrt-type" :style="{'background':item.color}">{{ item.type }}</view>
  47. <view class="vsbrt-title" :style="{'color':item.color}">{{ item.title }}</view>
  48. </view>
  49. <view class="vsbr-desc">{{ item.desc }}</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 总体评估分析 -->
  56. <view class="cd_box adffc" style="border: none;">
  57. <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/'+'intro'+'_top_title_bg2.png)'}">
  58. <view class="vt-left">总体评估分析</view>
  59. <view class="vt-right">团队发展动态评估报告(个人版)</view>
  60. </view>
  61. <view class="v2-box">
  62. <img class="vb-img1" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_box_img1.png'">
  63. <view class="v2-p2">报告的核心是PERILL评估分析下从评估发起者个人维度来看其所在整体团队当前状态下的表现。这包括团队在PERILL模型每个关键要素上的综合得分,通过结合得分和置信指数,我们能够展示出高功能和低功能领域。</view>
  64. <view class="v2-p2" style="margin-top: 6px;">下面的条形图上的位置标记显示了团队在各个维度上的影响力评分。</view>
  65. <view style="width:100%;height:200px;" class="pdfEchart">
  66. <l-echart ref="ztzdfxRef" :canvas2d="true" @finished="initZtzdfxChart"></l-echart>
  67. </view>
  68. <view class="v2b-tip-title">注: 关于认同度、重要性分、影响力分的定义</view>
  69. <view class="v2b-tip-memo">
  70. a.“认同度分”,指标逻辑为评估发起者个人对当前主题所对应各问卷题目认同度评分的均值,用来表征其对这一主题问卷所陈述内容与团队情况的相符合程度的平均认知,最高分:5分,最低分:1分;<br>
  71. b.“重要分”,指标逻辑为根据评估发起者个人对当前主题所对应各问卷题目重要性评分的均值,用来表征其对这一主题问卷所陈述内容对于团队重要性的平均认知,最高分:5分,最低分:1分;<br>
  72. c.“影响力分”,指标逻辑为综合团队全体对当前主题所对应各问卷题目的认同度与重要性的评分数据测算而来,用来表征其对这一主题问卷所陈述内容对于团队的影响力水平,最高分:5分,最低分:1分;
  73. </view>
  74. <view class="v2b-title">评估结果</view>
  75. <view class="v2b-p" v-html="renderMarkdown(reportData.totalDiagnosticOutput||'')"></view>
  76. </view>
  77. </view>
  78. <!-- 总体评估分析 评估建议-->
  79. <view class="cd_box adffc" style="border: none;">
  80. <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/'+'intro'+'_top_title_bg2.png)'}">
  81. <view class="vt-left">总体评估分析</view>
  82. <view class="vt-right">团队发展动态评估报告(个人版)</view>
  83. </view>
  84. <view class="v2-box">
  85. <img class="vb-img1" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_box_img1.png'">
  86. <view class="v2b-title" style="margin-top: 0;">评估建议</view>
  87. <view class="v2b-p" v-html="renderMarkdown(reportData.totalDiagnosisSuggest||'')"></view>
  88. </view>
  89. </view>
  90. <!-- 多维度 -->
  91. <canvas type="2d" canvas-id="score-canvas" id="score-canvas" class="offscreen-canvas"></canvas>
  92. <template v-if="reportData&&reportData.dimensionAnalysis&&reportData.dimensionAnalysis.length">
  93. <view class="cd_box adffc" style="border: none;" v-for="(n,i) in [[0,2],[2,4],[4,6]]" :key="i">
  94. <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_title_bg.png)','padding':'0 8px 0 22px'}">
  95. <view class="vt-left" style="color: #FFFFFF;">PERILL六大纬度</view>
  96. <view class="vt-right">团队发展动态评估报告(个人版)</view>
  97. </view>
  98. <view v-for="(item,index) in reportData.dimensionAnalysis.slice(n[0],n[1])" :key="index">
  99. <view class="v2-title2">{{ item.title||'' }}</view>
  100. <view class="v2-box" :style="{'border':'none','padding':0}">
  101. <view class="v2-p2">{{ item.desc }}</view>
  102. <view class="vb-table adf" :style="{'border':'1px solid '+item.bordercolor,'margin-top':'12px'}">
  103. <view class="vbt2-left">
  104. <view class="vbt2l-th adf" :style="{'background':item.thbgcolor,'color':item.thtextcolor}">
  105. <view class="vbt2l-th-title adfac">主题</view>
  106. <view class="vbt2l-th-score adfacjc">影响力分</view>
  107. </view>
  108. <view class="vbt2l-pre" v-for="(ss,si) in item.scoreSpreads" :key="si" :style="{'border-bottom':'1px solid '+item.bordercolor}">
  109. <view class="vbt2l-pre-l adffc">
  110. <view class="vbt2l-pre-l-title" :style="{'color':item.titlecolor}">{{ ss.theme||'' }}</view>
  111. <view class="vbt2l-pre-l-tip">{{ ss.question||'' }}</view>
  112. </view>
  113. <view class="vbt2l-pre-r adfacjc">{{ ss.memeber.avgScore||0 }}</view>
  114. </view>
  115. </view>
  116. <view class="vbt2-right adffc">
  117. <view class="vbt2r-th adf" :style="{'background':item.thbgcolor,'color':item.thtextcolor}">
  118. <view class="vbt2r-pre adfacjc">认同度分</view>
  119. <view class="vbt2r-pre adfacjc">重要性分</view>
  120. </view>
  121. <view class="vbt2r-tb adf">
  122. <view class="vbt2r-tb-l adffc">
  123. <view class="vbt2r-tb-l-pre red adfac" v-for="(ss,si) in item.scoreSpreads" :key="si" :style="{'border-bottom':'1px solid '+item.bordercolor}">
  124. <view class="vbt2r-tb-l-pre-bg"></view>
  125. <view class="vbt2r-tb-l-pre-zzt red" :style="{'width':(ss.memeber.avgAgreement/6*100)+'%'}">
  126. <view class="vbt2r-tb-l-pre-zzt-numl">{{ ss.memeber.avgAgreement||0 }}</view>
  127. </view>
  128. </view>
  129. </view>
  130. <view class="vbt2r-tb-l">
  131. <view class="vbt2r-tb-l-pre green adfac" v-for="(ss,si) in item.scoreSpreads" :key="si" :style="{'border-bottom':'1px solid '+item.bordercolor}">
  132. <view class="vbt2r-tb-l-pre-bg r"></view>
  133. <view class="vbt2r-tb-l-pre-zzt green" :style="{'width':(ss.memeber.avgVital/6*100)+'%'}">
  134. <view class="vbt2r-tb-l-pre-zzt-numr">{{ ss.memeber.avgVital||0 }}</view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. </template>
  145. <!-- 封底页 -->
  146. <view class="cd_box fdy" style="border: none;">
  147. <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fdy_title_bg.png)'}">
  148. <view class="vt-left" style="color: #FFFFFF;">结言</view>
  149. <view class="vt-right">团队发展动态评估报告(个人版)</view>
  150. </view>
  151. <view class="fdy-title">致关注团队发展的您:从评估到行动,开启团队进化跃迁之旅。</view>
  152. <view class="fdy-p">当您阅读至此,首先恭喜您完成了一次专业的团队评估!这不仅是您对所在团队的一次深度观察,也为团队发展开启了一个充满可能性的新起点。</view>
  153. <view class="fdy-p">作为团队教练,我们希望与您分享这次评估的深层价值,并为您描绘从个人视角走向团队共识的可能路径。</view>
  154. <view class="fdy-subtitle">一、这次个人评估为您理解团队提供了两个独特视角:</view>
  155. <view class="fdy-subtitle2">1. 个人观察的整合</view>
  156. <view class="fdy-p" style="margin-top: 6px;">本报告整合了您个人对团队当前状态(认同度)和未来期待(重要性)的评价,如同一面镜子,映照出您所感知的团队运作状态。它帮助您看见那些可能被忽略的惯性模式、盲点与认知差异。无论是您看到的优势、共识,还是待发展的领域,这些都构成了您个人视角下的团队画像。 </view>
  157. <view class="fdy-subtitle2">2. 进化方向的个人洞察</view>
  158. <view class="fdy-p" style="margin-top: 6px;">基于您的观察,报告勾勒出团队持续进化的潜在方向。这并非标准答案,而是帮助您识别那些对团队成功可能最关键的发展维度——无论是战略对齐、信任深化、协同效率、创新学习还是领导力进化。它将您个人的感受与对团队的期待连接起来,把模糊的感觉转化为可讨论、可聚焦的议题,为您后续参与团队对话提供事实依据。</view>
  159. <view class="fdy-subtitle">二、个人评估是重要的第一步,但团队的真实面貌往往需要更多视角。</view>
  160. <view class="fdy-p">本次评估仅代表您个人的观察,而团队作为一个系统,其全貌需要整合团队领导者、成员、赞助人及利益相关方等多方视角。这正是PERILL团队评估系统的核心价值:通过科学的、结构化的评估,帮助团队获得系统性洞察,实现高杠杆改进。</view>
  161. <view class="fdy-subtitle">三、我们邀请您:</view>
  162. <view class="fdy-subtitle2">1. 发起一次坦诚的团队对话</view>
  163. <view class="fdy-p" style="margin-top: 6px;">邀请关键成员,基于您的观察分享感受,倾听他人视角,开启团队共识的第一步。</view>
  164. <view class="fdy-subtitle2">2. 进行一次完整的团队PERILL评估</view>
  165. <view class="fdy-p" style="margin-top: 6px;">邀请团队负责人、成员、赞助人及利益相关方共同参与,获得真实、立体的团队诊断报告,为团队发展奠定共同事实基础。</view>
  166. <view class="fdy-subtitle2">3. 考虑获取专业支持</view>
  167. <view class="fdy-p" style="margin-top: 6px;">团队教练可作为中立的思考伙伴,帮助团队整合多元视角,建立共同语言,制定切实可行的进化路径。</view>
  168. <view class="fdy-p" style="margin-top: 20px;">每一支超越高绩效的团队,都始于对现状清醒的认知与持续进化的共同勇气。现在,您已拥有个人视角的洞察,下一步是走向团队共识——让每一次对话,都成为团队蜕变的契机。</view>
  169. <view class="fdy-p">PERILL不止于评估,更在于赋能。期待与您和团队同行,见证未来的更多可能。</view>
  170. <view class="fdy-p">具体需求可联系您的团队教练或扫码联系“⼤衡同学”。</view>
  171. <view class="fdy-code adffcac" style="margin-top: 14px;">
  172. <img :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fdy_code.png'">
  173. <p style="margin-top: 0;font-size: 10px;color: #002846;line-height: 18px;">扫码联系大衡同学</p>
  174. </view>
  175. <view class="v2b-alert" style="margin-top: 28px;">注:团队发展本身就不是单一答案的过程,PERILL AI教练根据创衡独创团队教练方法论,可以从不同角度解读团队,发现那些隐藏的机会点。多元建议代表多元可能。您可以尝试再次生成评估报告,探索更多可能性。</view>
  176. </view>
  177. </view>
  178. <view class="pdf_btn" @click="createPdf">生成PDF</view>
  179. </view>
  180. </template>
  181. <script name="">
  182. import { BaseApi } from '@/http/baseApi.js';
  183. import * as echarts from '@/pagesHome/components/lime-echart/static/echarts.min.js'
  184. import lEchart from '@/pagesHome/components/lime-echart/components/l-echart/l-echart.vue'
  185. export default {
  186. name: 'ZtzdfxChart',
  187. components:{ lEchart },
  188. data() {
  189. return {
  190. reportId:'',
  191. reportData: null,
  192. isChartReady: false,
  193. scale:1,
  194. originalContainerHeight: 0,
  195. containerScaledHeight: 'auto',
  196. sixWd: [
  197. {
  198. img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_p.png',
  199. type:'P',
  200. title:'宗旨与动机',
  201. desc:'指团队共享的目的和存在的意义, 包含对共同的愿景,目标和优先级的清晰度。',
  202. color:'#761E6A'
  203. },
  204. {
  205. img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_e.png',
  206. type:'E',
  207. title:'外部流程、系统与结构',
  208. desc:'指团队与其外部利益相关者 - 客户,供应商,股东,组织内的上级及其他团队的互动关系和协作机制。',
  209. color:'#009191'
  210. },
  211. {
  212. img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_r.png',
  213. type:'R',
  214. title:'人际关系',
  215. desc:'指团队成员共同工作时的关系状态–他们是否相互尊重和信任对方的能力,是否足够心理安全以能够坦诚沟通,是否真正关心彼此的幸福感等。',
  216. color:'#FFD750'
  217. },
  218. {
  219. img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_i.png',
  220. type:'I',
  221. title:'内部流程、系统与结构',
  222. desc:'指团队如何管理工作任务和流程(包括但不限于会议、任务分配和团队情绪等),互相支持以及高质量的沟通和决策。',
  223. color:'#4EB2B2'
  224. },
  225. {
  226. img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_l.png',
  227. type:'L',
  228. title:'学习',
  229. desc:'指团队如何应对多变的环境和保持持续的进步和成⻓,能够从经验中反思、提炼并应用知识的能力。',
  230. color:'#AFCDF5'
  231. },
  232. {
  233. img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_l2.png',
  234. type:'L',
  235. title:'领导力',
  236. desc:'指团队认为需要怎样的领导行为能够让他们,作为个人或者团队做到最好。团队可以和他们的领导者讨论他们的责任及承担方式,以帮助领导者成为他们需要的领导者。',
  237. color:'#002846'
  238. }
  239. ],
  240. pdfImages:[],
  241. };
  242. },
  243. onLoad(options) {
  244. this.reportId = options.reportId;
  245. this.getReportData();
  246. },
  247. onReady() {
  248. // #ifdef MP-WEIXIN
  249. wx.hideShareMenu();
  250. // #endif
  251. },
  252. mounted() {
  253. this.calculateScaleAndPosition();
  254. uni.onWindowResize(() => {
  255. this.calculateScaleAndPosition();
  256. });
  257. },
  258. methods: {
  259. renderMarkdown(val) {
  260. if(!val) return '';
  261. val = '<span style="padding-left:4ch;"></span>'+val;
  262. val = this.formattedText2(val);
  263. val = val.replaceAll('\n','<br><span style="padding-left:4ch;"></span>')
  264. val = this.formattedText(val);
  265. return val;
  266. },
  267. formattedText(val) {
  268. // 正则表达式:匹配**包裹的内容
  269. // /\*\*(.*?)\*\*/g 解析:
  270. // \*\* 匹配两个星号(*需要转义)
  271. // (.*?) 非贪婪匹配任意字符(括号捕获匹配的内容)
  272. // g 全局匹配(替换所有符合条件的内容)
  273. const regex = /\*\*(.*?)\*\*/g
  274. // 替换为<b>标签,$1表示正则中括号捕获的内容
  275. return val.replace(regex, '<b>$1</b>')
  276. },
  277. formattedText2(val) {
  278. // 正则解析:
  279. // #{1,6} 匹配1到6个#
  280. // (.*?) 非贪婪捕获#后、空格前的任意文字(核心要保留的内容)
  281. // \s 匹配后面的空格(注意是单个空格,若要兼容多个空格可改为\s+)
  282. // g 全局匹配,替换所有符合条件的内容
  283. const regex = /#{1,6}\s*(.+?)\s*\n/g;
  284. // 替换规则:将匹配到的 "#文字 " / "##文字 " / "###文字 " 转为 "<b>文字</b>"
  285. return val.replace(regex, '<b>$1</b><br>')
  286. },
  287. getReportData(){
  288. this.$api.get(`/core/report/previewReport/${this.reportId}`).then(({data:res})=>{
  289. if(res.code!==0) return this.$showToast(res.msg)
  290. this.reportData = res.data;
  291. const tempDimensionAnalysis = [
  292. {
  293. title:'P-宗旨与动机',thbgcolor:'#761E6A',thtextcolor:'#FFFFFF',titlecolor:'#761E6A',dimensionCode:"purpose",bordercolor:'#E4D2E1',
  294. desc:`「宗旨与动机」维度,我们旨在探究团队是否有清晰的存在理由和明确的方向,能够激发团队成员的动力并吸引他们的想象力,以及个人与集体的身份认同是否围绕共同的目标,并在实现目标的优先次序上达成一致。`
  295. },
  296. {
  297. title:'E-外部流程、系统与结构',thbgcolor:'#009191',thtextcolor:'#FFFFFF',titlecolor:'#009191',dimensionCode:"external",bordercolor:'#B3DEDE',
  298. desc:`「外部流程、系统与结构」维度,我们旨在探究团队如何与各种利益相关者互动,他们与团队的利益相关方各自如何寻求了解对方,以及现有系统和流程的有效性,以帮助管理不同利益相关者的期望和需求。`
  299. },
  300. {
  301. title:'R-人际关系',thbgcolor:'#FFD750',thtextcolor:'#002846',titlecolor:'#002846',dimensionCode:"relationship",bordercolor:'#FFEBA8',
  302. desc:`「人际关系」维度,我们旨在探究团队成员相互沟通交流的状态,团队成员的信任程度、尊重和关心的程度、心理安全度,以及团队成员之间的关系如何促进(或破坏)协作。`
  303. },
  304. {
  305. title:'I-内部流程、系统与结构',thbgcolor:'#4EB2B2',thtextcolor:'#FFFFFF',titlecolor:'#33A7A7',dimensionCode:"internal",bordercolor:'#B3DEDE',
  306. desc:`「内部流程、系统与结构」维度,我们旨在探究团队在管理工作任务和流程中如何平衡责任与自主权进行协作。主要关注团队应对变化时的敏捷程度、日常沟通方式以及内部决策过程的有效性。`
  307. },
  308. {
  309. title:'L-学习',thbgcolor:'#AFCDF5',thtextcolor:'#002846',titlecolor:'#002846',dimensionCode:"learning",bordercolor:'#C7DCF8',
  310. desc:`「学习」维度,我们旨在探究团队如何提高其绩效(完成当下的任务)、能力(提高技能和资源以处理明天的任务)和容量(⻓期的愿景,用更少的资源做更多的事情)以应对当前和未来的任务。同时还关注团队如何管理这些能力和提高效率。`
  311. },
  312. {
  313. title:'L-领导力',thbgcolor:'#002846',thtextcolor:'#FFFFFF',titlecolor:'#002846',dimensionCode:"leadership",bordercolor:'#E6EAED',
  314. desc:`「领导力」维度,我们旨在探究团队领导者的素质和行为(包括但不限于正式与非正式的引导、赋能与责任承担方式)如何对团队功能和其他因素产生影响,以及这是积极的还是消极的。`
  315. }
  316. ]
  317. if(this.reportData&&this.reportData.dimensionAnalysis){
  318. this.reportData.dimensionAnalysis.forEach((d,i)=>{
  319. d.scoreSpreads.forEach(s=>{
  320. s.theme = s.theme.replaceAll(',',' ').replaceAll(',',' ');
  321. })
  322. let temp = tempDimensionAnalysis.find(t=>t.dimensionCode === d.dimensionCode)||{};
  323. this.reportData.dimensionAnalysis[i] = {...d,...temp}
  324. })
  325. }
  326. })
  327. },
  328. // async createPdf(){
  329. // uni.showLoading({
  330. // title:'正在生成PDF所需的图片...'
  331. // })
  332. // const imageUrl = await this.downloadZtzdfximage();
  333. // this.pdfImages.push(imageUrl);
  334. // for(const d of this.reportData.dimensionAnalysis){
  335. // const fileurl = await this.generateScoreImage(d);
  336. // this.pdfImages.push(fileurl)
  337. // }
  338. // this.$showToast(`生成成功,共计${this.pdfImages.length}张`);
  339. // uni.hideLoading();
  340. // console.log(this.pdfImages);
  341. // },
  342. // Promise.all方法,性能更高
  343. async createPdf(){
  344. uni.showLoading({
  345. title:'正在生成PDF所需的图片...'
  346. })
  347. try {
  348. const ztzdfximagePromise = this.downloadZtzdfximage();
  349. const dimensionImagePromises = this.reportData.dimensionAnalysis.map(d => {
  350. return this.generateScoreImage(d,d.scoreSpreads||[]);
  351. });
  352. const allImageUrls = await Promise.all([
  353. ztzdfximagePromise,
  354. ...dimensionImagePromises
  355. ]);
  356. this.pdfImages = allImageUrls;
  357. this.$api.post('/core/report/reportToPdf',{
  358. images:this.pdfImages,
  359. reportId:this.reportId
  360. }).then(({data:res})=>{
  361. if(res.code!==0) return this.$showToast(res.msg)
  362. uni.hideLoading();
  363. this.$showToast('生成成功');
  364. setTimeout(()=>{
  365. uni.redirectTo({
  366. url:'/pagesHome/report'
  367. })
  368. },1500)
  369. })
  370. } catch (error) {
  371. uni.hideLoading();
  372. console.error('生成图片过程中发生错误:', error);
  373. uni.showToast({ title: '生成图片失败,请重试', icon: 'none' });
  374. }
  375. },
  376. // 绘制主函数
  377. async generateScoreImage(dimensionData, scoreData) {
  378. return new Promise(resolve => {
  379. console.log('开始生成图片...');
  380. // --- 1. 定义尺寸和样式 ---
  381. const canvasWidth = 588;
  382. const headerHeight = 26;
  383. const rowHeight = 54;
  384. const totalHeight = headerHeight + rowHeight * scoreData.length;
  385. const leftColWidth = 280;
  386. const rightColWidth = 308;
  387. // --- 2. 获取 Canvas 节点 ---
  388. const query = uni.createSelectorQuery().in(this);
  389. query.select('#score-canvas')
  390. .fields({
  391. node: true,
  392. size: true
  393. })
  394. .exec(async (res) => {
  395. if (!res || !res[0] || !res[0].node) {
  396. console.error('获取 Canvas 节点失败,请检查 canvas-id 和 type="2d" 是否正确设置。');
  397. uni.showToast({
  398. title: '组件初始化失败',
  399. icon: 'none'
  400. });
  401. return;
  402. }
  403. const canvasNode = res[0].node;
  404. const ctx = canvasNode.getContext('2d');
  405. const dpr = uni.getSystemInfoSync().pixelRatio;
  406. // --- 3. 设置画布尺寸和缩放以适应高分屏 ---
  407. canvasNode.width = canvasWidth * dpr;
  408. canvasNode.height = totalHeight * dpr;
  409. ctx.scale(dpr, dpr);
  410. // --- 4. 开始绘制 ---
  411. // 绘制大背景
  412. ctx.fillStyle = '#FFFFFF';
  413. ctx.fillRect(0, 0, canvasWidth, totalHeight);
  414. // --- 5. 绘制表头 ---
  415. // 左侧表头背景
  416. ctx.fillStyle = dimensionData.thbgcolor;
  417. ctx.fillRect(0, 0, leftColWidth, headerHeight);
  418. // 右侧表头背景
  419. ctx.fillRect(leftColWidth, 0, rightColWidth, headerHeight);
  420. // 左侧表头文字
  421. ctx.fillStyle = dimensionData.thtextcolor;
  422. ctx.font = 'bold 9px sans-serif';
  423. ctx.textBaseline = 'middle';
  424. ctx.textAlign = 'left';
  425. ctx.fillText('主题', 15, headerHeight / 2);
  426. // 左侧表头分割线
  427. ctx.strokeStyle = 'rgba(255,255,255,0.24)';
  428. ctx.lineWidth = 1;
  429. ctx.beginPath();
  430. ctx.moveTo(leftColWidth - 54, 0);
  431. ctx.lineTo(leftColWidth - 54, headerHeight);
  432. ctx.stroke();
  433. // 影响力分右侧分割线 (Header)
  434. ctx.beginPath();
  435. ctx.moveTo(leftColWidth, 0);
  436. ctx.lineTo(leftColWidth, headerHeight);
  437. ctx.stroke();
  438. ctx.textAlign = 'center';
  439. ctx.fillText('影响力分', leftColWidth - 27, headerHeight / 2);
  440. // 右侧表头分割线
  441. ctx.beginPath();
  442. ctx.moveTo(leftColWidth + rightColWidth / 2, 0);
  443. ctx.lineTo(leftColWidth + rightColWidth / 2, headerHeight);
  444. ctx.stroke();
  445. // 右侧表头文字
  446. ctx.fillText('认同度分', leftColWidth + rightColWidth / 4, headerHeight / 2);
  447. ctx.fillText('重要性分', leftColWidth + rightColWidth * 0.75, headerHeight / 2);
  448. // --- 6. 循环绘制每一行 ---
  449. for (let i = 0; i < scoreData.length; i++) {
  450. const item = scoreData[i];
  451. const yPos = headerHeight + i * rowHeight;
  452. this.drawTableItem(ctx, item, yPos, leftColWidth, rightColWidth, rowHeight, dimensionData);
  453. }
  454. // --- 7. 绘制最外层边框 ---
  455. ctx.strokeStyle = dimensionData.bordercolor;
  456. ctx.lineWidth = 1;
  457. ctx.strokeRect(0, 0, canvasWidth, totalHeight);
  458. // --- 9. 生成图片 ---
  459. uni.hideLoading();
  460. uni.canvasToTempFilePath({
  461. canvas: canvasNode,
  462. x: 0,
  463. y: 0,
  464. width: canvasWidth,
  465. height: totalHeight,
  466. destWidth: canvasWidth * dpr,
  467. destHeight: totalHeight * dpr,
  468. success: async (result) => {
  469. console.log('图片生成成功!', result.tempFilePath);
  470. const fileurl = await this.uploadFilePromise(result.tempFilePath);
  471. console.log(fileurl, 'fileurl');
  472. resolve(fileurl)
  473. },
  474. fail: (err) => {
  475. console.error('图片生成失败', err);
  476. uni.showToast({
  477. title: '图片生成失败',
  478. icon: 'none'
  479. });
  480. }
  481. }, this);
  482. });
  483. })
  484. },
  485. drawTableItem(ctx, item, y, leftW, rightW, h, dimensionData) {
  486. // 1. 设置通用边框样式
  487. ctx.strokeStyle = dimensionData.bordercolor;
  488. ctx.lineWidth = 1;
  489. // 绘制整行下边框 (贯穿左右)
  490. ctx.beginPath();
  491. ctx.moveTo(0, y + h);
  492. ctx.lineTo(leftW + rightW, y + h);
  493. ctx.stroke();
  494. // --- 计算高度 ---
  495. // 必须先设置字体,否则 measureText 计算不准确
  496. ctx.font = 'bold 9px sans-serif';
  497. let themeHeight = this.calculateWrappedTextHeight(ctx, item.theme, 14, leftW - 54 - 20);
  498. ctx.font = '8px sans-serif';
  499. let questionHeight = this.calculateWrappedTextHeight(ctx, item.question, 10, leftW - 54 - 20);
  500. let totalTextHeight = themeHeight + 4 + questionHeight; // 4 is spacing
  501. let startY = y + (h - totalTextHeight) / 2;
  502. // --- 绘制左侧文字 ---
  503. // Theme Title
  504. ctx.fillStyle = dimensionData.titlecolor;
  505. ctx.font = 'bold 9px sans-serif';
  506. ctx.textAlign = 'left';
  507. ctx.textBaseline = 'top';
  508. this.drawWrappedTextTop(ctx, item.theme, 10, startY, 14, leftW - 54 - 20);
  509. // Question Tip
  510. ctx.fillStyle = '#002846';
  511. ctx.font = '8px sans-serif';
  512. this.drawWrappedTextTop(ctx, item.question, 10, startY + themeHeight + 4, 10, leftW - 54 - 20);
  513. // Score
  514. ctx.fillStyle = '#002846';
  515. ctx.font = 'bold 12px DIN, sans-serif';
  516. ctx.textAlign = 'center';
  517. ctx.textBaseline = 'middle';
  518. ctx.fillText((item.memeber && item.memeber.avgScore) || 0, leftW - 27, y + h / 2);
  519. // 2. 右侧
  520. const rightX = leftW;
  521. // 绘制中间线
  522. const centerX = rightX + rightW / 2;
  523. // Bar Charts
  524. const barHeight = 10;
  525. const barY = y + (h - barHeight) / 2;
  526. // Agreement (Left, Red/Purple)
  527. // Width = avgAgreement / 6 * 100% of half width?
  528. const maxVal = 6;
  529. const halfW = rightW / 2;
  530. const avgAgreement = (item.memeber && item.memeber.avgAgreement) || 0;
  531. const avgVital = (item.memeber && item.memeber.avgVital) || 0;
  532. const agreeW = (avgAgreement / maxVal) * halfW;
  533. const vitalW = (avgVital / maxVal) * halfW;
  534. // --- 绘制背景轨道 (灰色) ---
  535. // 模仿 CSS .vbt2r-tb-l-pre-bg: width: calc(100% - 16px); height: 4px;
  536. // 左右各留 8px 空隙?或者就是简单的横条
  537. const trackHeight = 4;
  538. const trackY = y + (h - trackHeight) / 2;
  539. ctx.fillStyle = '#E6EAED';
  540. // 左侧轨道背景 (从右向左)
  541. this.drawRoundedRect(ctx, rightX + 8, trackY, halfW - 8, trackHeight, 2);
  542. // 右侧轨道背景 (从左向右)
  543. this.drawRoundedRect(ctx, centerX, trackY, halfW - 8, trackHeight, 2);
  544. // Draw Agreement Bar (grows from center to left)
  545. ctx.fillStyle = '#BA8EB4';
  546. // 左侧条,圆角在左边 [2, 0, 0, 2]
  547. this.drawCustomRoundedRect(ctx, centerX - agreeW, barY, agreeW, barHeight, [2, 0, 0, 2]);
  548. // Draw Vital Bar (grows from center to right)
  549. ctx.fillStyle = '#80C8C8';
  550. // 右侧条,圆角在右边 [0, 2, 2, 0]
  551. this.drawCustomRoundedRect(ctx, centerX, barY, vitalW, barHeight, [0, 2, 2, 0]);
  552. // --- 绘制数字标签 ---
  553. const tagW = 16;
  554. const tagH = 20;
  555. // 左标签位置 (中心点)
  556. // CSS: left: -8px (relative to bar start/end).
  557. // 实际上是在条形图的末端(远离中心的那一端)
  558. // 左侧条形图末端 x = centerX - agreeW
  559. // 标签中心 x = centerX - agreeW
  560. this.drawValueTag(ctx, avgAgreement, centerX - agreeW, y + h/2, '#904A87', 'rgba(131,52,120,0.19)', 'rgba(118,30,106,0.1)');
  561. // 右标签位置
  562. // 右侧条形图末端 x = centerX + vitalW
  563. this.drawValueTag(ctx, avgVital, centerX + vitalW, y + h/2, '#199C9C', 'rgba(51,167,167,0.31)', 'rgba(118,30,106,0.1)');
  564. },
  565. // 辅助函数:绘制带样式的数值标签
  566. drawValueTag(ctx, value, cx, cy, textColor, borderColor, shadowColor) {
  567. const width = 16;
  568. const height = 20;
  569. const x = cx - width / 2;
  570. const y = cy - height / 2;
  571. const radius = 4;
  572. ctx.save();
  573. // 阴影
  574. ctx.shadowOffsetX = 0;
  575. ctx.shadowOffsetY = 4;
  576. ctx.shadowBlur = 8;
  577. ctx.shadowColor = shadowColor;
  578. // 背景
  579. ctx.fillStyle = '#FFFFFF';
  580. this.drawRoundedRectPath(ctx, x, y, width, height, radius);
  581. ctx.fill();
  582. // 边框 (取消阴影绘制边框)
  583. ctx.shadowColor = 'transparent';
  584. ctx.strokeStyle = borderColor;
  585. ctx.lineWidth = 1;
  586. ctx.stroke();
  587. // 文字
  588. ctx.fillStyle = textColor;
  589. ctx.font = 'bold 12px DIN, sans-serif';
  590. ctx.textAlign = 'center';
  591. ctx.textBaseline = 'middle';
  592. ctx.fillText(value, cx, cy);
  593. ctx.restore();
  594. },
  595. // 辅助函数:绘制圆角矩形路径
  596. drawRoundedRectPath(ctx, x, y, w, h, r) {
  597. ctx.beginPath();
  598. ctx.moveTo(x + r, y);
  599. ctx.lineTo(x + w - r, y);
  600. ctx.arcTo(x + w, y, x + w, y + h, r);
  601. ctx.lineTo(x + w, y + h - r);
  602. ctx.arcTo(x + w, y + h, x, y + h, r);
  603. ctx.lineTo(x + r, y + h);
  604. ctx.arcTo(x, y + h, x, y, r);
  605. ctx.lineTo(x, y + r);
  606. ctx.arcTo(x, y, x + w, y, r);
  607. ctx.closePath();
  608. },
  609. // 辅助函数:绘制圆角矩形 (简单版)
  610. drawRoundedRect(ctx, x, y, w, h, r) {
  611. this.drawRoundedRectPath(ctx, x, y, w, h, r);
  612. ctx.fill();
  613. },
  614. // 辅助函数:绘制自定义四个角圆角的矩形
  615. drawCustomRoundedRect(ctx, x, y, w, h, radii) {
  616. // radii: [tl, tr, br, bl]
  617. if (!Array.isArray(radii)) radii = [radii, radii, radii, radii];
  618. const [tl, tr, br, bl] = radii;
  619. ctx.beginPath();
  620. ctx.moveTo(x + tl, y);
  621. ctx.lineTo(x + w - tr, y);
  622. ctx.arcTo(x + w, y, x + w, y + h, tr);
  623. ctx.lineTo(x + w, y + h - br);
  624. ctx.arcTo(x + w, y + h, x, y + h, br);
  625. ctx.lineTo(x + bl, y + h);
  626. ctx.arcTo(x, y + h, x, y, bl);
  627. ctx.lineTo(x, y + tl);
  628. ctx.arcTo(x, y, x + w, y, tl);
  629. ctx.closePath();
  630. ctx.fill();
  631. },
  632. // 辅助函数:计算自动换行文字的总高度
  633. calculateWrappedTextHeight(ctx, text, lineHeight, maxWidth) {
  634. if (!text) return 0;
  635. let words = text.split('');
  636. let line = '';
  637. let height = lineHeight; // 至少有一行
  638. for (let n = 0; n < words.length; n++) {
  639. let testLine = line + words[n];
  640. let metrics = ctx.measureText(testLine);
  641. let testWidth = metrics.width;
  642. if (testWidth > maxWidth && n > 0) {
  643. line = words[n];
  644. height += lineHeight;
  645. } else {
  646. line = testLine;
  647. }
  648. }
  649. return height;
  650. },
  651. // 辅助函数:绘制自动换行文字 (从顶部开始)
  652. drawWrappedTextTop(ctx, text, x, y, lineHeight, maxWidth) {
  653. if (!text) return;
  654. let words = text.split('');
  655. let line = '';
  656. let currentY = y;
  657. for (let n = 0; n < words.length; n++) {
  658. let testLine = line + words[n];
  659. let metrics = ctx.measureText(testLine);
  660. let testWidth = metrics.width;
  661. if (testWidth > maxWidth && n > 0) {
  662. ctx.fillText(line, x, currentY); // 使用 currentY 作为顶部基线
  663. line = words[n];
  664. currentY += lineHeight;
  665. } else {
  666. line = testLine;
  667. }
  668. }
  669. ctx.fillText(line, x, currentY);
  670. },
  671. calculateScaleAndPosition() {
  672. uni.getSystemInfo({
  673. success: (res) => {
  674. const screenWidth = res.windowWidth; // 手机屏幕的宽度
  675. const pcContentWidth = 630; // PC端内容的原始宽度
  676. this.scale = screenWidth / pcContentWidth;
  677. this.$nextTick(() => {
  678. if (this.$refs.ztzdfxRef) {
  679. this.initZtzdfxChart();
  680. }
  681. });
  682. }
  683. });
  684. },
  685. calculatePdfContainerHeight() {
  686. uni.createSelectorQuery().in(this).select('#pdfContainer').boundingClientRect(rect => {
  687. if (rect) {
  688. this.originalContainerHeight = rect.height;
  689. this.containerScaledHeight = this.originalContainerHeight * this.scale;
  690. // console.log('原始高度:', this.originalContainerHeight, '缩放比例:', this.scale, '缩放后高度:', this.containerScaledHeight);
  691. }
  692. }).exec();
  693. },
  694. downloadZtzdfximage(){
  695. return new Promise(resolve=>{
  696. if (!this.isChartReady) return console.log('图表尚未准备好');
  697. const chartRef = this.$refs.ztzdfxRef;
  698. if (!chartRef) return console.log('无法找到图表组件');
  699. chartRef.canvasToTempFilePath({
  700. success: async (res) => {
  701. const imageUrl = await this.uploadFilePromise(res.tempFilePath);
  702. console.log(imageUrl,'imageUrl');
  703. resolve(imageUrl)
  704. },
  705. fail: (err) => {
  706. console.log('生成图片失败:', err);
  707. }
  708. });
  709. })
  710. },
  711. uploadFilePromise(url) {
  712. return new Promise((resolve, reject) => {
  713. let a = uni.uploadFile({
  714. url: BaseApi+'/uploadFile',
  715. filePath: url,
  716. name: 'file',
  717. success: (res) => {
  718. setTimeout(() => {
  719. let data = JSON.parse(res.data)
  720. if(data&&data.code===0){
  721. resolve(data.data);
  722. }else this.$showToast(data?.msg)
  723. }, 1000);
  724. },
  725. fail: err =>{
  726. resolve('');
  727. }
  728. });
  729. });
  730. },
  731. async initZtzdfxChart() {
  732. let xdata = ['宗旨与动机', '外部流程、系统与结构', '关系', '内部流程、系统与结构', '学习', '领导力'].reverse();
  733. let yvalue = [40, 25, 30, 35, 33, 47].reverse();
  734. let ycolor = [['#771E6A','#771E6A'],['#009191','#009191'],['#FFD750','#FFD750'],['#4EB2B2','#4EB2B2'],['#AFCDF5','#AFCDF5'],['#002846','#002846']].reverse();
  735. let yData = yvalue.map((v, i) => {
  736. return {
  737. value: v,
  738. itemStyle: {
  739. color: new echarts.graphic.LinearGradient(
  740. 0, 0, 1, 0,
  741. [
  742. { offset: 0, color: ycolor[i][0] },
  743. { offset: 1, color: ycolor[i][1] }
  744. ]
  745. ),
  746. borderRadius: [0, 4, 4, 0]
  747. }
  748. };
  749. });
  750. const chart = await this.$refs.ztzdfxRef.init(echarts);
  751. let option = {
  752. grid: {
  753. left: '2%',
  754. right: '10%',
  755. bottom: '0%',
  756. top: '10%',
  757. containLabel: true
  758. },
  759. xAxis: {
  760. type: 'value',
  761. boundaryGap: [0, 0.01],
  762. splitLine: {
  763. show: false
  764. },
  765. // 隐藏X轴轴线和标签,使图表更干净
  766. axisLine: {
  767. show: false
  768. },
  769. axisLabel: {
  770. show: true,
  771. color: '#193D59',
  772. fontSize: 10*this.scale // X轴刻度值也不显示
  773. }
  774. },
  775. yAxis: {
  776. type: 'category',
  777. data: xdata,
  778. axisLine: {
  779. show: true, // 设置为 true 来显示Y轴的轴线
  780. lineStyle: {
  781. color: '#ECEEF5',
  782. width: 1
  783. }
  784. },
  785. // 隐藏Y轴上的小刻度线(如果你想保留可以设为true)
  786. axisTick: {
  787. show: false
  788. },
  789. axisLabel: {
  790. color: '#193D59',
  791. fontSize: 10*this.scale
  792. }
  793. },
  794. series: [
  795. {
  796. type: 'bar',
  797. barWidth: `${8*this.scale}px`,
  798. data: yData
  799. }
  800. ]
  801. };
  802. chart.setOption(option);
  803. this.isChartReady = true;
  804. this.$nextTick(() => {
  805. this.calculatePdfContainerHeight();
  806. });
  807. },
  808. }
  809. };
  810. </script>
  811. <style scoped lang="scss">
  812. .offscreen-canvas {
  813. position: fixed;
  814. top: -9999px;
  815. left: -9999px;
  816. }
  817. .pdf_btn{
  818. padding: 15rpx 20rpx;
  819. border-radius: 20rpx;
  820. font-size: 28rpx;
  821. color: #FFFFFF;
  822. background: #189B9B;
  823. position: fixed;
  824. right: 30rpx;
  825. bottom: 100rpx;
  826. z-index: 1000;
  827. }
  828. .page-wrappe{
  829. width: 100%;
  830. background: #FFFFFF;
  831. overflow-x: hidden;
  832. overflow-y: auto;
  833. .pdf-container{
  834. width: 630px;
  835. padding: 0 20rpx;
  836. box-sizing: border-box;
  837. transform-origin: top left;
  838. }
  839. }
  840. @import '../static/pdf.scss';
  841. </style>