Editor.vue 100 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728
  1. <template>
  2. <div class="editor-page">
  3. <div class="editor-body">
  4. <!-- 左侧面板 -->
  5. <div class="left-panel" :style="{ width: leftPanelWidth + 'px' }">
  6. <!-- Tab 切换 -->
  7. <div class="panel-tabs">
  8. <div
  9. class="panel-tab"
  10. :class="{ active: leftPanelTab === 'projects' }"
  11. @click="leftPanelTab = 'projects'"
  12. >
  13. 📄 项目
  14. <span class="tab-count">{{ projects.length }}</span>
  15. </div>
  16. <transition name="tab-slide">
  17. <div
  18. v-if="hasActiveProject"
  19. class="panel-tab"
  20. :class="{ active: leftPanelTab === 'attachments' }"
  21. @click="leftPanelTab = 'attachments'"
  22. >
  23. 📁 附件
  24. <span class="tab-count">{{ attachments.length }}</span>
  25. </div>
  26. </transition>
  27. <transition name="tab-slide">
  28. <div
  29. v-if="hasActiveProject"
  30. class="panel-tab"
  31. :class="{ active: leftPanelTab === 'rules' }"
  32. @click="leftPanelTab = 'rules'"
  33. >
  34. ⚙️ 规则
  35. <span class="tab-count">{{ rules.length }}</span>
  36. </div>
  37. </transition>
  38. </div>
  39. <!-- 项目列表面板 -->
  40. <div class="panel-body reports-panel" v-show="leftPanelTab === 'projects'">
  41. <el-button
  42. class="new-report-btn"
  43. type="primary"
  44. :icon="Plus"
  45. @click="showNewProjectDialog = true"
  46. >
  47. 新建项目
  48. </el-button>
  49. <el-input
  50. v-model="projectSearchKeyword"
  51. placeholder="搜索项目..."
  52. :prefix-icon="Search"
  53. clearable
  54. class="report-search"
  55. />
  56. <div class="report-list" v-if="filteredProjects.length > 0">
  57. <div
  58. v-for="project in filteredProjects"
  59. :key="project.id"
  60. class="report-item"
  61. :class="{ active: currentProjectId === project.id }"
  62. @click="switchProject(project)"
  63. >
  64. <div class="report-icon">📄</div>
  65. <div class="report-info">
  66. <div class="report-name">{{ project.title }}</div>
  67. <div class="report-meta">
  68. <span class="report-time">{{ formatTime(project.updatedAt || project.createdAt) }}</span>
  69. <span class="report-status" :class="project.status">
  70. {{ getStatusText(project.status) }}
  71. </span>
  72. </div>
  73. </div>
  74. <el-dropdown trigger="click" @command="(cmd) => handleProjectCommand(cmd, project)" @click.stop>
  75. <el-button class="report-delete-btn" circle size="small">
  76. <el-icon><MoreFilled /></el-icon>
  77. </el-button>
  78. <template #dropdown>
  79. <el-dropdown-menu>
  80. <el-dropdown-item command="copy">复制项目</el-dropdown-item>
  81. <el-dropdown-item command="archive">归档</el-dropdown-item>
  82. <el-dropdown-item command="delete" divided>删除</el-dropdown-item>
  83. </el-dropdown-menu>
  84. </template>
  85. </el-dropdown>
  86. </div>
  87. </div>
  88. <div class="report-empty" v-else-if="!loadingProjects">
  89. <div class="empty-icon">📄</div>
  90. <div class="empty-text">{{ projectSearchKeyword ? '未找到匹配的项目' : '暂无项目' }}</div>
  91. <div class="empty-hint">点击上方按钮创建新项目</div>
  92. </div>
  93. <div class="report-loading" v-if="loadingProjects">
  94. <el-icon class="is-loading"><Loading /></el-icon>
  95. <span>加载中...</span>
  96. </div>
  97. </div>
  98. <!-- 附件面板 -->
  99. <div class="panel-body" v-show="leftPanelTab === 'attachments'">
  100. <el-upload
  101. class="upload-zone"
  102. drag
  103. :auto-upload="false"
  104. :on-change="handleAttachmentUpload"
  105. :show-file-list="false"
  106. accept=".pdf,.doc,.docx,.xls,.xlsx"
  107. >
  108. <div class="upload-content">
  109. <div class="upload-icon">📄</div>
  110. <div class="upload-text">拖拽或点击上传</div>
  111. <div class="upload-hint">支持 PDF / Word / Excel</div>
  112. </div>
  113. </el-upload>
  114. <div class="file-list">
  115. <div
  116. v-for="att in attachments"
  117. :key="att.id"
  118. class="file-item"
  119. :class="{ active: selectedAttachment?.id === att.id }"
  120. @click="selectAttachment(att)"
  121. >
  122. <span class="file-icon">{{ getFileIcon(att) }}</span>
  123. <div class="file-info">
  124. <div class="file-name">{{ att.displayName }}</div>
  125. <div class="file-meta">
  126. <span>{{ att.entityCount || 0 }} 个实体</span>
  127. </div>
  128. </div>
  129. <el-button
  130. size="small"
  131. :icon="Delete"
  132. circle
  133. @click.stop="removeAttachment(att)"
  134. />
  135. </div>
  136. </div>
  137. </div>
  138. <!-- 规则面板 -->
  139. <div class="panel-body" v-show="leftPanelTab === 'rules'">
  140. <el-button
  141. class="new-report-btn"
  142. :icon="Plus"
  143. @click="showNewRuleDialog = true"
  144. >
  145. 添加规则
  146. </el-button>
  147. <el-button
  148. v-if="rules.length > 0"
  149. type="success"
  150. size="small"
  151. style="margin: 8px 0; width: 100%;"
  152. @click="handleBatchExecuteRules"
  153. :loading="executingRules"
  154. >
  155. 批量执行规则
  156. </el-button>
  157. <div class="file-list">
  158. <div
  159. v-for="rule in rules"
  160. :key="rule.id"
  161. class="file-item"
  162. >
  163. <span class="file-icon">⚙️</span>
  164. <div class="file-info">
  165. <div class="file-name">{{ rule.ruleName }}</div>
  166. <div class="file-meta">
  167. <el-tag size="small" :type="rule.lastRunStatus === 'success' ? 'success' : rule.lastRunStatus === 'failed' ? 'danger' : 'info'">
  168. {{ rule.ruleType }}
  169. </el-tag>
  170. </div>
  171. </div>
  172. <el-button size="small" type="primary" text @click.stop="handleExecuteRule(rule)" title="执行">▶</el-button>
  173. <el-button size="small" :icon="Delete" circle @click.stop="handleDeleteRule(rule)" />
  174. </div>
  175. </div>
  176. </div>
  177. </div>
  178. <!-- 左侧拖拽分隔条 -->
  179. <div class="resize-handle left-resize" @mousedown="startResizeLeft"></div>
  180. <!-- 中间主区域 -->
  181. <div class="center-panel">
  182. <!-- 欢迎页 -->
  183. <div class="welcome-page" v-if="!hasActiveProject">
  184. <div class="welcome-content">
  185. <div class="welcome-logo">灵</div>
  186. <div class="welcome">
  187. <h1>{{ greetingText }},{{ userName }}!<span>智能报告,洞察未来。</span></h1>
  188. <p>今天是个创作的好日子,开始您的智能报告之旅吧</p>
  189. </div>
  190. </div>
  191. </div>
  192. <!-- 项目详情 -->
  193. <template v-else>
  194. <div class="editor-title-bar">
  195. <div class="title-section">
  196. <el-input v-model="projectTitle" class="title-input" placeholder="请输入项目标题" style="width: 300px;" />
  197. <span class="save-status" v-if="saved">✓ 已保存</span>
  198. </div>
  199. <div class="view-toggle">
  200. <el-radio-group v-model="viewMode" size="small">
  201. <el-radio-button value="document">📄 文档</el-radio-button>
  202. <el-radio-button value="elements">📝 要素</el-radio-button>
  203. <el-radio-button value="entities">🏷️ 实体</el-radio-button>
  204. </el-radio-group>
  205. </div>
  206. <div class="toolbar-actions">
  207. <el-button size="small" @click="handleCopyProject" :icon="CopyDocument">复制</el-button>
  208. <el-divider direction="vertical" />
  209. <el-button size="small" type="primary" :icon="Check" @click="handleSave">保存</el-button>
  210. </div>
  211. </div>
  212. <div class="editor-scroll" ref="editorRef" v-loading="loading" element-loading-text="正在加载项目...">
  213. <!-- 文档视图 -->
  214. <div class="document-view" v-if="viewMode === 'document'">
  215. <!-- 工具栏 -->
  216. <div class="doc-toolbar">
  217. <div class="doc-toolbar-left" v-if="attachments.length > 0">
  218. <span class="doc-att-label">附件:</span>
  219. <el-select v-model="docAttachmentId" placeholder="选择附件" size="small" style="width: 240px;" @change="loadDocContent">
  220. <el-option v-for="att in attachments" :key="att.id" :label="att.displayName" :value="att.id" />
  221. </el-select>
  222. </div>
  223. <div class="doc-toolbar-right">
  224. <el-switch v-model="highlightEnabled" active-text="要素高亮" inactive-text="" size="small" style="margin-right: 12px;" @change="renderDocHtml" />
  225. <el-tag v-if="highlightEnabled" size="small" type="info">{{ elementHighlightCount }} 处高亮</el-tag>
  226. </div>
  227. </div>
  228. <!-- 文档渲染区域(可编辑) -->
  229. <div
  230. class="doc-paper"
  231. v-if="docHtml"
  232. :style="docPaperStyle"
  233. contenteditable="true"
  234. spellcheck="false"
  235. v-html="docHtml"
  236. @input="onDocInput"
  237. @click="onDocClick"
  238. ref="docPaperRef"
  239. ></div>
  240. <!-- 无内容提示 -->
  241. <div class="doc-empty" v-else-if="!docLoading && docAttachmentId">
  242. <el-empty description="该附件暂无解析内容" />
  243. </div>
  244. <div class="doc-empty" v-else-if="!docLoading && attachments.length === 0">
  245. <el-empty description="暂无附件,请先在左侧上传文档" />
  246. </div>
  247. <div class="doc-empty" v-else-if="!docLoading && !docAttachmentId">
  248. <el-empty description="请选择一个附件查看文档内容" />
  249. </div>
  250. <div class="doc-loading" v-if="docLoading">
  251. <el-icon class="is-loading" :size="24"><Loading /></el-icon>
  252. <span>正在加载文档内容...</span>
  253. </div>
  254. </div>
  255. <!-- 要素高亮弹出框 -->
  256. <div
  257. v-if="highlightPopover.visible"
  258. class="element-popover"
  259. :style="{ top: highlightPopover.y + 'px', left: highlightPopover.x + 'px' }"
  260. >
  261. <div class="popover-header">
  262. <span class="popover-label">{{ highlightPopover.elementName }}</span>
  263. <el-tag size="small">{{ highlightPopover.elementKey }}</el-tag>
  264. </div>
  265. <div class="popover-body">
  266. <div class="popover-field">
  267. <span class="popover-field-label">当前值:</span>
  268. <el-input
  269. v-model="highlightPopover.currentValue"
  270. size="small"
  271. placeholder="输入要素值"
  272. @keyup.enter="savePopoverValue"
  273. />
  274. </div>
  275. <div class="popover-field" v-if="highlightPopover.originalValue">
  276. <span class="popover-field-label">原始值:</span>
  277. <span class="popover-original">{{ highlightPopover.originalValue }}</span>
  278. </div>
  279. </div>
  280. <div class="popover-footer">
  281. <el-button size="small" @click="highlightPopover.visible = false">关闭</el-button>
  282. <el-button size="small" type="primary" @click="savePopoverValue">保存</el-button>
  283. </div>
  284. </div>
  285. <!-- 要素视图 -->
  286. <div class="elements-view" v-if="viewMode === 'elements'">
  287. <div class="elements-grid">
  288. <div class="element-card" v-for="elem in elements" :key="elem.id">
  289. <div class="element-card-header">
  290. <span class="element-label">{{ elem.elementName }}</span>
  291. <el-tag size="small" :type="elem.dataType === 'text' ? '' : 'warning'">{{ elem.dataType || '文本' }}</el-tag>
  292. </div>
  293. <div class="element-card-body">
  294. <div class="element-value-row" v-for="val in getElementValues(elem.elementKey)" :key="val.valueId">
  295. <el-input v-model="val.valueText" placeholder="暂无值" size="small" @change="onValueChange(val)" />
  296. <div class="value-meta" v-if="val.fillSource">
  297. <span class="original-label">来源:</span>
  298. <span class="original-value">{{ val.fillSource }}</span>
  299. </div>
  300. <div class="value-status">
  301. <el-tag v-if="val.isFilled" type="success" size="small">已填充</el-tag>
  302. <el-tag v-else type="info" size="small">待填充</el-tag>
  303. </div>
  304. </div>
  305. <div class="element-empty" v-if="getElementValues(elem.elementKey).length === 0">
  306. <span class="empty-hint">暂无值,请通过规则填充或手动输入</span>
  307. </div>
  308. </div>
  309. </div>
  310. </div>
  311. <div class="elements-empty" v-if="elements.length === 0">
  312. <el-empty description="暂无要素定义">
  313. <el-button type="primary" :icon="Plus" @click="showAddElementDialog = true">添加要素</el-button>
  314. </el-empty>
  315. </div>
  316. </div>
  317. <!-- 实体视图 -->
  318. <div class="entities-view" v-if="viewMode === 'entities'">
  319. <div class="entity-filter-bar">
  320. <el-input v-model="entitySearchKeyword" placeholder="搜索实体..." :prefix-icon="Search" clearable style="width: 300px;" />
  321. <el-select v-model="entityTypeFilter" placeholder="实体类型" clearable style="width: 150px; margin-left: 12px;">
  322. <el-option label="全部" value="" />
  323. <el-option label="组织机构" value="ORG" />
  324. <el-option label="人物" value="PERSON" />
  325. <el-option label="日期" value="DATE" />
  326. <el-option label="编号" value="CODE" />
  327. <el-option label="数值" value="NUMBER" />
  328. </el-select>
  329. </div>
  330. <el-table :data="filteredEntities" style="width: 100%" stripe max-height="calc(100vh - 220px)">
  331. <el-table-column prop="entityText" label="实体文本" min-width="200" />
  332. <el-table-column prop="entityType" label="类型" width="120">
  333. <template #default="{ row }">
  334. <el-tag size="small">{{ getEntityTypeName(row.entityType) }}</el-tag>
  335. </template>
  336. </el-table-column>
  337. <el-table-column prop="businessLabel" label="业务标签" width="150" />
  338. <el-table-column prop="confidence" label="置信度" width="100">
  339. <template #default="{ row }">
  340. <span v-if="row.confidence">{{ (row.confidence * 100).toFixed(0) }}%</span>
  341. <span v-else>-</span>
  342. </template>
  343. </el-table-column>
  344. <el-table-column prop="sourceAttachment" label="来源附件" width="150" />
  345. </el-table>
  346. <div class="entities-empty" v-if="entities.length === 0">
  347. <el-empty description="暂无实体,请先上传附件并解析" />
  348. </div>
  349. </div>
  350. </div>
  351. </template>
  352. </div>
  353. <!-- 右侧拖拽分隔条 -->
  354. <div v-if="hasActiveProject" class="resize-handle right-resize" @mousedown="startResizeRight"></div>
  355. <!-- 右侧面板 -->
  356. <div v-if="hasActiveProject" class="right-panel" :style="{ width: rightPanelWidth + 'px' }">
  357. <div class="element-section">
  358. <div class="element-header">
  359. <span class="element-title">📊 项目概览</span>
  360. </div>
  361. <div class="element-body">
  362. <div class="overview-stats">
  363. <div class="stat-item"><span class="stat-label">要素数</span><span class="stat-value">{{ elements.length }}</span></div>
  364. <div class="stat-item"><span class="stat-label">已填充</span><span class="stat-value filled">{{ filledValueCount }}</span></div>
  365. <div class="stat-item"><span class="stat-label">附件数</span><span class="stat-value">{{ attachments.length }}</span></div>
  366. <div class="stat-item"><span class="stat-label">实体数</span><span class="stat-value">{{ entities.length }}</span></div>
  367. <div class="stat-item"><span class="stat-label">规则数</span><span class="stat-value">{{ rules.length }}</span></div>
  368. </div>
  369. </div>
  370. </div>
  371. <div class="element-section">
  372. <div class="element-header">
  373. <span class="element-title">🏷️ 要素列表 <span class="element-count">({{ elements.length }})</span></span>
  374. <el-button size="small" type="primary" :icon="Plus" @click="showAddElementDialog = true">添加</el-button>
  375. </div>
  376. <div class="element-body">
  377. <div class="element-tags-wrap" v-if="elements.length > 0">
  378. <div v-for="elem in elements" :key="elem.id" class="var-tag confirmed" :title="elem.elementName">
  379. <span class="tag-name">{{ elem.elementName }}</span>
  380. <span class="tag-status" v-if="hasFilledValue(elem.elementKey)">✓</span>
  381. </div>
  382. </div>
  383. <div class="element-hint" v-else>暂无要素,点击添加按钮创建</div>
  384. </div>
  385. </div>
  386. <div class="element-section" v-if="entities.length > 0">
  387. <div class="element-header">
  388. <span class="element-title">🔍 实体摘要 <span class="element-count">({{ entities.length }})</span></span>
  389. </div>
  390. <div class="element-body">
  391. <div class="element-tags-wrap">
  392. <div v-for="entity in entities.slice(0, 20)" :key="entity.id" class="var-tag" :class="getEntityTypeClass(entity.entityType)" :title="entity.entityText">
  393. <span class="tag-icon">{{ getEntityTypeIcon(entity.entityType) }}</span>
  394. <span class="tag-name">{{ entity.entityText }}</span>
  395. </div>
  396. <div v-if="entities.length > 20" class="element-hint" style="margin-top: 8px;">还有 {{ entities.length - 20 }} 个实体...</div>
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. </div>
  402. <!-- 新建项目对话框 -->
  403. <el-dialog v-model="showNewProjectDialog" title="新建项目" width="460" :close-on-click-modal="false">
  404. <el-form :model="newProjectForm" label-width="80px">
  405. <el-form-item label="项目名称" required>
  406. <el-input v-model="newProjectForm.title" placeholder="请输入项目名称" maxlength="100" show-word-limit />
  407. </el-form-item>
  408. <el-form-item label="项目描述">
  409. <el-input v-model="newProjectForm.description" type="textarea" :rows="3" placeholder="项目描述(可选)" />
  410. </el-form-item>
  411. </el-form>
  412. <template #footer>
  413. <el-button @click="showNewProjectDialog = false">取消</el-button>
  414. <el-button type="primary" @click="handleCreateProject" :disabled="!newProjectForm.title.trim()" :loading="creatingProject">创建</el-button>
  415. </template>
  416. </el-dialog>
  417. <!-- 添加要素对话框 -->
  418. <el-dialog v-model="showAddElementDialog" title="添加要素" width="500">
  419. <el-form :model="newElementForm" label-width="100px">
  420. <el-form-item label="要素名称" required>
  421. <el-input v-model="newElementForm.elementName" placeholder="如:项目编号" />
  422. </el-form-item>
  423. <el-form-item label="要素标识" required>
  424. <el-input v-model="newElementForm.elementKey" placeholder="如:basicInfo.projectCode" />
  425. </el-form-item>
  426. <el-form-item label="数据类型">
  427. <el-select v-model="newElementForm.dataType" style="width: 100%">
  428. <el-option label="文本" value="text" />
  429. <el-option label="数字" value="number" />
  430. <el-option label="日期" value="date" />
  431. <el-option label="金额" value="money" />
  432. </el-select>
  433. </el-form-item>
  434. <el-form-item label="描述">
  435. <el-input v-model="newElementForm.description" type="textarea" :rows="2" placeholder="要素描述" />
  436. </el-form-item>
  437. </el-form>
  438. <template #footer>
  439. <el-button @click="showAddElementDialog = false">取消</el-button>
  440. <el-button type="primary" @click="handleAddElement" :disabled="!newElementForm.elementName || !newElementForm.elementKey">添加</el-button>
  441. </template>
  442. </el-dialog>
  443. <!-- 添加规则对话框 -->
  444. <el-dialog v-model="showNewRuleDialog" title="添加规则" width="500">
  445. <el-form :model="newRuleForm" label-width="100px">
  446. <el-form-item label="规则名称" required>
  447. <el-input v-model="newRuleForm.ruleName" placeholder="如:项目编号-直接引用实体" />
  448. </el-form-item>
  449. <el-form-item label="规则类型" required>
  450. <el-select v-model="newRuleForm.ruleType" style="width: 100%">
  451. <el-option label="直接引用实体" value="direct_entity" />
  452. <el-option label="AI 提取" value="ai_extract" />
  453. <el-option label="固定值" value="fixed_value" />
  454. <el-option label="计算公式" value="formula" />
  455. </el-select>
  456. </el-form-item>
  457. <el-form-item label="目标要素">
  458. <el-select v-model="newRuleForm.targetElementKey" style="width: 100%" placeholder="选择要填充的要素">
  459. <el-option v-for="elem in elements" :key="elem.elementKey" :label="elem.elementName" :value="elem.elementKey" />
  460. </el-select>
  461. </el-form-item>
  462. </el-form>
  463. <template #footer>
  464. <el-button @click="showNewRuleDialog = false">取消</el-button>
  465. <el-button type="primary" @click="handleCreateRule" :disabled="!newRuleForm.ruleName">创建</el-button>
  466. </template>
  467. </el-dialog>
  468. </div>
  469. </template>
  470. <script setup>
  471. import { ref, reactive, computed, onMounted } from 'vue'
  472. import { useRouter, useRoute } from 'vue-router'
  473. import { Plus, Delete, Search, Loading, Check, CopyDocument, MoreFilled } from '@element-plus/icons-vue'
  474. import { ElMessage, ElMessageBox } from 'element-plus'
  475. import { projectApi, elementApi, valueApi, attachmentApi, entityApi, ruleApi } from '@/api'
  476. const router = useRouter()
  477. const route = useRoute()
  478. const currentProjectId = ref(null)
  479. const hasActiveProject = computed(() => !!currentProjectId.value)
  480. const userName = computed(() => localStorage.getItem('username') || '用户')
  481. const greetingText = computed(() => {
  482. const hour = new Date().getHours()
  483. if (hour < 6) return '凌晨好'
  484. if (hour < 9) return '早上好'
  485. if (hour < 12) return '上午好'
  486. if (hour < 14) return '中午好'
  487. if (hour < 18) return '下午好'
  488. if (hour < 22) return '晚上好'
  489. return '夜深了'
  490. })
  491. const projectTitle = ref('')
  492. const viewMode = ref('document')
  493. const saved = ref(true)
  494. const editorRef = ref(null)
  495. const loading = ref(false)
  496. const leftPanelWidth = ref(300)
  497. const rightPanelWidth = ref(340)
  498. const isResizing = ref(false)
  499. const resizeType = ref('')
  500. const leftPanelTab = ref('projects')
  501. const projects = ref([])
  502. const loadingProjects = ref(false)
  503. const projectSearchKeyword = ref('')
  504. const elements = ref([])
  505. const values = ref([])
  506. const attachments = ref([])
  507. const entities = ref([])
  508. const rules = ref([])
  509. const selectedAttachment = ref(null)
  510. const entitySearchKeyword = ref('')
  511. const entityTypeFilter = ref('')
  512. const executingRules = ref(false)
  513. // 文档预览状态
  514. const docAttachmentId = ref(null)
  515. const docContent = ref(null)
  516. const docLoading = ref(false)
  517. const docHtml = ref('')
  518. const docPaperRef = ref(null)
  519. const highlightEnabled = ref(true)
  520. const elementHighlightCount = ref(0)
  521. const highlightPopover = reactive({
  522. visible: false, x: 0, y: 0,
  523. elementKey: '', fullElementKey: '', elementName: '', currentValue: '', originalValue: '', valueId: null
  524. })
  525. const showNewProjectDialog = ref(false)
  526. const showAddElementDialog = ref(false)
  527. const showNewRuleDialog = ref(false)
  528. const creatingProject = ref(false)
  529. const newProjectForm = reactive({ title: '', description: '' })
  530. const newElementForm = reactive({ elementName: '', elementKey: '', dataType: 'text', description: '' })
  531. const newRuleForm = reactive({ ruleName: '', ruleType: 'direct_entity', targetElementKey: '' })
  532. const filteredProjects = computed(() => {
  533. if (!projectSearchKeyword.value) return projects.value
  534. const kw = projectSearchKeyword.value.toLowerCase()
  535. return projects.value.filter(p => p.title?.toLowerCase().includes(kw))
  536. })
  537. const filteredEntities = computed(() => {
  538. let result = entities.value || []
  539. if (entityTypeFilter.value) result = result.filter(e => e.entityType === entityTypeFilter.value)
  540. if (entitySearchKeyword.value) {
  541. const kw = entitySearchKeyword.value.toLowerCase()
  542. result = result.filter(e => e.entityText?.toLowerCase().includes(kw) || e.businessLabel?.toLowerCase().includes(kw))
  543. }
  544. return result
  545. })
  546. const filledValueCount = computed(() => values.value.filter(v => v.isFilled).length)
  547. // 面板拖拽
  548. function startResizeLeft() {
  549. isResizing.value = true; resizeType.value = 'left'
  550. document.addEventListener('mousemove', handleResize)
  551. document.addEventListener('mouseup', stopResize)
  552. document.body.style.cursor = 'col-resize'; document.body.style.userSelect = 'none'
  553. }
  554. function startResizeRight() {
  555. isResizing.value = true; resizeType.value = 'right'
  556. document.addEventListener('mousemove', handleResize)
  557. document.addEventListener('mouseup', stopResize)
  558. document.body.style.cursor = 'col-resize'; document.body.style.userSelect = 'none'
  559. }
  560. function handleResize(e) {
  561. if (!isResizing.value) return
  562. if (resizeType.value === 'left') leftPanelWidth.value = Math.max(240, Math.min(500, e.clientX))
  563. else if (resizeType.value === 'right') rightPanelWidth.value = Math.max(280, Math.min(500, window.innerWidth - e.clientX))
  564. }
  565. function stopResize() {
  566. isResizing.value = false; resizeType.value = ''
  567. document.removeEventListener('mousemove', handleResize)
  568. document.removeEventListener('mouseup', stopResize)
  569. document.body.style.cursor = ''; document.body.style.userSelect = ''
  570. }
  571. // 项目操作
  572. async function loadProjects() {
  573. loadingProjects.value = true
  574. try {
  575. const data = await projectApi.list({ page: 1, size: 50 })
  576. projects.value = data?.records || data || []
  577. } catch (error) {
  578. console.warn('获取项目列表失败:', error)
  579. projects.value = []
  580. } finally { loadingProjects.value = false }
  581. }
  582. async function switchProject(project) {
  583. if (currentProjectId.value === project.id) { unselectProject(); return }
  584. currentProjectId.value = project.id
  585. projectTitle.value = project.title || ''
  586. leftPanelTab.value = 'projects'
  587. await loadProjectData(project.id)
  588. }
  589. function unselectProject() {
  590. currentProjectId.value = null; projectTitle.value = ''
  591. elements.value = []; values.value = []; attachments.value = []; entities.value = []; rules.value = []
  592. docAttachmentId.value = null; docContent.value = null
  593. leftPanelTab.value = 'projects'
  594. }
  595. async function loadProjectData(projectId) {
  596. loading.value = true
  597. try {
  598. const [elemData, valData, attData, entData, ruleData] = await Promise.all([
  599. elementApi.list(projectId).catch(() => []),
  600. valueApi.list(projectId).catch(() => []),
  601. attachmentApi.list(projectId).catch(() => []),
  602. entityApi.listByProject(projectId).catch(() => []),
  603. ruleApi.list(projectId).catch(() => [])
  604. ])
  605. elements.value = elemData || []; values.value = valData || []
  606. attachments.value = attData || []; entities.value = entData || []; rules.value = ruleData || []
  607. // 自动加载第一个附件的文档内容
  608. if (attachments.value.length > 0) {
  609. docAttachmentId.value = attachments.value[0].id
  610. loadDocContent(attachments.value[0].id)
  611. } else {
  612. docAttachmentId.value = null
  613. docContent.value = null
  614. }
  615. } catch (error) { console.error('加载项目数据失败:', error) }
  616. finally { loading.value = false }
  617. }
  618. async function handleCreateProject() {
  619. if (!newProjectForm.title.trim()) return
  620. creatingProject.value = true
  621. try {
  622. const project = await projectApi.create({ title: newProjectForm.title.trim(), description: newProjectForm.description })
  623. showNewProjectDialog.value = false; newProjectForm.title = ''; newProjectForm.description = ''
  624. await loadProjects()
  625. if (project) await switchProject(project)
  626. ElMessage.success('项目创建成功')
  627. } catch (error) { ElMessage.error('创建失败: ' + error.message) }
  628. finally { creatingProject.value = false }
  629. }
  630. async function handleProjectCommand(cmd, project) {
  631. switch (cmd) {
  632. case 'copy':
  633. try { await projectApi.copy(project.id); await loadProjects(); ElMessage.success('项目复制成功') }
  634. catch (e) { ElMessage.error('复制失败: ' + e.message) }
  635. break
  636. case 'archive':
  637. try { await projectApi.archive(project.id); await loadProjects(); ElMessage.success('项目已归档') }
  638. catch (e) { ElMessage.error('归档失败: ' + e.message) }
  639. break
  640. case 'delete':
  641. try {
  642. await ElMessageBox.confirm(`确定要删除项目「${project.title}」吗?`, '删除确认', { confirmButtonText: '删除', cancelButtonText: '取消', type: 'warning' })
  643. await projectApi.delete(project.id)
  644. if (currentProjectId.value === project.id) unselectProject()
  645. await loadProjects(); ElMessage.success('项目已删除')
  646. } catch (e) { if (e !== 'cancel') ElMessage.error('删除失败: ' + e.message) }
  647. break
  648. }
  649. }
  650. async function handleCopyProject() {
  651. if (!currentProjectId.value) return
  652. try {
  653. const copied = await projectApi.copy(currentProjectId.value)
  654. await loadProjects(); ElMessage.success('项目复制成功')
  655. if (copied) await switchProject(copied)
  656. } catch (e) { ElMessage.error('复制失败: ' + e.message) }
  657. }
  658. function handleSave() { saved.value = true; ElMessage.success('保存成功') }
  659. // ==================== 文档预览 + 可编辑 + 要素高亮 ====================
  660. async function loadDocContent(attId) {
  661. if (!attId) return
  662. docLoading.value = true
  663. docContent.value = null
  664. docHtml.value = ''
  665. try {
  666. const data = await attachmentApi.getDocContent(attId)
  667. docContent.value = data
  668. renderDocHtml()
  669. } catch (e) {
  670. console.warn('加载文档内容失败:', e)
  671. docContent.value = null
  672. docHtml.value = ''
  673. } finally {
  674. docLoading.value = false
  675. }
  676. }
  677. const docPaperStyle = computed(() => {
  678. const page = docContent.value?.page
  679. if (!page) return {}
  680. return {
  681. maxWidth: `${page.widthMm * 3.78}px`,
  682. paddingTop: `${page.marginTopMm * 3.78}px`,
  683. paddingBottom: `${page.marginBottomMm * 3.78}px`,
  684. paddingLeft: `${page.marginLeftMm * 3.78}px`,
  685. paddingRight: `${page.marginRightMm * 3.78}px`,
  686. }
  687. })
  688. // 从值的 elementKey 中提取不含项目前缀的 key
  689. // 例如 "PRJ-2024-001:basicInfo.projectCode" -> "basicInfo.projectCode"
  690. function stripValueKeyPrefix(valueElementKey) {
  691. const idx = valueElementKey?.indexOf(':')
  692. return idx >= 0 ? valueElementKey.substring(idx + 1) : valueElementKey
  693. }
  694. // 构建要素值映射表,分为长文本和短文本两类
  695. function buildElementValueMap() {
  696. const longTexts = [] // paragraph/table 类型的长文本要素
  697. const shortTexts = [] // text 类型的短文本要素
  698. const colors = [
  699. '#fff3cd', '#cce5ff', '#d4edda', '#f8d7da', '#e2d5f1',
  700. '#d1ecf1', '#ffeeba', '#c3e6cb', '#f5c6cb', '#d6d8db'
  701. ]
  702. let colorIdx = 0
  703. for (const elem of elements.value) {
  704. const elemValues = values.value.filter(v => stripValueKeyPrefix(v.elementKey) === elem.elementKey)
  705. const elemType = elem.elementType || 'text'
  706. for (const val of elemValues) {
  707. const text = val.valueText
  708. if (!text || text.length < 2) continue
  709. const entry = {
  710. text,
  711. elementKey: elem.elementKey,
  712. fullElementKey: val.elementKey,
  713. elementName: elem.elementName,
  714. valueId: val.valueId,
  715. elemType,
  716. color: colors[colorIdx % colors.length]
  717. }
  718. // paragraph/table 类型或多行文本视为长文本
  719. if (elemType === 'paragraph' || elemType === 'table' || text.includes('\n') || text.length > 100) {
  720. longTexts.push(entry)
  721. } else {
  722. shortTexts.push(entry)
  723. }
  724. }
  725. colorIdx++
  726. }
  727. // 长文本按长度降序
  728. longTexts.sort((a, b) => b.text.length - a.text.length)
  729. // 短文本按长度降序
  730. shortTexts.sort((a, b) => b.text.length - a.text.length)
  731. return { longTexts, shortTexts }
  732. }
  733. // 将文档 blocks 渲染为 HTML 字符串(含要素高亮)
  734. function renderDocHtml() {
  735. if (!docContent.value?.blocks) { docHtml.value = ''; return }
  736. const blocks = docContent.value.blocks
  737. const { longTexts, shortTexts } = highlightEnabled.value ? buildElementValueMap() : { longTexts: [], shortTexts: [] }
  738. let highlightCount = 0
  739. const parts = []
  740. // 预处理:为每个长文本要素,将其 valueText 按行拆分为句子集合
  741. // 用于判断某个 block 的文本是否属于某个长文本要素
  742. const longTextLines = longTexts.map(lt => ({
  743. ...lt,
  744. lines: new Set(lt.text.split('\n').map(l => l.trim()).filter(l => l.length > 0))
  745. }))
  746. // 收集被长文本高亮覆盖的 block IDs,这些 block 内的短文本不再单独高亮
  747. const longHighlightedBlockIds = new Set()
  748. // 第一遍:确定哪些 block 属于长文本要素
  749. for (const block of blocks) {
  750. const blockText = getBlockPlainText(block)
  751. if (!blockText) continue
  752. for (const lt of longTextLines) {
  753. if (lt.lines.has(blockText)) {
  754. longHighlightedBlockIds.add(block.id)
  755. break
  756. }
  757. }
  758. }
  759. // 第二遍:渲染,连续属于同一长文本要素的 block 合并到一个边框内
  760. let currentLongKey = null // 当前正在收集的长文本要素 key
  761. let currentLongMatch = null // 当前长文本要素匹配信息
  762. let longGroupHtml = '' // 当前长文本分组的 HTML 累积
  763. function flushLongGroup() {
  764. if (currentLongKey && longGroupHtml) {
  765. const borderColor = darkenColor(currentLongMatch.color)
  766. parts.push(`<div class="elem-highlight-wrap" data-elem-key="${currentLongMatch.elementKey}" data-value-id="${currentLongMatch.valueId || ''}" title="${escapeAttr(currentLongMatch.elementName)}" style="border:2px solid ${borderColor};border-radius:4px;padding:6px 8px;margin:4px 0;cursor:pointer;">${longGroupHtml}</div>`)
  767. highlightCount++
  768. }
  769. currentLongKey = null
  770. currentLongMatch = null
  771. longGroupHtml = ''
  772. }
  773. for (const block of blocks) {
  774. if (block.type === 'table') {
  775. flushLongGroup()
  776. const tableMatch = findTableLongTextMatch(block, longTextLines)
  777. parts.push(renderTableHtml(block, tableMatch))
  778. if (tableMatch) highlightCount++
  779. } else {
  780. const blockText = getBlockPlainText(block)
  781. const longMatch = findBlockLongTextMatch(blockText, longTextLines)
  782. if (longMatch) {
  783. // 如果和当前分组是同一个要素,继续累积
  784. if (currentLongKey === longMatch.elementKey) {
  785. longGroupHtml += renderBlockHtml(block, [], null, () => {})
  786. } else {
  787. // 不同要素,先 flush 上一组,再开始新组
  788. flushLongGroup()
  789. currentLongKey = longMatch.elementKey
  790. currentLongMatch = longMatch
  791. longGroupHtml = renderBlockHtml(block, [], null, () => {})
  792. }
  793. } else {
  794. // 非长文本 block,先 flush 再正常渲染
  795. flushLongGroup()
  796. parts.push(renderBlockHtml(block, shortTexts, null, (n) => { highlightCount += n }))
  797. }
  798. }
  799. }
  800. flushLongGroup() // flush 最后一组
  801. elementHighlightCount.value = highlightCount
  802. docHtml.value = parts.join('')
  803. }
  804. // 获取 block 的纯文本
  805. function getBlockPlainText(block) {
  806. if (!block.runs) return ''
  807. return block.runs.map(r => r.text).join('').trim()
  808. }
  809. // 查找 block 文本是否匹配某个长文本要素
  810. function findBlockLongTextMatch(blockText, longTextLines) {
  811. if (!blockText) return null
  812. for (const lt of longTextLines) {
  813. if (lt.lines.has(blockText)) return lt
  814. }
  815. return null
  816. }
  817. // 查找表格是否匹配某个长文本要素(通过表格第一行文本匹配)
  818. function findTableLongTextMatch(block, longTextLines) {
  819. if (!block.table?.data?.length) return null
  820. const firstRowText = block.table.data[0].map(c => c.text).join(' | ')
  821. for (const lt of longTextLines) {
  822. if (lt.text.includes(firstRowText)) return lt
  823. }
  824. return null
  825. }
  826. function renderBlockHtml(block, shortMap, longMatch, countFn) {
  827. const tag = getBlockTag(block.type)
  828. const cls = `doc-block doc-${block.type}`
  829. const styleStr = buildStyleStr(block.style)
  830. const styleAttr = styleStr ? ` style="${styleStr}"` : ''
  831. let inner = ''
  832. // 图片
  833. if (block.images?.length > 0) {
  834. for (const img of block.images) {
  835. const imgStyle = []
  836. if (img.widthInch) imgStyle.push(`width:${img.widthInch}in`)
  837. if (img.heightInch) imgStyle.push(`height:${img.heightInch}in`)
  838. imgStyle.push('max-width:100%', 'display:block', 'margin:8px auto')
  839. inner += `<img src="${img.src}" style="${imgStyle.join(';')}" class="doc-inline-image" contenteditable="false" />`
  840. }
  841. }
  842. // Runs
  843. if (block.runs) {
  844. let runsHtml = ''
  845. for (const run of block.runs) {
  846. const text = escapeHtml(run.text)
  847. const rs = buildRunStyleStr(run)
  848. runsHtml += rs ? `<span style="${rs}">${text}</span>` : text
  849. }
  850. // 长文本高亮:不在 runs 层面处理,在外层 block 包裹
  851. if (longMatch) {
  852. countFn(1)
  853. } else if (shortMap.length > 0 && runsHtml.length > 0) {
  854. // 短文本高亮:只替换 HTML 标签外的纯文本部分,避免破坏已有标签
  855. let count = 0
  856. for (const em of shortMap) {
  857. const escaped = escapeHtml(em.text)
  858. const hl = `<span class="elem-highlight" data-elem-key="${em.elementKey}" data-value-id="${em.valueId || ''}" style="border:1.5px solid ${darkenColor(em.color)};border-radius:3px;padding:0 2px;cursor:pointer;" contenteditable="false" title="${escapeAttr(em.elementName)}">${escaped}</span>`
  859. const newHtml = replaceTextOutsideTags(runsHtml, escaped, hl)
  860. if (newHtml !== runsHtml) {
  861. runsHtml = newHtml
  862. count++
  863. }
  864. }
  865. if (count > 0) countFn(count)
  866. }
  867. inner += runsHtml
  868. }
  869. if (!inner) inner = '&nbsp;'
  870. return `<${tag} class="${cls}"${styleAttr} data-block-id="${block.id}">${inner}</${tag}>`
  871. }
  872. function renderTableHtml(block, longMatch) {
  873. const t = block.table
  874. if (!t?.data) return ''
  875. let html = `<table class="doc-table" data-block-id="${block.id}">`
  876. for (let ri = 0; ri < t.data.length; ri++) {
  877. html += '<tr>'
  878. for (const cell of t.data[ri]) {
  879. const cs = cell.colspan > 1 ? ` colspan="${cell.colspan}"` : ''
  880. html += `<td class="doc-table-cell"${cs}>${escapeHtml(cell.text)}</td>`
  881. }
  882. html += '</tr>'
  883. }
  884. html += '</table>'
  885. if (longMatch) {
  886. const borderColor = darkenColor(longMatch.color)
  887. html = `<div class="elem-highlight-wrap" data-elem-key="${longMatch.elementKey}" data-value-id="${longMatch.valueId || ''}" title="${escapeAttr(longMatch.elementName)}" style="border:2px solid ${borderColor};border-radius:4px;padding:6px;margin:4px auto;cursor:pointer;display:flex;justify-content:center;">${html}</div>`
  888. }
  889. return html
  890. }
  891. function getBlockTag(type) {
  892. if (type === 'heading1') return 'h1'
  893. if (type === 'heading2') return 'h2'
  894. if (type === 'heading3') return 'h3'
  895. if (type?.startsWith('toc')) return 'div'
  896. return 'p'
  897. }
  898. function buildStyleStr(style) {
  899. if (!style) return ''
  900. const parts = []
  901. if (style.alignment) {
  902. const map = { left: 'left', center: 'center', right: 'right', justify: 'justify', both: 'justify' }
  903. parts.push(`text-align:${map[style.alignment] || style.alignment}`)
  904. }
  905. if (style.indentLeft) parts.push(`padding-left:${style.indentLeft / 914400}in`)
  906. if (style.indentRight) parts.push(`padding-right:${style.indentRight / 914400}in`)
  907. if (style.indentFirstLine) parts.push(`text-indent:${style.indentFirstLine / 914400}in`)
  908. if (style.indentHanging) parts.push(`text-indent:-${style.indentHanging / 914400}in`)
  909. if (style.spacingBefore) parts.push(`margin-top:${style.spacingBefore / 914400}in`)
  910. if (style.spacingAfter) parts.push(`margin-bottom:${style.spacingAfter / 914400}in`)
  911. if (style.lineSpacing && style.lineSpacing >= 1 && style.lineSpacing <= 5) parts.push(`line-height:${style.lineSpacing}`)
  912. return parts.join(';')
  913. }
  914. function buildRunStyleStr(run) {
  915. const parts = []
  916. if (run.fontFamily) parts.push(`font-family:${run.fontFamily}`)
  917. if (run.fontSize) parts.push(`font-size:${run.fontSize}pt`)
  918. if (run.bold) parts.push('font-weight:bold')
  919. if (run.italic) parts.push('font-style:italic')
  920. if (run.color) parts.push(`color:${run.color.startsWith('#') ? run.color : '#' + run.color}`)
  921. if (run.underline) parts.push('text-decoration:underline')
  922. if (run.strikeThrough) parts.push('text-decoration:line-through')
  923. return parts.join(';')
  924. }
  925. function escapeHtml(text) {
  926. if (!text) return ''
  927. return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;')
  928. }
  929. function escapeAttr(text) {
  930. if (!text) return ''
  931. return text.replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;')
  932. }
  933. // 只替换 HTML 标签外部的纯文本中的目标字符串,避免破坏已有标签和属性
  934. function replaceTextOutsideTags(html, search, replacement) {
  935. // 将 HTML 拆分为:标签部分 和 文本部分
  936. // 正则匹配所有 HTML 标签(包括自闭合标签)
  937. const parts = html.split(/(<[^>]+>)/g)
  938. let replaced = false
  939. for (let i = 0; i < parts.length; i++) {
  940. // 奇数索引是标签,偶数索引是文本
  941. if (i % 2 === 0 && parts[i].includes(search)) {
  942. parts[i] = parts[i].split(search).join(replacement)
  943. replaced = true
  944. }
  945. }
  946. return replaced ? parts.join('') : html
  947. }
  948. function darkenColor(hex) {
  949. // 简单加深颜色用于下边框
  950. const map = {
  951. '#fff3cd': '#e0a800', '#cce5ff': '#3d8bfd', '#d4edda': '#28a745',
  952. '#f8d7da': '#dc3545', '#e2d5f1': '#6f42c1', '#d1ecf1': '#17a2b8',
  953. '#ffeeba': '#d39e00', '#c3e6cb': '#1e7e34', '#f5c6cb': '#c82333',
  954. '#d6d8db': '#6c757d'
  955. }
  956. return map[hex] || '#999'
  957. }
  958. // 文档编辑事件
  959. function onDocInput() {
  960. saved.value = false
  961. }
  962. // 点击文档中的高亮要素
  963. function onDocClick(e) {
  964. const target = e.target.closest('.elem-highlight') || e.target.closest('.elem-highlight-wrap') || e.target.closest('.elem-highlight-table')
  965. if (!target) {
  966. highlightPopover.visible = false
  967. return
  968. }
  969. const elemKey = target.dataset.elemKey
  970. const valueId = target.dataset.valueId
  971. const elem = elements.value.find(el => el.elementKey === elemKey)
  972. const val = values.value.find(v => String(v.valueId) === String(valueId)) ||
  973. values.value.find(v => stripValueKeyPrefix(v.elementKey) === elemKey)
  974. if (!elem) return
  975. const rect = target.getBoundingClientRect()
  976. const scrollEl = editorRef.value
  977. const scrollRect = scrollEl?.getBoundingClientRect() || { top: 0, left: 0 }
  978. highlightPopover.elementKey = elemKey
  979. highlightPopover.fullElementKey = val?.elementKey || ''
  980. highlightPopover.elementName = elem.elementName
  981. highlightPopover.currentValue = val?.valueText || ''
  982. highlightPopover.originalValue = ''
  983. highlightPopover.valueId = val?.valueId || null
  984. highlightPopover.x = rect.left - scrollRect.left + scrollEl.scrollLeft
  985. highlightPopover.y = rect.bottom - scrollRect.top + scrollEl.scrollTop + 4
  986. highlightPopover.visible = true
  987. }
  988. async function savePopoverValue() {
  989. if (!highlightPopover.elementKey || !currentProjectId.value) {
  990. ElMessage.warning('无法保存:未找到对应的值记录')
  991. return
  992. }
  993. try {
  994. // API: PUT /projects/{projectId}/values/{elementKey} with { valueText }
  995. const apiKey = highlightPopover.fullElementKey || highlightPopover.elementKey
  996. const result = await valueApi.update(currentProjectId.value, apiKey, { valueText: highlightPopover.currentValue })
  997. // 更新本地数据
  998. const val = values.value.find(v => stripValueKeyPrefix(v.elementKey) === highlightPopover.elementKey)
  999. if (val) {
  1000. val.valueText = highlightPopover.currentValue
  1001. val.isFilled = !!highlightPopover.currentValue
  1002. }
  1003. highlightPopover.visible = false
  1004. renderDocHtml()
  1005. ElMessage.success('要素值已更新')
  1006. } catch (e) {
  1007. ElMessage.error('保存失败: ' + e.message)
  1008. }
  1009. }
  1010. // 要素/值
  1011. function getElementValues(elementKey) { return values.value.filter(v => stripValueKeyPrefix(v.elementKey) === elementKey) }
  1012. function hasFilledValue(elementKey) { return values.value.some(v => stripValueKeyPrefix(v.elementKey) === elementKey && v.isFilled) }
  1013. function onValueChange(val) { saved.value = false; val.isModified = true }
  1014. async function handleAddElement() {
  1015. if (!newElementForm.elementName || !newElementForm.elementKey) return
  1016. try {
  1017. const elem = await elementApi.add(currentProjectId.value, { ...newElementForm })
  1018. elements.value.push(elem); showAddElementDialog.value = false
  1019. Object.assign(newElementForm, { elementName: '', elementKey: '', dataType: 'text', description: '' })
  1020. ElMessage.success('要素添加成功')
  1021. } catch (e) { ElMessage.error('添加失败: ' + e.message) }
  1022. }
  1023. // 附件
  1024. async function handleAttachmentUpload(file) {
  1025. if (!currentProjectId.value) return
  1026. try {
  1027. const att = await attachmentApi.upload(currentProjectId.value, file.raw, file.name)
  1028. attachments.value.push(att); ElMessage.success('附件上传成功')
  1029. } catch (e) { ElMessage.error('上传失败: ' + e.message) }
  1030. }
  1031. function selectAttachment(att) { selectedAttachment.value = att }
  1032. async function removeAttachment(att) {
  1033. try {
  1034. await ElMessageBox.confirm(`确定删除附件「${att.displayName}」?`, '删除确认', { type: 'warning' })
  1035. await attachmentApi.delete(att.id)
  1036. attachments.value = attachments.value.filter(a => a.id !== att.id); ElMessage.success('附件已删除')
  1037. } catch (e) { if (e !== 'cancel') ElMessage.error('删除失败') }
  1038. }
  1039. function getFileIcon(att) {
  1040. const name = att.displayName || ''
  1041. if (name.endsWith('.pdf')) return '📕'
  1042. if (name.endsWith('.doc') || name.endsWith('.docx')) return '📘'
  1043. if (name.endsWith('.xls') || name.endsWith('.xlsx')) return '📗'
  1044. return '📄'
  1045. }
  1046. // 规则
  1047. async function handleCreateRule() {
  1048. if (!newRuleForm.ruleName) return
  1049. try {
  1050. const rule = await ruleApi.create(currentProjectId.value, { ...newRuleForm })
  1051. rules.value.push(rule); showNewRuleDialog.value = false
  1052. Object.assign(newRuleForm, { ruleName: '', ruleType: 'direct_entity', targetElementKey: '' })
  1053. ElMessage.success('规则创建成功')
  1054. } catch (e) { ElMessage.error('创建失败: ' + e.message) }
  1055. }
  1056. async function handleDeleteRule(rule) {
  1057. try {
  1058. await ElMessageBox.confirm(`确定删除规则「${rule.ruleName}」?`, '删除确认', { type: 'warning' })
  1059. await ruleApi.delete(rule.id); rules.value = rules.value.filter(r => r.id !== rule.id); ElMessage.success('规则已删除')
  1060. } catch (e) { if (e !== 'cancel') ElMessage.error('删除失败') }
  1061. }
  1062. async function handleExecuteRule(rule) {
  1063. try { await ruleApi.execute(rule.id); ElMessage.success(`规则「${rule.ruleName}」执行成功`); await loadProjectData(currentProjectId.value) }
  1064. catch (e) { ElMessage.error('执行失败: ' + e.message) }
  1065. }
  1066. async function handleBatchExecuteRules() {
  1067. if (!currentProjectId.value) return
  1068. executingRules.value = true
  1069. try { await ruleApi.batchExecute(currentProjectId.value); ElMessage.success('批量执行完成'); await loadProjectData(currentProjectId.value) }
  1070. catch (e) { ElMessage.error('执行失败: ' + e.message) }
  1071. finally { executingRules.value = false }
  1072. }
  1073. // 实体工具
  1074. function getEntityTypeName(type) {
  1075. const map = { 'ORG': '组织机构', 'PERSON': '人物', 'DATE': '日期', 'CODE': '编号', 'NUMBER': '数值', 'LOCATION': '地点', 'MONEY': '金额', 'PERCENT': '百分比' }
  1076. return map[type] || type || '其他'
  1077. }
  1078. function getEntityTypeIcon(type) {
  1079. const map = { 'ORG': '🏢', 'PERSON': '👤', 'DATE': '📅', 'CODE': '🔢', 'NUMBER': '📊', 'LOCATION': '📍', 'MONEY': '💰', 'PERCENT': '📊' }
  1080. return map[type] || '🏷️'
  1081. }
  1082. function getEntityTypeClass(type) {
  1083. const map = { 'ORG': 'entity-org', 'PERSON': 'entity-person', 'DATE': 'entity-date', 'CODE': 'entity-data', 'NUMBER': 'entity-data', 'LOCATION': 'entity-location' }
  1084. return map[type] || 'entity-default'
  1085. }
  1086. // 工具函数
  1087. function formatTime(dateStr) {
  1088. if (!dateStr) return ''
  1089. const date = new Date(dateStr); const now = new Date()
  1090. const diffDays = Math.floor((now - date) / (1000 * 60 * 60 * 24))
  1091. if (diffDays === 0) return '今天'
  1092. if (diffDays === 1) return '昨天'
  1093. if (diffDays < 7) return `${diffDays}天前`
  1094. return date.toLocaleDateString('zh-CN', { month: 'short', day: 'numeric' })
  1095. }
  1096. function getStatusText(status) {
  1097. const map = { 'draft': '草稿', 'active': '进行中', 'archived': '已归档', 'completed': '已完成' }
  1098. return map[status] || '草稿'
  1099. }
  1100. onMounted(async () => {
  1101. await loadProjects()
  1102. const pid = route.query.project
  1103. if (pid) {
  1104. const p = projects.value.find(p => String(p.id) === String(pid))
  1105. if (p) await switchProject(p)
  1106. }
  1107. })
  1108. </script>
  1109. <style lang="scss" scoped>
  1110. // ==========================================
  1111. // Editor 页面样式 - 参考 V2 原型设计
  1112. // ==========================================
  1113. .editor-page {
  1114. height: calc(100vh - 56px);
  1115. display: flex;
  1116. flex-direction: column;
  1117. background: var(--bg);
  1118. }
  1119. .editor-body {
  1120. flex: 1;
  1121. display: flex;
  1122. overflow: hidden;
  1123. }
  1124. // ==========================================
  1125. // 拖拽分隔条
  1126. // ==========================================
  1127. .resize-handle {
  1128. width: 4px;
  1129. background: transparent;
  1130. cursor: col-resize;
  1131. flex-shrink: 0;
  1132. position: relative;
  1133. z-index: 10;
  1134. transition: background 0.2s;
  1135. &:hover, &:active {
  1136. background: var(--primary);
  1137. }
  1138. &::before {
  1139. content: '';
  1140. position: absolute;
  1141. top: 0;
  1142. bottom: 0;
  1143. left: -3px;
  1144. right: -3px;
  1145. }
  1146. }
  1147. // ==========================================
  1148. // 左侧面板 - V2 风格
  1149. // ==========================================
  1150. .left-panel {
  1151. background: var(--white);
  1152. border-right: 1px solid var(--border);
  1153. display: flex;
  1154. flex-direction: column;
  1155. flex-shrink: 0;
  1156. min-width: 240px;
  1157. max-width: 500px;
  1158. overflow: hidden;
  1159. // Tab 导航 - V2 风格(圆角填充)
  1160. .panel-tabs {
  1161. display: flex;
  1162. gap: 6px;
  1163. padding: 10px 12px;
  1164. border-bottom: 1px solid var(--border);
  1165. background: var(--white);
  1166. overflow: hidden;
  1167. .panel-tab {
  1168. padding: 6px 10px;
  1169. font-size: 12px;
  1170. font-weight: 600;
  1171. text-align: center;
  1172. cursor: pointer;
  1173. color: var(--text-2);
  1174. border-radius: 10px;
  1175. border: 1px solid transparent;
  1176. transition: all 0.2s;
  1177. display: flex;
  1178. align-items: center;
  1179. justify-content: center;
  1180. gap: 4px;
  1181. white-space: nowrap;
  1182. flex-shrink: 0;
  1183. &:hover {
  1184. color: var(--primary);
  1185. background: var(--primary-light);
  1186. }
  1187. &.active {
  1188. background: var(--primary);
  1189. color: #fff;
  1190. border-color: rgba(0, 0, 0, 0.04);
  1191. box-shadow: var(--shadow-md);
  1192. }
  1193. .tab-count {
  1194. font-size: 10px;
  1195. font-weight: 500;
  1196. background: rgba(255, 255, 255, 0.2);
  1197. padding: 1px 6px;
  1198. border-radius: 10px;
  1199. color: inherit;
  1200. }
  1201. &:not(.active) .tab-count {
  1202. background: var(--bg);
  1203. color: var(--text-3);
  1204. }
  1205. }
  1206. }
  1207. // Tab 滑入动画 - 简化为淡入淡出
  1208. .tab-slide-enter-active {
  1209. transition: opacity 0.25s ease-out;
  1210. }
  1211. .tab-slide-leave-active {
  1212. transition: opacity 0.15s ease-in;
  1213. }
  1214. .tab-slide-enter-from,
  1215. .tab-slide-leave-to {
  1216. opacity: 0;
  1217. }
  1218. .panel-header {
  1219. padding: 14px 16px;
  1220. border-bottom: 1px solid var(--border);
  1221. font-size: 13px;
  1222. font-weight: 600;
  1223. display: flex;
  1224. justify-content: space-between;
  1225. align-items: center;
  1226. .file-count {
  1227. font-size: 12px;
  1228. color: var(--text-3);
  1229. font-weight: normal;
  1230. }
  1231. }
  1232. .panel-body {
  1233. flex: 1;
  1234. overflow-y: auto;
  1235. padding: 12px;
  1236. min-height: 0;
  1237. &.toc-panel {
  1238. padding: 8px;
  1239. }
  1240. &.reports-panel {
  1241. display: flex;
  1242. flex-direction: column;
  1243. gap: 12px;
  1244. }
  1245. }
  1246. // ==========================================
  1247. // 我的报告面板 - V2 风格
  1248. // ==========================================
  1249. .new-report-btn {
  1250. width: 100%;
  1251. border-radius: var(--radius-md);
  1252. height: 40px;
  1253. font-size: 14px;
  1254. font-weight: 600;
  1255. background: var(--primary-gradient);
  1256. border: none;
  1257. &:hover {
  1258. box-shadow: 0 4px 12px rgba(24, 144, 255, 0.4);
  1259. }
  1260. }
  1261. .report-search {
  1262. :deep(.el-input__wrapper) {
  1263. border-radius: 18px;
  1264. background: var(--bg);
  1265. box-shadow: none;
  1266. border: 1px solid var(--border);
  1267. &:hover, &.is-focus {
  1268. border-color: var(--primary);
  1269. background: var(--white);
  1270. }
  1271. }
  1272. }
  1273. .report-list {
  1274. display: flex;
  1275. flex-direction: column;
  1276. gap: 10px;
  1277. flex: 1;
  1278. overflow-y: auto;
  1279. padding: 4px 0;
  1280. .report-item {
  1281. display: flex;
  1282. align-items: center;
  1283. gap: 10px;
  1284. padding: 12px;
  1285. background: var(--white);
  1286. border: 1px solid var(--border);
  1287. border-radius: var(--radius-md);
  1288. cursor: pointer;
  1289. transition: all 0.2s;
  1290. position: relative;
  1291. &:hover {
  1292. border-color: var(--primary);
  1293. background: var(--primary-light);
  1294. transform: translateY(-1px);
  1295. box-shadow: var(--shadow-sm);
  1296. }
  1297. &.active {
  1298. border-color: var(--primary);
  1299. background: var(--primary-light);
  1300. box-shadow: var(--shadow-sm);
  1301. &::before {
  1302. content: '';
  1303. position: absolute;
  1304. left: 0;
  1305. top: 50%;
  1306. transform: translateY(-50%);
  1307. width: 3px;
  1308. height: 18px;
  1309. background: var(--primary);
  1310. border-radius: 0 2px 2px 0;
  1311. }
  1312. .report-name {
  1313. color: var(--primary);
  1314. }
  1315. }
  1316. .report-icon {
  1317. width: 40px;
  1318. height: 40px;
  1319. border-radius: var(--radius-sm);
  1320. background: var(--bg);
  1321. display: flex;
  1322. align-items: center;
  1323. justify-content: center;
  1324. font-size: 18px;
  1325. flex-shrink: 0;
  1326. }
  1327. .report-info {
  1328. flex: 1;
  1329. min-width: 0;
  1330. .report-name {
  1331. font-weight: 600;
  1332. font-size: 13px;
  1333. color: var(--text-1);
  1334. white-space: nowrap;
  1335. overflow: hidden;
  1336. text-overflow: ellipsis;
  1337. margin-bottom: 4px;
  1338. }
  1339. .report-meta {
  1340. display: flex;
  1341. align-items: center;
  1342. gap: 8px;
  1343. font-size: 11px;
  1344. color: var(--text-3);
  1345. .report-status {
  1346. padding: 2px 8px;
  1347. border-radius: 4px;
  1348. background: var(--bg);
  1349. font-weight: 500;
  1350. &.draft { color: var(--text-3); }
  1351. &.editing { color: var(--primary); background: var(--primary-light); }
  1352. &.published { color: var(--success); background: #f6ffed; }
  1353. &.archived { color: var(--text-3); }
  1354. }
  1355. }
  1356. }
  1357. .report-delete-btn {
  1358. opacity: 0;
  1359. flex-shrink: 0;
  1360. transition: opacity 0.2s;
  1361. border: none;
  1362. background: transparent;
  1363. color: var(--text-3);
  1364. &:hover {
  1365. color: var(--danger);
  1366. background: rgba(255, 77, 79, 0.1);
  1367. }
  1368. }
  1369. &:hover .report-delete-btn {
  1370. opacity: 1;
  1371. }
  1372. }
  1373. }
  1374. .report-empty, .report-loading {
  1375. display: flex;
  1376. flex-direction: column;
  1377. align-items: center;
  1378. justify-content: center;
  1379. padding: 40px 20px;
  1380. color: var(--text-3);
  1381. .empty-icon {
  1382. font-size: 48px;
  1383. margin-bottom: 16px;
  1384. opacity: 0.4;
  1385. }
  1386. .empty-text {
  1387. font-size: 14px;
  1388. font-weight: 500;
  1389. color: var(--text-2);
  1390. margin-bottom: 6px;
  1391. }
  1392. .empty-hint {
  1393. font-size: 12px;
  1394. }
  1395. }
  1396. .report-loading {
  1397. flex-direction: row;
  1398. gap: 10px;
  1399. padding: 24px;
  1400. }
  1401. // ==========================================
  1402. // 目录列表 - V2 风格
  1403. // ==========================================
  1404. .toc-list {
  1405. .toc-item {
  1406. display: flex;
  1407. align-items: flex-start;
  1408. padding: 10px 12px;
  1409. border-radius: var(--radius-sm);
  1410. cursor: pointer;
  1411. transition: all 0.2s;
  1412. font-size: 13px;
  1413. line-height: 1.5;
  1414. &:hover {
  1415. background: var(--primary-light);
  1416. }
  1417. .toc-bullet {
  1418. flex-shrink: 0;
  1419. width: 14px;
  1420. color: var(--primary);
  1421. font-size: 8px;
  1422. margin-top: 5px;
  1423. }
  1424. .toc-text {
  1425. flex: 1;
  1426. color: var(--text-1);
  1427. word-break: break-word;
  1428. }
  1429. .toc-page {
  1430. flex-shrink: 0;
  1431. margin-left: 8px;
  1432. color: var(--text-3);
  1433. font-size: 11px;
  1434. }
  1435. // 层级缩进
  1436. &.toc-level-1 {
  1437. padding-left: 12px;
  1438. font-weight: 600;
  1439. .toc-bullet { font-size: 10px; }
  1440. }
  1441. &.toc-level-2 {
  1442. padding-left: 28px;
  1443. font-weight: 500;
  1444. }
  1445. &.toc-level-3 {
  1446. padding-left: 44px;
  1447. font-size: 12px;
  1448. color: var(--text-2);
  1449. }
  1450. }
  1451. }
  1452. .toc-empty {
  1453. display: flex;
  1454. flex-direction: column;
  1455. align-items: center;
  1456. justify-content: center;
  1457. padding: 40px 20px;
  1458. color: var(--text-3);
  1459. .empty-icon {
  1460. font-size: 48px;
  1461. margin-bottom: 16px;
  1462. opacity: 0.4;
  1463. }
  1464. .empty-text {
  1465. font-size: 14px;
  1466. color: var(--text-2);
  1467. margin-bottom: 6px;
  1468. }
  1469. .empty-hint {
  1470. font-size: 12px;
  1471. }
  1472. }
  1473. }
  1474. // ==========================================
  1475. // 上传区 - V2 风格
  1476. // ==========================================
  1477. .upload-zone {
  1478. border: 2px dashed var(--border);
  1479. border-radius: var(--radius-lg);
  1480. margin-bottom: 16px;
  1481. height: 40px;
  1482. display: flex;
  1483. align-items: center;
  1484. justify-content: center;
  1485. background: var(--white);
  1486. transition: all 0.2s;
  1487. &:hover {
  1488. border-color: var(--primary);
  1489. background: var(--primary-light);
  1490. }
  1491. :deep(.el-upload-dragger) {
  1492. padding: 0 12px;
  1493. border: none;
  1494. background: transparent;
  1495. width: 100%;
  1496. height: 100%;
  1497. display: flex;
  1498. align-items: center;
  1499. justify-content: center;
  1500. }
  1501. .upload-content {
  1502. display: flex;
  1503. align-items: center;
  1504. gap: 8px;
  1505. }
  1506. .upload-icon {
  1507. font-size: 18px;
  1508. }
  1509. .upload-text {
  1510. font-size: 14px;
  1511. font-weight: 600;
  1512. color: var(--text-1);
  1513. }
  1514. .upload-hint {
  1515. display: block;
  1516. font-size: 11px;
  1517. color: var(--text-3);
  1518. margin-top: 8px;
  1519. text-align: center;
  1520. }
  1521. }
  1522. .file-list {
  1523. margin-bottom: 16px;
  1524. display: flex;
  1525. flex-direction: column;
  1526. gap: 10px;
  1527. }
  1528. // ==========================================
  1529. // 文件项 - V2 风格
  1530. // ==========================================
  1531. .file-item {
  1532. display: flex;
  1533. align-items: center;
  1534. gap: 10px;
  1535. padding: 12px;
  1536. background: var(--white);
  1537. border: 1px solid var(--border);
  1538. border-radius: var(--radius-md);
  1539. cursor: pointer;
  1540. transition: all 0.2s;
  1541. position: relative;
  1542. &:hover {
  1543. border-color: var(--primary);
  1544. background: var(--primary-light);
  1545. }
  1546. &.active {
  1547. border-color: var(--primary);
  1548. background: var(--primary-light);
  1549. }
  1550. .file-icon {
  1551. width: 40px;
  1552. height: 40px;
  1553. border-radius: var(--radius-sm);
  1554. display: flex;
  1555. align-items: center;
  1556. justify-content: center;
  1557. color: #fff;
  1558. font-weight: 700;
  1559. font-size: 13px;
  1560. flex-shrink: 0;
  1561. &.pdf { background: #ff6b6b; }
  1562. &.docx, &.doc { background: #4dabf7; }
  1563. &.xlsx, &.xls { background: #73d13d; }
  1564. &.md { background: #9254de; }
  1565. &.default { background: var(--text-3); }
  1566. }
  1567. .file-info {
  1568. flex: 1;
  1569. min-width: 0;
  1570. display: flex;
  1571. flex-direction: column;
  1572. .file-name {
  1573. font-size: 13px;
  1574. font-weight: 600;
  1575. color: var(--text-1);
  1576. white-space: nowrap;
  1577. overflow: hidden;
  1578. text-overflow: ellipsis;
  1579. }
  1580. .file-meta {
  1581. font-size: 11px;
  1582. color: var(--text-3);
  1583. margin-top: 4px;
  1584. .required {
  1585. color: var(--danger);
  1586. }
  1587. }
  1588. }
  1589. .file-status {
  1590. font-size: 11px;
  1591. white-space: nowrap;
  1592. &.parsing { color: var(--primary); }
  1593. &.done { color: var(--success); }
  1594. }
  1595. }
  1596. .add-source-btn {
  1597. width: 100%;
  1598. border-radius: var(--radius-md);
  1599. }
  1600. // ==========================================
  1601. // 中间面板 - V2 风格
  1602. // ==========================================
  1603. .center-panel {
  1604. flex: 1;
  1605. display: flex;
  1606. flex-direction: column;
  1607. background: var(--white);
  1608. overflow: hidden;
  1609. border-radius: var(--radius-md);
  1610. margin: 0 8px;
  1611. box-shadow: var(--shadow-sm);
  1612. // ==========================================
  1613. // 欢迎页 - V2 风格
  1614. // ==========================================
  1615. .welcome-page {
  1616. flex: 1;
  1617. display: flex;
  1618. align-items: center;
  1619. justify-content: center;
  1620. background: var(--white);
  1621. .welcome-content {
  1622. text-align: center;
  1623. max-width: 600px;
  1624. padding: 48px;
  1625. }
  1626. .welcome-logo {
  1627. width: 80px;
  1628. height: 80px;
  1629. margin: 0 auto 32px;
  1630. background: linear-gradient(135deg, var(--primary) 0%, #69c0ff 100%);
  1631. border-radius: 16px;
  1632. display: flex;
  1633. align-items: center;
  1634. justify-content: center;
  1635. font-size: 40px;
  1636. font-weight: 700;
  1637. color: white;
  1638. box-shadow: 0 12px 32px rgba(24, 144, 255, 0.3);
  1639. }
  1640. .welcome {
  1641. h1 {
  1642. font-size: 28px;
  1643. font-weight: 700;
  1644. color: var(--text-1);
  1645. margin-bottom: 12px;
  1646. line-height: 1.4;
  1647. span {
  1648. display: block;
  1649. font-size: 20px;
  1650. font-weight: 500;
  1651. background: var(--ai-gradient);
  1652. background-clip: text;
  1653. -webkit-background-clip: text;
  1654. -webkit-text-fill-color: transparent;
  1655. margin-top: 8px;
  1656. }
  1657. }
  1658. p {
  1659. font-size: 15px;
  1660. color: var(--text-3);
  1661. line-height: 1.6;
  1662. }
  1663. }
  1664. }
  1665. // ==========================================
  1666. // 编辑器标题栏 - V2 风格(集成工具栏)
  1667. // ==========================================
  1668. .editor-title-bar {
  1669. padding: 12px 20px;
  1670. border-bottom: 1px solid var(--border);
  1671. display: flex;
  1672. align-items: center;
  1673. gap: 16px;
  1674. background: var(--white);
  1675. flex-shrink: 0;
  1676. // 左侧:标题和保存状态
  1677. .title-section {
  1678. display: flex;
  1679. align-items: center;
  1680. gap: 10px;
  1681. flex: 1;
  1682. min-width: 0;
  1683. }
  1684. .title-input-wrapper {
  1685. position: relative;
  1686. display: inline-block;
  1687. min-width: 150px;
  1688. max-width: 300px;
  1689. .title-input {
  1690. width: 100%;
  1691. :deep(.el-input__wrapper) {
  1692. box-shadow: none;
  1693. background: transparent;
  1694. border-radius: var(--radius-sm);
  1695. padding: 0 8px;
  1696. &:hover {
  1697. background: var(--bg);
  1698. }
  1699. &.is-focus {
  1700. background: var(--white);
  1701. box-shadow: 0 0 0 2px var(--primary-light);
  1702. }
  1703. }
  1704. :deep(.el-input__inner) {
  1705. font-size: 15px;
  1706. font-weight: 600;
  1707. color: var(--text-1);
  1708. }
  1709. }
  1710. .title-measure {
  1711. position: absolute;
  1712. visibility: hidden;
  1713. white-space: nowrap;
  1714. font-size: 15px;
  1715. font-weight: 600;
  1716. padding: 0 8px;
  1717. pointer-events: none;
  1718. }
  1719. }
  1720. .save-status {
  1721. display: flex;
  1722. align-items: center;
  1723. gap: 4px;
  1724. color: var(--success);
  1725. font-size: 12px;
  1726. white-space: nowrap;
  1727. }
  1728. // 中间:视图切换
  1729. .view-toggle {
  1730. display: flex;
  1731. align-items: center;
  1732. :deep(.el-radio-group) {
  1733. .el-radio-button__inner {
  1734. padding: 6px 12px;
  1735. font-size: 12px;
  1736. }
  1737. }
  1738. }
  1739. // 右侧:操作按钮
  1740. .toolbar-actions {
  1741. display: flex;
  1742. gap: 8px;
  1743. align-items: center;
  1744. flex-shrink: 0;
  1745. :deep(.el-button) {
  1746. border-radius: var(--radius-sm);
  1747. &:not(.el-button--primary) {
  1748. border-color: var(--border);
  1749. &:hover {
  1750. border-color: var(--primary);
  1751. color: var(--primary);
  1752. background: var(--primary-light);
  1753. }
  1754. }
  1755. &.el-button--primary {
  1756. background: var(--primary-gradient);
  1757. border: none;
  1758. &:hover {
  1759. box-shadow: 0 4px 12px rgba(24, 144, 255, 0.4);
  1760. }
  1761. }
  1762. }
  1763. :deep(.el-divider--vertical) {
  1764. height: 20px;
  1765. margin: 0 4px;
  1766. }
  1767. }
  1768. }
  1769. // ==========================================
  1770. // 编辑器滚动区 - V2 风格
  1771. // ==========================================
  1772. .editor-scroll {
  1773. flex: 1;
  1774. overflow-y: auto;
  1775. padding: 40px 48px;
  1776. background: var(--white);
  1777. }
  1778. .editor-content {
  1779. max-width: 1000px;
  1780. margin: 0 auto;
  1781. outline: none;
  1782. // 文档块样式
  1783. :deep(.doc-block) {
  1784. position: relative;
  1785. transition: background-color 0.2s;
  1786. &:hover {
  1787. background-color: rgba(24, 144, 255, 0.02);
  1788. }
  1789. // 被选中时的样式
  1790. &.selected {
  1791. background-color: rgba(24, 144, 255, 0.08);
  1792. outline: 1px dashed var(--primary);
  1793. }
  1794. }
  1795. :deep(h1) {
  1796. font-size: 24px;
  1797. font-weight: 700;
  1798. margin-bottom: 24px;
  1799. }
  1800. :deep(h2) {
  1801. font-size: 18px;
  1802. font-weight: 600;
  1803. margin: 28px 0 16px;
  1804. }
  1805. :deep(p) {
  1806. margin-bottom: 12px;
  1807. line-height: 1.6;
  1808. }
  1809. :deep(ul) {
  1810. margin-bottom: 16px;
  1811. padding-left: 24px;
  1812. li {
  1813. margin-bottom: 8px;
  1814. }
  1815. }
  1816. // 目录样式
  1817. :deep(.doc-toc-title) {
  1818. font-size: 18pt;
  1819. font-weight: bold;
  1820. text-align: center;
  1821. margin: 20px 0 16px;
  1822. }
  1823. :deep(.doc-toc-item) {
  1824. display: flex;
  1825. align-items: baseline;
  1826. padding: 6px 0;
  1827. line-height: 1.6;
  1828. cursor: pointer;
  1829. transition: background-color 0.2s;
  1830. &:hover {
  1831. background-color: #f5f5f5;
  1832. }
  1833. .toc-title {
  1834. flex-shrink: 0;
  1835. white-space: nowrap;
  1836. }
  1837. .toc-dots {
  1838. flex: 1;
  1839. border-bottom: 1px dotted #999;
  1840. margin: 0 8px;
  1841. min-width: 20px;
  1842. height: 0.6em;
  1843. }
  1844. .toc-page {
  1845. flex-shrink: 0;
  1846. color: #666;
  1847. min-width: 20px;
  1848. text-align: right;
  1849. }
  1850. }
  1851. // 表格样式
  1852. :deep(.doc-table-container) {
  1853. margin: 16px 0;
  1854. overflow-x: auto;
  1855. }
  1856. :deep(.doc-table) {
  1857. width: 100%;
  1858. border-collapse: collapse;
  1859. font-size: 14px;
  1860. th, td {
  1861. border: 1px solid #ddd;
  1862. padding: 8px 12px;
  1863. text-align: left;
  1864. vertical-align: top;
  1865. line-height: 1.5;
  1866. }
  1867. th {
  1868. background-color: #f5f5f5;
  1869. font-weight: bold;
  1870. }
  1871. tr:nth-child(even) td {
  1872. background-color: #fafafa;
  1873. }
  1874. tr:hover td {
  1875. background-color: #f0f7ff;
  1876. }
  1877. }
  1878. :deep(.doc-table-empty) {
  1879. padding: 20px;
  1880. text-align: center;
  1881. color: #999;
  1882. border: 1px dashed #ddd;
  1883. margin: 16px 0;
  1884. }
  1885. // 列表项样式
  1886. :deep(.doc-list-item) {
  1887. position: relative;
  1888. margin-bottom: 8px;
  1889. line-height: 1.6;
  1890. &.bullet {
  1891. padding-left: 1.5em;
  1892. &::before {
  1893. content: '•';
  1894. position: absolute;
  1895. left: 0;
  1896. }
  1897. }
  1898. &.ordered {
  1899. padding-left: 2em;
  1900. counter-increment: doc-list;
  1901. &::before {
  1902. content: counter(doc-list) '.';
  1903. position: absolute;
  1904. left: 0;
  1905. }
  1906. }
  1907. }
  1908. // 重置列表计数器
  1909. :deep(p + .doc-list-item.ordered:first-of-type),
  1910. :deep(.doc-list-item.bullet + .doc-list-item.ordered) {
  1911. counter-reset: doc-list;
  1912. }
  1913. // 块引用样式
  1914. :deep(blockquote) {
  1915. margin: 16px 0;
  1916. padding: 12px 20px;
  1917. border-left: 4px solid #ddd;
  1918. background: #f9f9f9;
  1919. color: #666;
  1920. }
  1921. // 代码块样式
  1922. :deep(pre) {
  1923. margin: 16px 0;
  1924. padding: 16px;
  1925. background: #f5f5f5;
  1926. border-radius: 4px;
  1927. overflow-x: auto;
  1928. code {
  1929. font-family: 'Consolas', 'Monaco', monospace;
  1930. font-size: 13px;
  1931. }
  1932. }
  1933. // 实体高亮样式 - 匹配原型 UI(边框 + 背景)
  1934. :deep(.entity-highlight) {
  1935. display: inline;
  1936. padding: 2px 8px;
  1937. border-radius: 4px;
  1938. cursor: pointer;
  1939. transition: all 0.2s;
  1940. font-weight: 500;
  1941. border: 1px solid #1890ff;
  1942. color: #1890ff;
  1943. background: rgba(24, 144, 255, 0.1);
  1944. &:hover {
  1945. background: #1890ff;
  1946. color: white;
  1947. }
  1948. // 实体类型颜色
  1949. &.entity {
  1950. border-color: #1890ff;
  1951. color: #1890ff;
  1952. background: rgba(24, 144, 255, 0.1);
  1953. &:hover { background: #1890ff; color: white; }
  1954. }
  1955. &.concept {
  1956. border-color: #722ed1;
  1957. color: #722ed1;
  1958. background: rgba(114, 46, 209, 0.1);
  1959. &:hover { background: #722ed1; color: white; }
  1960. }
  1961. &.data {
  1962. border-color: #52c41a;
  1963. color: #52c41a;
  1964. background: rgba(82, 196, 26, 0.1);
  1965. &:hover { background: #52c41a; color: white; }
  1966. }
  1967. &.location {
  1968. border-color: #faad14;
  1969. color: #d48806;
  1970. background: rgba(250, 173, 20, 0.1);
  1971. &:hover { background: #faad14; color: white; }
  1972. }
  1973. &.asset {
  1974. border-color: #eb2f96;
  1975. color: #eb2f96;
  1976. background: rgba(235, 47, 150, 0.1);
  1977. &:hover { background: #eb2f96; color: white; }
  1978. }
  1979. &.person {
  1980. border-color: #1890ff;
  1981. color: #1890ff;
  1982. background: rgba(24, 144, 255, 0.1);
  1983. &:hover { background: #1890ff; color: white; }
  1984. }
  1985. &.org {
  1986. border-color: #722ed1;
  1987. color: #722ed1;
  1988. background: rgba(114, 46, 209, 0.1);
  1989. &:hover { background: #722ed1; color: white; }
  1990. }
  1991. &.date {
  1992. border-color: #13c2c2;
  1993. color: #13c2c2;
  1994. background: rgba(19, 194, 194, 0.1);
  1995. &:hover { background: #13c2c2; color: white; }
  1996. }
  1997. &.product {
  1998. border-color: #eb2f96;
  1999. color: #eb2f96;
  2000. background: rgba(235, 47, 150, 0.1);
  2001. &:hover { background: #eb2f96; color: white; }
  2002. }
  2003. &.event {
  2004. border-color: #fa8c16;
  2005. color: #fa8c16;
  2006. background: rgba(250, 140, 22, 0.1);
  2007. &:hover { background: #fa8c16; color: white; }
  2008. }
  2009. &.law {
  2010. border-color: #2f54eb;
  2011. color: #2f54eb;
  2012. background: rgba(47, 84, 235, 0.1);
  2013. &:hover { background: #2f54eb; color: white; }
  2014. }
  2015. // 未确认的 AI 建议(文档中虚线样式)
  2016. &.ai-suggestion-pending {
  2017. border-style: dashed;
  2018. opacity: 0.9;
  2019. }
  2020. // 点击 AI 建议后,文档中该要素的「待确认」高亮
  2021. &.entity-pending-confirm {
  2022. box-shadow: 0 0 0 2px #1890ff;
  2023. opacity: 1;
  2024. }
  2025. }
  2026. }
  2027. }
  2028. // ==========================================
  2029. // 右侧面板 - V2 风格
  2030. // ==========================================
  2031. .right-panel {
  2032. background: var(--white);
  2033. border-left: 1px solid var(--border);
  2034. display: flex;
  2035. flex-direction: column;
  2036. flex-shrink: 0;
  2037. min-width: 280px;
  2038. max-width: 500px;
  2039. overflow: hidden;
  2040. // 右侧面板分为上下两部分
  2041. .element-section {
  2042. flex: 4;
  2043. overflow-y: auto;
  2044. min-height: 0;
  2045. }
  2046. .ai-assistant {
  2047. flex: 6;
  2048. overflow-y: auto;
  2049. min-height: 0;
  2050. display: flex;
  2051. flex-direction: column;
  2052. }
  2053. }
  2054. // ==========================================
  2055. // 要素管理区 - V2 风格
  2056. // ==========================================
  2057. .element-section {
  2058. padding: 16px;
  2059. border-bottom: 1px dashed var(--border);
  2060. // 模块标题样式 - V2 风格
  2061. .module-title {
  2062. display: flex;
  2063. align-items: center;
  2064. gap: 10px;
  2065. font-size: 15px;
  2066. font-weight: 700;
  2067. color: var(--text-1);
  2068. margin-bottom: 14px;
  2069. .module-icon {
  2070. width: 36px;
  2071. height: 36px;
  2072. border-radius: 8px;
  2073. background: var(--primary-gradient);
  2074. display: flex;
  2075. align-items: center;
  2076. justify-content: center;
  2077. font-size: 18px;
  2078. color: white;
  2079. box-shadow: var(--shadow-md);
  2080. }
  2081. }
  2082. .element-header {
  2083. display: flex;
  2084. align-items: center;
  2085. justify-content: space-between;
  2086. margin-bottom: 12px;
  2087. .element-title {
  2088. font-size: 13px;
  2089. font-weight: 600;
  2090. display: flex;
  2091. align-items: center;
  2092. gap: 6px;
  2093. .element-count {
  2094. font-size: 11px;
  2095. color: var(--text-3);
  2096. font-weight: normal;
  2097. }
  2098. }
  2099. .header-actions {
  2100. display: flex;
  2101. gap: 4px;
  2102. .el-button {
  2103. padding: 4px 8px;
  2104. font-size: 12px;
  2105. }
  2106. }
  2107. }
  2108. // AI 建议区块特殊样式
  2109. &.ai-section {
  2110. background: var(--bg);
  2111. border-bottom: none;
  2112. .element-header {
  2113. .element-title {
  2114. color: var(--text-2);
  2115. }
  2116. }
  2117. .element-option.ai-highlight-option {
  2118. display: flex;
  2119. align-items: center;
  2120. gap: 8px;
  2121. padding: 8px 16px;
  2122. font-size: 12px;
  2123. color: var(--text-2);
  2124. .option-label {
  2125. flex: 1;
  2126. }
  2127. }
  2128. .element-tags-wrap {
  2129. max-height: 300px;
  2130. }
  2131. }
  2132. // 要素 Tab 切换 - V2 风格
  2133. .element-tabs {
  2134. display: flex;
  2135. gap: 8px;
  2136. .element-tab {
  2137. padding: 6px 12px;
  2138. border-radius: 12px;
  2139. background: transparent;
  2140. border: 1px solid transparent;
  2141. font-size: 13px;
  2142. cursor: pointer;
  2143. color: var(--text-2);
  2144. transition: all 0.2s;
  2145. &:hover {
  2146. background: var(--bg);
  2147. }
  2148. &.active {
  2149. background: var(--primary);
  2150. color: #fff;
  2151. border-color: rgba(0, 0, 0, 0.04);
  2152. box-shadow: var(--shadow-md);
  2153. }
  2154. }
  2155. }
  2156. .element-filter {
  2157. padding: 0 0 12px;
  2158. .entity-search {
  2159. margin-bottom: 12px;
  2160. :deep(.el-input__wrapper) {
  2161. border-radius: 18px;
  2162. background: var(--bg);
  2163. box-shadow: none;
  2164. border: 1px solid var(--border);
  2165. &:hover, &.is-focus {
  2166. border-color: var(--primary);
  2167. background: var(--white);
  2168. }
  2169. }
  2170. }
  2171. .entity-type-filter {
  2172. display: flex;
  2173. flex-wrap: wrap;
  2174. gap: 6px;
  2175. .filter-tag {
  2176. cursor: pointer;
  2177. transition: all 0.2s;
  2178. border-radius: 12px;
  2179. font-size: 11px;
  2180. &:hover {
  2181. border-color: var(--primary);
  2182. color: var(--primary);
  2183. }
  2184. &.active {
  2185. background: var(--primary);
  2186. color: white;
  2187. border-color: var(--primary);
  2188. }
  2189. &.clear {
  2190. background: transparent;
  2191. border-style: dashed;
  2192. color: var(--text-3);
  2193. &:hover {
  2194. border-color: var(--danger);
  2195. color: var(--danger);
  2196. }
  2197. }
  2198. }
  2199. }
  2200. }
  2201. .element-body {
  2202. padding: 0;
  2203. display: flex;
  2204. flex-direction: column;
  2205. gap: 16px;
  2206. }
  2207. // 要素标签容器 - V2 风格
  2208. .element-tags-wrap {
  2209. display: flex;
  2210. flex-wrap: wrap;
  2211. gap: 8px;
  2212. max-height: 200px;
  2213. overflow-y: auto;
  2214. padding-right: 4px;
  2215. padding-bottom: 16px;
  2216. &::-webkit-scrollbar {
  2217. width: 4px;
  2218. }
  2219. &::-webkit-scrollbar-track {
  2220. background: var(--bg);
  2221. border-radius: 2px;
  2222. }
  2223. &::-webkit-scrollbar-thumb {
  2224. background: var(--border);
  2225. border-radius: 2px;
  2226. &:hover {
  2227. background: var(--text-3);
  2228. }
  2229. }
  2230. }
  2231. // ==========================================
  2232. // 要素标签样式 - V2 风格
  2233. // ==========================================
  2234. .var-tag {
  2235. height: 28px;
  2236. display: inline-flex;
  2237. align-items: center;
  2238. gap: 6px;
  2239. padding: 0 12px;
  2240. border-radius: 2px;
  2241. font-size: 12px;
  2242. cursor: pointer;
  2243. transition: all 0.2s;
  2244. background: var(--bg);
  2245. border: 1px solid var(--border);
  2246. user-select: none;
  2247. &:hover {
  2248. border-color: var(--primary);
  2249. background: var(--primary-light);
  2250. transform: translateY(-1px);
  2251. }
  2252. &:active {
  2253. cursor: grabbing;
  2254. }
  2255. .tag-icon {
  2256. font-size: 12px;
  2257. }
  2258. .tag-name {
  2259. max-width: 120px;
  2260. overflow: hidden;
  2261. text-overflow: ellipsis;
  2262. white-space: nowrap;
  2263. font-weight: 500;
  2264. line-height: 28px;
  2265. }
  2266. .tag-status {
  2267. color: #52c41a;
  2268. font-size: 10px;
  2269. }
  2270. .tag-action {
  2271. color: var(--primary);
  2272. font-size: 14px;
  2273. font-weight: bold;
  2274. margin-left: 2px;
  2275. }
  2276. // 已确认的要素
  2277. &.confirmed {
  2278. background: var(--white);
  2279. border-color: var(--primary);
  2280. .tag-name {
  2281. color: var(--text-1);
  2282. }
  2283. }
  2284. // AI 建议的要素(虚线边框、淡色)
  2285. &.ai-suggestion {
  2286. background: transparent;
  2287. border-style: dashed;
  2288. border-color: var(--border);
  2289. opacity: 0.85;
  2290. .tag-name {
  2291. color: var(--text-2);
  2292. }
  2293. &:hover {
  2294. opacity: 1;
  2295. border-color: var(--primary);
  2296. border-style: solid;
  2297. background: var(--primary-light);
  2298. .tag-action {
  2299. transform: scale(1.2);
  2300. }
  2301. }
  2302. }
  2303. // 动态要素样式(圆角)
  2304. &.dynamic {
  2305. border-radius: 14px;
  2306. }
  2307. // 静态要素样式(微圆角)
  2308. &.static {
  2309. border-radius: 2px;
  2310. }
  2311. // 已确认状态
  2312. &.confirmed {
  2313. background: rgba(82, 196, 26, 0.1);
  2314. border-color: #52c41a;
  2315. .tag-name {
  2316. color: #389e0d;
  2317. }
  2318. }
  2319. // 实体类型样式 - 左边框颜色区分
  2320. &.entity-person, &.entity {
  2321. border-left: 3px solid var(--primary);
  2322. }
  2323. &.entity-org, &.concept {
  2324. border-left: 3px solid #722ed1;
  2325. }
  2326. &.entity-location, &.location {
  2327. border-left: 3px solid var(--warning);
  2328. }
  2329. &.entity-date {
  2330. border-left: 3px solid #13c2c2;
  2331. }
  2332. &.entity-data, &.data {
  2333. border-left: 3px solid var(--success);
  2334. }
  2335. &.entity-product, &.asset {
  2336. border-left: 3px solid #eb2f96;
  2337. }
  2338. &.entity-event {
  2339. border-left: 3px solid #fa8c16;
  2340. }
  2341. &.entity-law {
  2342. border-left: 3px solid #2f54eb;
  2343. }
  2344. &.entity-default {
  2345. border-left: 3px solid #8c8c8c;
  2346. }
  2347. // 当前正在确认的 AI 建议 tag
  2348. &.is-pending {
  2349. border-color: var(--primary);
  2350. background: var(--primary-light);
  2351. border-style: solid;
  2352. }
  2353. }
  2354. // AI 建议确认栏已移至「+」按钮的悬浮框内,此处样式仅作保留注释
  2355. .element-hint {
  2356. font-size: 12px;
  2357. color: var(--text-3);
  2358. text-align: center;
  2359. padding: 24px;
  2360. }
  2361. }
  2362. // 实体高亮闪烁效果
  2363. @keyframes entity-flash {
  2364. 0%, 100% { background-color: inherit; }
  2365. 50% { background-color: #ffe58f; }
  2366. }
  2367. .entity-highlight-flash {
  2368. animation: entity-flash 0.5s ease-in-out 3;
  2369. }
  2370. // 实体编辑弹窗样式
  2371. .entity-edit-form {
  2372. .entity-edit-preview {
  2373. display: flex;
  2374. align-items: center;
  2375. justify-content: center;
  2376. gap: 10px;
  2377. padding: 16px;
  2378. background: var(--primary-light);
  2379. border: 1px dashed var(--primary);
  2380. border-radius: 8px;
  2381. margin-bottom: 20px;
  2382. .preview-icon {
  2383. font-size: 24px;
  2384. }
  2385. .preview-text {
  2386. font-size: 16px;
  2387. font-weight: 600;
  2388. color: var(--primary);
  2389. }
  2390. }
  2391. }
  2392. .category-section {
  2393. padding: 12px 16px;
  2394. border-bottom: 1px solid var(--border);
  2395. .category-header {
  2396. display: flex;
  2397. align-items: center;
  2398. gap: 8px;
  2399. font-size: 12px;
  2400. font-weight: 600;
  2401. margin-bottom: 10px;
  2402. .category-dot {
  2403. width: 10px;
  2404. height: 10px;
  2405. border-radius: 50%;
  2406. }
  2407. .category-count {
  2408. color: var(--text-3);
  2409. font-weight: normal;
  2410. background: var(--bg);
  2411. padding: 2px 8px;
  2412. border-radius: 10px;
  2413. }
  2414. }
  2415. .category-items {
  2416. .category-item {
  2417. display: flex;
  2418. justify-content: space-between;
  2419. padding: 8px 12px;
  2420. background: var(--bg);
  2421. border-radius: 6px;
  2422. margin-bottom: 6px;
  2423. cursor: pointer;
  2424. font-size: 12px;
  2425. transition: all 0.2s;
  2426. &:hover {
  2427. background: var(--primary-light);
  2428. }
  2429. .item-value {
  2430. color: var(--text-3);
  2431. }
  2432. }
  2433. }
  2434. }
  2435. // ==========================================
  2436. // 右键菜单 - V2 风格
  2437. // ==========================================
  2438. .context-menu {
  2439. position: fixed;
  2440. min-width: 180px;
  2441. background: var(--white);
  2442. border-radius: var(--radius-md);
  2443. box-shadow: var(--shadow-lg);
  2444. z-index: 3000;
  2445. overflow: hidden;
  2446. .context-menu-header {
  2447. padding: 12px 14px;
  2448. background: var(--bg);
  2449. border-bottom: 1px solid var(--border);
  2450. .selected-preview {
  2451. font-size: 12px;
  2452. color: var(--primary);
  2453. font-weight: 600;
  2454. max-width: 150px;
  2455. overflow: hidden;
  2456. text-overflow: ellipsis;
  2457. white-space: nowrap;
  2458. }
  2459. }
  2460. .context-menu-section {
  2461. padding: 8px 14px 4px;
  2462. font-size: 10px;
  2463. color: var(--text-3);
  2464. font-weight: 600;
  2465. text-transform: uppercase;
  2466. letter-spacing: 0.5px;
  2467. }
  2468. .context-menu-item {
  2469. display: flex;
  2470. align-items: center;
  2471. gap: 10px;
  2472. padding: 10px 14px;
  2473. font-size: 13px;
  2474. cursor: pointer;
  2475. transition: all 0.15s;
  2476. color: var(--text-1);
  2477. position: relative;
  2478. &:hover {
  2479. background: var(--primary-light);
  2480. color: var(--primary);
  2481. }
  2482. &[disabled="true"] {
  2483. opacity: 0.5;
  2484. pointer-events: none;
  2485. }
  2486. .icon {
  2487. font-size: 14px;
  2488. width: 20px;
  2489. text-align: center;
  2490. flex-shrink: 0;
  2491. }
  2492. .shortcut {
  2493. margin-left: auto;
  2494. font-size: 11px;
  2495. color: var(--text-3);
  2496. }
  2497. .submenu-arrow {
  2498. margin-left: auto;
  2499. font-size: 14px;
  2500. color: var(--text-3);
  2501. }
  2502. &.has-submenu {
  2503. &:hover .submenu-arrow {
  2504. color: var(--primary);
  2505. }
  2506. }
  2507. }
  2508. // 子菜单
  2509. .context-submenu {
  2510. position: absolute;
  2511. left: 100%;
  2512. top: 0;
  2513. min-width: 150px;
  2514. background: var(--white);
  2515. border-radius: var(--radius-md);
  2516. box-shadow: var(--shadow-lg);
  2517. overflow: hidden;
  2518. .context-menu-item {
  2519. padding: 8px 12px;
  2520. font-size: 12px;
  2521. gap: 8px;
  2522. .icon {
  2523. font-size: 12px;
  2524. width: 16px;
  2525. }
  2526. }
  2527. }
  2528. .context-menu-divider {
  2529. height: 1px;
  2530. background: var(--border);
  2531. margin: 4px 0;
  2532. }
  2533. .context-menu-loading {
  2534. display: flex;
  2535. align-items: center;
  2536. justify-content: center;
  2537. gap: 8px;
  2538. padding: 12px;
  2539. color: var(--primary);
  2540. font-size: 12px;
  2541. border-top: 1px solid var(--border);
  2542. background: var(--bg);
  2543. }
  2544. }
  2545. // ==========================================
  2546. // 实体弹出框样式 - V2 风格
  2547. // ==========================================
  2548. .entity-popover {
  2549. .entity-popover-header {
  2550. display: flex;
  2551. align-items: center;
  2552. justify-content: space-between;
  2553. margin-bottom: 10px;
  2554. .entity-text {
  2555. font-weight: 600;
  2556. font-size: 14px;
  2557. max-width: 140px;
  2558. overflow: hidden;
  2559. text-overflow: ellipsis;
  2560. white-space: nowrap;
  2561. color: var(--text-1);
  2562. }
  2563. }
  2564. .entity-popover-type {
  2565. font-size: 12px;
  2566. color: var(--text-2);
  2567. margin-bottom: 14px;
  2568. padding: 4px 8px;
  2569. background: var(--bg);
  2570. border-radius: 4px;
  2571. display: inline-block;
  2572. }
  2573. .entity-popover-actions {
  2574. display: flex;
  2575. gap: 8px;
  2576. flex-wrap: wrap;
  2577. :deep(.el-button) {
  2578. border-radius: var(--radius-sm);
  2579. }
  2580. }
  2581. }
  2582. // ==========================================
  2583. // 知识图谱容器 - V2 风格
  2584. // ==========================================
  2585. .graph-container {
  2586. height: 500px;
  2587. position: relative;
  2588. background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
  2589. linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
  2590. linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
  2591. linear-gradient(-45deg, transparent 75%, #f8f8f8 75%);
  2592. background-size: 20px 20px;
  2593. background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  2594. border-radius: var(--radius-md);
  2595. .graph-legend {
  2596. position: absolute;
  2597. top: 16px;
  2598. left: 16px;
  2599. background: var(--white);
  2600. border-radius: var(--radius-md);
  2601. padding: 14px 18px;
  2602. box-shadow: var(--shadow-md);
  2603. .legend-title {
  2604. font-size: 12px;
  2605. font-weight: 600;
  2606. margin-bottom: 10px;
  2607. color: var(--text-1);
  2608. }
  2609. .legend-item {
  2610. display: flex;
  2611. align-items: center;
  2612. gap: 8px;
  2613. font-size: 12px;
  2614. color: var(--text-2);
  2615. margin-bottom: 6px;
  2616. &:last-child {
  2617. margin-bottom: 0;
  2618. }
  2619. }
  2620. .legend-dot {
  2621. width: 12px;
  2622. height: 12px;
  2623. border-radius: 50%;
  2624. &.core, &.entity { background: var(--primary); }
  2625. &.concept { background: #722ed1; }
  2626. &.data { background: var(--success); }
  2627. &.location { background: var(--warning); }
  2628. }
  2629. }
  2630. .graph-body {
  2631. height: 100%;
  2632. display: flex;
  2633. align-items: center;
  2634. justify-content: center;
  2635. .graph-placeholder {
  2636. text-align: center;
  2637. color: var(--text-3);
  2638. .placeholder-icon {
  2639. font-size: 48px;
  2640. margin-bottom: 16px;
  2641. opacity: 0.5;
  2642. }
  2643. p {
  2644. margin-top: 12px;
  2645. font-size: 14px;
  2646. }
  2647. }
  2648. }
  2649. }
  2650. // ==========================================
  2651. // 空白编辑器占位提示样式 - V2 风格
  2652. // ==========================================
  2653. :deep(.empty-editor-placeholder) {
  2654. display: flex;
  2655. flex-direction: column;
  2656. align-items: center;
  2657. justify-content: center;
  2658. padding: 80px 40px;
  2659. text-align: center;
  2660. min-height: 400px;
  2661. .empty-icon {
  2662. font-size: 64px;
  2663. margin-bottom: 24px;
  2664. opacity: 0.8;
  2665. }
  2666. h2 {
  2667. font-size: 24px;
  2668. font-weight: 600;
  2669. margin-bottom: 12px;
  2670. color: var(--text-1);
  2671. }
  2672. .empty-subtitle {
  2673. font-size: 15px;
  2674. color: var(--text-3);
  2675. margin-bottom: 32px;
  2676. }
  2677. .empty-actions {
  2678. display: flex;
  2679. flex-direction: column;
  2680. gap: 12px;
  2681. margin-bottom: 32px;
  2682. width: 100%;
  2683. max-width: 400px;
  2684. }
  2685. .action-card {
  2686. display: flex;
  2687. align-items: center;
  2688. gap: 12px;
  2689. padding: 16px 20px;
  2690. background: var(--bg);
  2691. border: 1px solid var(--border);
  2692. border-radius: var(--radius-md);
  2693. cursor: pointer;
  2694. transition: all 0.2s;
  2695. text-align: left;
  2696. &:hover {
  2697. border-color: var(--primary);
  2698. background: var(--primary-light);
  2699. transform: translateX(4px);
  2700. }
  2701. .action-icon {
  2702. font-size: 24px;
  2703. flex-shrink: 0;
  2704. }
  2705. .action-text {
  2706. font-size: 14px;
  2707. color: var(--text-1);
  2708. font-weight: 500;
  2709. }
  2710. }
  2711. .empty-hint {
  2712. font-size: 13px;
  2713. color: var(--text-3);
  2714. padding: 12px 20px;
  2715. background: var(--bg);
  2716. border-radius: var(--radius-md);
  2717. border-left: 3px solid var(--primary);
  2718. }
  2719. }
  2720. // 高亮块动画
  2721. .highlight-block {
  2722. animation: highlight-pulse 2s ease-out;
  2723. }
  2724. @keyframes highlight-pulse {
  2725. 0% {
  2726. background: rgba(24, 144, 255, 0.3);
  2727. box-shadow: 0 0 0 4px rgba(24, 144, 255, 0.2);
  2728. }
  2729. 100% {
  2730. background: transparent;
  2731. box-shadow: none;
  2732. }
  2733. }
  2734. // ==========================================
  2735. // 报告要素管理弹窗样式
  2736. // ==========================================
  2737. .elements-modal {
  2738. :deep(.el-dialog__header) {
  2739. padding: 16px 20px;
  2740. border-bottom: 1px solid var(--border);
  2741. margin-right: 0;
  2742. }
  2743. :deep(.el-dialog__body) {
  2744. padding: 0;
  2745. }
  2746. :deep(.el-dialog__footer) {
  2747. padding: 12px 20px;
  2748. border-top: 1px solid var(--border);
  2749. }
  2750. }
  2751. .elements-modal-content {
  2752. .elements-search {
  2753. display: flex;
  2754. align-items: center;
  2755. gap: 16px;
  2756. padding: 16px 20px;
  2757. border-bottom: 1px solid var(--border);
  2758. background: var(--bg);
  2759. .el-input {
  2760. max-width: 300px;
  2761. }
  2762. }
  2763. .elements-table-wrap {
  2764. padding: 0;
  2765. :deep(.el-table) {
  2766. .element-name {
  2767. font-weight: 500;
  2768. color: var(--text-1);
  2769. }
  2770. .element-desc {
  2771. color: var(--text-3);
  2772. font-size: 12px;
  2773. }
  2774. .original-value {
  2775. color: var(--text-2);
  2776. font-size: 12px;
  2777. }
  2778. .element-source {
  2779. color: var(--primary);
  2780. font-size: 12px;
  2781. }
  2782. .el-input__wrapper {
  2783. box-shadow: none;
  2784. background: var(--bg);
  2785. border-radius: var(--radius-sm);
  2786. &:hover, &.is-focus {
  2787. background: var(--white);
  2788. box-shadow: 0 0 0 1px var(--primary);
  2789. }
  2790. }
  2791. }
  2792. }
  2793. .elements-pagination {
  2794. display: flex;
  2795. justify-content: flex-end;
  2796. padding: 12px 20px;
  2797. border-top: 1px solid var(--border);
  2798. }
  2799. }
  2800. // ==========================================
  2801. // 新建报告对话框样式
  2802. // ==========================================
  2803. .new-report-dialog {
  2804. :deep(.el-dialog__header) {
  2805. padding: 16px 20px;
  2806. border-bottom: 1px solid var(--border);
  2807. margin-right: 0;
  2808. }
  2809. :deep(.el-dialog__body) {
  2810. padding: 20px;
  2811. }
  2812. :deep(.el-dialog__footer) {
  2813. padding: 12px 20px;
  2814. border-top: 1px solid var(--border);
  2815. }
  2816. }
  2817. .new-report-form {
  2818. .section-label {
  2819. font-size: 13px;
  2820. font-weight: 500;
  2821. color: var(--text-2);
  2822. margin-bottom: 10px;
  2823. }
  2824. .create-type-section {
  2825. margin-bottom: 20px;
  2826. }
  2827. .create-type-options {
  2828. display: flex;
  2829. gap: 12px;
  2830. }
  2831. .type-option {
  2832. flex: 1;
  2833. display: flex;
  2834. align-items: flex-start;
  2835. gap: 12px;
  2836. padding: 14px;
  2837. background: var(--bg);
  2838. border: 2px solid var(--border);
  2839. border-radius: var(--radius-md);
  2840. cursor: pointer;
  2841. transition: all 0.2s;
  2842. position: relative;
  2843. &:hover {
  2844. border-color: var(--primary-light);
  2845. background: var(--white);
  2846. }
  2847. &.active {
  2848. border-color: var(--primary);
  2849. background: var(--primary-light);
  2850. .option-title {
  2851. color: var(--primary);
  2852. }
  2853. }
  2854. .option-icon {
  2855. font-size: 24px;
  2856. flex-shrink: 0;
  2857. line-height: 1;
  2858. }
  2859. .option-content {
  2860. flex: 1;
  2861. min-width: 0;
  2862. }
  2863. .option-title {
  2864. font-size: 14px;
  2865. font-weight: 600;
  2866. color: var(--text-1);
  2867. margin-bottom: 4px;
  2868. }
  2869. .option-desc {
  2870. font-size: 12px;
  2871. color: var(--text-3);
  2872. line-height: 1.4;
  2873. }
  2874. .option-check {
  2875. position: absolute;
  2876. top: 8px;
  2877. right: 8px;
  2878. width: 20px;
  2879. height: 20px;
  2880. background: var(--primary);
  2881. color: white;
  2882. border-radius: 50%;
  2883. display: flex;
  2884. align-items: center;
  2885. justify-content: center;
  2886. font-size: 12px;
  2887. font-weight: bold;
  2888. }
  2889. }
  2890. .name-input-section {
  2891. margin-bottom: 20px;
  2892. :deep(.el-input__wrapper) {
  2893. border-radius: var(--radius-sm);
  2894. }
  2895. }
  2896. .upload-section {
  2897. .report-upload-area {
  2898. :deep(.el-upload) {
  2899. width: 100%;
  2900. }
  2901. :deep(.el-upload-dragger) {
  2902. width: 100%;
  2903. height: auto;
  2904. padding: 24px;
  2905. border-radius: var(--radius-md);
  2906. border: 2px dashed var(--border);
  2907. background: var(--bg);
  2908. &:hover {
  2909. border-color: var(--primary);
  2910. background: var(--primary-light);
  2911. }
  2912. }
  2913. .upload-content {
  2914. text-align: center;
  2915. }
  2916. .upload-icon {
  2917. font-size: 32px;
  2918. color: var(--text-3);
  2919. margin-bottom: 8px;
  2920. }
  2921. .upload-text {
  2922. font-size: 14px;
  2923. color: var(--text-2);
  2924. margin-bottom: 4px;
  2925. em {
  2926. color: var(--primary);
  2927. font-style: normal;
  2928. }
  2929. }
  2930. .upload-hint {
  2931. font-size: 12px;
  2932. color: var(--text-3);
  2933. }
  2934. }
  2935. }
  2936. }
  2937. // ==========================================
  2938. // 要素视图
  2939. // ==========================================
  2940. .elements-view {
  2941. padding: 24px;
  2942. .elements-grid {
  2943. display: grid;
  2944. grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  2945. gap: 16px;
  2946. }
  2947. .element-card {
  2948. background: var(--white);
  2949. border: 1px solid var(--border);
  2950. border-radius: var(--radius-md);
  2951. overflow: hidden;
  2952. transition: all 0.2s;
  2953. &:hover {
  2954. border-color: var(--primary);
  2955. box-shadow: var(--shadow-sm);
  2956. }
  2957. .element-card-header {
  2958. display: flex;
  2959. align-items: center;
  2960. justify-content: space-between;
  2961. padding: 12px 16px;
  2962. background: var(--bg);
  2963. border-bottom: 1px solid var(--border);
  2964. .element-label {
  2965. font-weight: 600;
  2966. font-size: 14px;
  2967. color: var(--text-1);
  2968. }
  2969. }
  2970. .element-card-body {
  2971. padding: 12px 16px;
  2972. .element-value-row {
  2973. margin-bottom: 8px;
  2974. .value-meta {
  2975. margin-top: 4px;
  2976. font-size: 11px;
  2977. color: var(--text-3);
  2978. .original-label {
  2979. margin-right: 4px;
  2980. }
  2981. .original-value {
  2982. color: var(--text-2);
  2983. }
  2984. }
  2985. .value-status {
  2986. margin-top: 4px;
  2987. }
  2988. }
  2989. .element-empty {
  2990. padding: 16px 0;
  2991. text-align: center;
  2992. .empty-hint {
  2993. font-size: 12px;
  2994. color: var(--text-3);
  2995. }
  2996. }
  2997. }
  2998. }
  2999. .elements-empty {
  3000. padding: 60px 20px;
  3001. text-align: center;
  3002. }
  3003. }
  3004. // ==========================================
  3005. // 实体视图
  3006. // ==========================================
  3007. .entities-view {
  3008. padding: 24px;
  3009. .entity-filter-bar {
  3010. display: flex;
  3011. align-items: center;
  3012. margin-bottom: 16px;
  3013. }
  3014. .entities-empty {
  3015. padding: 60px 20px;
  3016. text-align: center;
  3017. }
  3018. }
  3019. // ==========================================
  3020. // 项目概览统计
  3021. // ==========================================
  3022. .overview-stats {
  3023. display: grid;
  3024. grid-template-columns: repeat(3, 1fr);
  3025. gap: 12px;
  3026. .stat-item {
  3027. display: flex;
  3028. flex-direction: column;
  3029. align-items: center;
  3030. padding: 12px 8px;
  3031. background: var(--bg);
  3032. border-radius: var(--radius-sm);
  3033. .stat-label {
  3034. font-size: 11px;
  3035. color: var(--text-3);
  3036. margin-bottom: 4px;
  3037. }
  3038. .stat-value {
  3039. font-size: 20px;
  3040. font-weight: 700;
  3041. color: var(--text-1);
  3042. &.filled {
  3043. color: var(--success);
  3044. }
  3045. }
  3046. }
  3047. }
  3048. // ==========================================
  3049. // 文档视图 - Word 排版还原 + 可编辑 + 要素高亮
  3050. // ==========================================
  3051. .document-view {
  3052. display: flex;
  3053. flex-direction: column;
  3054. align-items: center;
  3055. padding: 20px;
  3056. background: #e8e8e8;
  3057. min-height: 100%;
  3058. position: relative;
  3059. .doc-toolbar {
  3060. display: flex;
  3061. align-items: center;
  3062. justify-content: space-between;
  3063. gap: 12px;
  3064. margin-bottom: 16px;
  3065. padding: 8px 16px;
  3066. background: var(--white);
  3067. border-radius: var(--radius-md);
  3068. box-shadow: var(--shadow-sm);
  3069. width: 100%;
  3070. max-width: 820px;
  3071. .doc-toolbar-left, .doc-toolbar-right {
  3072. display: flex;
  3073. align-items: center;
  3074. gap: 8px;
  3075. }
  3076. .doc-att-label {
  3077. font-size: 13px;
  3078. font-weight: 600;
  3079. color: var(--text-2);
  3080. white-space: nowrap;
  3081. }
  3082. }
  3083. .doc-paper {
  3084. background: #fff;
  3085. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  3086. border-radius: 2px;
  3087. width: 100%;
  3088. max-width: 820px;
  3089. min-height: 1100px;
  3090. padding: 96px 90px;
  3091. font-family: 'Times New Roman', 'SimSun', '宋体', serif;
  3092. font-size: 12pt;
  3093. line-height: 1.6;
  3094. color: #000;
  3095. word-wrap: break-word;
  3096. overflow-wrap: break-word;
  3097. }
  3098. .doc-block {
  3099. margin: 0;
  3100. padding: 0;
  3101. min-height: 1em;
  3102. }
  3103. // 标题样式
  3104. h1.doc-block {
  3105. font-size: 18pt;
  3106. font-weight: bold;
  3107. margin: 16px 0 10px;
  3108. line-height: 1.4;
  3109. }
  3110. h2.doc-block {
  3111. font-size: 16pt;
  3112. font-weight: bold;
  3113. margin: 14px 0 8px;
  3114. line-height: 1.4;
  3115. }
  3116. h3.doc-block {
  3117. font-size: 14pt;
  3118. font-weight: bold;
  3119. margin: 12px 0 6px;
  3120. line-height: 1.4;
  3121. }
  3122. // 段落
  3123. p.doc-block {
  3124. margin: 0 0 2px;
  3125. text-align: justify;
  3126. }
  3127. // 目录
  3128. .doc-toc1, .doc-toc2, .doc-toc3 {
  3129. font-size: 14pt;
  3130. margin: 2px 0;
  3131. cursor: default;
  3132. }
  3133. .doc-toc2 {
  3134. padding-left: 24px;
  3135. font-size: 12pt;
  3136. }
  3137. .doc-toc3 {
  3138. padding-left: 48px;
  3139. font-size: 11pt;
  3140. }
  3141. // 空段落
  3142. p.doc-paragraph:empty::after,
  3143. p.doc-block:empty::after {
  3144. content: '\00a0';
  3145. }
  3146. // 内联图片
  3147. .doc-inline-image {
  3148. max-width: 100%;
  3149. height: auto;
  3150. display: block;
  3151. margin: 8px auto;
  3152. }
  3153. // 表格
  3154. .doc-table {
  3155. width: 100%;
  3156. border-collapse: collapse;
  3157. margin: 12px 0;
  3158. font-size: 11pt;
  3159. .doc-table-cell {
  3160. border: 1px solid #000;
  3161. padding: 6px 8px;
  3162. vertical-align: top;
  3163. line-height: 1.4;
  3164. }
  3165. tr:first-child .doc-table-cell {
  3166. font-weight: bold;
  3167. background: #f0f0f0;
  3168. }
  3169. }
  3170. // 空状态 & 加载
  3171. .doc-empty, .doc-loading {
  3172. display: flex;
  3173. flex-direction: column;
  3174. align-items: center;
  3175. justify-content: center;
  3176. padding: 80px 20px;
  3177. width: 100%;
  3178. max-width: 820px;
  3179. background: var(--white);
  3180. border-radius: var(--radius-md);
  3181. box-shadow: var(--shadow-sm);
  3182. }
  3183. .doc-loading {
  3184. flex-direction: row;
  3185. gap: 12px;
  3186. padding: 40px;
  3187. font-size: 14px;
  3188. color: var(--text-2);
  3189. }
  3190. }
  3191. // ==========================================
  3192. // 要素高亮弹出框
  3193. // ==========================================
  3194. .element-popover {
  3195. position: absolute;
  3196. z-index: 1000;
  3197. background: #fff;
  3198. border: 1px solid var(--border);
  3199. border-radius: var(--radius-md);
  3200. box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  3201. width: 320px;
  3202. overflow: hidden;
  3203. .popover-header {
  3204. display: flex;
  3205. align-items: center;
  3206. justify-content: space-between;
  3207. padding: 10px 14px;
  3208. background: var(--bg);
  3209. border-bottom: 1px solid var(--border);
  3210. .popover-label {
  3211. font-weight: 600;
  3212. font-size: 14px;
  3213. color: var(--text-1);
  3214. }
  3215. }
  3216. .popover-body {
  3217. padding: 12px 14px;
  3218. .popover-field {
  3219. margin-bottom: 10px;
  3220. &:last-child {
  3221. margin-bottom: 0;
  3222. }
  3223. .popover-field-label {
  3224. display: block;
  3225. font-size: 12px;
  3226. color: var(--text-3);
  3227. margin-bottom: 4px;
  3228. }
  3229. .popover-original {
  3230. font-size: 13px;
  3231. color: var(--text-2);
  3232. background: var(--bg);
  3233. padding: 4px 8px;
  3234. border-radius: var(--radius-sm);
  3235. display: inline-block;
  3236. }
  3237. }
  3238. }
  3239. .popover-footer {
  3240. display: flex;
  3241. justify-content: flex-end;
  3242. gap: 8px;
  3243. padding: 8px 14px;
  3244. border-top: 1px solid var(--border);
  3245. background: var(--bg);
  3246. }
  3247. }
  3248. // 可编辑文档纸张的光标和选区样式
  3249. .doc-paper[contenteditable="true"] {
  3250. outline: none;
  3251. cursor: text;
  3252. &:focus {
  3253. box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(24, 144, 255, 0.2);
  3254. }
  3255. }
  3256. // 高亮边框样式
  3257. .elem-highlight {
  3258. transition: border-color 0.2s, box-shadow 0.2s;
  3259. &:hover {
  3260. box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.4);
  3261. border-color: #1890ff !important;
  3262. }
  3263. }
  3264. .elem-highlight-long {
  3265. display: inline !important;
  3266. transition: border-color 0.2s, box-shadow 0.2s;
  3267. &:hover {
  3268. box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.4);
  3269. border-color: #1890ff !important;
  3270. }
  3271. }
  3272. .elem-highlight-wrap {
  3273. position: relative;
  3274. transition: border-color 0.2s, box-shadow 0.2s;
  3275. &:hover {
  3276. border-color: #1890ff !important;
  3277. box-shadow: 0 0 0 1px rgba(24, 144, 255, 0.4);
  3278. }
  3279. .doc-table {
  3280. margin: 0 auto;
  3281. }
  3282. }
  3283. </style>