index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  1. <template>
  2. <div :class="prefixCls" class="trans-sensitive-page">
  3. <div class="page-header">
  4. <div class="page-title">敏感日期交易</div>
  5. <div class="page-subtitle">按对象与交易日期筛选敏感日期交易,并联动查看对应交易明细。</div>
  6. </div>
  7. <div class="filter-bar">
  8. <div class="filter-item">
  9. <span class="filter-label">选择对象:</span>
  10. <Select
  11. v-model:value="filters.target"
  12. mode="multiple"
  13. allow-clear
  14. max-tag-count="responsive"
  15. class="filter-input"
  16. :options="targetOptions"
  17. placeholder="全部"
  18. />
  19. </div>
  20. <div class="filter-item">
  21. <span class="filter-label">交易日期:</span>
  22. <RangePicker
  23. v-model:value="filters.dateRange"
  24. class="filter-input filter-date"
  25. :format="DATE_FORMAT"
  26. :value-format="DATE_FORMAT"
  27. :placeholder="['开始日期', '结束日期']"
  28. />
  29. </div>
  30. <div class="filter-actions">
  31. <Button type="primary" :loading="queryLoading" @click="handleSearch">查询</Button>
  32. <Button @click="handleReset">重置</Button>
  33. <Button @click="handleOpenSpecialDateModal">特殊日期配置</Button>
  34. </div>
  35. </div>
  36. <div class="content-panel">
  37. <div class="panel-left">
  38. <div class="panel-header">
  39. <div>
  40. <div class="panel-title">交易对方汇总</div>
  41. <div class="panel-desc">汇总敏感日期的对手方交易情况,点击左侧记录可查看右侧明细。</div>
  42. </div>
  43. </div>
  44. <div class="panel-search">
  45. <Input
  46. :value="filters.keyword"
  47. placeholder="请输入对方姓名/对方卡号搜索"
  48. allow-clear
  49. @update:value="handleKeywordUpdate"
  50. @pressEnter="handleKeywordEnter"
  51. />
  52. </div>
  53. <div v-if="!hasSearched" class="query-state-panel">
  54. <EmptyState
  55. variant="query"
  56. title="请点击查询"
  57. description="设置条件精细查询,也可点击查询展示所有信息"
  58. min-height="100%"
  59. description-width="min(100%, 420px)"
  60. />
  61. </div>
  62. <div v-else class="table-panel">
  63. <div class="table-wrapper">
  64. <BasicTable
  65. :columns="summaryColumns"
  66. :data-source="summaryData"
  67. :pagination="false"
  68. :show-table-setting="false"
  69. :table-setting="{ setting: true, size: true, redo: false, fullScreen: false }"
  70. :can-resize="true"
  71. :is-can-resize-parent="true"
  72. :resize-height-offset="32"
  73. :rowClassName="summaryRowClassName"
  74. row-key="id"
  75. @row-click="handleSummaryRowClick"
  76. />
  77. </div>
  78. </div>
  79. <div v-if="hasSearched" class="pagination-bar">
  80. <AnalysisPagination
  81. :total="summaryTotal"
  82. :current="summaryPagination.current"
  83. :page-size="summaryPagination.pageSize"
  84. :page-size-options="pageSizeOptions"
  85. :loading="queryLoading"
  86. @change="handleSummaryPaginationChange"
  87. />
  88. </div>
  89. </div>
  90. <div class="panel-right">
  91. <div class="panel-header panel-header--actions">
  92. <div>
  93. <div class="panel-title">敏感交易详情</div>
  94. <div class="panel-desc">
  95. {{
  96. selectedSummaryRow
  97. ? `${selectedSummaryRow.selfName} 与 ${selectedSummaryRow.otherName} 的敏感日期交易明细`
  98. : '请选择左侧汇总数据查看详细交易记录。'
  99. }}
  100. </div>
  101. </div>
  102. </div>
  103. <div class="table-panel">
  104. <div class="table-wrapper table-wrapper--detail">
  105. <div v-if="detailLoading && !festivalData.length" class="panel-empty panel-empty--record">
  106. 敏感交易明细加载中...
  107. </div>
  108. <BasicTable
  109. v-else-if="festivalData.length"
  110. :columns="festivalColumns"
  111. :action-column="detailActionColumn"
  112. :data-source="festivalData"
  113. :pagination="false"
  114. :loading="detailLoading"
  115. :show-table-setting="false"
  116. :table-setting="{ setting: true, size: true, redo: false, fullScreen: false }"
  117. :can-resize="true"
  118. :is-can-resize-parent="true"
  119. :resize-height-offset="32"
  120. row-key="id"
  121. />
  122. <div v-else class="panel-empty panel-empty--state panel-empty--record">
  123. <EmptyState
  124. :title="selectedSummaryRow ? '暂无数据' : '请选择对象'"
  125. :description="
  126. selectedSummaryRow
  127. ? '当前选中对象暂无敏感日期交易记录'
  128. : '左侧选中联系人后,在这里查看敏感日期交易明细'
  129. "
  130. :min-height="240"
  131. />
  132. </div>
  133. </div>
  134. </div>
  135. <div v-if="showDetailPagination" class="pagination-bar">
  136. <AnalysisPagination
  137. :total="detailTotal"
  138. :current="detailPagination.current"
  139. :page-size="detailPagination.pageSize"
  140. :page-size-options="pageSizeOptions"
  141. :loading="detailLoading"
  142. @change="handleDetailPaginationChange"
  143. />
  144. </div>
  145. </div>
  146. </div>
  147. <SpecialDateConfigModal v-model:open="specialDateModalOpen" summary="统一维护敏感日期交易分析使用的特殊日期配置" />
  148. </div>
  149. </template>
  150. <script lang="ts" setup name="ViewsTransSensitiveIndex">
  151. import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
  152. import { Select, Input, DatePicker, Button } from 'ant-design-vue';
  153. import AnalysisPagination from '@jeesite/core/components/AnalysisPagination/src/AnalysisPagination.vue';
  154. import { EmptyState } from '@jeesite/core/components/EmptyState';
  155. import { BasicTable } from '@jeesite/core/components/Table';
  156. import { useAnalysisRefreshPrompt } from '@jeesite/core/hooks/web/useAnalysisRefreshPrompt';
  157. import { useDesign } from '@jeesite/core/hooks/web/useDesign';
  158. import { useTableSkill } from '@jeesite/core/hooks/web/useTableSkill';
  159. import { useMessage } from '@jeesite/core/hooks/web/useMessage';
  160. import { maskCertNo } from '@jeesite/core/utils/sensitive';
  161. import { useTimeSeriesJump } from '@jeesite/otg/hooks/useTimeSeriesJump';
  162. import componentSetting from '@jeesite/core/settings/componentSetting';
  163. import { statFirstTransSensitive, statSecondTransSensitive } from '@jeesite/trans/api/transApi';
  164. import { getPersonOptions } from '@jeesite/person/api/personApi';
  165. import SpecialDateConfigModal from '@jeesite/person/views/components/SpecialDateConfigModal.vue';
  166. import type { TransRecord, TransSensitiveDTO } from '@jeesite/trans/api/types/dto';
  167. import type { TransSensitiveQuery } from '@jeesite/trans/api/types/query';
  168. const { prefixCls } = useDesign('trans-sensitive');
  169. const { queryLoading, runWithQueryLoading } = useTableSkill();
  170. const { createMessage } = useMessage();
  171. const { jumping, jumpToBehaviorSpacetime } = useTimeSeriesJump();
  172. const RangePicker = DatePicker.RangePicker;
  173. const DATE_FORMAT = 'YYYY-MM-DD';
  174. type RangeValue = [string, string] | undefined;
  175. const filters = ref({
  176. target: [] as string[],
  177. dateRange: undefined as RangeValue,
  178. keyword: '',
  179. });
  180. const summaryPagination = ref({
  181. current: 1,
  182. pageSize: componentSetting.table.defaultPageSize,
  183. });
  184. const summaryTotal = ref(0);
  185. const jumpPage = ref('1');
  186. const summaryData = ref<any[]>([]);
  187. const hasSearched = ref(false);
  188. const { syncAnalysisDataRefreshState } = useAnalysisRefreshPrompt({
  189. refresh: () => fetchSummaryTable(),
  190. hasData: () => hasSearched.value && summaryData.value.length > 0,
  191. });
  192. const detailLoading = ref(false);
  193. const detailPagination = ref({
  194. current: 1,
  195. pageSize: componentSetting.table.defaultPageSize,
  196. });
  197. const detailTotal = ref(0);
  198. const detailJumpPage = ref('1');
  199. const selectedSummaryRow = ref<any | null>(null);
  200. const festivalData = ref<any[]>([]);
  201. const summaryKeywordTimer = ref<ReturnType<typeof setTimeout> | null>(null);
  202. const DEFAULT_SUMMARY_SORT_KEY = 'transCount';
  203. const DEFAULT_SUMMARY_SORT_ORDER = 'DESC' as const;
  204. const specialDateModalOpen = ref(false);
  205. const targetOptions = ref<Array<{ label: string; value: string }>>([]);
  206. const normalizeSelectedTargets = (value?: string[] | string | null) => {
  207. if (Array.isArray(value)) {
  208. const list = value.map((item) => String(item).trim()).filter(Boolean);
  209. return list.length ? Array.from(new Set(list)) : [];
  210. }
  211. if (!value) return [];
  212. const list = String(value)
  213. .split(',')
  214. .map((item) => item.trim())
  215. .filter(Boolean);
  216. return list.length ? Array.from(new Set(list)) : [];
  217. };
  218. const pageSizeOptions = componentSetting.table.pageSizeOptions.map((value) => ({
  219. label: value,
  220. value,
  221. }));
  222. const summaryColumns = [
  223. { title: '本方姓名', dataIndex: 'selfName', key: 'selfName', width: 120 },
  224. { title: '对方姓名/卡号', dataIndex: 'otherName', key: 'otherName', width: 200 },
  225. {
  226. title: '联系次数',
  227. dataIndex: 'transCount',
  228. key: 'transCount',
  229. width: 130,
  230. sorter: true,
  231. defaultSortOrder: 'descend',
  232. },
  233. { title: '对方号码', dataIndex: 'otherCard', key: 'otherCard', width: 140 },
  234. ];
  235. const festivalColumns = [
  236. { title: '序号', dataIndex: 'id', key: 'id', width: 80 },
  237. { title: '节日名称', dataIndex: 'festivalName', key: 'festivalName', width: 120 },
  238. { title: '本方卡(账)号', dataIndex: 'selfAccount', key: 'selfAccount', width: 160 },
  239. { title: '对方卡(账)号', dataIndex: 'otherAccount', key: 'otherAccount', width: 160 },
  240. { title: '交易金额', dataIndex: 'amount', key: 'amount', width: 120 },
  241. { title: '交易日期时间', dataIndex: 'transDateTime', key: 'transDateTime', width: 180 },
  242. { title: '借贷标志', dataIndex: 'sign', key: 'sign', width: 100 },
  243. { title: '银行名称', dataIndex: 'bankName', key: 'bankName', width: 160 },
  244. { title: '本方姓名', dataIndex: 'selfName', key: 'selfName', width: 120 },
  245. { title: '本方证件号码', dataIndex: 'selfCertNo', key: 'selfCertNo', width: 180 },
  246. { title: '本方账号', dataIndex: 'selfAccountNo', key: 'selfAccountNo', width: 180 },
  247. { title: '对方名称', dataIndex: 'otherName', key: 'otherName', width: 120 },
  248. { title: '对方证件号码', dataIndex: 'otherCertNo', key: 'otherCertNo', width: 180 },
  249. { title: '对方账号', dataIndex: 'otherAccountNo', key: 'otherAccountNo', width: 180 },
  250. { title: '交易类型', dataIndex: 'transType', key: 'transType', width: 120 },
  251. { title: '交易日期', dataIndex: 'transDate', key: 'transDate', width: 120 },
  252. { title: '交易时间', dataIndex: 'transTime', key: 'transTime', width: 120 },
  253. { title: '币种', dataIndex: 'currency', key: 'currency', width: 90 },
  254. { title: '交易余额', dataIndex: 'transBalance', key: 'transBalance', width: 120 },
  255. { title: '交易流水号', dataIndex: 'transSerialNo', key: 'transSerialNo', width: 180 },
  256. { title: '交易摘要', dataIndex: 'transSummary', key: 'transSummary', width: 180 },
  257. { title: '交易网点', dataIndex: 'branchName', key: 'branchName', width: 180 },
  258. { title: '现金标志', dataIndex: 'cashFlag', key: 'cashFlag', width: 100 },
  259. { title: '交易地点', dataIndex: 'transLocation', key: 'transLocation', width: 180 },
  260. { title: '备注', dataIndex: 'remark', key: 'remark', width: 180 },
  261. ];
  262. const summaryTotalPages = computed(() => {
  263. if (!summaryTotal.value) return 1;
  264. return Math.max(1, Math.ceil(summaryTotal.value / summaryPagination.value.pageSize));
  265. });
  266. const detailTotalPages = computed(() => {
  267. if (!detailTotal.value) return 1;
  268. return Math.max(1, Math.ceil(detailTotal.value / detailPagination.value.pageSize));
  269. });
  270. const showDetailPagination = computed(() => festivalData.value.length > 0);
  271. const normalizeList = (resp: any): any[] => {
  272. if (Array.isArray(resp)) return resp;
  273. if (Array.isArray(resp?.list)) return resp.list;
  274. if (Array.isArray(resp?.data)) return resp.data;
  275. if (Array.isArray(resp?.data?.list)) return resp.data.list;
  276. if (Array.isArray(resp?.records)) return resp.records;
  277. if (Array.isArray(resp?.data?.records)) return resp.data.records;
  278. return [];
  279. };
  280. const normalizeTotal = (resp: any, listLen: number) => {
  281. const t = resp?.total ?? resp?.data?.total ?? resp?.count ?? resp?.data?.count ?? resp?.data?.records?.length;
  282. return Number.isFinite(Number(t)) ? Number(t) : listLen;
  283. };
  284. const normalizeCurrent = (resp: any, fallback: number) => {
  285. const current = resp?.current ?? resp?.data?.current ?? fallback;
  286. return Number.isFinite(Number(current)) && Number(current) > 0 ? Number(current) : fallback;
  287. };
  288. const normalizeSize = (resp: any, fallback: number) => {
  289. const size = resp?.size ?? resp?.data?.size ?? fallback;
  290. return Number.isFinite(Number(size)) && Number(size) > 0 ? Number(size) : fallback;
  291. };
  292. const mapSummaryRow = (item: TransSensitiveDTO, index: number) => ({
  293. id: (summaryPagination.value.current - 1) * summaryPagination.value.pageSize + index + 1,
  294. selfName: item.personName || '-',
  295. otherName: item.otherName || '-',
  296. transCount: item.transCount ?? (item as any).count ?? (item as any).totalCount ?? 0,
  297. otherCard: item.otherCardNo || '-',
  298. raw: item,
  299. });
  300. const sortSummaryList = (list: TransSensitiveDTO[]) =>
  301. [...list].sort((left, right) => {
  302. const leftCount = Number(left.transCount ?? (left as any).count ?? (left as any).totalCount ?? 0) || 0;
  303. const rightCount = Number(right.transCount ?? (right as any).count ?? (right as any).totalCount ?? 0) || 0;
  304. if (rightCount !== leftCount) return rightCount - leftCount;
  305. return String(left.otherName || left.otherCardNo || '').localeCompare(
  306. String(right.otherName || right.otherCardNo || ''),
  307. );
  308. });
  309. const fallbackValue = (value: string | number | null | undefined) => {
  310. if (value === 0) return '0';
  311. if (value === null || value === undefined || value === '') return '-';
  312. return String(value);
  313. };
  314. const clearSummaryKeywordTimer = () => {
  315. if (summaryKeywordTimer.value) {
  316. clearTimeout(summaryKeywordTimer.value);
  317. summaryKeywordTimer.value = null;
  318. }
  319. };
  320. const mapDetailRow = (item: TransRecord, index: number) => ({
  321. id: (detailPagination.value.current - 1) * detailPagination.value.pageSize + index + 1,
  322. festivalName: fallbackValue(item.festivalName),
  323. bankName: fallbackValue(item.bankName),
  324. selfName: item.personName || '-',
  325. selfCertNo: maskCertNo(item.personCertNo),
  326. selfAccountNo: fallbackValue(item.personAccount),
  327. selfAccount: item.personCardNo || item.personAccount || '-',
  328. otherName: item.otherName || '-',
  329. otherCertNo: maskCertNo(item.otherCertNo),
  330. otherAccountNo: fallbackValue(item.otherAccount),
  331. otherAccount: item.otherCardNo || item.otherAccount || '-',
  332. transType: fallbackValue(item.transType),
  333. transDate: item.transDate || '-',
  334. transTime: item.transTime || '-',
  335. transDateTime: fallbackValue(item.transDateTime),
  336. sign: item.debitCreditFlag || '-',
  337. currency: fallbackValue(item.currency),
  338. amount: fallbackValue(item.transAmount),
  339. transBalance: fallbackValue(item.transBalance),
  340. transSerialNo: fallbackValue(item.transSerialNo),
  341. transSummary: item.transSummary || '-',
  342. branchName: fallbackValue(item.branchName),
  343. cashFlag: fallbackValue(item.cashFlag),
  344. transLocation: fallbackValue(item.transLocation),
  345. remark: fallbackValue(item.remark),
  346. raw: item,
  347. });
  348. const normalizeActionRecordId = (value: unknown) => {
  349. const text = String(value ?? '').trim();
  350. if (!text || text === '-' || text === 'null' || text === 'undefined') return undefined;
  351. return text;
  352. };
  353. const buildJumpQuery = (record?: TransRecord) => {
  354. const id = normalizeActionRecordId(record?.id);
  355. return {
  356. hasLocal: 'N',
  357. tableName: 'trans_record',
  358. tableNameEn: 'trans_record',
  359. tableNameCn: '交易记录',
  360. id,
  361. personName: record?.personName || undefined,
  362. personNames: record?.personName ? [record.personName] : undefined,
  363. };
  364. };
  365. const handleJump = async (record?: TransRecord) => {
  366. await jumpToBehaviorSpacetime(buildJumpQuery(record));
  367. };
  368. const detailActionColumn = computed(() => ({
  369. title: '操作',
  370. dataIndex: 'action',
  371. key: 'action',
  372. width: 90,
  373. fixed: 'right',
  374. align: 'center',
  375. actions: (record: { raw?: TransRecord }) => {
  376. const rawRecord = record.raw;
  377. const query = buildJumpQuery(rawRecord);
  378. return [
  379. {
  380. label: '跳转',
  381. disabled: jumping.value || !query.id,
  382. onClick: () => void handleJump(rawRecord),
  383. },
  384. ];
  385. },
  386. }));
  387. const buildFirstQuery = (): TransSensitiveQuery => {
  388. const range = filters.value.dateRange as RangeValue;
  389. const keyword = filters.value.keyword?.trim() || '';
  390. return {
  391. page: summaryPagination.value.current,
  392. limit: summaryPagination.value.pageSize,
  393. startDate: range?.[0] || undefined,
  394. endDate: range?.[1] || undefined,
  395. personNames: (() => {
  396. const personNames = normalizeSelectedTargets(filters.value.target);
  397. return personNames.length ? personNames : undefined;
  398. })(),
  399. keyword,
  400. orderKey: DEFAULT_SUMMARY_SORT_KEY,
  401. sort: DEFAULT_SUMMARY_SORT_ORDER,
  402. };
  403. };
  404. const fetchSummaryTable = async () => {
  405. await runWithQueryLoading(async () => {
  406. const resp = await statFirstTransSensitive(buildFirstQuery());
  407. const list = sortSummaryList(normalizeList(resp));
  408. summaryData.value = list.map(mapSummaryRow);
  409. summaryTotal.value = normalizeTotal(resp, list.length);
  410. hasSearched.value = true;
  411. syncAnalysisDataRefreshState(list.length > 0);
  412. const current = Number((resp as any)?.data?.current || summaryPagination.value.current);
  413. const size = Number((resp as any)?.data?.size || summaryPagination.value.pageSize);
  414. if (Number.isFinite(current) && current > 0) summaryPagination.value.current = current;
  415. if (Number.isFinite(size) && size > 0) summaryPagination.value.pageSize = size;
  416. jumpPage.value = String(summaryPagination.value.current);
  417. });
  418. };
  419. const fetchDetailTable = async (row?: any) => {
  420. const current = row || selectedSummaryRow.value;
  421. if (!current) {
  422. festivalData.value = [];
  423. detailTotal.value = 0;
  424. detailJumpPage.value = '1';
  425. return;
  426. }
  427. selectedSummaryRow.value = current;
  428. detailLoading.value = true;
  429. try {
  430. const range = filters.value.dateRange as RangeValue;
  431. const selectedTarget = normalizeSelectedTargets(filters.value.target)[0];
  432. const rowPersonName = current.raw?.personName;
  433. const resp = await statSecondTransSensitive({
  434. page: detailPagination.value.current,
  435. limit: detailPagination.value.pageSize,
  436. startDate: range?.[0] || undefined,
  437. endDate: range?.[1] || undefined,
  438. personName: rowPersonName || selectedTarget,
  439. otherCardNo: current.raw?.otherCardNo || undefined,
  440. otherName: current.raw?.otherName || undefined,
  441. });
  442. const records = normalizeList(resp) as TransRecord[];
  443. festivalData.value = records.map(mapDetailRow);
  444. detailTotal.value = normalizeTotal(resp, records.length);
  445. detailPagination.value.current = normalizeCurrent(resp, detailPagination.value.current);
  446. detailPagination.value.pageSize = normalizeSize(resp, detailPagination.value.pageSize);
  447. detailJumpPage.value = String(detailPagination.value.current);
  448. } catch (error) {
  449. festivalData.value = [];
  450. detailTotal.value = 0;
  451. createMessage.warning('敏感交易第二层接口调用失败');
  452. } finally {
  453. detailLoading.value = false;
  454. }
  455. };
  456. const resetDetailPagination = () => {
  457. detailPagination.value.current = 1;
  458. detailJumpPage.value = '1';
  459. };
  460. const refreshRightByFirstRow = async () => {
  461. resetDetailPagination();
  462. if (summaryData.value.length) {
  463. await fetchDetailTable(summaryData.value[0]);
  464. } else {
  465. festivalData.value = [];
  466. detailTotal.value = 0;
  467. selectedSummaryRow.value = null;
  468. }
  469. };
  470. const handleSearch = async () => {
  471. clearSummaryKeywordTimer();
  472. summaryPagination.value.current = 1;
  473. await fetchSummaryTable();
  474. await refreshRightByFirstRow();
  475. };
  476. const handleReset = async () => {
  477. clearSummaryKeywordTimer();
  478. filters.value = {
  479. target: [],
  480. dateRange: undefined,
  481. keyword: '',
  482. };
  483. summaryPagination.value.current = 1;
  484. await fetchSummaryTable();
  485. await refreshRightByFirstRow();
  486. };
  487. const handleOpenSpecialDateModal = () => {
  488. specialDateModalOpen.value = true;
  489. };
  490. const handlePrevPage = async () => {
  491. if (queryLoading.value || summaryPagination.value.current <= 1) return;
  492. summaryPagination.value.current -= 1;
  493. await fetchSummaryTable();
  494. await refreshRightByFirstRow();
  495. };
  496. const handleNextPage = async () => {
  497. if (queryLoading.value || summaryPagination.value.current >= summaryTotalPages.value) return;
  498. summaryPagination.value.current += 1;
  499. await fetchSummaryTable();
  500. await refreshRightByFirstRow();
  501. };
  502. const handleSummaryPaginationChange = async (page: number, pageSize: number) => {
  503. if (queryLoading.value) return;
  504. if (pageSize !== summaryPagination.value.pageSize) {
  505. summaryPagination.value.pageSize = pageSize;
  506. await handlePageSizeChange();
  507. return;
  508. }
  509. if (page === summaryPagination.value.current - 1) {
  510. await handlePrevPage();
  511. return;
  512. }
  513. if (page === summaryPagination.value.current + 1) {
  514. await handleNextPage();
  515. return;
  516. }
  517. if (page === summaryPagination.value.current) return;
  518. jumpPage.value = String(page);
  519. await handleJumpPage();
  520. };
  521. const handlePageSizeChange = async () => {
  522. summaryPagination.value.current = 1;
  523. await fetchSummaryTable();
  524. await refreshRightByFirstRow();
  525. };
  526. const handleJumpPage = async () => {
  527. const next = Number(jumpPage.value);
  528. if (!Number.isInteger(next) || next < 1) {
  529. createMessage.warning('请输入正确页码');
  530. jumpPage.value = String(summaryPagination.value.current);
  531. return;
  532. }
  533. summaryPagination.value.current = Math.min(next, summaryTotalPages.value);
  534. await fetchSummaryTable();
  535. await refreshRightByFirstRow();
  536. };
  537. const triggerKeywordSearch = async () => {
  538. if (!hasSearched.value) return;
  539. clearSummaryKeywordTimer();
  540. summaryPagination.value.current = 1;
  541. await fetchSummaryTable();
  542. await refreshRightByFirstRow();
  543. };
  544. const handleKeywordUpdate = (value: string) => {
  545. filters.value.keyword = value;
  546. clearSummaryKeywordTimer();
  547. if (!hasSearched.value) return;
  548. summaryKeywordTimer.value = setTimeout(() => {
  549. void triggerKeywordSearch();
  550. }, 300);
  551. };
  552. const handleKeywordEnter = async () => {
  553. if (!hasSearched.value) return;
  554. await triggerKeywordSearch();
  555. };
  556. const handleSummaryRowClick = async (record: any) => {
  557. resetDetailPagination();
  558. await fetchDetailTable(record);
  559. };
  560. const handleDetailPrevPage = async () => {
  561. if (detailLoading.value || detailPagination.value.current <= 1) return;
  562. detailPagination.value.current -= 1;
  563. await fetchDetailTable();
  564. };
  565. const handleDetailNextPage = async () => {
  566. if (detailLoading.value || detailPagination.value.current >= detailTotalPages.value) return;
  567. detailPagination.value.current += 1;
  568. await fetchDetailTable();
  569. };
  570. const handleDetailPaginationChange = async (page: number, pageSize: number) => {
  571. if (detailLoading.value) return;
  572. if (pageSize !== detailPagination.value.pageSize) {
  573. detailPagination.value.pageSize = pageSize;
  574. await handleDetailPageSizeChange();
  575. return;
  576. }
  577. if (page === detailPagination.value.current - 1) {
  578. await handleDetailPrevPage();
  579. return;
  580. }
  581. if (page === detailPagination.value.current + 1) {
  582. await handleDetailNextPage();
  583. return;
  584. }
  585. if (page === detailPagination.value.current) return;
  586. detailJumpPage.value = String(page);
  587. await handleDetailJumpPage();
  588. };
  589. const handleDetailPageSizeChange = async () => {
  590. detailPagination.value.current = 1;
  591. await fetchDetailTable();
  592. };
  593. const handleDetailJumpPage = async () => {
  594. const next = Number(detailJumpPage.value);
  595. if (!Number.isInteger(next) || next < 1) {
  596. createMessage.warning('请输入正确页码');
  597. detailJumpPage.value = String(detailPagination.value.current);
  598. return;
  599. }
  600. detailPagination.value.current = Math.min(next, detailTotalPages.value);
  601. await fetchDetailTable();
  602. };
  603. const summaryRowClassName = (record: any) => {
  604. return selectedSummaryRow.value && selectedSummaryRow.value.id === record.id ? 'summary-row-selected' : '';
  605. };
  606. const fetchTargetOptions = async () => {
  607. try {
  608. targetOptions.value = await getPersonOptions(false);
  609. } catch (error) {
  610. targetOptions.value = [];
  611. }
  612. };
  613. onMounted(async () => {
  614. await fetchTargetOptions();
  615. });
  616. onBeforeUnmount(() => {
  617. clearSummaryKeywordTimer();
  618. });
  619. </script>
  620. <style lang="less">
  621. @import '../styles/trans-analysis-table-ui.less';
  622. @prefix-cls: ~'jeesite-trans-sensitive';
  623. .@{prefix-cls}.trans-sensitive-page {
  624. .analysis-page-frame();
  625. .filter-input {
  626. width: 180px;
  627. }
  628. .filter-date {
  629. width: 360px;
  630. }
  631. .content-panel {
  632. display: flex;
  633. gap: 2px;
  634. }
  635. .panel-left {
  636. flex: 0 0 46%;
  637. max-width: 46%;
  638. min-width: 0;
  639. .analysis-card-shell();
  640. }
  641. .panel-right {
  642. flex: 1;
  643. min-width: 0;
  644. .analysis-card-shell();
  645. }
  646. .panel-header--actions {
  647. align-items: center;
  648. }
  649. .query-state-panel {
  650. flex: 1 1 auto;
  651. min-height: 0;
  652. display: flex;
  653. align-items: center;
  654. justify-content: center;
  655. padding: 12px 0 0;
  656. }
  657. .table-panel,
  658. .table-wrapper {
  659. min-width: 0;
  660. }
  661. .table-wrapper {
  662. flex: 1 1 auto;
  663. min-height: 0;
  664. }
  665. .table-wrapper .jeesite-basic-table {
  666. height: 100%;
  667. display: flex;
  668. flex-direction: column;
  669. min-height: 0;
  670. }
  671. .table-wrapper .ant-table-wrapper {
  672. height: 100%;
  673. min-height: 0;
  674. }
  675. .table-wrapper .ant-table-content,
  676. .table-wrapper .ant-table-scroll {
  677. width: 100%;
  678. min-height: 0;
  679. }
  680. .table-wrapper .ant-spin-nested-loading,
  681. .table-wrapper .ant-spin-container {
  682. height: 100%;
  683. min-height: 0;
  684. }
  685. .table-wrapper .ant-spin-container,
  686. .table-wrapper .ant-table,
  687. .table-wrapper .ant-table-container {
  688. height: 100%;
  689. min-height: 0;
  690. display: flex;
  691. flex-direction: column;
  692. }
  693. .table-wrapper .ant-table-body {
  694. flex: 1 1 auto;
  695. min-height: 0;
  696. max-height: 100% !important;
  697. overflow: auto !important;
  698. }
  699. .table-wrapper .ant-table-body::-webkit-scrollbar {
  700. width: 8px;
  701. height: 8px;
  702. }
  703. .table-wrapper .ant-table-body::-webkit-scrollbar-thumb {
  704. background: rgb(148 163 184 / 60%);
  705. border-radius: 999px;
  706. }
  707. .table-wrapper .ant-table-body::-webkit-scrollbar-track {
  708. background: transparent;
  709. }
  710. .table-wrapper .ant-table-thead > tr > th {
  711. background: #f8fafc;
  712. font-weight: 600;
  713. color: #374151;
  714. }
  715. .table-wrapper .ant-table-tbody > tr > td {
  716. color: #374151;
  717. }
  718. .table-wrapper
  719. .jeesite-basic-table
  720. .ant-table-tbody
  721. > tr.jeesite-basic-table-row__striped
  722. > td.ant-table-column-sort,
  723. .table-wrapper
  724. .jeesite-basic-table
  725. .ant-table-tbody
  726. > tr.jeesite-basic-table-row__striped
  727. > td.ant-table-cell-fix-left.ant-table-column-sort,
  728. .table-wrapper
  729. .jeesite-basic-table
  730. .ant-table-tbody
  731. > tr.jeesite-basic-table-row__striped
  732. > td.ant-table-cell-fix-right.ant-table-column-sort {
  733. background: #fafafa !important;
  734. }
  735. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr.summary-row-selected > td,
  736. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr.jeesite-basic-table-row__selected > td,
  737. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr.summary-row-selected > td.ant-table-cell-row-hover,
  738. .table-wrapper
  739. .jeesite-basic-table
  740. .ant-table-tbody
  741. > tr.jeesite-basic-table-row__selected
  742. > td.ant-table-cell-row-hover {
  743. background: #e8f1ff !important;
  744. }
  745. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr.summary-row-selected > td.ant-table-column-sort,
  746. .table-wrapper
  747. .jeesite-basic-table
  748. .ant-table-tbody
  749. > tr.summary-row-selected
  750. > td.ant-table-cell-row-hover.ant-table-column-sort,
  751. .table-wrapper
  752. .jeesite-basic-table
  753. .ant-table-tbody
  754. > tr.summary-row-selected
  755. > td.ant-table-cell-fix-left.ant-table-column-sort,
  756. .table-wrapper
  757. .jeesite-basic-table
  758. .ant-table-tbody
  759. > tr.summary-row-selected
  760. > td.ant-table-cell-fix-right.ant-table-column-sort,
  761. .table-wrapper
  762. .jeesite-basic-table
  763. .ant-table-tbody
  764. > tr.jeesite-basic-table-row__selected
  765. > td.ant-table-column-sort,
  766. .table-wrapper
  767. .jeesite-basic-table
  768. .ant-table-tbody
  769. > tr.jeesite-basic-table-row__selected
  770. > td.ant-table-cell-row-hover.ant-table-column-sort,
  771. .table-wrapper
  772. .jeesite-basic-table
  773. .ant-table-tbody
  774. > tr.jeesite-basic-table-row__selected
  775. > td.ant-table-cell-fix-left.ant-table-column-sort,
  776. .table-wrapper
  777. .jeesite-basic-table
  778. .ant-table-tbody
  779. > tr.jeesite-basic-table-row__selected
  780. > td.ant-table-cell-fix-right.ant-table-column-sort {
  781. background: #e8f1ff !important;
  782. }
  783. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr:hover > td,
  784. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr:hover > td.ant-table-cell-row-hover {
  785. background: #f5f7ff !important;
  786. }
  787. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr:hover > td.ant-table-column-sort,
  788. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr:hover > td.ant-table-cell-row-hover.ant-table-column-sort,
  789. .table-wrapper .jeesite-basic-table .ant-table-tbody > tr:hover > td.ant-table-cell-fix-left.ant-table-column-sort,
  790. .table-wrapper
  791. .jeesite-basic-table
  792. .ant-table-tbody
  793. > tr:hover
  794. > td.ant-table-cell-fix-right.ant-table-column-sort {
  795. background: #f5f7ff !important;
  796. }
  797. .pagination-input {
  798. width: 48px;
  799. }
  800. .panel-empty {
  801. flex: 1 1 auto;
  802. min-height: 0;
  803. display: flex;
  804. align-items: center;
  805. justify-content: center;
  806. color: #6b7280;
  807. font-size: 13px;
  808. text-align: center;
  809. }
  810. .panel-empty--record {
  811. width: 100%;
  812. }
  813. @media screen and (max-width: 900px) {
  814. .content-panel {
  815. flex-direction: column;
  816. }
  817. .panel-left {
  818. flex-basis: auto;
  819. max-width: none;
  820. }
  821. }
  822. @media screen and (max-width: 992px) {
  823. .filter-actions {
  824. width: 100%;
  825. margin-left: 0;
  826. }
  827. .filter-input,
  828. .filter-date {
  829. width: 100%;
  830. }
  831. .pagination-bar {
  832. justify-content: flex-start;
  833. }
  834. }
  835. }
  836. </style>