| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410 |
- <template>
- <view class="page-wrappe">
- <cus-header title=' ' bgColor="transparent"></cus-header>
- <view id="pdfContainer" class="pdf-container" :style="{'transform':'scale('+scale+')', 'height': containerScaledHeight + 'px'}" v-if="reportData">
- <!-- 封面 -->
- <view class="cd_box fm2 adffc" style="border: none;margin-top: 20px;height: 868px;">
- <img class="fm2-logo" src="https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fm_logo.png">
- <img class="fm2-logo2" src="https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fm_logo2.png">
- <img class="fm2-perill" src="https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fm_perill.png">
- <view class="fm2-line"></view>
- <view class="fm2-p" style="margin-top: 4px;font-size: 38px;">团队发展动态评估报告(团队版)</view>
- <view class="fm2-texts adf">
- <view class="fm2-texts-pre adf" style="margin-top: 6px;">
- <view class="fm2-texts-pre-span">客户名称:</view>
- <view class="fm2-texts-pre-val">{{ reportData.teamInfo.enterpriseName||'' }}</view>
- </view>
- <view class="fm2-texts-pre adf" style="margin-top: 6px;">
- <view class="fm2-texts-pre-span">团队名称:</view>
- <view class="fm2-texts-pre-val">{{ reportData.teamInfo.teamName||'' }}</view>
- </view>
- <view class="fm2-texts-pre adf" style="margin-top: 6px;">
- <view class="fm2-texts-pre-span">团队职能类型:</view>
- <view class="fm2-texts-pre-val">{{ reportData.teamInfo.functionName||'' }}</view>
- </view>
- <view class="fm2-texts-pre adf" style="margin-top: 6px;">
- <view class="fm2-texts-pre-span">团队模式类型:</view>
- <view class="fm2-texts-pre-val">{{ reportData.teamInfo.organizationName||'' }}</view>
- </view>
- <view class="fm2-texts-pre adf" style="margin-top: 6px;">
- <view class="fm2-texts-pre-span">评估发起人:</view>
- <view class="fm2-texts-pre-val">{{ reportData.teamInfo.initiator||'' }}</view>
- </view>
- <view class="fm2-texts-pre adf" style="margin-top: 6px;">
- <view class="fm2-texts-pre-span">报告生成时间:</view>
- <view class="fm2-texts-pre-val">{{ reportData.teamInfo.reportDate||'' }}</view>
- </view>
- </view>
- <view class="fm2-tip" style="margin-top: 12px;">免责声明:本团队测评报告基于您方团队填写的测评数据及相关信息生成,深圳创衡管理顾问有限公司不对报告内容的真实性、准确性和完整性负责。本报告仅供您了解团队情况、优化管理决策提供参考。报告结论不构成任何法律、商业或投资建议,亦不替代专业咨询意见。我方不对因使用本报告内容而产生的任何直接或间接损失承担责任。</view>
- </view>
- <!-- 介绍 -->
- <view class="cd_box" style="border: none">
- <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 24px'}">
- <view class="vt-left" style="color: #FFFFFF;">PERILL模型介绍</view>
- <view class="vt-right">团队发展动态评估报告(团队版) </view>
- </view>
- <view class="v2-box">
- <img class="vb-img1" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_box_img1.png'">
- <view class="v2-p">PERILL团队发展动态评估源于团队教练辅导领域的先驱、管理思维与团队绩效领域的权威、全球顶尖团队教练David Clutterbuck教授及其团队通过深入研究,提炼出影响团队绩效的140多个基于实证的因素,整合而成的团队评估和提升工具-PERILL模型。</view>
- <view class="v2-p" style="margin-top: 8px;">创衡国际基于10多年来在全球与200多家具有前瞻性的国际公司以及国内具有行业代表性公司的合作经验,结合CCMI的PERILL评估工具,在中国推出的团队发展动态评估系统,旨在帮助团队更全面、更有效地从六个维度评估团队的发展现状,为支持团队成为高价值创造团队提供全景式的客观评估。</view>
- <view class="v2-p" style="margin-top: 8px;">PERILL团队发展动态评估(团队版)的主体内容由<span>{{ reportData.teamInfo.questionCount }}</span>个关于团队的描述组成。</view>
- </view>
- <view class="v2-six">
- <view class="vsix-title">PERILL六大纬度</view>
- <view class="vsix-p">PERILL评估提供了一个复杂的团队系统概览,它并非针对孤立的问题,也不是简单的优缺点,而是着眼于团队系统的复杂性。它通过6个影响因素(如下所述)提出问题,以揭示团队系统各要素之间的联系,以及这些联系如何影响团队的高效运作能力。</view>
- <view class="vsix-boxs">
- <view class="vsb adfac" v-for="(item,index) in sixWd" :key="index">
- <img class="vsb-img" :src="item.img"/>
- <view class="vsb-right">
- <view class="vsbr-top adfac">
- <view class="vsbrt-type" :style="{'background':item.color}">{{ item.type }}</view>
- <view class="vsbrt-title" :style="{'color':item.color}">{{ item.title }}</view>
- </view>
- <view class="vsbr-desc">{{ item.desc }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 总体评估分析 -->
- <view class="cd_box adffc" style="border: none;">
- <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)'}">
- <view class="vt-left">总体评估分析</view>
- <view class="vt-right">团队发展动态评估报告(团队版) </view>
- </view>
- <view class="v2-box" style="border: 1px solid #33A7A7;">
- <img class="vb-img1" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_box_img1.png'">
- <view class="v2-p2">报告的核心是PERILL评估分析下的整体团队表现。这包括团队在PERILL模型每个关键要素上的综合得分,通过结合得分和置信指数,我们能够展示出高功能和低功能领域。</view>
- <view class="v2-p2" style="margin-top: 2px;font-weight: 400;color: #002846;font-size: 10px;">下面图中的位置标记显示了团队按影响力划分的总分。</view>
- <view class="vb-category" v-if="reportData&&reportData.teamInfo">
- <view class="vbc-pre adfac">
- <view class="vbcp-yuan y1"></view>
- <view class="vbcp-text">团队领导者 Team Leader {{ reportData.teamInfo.leaderCount||0 }}人</view>
- </view>
- <view class="vbc-pre adfac">
- <view class="vbcp-yuan y2"></view>
- <view class="vbcp-text">团队成员 Team Member {{ reportData.teamInfo.memberCount||0 }}人</view>
- </view>
- <view class="vbc-pre adfac">
- <view class="vbcp-yuan y3"></view>
- <view class="vbcp-text">利益相关方 Stakeholder {{ reportData.teamInfo.stackCount||0 }}人</view>
- </view>
- <view class="vbc-pre adfac">
- <view class="vbcp-yuan y4"></view>
- <view class="vbcp-text">赞助人/出资人 Sponsor {{ reportData.teamInfo.sponsorCount||0 }}人</view>
- </view>
- </view>
- <view style="width:360px;height:360px;margin: 0 auto;" class="pdfEchart">
- <l-echart ref="ztzdfxRef" :canvas2d="true" @finished="initZtzdfxChart" style="width: 100%;height: 100%;"></l-echart>
- </view>
- <view class="v2b-tip-title" style="color: #002846;">注: 关于认同度、重要性分、影响力分的定义</view>
- <view class="v2b-tip-memo">
- a.“认同度分”,指标逻辑为团队全体对当前主题所对应各问卷题目认同度评分的均值,用来表征团队对这一主题问卷所陈述内容与团队情况的相符合程度的平均认知,最高分:5分,最低分:1分;<br>
- b.“重要分”,指标逻辑为根据团队全体对当前主题所对应各问卷题目重要性评分的均值,用来表征团队对这一主题问卷所陈述内容对于团队重要性的平均认知,最高分:5分,最低分:1分;<br>
- c.“影响力分”,指标逻辑为综合团队全体对当前主题所对应各问卷题目的认同度与重要性的评分数据测算而来,用来表征团队对这一主题问卷所陈述内容对于团队的影响力水平,最高分:5分,最低分:1分;</view>
- <view class="v2b-title">总评分表</view>
- <view class="sum_score_table">
- <div class="sst-th adfac">
- <div class="sstt1">PERILL维度</div>
- <div class="sstt2">
- <div class="sstt2-title">团队全员</div>
- <div class="sstt2-subs adfac">
- <div class="sstt2-s sstt-td">认同度</div>
- <div class="sstt2-s sstt-td">重要性</div>
- <div class="sstt2-s sstt-td">影响力</div>
- </div>
- </div>
- <div class="sstt3">
- <div class="sstt3-pre adfac">
- <div class="sstt-td">利益相关者</div>
- <div class="sstt-td notr">赞助者</div>
- </div>
- <div class="sstt3-pre adfac">
- <div class="sstt-td">影响力</div>
- <div class="sstt-td notr">影响力</div>
- </div>
- </div>
- </div>
- <div class="sst-trs">
- <div class="sstr-pre adfac" :class="{'spbg':index%2===1,'lasttr':index===perillData.length-1}" v-for="(item,index) in perillData" :key="index">
- <div class="sstr-td1">{{ item.dimension }}</div>
- <div class="sstr-td2">{{ item.teamRecognition }}</div>
- <div class="sstr-td2">{{ item.teamImportance }}</div>
- <div class="sstr-td2">{{ item.teamInfluence }}</div>
- <div class="sstr-td2">{{ item.stakeholderInfluence }}</div>
- <div class="sstr-td2 notr">{{ item.sponsorInfluence }}</div>
- </div>
- </div>
- </view>
- </view>
- </view>
- <!-- 总体评估分析 评估建议-->
- <view class="cd_box adffc" style="border: none;">
- <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)'}">
- <view class="vt-left">总体评估分析</view>
- <view class="vt-right">团队发展动态评估报告(团队版) </view>
- </view>
- <view class="v2-box" style="border: 1px solid #33A7A7;">
- <img class="vb-img1" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_box_img1.png'">
- <view class="v2b-title" style="margin-top: 0;">评估建议</view>
- <view class="v2b-p" v-html="renderMarkdown(reportData.totalDiagnosisSuggest||'')"></view>
- <view class="v2b-title">评估结果</view>
- <view class="v2b-p" v-html="renderMarkdown(reportData.totalDiagnosticOutput||'')"></view>
- </view>
- </view>
- <!-- 多维度 -->
- <canvas type="2d" canvas-id="score-canvas" id="score-canvas" class="offscreen-canvas"></canvas>
- <template v-if="reportData&&reportData.dimensionAnalysis&&reportData.dimensionAnalysis.length">
- <block v-for="(item,index) in reportData.dimensionAnalysis" :key="index">
- <view class="cd_box adffc" style="border: none;">
- <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/'+(typeDict[item.title]||'zzdj')+'_title_bg.png)','padding':'0 8px 0 24px'}">
- <view class="vt-left" :class="{'black':(item.title=='人际关系'||item.title=='学习')}">{{ item.title }}</view>
- <view class="vt-right">团队发展动态评估报告(团队版) </view>
- </view>
- <view class="v2-box" :style="{'border':'none','padding':0}">
- <view class="v2-p2">{{ item.desc }}</view>
- <view class="vb-table adf" :style="{'border':'1px solid '+item.bordercolor,'margin-top':'12px'}">
- <view class="vbt2-left">
- <view class="vbt2l-th adf" :style="{'background':item.thbgcolor,'color':item.thtextcolor}">
- <view class="vbt2l-th-title adfac">主题</view>
- <view class="vbt2l-th-score adfacjc">影响力分</view>
- </view>
- <view class="vbt2l-pre" v-for="(ss,si) in item.scoreSpreads" :key="si" :style="{'border-bottom':'1px solid '+item.bordercolor}">
- <view class="vbt2l-pre-l adffc">
- <view class="vbt2l-pre-l-title" :style="{'color':item.titlecolor}">{{ ss.theme||'' }}</view>
- <view class="vbt2l-pre-l-tip">{{ ss.question||'' }}</view>
- </view>
- <view class="vbt2l-pre-r adfacjc">{{ ss.regular.avgScore||0 }}</view>
- </view>
- </view>
- <view class="vbt2-right adffc">
- <view class="vbt2r-th adf" :style="{'background':item.thbgcolor,'color':item.thtextcolor}">
- <view class="vbt2r-pre adfacjc">认同度分</view>
- <view class="vbt2r-pre adfacjc">重要性分</view>
- </view>
- <view class="vbt2r-tb adf">
- <view class="vbt2r-tb-l adffc">
- <view class="vbt2r-tb-l-pre red adfac" v-for="(ss,si) in item.scoreSpreads" :key="si" :style="{'border-bottom':'1px solid '+item.bordercolor}">
- <view class="vbt2r-tb-l-pre-bg"></view>
- <view class="vbt2r-tb-l-pre-zzt red" :style="{'width':(ss.regular.avgAgreement/6*100)+'%'}">
- <view class="vbt2r-tb-l-pre-zzt-numl">{{ ss.regular.avgAgreement||0 }}</view>
- </view>
- </view>
- </view>
- <view class="vbt2r-tb-l">
- <view class="vbt2r-tb-l-pre green adfac" v-for="(ss,si) in item.scoreSpreads" :key="si" :style="{'border-bottom':'1px solid '+item.bordercolor}">
- <view class="vbt2r-tb-l-pre-bg r"></view>
- <view class="vbt2r-tb-l-pre-zzt green" :style="{'width':(ss.regular.avgVital/6*100)+'%'}">
- <view class="vbt2r-tb-l-pre-zzt-numr">{{ ss.regular.avgVital||0 }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="v2-subp">评估结果</view>
- <view class="v2-p" style="margin-top: 6px;" v-html="renderMarkdown2(item.diagnosisOutput||'')"></view>
- </view>
- </view>
- <view class="cd_box adffc" style="border: none;">
- <view class="v2-top adfacjb" :style="{'background-image':'url(https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/'+(typeDict[item.title]||'zzdj')+'_title_bg.png)','padding':'0 8px 0 24px'}">
- <view class="vt-left" :class="{'black':(item.title=='人际关系'||item.title=='学习')}">{{ item.title }}</view>
- <view class="vt-right">团队发展动态评估报告(团队版) </view>
- </view>
- <view class="v2-box" :style="{'border':'none','padding':0}">
- <view class="v2-p" style="margin-top: 6px;" v-html="renderMarkdown2(item.diagnosisSuggest||'')"></view>
- </view>
- </view>
- </block>
- </template>
- <!-- 封底页 -->
- <view class="cd_box fdy" style="border: none;">
- <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)'}">
- <view class="vt-left" style="color: #FFFFFF;">结言</view>
- <view class="vt-right">团队发展动态评估报告(团队版)</view>
- </view>
- <view class="fdy-title">致团队:从评估到行动,开启团队进化跃迁之旅</view>
- <view class="fdy-p">当您阅读至此,首先恭喜您和团队伙伴共同完成了一次完整、专业的团队评估!这标志着团队发展旅程中一个充满可能性的新起点。</view>
- <view class="fdy-p">作为团队教练,我们希望与您分享PERILL评估的科学价值,并为您描绘从系统诊断到协同进化的路径。 </view>
- <view class="fdy-subtitle">一、这份报告为团队带来了什么? </view>
- <view class="fdy-p" style="margin-top: 6px;">这份报告整合了团队内部(如:团队领导者与成员)与外部(如:客户、合作伙伴、赞助人)的多方视角,为您呈现团队作为一个“系统”的真实状态。它帮助团队:</view>
- <view class="fdy-p" style="margin-top: 0px;text-indent: 24px;">· 看见惯性模式与盲点——那些日常被忽略的协作断点、沟通落差与共识偏差。</view>
- <view class="fdy-p" style="margin-top: 0px;text-indent: 24px;">· 获得立体画像而非主观印象——基于数据而非直觉,客观定位团队在六大维度的表现。</view>
- <view class="fdy-p" style="margin-top: 0px;text-indent: 24px;">· 识别高杠杆改进区——不只列出问题,更揭示“从哪里改变,能带动全局提升”。</view>
- <view class="fdy-subtitle">二、PERILL 评估的科学洞察:不只是分数,更是系统思维</view>
- <view class="fdy-p" style="margin-top: 6px;">PERILL源自David Clutterbuck教授数十年的实证研究,其价值远超过一份评分报告。它帮助团队实现:</view>
- <view class="fdy-subtitle2">从“凭感觉管理”到“系统诊断”</view>
- <view class="fdy-p" style="margin-top: 6px;text-indent: 24px;">传统团队讨论容易陷入“我觉得”“你认为”的主观争论。PERILL提供共同语言与结构框架,让对话基于事实,聚焦系统障碍而非个人指责。</view>
- <view class="fdy-subtitle2">揭示“维度关联”,避免单一解药</view>
- <view class="fdy-p" style="margin-top: 6px;text-indent: 24px;">PERILL 揭示六大维度间的动态关联,例如:</view>
- <view class="fdy-p" style="margin-top: 0px;text-indent: 24px;">· 人际关系(R)紧张 → 抑制信息共享 → 影响学习(L)与创新 → 动摇宗旨认同(P)。</view>
- <view class="fdy-p" style="margin-top: 0px;text-indent: 24px;">· 改进关键点:可能只需提升心理安全(R),即可激活学习(L)与协同(I)。</view>
- <view class="fdy-subtitle2">赋能团队成为“自我进化系统”</view>
- <view class="fdy-p" style="margin-top: 6px;text-indent: 24px;">评估过程本身就是一次深度对话与反思。通过共同诊断、共同制定行动,团队主人翁意识被激发,变革可持续性远高于外部强加的“方案”。</view>
- <view class="fdy-subtitle">三、接下来,团队可以如何行动?</view>
- <view class="fdy-p" style="margin-top: 8px;">报告只是开始,真正的进化发生在对话与实践中。可以依照团队的需求去安排以下内容</view>
- <view class="fdy-subtitle2">1. 召开一次“报告解读与共识工作坊”</view>
- <view class="fdy-p" style="margin-top: 6px;text-indent: 24px;">邀请专业团队教练与团队一起开放地探讨评估结果,理解数据背后的含义,并就<span style="font-weight: bold;">“我们接下来共同聚焦哪1-2个维度?”</span>达成共识。这个过程本身,就是一次强有力的团队对话与承诺建立。</view>
- <view class="fdy-subtitle2">2. 针对关键挑战,设计专题行动实验</view>
- <view class="fdy-subtitle2">3. 如需深度支持,可考虑引入团队教练辅导助力团队发展</view>
- <view class="fdy-p">每一支高价值团队,都始于对现状清醒的认知与共同进化的勇气。PERILL为团队提供了导航仪与路线图——下一步,行动在您们手中。</view>
- <view class="fdy-p">PERILL不止于评估,更在于赋能。期待与您和团队同行,见证未来的更多可能。</view>
- <view class="fdy-p" style="margin-top: 8px;">具体需求可联系您的团队教练 或 扫码联系“⼤衡同学”。</view>
- <view class="fdy-code adffcac">
- <img class="fdy-code-team" :src="'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/fdy_code.png'">
- <p style="margin-top: 0;font-size: 10px;color: #002846;line-height: 18px;">扫码联系大衡同学</p>
- </view>
- <view class="v2b-alert">注:团队发展本身就不是单一答案的过程,PERILL AI教练根据创衡独创团队教练方法论,可以从不同角度解读团队,发现那些隐藏的机会点。多元建议代表多元可能。您可以尝试再次生成评估报告,探索更多可能性。</view>
- </view>
- </view>
- <view class="pdf_btn" @click="createPdf">生成PDF</view>
- <view class="loading adffcacjc" v-if="isLoading">
- <u-loading-icon text="数据加载中,请耐心等待" :vertical="true" size="72" color="#FFFFFF" textSize="32" textColor="#FFFFFF"></u-loading-icon>
- </view>
- </view>
- </template>
- <script name="">
- import { BaseApi } from '@/http/baseApi.js';
- import * as echarts from '@/pagesHome/components/lime-echart/static/echarts.min.js'
- import lEchart from '@/pagesHome/components/lime-echart/components/l-echart/l-echart.vue'
-
- export default {
- name: 'ZtzdfxChart',
- components:{ lEchart },
- data() {
- return {
- isLoading: true,
- reportId:'',
- reportData: null,
- isChartReady: false,
- scale:1,
- originalContainerHeight: 0,
- containerScaledHeight: 'auto',
- typeDict: {
- '宗旨与动机':'zzdj',
- '外部流程、系统与结构':'wbjg',
- '人际关系':'rjgx',
- '内部流程、系统与结构':'nbjg',
- '学习':'xx',
- '领导力':'ldl'
- },
- sixWd: [
- {
- img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_p.png',
- type:'P',
- title:'宗旨与动机',
- desc:'指团队共享的目的和存在的意义, 包含对共同的愿景,目标和优先级的清晰度。',
- color:'#761E6A'
- },
- {
- img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_e.png',
- type:'E',
- title:'外部流程、系统与结构',
- desc:'指团队与其外部利益相关者 - 客户,供应商,股东,组织内的上级及其他团队的互动关系和协作机制。',
- color:'#009191'
- },
- {
- img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_r.png',
- type:'R',
- title:'人际关系',
- desc:'指团队成员共同工作时的关系状态–他们是否相互尊重和信任对方的能力,是否足够心理安全以能够坦诚沟通,是否真正关心彼此的幸福感等。',
- color:'#FFD750'
- },
- {
- img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_i.png',
- type:'I',
- title:'内部流程、系统与结构',
- desc:'指团队如何管理工作任务和流程(包括但不限于会议、任务分配和团队情绪等),互相支持以及高质量的沟通和决策。',
- color:'#4EB2B2'
- },
- {
- img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_l.png',
- type:'L',
- title:'学习',
- desc:'指团队如何应对多变的环境和保持持续的进步和成⻓,能够从经验中反思、提炼并应用知识的能力。',
- color:'#AFCDF5'
- },
- {
- img:'https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/versionTwo/intro_img_l2.png',
- type:'L',
- title:'领导力',
- desc:'指团队认为需要怎样的领导行为能够让他们,作为个人或者团队做到最好。团队可以和他们的领导者讨论他们的责任及承担方式,以帮助领导者成为他们需要的领导者。',
- color:'#002846'
- }
- ],
- pdfImages:[],
- perillData:[
- {
- filter: '宗旨与动机',
- dimension: '宗旨与动机(P)',
- teamRecognition: '-',
- teamImportance: '-',
- teamInfluence: '-',
- stakeholderInfluence: '-',
- sponsorInfluence: '-'
- },
- {
- filter: '外部流程、系统与结构',
- dimension: '外部流程及系统及架构(E)',
- teamRecognition: '-',
- teamImportance: '-',
- teamInfluence: '-',
- stakeholderInfluence: '-',
- sponsorInfluence: '-'
- },
- {
- filter: '人际关系',
- dimension: '人际关系(R)',
- teamRecognition: '-',
- teamImportance: '-',
- teamInfluence: '-',
- stakeholderInfluence: '-',
- sponsorInfluence: '-'
- },
- {
- filter: '内部流程、系统与结构',
- dimension: '内部流程及系统及架构(I)',
- teamRecognition: '-',
- teamImportance: '-',
- teamInfluence: '-',
- stakeholderInfluence: '-',
- sponsorInfluence: '-'
- },
- {
- filter: '学习',
- dimension: '学习(L)',
- teamRecognition: '-',
- teamImportance: '-',
- teamInfluence: '-',
- stakeholderInfluence: '-',
- sponsorInfluence: '-'
- },
- {
- filter: '领导力',
- dimension: '领导力(L)',
- teamRecognition: '-',
- teamImportance: '-',
- teamInfluence: '-',
- stakeholderInfluence: '-',
- sponsorInfluence: '-'
- }
- ]
- };
- },
- onLoad(options) {
- this.reportId = options.reportId;
- this.getReportData();
- },
- onReady() {
- // #ifdef MP-WEIXIN
- wx.hideShareMenu();
- // #endif
- },
- mounted() {
- this.calculateScaleAndPosition();
- uni.onWindowResize(() => {
- this.calculateScaleAndPosition();
- });
- },
- methods: {
- renderMarkdown(val) {
- if(!val) return '';
- val = '<span style="padding-left:4ch;"></span>'+val;
- val = this.formattedText2(val);
- val = val.replaceAll('\n','<br><span style="padding-left:4ch;"></span>')
- val = this.formattedText(val);
- return val
- },
- renderMarkdown2(val) {
- if(!val) return '';
- val = '<span style="padding-left:4ch;"></span>'+val;
- val = val.replaceAll('\n','<br><span style="padding-left:4ch;"></span>')
- return val
- },
- formattedText(val) {
- // 正则表达式:匹配**包裹的内容
- // /\*\*(.*?)\*\*/g 解析:
- // \*\* 匹配两个星号(*需要转义)
- // (.*?) 非贪婪匹配任意字符(括号捕获匹配的内容)
- // g 全局匹配(替换所有符合条件的内容)
- const regex = /\*\*(.*?)\*\*/g
- // 替换为<b>标签,$1表示正则中括号捕获的内容
- return val.replace(regex, '<b>$1</b>')
- },
- formattedText2(val) {
- // 正则解析:
- // #{1,6} 匹配1到6个#
- // (.*?) 非贪婪捕获#后、空格前的任意文字(核心要保留的内容)
- // \s 匹配后面的空格(注意是单个空格,若要兼容多个空格可改为\s+)
- // g 全局匹配,替换所有符合条件的内容
- const regex = /#{1,6}\s*(.+?)\s*\n/g;
-
- // 替换规则:将匹配到的 "#文字 " / "##文字 " / "###文字 " 转为 "<b>文字</b>"
- return val.replace(regex, '<b>$1</b><br>')
- },
- getReportData(){
- this.$api.get(`/core/report/previewReport/${this.reportId}`).then(async ({data:res})=>{
- if(res.code!==0) return this.$showToast(res.msg)
- this.reportData = res.data;
-
- const tempDimensionAnalysis = [
- {
- title:'宗旨与动机',thbgcolor:'#761E6A',thtextcolor:'#FFFFFF',titlecolor:'#761E6A',dimensionCode:"purpose",bordercolor:'#E4D2E1',
- desc:`「宗旨与动机」维度,我们旨在探究团队是否有清晰的存在理由和明确的方向,能够激发团队成员的动力并吸引他们的想象力,以及个人与集体的身份认同是否围绕共同的目标,并在实现目标的优先次序上达成一致。`
- },
- {
- title:'外部流程、系统与结构',thbgcolor:'#009191',thtextcolor:'#FFFFFF',titlecolor:'#009191',dimensionCode:"external",bordercolor:'#B3DEDE',
- desc:`「外部流程、系统与结构」维度,我们旨在探究团队如何与各种利益相关者互动,他们与团队的利益相关方各自如何寻求了解对方,以及现有系统和流程的有效性,以帮助管理不同利益相关者的期望和需求。`
- },
- {
- title:'人际关系',thbgcolor:'#FFD750',thtextcolor:'#002846',titlecolor:'#002846',dimensionCode:"relationship",bordercolor:'#FFEBA8',
- desc:`「人际关系」维度,我们旨在探究团队成员相互沟通交流的状态,团队成员的信任程度、尊重和关心的程度、心理安全度,以及团队成员之间的关系如何促进(或破坏)协作。`
- },
- {
- title:'内部流程、系统与结构',thbgcolor:'#4EB2B2',thtextcolor:'#FFFFFF',titlecolor:'#33A7A7',dimensionCode:"internal",bordercolor:'#B3DEDE',
- desc:`「内部流程、系统与结构」维度,我们旨在探究团队在管理工作任务和流程中如何平衡责任与自主权进行协作。主要关注团队应对变化时的敏捷程度、日常沟通方式以及内部决策过程的有效性。`
- },
- {
- title:'学习',thbgcolor:'#AFCDF5',thtextcolor:'#002846',titlecolor:'#002846',dimensionCode:"learning",bordercolor:'#C7DCF8',
- desc:`「学习」维度,我们旨在探究团队如何提高其绩效(完成当下的任务)、能力(提高技能和资源以处理明天的任务)和容量(⻓期的愿景,用更少的资源做更多的事情)以应对当前和未来的任务。同时还关注团队如何管理这些能力和提高效率。`
- },
- {
- title:'领导力',thbgcolor:'#002846',thtextcolor:'#FFFFFF',titlecolor:'#002846',dimensionCode:"leadership",bordercolor:'#E6EAED',
- desc:`「领导力」维度,我们旨在探究团队领导者的素质和行为(包括但不限于正式与非正式的引导、赋能与责任承担方式)如何对团队功能和其他因素产生影响,以及这是积极的还是消极的。`
- }
- ]
- this.reportData.dimensionAnalysis.forEach((d,i)=>{
- d.scoreSpreads.forEach(s=>{
- s.theme = s.theme.replaceAll(',',' ').replaceAll(',','');
- })
- let temp = tempDimensionAnalysis.find(t=>t.dimensionCode === d.dimensionCode)||{};
- this.reportData.dimensionAnalysis[i] = {...d,...temp}
- })
- this.reportData.overall.forEach(o=>{
- let temp = this.perillData.find(t=>t.filter === o.dimension);
- let ti = this.perillData.findIndex(t=>t.filter === o.dimension);
- if(temp&&ti>-1){
- if(o.dimensionTotalSpreads&&o.dimensionTotalSpreads.length){
- this.perillData[ti].teamRecognition = o.dimensionTotalSpreads[0].all_agreement||'-';
- this.perillData[ti].teamImportance = o.dimensionTotalSpreads[0].all_vital||'-';
- this.perillData[ti].teamInfluence = o.dimensionTotalSpreads[0].all_score||'-';
- this.perillData[ti].stakeholderInfluence = o.dimensionTotalSpreads[0].stakeholder_score||'-';
- this.perillData[ti].sponsorInfluence = o.dimensionTotalSpreads[0].sponsor_score||'-';
- }
- }
- })
-
- // 【关键逻辑】在数据渲染后,开始预加载图片
- await this.$nextTick(); // 确保DOM更新完毕
- try {
- const imageUrls = this.collectImageUrls();
- const results = await this.preloadAllImages(imageUrls);
-
- // (可选) 检查加载结果并上报或提示
- const failedImages = results
- .filter(result => result.status === 'rejected')
- .map(result => result.reason.url); // 获取加载失败的图片URL
- if (failedImages.length > 0) {
- console.error(`加载失败的图片 (重试3次后):`, failedImages);
- this.$showToast('部分图片资源加载失败');
- } else {
- console.log('所有依赖的图片已加载完成!');
- }
- } catch (error) {
- // Promise.allSettled 本身不应该抛出错误,这里作为保险
- console.error('预加载过程中发生意外错误:', error);
- } finally {
- // 无论成功或失败,最后都隐藏loading
- this.isLoading = false;
- }
- }).catch(err => {
- // 网络请求失败等情况
- console.error('获取报告数据失败:', err);
- this.isLoading = false;
- this.$showToast('获取报告数据失败,请检查网络');
- });
- },
- /**
- * @description 新增:收集页面上所有需要预加载的图片URL
- * @returns {Array<string>} 包含所有图片URL的数组
- */
- collectImageUrls() {
- // 使用 Set 来自动去重
- const imageUrls = new Set();
- const baseUrl = 'https://oss.familydaf.cn/sxsnfile/';
-
- // 1. 静态图片 (封面、介绍等)
- imageUrls.add(baseUrl + '20251230/b70c19716d86452aaa0c9808a2851e8b.png');
-
- console.log(`[Preload] 收集到 ${imageUrls.size} 个待加载的图片URL`);
- return Array.from(imageUrls); // 将 Set 转换为数组
- },
- /**
- * @description 【新增】带重试逻辑的单个图片加载器
- * @param {string} url 图片URL
- * @param {number} maxRetries 最大重试次数
- * @returns {Promise} 成功时 resolve, 彻底失败时 reject
- */
- loadImageWithRetry(url, maxRetries = 5) {
- return new Promise((resolve, reject) => {
- let attempts = 0;
- const tryLoad = () => {
- attempts++;
- uni.getImageInfo({
- src: url,
- success: (res) => {
- // console.log(`图片加载成功: ${url} (尝试次数: ${attempts})`);
- resolve(res);
- },
- fail: (err) => {
- console.warn(`图片加载失败: ${url} (尝试次数: ${attempts}/${maxRetries})`);
- if (attempts < maxRetries) {
- // 稍作延迟后重试,避免立即请求导致服务器压力
- setTimeout(tryLoad, 300);
- } else {
- // 达到最大重试次数,彻底失败
- console.error(`图片彻底加载失败: ${url}`);
- reject({ url, error: err }); // reject时返回包含url的对象,方便追踪
- }
- }
- });
- };
- tryLoad();
- });
- },
-
- /**
- * @description 【优化】预加载所有图片,并处理重试逻辑
- * @param {Array<string>} urls 图片URL数组
- * @returns {Promise<Array<Object>>} 返回 Promise.allSettled 的结果数组
- */
- preloadAllImages(urls) {
- const promises = urls.map(url => this.loadImageWithRetry(url, 5));
- // 使用 Promise.allSettled
- // 它会等待所有 Promise 完成(无论是 resolve还是reject)
- // 这样即使有图片加载失败,也不会中断整个过程
- return Promise.allSettled(promises);
- },
-
- async createPdf(){
- uni.showLoading({
- title:'正在生成PDF所需的图片...'
- })
- try {
- const ztzdfxImgPromise = this.downloadZtzdfxImg();
- const sumScoreTablePromise = this.generateSumScoreTableImage();
- const dimensionImagePromises = this.reportData.dimensionAnalysis.map(d => {
- return this.generateScoreImage(d,d.scoreSpreads);
- });
- const allImageUrls = await Promise.all([
- ztzdfxImgPromise,
- sumScoreTablePromise,
- ...dimensionImagePromises
- ]);
- this.pdfImages = allImageUrls;
-
- this.$api.post('/core/report/reportToPdf',{
- images:this.pdfImages,
- reportId:this.reportId
- }).then(({data:res})=>{
- if(res.code!==0) return this.$showToast(res.msg)
- uni.hideLoading();
- this.$showToast('生成成功');
- setTimeout(()=>{
- uni.redirectTo({
- url:'/pagesHome/report'
- })
- },1500)
- })
- } catch (error) {
- uni.hideLoading();
- console.error('生成图片过程中发生错误:', error);
- uni.showToast({ title: '生成图片失败,请重试', icon: 'none' });
- }
- },
- // 绘制主函数
- async generateScoreImage(dimensionData, scoreData) {
- return new Promise(resolve => {
- console.log('开始生成图片...');
- // --- 1. 定义尺寸和样式 ---
- const canvasWidth = 588;
- const headerHeight = 26;
- const rowHeight = 54;
- const totalHeight = headerHeight + rowHeight * scoreData.length;
- const leftColWidth = 280;
- const rightColWidth = 308;
- // --- 2. 获取 Canvas 节点 ---
- const query = uni.createSelectorQuery().in(this);
- query.select('#score-canvas')
- .fields({
- node: true,
- size: true
- })
- .exec(async (res) => {
- if (!res || !res[0] || !res[0].node) {
- console.error('获取 Canvas 节点失败,请检查 canvas-id 和 type="2d" 是否正确设置。');
- uni.showToast({
- title: '组件初始化失败',
- icon: 'none'
- });
- return;
- }
- const canvasNode = res[0].node;
- const ctx = canvasNode.getContext('2d');
- const dpr = uni.getSystemInfoSync().pixelRatio;
- // --- 3. 设置画布尺寸和缩放以适应高分屏 ---
- canvasNode.width = canvasWidth * dpr;
- canvasNode.height = totalHeight * dpr;
- ctx.scale(dpr, dpr);
- // --- 4. 开始绘制 ---
- // 绘制大背景
- ctx.fillStyle = '#FFFFFF';
- ctx.fillRect(0, 0, canvasWidth, totalHeight);
- // --- 5. 绘制表头 ---
- // 左侧表头背景
- ctx.fillStyle = dimensionData.thbgcolor;
- ctx.fillRect(0, 0, leftColWidth, headerHeight);
- // 右侧表头背景
- ctx.fillRect(leftColWidth, 0, rightColWidth, headerHeight);
- // 左侧表头文字
- ctx.fillStyle = dimensionData.thtextcolor;
- ctx.font = 'bold 9px sans-serif';
- ctx.textBaseline = 'middle';
- ctx.textAlign = 'left';
- ctx.fillText('主题', 15, headerHeight / 2);
- // 左侧表头分割线
- ctx.strokeStyle = 'rgba(255,255,255,0.24)';
- ctx.lineWidth = 1;
- ctx.beginPath();
- ctx.moveTo(leftColWidth - 54, 0);
- ctx.lineTo(leftColWidth - 54, headerHeight);
- ctx.stroke();
-
- // 影响力分右侧分割线 (Header)
- ctx.beginPath();
- ctx.moveTo(leftColWidth, 0);
- ctx.lineTo(leftColWidth, headerHeight);
- ctx.stroke();
- ctx.textAlign = 'center';
- ctx.fillText('影响力分', leftColWidth - 27, headerHeight / 2);
- // 右侧表头分割线
- ctx.beginPath();
- ctx.moveTo(leftColWidth + rightColWidth / 2, 0);
- ctx.lineTo(leftColWidth + rightColWidth / 2, headerHeight);
- ctx.stroke();
- // 右侧表头文字
- ctx.fillText('认同度分', leftColWidth + rightColWidth / 4, headerHeight / 2);
- ctx.fillText('重要性分', leftColWidth + rightColWidth * 0.75, headerHeight / 2);
- // --- 6. 循环绘制每一行 ---
- for (let i = 0; i < scoreData.length; i++) {
- const item = scoreData[i];
- const yPos = headerHeight + i * rowHeight;
- this.drawTableItem(ctx, item, yPos, leftColWidth, rightColWidth, rowHeight, dimensionData);
- }
- // --- 7. 绘制最外层边框 ---
- ctx.strokeStyle = dimensionData.bordercolor;
- ctx.lineWidth = 1;
- ctx.strokeRect(0, 0, canvasWidth, totalHeight);
- // --- 9. 生成图片 ---
- uni.hideLoading();
- uni.canvasToTempFilePath({
- canvas: canvasNode,
- x: 0,
- y: 0,
- width: canvasWidth,
- height: totalHeight,
- destWidth: canvasWidth * dpr,
- destHeight: totalHeight * dpr,
- success: async (result) => {
- console.log('图片生成成功!', result.tempFilePath);
- const fileurl = await this.uploadFilePromise(result.tempFilePath);
- console.log(fileurl, 'fileurl');
- resolve(fileurl)
- },
- fail: (err) => {
- console.error('图片生成失败', err);
- uni.showToast({
- title: '图片生成失败',
- icon: 'none'
- });
- }
- }, this);
- });
- })
- },
- // 绘制总评分表
- async generateSumScoreTableImage() {
- return new Promise(resolve => {
- // --- 1. 定义尺寸和样式 ---
- const canvasWidth = 588;
- const headerHeight = 72;
- const rowHeight = 36;
- const totalHeight = headerHeight + rowHeight * this.perillData.length;
- // 列宽设置
- const colWidth = 87; // 标准列宽度
- const col1Width = canvasWidth - colWidth * 5; // PERILL纬度列宽度
- // --- 2. 获取 Canvas 节点 ---
- const query = uni.createSelectorQuery().in(this);
- query.select('#score-canvas')
- .fields({
- node: true,
- size: true
- })
- .exec(async (res) => {
- if (!res || !res[0] || !res[0].node) {
- console.error('获取 Canvas 节点失败,请检查 canvas-id 和 type="2d" 是否正确设置。');
- uni.showToast({
- title: '组件初始化失败',
- icon: 'none'
- });
- return;
- }
- const canvasNode = res[0].node;
- const ctx = canvasNode.getContext('2d');
- const dpr = uni.getSystemInfoSync().pixelRatio;
- // --- 3. 设置画布尺寸和缩放以适应高分屏 ---
- canvasNode.width = canvasWidth * dpr;
- canvasNode.height = totalHeight * dpr;
- ctx.scale(dpr, dpr);
- // --- 4. 开始绘制 ---
- // 绘制大背景
- ctx.fillStyle = '#FFFFFF';
- ctx.fillRect(0, 0, canvasWidth, totalHeight);
- // --- 5. 绘制表头 ---
- // 表头背景
- ctx.fillStyle = '#F5F7F8';
- ctx.fillRect(0, 0, canvasWidth, headerHeight);
- // 表头文字样式
- ctx.fillStyle = '#002846';
- ctx.font = 'bold 12px PingFang-SC, sans-serif';
- ctx.textBaseline = 'middle';
- // 第一列:PERILL纬度
- ctx.textAlign = 'left';
- ctx.fillText('PERILL纬度', 10, headerHeight / 2);
- // 第二列:团队全员
- ctx.textAlign = 'center';
- ctx.fillText('团队全员', col1Width + colWidth * 1.5, 18);
- // 团队全员子列
- ctx.font = 'bold 12px PingFang-SC, sans-serif';
- ctx.fillText('认同度', col1Width + colWidth * 0.5, 54);
- ctx.fillText('重要性', col1Width + colWidth * 1.5, 54);
- ctx.fillText('影响力', col1Width + colWidth * 2.5, 54);
- // 第三列:利益相关者
- ctx.fillText('利益相关者', col1Width + colWidth * 3.5, 18);
- ctx.fillText('影响力', col1Width + colWidth * 3.5, 54);
- // 第四列:赞助者
- ctx.fillText('赞助者', col1Width + colWidth * 4.5, 18);
- ctx.fillText('影响力', col1Width + colWidth * 4.5, 54);
- // 绘制表头分割线
- ctx.strokeStyle = '#AEDADA';
- ctx.lineWidth = 1;
- // 垂直线
- ctx.beginPath();
- // PERILL纬度列右边的线
- ctx.moveTo(col1Width, 0);
- ctx.lineTo(col1Width, headerHeight);
- // 团队全员子列分割线(只在36px以下)
- ctx.moveTo(col1Width + colWidth, 36);
- ctx.lineTo(col1Width + colWidth, headerHeight);
- ctx.moveTo(col1Width + colWidth * 2, 36);
- ctx.lineTo(col1Width + colWidth * 2, headerHeight);
- // 团队全员与利益相关者之间的线
- ctx.moveTo(col1Width + colWidth * 3, 0);
- ctx.lineTo(col1Width + colWidth * 3, headerHeight);
- // 利益相关者与赞助者之间的线
- ctx.moveTo(col1Width + colWidth * 4, 0);
- ctx.lineTo(col1Width + colWidth * 4, headerHeight);
- // 赞助者列右边的线
- ctx.moveTo(col1Width + colWidth * 5, 0);
- ctx.lineTo(col1Width + colWidth * 5, headerHeight);
- ctx.stroke();
- // 水平线
- ctx.beginPath();
- // 只绘制PERILL纬度列右侧的横线
- ctx.moveTo(col1Width, 36);
- ctx.lineTo(canvasWidth, 36);
- ctx.moveTo(0, headerHeight);
- ctx.lineTo(canvasWidth, headerHeight);
- ctx.stroke();
- // --- 6. 绘制数据行 ---
- ctx.font = 'bold 12px PingFang-SC, sans-serif';
- ctx.textBaseline = 'middle';
- for (let i = 0; i < this.perillData.length; i++) {
- const item = this.perillData[i];
- const yPos = headerHeight + i * rowHeight;
- // 交替背景色
- if (i % 2 === 1) {
- ctx.fillStyle = 'rgba(51,167,167,0.08)';
- ctx.fillRect(0, yPos, canvasWidth, rowHeight);
- }
- // 第一列:维度名称
- ctx.fillStyle = '#002846';
- ctx.textAlign = 'left';
- ctx.fillText(item.dimension, 10, yPos + rowHeight / 2);
- // 其他列:数据
- ctx.textAlign = 'center';
- ctx.fillText(item.teamRecognition, col1Width + colWidth * 0.5, yPos + rowHeight / 2);
- ctx.fillText(item.teamImportance, col1Width + colWidth * 1.5, yPos + rowHeight / 2);
- ctx.fillText(item.teamInfluence, col1Width + colWidth * 2.5, yPos + rowHeight / 2);
- ctx.fillText(item.stakeholderInfluence, col1Width + colWidth * 3.5, yPos + rowHeight / 2);
- ctx.fillText(item.sponsorInfluence, col1Width + colWidth * 4.5, yPos + rowHeight / 2);
- // 绘制行分割线
- if (i < this.perillData.length - 1) {
- ctx.beginPath();
- ctx.moveTo(0, yPos + rowHeight);
- ctx.lineTo(canvasWidth, yPos + rowHeight);
- ctx.stroke();
- }
- // 绘制列分割线
- ctx.beginPath();
- ctx.moveTo(col1Width, yPos);
- ctx.lineTo(col1Width, yPos + rowHeight);
- ctx.moveTo(col1Width + colWidth, yPos);
- ctx.lineTo(col1Width + colWidth, yPos + rowHeight);
- ctx.moveTo(col1Width + colWidth * 2, yPos);
- ctx.lineTo(col1Width + colWidth * 2, yPos + rowHeight);
- ctx.moveTo(col1Width + colWidth * 3, yPos);
- ctx.lineTo(col1Width + colWidth * 3, yPos + rowHeight);
- ctx.moveTo(col1Width + colWidth * 4, yPos);
- ctx.lineTo(col1Width + colWidth * 4, yPos + rowHeight);
- ctx.stroke();
- }
- // --- 7. 绘制最外层边框 ---
- ctx.strokeStyle = '#AEDADA';
- ctx.lineWidth = 1;
- ctx.strokeRect(0, 0, canvasWidth, totalHeight);
- // --- 8. 生成图片 ---
- uni.canvasToTempFilePath({
- canvas: canvasNode,
- x: 0,
- y: 0,
- width: canvasWidth,
- height: totalHeight,
- destWidth: canvasWidth * dpr,
- destHeight: totalHeight * dpr,
- success: async (result) => {
- console.log('总评分表图片生成成功!', result.tempFilePath);
- const fileurl = await this.uploadFilePromise(result.tempFilePath);
- console.log(fileurl, 'fileurl');
- resolve(fileurl)
- },
- fail: (err) => {
- console.error('图片生成失败', err);
- uni.showToast({
- title: '图片生成失败',
- icon: 'none'
- });
- }
- }, this);
- });
- })
- },
- drawTableItem(ctx, item, y, leftW, rightW, h, dimensionData) {
- // 1. 设置通用边框样式
- ctx.strokeStyle = dimensionData.bordercolor;
- ctx.lineWidth = 1;
-
- // 绘制整行下边框 (贯穿左右)
- ctx.beginPath();
- ctx.moveTo(0, y + h);
- ctx.lineTo(leftW + rightW, y + h);
- ctx.stroke();
-
- // --- 计算高度 ---
- // 必须先设置字体,否则 measureText 计算不准确
- ctx.font = 'bold 9px sans-serif';
- let themeHeight = this.calculateWrappedTextHeight(ctx, item.theme, 14, leftW - 54 - 20);
-
- ctx.font = '8px sans-serif';
- let questionHeight = this.calculateWrappedTextHeight(ctx, item.question, 10, leftW - 54 - 20);
-
- let totalTextHeight = themeHeight + 4 + questionHeight; // 4 is spacing
- let startY = y + (h - totalTextHeight) / 2;
-
- // --- 绘制左侧文字 ---
- // Theme Title
- ctx.fillStyle = dimensionData.titlecolor;
- ctx.font = 'bold 9px sans-serif';
- ctx.textAlign = 'left';
- ctx.textBaseline = 'top';
- this.drawWrappedTextTop(ctx, item.theme, 10, startY, 14, leftW - 54 - 20);
-
- // Question Tip
- ctx.fillStyle = '#002846';
- ctx.font = '8px sans-serif';
- this.drawWrappedTextTop(ctx, item.question, 10, startY + themeHeight + 4, 10, leftW - 54 - 20);
-
- // Score
- ctx.fillStyle = '#002846';
- ctx.font = 'bold 12px DIN, sans-serif';
- ctx.textAlign = 'center';
- ctx.textBaseline = 'middle';
- ctx.fillText((item.regular && item.regular.avgScore) || 0, leftW - 27, y + h / 2);
-
- // 2. 右侧
- const rightX = leftW;
-
- // 绘制中间线
- const centerX = rightX + rightW / 2;
-
- // Bar Charts
- const barHeight = 10;
- const barY = y + (h - barHeight) / 2;
-
- // Agreement (Left, Red/Purple)
- // Width = avgAgreement / 6 * 100% of half width?
- const maxVal = 6;
- const halfW = rightW / 2;
-
- const avgAgreement = (item.regular && item.regular.avgAgreement) || 0;
- const avgVital = (item.regular && item.regular.avgVital) || 0;
-
- const agreeW = (avgAgreement / maxVal) * halfW;
- const vitalW = (avgVital / maxVal) * halfW;
-
- // --- 绘制背景轨道 (灰色) ---
- // 模仿 CSS .vbt2r-tb-l-pre-bg: width: calc(100% - 16px); height: 4px;
- // 左右各留 8px 空隙?或者就是简单的横条
- const trackHeight = 4;
- const trackY = y + (h - trackHeight) / 2;
- ctx.fillStyle = '#E6EAED';
-
- // 左侧轨道背景 (从右向左)
- this.drawRoundedRect(ctx, rightX + 8, trackY, halfW - 8, trackHeight, 2);
- // 右侧轨道背景 (从左向右)
- this.drawRoundedRect(ctx, centerX, trackY, halfW - 8, trackHeight, 2);
-
- // Draw Agreement Bar (grows from center to left)
- ctx.fillStyle = '#BA8EB4';
- // 左侧条,圆角在左边 [2, 0, 0, 2]
- this.drawCustomRoundedRect(ctx, centerX - agreeW, barY, agreeW, barHeight, [2, 0, 0, 2]);
-
- // Draw Vital Bar (grows from center to right)
- ctx.fillStyle = '#80C8C8';
- // 右侧条,圆角在右边 [0, 2, 2, 0]
- this.drawCustomRoundedRect(ctx, centerX, barY, vitalW, barHeight, [0, 2, 2, 0]);
-
- // --- 绘制数字标签 ---
- const tagW = 16;
- const tagH = 20;
-
- // 左标签位置 (中心点)
- // CSS: left: -8px (relative to bar start/end).
- // 实际上是在条形图的末端(远离中心的那一端)
- // 左侧条形图末端 x = centerX - agreeW
- // 标签中心 x = centerX - agreeW
- this.drawValueTag(ctx, avgAgreement, centerX - agreeW, y + h/2, '#904A87', 'rgba(131,52,120,0.19)', 'rgba(118,30,106,0.1)');
-
- // 右标签位置
- // 右侧条形图末端 x = centerX + vitalW
- this.drawValueTag(ctx, avgVital, centerX + vitalW, y + h/2, '#199C9C', 'rgba(51,167,167,0.31)', 'rgba(118,30,106,0.1)');
- },
- // 辅助函数:绘制带样式的数值标签
- drawValueTag(ctx, value, cx, cy, textColor, borderColor, shadowColor) {
- const width = 16;
- const height = 20;
- const x = cx - width / 2;
- const y = cy - height / 2;
- const radius = 4;
-
- ctx.save();
- // 阴影
- ctx.shadowOffsetX = 0;
- ctx.shadowOffsetY = 4;
- ctx.shadowBlur = 8;
- ctx.shadowColor = shadowColor;
-
- // 背景
- ctx.fillStyle = '#FFFFFF';
- this.drawRoundedRectPath(ctx, x, y, width, height, radius);
- ctx.fill();
-
- // 边框 (取消阴影绘制边框)
- ctx.shadowColor = 'transparent';
- ctx.strokeStyle = borderColor;
- ctx.lineWidth = 1;
- ctx.stroke();
-
- // 文字
- ctx.fillStyle = textColor;
- ctx.font = 'bold 12px DIN, sans-serif';
- ctx.textAlign = 'center';
- ctx.textBaseline = 'middle';
- ctx.fillText(value, cx, cy);
-
- ctx.restore();
- },
- // 辅助函数:绘制圆角矩形路径
- drawRoundedRectPath(ctx, x, y, w, h, r) {
- ctx.beginPath();
- ctx.moveTo(x + r, y);
- ctx.lineTo(x + w - r, y);
- ctx.arcTo(x + w, y, x + w, y + h, r);
- ctx.lineTo(x + w, y + h - r);
- ctx.arcTo(x + w, y + h, x, y + h, r);
- ctx.lineTo(x + r, y + h);
- ctx.arcTo(x, y + h, x, y, r);
- ctx.lineTo(x, y + r);
- ctx.arcTo(x, y, x + w, y, r);
- ctx.closePath();
- },
- // 辅助函数:绘制圆角矩形 (简单版)
- drawRoundedRect(ctx, x, y, w, h, r) {
- this.drawRoundedRectPath(ctx, x, y, w, h, r);
- ctx.fill();
- },
- // 辅助函数:绘制自定义四个角圆角的矩形
- drawCustomRoundedRect(ctx, x, y, w, h, radii) {
- // radii: [tl, tr, br, bl]
- if (!Array.isArray(radii)) radii = [radii, radii, radii, radii];
- const [tl, tr, br, bl] = radii;
-
- ctx.beginPath();
- ctx.moveTo(x + tl, y);
- ctx.lineTo(x + w - tr, y);
- ctx.arcTo(x + w, y, x + w, y + h, tr);
- ctx.lineTo(x + w, y + h - br);
- ctx.arcTo(x + w, y + h, x, y + h, br);
- ctx.lineTo(x + bl, y + h);
- ctx.arcTo(x, y + h, x, y, bl);
- ctx.lineTo(x, y + tl);
- ctx.arcTo(x, y, x + w, y, tl);
- ctx.closePath();
- ctx.fill();
- },
- // 辅助函数:计算自动换行文字的总高度
- calculateWrappedTextHeight(ctx, text, lineHeight, maxWidth) {
- if (!text) return 0;
- let words = text.split('');
- let line = '';
- let height = lineHeight; // 至少有一行
- for (let n = 0; n < words.length; n++) {
- let testLine = line + words[n];
- let metrics = ctx.measureText(testLine);
- let testWidth = metrics.width;
- if (testWidth > maxWidth && n > 0) {
- line = words[n];
- height += lineHeight;
- } else {
- line = testLine;
- }
- }
- return height;
- },
- // 辅助函数:绘制自动换行文字 (从顶部开始)
- drawWrappedTextTop(ctx, text, x, y, lineHeight, maxWidth) {
- if (!text) return;
- let words = text.split('');
- let line = '';
- let currentY = y;
-
- for (let n = 0; n < words.length; n++) {
- let testLine = line + words[n];
- let metrics = ctx.measureText(testLine);
- let testWidth = metrics.width;
- if (testWidth > maxWidth && n > 0) {
- ctx.fillText(line, x, currentY); // 使用 currentY 作为顶部基线
- line = words[n];
- currentY += lineHeight;
- } else {
- line = testLine;
- }
- }
- ctx.fillText(line, x, currentY);
- },
- calculateScaleAndPosition() {
- uni.getSystemInfo({
- success: (res) => {
- const screenWidth = res.windowWidth; // 手机屏幕的宽度
- const pcContentWidth = 630; // PC端内容的原始宽度
- this.scale = screenWidth / pcContentWidth;
- this.$nextTick(() => {
- if (this.$refs.ztzdfxRef) {
- this.initZtzdfxChart();
- }
- });
- }
- });
- },
- calculatePdfContainerHeight() {
- uni.createSelectorQuery().in(this).select('#pdfContainer').boundingClientRect(rect => {
- if (rect) {
- this.originalContainerHeight = rect.height;
- this.containerScaledHeight = this.originalContainerHeight * this.scale;
- // console.log('原始高度:', this.originalContainerHeight, '缩放比例:', this.scale, '缩放后高度:', this.containerScaledHeight);
- }
- }).exec();
- },
- downloadZtzdfxImg(){
- return new Promise(resolve=>{
- if (!this.isChartReady) return console.log('图表尚未准备好');
-
- const chartRef = this.$refs.ztzdfxRef;
- if (!chartRef) return console.log('无法找到图表组件');
-
- chartRef.canvasToTempFilePath({
- success: async (res) => {
- const imgUrl = await this.uploadFilePromise(res.tempFilePath);
- console.log(imgUrl,'imgUrl');
- resolve(imgUrl)
- },
- fail: (err) => {
- console.log('生成图片失败:', err);
- }
- });
- })
- },
- uploadFilePromise(url) {
- return new Promise((resolve, reject) => {
- let a = uni.uploadFile({
- url: BaseApi+'/uploadFile',
- filePath: url,
- name: 'file',
- success: (res) => {
- setTimeout(() => {
- let data = JSON.parse(res.data)
- if(data&&data.code===0){
- resolve(data.data);
- }else this.$showToast(data?.msg)
- }, 1000);
- },
- fail: err =>{
- resolve('');
- }
- });
- });
- },
- async initZtzdfxChart() {
- let dataSum = this.reportData.overall.length*this.reportData.overall[0].themeTotalSpreads.length;
- const leaderData = [],memberData = [],stakeholderData=[],sponsorData=[];
- const overall = this.reportData.overall||[];
- overall.forEach(o=>{
- let themeTotalSpreads = o.themeTotalSpreads||[];
- if(['内部流程、系统与结构','学习','领导力'].includes(o.dimension)) themeTotalSpreads = o.themeTotalSpreads.reverse()||[];
- themeTotalSpreads.forEach(t=>{
- leaderData.push(t.scoreLeader||0);
- memberData.push(t.scoreMember||0);
- stakeholderData.push(t.scoreStakeholder||0);
- sponsorData.push(t.scoreSponsor||0);
- })
- })
- const sumArr = leaderData.concat(memberData).concat(stakeholderData).concat(sponsorData);
- const maxValue = sumArr.reduce((a,b)=>Math.max(a,b));
- const minValue = sumArr.reduce((a,b)=>Math.min(a,b));
- const chart = await this.$refs.ztzdfxRef.init(echarts);
- let option = {
- graphic: [
- {
- type: 'image',
- id: 'radar-bg',
- z: -1,
- bounding: 'raw',
- left: 'center',
- top: 'center',
- style: {
- image:'https://oss.familydaf.cn/sxsnfile/20251230/b70c19716d86452aaa0c9808a2851e8b.png',
- width: 360*this.scale-20,
- height: 360*this.scale-20,
- opacity: 1
- }
- },
- {
- type: 'circle',
- z: 100, // 设置一个较高的 z 值,确保它在最顶层
- left: 'center', // 水平居中
- top: 'center', // 垂直居中
- shape: {
- r: 12*this.scale // 圆形的半径,您可以根据需要调整大小
- },
- style: {
- fill: '#FFFFFF', // 填充色为白色
- shadowBlur: 20*this.scale, // 阴影的模糊范围
- shadowColor: 'rgba(0, 0, 0, 0.15)', // 阴影颜色
- shadowOffsetY: 4*this.scale // 向下的阴影偏移,产生悬浮效果
- }
- }
- ],
- radar: {
- // shape: 'circle',
- indicator: new Array(dataSum).fill({ max:maxValue, min:minValue }),
- axisName: {
- show: false
- },
- splitArea:{
- show:false
- },
- splitLine: {
- show: false
- },
- axisLine: {
- show: false
- },
- startAngle: 95
- },
- series: [
- {
- type: 'radar',
- data: [
- {
- value: sponsorData,
- itemStyle: {
- color: '#012846'
- },
- lineStyle: {
- color: '#012846',
- width:1
- },
- areaStyle: {
- color: 'rgba(255, 255, 255, 0.4)'
- },
- symbolSize: 2
- },
- {
- value: stakeholderData,
- itemStyle: {
- color: '#FFD650'
- },
- lineStyle: {
- color: '#FFD650',
- width:1
- },
- areaStyle: {
- color: 'rgba(255, 255, 255, 0.4)'
- },
- symbolSize: 2
- },
- {
- value: memberData,
- itemStyle: {
- color: '#AFCDF5'
- },
- lineStyle: {
- color: '#AFCDF5',
- width:1
- },
- areaStyle: {
- color: 'rgba(255, 255, 255, 0.4)'
- },
- symbolSize: 2
- },
- {
- value: leaderData,
- itemStyle: {
- color: '#9F6196'
- },
- lineStyle: {
- color: '#9F6196',
- width:1
- },
- areaStyle: {
- color: 'rgba(255, 255, 255, 0.4)'
- },
- symbolSize: 2
- }
- ]
- }
- ]
- };
- chart.setOption(option);
- this.isChartReady = true;
- this.$nextTick(() => {
- this.calculatePdfContainerHeight();
- });
- },
- }
- };
- </script>
- <style scoped lang="scss">
- .loading{
- position: fixed;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- background: rgba(0,0,0,.4);
- z-index: 1001;
- }
-
- .page-wrappe{
- width: 100%;
- background: #FFFFFF;
- overflow-x: hidden;
- overflow-y: auto;
- .pdf-container{
- width: 630px;
- padding: 0 20rpx;
- box-sizing: border-box;
- transform-origin: top left;
- }
- }
- .offscreen-canvas {
- position: fixed;
- top: -9999px;
- left: -9999px;
- }
- .pdf_btn{
- padding: 15rpx 20rpx;
- border-radius: 20rpx;
- font-size: 28rpx;
- color: #FFFFFF;
- background: #189B9B;
- position: fixed;
- right: 30rpx;
- bottom: 100rpx;
- z-index: 1000;
- }
-
- @import '../static/pdf.scss';
- </style>
|