IntimacyPanel.vue 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712
  1. <template>
  2. <div class="intimacy-panel">
  3. <div class="section-header">
  4. <div class="section-title">亲密关系人</div>
  5. <div class="section-tools">
  6. <Input v-model:value="keyword" class="relation-search" placeholder="搜索被关联对象" allow-clear />
  7. <Button type="link" class="section-action" @click="handleOpenConfigModal">编辑</Button>
  8. </div>
  9. </div>
  10. <Spin :spinning="loading">
  11. <div v-if="filteredRelations.length" class="intimacy-content">
  12. <div class="intimacy-rail">
  13. <div class="intimacy-left-wrap">
  14. <Button v-if="showPrevButton" class="scroll-btn scroll-btn--prev" @click="scrollCards('left')">&lt;</Button>
  15. <div ref="cardListRef" class="intimacy-card-list" @scroll="updateScrollButtons">
  16. <button
  17. v-for="(relation, index) in filteredRelations"
  18. :key="relation.id"
  19. type="button"
  20. class="intimacy-card"
  21. :class="{ active: index === activeIndex }"
  22. @click="activeIndex = index"
  23. >
  24. <div class="intimacy-card__top">
  25. <div class="intimacy-card__head">
  26. <PersonAvatar class="relation-avatar" :size="42" :alt="relation.otherName" />
  27. <div class="intimacy-card__name" :title="relation.otherName">{{ relation.otherName }}</div>
  28. </div>
  29. <div class="intimacy-card__score-wrap">
  30. <div class="intimacy-card__score-badge">{{ relation.intimacyText }}</div>
  31. <div class="intimacy-card__score">亲密度</div>
  32. </div>
  33. </div>
  34. <div class="intimacy-card__tags">
  35. <span
  36. v-for="behavior in relation.behaviors"
  37. :key="behavior.key"
  38. class="behavior-tag"
  39. :style="getTagStyle(behavior)"
  40. >
  41. {{ getIntimacyBehaviorDisplayName(behavior.name) }}
  42. </span>
  43. </div>
  44. </button>
  45. </div>
  46. <Button v-if="showNextButton" class="scroll-btn scroll-btn--next" @click="scrollCards('right')">
  47. &gt;
  48. </Button>
  49. </div>
  50. </div>
  51. <div class="intimacy-detail">
  52. <div class="intimacy-detail__title-row">
  53. <div class="intimacy-detail__title">亲密度详情</div>
  54. <div class="intimacy-detail__summary-inline">
  55. <div class="summary-item">
  56. <span class="label">关系人:</span>
  57. <span class="value">{{ activeRelation?.otherName || '-' }}</span>
  58. </div>
  59. <div class="summary-item">
  60. <span class="label">亲密度:</span>
  61. <span class="value value--accent">{{ activeRelation?.intimacyText || '-' }}</span>
  62. </div>
  63. <div class="intimacy-detail__meta">
  64. {{ activeRelation ? `命中 ${activeRelation.details.length} 项行为` : '未选择关系人' }}
  65. </div>
  66. </div>
  67. </div>
  68. <div v-if="activeRelation?.details.length" class="intimacy-detail__list">
  69. <div v-for="detail in activeRelation.details" :key="detail.key" class="detail-item">
  70. <span class="detail-dot" :style="{ backgroundColor: detail.color }"></span>
  71. <div class="detail-main">
  72. <div class="detail-title">
  73. {{ detail.title }}
  74. <span v-if="detail.weightText" class="detail-weight">(权重{{ detail.weightText }})</span>
  75. </div>
  76. <div class="detail-desc">
  77. <span
  78. v-for="(seg, segIndex) in parseDescriptionSegments(detail.description)"
  79. :key="segIndex"
  80. :class="{ 'detail-value--clickable': seg.clickable }"
  81. @click="seg.clickable && handleJumpToAnalysis(detail)"
  82. >{{ seg.text }}</span
  83. >
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. <div v-else class="detail-empty">
  89. <EmptyState title="暂无数据" description="当前关系暂无行为详情" variant="compact" :min-height="160" />
  90. </div>
  91. </div>
  92. </div>
  93. <div v-else class="intimacy-empty">
  94. <EmptyState
  95. :title="selectedPerson ? '暂无亲密关系人' : '请先选择对象'"
  96. :description="selectedPerson ? '当前对象暂无亲密度分析结果' : '选择左侧对象后可查看亲密关系人与行为详情'"
  97. />
  98. </div>
  99. </Spin>
  100. <BasicModal
  101. :open="configModalOpen"
  102. title="亲密度配置"
  103. :confirmLoading="configSaving"
  104. :width="920"
  105. :centered="true"
  106. :destroyOnClose="false"
  107. okText="应用配置"
  108. wrapClassName="intimacy-config-modal"
  109. @ok="handleSaveConfig"
  110. @update:open="handleConfigModalChange"
  111. @cancel="closeConfigModal"
  112. >
  113. <div class="config-modal">
  114. <div class="config-modal__summary" :class="{ 'is-error': configTotalExceeded }">
  115. <div class="config-modal__summary-main">
  116. <div class="config-modal__summary-label">权重总和</div>
  117. <div class="config-modal__summary-value"> {{ configTotalWeight }}<span class="unit">%</span> </div>
  118. <div class="config-modal__summary-tip">支持同时调整权重和分值,权重总和不能超过 100。</div>
  119. </div>
  120. <div class="config-modal__summary-extra">
  121. <div class="config-modal__remaining">
  122. {{ configTotalExceeded ? `已超出 ${configExceededWeight}%` : `剩余 ${configRemainingWeight}%` }}
  123. </div>
  124. <Button size="small" @click="handleReloadConfigs">刷新配置</Button>
  125. </div>
  126. </div>
  127. <div v-if="editableIntimacyConfigs.length" class="config-modal__list">
  128. <div
  129. v-for="item in editableIntimacyConfigs"
  130. :key="item.rowKey"
  131. class="config-item"
  132. :class="{ 'is-invalid': isConfigItemInvalid(item) }"
  133. >
  134. <div class="config-item__main">
  135. <div class="config-item__tags">
  136. <span v-for="tag in item.tagList" :key="tag" class="config-item__tag">{{ tag }}</span>
  137. <span v-if="!item.tagList.length" class="config-item__tag config-item__tag--empty">未配置标签</span>
  138. </div>
  139. <div v-if="item.scoreItems.length" class="config-item__score-editor">
  140. <div v-for="score in item.scoreItems" :key="score.key" class="score-editor-item">
  141. <span class="score-editor-item__label">{{ score.label }}:</span>
  142. <InputNumber
  143. v-model:value="score.value"
  144. class="score-editor-item__input"
  145. :min="0"
  146. :precision="0"
  147. placeholder="请输入分值"
  148. />
  149. </div>
  150. </div>
  151. <div v-else class="config-item__score-empty">暂无分数配置</div>
  152. </div>
  153. <div class="config-item__weight">
  154. <span class="config-item__weight-label">权重</span>
  155. <InputNumber
  156. v-model:value="item.weightValue"
  157. class="config-item__weight-input"
  158. :min="0"
  159. :max="100"
  160. :precision="0"
  161. placeholder="0-100"
  162. />
  163. <span class="config-item__weight-unit">%</span>
  164. </div>
  165. </div>
  166. </div>
  167. <div v-else class="config-modal__empty">
  168. <EmptyState
  169. title="暂无配置"
  170. description="亲密度配置接入后可在此调整权重"
  171. variant="compact"
  172. :min-height="220"
  173. />
  174. </div>
  175. </div>
  176. </BasicModal>
  177. </div>
  178. </template>
  179. <script lang="ts" setup>
  180. import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
  181. import { Button, Input, InputNumber, Spin } from 'ant-design-vue';
  182. import { EmptyState } from '@jeesite/core/components/EmptyState';
  183. import { BasicModal } from '@jeesite/core/components/Modal';
  184. import { PersonAvatar } from '@jeesite/core/components/PersonAvatar';
  185. import { useMessage } from '@jeesite/core/hooks/web/useMessage';
  186. import { useUserStoreWithOut } from '@jeesite/core/store/modules/case';
  187. import { getIntimacySummary } from '../../../../person/api/dpApi';
  188. import { listIntimacy, modifyIntimacy } from '../../../../person/api/personApi';
  189. import type { IntimacyConfigDTO, IntimacySummaryDTO, PersonBasicInfo } from '../../../../person/api/types/dto';
  190. interface BehaviorPalette {
  191. color: string;
  192. bgColor: string;
  193. borderColor: string;
  194. }
  195. interface BehaviorViewItem extends BehaviorPalette {
  196. key: string;
  197. name: string;
  198. weight?: number;
  199. weightText?: string;
  200. }
  201. interface DetailViewItem {
  202. key: string;
  203. behaviorName: string;
  204. title: string;
  205. description: string;
  206. weightText: string;
  207. color: string;
  208. detailRecord: Record<string, unknown>;
  209. }
  210. interface RelationViewItem {
  211. id: number | string;
  212. otherName: string;
  213. avatar: string;
  214. intimacyText: string;
  215. behaviors: BehaviorViewItem[];
  216. details: DetailViewItem[];
  217. }
  218. interface EditableIntimacyConfigItem extends IntimacyConfigDTO {
  219. rowKey: string;
  220. tagList: string[];
  221. weightValue?: number;
  222. scoreItems: EditableScoreItem[];
  223. }
  224. interface EditableScoreItem {
  225. key: string;
  226. label: string;
  227. value?: number;
  228. }
  229. const props = defineProps<{
  230. selectedPerson?: PersonBasicInfo | null;
  231. }>();
  232. const emit = defineEmits<{
  233. (e: 'jump-to-analysis', payload: JumpToAnalysisPayload): void;
  234. }>();
  235. interface JumpToAnalysisPayload extends Record<string, unknown> {
  236. personName: string;
  237. otherName: string;
  238. behaviorType: string;
  239. detailRecord: Record<string, unknown>;
  240. path: string;
  241. query: Record<string, string>;
  242. }
  243. const userStore = useUserStoreWithOut();
  244. const { createMessage } = useMessage();
  245. const keyword = ref('');
  246. const loading = ref(false);
  247. const MAX_INTIMACY_RELATIONS = 100;
  248. const activeIndex = ref(0);
  249. const cardListRef = ref<HTMLElement | null>(null);
  250. const showPrevButton = ref(false);
  251. const showNextButton = ref(false);
  252. const intimacyConfigs = ref<IntimacyConfigDTO[]>([]);
  253. const intimacySummaryRows = ref<IntimacySummaryDTO[]>([]);
  254. const configModalOpen = ref(false);
  255. const configSaving = ref(false);
  256. const editableIntimacyConfigs = ref<EditableIntimacyConfigItem[]>([]);
  257. const defaultPalette: BehaviorPalette = {
  258. color: '#1677ff',
  259. bgColor: '#e6f4ff',
  260. borderColor: '#bfdbfe',
  261. };
  262. const behaviorPaletteMap: Record<string, BehaviorPalette> = {
  263. 大额转账: { color: '#1677ff', bgColor: '#e6f4ff', borderColor: '#bfdbfe' },
  264. 基站碰面: { color: '#ef4444', bgColor: '#fee2e2', borderColor: '#fecaca' },
  265. 特殊日期特殊转账: { color: '#6366f1', bgColor: '#e0e7ff', borderColor: '#c7d2fe' },
  266. 频繁交易: { color: '#475569', bgColor: '#e2e8f0', borderColor: '#cbd5e1' },
  267. 酒店同住: { color: '#16a34a', bgColor: '#dcfce7', borderColor: '#bbf7d0' },
  268. 特殊日期通话: { color: '#d97706', bgColor: '#fef3c7', borderColor: '#fde68a' },
  269. 异卡同号: { color: '#a16207', bgColor: '#fef9c3', borderColor: '#fde047' },
  270. 联系次数: { color: '#b91c1c', bgColor: '#fee2e2', borderColor: '#fecaca' },
  271. 同交通工具出行: { color: '#0f766e', bgColor: '#ccfbf1', borderColor: '#99f6e4' },
  272. 关联企业: { color: '#ea580c', bgColor: '#ffedd5', borderColor: '#fed7aa' },
  273. 夜间通话次数: { color: '#7c3aed', bgColor: '#ede9fe', borderColor: '#ddd6fe' },
  274. };
  275. const intimacyBehaviorDisplayNameMap: Record<string, string> = {
  276. 特殊日期特殊转账: '敏感日期特殊转账',
  277. 特殊日期通话: '敏感日期通话',
  278. };
  279. const getIntimacyBehaviorDisplayName = (name: string) => intimacyBehaviorDisplayNameMap[name] || name;
  280. const scoreLabelTemplateMap: Record<string, string[]> = {
  281. 大额转账: ['大于等于5万', '1万到5万', '小于1万'],
  282. 频繁交易: ['交易次数top1~5', '交易次数top6~10', '交易次数top11~top20', '交易次数大于top20'],
  283. };
  284. // 行为类型到分析页面的跳转映射
  285. const BEHAVIOR_JUMP_MAP: Record<string, { path: string; query: Record<string, string> }> = {
  286. 大额转账: {
  287. path: '/largeAmount/index',
  288. query: {
  289. countOp: 'GE',
  290. countValue: '1',
  291. amountOp: 'GE',
  292. amountValue: '10000',
  293. },
  294. },
  295. 频繁交易: {
  296. path: '/tradeFrequency/index',
  297. query: {},
  298. },
  299. 基站碰面: {
  300. path: '/coResidence/index',
  301. query: {},
  302. },
  303. 特殊日期特殊转账: {
  304. path: '/transSensitive/index',
  305. query: {},
  306. },
  307. 敏感日期特殊转账: {
  308. path: '/transSensitive/index',
  309. query: {},
  310. },
  311. 敏感日期交易: {
  312. path: '/transSensitive/index',
  313. query: {},
  314. },
  315. 特殊日期交易: {
  316. path: '/transSensitive/index',
  317. query: {},
  318. },
  319. 酒店同住: {
  320. path: '/coResidence/index',
  321. query: {},
  322. },
  323. 特殊日期通话: {
  324. path: '/sensitive/index',
  325. query: {},
  326. },
  327. 敏感日期通话: {
  328. path: '/sensitive/index',
  329. query: {},
  330. },
  331. 联系次数: {
  332. path: '/continuous/index',
  333. query: {
  334. monthValue: '1',
  335. },
  336. },
  337. 同交通工具出行: {
  338. path: '/peerAnalysis/index',
  339. query: {},
  340. },
  341. 夜间通话次数: {
  342. path: '/night/index',
  343. query: {},
  344. },
  345. 异卡同号: {
  346. path: '/cardHolding/index',
  347. query: {},
  348. },
  349. 关联企业: {
  350. path: '/objectRelation/index',
  351. query: {},
  352. },
  353. };
  354. /** 将详情描述中的数字提取为可点击的片段 */
  355. const parseDescriptionSegments = (
  356. description: string,
  357. ): Array<{ text: string; clickable: boolean; value: string }> => {
  358. const segments: Array<{ text: string; clickable: boolean; value: string }> = [];
  359. const regex = /(\d+(?:\.\d+)?)/g;
  360. let lastIndex = 0;
  361. let match: RegExpExecArray | null;
  362. while ((match = regex.exec(description)) !== null) {
  363. if (match.index > lastIndex) {
  364. segments.push({ text: description.slice(lastIndex, match.index), clickable: false, value: '' });
  365. }
  366. segments.push({ text: match[0], clickable: true, value: match[0] });
  367. lastIndex = match.index + match[0].length;
  368. }
  369. if (lastIndex < description.length) {
  370. segments.push({ text: description.slice(lastIndex), clickable: false, value: '' });
  371. }
  372. return segments;
  373. };
  374. const handleJumpToAnalysis = (detail: DetailViewItem) => {
  375. const personName = selectedPersonName.value;
  376. const otherName = activeRelation.value?.otherName || '';
  377. const behaviorType = detail.title;
  378. const behaviorName = detail.behaviorName || detail.title;
  379. const jumpConfig = BEHAVIOR_JUMP_MAP[behaviorName] || BEHAVIOR_JUMP_MAP[behaviorType];
  380. if (!personName && !otherName) {
  381. createMessage.warning('无可跳转的对象信息');
  382. return;
  383. }
  384. if (!jumpConfig?.path) {
  385. createMessage.warning('当前行为暂未配置分析页跳转');
  386. return;
  387. }
  388. const detailRecord = detail.detailRecord || {};
  389. const query = { ...jumpConfig.query };
  390. if (behaviorType === '同交通工具出行') {
  391. const personNames = [personName, otherName].map((item) => item.trim()).filter(Boolean);
  392. if (personNames.length) {
  393. query.personNames = personNames.join(',');
  394. }
  395. if (otherName) {
  396. query.companionName = otherName;
  397. }
  398. }
  399. emit('jump-to-analysis', {
  400. personName,
  401. otherName,
  402. behaviorType,
  403. detailRecord,
  404. path: jumpConfig.path,
  405. query,
  406. });
  407. };
  408. let resizeObserver: ResizeObserver | null = null;
  409. let summaryRequestId = 0;
  410. const caseId = computed(() => userStore.getCaseInfo?.id as number | string | undefined);
  411. const selectedPerson = computed(() => props.selectedPerson || null);
  412. const selectedObjId = computed(() => selectedPerson.value?.objId ?? selectedPerson.value?.id);
  413. const selectedPersonName = computed(() => String(selectedPerson.value?.personName || '').trim());
  414. const normalizeArrayResponse = <T,>(value: any): T[] => {
  415. if (Array.isArray(value)) return value as T[];
  416. const candidates = [
  417. value?.records,
  418. value?.list,
  419. value?.data,
  420. value?.data?.records,
  421. value?.data?.list,
  422. value?.data?.data,
  423. value?.result,
  424. ];
  425. for (const item of candidates) {
  426. if (Array.isArray(item)) return item as T[];
  427. }
  428. return [];
  429. };
  430. const toDisplayText = (value: unknown) => {
  431. if (value === 0) return '0';
  432. if (value === null || value === undefined || value === '') return '-';
  433. return String(value);
  434. };
  435. const toNumericValue = (value: unknown) => {
  436. if (value === null || value === undefined || value === '') return null;
  437. const numeric = Number(
  438. String(value)
  439. .replace(/[,%\s]/g, '')
  440. .trim(),
  441. );
  442. return Number.isFinite(numeric) ? numeric : null;
  443. };
  444. const formatMetric = (value: unknown, unit = '') => {
  445. const text = toDisplayText(value);
  446. return text === '-' ? '-' : `${text}${unit}`;
  447. };
  448. const parseBehaviorItems = (value: unknown) => {
  449. const source = Array.isArray(value) ? value.join(',') : String(value || '');
  450. const itemMap = new Map<string, { name: string; weight?: number; weightText?: string }>();
  451. source
  452. .split(/[,,]/)
  453. .map((item) => String(item || '').trim())
  454. .filter(Boolean)
  455. .forEach((item) => {
  456. const name = item.split('-')[0]?.trim();
  457. if (!name) return;
  458. const weightMatch = item.match(/权重\s*(\d+(?:\.\d+)?)\s*%?/);
  459. const weightValue = weightMatch ? toNumericValue(weightMatch[1]) : null;
  460. itemMap.set(name, {
  461. name,
  462. weight: weightValue === null ? undefined : weightValue,
  463. weightText: weightValue === null ? '' : `${weightValue}%`,
  464. });
  465. });
  466. return Array.from(itemMap.values());
  467. };
  468. const parseConfigTags = (value: unknown) => {
  469. return String(value || '')
  470. .split(/[,,、]/)
  471. .map((item) => item.trim())
  472. .filter(Boolean);
  473. };
  474. const buildDefaultScoreLabels = (tagList: string[], scoreCount: number) => {
  475. const primaryTag = tagList[0] || '';
  476. const template = scoreLabelTemplateMap[primaryTag];
  477. if (template?.length) {
  478. return template;
  479. }
  480. const count = Math.max(scoreCount, 1);
  481. return Array.from({ length: count }, (_, index) => `分值${index + 1}`);
  482. };
  483. const cleanScoreLabel = (value: string) => {
  484. return value
  485. .replace(/^[\s{[\("'“”、,,、::]+/, '')
  486. .replace(/[\s}\]"'“”、,,、::]+$/, '')
  487. .trim();
  488. };
  489. const parseScoreItems = (value: unknown, tagList: string[], rowKey: string): EditableScoreItem[] => {
  490. const source = String(value || '').trim();
  491. if (!source) {
  492. return buildDefaultScoreLabels(tagList, 0).map((label, index) => ({
  493. key: `${rowKey}-score-${index}`,
  494. label,
  495. value: undefined,
  496. }));
  497. }
  498. const pairEntries = Array.from(source.matchAll(/["“]?([^"“”:=:{}]+?)["”]?\s*[::=]\s*(-?\d+(?:\.\d+)?)/g))
  499. .map((match) => ({
  500. label: cleanScoreLabel(match[1] || ''),
  501. value: toNumericValue(match[2]),
  502. }))
  503. .filter((item) => item.label);
  504. if (pairEntries.length) {
  505. return pairEntries.map((item, index) => ({
  506. key: `${rowKey}-score-${index}`,
  507. label: item.label,
  508. value: item.value === null ? undefined : item.value,
  509. }));
  510. }
  511. const numericValues = (source.match(/-?\d+(?:\.\d+)?/g) || [])
  512. .map((item) => toNumericValue(item))
  513. .filter((item): item is number => item !== null);
  514. const labels = buildDefaultScoreLabels(tagList, numericValues.length);
  515. return labels.map((label, index) => ({
  516. key: `${rowKey}-score-${index}`,
  517. label,
  518. value: numericValues[index],
  519. }));
  520. };
  521. const stringifyScoreItems = (scoreItems: EditableScoreItem[]) => {
  522. if (!scoreItems.length) return '';
  523. const scoreMap = scoreItems.reduce<Record<string, number>>((result, item) => {
  524. const label = cleanScoreLabel(item.label);
  525. if (!label) return result;
  526. result[label] = Number(item.value ?? 0);
  527. return result;
  528. }, {});
  529. return Object.keys(scoreMap).length ? JSON.stringify(scoreMap) : '';
  530. };
  531. const parseDetailRecord = (value: unknown): Record<string, unknown> => {
  532. if (!value) return {};
  533. if (typeof value === 'string') {
  534. try {
  535. const parsed = JSON.parse(value);
  536. return parsed && typeof parsed === 'object' ? parsed : {};
  537. } catch {
  538. return {};
  539. }
  540. }
  541. return typeof value === 'object' ? (value as Record<string, unknown>) : {};
  542. };
  543. const buildDetailDescription = (name: string, detail: Record<string, unknown>) => {
  544. switch (name) {
  545. case '大额转账':
  546. return `大额交易次数 ${formatMetric(detail['大额交易次数'], '次')}`;
  547. case '基站碰面':
  548. return `碰面 ${formatMetric(detail['碰面次数'], '次')},碰面地点 ${formatMetric(detail['碰面地点次数'], '个')}`;
  549. case '特殊日期特殊转账':
  550. return `敏感日期特殊转账 ${formatMetric(detail['特殊日期特殊转账'], '次')}`;
  551. case '频繁交易':
  552. return `相互交易 ${formatMetric(detail['交易次数'], '次')}`;
  553. case '酒店同住':
  554. return `同住 ${formatMetric(detail['同住次数'], '次')}`;
  555. case '特殊日期通话':
  556. return `敏感日期联系 ${formatMetric(detail['特殊日期通话次数'], '次')}`;
  557. case '异卡同号': {
  558. const count = toDisplayText(detail['异卡同号']);
  559. return count === '-' ? '存在异卡同号关联' : `有 ${count} 张卡绑定分析对象号码`;
  560. }
  561. case '联系次数':
  562. return `相互联系 ${formatMetric(detail['联系次数'], '次')}`;
  563. case '同交通工具出行':
  564. return `同行 ${formatMetric(detail['同行次数'], '次')}`;
  565. case '关联企业':
  566. return `共同关联企业 ${formatMetric(detail['共同关联企业'], '家')}`;
  567. case '夜间通话次数':
  568. return `夜间通话 ${formatMetric(detail['夜间通话次数'], '次')}`;
  569. default:
  570. return '关联指标已命中,详细数据以接口返回为准';
  571. }
  572. };
  573. const intimacyWeightMap = computed(() => {
  574. const map = new Map<string, number>();
  575. intimacyConfigs.value.forEach((item) => {
  576. const weight = toNumericValue(item.weight);
  577. if (weight === null) return;
  578. parseConfigTags(item.tags).forEach((tag) => {
  579. if (!map.has(tag)) {
  580. map.set(tag, weight);
  581. }
  582. });
  583. });
  584. return map;
  585. });
  586. const configTotalWeight = computed(() =>
  587. editableIntimacyConfigs.value.reduce((sum, item) => sum + (Number(item.weightValue) || 0), 0),
  588. );
  589. const configTotalExceeded = computed(() => configTotalWeight.value > 100);
  590. const configRemainingWeight = computed(() => Math.max(0, 100 - configTotalWeight.value));
  591. const configExceededWeight = computed(() => Math.max(0, configTotalWeight.value - 100));
  592. const relationList = computed<RelationViewItem[]>(() => {
  593. return intimacySummaryRows.value
  594. .filter((item) => (toNumericValue(item.intimacy) ?? 0) > 0)
  595. .map((item, rowIndex) => {
  596. const detailRecord = parseDetailRecord(item.detail);
  597. const behaviorItems = parseBehaviorItems(item.intimacyBehavior);
  598. const relationId =
  599. (item as IntimacySummaryDTO & { id?: number | string }).id ??
  600. `${selectedObjId.value || 'relation'}-${rowIndex}`;
  601. const behaviors = behaviorItems.map((behaviorItem, behaviorIndex) => {
  602. const name = behaviorItem.name;
  603. const palette = behaviorPaletteMap[name] || defaultPalette;
  604. const configWeight = intimacyWeightMap.value.get(name);
  605. const weight = behaviorItem.weight ?? configWeight;
  606. return {
  607. key: `${relationId}-${behaviorIndex}`,
  608. name,
  609. weight,
  610. weightText: behaviorItem.weightText || (weight === undefined ? '' : `${weight}%`),
  611. ...palette,
  612. };
  613. });
  614. const details = behaviors.map((behavior) => ({
  615. key: `${relationId}-${behavior.name}`,
  616. behaviorName: behavior.name,
  617. title: getIntimacyBehaviorDisplayName(behavior.name),
  618. description: buildDetailDescription(behavior.name, detailRecord),
  619. weightText: behavior.weightText || (behavior.weight === undefined ? '' : `${behavior.weight}%`),
  620. color: behavior.color,
  621. detailRecord,
  622. }));
  623. const otherName = String(item.otherName || `关系人${rowIndex + 1}`);
  624. return {
  625. id: relationId,
  626. otherName,
  627. avatar: otherName.slice(0, 1) || '关',
  628. intimacyText: toDisplayText(item.intimacy),
  629. behaviors,
  630. details,
  631. };
  632. });
  633. });
  634. const filteredRelations = computed(() => {
  635. const searchValue = keyword.value.trim();
  636. if (!searchValue) return relationList.value;
  637. return relationList.value.filter((item) => item.otherName.includes(searchValue));
  638. });
  639. const activeRelation = computed(() => filteredRelations.value[activeIndex.value] || null);
  640. const getTagStyle = (behavior: BehaviorViewItem) => ({
  641. color: behavior.color,
  642. background: behavior.bgColor,
  643. borderColor: behavior.borderColor,
  644. });
  645. const buildEditableConfigRows = (list: IntimacyConfigDTO[]): EditableIntimacyConfigItem[] => {
  646. return list.map((item, index) => {
  647. const weight = toNumericValue(item.weight);
  648. const rowKey = String(item.id ?? index);
  649. const tagList = parseConfigTags(item.tags);
  650. return {
  651. ...item,
  652. rowKey,
  653. tagList,
  654. weightValue: weight === null ? undefined : weight,
  655. scoreItems: parseScoreItems(item.scoreJson ?? item.scores, tagList, rowKey),
  656. };
  657. });
  658. };
  659. const syncEditableConfigs = () => {
  660. editableIntimacyConfigs.value = buildEditableConfigRows(intimacyConfigs.value);
  661. };
  662. const isConfigItemInvalid = (item: EditableIntimacyConfigItem) => {
  663. if (item.weightValue === undefined || item.weightValue === null) return true;
  664. return item.weightValue < 0 || item.weightValue > 100;
  665. };
  666. const getInvalidScoreItem = (item: EditableIntimacyConfigItem) => {
  667. return (
  668. item.scoreItems.find((score) => score.value === undefined || score.value === null || score.value < 0) || null
  669. );
  670. };
  671. const handleOpenConfigModal = async () => {
  672. if (!intimacyConfigs.value.length) {
  673. await loadIntimacyConfigs();
  674. }
  675. syncEditableConfigs();
  676. configModalOpen.value = true;
  677. };
  678. const closeConfigModal = () => {
  679. configModalOpen.value = false;
  680. };
  681. const handleConfigModalChange = (open: boolean) => {
  682. configModalOpen.value = open;
  683. if (!open) {
  684. syncEditableConfigs();
  685. }
  686. };
  687. const handleReloadConfigs = async () => {
  688. await loadIntimacyConfigs(true);
  689. syncEditableConfigs();
  690. };
  691. const validateEditableConfigs = () => {
  692. const invalidItem = editableIntimacyConfigs.value.find((item) => isConfigItemInvalid(item));
  693. if (invalidItem) {
  694. createMessage.warning(`请填写有效权重:${invalidItem.tagList.join(' / ') || '未配置标签'}`);
  695. return false;
  696. }
  697. const invalidScoreConfig = editableIntimacyConfigs.value.find((item) => !!getInvalidScoreItem(item));
  698. if (invalidScoreConfig) {
  699. const invalidScoreItem = getInvalidScoreItem(invalidScoreConfig);
  700. createMessage.warning(
  701. `请填写有效分值:${invalidScoreConfig.tagList.join(' / ') || '未配置标签'} - ${invalidScoreItem?.label || '分值'}`,
  702. );
  703. return false;
  704. }
  705. if (configTotalExceeded.value) {
  706. createMessage.warning('亲密度权重总和不能超过 100');
  707. return false;
  708. }
  709. return true;
  710. };
  711. const handleSaveConfig = async () => {
  712. if (configSaving.value) return;
  713. if (!validateEditableConfigs()) return;
  714. configSaving.value = true;
  715. try {
  716. const payload = editableIntimacyConfigs.value.map((item) => {
  717. return {
  718. id: item.id,
  719. tags: item.tags,
  720. scores: stringifyScoreItems(item.scoreItems),
  721. weight: Number(item.weightValue ?? 0),
  722. };
  723. });
  724. await modifyIntimacy(payload);
  725. intimacyConfigs.value = payload;
  726. await loadIntimacyConfigs();
  727. syncEditableConfigs();
  728. createMessage.success('亲密度配置保存成功');
  729. configModalOpen.value = false;
  730. } catch (error) {
  731. console.error('保存亲密度配置失败', error);
  732. createMessage.warning('亲密度配置保存失败,请稍后重试');
  733. } finally {
  734. configSaving.value = false;
  735. }
  736. };
  737. const updateScrollButtons = () => {
  738. const element = cardListRef.value;
  739. if (!element) {
  740. showPrevButton.value = false;
  741. showNextButton.value = false;
  742. return;
  743. }
  744. const maxScrollLeft = Math.max(0, element.scrollWidth - element.clientWidth);
  745. showPrevButton.value = element.scrollLeft > 4;
  746. showNextButton.value = maxScrollLeft - element.scrollLeft > 4;
  747. };
  748. const scheduleScrollStateUpdate = () => {
  749. nextTick(() => {
  750. requestAnimationFrame(() => {
  751. updateScrollButtons();
  752. });
  753. });
  754. };
  755. const scrollCards = (direction: 'left' | 'right') => {
  756. const element = cardListRef.value;
  757. if (!element) return;
  758. const offset = direction === 'left' ? -320 : 320;
  759. element.scrollBy({ left: offset, behavior: 'smooth' });
  760. window.setTimeout(updateScrollButtons, 220);
  761. };
  762. const bindResizeObserver = () => {
  763. if (typeof ResizeObserver === 'undefined') return;
  764. resizeObserver?.disconnect();
  765. resizeObserver = new ResizeObserver(() => {
  766. scheduleScrollStateUpdate();
  767. });
  768. if (cardListRef.value) {
  769. resizeObserver.observe(cardListRef.value);
  770. }
  771. };
  772. const loadIntimacyConfigs = async (showSuccessMessage = false) => {
  773. try {
  774. intimacyConfigs.value = normalizeArrayResponse<IntimacyConfigDTO>(await listIntimacy());
  775. if (showSuccessMessage) {
  776. createMessage.success('亲密度配置已刷新');
  777. }
  778. } catch (error) {
  779. console.error('获取亲密度配置失败', error);
  780. intimacyConfigs.value = [];
  781. if (showSuccessMessage) {
  782. createMessage.warning('亲密度配置刷新失败');
  783. }
  784. }
  785. };
  786. const loadIntimacySummary = async () => {
  787. const currentRequestId = ++summaryRequestId;
  788. const objId = selectedObjId.value;
  789. const personName = selectedPersonName.value;
  790. if (!objId && !personName) {
  791. intimacySummaryRows.value = [];
  792. loading.value = false;
  793. return;
  794. }
  795. loading.value = true;
  796. try {
  797. const response = await getIntimacySummary({
  798. personName: personName || undefined,
  799. });
  800. if (currentRequestId !== summaryRequestId) return;
  801. intimacySummaryRows.value = normalizeArrayResponse<IntimacySummaryDTO>(response).slice(0, MAX_INTIMACY_RELATIONS);
  802. } catch (error) {
  803. if (currentRequestId !== summaryRequestId) return;
  804. console.error('获取亲密关系人失败', error);
  805. intimacySummaryRows.value = [];
  806. } finally {
  807. if (currentRequestId !== summaryRequestId) return;
  808. loading.value = false;
  809. scheduleScrollStateUpdate();
  810. }
  811. };
  812. watch(
  813. () => [selectedObjId.value, selectedPersonName.value, caseId.value],
  814. async () => {
  815. keyword.value = '';
  816. activeIndex.value = 0;
  817. await loadIntimacySummary();
  818. },
  819. { immediate: true },
  820. );
  821. watch(
  822. filteredRelations,
  823. (list) => {
  824. if (!list.length) {
  825. activeIndex.value = 0;
  826. } else if (activeIndex.value >= list.length) {
  827. activeIndex.value = 0;
  828. }
  829. scheduleScrollStateUpdate();
  830. },
  831. { deep: true },
  832. );
  833. watch(
  834. () => cardListRef.value,
  835. () => {
  836. bindResizeObserver();
  837. scheduleScrollStateUpdate();
  838. },
  839. );
  840. onMounted(() => {
  841. void loadIntimacyConfigs();
  842. bindResizeObserver();
  843. scheduleScrollStateUpdate();
  844. });
  845. onBeforeUnmount(() => {
  846. resizeObserver?.disconnect();
  847. resizeObserver = null;
  848. });
  849. </script>
  850. <style lang="less" scoped>
  851. .intimacy-panel {
  852. --intimacy-content-height: 248px;
  853. display: flex;
  854. flex-direction: column;
  855. gap: 12px;
  856. min-height: 0;
  857. min-width: 0;
  858. overflow: visible;
  859. box-sizing: border-box;
  860. :deep(.ant-spin-nested-loading),
  861. :deep(.ant-spin-container) {
  862. display: flex;
  863. flex: 1 1 auto;
  864. flex-direction: column;
  865. min-height: 0;
  866. }
  867. .section-header {
  868. display: flex;
  869. align-items: center;
  870. justify-content: space-between;
  871. gap: 12px 16px;
  872. margin-bottom: 0;
  873. padding-bottom: 10px;
  874. border-bottom: 1px solid #eef2f7;
  875. }
  876. .section-title {
  877. position: relative;
  878. display: inline-flex;
  879. align-items: center;
  880. gap: 8px;
  881. font-size: 15px;
  882. font-weight: 600;
  883. color: #111827;
  884. &::before {
  885. content: '';
  886. width: 3px;
  887. height: 14px;
  888. border-radius: 999px;
  889. background: #1677ff;
  890. }
  891. }
  892. .section-tools {
  893. display: flex;
  894. align-items: center;
  895. gap: 8px;
  896. margin-left: auto;
  897. }
  898. .relation-search {
  899. width: 200px;
  900. max-width: 100%;
  901. }
  902. .intimacy-content {
  903. width: 100%;
  904. max-width: 100%;
  905. height: var(--intimacy-content-height);
  906. display: grid;
  907. grid-template-columns: minmax(0, 1fr) minmax(320px, 36%);
  908. grid-template-rows: minmax(0, 1fr);
  909. gap: 2px;
  910. grid-auto-rows: minmax(0, 1fr);
  911. min-height: 0;
  912. align-items: stretch;
  913. overflow: hidden;
  914. padding: 2px;
  915. background: #f3f4f6;
  916. box-sizing: border-box;
  917. }
  918. .intimacy-rail {
  919. min-width: 0;
  920. width: 100%;
  921. max-width: 100%;
  922. height: 100%;
  923. min-height: 0;
  924. display: flex;
  925. flex-direction: column;
  926. gap: 0;
  927. }
  928. .intimacy-left-wrap {
  929. position: relative;
  930. width: 100%;
  931. max-width: 100%;
  932. min-width: 0;
  933. flex: 1 1 auto;
  934. height: 100%;
  935. min-height: 0;
  936. display: flex;
  937. align-self: stretch;
  938. align-items: stretch;
  939. border-radius: 12px;
  940. background: #fff;
  941. border: 1px solid #e2e8f0;
  942. overflow: hidden;
  943. box-sizing: border-box;
  944. box-shadow: none;
  945. }
  946. .intimacy-card-list {
  947. flex: 1 1 auto;
  948. width: 100%;
  949. max-width: 100%;
  950. height: 100%;
  951. min-width: 0;
  952. min-height: 0;
  953. display: flex;
  954. align-items: stretch;
  955. gap: 8px;
  956. padding: 10px 36px 18px;
  957. overflow: auto hidden;
  958. scroll-behavior: smooth;
  959. box-sizing: border-box;
  960. &::-webkit-scrollbar {
  961. height: 6px;
  962. }
  963. &::-webkit-scrollbar-thumb {
  964. border-radius: 999px;
  965. background: #cbd5e1;
  966. }
  967. &::-webkit-scrollbar-track {
  968. background: transparent;
  969. }
  970. }
  971. .intimacy-card {
  972. flex: 0 0 244px;
  973. align-self: stretch;
  974. height: auto;
  975. min-height: 0;
  976. max-height: none;
  977. padding: 10px 12px;
  978. border: 1px solid #e5e7eb;
  979. border-radius: 10px;
  980. background: #fff;
  981. display: flex;
  982. flex-direction: column;
  983. justify-content: flex-start;
  984. gap: 12px;
  985. text-align: left;
  986. cursor: pointer;
  987. box-sizing: border-box;
  988. transition:
  989. border-color 0.2s ease,
  990. box-shadow 0.2s ease,
  991. background 0.2s ease;
  992. &:hover {
  993. border-color: #91caff;
  994. box-shadow: none;
  995. transform: none;
  996. }
  997. &.active {
  998. border-color: #1677ff;
  999. background: rgba(247, 251, 255, 0.72);
  1000. box-shadow: none;
  1001. }
  1002. }
  1003. .intimacy-card__top {
  1004. display: flex;
  1005. align-items: flex-start;
  1006. justify-content: space-between;
  1007. gap: 12px;
  1008. }
  1009. .intimacy-card__head {
  1010. display: flex;
  1011. align-items: center;
  1012. gap: 12px;
  1013. min-width: 0;
  1014. flex: 1 1 auto;
  1015. }
  1016. .relation-avatar {
  1017. flex: 0 0 42px;
  1018. display: inline-flex;
  1019. }
  1020. .intimacy-card__name {
  1021. min-width: 0;
  1022. font-size: 15px;
  1023. font-weight: 600;
  1024. line-height: 22px;
  1025. color: #111827;
  1026. word-break: break-all;
  1027. }
  1028. .intimacy-card__score-wrap {
  1029. flex: 0 0 auto;
  1030. display: flex;
  1031. flex-direction: column;
  1032. align-items: center;
  1033. gap: 8px;
  1034. }
  1035. .intimacy-card__score-badge {
  1036. min-width: 42px;
  1037. height: 42px;
  1038. padding: 0 10px;
  1039. border-radius: 12px;
  1040. background: linear-gradient(180deg, #1d4ed8 0%, #2563eb 100%);
  1041. color: #fff;
  1042. display: inline-flex;
  1043. align-items: center;
  1044. justify-content: center;
  1045. font-size: 18px;
  1046. line-height: 1;
  1047. font-weight: 700;
  1048. box-shadow: none;
  1049. }
  1050. .intimacy-card__score {
  1051. font-size: 12px;
  1052. line-height: 18px;
  1053. color: #64748b;
  1054. text-align: center;
  1055. white-space: nowrap;
  1056. }
  1057. .intimacy-card__tags {
  1058. display: grid;
  1059. grid-auto-flow: column;
  1060. grid-template-rows: repeat(2, max-content);
  1061. grid-auto-columns: max-content;
  1062. align-content: end;
  1063. gap: 6px;
  1064. margin-top: auto;
  1065. max-height: 58px;
  1066. overflow: visible;
  1067. }
  1068. .behavior-tag {
  1069. display: inline-flex;
  1070. align-items: center;
  1071. min-height: 26px;
  1072. padding: 0 10px;
  1073. border-radius: 999px;
  1074. border: 1px solid transparent;
  1075. font-size: 11px;
  1076. line-height: 1.1;
  1077. font-weight: 500;
  1078. white-space: nowrap;
  1079. }
  1080. .scroll-btn {
  1081. position: absolute;
  1082. top: 50%;
  1083. z-index: 2;
  1084. width: 30px;
  1085. height: 30px;
  1086. padding: 0;
  1087. border-radius: 999px;
  1088. border-color: #dbe2ea;
  1089. background: rgb(255 255 255 / 96%);
  1090. transform: translateY(-50%);
  1091. box-shadow: none;
  1092. &.scroll-btn--prev {
  1093. left: 8px;
  1094. }
  1095. &.scroll-btn--next {
  1096. right: 8px;
  1097. }
  1098. }
  1099. .intimacy-detail {
  1100. width: 100%;
  1101. max-width: 100%;
  1102. flex: 1 1 auto;
  1103. min-width: 0;
  1104. height: 100%;
  1105. min-height: 0;
  1106. max-height: 100%;
  1107. display: flex;
  1108. flex-direction: column;
  1109. align-self: stretch;
  1110. padding: 10px 12px;
  1111. border: 1px solid #e2e8f0;
  1112. border-radius: 12px;
  1113. background: #fff;
  1114. overflow: hidden;
  1115. box-sizing: border-box;
  1116. box-shadow: none;
  1117. }
  1118. .intimacy-detail__title-row {
  1119. display: flex;
  1120. align-items: center;
  1121. justify-content: space-between;
  1122. gap: 12px;
  1123. min-width: 0;
  1124. padding-bottom: 8px;
  1125. border-bottom: 1px solid #eef2f7;
  1126. }
  1127. .intimacy-detail__title {
  1128. flex: 0 0 auto;
  1129. font-size: 15px;
  1130. font-weight: 600;
  1131. line-height: 22px;
  1132. color: #111827;
  1133. }
  1134. .intimacy-detail__summary-inline {
  1135. display: flex;
  1136. flex: 1 1 auto;
  1137. justify-content: flex-end;
  1138. align-items: center;
  1139. gap: 16px;
  1140. min-width: 0;
  1141. flex-wrap: wrap;
  1142. }
  1143. .intimacy-detail__meta {
  1144. flex-shrink: 0;
  1145. font-size: 12px;
  1146. line-height: 20px;
  1147. color: #94a3b8;
  1148. }
  1149. .summary-item {
  1150. display: inline-flex;
  1151. align-items: center;
  1152. gap: 6px;
  1153. font-size: 13px;
  1154. min-width: 0;
  1155. }
  1156. .label {
  1157. flex: 0 0 auto;
  1158. color: #6b7280;
  1159. white-space: nowrap;
  1160. }
  1161. .value {
  1162. color: #111827;
  1163. font-weight: 500;
  1164. word-break: break-all;
  1165. }
  1166. .value--accent {
  1167. color: #1677ff;
  1168. font-weight: 600;
  1169. }
  1170. .intimacy-detail__list {
  1171. flex: 1 1 auto;
  1172. min-height: 0;
  1173. display: flex;
  1174. flex-wrap: wrap;
  1175. align-content: flex-start;
  1176. gap: 8px;
  1177. margin-top: 6px;
  1178. padding-right: 4px;
  1179. padding-bottom: 4px;
  1180. overflow-y: auto;
  1181. overflow-x: hidden;
  1182. overscroll-behavior: contain;
  1183. }
  1184. .detail-item {
  1185. display: flex;
  1186. align-items: flex-start;
  1187. gap: 10px;
  1188. flex: 1 1 calc(50% - 4px);
  1189. min-width: 220px;
  1190. padding: 8px 12px;
  1191. border-radius: 10px;
  1192. background: #fff;
  1193. border: 1px solid #eef2f7;
  1194. box-sizing: border-box;
  1195. }
  1196. .detail-dot {
  1197. width: 8px;
  1198. height: 8px;
  1199. margin-top: 6px;
  1200. border-radius: 999px;
  1201. flex: 0 0 8px;
  1202. }
  1203. .detail-main {
  1204. flex: 1 1 auto;
  1205. min-width: 0;
  1206. display: flex;
  1207. flex-direction: column;
  1208. gap: 5px;
  1209. }
  1210. .detail-title {
  1211. font-size: 14px;
  1212. font-weight: 600;
  1213. line-height: 20px;
  1214. color: #111827;
  1215. word-break: break-all;
  1216. }
  1217. .detail-weight {
  1218. font-size: 12px;
  1219. font-weight: 500;
  1220. color: #6b7280;
  1221. }
  1222. .detail-desc {
  1223. font-size: 13px;
  1224. line-height: 20px;
  1225. color: #4b5563;
  1226. }
  1227. .detail-value--clickable {
  1228. display: inline;
  1229. padding: 0 2px;
  1230. color: #1677ff;
  1231. font-weight: 600;
  1232. cursor: pointer;
  1233. border-radius: 4px;
  1234. transition: background-color 0.2s ease;
  1235. &:hover {
  1236. background: #e6f4ff;
  1237. text-decoration: underline;
  1238. }
  1239. }
  1240. .detail-empty,
  1241. .intimacy-empty {
  1242. display: flex;
  1243. flex-direction: column;
  1244. align-items: center;
  1245. justify-content: center;
  1246. gap: 0;
  1247. min-height: 220px;
  1248. border: 0;
  1249. border-radius: 0;
  1250. background: transparent;
  1251. color: inherit;
  1252. }
  1253. .detail-empty {
  1254. margin-top: 16px;
  1255. min-height: 160px;
  1256. }
  1257. }
  1258. .config-modal {
  1259. display: flex;
  1260. flex-direction: column;
  1261. gap: 12px;
  1262. min-height: 0;
  1263. &__summary {
  1264. display: flex;
  1265. align-items: center;
  1266. justify-content: space-between;
  1267. gap: 12px;
  1268. padding: 10px 14px;
  1269. border: 1px solid #dbeafe;
  1270. border-radius: 12px;
  1271. background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
  1272. &.is-error {
  1273. border-color: #fecaca;
  1274. background: linear-gradient(180deg, #fff7f7 0%, #fef2f2 100%);
  1275. }
  1276. }
  1277. &__summary-main {
  1278. min-width: 0;
  1279. display: flex;
  1280. flex: 1 1 auto;
  1281. flex-wrap: wrap;
  1282. align-items: baseline;
  1283. gap: 6px 12px;
  1284. }
  1285. &__summary-label {
  1286. font-size: 12px;
  1287. line-height: 18px;
  1288. color: #64748b;
  1289. white-space: nowrap;
  1290. }
  1291. &__summary-value {
  1292. font-size: 22px;
  1293. line-height: 1;
  1294. font-weight: 700;
  1295. color: #1677ff;
  1296. white-space: nowrap;
  1297. .unit {
  1298. margin-left: 2px;
  1299. font-size: 14px;
  1300. }
  1301. }
  1302. &__summary-tip {
  1303. font-size: 12px;
  1304. line-height: 18px;
  1305. color: #6b7280;
  1306. flex: 1 1 240px;
  1307. }
  1308. &__summary-extra {
  1309. display: flex;
  1310. flex-direction: row;
  1311. align-items: flex-end;
  1312. gap: 8px;
  1313. flex-shrink: 0;
  1314. }
  1315. &__remaining {
  1316. font-size: 12px;
  1317. line-height: 18px;
  1318. font-weight: 600;
  1319. color: #111827;
  1320. white-space: nowrap;
  1321. }
  1322. &__list {
  1323. display: flex;
  1324. flex-direction: column;
  1325. gap: 12px;
  1326. max-height: 460px;
  1327. padding-right: 4px;
  1328. overflow-y: auto;
  1329. }
  1330. &__empty {
  1331. padding: 24px 0 8px;
  1332. }
  1333. }
  1334. .config-item {
  1335. display: flex;
  1336. align-items: center;
  1337. justify-content: space-between;
  1338. gap: 16px;
  1339. padding: 16px 18px;
  1340. border: 1px solid #e5e7eb;
  1341. border-radius: 14px;
  1342. background: #fff;
  1343. transition:
  1344. border-color 0.2s ease,
  1345. box-shadow 0.2s ease;
  1346. &.is-invalid {
  1347. border-color: #fca5a5;
  1348. box-shadow: inset 0 0 0 1px rgb(248 113 113 / 12%);
  1349. }
  1350. &__main {
  1351. min-width: 0;
  1352. flex: 1 1 auto;
  1353. display: flex;
  1354. flex-direction: column;
  1355. gap: 10px;
  1356. }
  1357. &__tags {
  1358. display: flex;
  1359. flex-wrap: wrap;
  1360. gap: 8px;
  1361. }
  1362. &__score-editor {
  1363. display: flex;
  1364. flex-wrap: wrap;
  1365. gap: 12px 20px;
  1366. padding-top: 2px;
  1367. }
  1368. &__score-empty {
  1369. font-size: 12px;
  1370. line-height: 20px;
  1371. color: #94a3b8;
  1372. }
  1373. &__tag {
  1374. display: inline-flex;
  1375. align-items: center;
  1376. min-height: 28px;
  1377. padding: 0 12px;
  1378. border-radius: 999px;
  1379. background: #eff6ff;
  1380. border: 1px solid #bfdbfe;
  1381. color: #1d4ed8;
  1382. font-size: 12px;
  1383. line-height: 1;
  1384. font-weight: 500;
  1385. &--empty {
  1386. color: #94a3b8;
  1387. background: #f8fafc;
  1388. border-color: #e2e8f0;
  1389. }
  1390. }
  1391. &__weight {
  1392. flex: 0 0 176px;
  1393. display: flex;
  1394. align-items: center;
  1395. justify-content: flex-end;
  1396. gap: 8px;
  1397. }
  1398. &__weight-label {
  1399. font-size: 13px;
  1400. line-height: 20px;
  1401. color: #6b7280;
  1402. white-space: nowrap;
  1403. }
  1404. &__weight-input {
  1405. width: 96px;
  1406. }
  1407. &__weight-unit {
  1408. font-size: 13px;
  1409. line-height: 20px;
  1410. color: #111827;
  1411. font-weight: 600;
  1412. }
  1413. }
  1414. .score-editor-item {
  1415. display: inline-flex;
  1416. align-items: center;
  1417. gap: 8px;
  1418. min-width: 0;
  1419. &__label {
  1420. font-size: 13px;
  1421. line-height: 20px;
  1422. color: #4b5563;
  1423. white-space: nowrap;
  1424. }
  1425. &__input {
  1426. width: 132px;
  1427. }
  1428. }
  1429. :deep(.intimacy-config-modal) {
  1430. .ant-modal-content {
  1431. max-height: 720px;
  1432. display: flex;
  1433. flex-direction: column;
  1434. }
  1435. .ant-modal-header,
  1436. .ant-modal-footer {
  1437. flex: 0 0 auto;
  1438. }
  1439. .ant-modal-body {
  1440. flex: 1 1 auto;
  1441. min-height: 0;
  1442. overflow: auto;
  1443. padding: 16px;
  1444. }
  1445. }
  1446. @media (max-width: 992px) {
  1447. .intimacy-panel {
  1448. --intimacy-content-height: auto;
  1449. .section-header {
  1450. flex-direction: column;
  1451. align-items: stretch;
  1452. }
  1453. .section-tools,
  1454. .relation-search {
  1455. width: 100%;
  1456. }
  1457. .intimacy-content {
  1458. height: auto;
  1459. grid-template-columns: 1fr;
  1460. grid-template-rows: auto auto;
  1461. gap: 12px;
  1462. grid-auto-rows: auto;
  1463. }
  1464. .intimacy-rail {
  1465. min-height: 0;
  1466. }
  1467. .intimacy-left-wrap {
  1468. flex: 0 0 auto;
  1469. height: 248px;
  1470. min-height: 248px;
  1471. }
  1472. .intimacy-detail {
  1473. width: 100%;
  1474. flex: 0 0 auto;
  1475. height: 320px;
  1476. min-height: 320px;
  1477. }
  1478. .intimacy-detail__title-row {
  1479. align-items: flex-start;
  1480. flex-direction: column;
  1481. }
  1482. .intimacy-detail__summary-inline {
  1483. width: 100%;
  1484. justify-content: flex-start;
  1485. gap: 8px 16px;
  1486. }
  1487. .detail-item {
  1488. flex-basis: 100%;
  1489. min-width: 0;
  1490. }
  1491. .intimacy-card-list {
  1492. padding-inline: 32px;
  1493. }
  1494. .intimacy-card {
  1495. flex-basis: 220px;
  1496. }
  1497. }
  1498. .config-modal {
  1499. &__summary {
  1500. flex-direction: column;
  1501. align-items: stretch;
  1502. }
  1503. &__summary-extra {
  1504. align-items: flex-start;
  1505. }
  1506. }
  1507. .config-item {
  1508. flex-direction: column;
  1509. align-items: stretch;
  1510. &__score-editor {
  1511. flex-direction: column;
  1512. }
  1513. &__weight {
  1514. flex: 0 0 auto;
  1515. justify-content: flex-start;
  1516. }
  1517. }
  1518. }
  1519. </style>