analysis.ts 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334
  1. import { defHttp } from '@jeesite/core/utils/http/axios';
  2. import { useGlobSetting } from '@jeesite/core/hooks/setting';
  3. import { useUserStoreWithOut } from '@jeesite/core/store/modules/case';
  4. import type { LocationQuery, LocationQueryValue } from 'vue-router';
  5. export type RelationMode = 'object' | 'entity';
  6. export type TradeMode = 'trade' | 'commonTrade' | 'mutualTrade';
  7. export type CommunicationMode = 'contact' | 'commonContact' | 'mutualContact';
  8. type GraphQueryValue = string | string[] | number | number[] | null | undefined;
  9. const { adminPath } = useGlobSetting();
  10. const GRAPH_QUERY_OBJECT_ID_KEYS = [
  11. 'ojbs',
  12. 'objIds',
  13. 'objId',
  14. 'ids',
  15. 'respondentIds',
  16. 'respondentId',
  17. 'targetIds',
  18. 'targetId',
  19. ];
  20. const GRAPH_QUERY_NAME_KEYS = [
  21. 'personNames',
  22. 'personName',
  23. 'respondentNames',
  24. 'respondentName',
  25. 'names',
  26. 'name',
  27. 'objNames',
  28. 'objName',
  29. ];
  30. const GRAPH_QUERY_IDENTITY_KEYS = [
  31. 'personCardNos',
  32. 'personCardNo',
  33. 'identityCodes',
  34. 'identityCode',
  35. 'cardNos',
  36. 'cardNo',
  37. 'sfz',
  38. 'sfzs',
  39. ];
  40. const GRAPH_QUERY_NESTED_KEYS = ['query', 'params', 'payload'];
  41. export interface AnalysisRespondent {
  42. id: string;
  43. name: string;
  44. objId?: string;
  45. identityCode?: string;
  46. photograph?: string;
  47. degree?: number;
  48. }
  49. export interface AnalysisConditionPayload {
  50. respondents: AnalysisRespondent[];
  51. queryTime?: [string, string];
  52. tradeMode?: TradeMode;
  53. tradeAmountMin?: number;
  54. tradeAmountMax?: number;
  55. communicationMode?: CommunicationMode;
  56. communicationCount?: number;
  57. }
  58. export interface GraphAnalysisNode {
  59. dxId?: string | null;
  60. level?: number | null;
  61. sfz?: string | null;
  62. photo?: string | null;
  63. main?: string | null;
  64. team_id?: string | null;
  65. bm: string;
  66. type?: string | null;
  67. mc?: string | null;
  68. nodecn?: string | null;
  69. zp?: string | null;
  70. dxId0?: string | null;
  71. sm?: string | null;
  72. mc1?: string | null;
  73. id: string;
  74. kg?: string | null;
  75. class?: string | null;
  76. clazz?: string | null;
  77. fzId?: string | null;
  78. node?: string | null;
  79. lx?: number | null;
  80. fx?: number | null;
  81. [key: string]: unknown;
  82. }
  83. export interface GraphAnalysisEdge {
  84. mc?: string | null;
  85. sm?: string | null;
  86. id: string;
  87. obj2_name?: string | null;
  88. dx1: string;
  89. clazz: string;
  90. dx2: string;
  91. obj1_name?: string | null;
  92. money?: number | null;
  93. lx?: number | null;
  94. sjfx?: number | null;
  95. sbxq?: number | null;
  96. nums?: string | number | null;
  97. }
  98. export interface GraphAnalysisResponse {
  99. code: number;
  100. msg: string;
  101. data: {
  102. dx: GraphAnalysisNode[];
  103. gx: GraphAnalysisEdge[];
  104. };
  105. }
  106. interface LegacyGraphAnalysisNode {
  107. id?: string | number | null;
  108. node?: string | number | null;
  109. bm?: string | number | null;
  110. sfz?: string | number | null;
  111. mc?: string | null;
  112. mc1?: string | null;
  113. nodecn?: string | null;
  114. name?: string | null;
  115. label?: string | null;
  116. class?: string | null;
  117. clazz?: string | null;
  118. dxId?: string | null;
  119. dxId0?: string | null;
  120. fzId?: string | null;
  121. photo?: string | null;
  122. zp?: string | null;
  123. [key: string]: unknown;
  124. }
  125. interface LegacyGraphAnalysisEdge {
  126. id?: string | number | null;
  127. dx1?: string | null;
  128. dx2?: string | null;
  129. node1?: string | null;
  130. node2?: string | null;
  131. obj1_name?: string | null;
  132. obj2_name?: string | null;
  133. node1cn?: string | null;
  134. node2cn?: string | null;
  135. clazz?: string | null;
  136. class?: string | null;
  137. lx?: string | number | null;
  138. mc?: string | null;
  139. sm?: string | null;
  140. money?: string | number | null;
  141. nums?: string | number | null;
  142. num?: string | number | null;
  143. [key: string]: unknown;
  144. }
  145. export interface GraphHistoryCreateQuery {
  146. caseId?: ApiId | number;
  147. graphHisName?: ApiText;
  148. name?: ApiText;
  149. graphName?: ApiText;
  150. title?: ApiText;
  151. content?: ApiText;
  152. graphData?: ApiText;
  153. graphJson?: ApiText;
  154. nodeCount?: ApiCount;
  155. edgeCount?: ApiCount;
  156. }
  157. export interface GraphHistoryItem {
  158. id?: ApiId | number;
  159. graphHisName?: ApiText;
  160. name?: ApiText;
  161. graphName?: ApiText;
  162. title?: ApiText;
  163. path?: ApiText;
  164. filePath?: ApiText;
  165. content?: ApiText;
  166. graphData?: ApiText;
  167. graphJson?: ApiText;
  168. data?: ApiText;
  169. createDate?: ApiDateString;
  170. createTime?: ApiDateString;
  171. createDateTime?: ApiDateString;
  172. createdAt?: ApiDateString;
  173. nodeCount?: ApiCount;
  174. edgeCount?: ApiCount;
  175. }
  176. export interface GraphHistoryDeleteQuery {
  177. id?: ApiId | number;
  178. }
  179. export interface GraphViewQuery extends Record<string, GraphQueryValue> {
  180. caseId?: number;
  181. page?: number;
  182. limit?: number;
  183. type?: number[];
  184. startMoney?: string;
  185. endMoney?: string;
  186. callNum?: string;
  187. order?: string;
  188. asc?: string | number;
  189. export?: string | number;
  190. erId?: number;
  191. ojbs?: string[];
  192. configDxMove?: string;
  193. configTeam?: string;
  194. configNoGx?: string;
  195. gxYs?: string;
  196. gxUser?: string;
  197. gxYsFs?: string;
  198. gxYsFsNum?: string;
  199. configYsGtgxr?: string;
  200. configYsGtgxrNum?: string;
  201. configYsGtgxrFs?: string;
  202. yhJy?: string;
  203. jyGtgxr?: string;
  204. jyGtgxrNum?: string;
  205. jyGtgxrMoney1?: string;
  206. jyGtgxrMoney2?: string;
  207. allJy?: string;
  208. jyXh?: string;
  209. jyGt?: string;
  210. gxTel?: string;
  211. telGtgxr?: string;
  212. telGtgxrNum?: string;
  213. telXh?: string;
  214. telGt?: string;
  215. telGtgxrFs1?: string;
  216. telDzTel?: string;
  217. telDzGtgxrNum?: string;
  218. allTel?: string;
  219. dxDzFc?: string;
  220. dxCar?: string;
  221. dxDzYh?: string;
  222. dxDzIp?: string;
  223. dxDzGa?: string;
  224. date1?: string;
  225. date2?: string;
  226. jt?: string;
  227. zdy?: string;
  228. model?: number;
  229. personName?: string;
  230. personNames?: string[];
  231. personCardNo?: string;
  232. personCardNos?: string[];
  233. identityCode?: string;
  234. identityCodes?: string[];
  235. startDate?: string;
  236. endDate?: string;
  237. keyword?: string;
  238. tableName?: string;
  239. tableNameEn?: string;
  240. tableNameCn?: string;
  241. rowId?: string;
  242. id?: string;
  243. objId?: string;
  244. objIds?: string[];
  245. ids?: string[];
  246. }
  247. export interface GraphTransDetailQuery extends GraphViewQuery {
  248. personCardNo?: string;
  249. otherName?: string;
  250. otherCardNo?: string;
  251. lx?: number;
  252. jdlx?: string;
  253. ext1?: string;
  254. transAmountSymbol?: string;
  255. transAmount?: string | number;
  256. debitCreditFlag?: string;
  257. transSummary?: string;
  258. orderKey?: string;
  259. sort?: string;
  260. bankCardNo?: string;
  261. cardNo?: string;
  262. bm?: string;
  263. nodeId?: string;
  264. nodeClass?: string;
  265. dxId?: string;
  266. dxId0?: string;
  267. }
  268. export interface GraphCallDetailQuery extends GraphViewQuery {
  269. personPhones?: string[];
  270. otherName?: string;
  271. otherPhones?: string[];
  272. callDirection?: string;
  273. callType?: string;
  274. startTime?: string;
  275. endTime?: string;
  276. orderKey?: string;
  277. sort?: string;
  278. phoneNo?: string;
  279. personPhone?: string;
  280. otherPhone?: string;
  281. bm?: string;
  282. nodeId?: string;
  283. nodeClass?: string;
  284. dxId?: string;
  285. dxId0?: string;
  286. dx1?: string;
  287. dx2?: string;
  288. clazz?: string;
  289. edgeId?: string;
  290. }
  291. export interface GraphNodeDetailQuery {
  292. node: string;
  293. lx?: number;
  294. fx?: number;
  295. clazz: string;
  296. page?: number;
  297. limit?: number;
  298. startDate?: string;
  299. endDate?: string;
  300. transAmountSymbol?: string;
  301. transAmount?: string | number;
  302. orderKey?: string;
  303. sort?: string;
  304. }
  305. const GRAPH_VIEW_REQUEST_KEYS: (keyof GraphViewQuery)[] = [
  306. 'caseId',
  307. 'personNames',
  308. 'type',
  309. 'startMoney',
  310. 'endMoney',
  311. 'callNum',
  312. 'date1',
  313. 'date2',
  314. 'startDate',
  315. 'endDate',
  316. ];
  317. const pickRouteQueryValue = (value?: LocationQueryValue | LocationQueryValue[]) => {
  318. return Array.isArray(value) ? value[0] : value;
  319. };
  320. const normalizeText = (value: unknown) => {
  321. if (value === 0) return '0';
  322. const text = String(value ?? '').trim();
  323. if (!text || text === 'null' || text === 'undefined') return undefined;
  324. return text;
  325. };
  326. const normalizeNumber = (value: unknown) => {
  327. if (value === null || value === undefined || value === '') return undefined;
  328. const numeric = Number(value);
  329. if (!Number.isFinite(numeric)) return undefined;
  330. return numeric;
  331. };
  332. const normalizeNumericText = (value: unknown) => {
  333. if (value === null || value === undefined || value === '') return undefined;
  334. const numeric = Number(value);
  335. if (!Number.isFinite(numeric)) return undefined;
  336. return String(numeric);
  337. };
  338. const normalizeStringArray = (value: unknown) => {
  339. if (Array.isArray(value)) {
  340. const values = value.map((item) => normalizeText(item)).filter((item): item is string => Boolean(item));
  341. return values.length ? Array.from(new Set(values)) : undefined;
  342. }
  343. const text = normalizeText(value);
  344. if (!text) return undefined;
  345. if (text.startsWith('[') && text.endsWith(']')) {
  346. try {
  347. const parsed = JSON.parse(text);
  348. if (Array.isArray(parsed)) return normalizeStringArray(parsed);
  349. } catch {
  350. // Ignore invalid JSON and keep the plain-text fallback.
  351. }
  352. }
  353. const values = text
  354. .split(',')
  355. .map((item) => normalizeText(item))
  356. .filter((item): item is string => Boolean(item));
  357. return values.length ? Array.from(new Set(values)) : undefined;
  358. };
  359. const normalizeNumberArray = (value: unknown) => {
  360. if (Array.isArray(value)) {
  361. const values = value.map((item) => normalizeNumber(item)).filter((item): item is number => item !== undefined);
  362. return values.length ? Array.from(new Set(values)) : undefined;
  363. }
  364. const text = normalizeText(value);
  365. if (!text) return undefined;
  366. if (text.startsWith('[') && text.endsWith(']')) {
  367. try {
  368. const parsed = JSON.parse(text);
  369. if (Array.isArray(parsed)) return normalizeNumberArray(parsed);
  370. } catch {
  371. // Ignore invalid JSON and keep the plain-text fallback.
  372. }
  373. }
  374. const values = text
  375. .split(',')
  376. .map((item) => normalizeNumber(item))
  377. .filter((item): item is number => item !== undefined);
  378. return values.length ? Array.from(new Set(values)) : undefined;
  379. };
  380. const hasGraphQueryValue = (value: GraphQueryValue) => {
  381. if (value === null || value === undefined) return false;
  382. if (Array.isArray(value)) return value.length > 0;
  383. if (typeof value === 'number') return Number.isFinite(value);
  384. if (typeof value === 'string') return value.trim().length > 0;
  385. return false;
  386. };
  387. const pickGraphViewRequestPayload = (query: GraphViewQuery): GraphViewQuery => {
  388. const payload: GraphViewQuery = {};
  389. GRAPH_VIEW_REQUEST_KEYS.forEach((key) => {
  390. const value = query[key];
  391. if (!hasGraphQueryValue(value)) return;
  392. payload[key] = value;
  393. });
  394. return payload;
  395. };
  396. const isObjectOrOrgNodeClass = (value?: string | null) => {
  397. const normalized = normalizeText(value)?.toLowerCase() || '';
  398. return normalized === 'obj' || normalized === 'org' || normalized === 'ins';
  399. };
  400. const normalizeGraphAnalysisNode = (node: LegacyGraphAnalysisNode, index: number): GraphAnalysisNode | null => {
  401. const normalizedClass = normalizeText(node?.class ?? node?.clazz);
  402. const preferNodeValue = isObjectOrOrgNodeClass(normalizedClass);
  403. const nodeCn = normalizeText(node?.nodecn);
  404. const token = preferNodeValue
  405. ? normalizeText(node?.node ?? node?.bm ?? node?.sfz ?? node?.id)
  406. : normalizeText(node?.bm ?? node?.node ?? node?.sfz ?? node?.id);
  407. const fullLabel = preferNodeValue
  408. ? normalizeText(node?.node ?? node?.mc ?? node?.mc1 ?? node?.name ?? node?.label)
  409. : normalizeText(node?.mc ?? node?.mc1 ?? node?.name ?? node?.label ?? node?.node ?? node?.bm);
  410. const id = preferNodeValue
  411. ? normalizeText(node?.node ?? node?.id ?? node?.bm ?? node?.sfz ?? node?.dxId ?? node?.dxId0)
  412. : normalizeText(node?.id ?? node?.node ?? node?.bm ?? node?.sfz ?? node?.dxId ?? node?.dxId0);
  413. if (!token && !fullLabel && !id) return null;
  414. return {
  415. ...(node as Record<string, unknown>),
  416. id: id || token || fullLabel || `graph-node-${index}`,
  417. bm: token || id || fullLabel || `graph-node-${index}`,
  418. mc: fullLabel || token || id || '未命名实体',
  419. nodecn: nodeCn,
  420. mc1: fullLabel || token || id || '未命名实体',
  421. sfz: normalizeText(node?.sfz),
  422. photo: normalizeText(node?.photo),
  423. zp: normalizeText(node?.zp),
  424. dxId: normalizeText(node?.dxId),
  425. dxId0: normalizeText(node?.dxId0),
  426. fzId: normalizeText(node?.fzId),
  427. class: normalizeText(node?.class ?? node?.clazz),
  428. clazz: normalizeText(node?.clazz ?? node?.class),
  429. type: normalizeText(node?.class ?? node?.clazz),
  430. node: normalizeText(node?.node),
  431. lx: normalizeNumber((node as Record<string, unknown>)?.lx),
  432. fx: normalizeNumber((node as Record<string, unknown>)?.fx),
  433. };
  434. };
  435. const buildGraphAnalysisNodeMergeKey = (node: GraphAnalysisNode) => {
  436. const clazz = normalizeText(node.class ?? node.type) || 'unknown';
  437. const token = normalizeText(node.bm ?? node.sfz ?? node.id);
  438. if (!token) return '';
  439. return `${clazz}::${token}`;
  440. };
  441. const pickPreferredNodeText = (current?: string | null, incoming?: string | null) => {
  442. const currentText = normalizeText(current);
  443. const incomingText = normalizeText(incoming);
  444. if (!currentText) return incomingText;
  445. if (!incomingText) return currentText;
  446. return incomingText.length > currentText.length ? incomingText : currentText;
  447. };
  448. const mergeGraphAnalysisNode = (current: GraphAnalysisNode, incoming: GraphAnalysisNode): GraphAnalysisNode => ({
  449. ...current,
  450. id: pickPreferredNodeText(current.id, incoming.id) || current.id,
  451. bm: pickPreferredNodeText(current.bm, incoming.bm) || current.bm,
  452. mc: pickPreferredNodeText(current.mc, incoming.mc) || current.mc,
  453. nodecn: pickPreferredNodeText(current.nodecn, incoming.nodecn),
  454. mc1: pickPreferredNodeText(current.mc1, incoming.mc1) || current.mc1,
  455. sfz: pickPreferredNodeText(current.sfz, incoming.sfz),
  456. photo: pickPreferredNodeText(current.photo, incoming.photo),
  457. zp: pickPreferredNodeText(current.zp, incoming.zp),
  458. dxId: pickPreferredNodeText(current.dxId, incoming.dxId),
  459. dxId0: pickPreferredNodeText(current.dxId0, incoming.dxId0),
  460. fzId: pickPreferredNodeText(current.fzId, incoming.fzId),
  461. class: pickPreferredNodeText(current.class, incoming.class),
  462. clazz: pickPreferredNodeText(current.clazz, incoming.clazz),
  463. type: pickPreferredNodeText(current.type, incoming.type),
  464. node: pickPreferredNodeText(current.node, incoming.node),
  465. lx: current.lx ?? incoming.lx,
  466. fx: current.fx ?? incoming.fx,
  467. });
  468. const dedupeGraphAnalysisNodes = (nodes: GraphAnalysisNode[]) => {
  469. const nodeMap = new Map<string, GraphAnalysisNode>();
  470. nodes.forEach((node) => {
  471. const mergeKey = buildGraphAnalysisNodeMergeKey(node);
  472. if (!mergeKey) return;
  473. const currentNode = nodeMap.get(mergeKey);
  474. nodeMap.set(mergeKey, currentNode ? mergeGraphAnalysisNode(currentNode, node) : node);
  475. });
  476. return Array.from(nodeMap.values());
  477. };
  478. const normalizeGraphAnalysisEdge = (edge: LegacyGraphAnalysisEdge, index: number): GraphAnalysisEdge | null => {
  479. const dx1 = normalizeText(edge?.dx1 ?? edge?.node1);
  480. const dx2 = normalizeText(edge?.dx2 ?? edge?.node2);
  481. if (!dx1 || !dx2) return null;
  482. const money = normalizeNumber(edge?.money ?? edge?.num);
  483. const nums = normalizeNumericText(edge?.nums ?? edge?.num);
  484. const clazz = normalizeText(edge?.clazz ?? edge?.class) || 'custom_assoc';
  485. return {
  486. id: normalizeText(edge?.id) || `${dx1}-${dx2}-${clazz}-${index}`,
  487. dx1,
  488. dx2,
  489. clazz,
  490. mc: normalizeText(edge?.mc ?? edge?.sm),
  491. sm: normalizeText(edge?.sm ?? edge?.mc),
  492. obj1_name: normalizeText(edge?.obj1_name ?? edge?.node1cn),
  493. obj2_name: normalizeText(edge?.obj2_name ?? edge?.node2cn),
  494. money,
  495. lx: normalizeNumber(edge?.lx),
  496. nums,
  497. };
  498. };
  499. const normalizeGraphAnalysisResponse = (response: any): GraphAnalysisResponse => {
  500. const payload = response?.data !== undefined ? response.data : response;
  501. const graphData = payload?.data !== undefined ? payload.data : payload;
  502. const rawNodes =
  503. (Array.isArray(graphData?.dx) && graphData.dx) ||
  504. (Array.isArray(graphData?.nodeList) && graphData.nodeList) ||
  505. (Array.isArray(graphData?.nodelist) && graphData.nodelist) ||
  506. [];
  507. const rawEdges =
  508. (Array.isArray(graphData?.gx) && graphData.gx) ||
  509. (Array.isArray(graphData?.edgeList) && graphData.edgeList) ||
  510. (Array.isArray(graphData?.edgelist) && graphData.edgelist) ||
  511. [];
  512. return {
  513. code: normalizeNumber(payload?.code ?? response?.code) ?? 200,
  514. msg: normalizeText(payload?.msg ?? payload?.message ?? response?.msg ?? response?.message) || '',
  515. data: {
  516. dx: dedupeGraphAnalysisNodes(
  517. rawNodes
  518. .map((item: LegacyGraphAnalysisNode, index: number) => normalizeGraphAnalysisNode(item, index))
  519. .filter((item): item is GraphAnalysisNode => Boolean(item)),
  520. ),
  521. gx: rawEdges
  522. .map((item: LegacyGraphAnalysisEdge, index: number) => normalizeGraphAnalysisEdge(item, index))
  523. .filter((item): item is GraphAnalysisEdge => Boolean(item)),
  524. },
  525. };
  526. };
  527. const parseObjectLike = (value: unknown): Record<string, unknown> | undefined => {
  528. if (!value) return undefined;
  529. if (typeof value === 'object' && !Array.isArray(value)) {
  530. return value as Record<string, unknown>;
  531. }
  532. const text = normalizeText(Array.isArray(value) ? value[0] : value);
  533. if (!text || !text.startsWith('{') || !text.endsWith('}')) return undefined;
  534. try {
  535. const parsed = JSON.parse(text);
  536. if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
  537. return parsed as Record<string, unknown>;
  538. }
  539. } catch {
  540. // Ignore invalid JSON text.
  541. }
  542. return undefined;
  543. };
  544. const expandLocationQuerySource = (query?: LocationQuery | Record<string, unknown>) => {
  545. if (!query) return {};
  546. const expanded: Record<string, unknown> = { ...query };
  547. GRAPH_QUERY_NESTED_KEYS.forEach((key) => {
  548. const nested = parseObjectLike((query as Record<string, unknown>)[key]);
  549. if (!nested) return;
  550. Object.entries(nested).forEach(([nestedKey, nestedValue]) => {
  551. const currentValue = expanded[nestedKey];
  552. if (currentValue === undefined || currentValue === null || currentValue === '') {
  553. expanded[nestedKey] = nestedValue;
  554. }
  555. });
  556. });
  557. return expanded;
  558. };
  559. const normalizeLocationQuery = (query?: LocationQuery | Record<string, unknown>): GraphViewQuery => {
  560. if (!query) return {};
  561. const normalized: GraphViewQuery = {};
  562. const expandedSource = expandLocationQuerySource(query);
  563. Object.entries(expandedSource).forEach(([key, rawValue]) => {
  564. if (typeof rawValue === 'number' && Number.isFinite(rawValue)) {
  565. normalized[key] = rawValue;
  566. return;
  567. }
  568. const arrayValue = normalizeStringArray(rawValue);
  569. if (Array.isArray(rawValue) || (arrayValue?.length && arrayValue.length > 1)) {
  570. if (arrayValue?.length) {
  571. normalized[key] = arrayValue;
  572. }
  573. return;
  574. }
  575. const routeValue = pickRouteQueryValue(rawValue as LocationQueryValue | LocationQueryValue[]);
  576. const textValue = normalizeText(routeValue);
  577. if (textValue !== undefined) {
  578. normalized[key] = textValue;
  579. }
  580. });
  581. return normalized;
  582. };
  583. const pickFirstText = (source: Record<string, unknown>, keys: string[]) => {
  584. for (const key of keys) {
  585. const text = normalizeText(source[key]);
  586. if (text) return text;
  587. }
  588. return undefined;
  589. };
  590. const pickFirstArray = (source: Record<string, unknown>, keys: string[]) => {
  591. for (const key of keys) {
  592. const values = normalizeStringArray(source[key]);
  593. if (values?.length) return values;
  594. }
  595. return undefined;
  596. };
  597. const pickFirstNumber = (source: Record<string, unknown>, keys: string[]) => {
  598. for (const key of keys) {
  599. const value = normalizeNumber(source[key]);
  600. if (value !== undefined) return value;
  601. }
  602. return undefined;
  603. };
  604. const uniqueValues = <T>(values: T[]) => Array.from(new Set(values));
  605. const uniqueNumberValues = (values: number[]) => Array.from(new Set(values.filter((item) => Number.isFinite(item))));
  606. const resolveGraphTransDetailType = (source: Record<string, unknown>) => {
  607. const directType = pickFirstNumber(source, ['lx']);
  608. if (directType !== undefined) return directType;
  609. const typeValues = normalizeNumberArray(source.type);
  610. return typeValues?.find((item) => item >= 100 && item < 200);
  611. };
  612. const pickGraphTransDetailRequestPayload = (query: GraphTransDetailQuery): GraphTransDetailQuery => {
  613. const source = query as Record<string, unknown>;
  614. const payload: GraphTransDetailQuery = {};
  615. const caseId = resolveCaseId(query);
  616. if (caseId !== undefined) {
  617. payload.caseId = caseId;
  618. }
  619. const page = normalizeNumber(query.page);
  620. if (page !== undefined) {
  621. payload.page = page;
  622. }
  623. const limit = normalizeNumber(query.limit);
  624. if (limit !== undefined) {
  625. payload.limit = limit;
  626. }
  627. const startDate = pickFirstText(source, ['startDate', 'date1']);
  628. if (startDate) {
  629. payload.startDate = startDate;
  630. }
  631. const endDate = pickFirstText(source, ['endDate', 'date2']);
  632. if (endDate) {
  633. payload.endDate = endDate;
  634. }
  635. const personCardNo = pickFirstText(source, ['personCardNo', 'bankCardNo', 'cardNo', 'bm']);
  636. if (personCardNo) {
  637. payload.personCardNo = personCardNo;
  638. }
  639. const otherCardNo = pickFirstText(source, ['otherCardNo']);
  640. if (otherCardNo) {
  641. payload.otherCardNo = otherCardNo;
  642. }
  643. const lx = resolveGraphTransDetailType(source);
  644. if (lx !== undefined) {
  645. payload.lx = lx;
  646. }
  647. const jdlx = pickFirstText(source, ['jdlx', 'debitCreditFlag']);
  648. if (jdlx) {
  649. payload.jdlx = jdlx;
  650. }
  651. const otherName = pickFirstText(source, ['otherName']);
  652. if (otherName) {
  653. payload.otherName = otherName;
  654. }
  655. const ext1 = pickFirstText(source, ['ext1', 'transSummary']);
  656. if (ext1) {
  657. payload.ext1 = ext1;
  658. }
  659. const transAmountSymbol = pickFirstText(source, ['transAmountSymbol']);
  660. if (transAmountSymbol) {
  661. payload.transAmountSymbol = transAmountSymbol;
  662. }
  663. const transAmount = normalizeText(query.transAmount);
  664. if (transAmount) {
  665. payload.transAmount = transAmount;
  666. }
  667. const orderKey = pickFirstText(source, ['orderKey']);
  668. if (orderKey) {
  669. payload.orderKey = orderKey;
  670. }
  671. const sort = pickFirstText(source, ['sort']);
  672. if (sort) {
  673. payload.sort = sort;
  674. }
  675. return payload;
  676. };
  677. const pickGraphCallDetailRequestPayload = (query: GraphCallDetailQuery): GraphCallDetailQuery => {
  678. const source = query as Record<string, unknown>;
  679. const payload: GraphCallDetailQuery = {};
  680. const caseId = resolveCaseId(query);
  681. if (caseId !== undefined) {
  682. payload.caseId = caseId;
  683. }
  684. const page = normalizeNumber(query.page);
  685. if (page !== undefined) {
  686. payload.page = page;
  687. }
  688. const limit = normalizeNumber(query.limit);
  689. if (limit !== undefined) {
  690. payload.limit = limit;
  691. }
  692. const personPhone = pickFirstText(source, ['personPhone', 'phoneNo', 'bm', 'dx1']) || query.personPhones?.[0];
  693. if (personPhone) {
  694. payload.personPhone = personPhone;
  695. }
  696. const otherPhone = pickFirstText(source, ['otherPhone', 'dx2']) || query.otherPhones?.[0];
  697. if (otherPhone) {
  698. payload.otherPhone = otherPhone;
  699. }
  700. const startDate = pickFirstText(source, ['startDate', 'date1']);
  701. if (startDate) {
  702. payload.startDate = startDate;
  703. }
  704. const endDate = pickFirstText(source, ['endDate', 'date2']);
  705. if (endDate) {
  706. payload.endDate = endDate;
  707. }
  708. const startTime = pickFirstText(source, ['startTime']);
  709. if (startTime) {
  710. payload.startTime = startTime;
  711. }
  712. const endTime = pickFirstText(source, ['endTime']);
  713. if (endTime) {
  714. payload.endTime = endTime;
  715. }
  716. const orderKey = pickFirstText(source, ['orderKey']);
  717. if (orderKey) {
  718. payload.orderKey = orderKey;
  719. }
  720. const sort = pickFirstText(source, ['sort']);
  721. if (sort) {
  722. payload.sort = sort;
  723. }
  724. return payload;
  725. };
  726. const resolveCaseId = (query?: GraphViewQuery) => {
  727. const routeCaseId = pickFirstNumber((query || {}) as Record<string, unknown>, ['caseId', 'case_id']);
  728. if (routeCaseId !== undefined) return routeCaseId;
  729. return normalizeNumber(useUserStoreWithOut().getCaseInfo?.id);
  730. };
  731. const appendRespondent = (
  732. respondents: AnalysisRespondent[],
  733. seenKeys: Set<string>,
  734. payload: {
  735. objId?: string;
  736. name?: string;
  737. identityCode?: string;
  738. },
  739. ) => {
  740. const objId = normalizeText(payload.objId);
  741. const name = normalizeText(payload.name);
  742. const identityCode = normalizeText(payload.identityCode);
  743. const id = objId || identityCode || name;
  744. if (!id || seenKeys.has(id)) return;
  745. seenKeys.add(id);
  746. respondents.push({
  747. id,
  748. objId,
  749. name: name || identityCode || objId || id,
  750. identityCode,
  751. });
  752. };
  753. export const resolveGraphRespondentsFromRouteQuery = (
  754. query?: LocationQuery | Record<string, unknown>,
  755. ): AnalysisRespondent[] => {
  756. const normalized = normalizeLocationQuery(query);
  757. const objIds = pickFirstArray(normalized, GRAPH_QUERY_OBJECT_ID_KEYS) || [];
  758. const personNames = pickFirstArray(normalized, GRAPH_QUERY_NAME_KEYS) || [];
  759. const personCardNos = pickFirstArray(normalized, GRAPH_QUERY_IDENTITY_KEYS) || [];
  760. const respondents: AnalysisRespondent[] = [];
  761. const seenKeys = new Set<string>();
  762. const maxLength = Math.max(objIds.length, personNames.length, personCardNos.length);
  763. for (let index = 0; index < maxLength; index += 1) {
  764. appendRespondent(respondents, seenKeys, {
  765. objId: objIds[index],
  766. name: personNames[index],
  767. identityCode: personCardNos[index],
  768. });
  769. }
  770. if (!respondents.length) {
  771. appendRespondent(respondents, seenKeys, {
  772. objId: pickFirstText(normalized, GRAPH_QUERY_OBJECT_ID_KEYS),
  773. name: normalizeText(normalized.keyword),
  774. identityCode: pickFirstText(normalized, GRAPH_QUERY_IDENTITY_KEYS),
  775. });
  776. }
  777. return respondents;
  778. };
  779. const applyRespondentFields = (target: GraphViewQuery, respondents: AnalysisRespondent[]) => {
  780. const respondentNames = uniqueValues(
  781. respondents.map((item) => normalizeText(item.name)).filter((item): item is string => Boolean(item)),
  782. );
  783. target.personName = undefined;
  784. target.personNames = respondentNames.length ? respondentNames : undefined;
  785. target.personCardNo = undefined;
  786. target.personCardNos = undefined;
  787. target.identityCode = undefined;
  788. target.identityCodes = undefined;
  789. target.ojbs = undefined;
  790. target.objId = undefined;
  791. target.objIds = undefined;
  792. target.ids = undefined;
  793. };
  794. const applyQueryTimeFields = (target: GraphViewQuery, queryTime?: [string, string]) => {
  795. const startDate = queryTime?.[0] || pickFirstText(target, ['date1', 'startDate']);
  796. const endDate = queryTime?.[1] || pickFirstText(target, ['date2', 'endDate']);
  797. target.date1 = startDate;
  798. target.date2 = endDate;
  799. target.startDate = startDate;
  800. target.endDate = endDate;
  801. };
  802. const applyConditionFields = (target: GraphViewQuery, payload?: AnalysisConditionPayload) => {
  803. if (!payload) {
  804. applyQueryTimeFields(target);
  805. return;
  806. }
  807. if (payload.respondents.length) {
  808. applyRespondentFields(target, payload.respondents);
  809. }
  810. applyQueryTimeFields(target, payload.queryTime);
  811. const typeCodes = uniqueNumberValues([
  812. payload.tradeMode
  813. ? payload.tradeMode === 'trade'
  814. ? 101
  815. : payload.tradeMode === 'commonTrade'
  816. ? 102
  817. : 103
  818. : undefined,
  819. payload.communicationMode
  820. ? payload.communicationMode === 'contact'
  821. ? 201
  822. : payload.communicationMode === 'commonContact'
  823. ? 202
  824. : 203
  825. : undefined,
  826. ]);
  827. target.type = typeCodes.length ? typeCodes : undefined;
  828. target.startMoney = normalizeNumericText(payload.tradeAmountMin);
  829. target.endMoney = normalizeNumericText(payload.tradeAmountMax);
  830. target.callNum = normalizeNumericText(payload.communicationCount);
  831. target.startDate = payload.queryTime?.[0] || target.startDate || target.date1;
  832. target.endDate = payload.queryTime?.[1] || target.endDate || target.date2;
  833. // Old graph/view flags are no longer used by the backend; clear them to avoid mixed payloads.
  834. target.gxYs = undefined;
  835. target.dxDzFc = undefined;
  836. target.dxCar = undefined;
  837. target.yhJy = undefined;
  838. target.allJy = undefined;
  839. target.jyGtgxr = undefined;
  840. target.jyGtgxrNum = undefined;
  841. target.jyGtgxrMoney1 = undefined;
  842. target.jyGtgxrMoney2 = undefined;
  843. target.jyXh = undefined;
  844. target.jyGt = undefined;
  845. target.gxTel = undefined;
  846. target.allTel = undefined;
  847. target.telGtgxr = undefined;
  848. target.telGtgxrNum = undefined;
  849. target.telGtgxrFs1 = undefined;
  850. target.telXh = undefined;
  851. target.telGt = undefined;
  852. target.configTeam = undefined;
  853. target.zdy = undefined;
  854. target.jt = undefined;
  855. };
  856. const finalizeGraphViewQuery = (query: GraphViewQuery) => {
  857. const normalized = { ...query } as GraphViewQuery;
  858. const caseId = resolveCaseId(normalized);
  859. if (caseId !== undefined) {
  860. normalized.caseId = caseId;
  861. }
  862. delete normalized.page;
  863. delete normalized.limit;
  864. delete normalized.model;
  865. applyQueryTimeFields(normalized);
  866. normalized.startDate = normalized.startDate || normalized.date1;
  867. normalized.endDate = normalized.endDate || normalized.date2;
  868. const routePersonNames = pickFirstArray(normalized, GRAPH_QUERY_NAME_KEYS);
  869. if (!normalized.personNames && routePersonNames?.length) {
  870. normalized.personNames = routePersonNames;
  871. }
  872. normalized.personName = undefined;
  873. normalized.ojbs = undefined;
  874. normalized.objId = undefined;
  875. normalized.objIds = undefined;
  876. normalized.ids = undefined;
  877. normalized.gxYs = undefined;
  878. normalized.dxDzFc = undefined;
  879. normalized.dxCar = undefined;
  880. normalized.yhJy = undefined;
  881. normalized.allJy = undefined;
  882. normalized.jyGtgxr = undefined;
  883. normalized.jyGtgxrNum = undefined;
  884. normalized.jyGtgxrMoney1 = undefined;
  885. normalized.jyGtgxrMoney2 = undefined;
  886. normalized.jyXh = undefined;
  887. normalized.jyGt = undefined;
  888. normalized.gxTel = undefined;
  889. normalized.allTel = undefined;
  890. normalized.telGtgxr = undefined;
  891. normalized.telGtgxrNum = undefined;
  892. normalized.telGtgxrFs1 = undefined;
  893. normalized.telXh = undefined;
  894. normalized.telGt = undefined;
  895. normalized.configTeam = undefined;
  896. normalized.zdy = undefined;
  897. normalized.jt = undefined;
  898. return pickGraphViewRequestPayload(normalized);
  899. };
  900. export const buildGraphViewQuery = (
  901. routeQuery?: LocationQuery | Record<string, unknown>,
  902. payload?: AnalysisConditionPayload,
  903. ): GraphViewQuery => {
  904. const normalized = normalizeLocationQuery(routeQuery);
  905. applyConditionFields(normalized, payload);
  906. return finalizeGraphViewQuery(normalized);
  907. };
  908. export const buildGraphTransDetailQuery = (
  909. routeQuery?: LocationQuery | Record<string, unknown>,
  910. detailQuery?: Record<string, unknown>,
  911. node?: GraphAnalysisNode | null,
  912. ): GraphTransDetailQuery => {
  913. const normalized = {
  914. ...normalizeLocationQuery(routeQuery),
  915. } as GraphTransDetailQuery;
  916. Object.entries(detailQuery || {}).forEach(([key, value]) => {
  917. if (typeof value === 'number' && Number.isFinite(value)) {
  918. normalized[key] = value;
  919. return;
  920. }
  921. const values = normalizeStringArray(value);
  922. if (Array.isArray(value) || (values?.length && values.length > 1)) {
  923. if (values?.length) {
  924. normalized[key] = values;
  925. }
  926. return;
  927. }
  928. const text = normalizeText(value);
  929. if (text !== undefined) {
  930. normalized[key] = text;
  931. }
  932. });
  933. const bankCardNo = normalizeText(node?.bm);
  934. const nodeId = normalizeText(node?.id);
  935. const nodeClass = normalizeText(node?.class);
  936. const dxId = normalizeText(node?.dxId);
  937. const dxId0 = normalizeText(node?.dxId0);
  938. if (bankCardNo) {
  939. normalized.personCardNo = normalized.personCardNo || bankCardNo;
  940. normalized.bankCardNo = normalized.bankCardNo || bankCardNo;
  941. normalized.cardNo = normalized.cardNo || bankCardNo;
  942. normalized.bm = normalized.bm || bankCardNo;
  943. }
  944. const personCardNo = pickFirstText(normalized as Record<string, unknown>, [
  945. 'personCardNo',
  946. 'bankCardNo',
  947. 'cardNo',
  948. 'bm',
  949. ]);
  950. if (personCardNo) {
  951. normalized.personCardNo = personCardNo;
  952. }
  953. const lx = resolveGraphTransDetailType(normalized as Record<string, unknown>);
  954. if (lx !== undefined) {
  955. normalized.lx = lx;
  956. }
  957. const jdlx = pickFirstText(normalized as Record<string, unknown>, ['jdlx', 'debitCreditFlag']);
  958. if (jdlx) {
  959. normalized.jdlx = jdlx;
  960. }
  961. const ext1 = pickFirstText(normalized as Record<string, unknown>, ['ext1', 'transSummary']);
  962. if (ext1) {
  963. normalized.ext1 = ext1;
  964. }
  965. if (nodeId && !normalized.nodeId) {
  966. normalized.nodeId = nodeId;
  967. }
  968. if (nodeClass && !normalized.nodeClass) {
  969. normalized.nodeClass = nodeClass;
  970. }
  971. if (dxId && !normalized.dxId) {
  972. normalized.dxId = dxId;
  973. }
  974. if (dxId0 && !normalized.dxId0) {
  975. normalized.dxId0 = dxId0;
  976. }
  977. normalized.ids = undefined;
  978. normalized.ojbs = undefined;
  979. normalized.objIds = undefined;
  980. normalized.objId = undefined;
  981. return normalized;
  982. };
  983. export const buildGraphCallDetailQuery = (
  984. routeQuery?: LocationQuery | Record<string, unknown>,
  985. detailQuery?: Record<string, unknown>,
  986. node?: GraphAnalysisNode | null,
  987. edge?: GraphAnalysisEdge | null,
  988. ): GraphCallDetailQuery => {
  989. const normalized = {
  990. ...normalizeLocationQuery(routeQuery),
  991. } as GraphCallDetailQuery;
  992. Object.entries(detailQuery || {}).forEach(([key, value]) => {
  993. if (typeof value === 'number' && Number.isFinite(value)) {
  994. normalized[key] = value;
  995. return;
  996. }
  997. const values = normalizeStringArray(value);
  998. if (Array.isArray(value) || (values?.length && values.length > 1)) {
  999. if (values?.length) {
  1000. normalized[key] = values;
  1001. }
  1002. return;
  1003. }
  1004. const text = normalizeText(value);
  1005. if (text !== undefined) {
  1006. normalized[key] = text;
  1007. }
  1008. });
  1009. const phoneNo = normalizeText(node?.bm);
  1010. const nodeId = normalizeText(node?.id);
  1011. const nodeClass = normalizeText(node?.class);
  1012. const dxId = normalizeText(node?.dxId);
  1013. const dxId0 = normalizeText(node?.dxId0);
  1014. const dx1 = normalizeText(edge?.dx1);
  1015. const dx2 = normalizeText(edge?.dx2);
  1016. const clazz = normalizeText(edge?.clazz);
  1017. const edgeId = normalizeText(edge?.id);
  1018. if (phoneNo) {
  1019. normalized.phoneNo = normalized.phoneNo || phoneNo;
  1020. normalized.personPhone = normalized.personPhone || phoneNo;
  1021. normalized.bm = normalized.bm || phoneNo;
  1022. if (!normalized.personPhones?.length) {
  1023. normalized.personPhones = [phoneNo];
  1024. }
  1025. }
  1026. if (nodeId && !normalized.nodeId) {
  1027. normalized.nodeId = nodeId;
  1028. }
  1029. if (nodeClass && !normalized.nodeClass) {
  1030. normalized.nodeClass = nodeClass;
  1031. }
  1032. if (dxId && !normalized.dxId) {
  1033. normalized.dxId = dxId;
  1034. }
  1035. if (dxId0 && !normalized.dxId0) {
  1036. normalized.dxId0 = dxId0;
  1037. }
  1038. if (dx1) {
  1039. normalized.dx1 = normalized.dx1 || dx1;
  1040. normalized.personPhone = normalized.personPhone || dx1;
  1041. if (!normalized.personPhones?.length) {
  1042. normalized.personPhones = [dx1];
  1043. }
  1044. }
  1045. if (dx2) {
  1046. normalized.dx2 = normalized.dx2 || dx2;
  1047. normalized.otherPhone = normalized.otherPhone || dx2;
  1048. if (!normalized.otherPhones?.length) {
  1049. normalized.otherPhones = [dx2];
  1050. }
  1051. }
  1052. if (clazz && !normalized.clazz) {
  1053. normalized.clazz = clazz;
  1054. }
  1055. if (edgeId && !normalized.edgeId) {
  1056. normalized.edgeId = edgeId;
  1057. }
  1058. const personPhone =
  1059. pickFirstText(normalized as Record<string, unknown>, ['personPhone', 'phoneNo', 'bm', 'dx1']) ||
  1060. normalized.personPhones?.[0];
  1061. if (personPhone) {
  1062. normalized.personPhone = personPhone;
  1063. }
  1064. const otherPhone =
  1065. pickFirstText(normalized as Record<string, unknown>, ['otherPhone', 'dx2']) || normalized.otherPhones?.[0];
  1066. if (otherPhone) {
  1067. normalized.otherPhone = otherPhone;
  1068. }
  1069. normalized.ids = undefined;
  1070. normalized.ojbs = undefined;
  1071. normalized.objIds = undefined;
  1072. normalized.objId = undefined;
  1073. return normalized;
  1074. };
  1075. export const fetchGraphAnalysis = async (
  1076. payload: AnalysisConditionPayload,
  1077. routeQuery?: LocationQuery | Record<string, unknown>,
  1078. ): Promise<GraphAnalysisResponse> => {
  1079. const data = buildGraphViewQuery(routeQuery, payload);
  1080. if (!data.personNames?.length) {
  1081. throw new Error('当前未获取到对象名称,请先选择对象');
  1082. }
  1083. const response = await defHttp.postJson<any>(
  1084. {
  1085. url: adminPath + '/graph/view',
  1086. data,
  1087. },
  1088. {
  1089. skipSuccessMessage: true,
  1090. },
  1091. );
  1092. return normalizeGraphAnalysisResponse(response);
  1093. };
  1094. export const fetchGraphTransDetail = async (data: GraphTransDetailQuery): Promise<any> => {
  1095. const payload = pickGraphTransDetailRequestPayload(data);
  1096. return defHttp.postJson(
  1097. {
  1098. url: adminPath + '/graph/transDetail',
  1099. data: payload,
  1100. },
  1101. {
  1102. skipSuccessMessage: true,
  1103. },
  1104. );
  1105. };
  1106. export const fetchGraphCallDetail = async (data: GraphCallDetailQuery): Promise<any> => {
  1107. const payload = pickGraphCallDetailRequestPayload(data);
  1108. return defHttp.postJson(
  1109. {
  1110. url: adminPath + '/graph/callDetail',
  1111. data: payload,
  1112. },
  1113. {
  1114. skipSuccessMessage: true,
  1115. },
  1116. );
  1117. };
  1118. export const fetchGraphNodeDetail = async (data: GraphNodeDetailQuery): Promise<any> => {
  1119. return defHttp.postJson(
  1120. {
  1121. url: adminPath + '/graph/nodeDetail',
  1122. data,
  1123. },
  1124. {
  1125. skipSuccessMessage: true,
  1126. },
  1127. );
  1128. };
  1129. export const createGraphHistory = async (params: GraphHistoryCreateQuery): Promise<any> => {
  1130. return defHttp.get(
  1131. {
  1132. url: adminPath + '/graph/createGraphHis',
  1133. params,
  1134. },
  1135. {
  1136. skipSuccessMessage: true,
  1137. },
  1138. );
  1139. };
  1140. export const fetchGraphHistory = async (params?: Partial<GraphViewQuery>): Promise<any> => {
  1141. return defHttp.get(
  1142. {
  1143. url: adminPath + '/graph/graphHis',
  1144. params,
  1145. },
  1146. {
  1147. skipSuccessMessage: true,
  1148. },
  1149. );
  1150. };
  1151. export const deleteGraphHistory = async (params: GraphHistoryDeleteQuery): Promise<any> => {
  1152. return defHttp.get(
  1153. {
  1154. url: adminPath + '/graph/deleteGraphHis',
  1155. params,
  1156. },
  1157. {
  1158. skipSuccessMessage: true,
  1159. },
  1160. );
  1161. };