From 05b7357ca6b62c8f94affb0dec12793cce0e437a Mon Sep 17 00:00:00 2001 From: bestlee Date: Sun, 20 Sep 2026 14:49:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E9=A3=8E=E9=99=A9=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/api/highRisk.ts | 11 + src/utils/common.ts | 37 ++ src/views/changeLedger/modules/list.vue | 69 ++- src/views/my/highRisk/index.vue | 488 ++------------------- src/views/my/highRisk/modules/history.vue | 146 ++++++ src/views/my/highRisk/modules/risk.vue | 387 ++++++++++++++++ src/views/my/highRisk/modules/template.vue | 312 +++++++++++++ 7 files changed, 973 insertions(+), 477 deletions(-) create mode 100644 src/service/api/highRisk.ts create mode 100644 src/views/my/highRisk/modules/history.vue create mode 100644 src/views/my/highRisk/modules/risk.vue create mode 100644 src/views/my/highRisk/modules/template.vue diff --git a/src/service/api/highRisk.ts b/src/service/api/highRisk.ts new file mode 100644 index 0000000..39339bf --- /dev/null +++ b/src/service/api/highRisk.ts @@ -0,0 +1,11 @@ +import { request } from '../request'; + +// 列表查询 +export function highRiskListApi(params:any) { + return request({ + url: `/api/risk-records/high`, + method: 'get', + params, + }); +} + diff --git a/src/utils/common.ts b/src/utils/common.ts index ff9ce11..212a17b 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -197,6 +197,43 @@ export function generateSecurePassword(passwordLength:number) { // 打乱字符顺序 return shuffle(password.split('')).join(''); } + +// 根据当前时间,获取指定的时间范围(返回时间戳) +export function getTimeRangeStamp(timeRange: string){ + const endTime = anyToTimestamp(new Date()); + if(!endTime) { + return null; + } + // 近一个月 + if(timeRange === 'month'){ + return { + from: endTime - (30 * 24 * 60 * 60 * 1000), + to: endTime + } + } + // 近三个月 + if(timeRange === 'quarter'){ + return { + from: endTime - (90 * 24 * 60 * 60 * 1000), + to: endTime + } + } + // 近半年 + if(timeRange === 'half_year'){ + return { + from: endTime - (180 * 24 * 60 * 60 * 1000), + to: endTime + } + } + // 近一年 + if(timeRange === 'year'){ + return { + from: endTime - (365 * 24 * 60 * 60 * 1000), + to: endTime + } + } +} + // 获取 token export const getToken = () => { return localStorage.getItem('token'); diff --git a/src/views/changeLedger/modules/list.vue b/src/views/changeLedger/modules/list.vue index c2699f3..3568561 100644 --- a/src/views/changeLedger/modules/list.vue +++ b/src/views/changeLedger/modules/list.vue @@ -3,7 +3,7 @@ import { ref, computed, onMounted, h } from 'vue'; import { Icon } from '@iconify/vue' import { useThemeStore } from '@/store/modules/theme'; import { useRouterPush } from '@/hooks/common/router'; -import { tagTextColor, tagBgColor, tagBorderColor } from '@/utils/common'; +import { tagTextColor, tagBgColor, tagBorderColor, getTimeRangeStamp, formatTimestamp } from '@/utils/common'; import { systemConfigApi } from '@/service/api/system'; import { orgListApi } from '@/service/api/user'; import { changeLedgerListApi } from '@/service/api/changeLedger'; @@ -13,6 +13,8 @@ const themeStore = useThemeStore(); const props = defineProps(['self', 'keyValue']) const loading = ref(false); +// 当前选中时间范围 +const period = ref("year"); // 组织树 const orgTree = ref([]); // 筛选条件 @@ -23,8 +25,8 @@ const formInfo = ref({ duration: null, status: '',//英文逗号隔开 org_id: 1, - apply_time_start: null, - apply_time_end: null, + apply_time_start: getTimeRangeStamp(period.value)?.from ?? null, + apply_time_end: getTimeRangeStamp(period.value)?.to ?? null, self: props.self, }); const pagination = ref<{page: number, pageSize: number, itemCount: number}>({ @@ -70,8 +72,6 @@ const TIME_OPTIONS = [ { label: "近一个月", value: 'month' }, { label: "自定义", value: 'custom' }, ]; -// 当前选中时间范围 -const period = ref("year"); // 是否显示全部 const isAll = ref(true); // 当前选中行 @@ -86,18 +86,6 @@ const revokeSaving = ref(false); // 列表 const list = ref([]); -// 重置 -const reset = () => { - formInfo.value.kw = ''; - formInfo.value.type = null; - formInfo.value.level = null; - formInfo.value.duration = null; - formInfo.value.status = ''; - formInfo.value.sort = ''; - period.value = 'year'; - isAll.value = true; - window.$message?.success("筛选条件已重置"); -}; // 导出台账 const exportChanges = () => { window.$message?.info('还差接口'); @@ -127,6 +115,21 @@ const searchHandle = () => { pagination.value.page = 1; getList(); } +// 重置 +const reset = () => { + period.value = 'year'; + formInfo.value.kw = ''; + formInfo.value.type = null; + formInfo.value.level = null; + formInfo.value.duration = null; + formInfo.value.status = ''; + formInfo.value.org_id = 1; + formInfo.value.sort = ''; + formInfo.value.apply_time_start = getTimeRangeStamp(period.value)?.from ?? null; + formInfo.value.apply_time_end = getTimeRangeStamp(period.value)?.to ?? null; + isAll.value = true; + searchHandle(); +}; // 组织选择改变 const orgChange = (val:any) => { formInfo.value.org_id = val; @@ -155,8 +158,30 @@ const durChoose = (val:any) => { // 时间范围选择 const timeChoose = (val:string) => { period.value = val; + if(val === 'custom'){ + formInfo.value.apply_time_start = null; + formInfo.value.apply_time_end = null; + return + }else{ + formInfo.value.apply_time_start = getTimeRangeStamp(val)?.from ?? null; + formInfo.value.apply_time_end = getTimeRangeStamp(val)?.to ?? null; + } searchHandle(); } +// 自定义时间选择 +const timeChange = (type:string,val:any) => { + if(type === 'start'){ + formInfo.value.apply_time_start = val; + }else{ + formInfo.value.apply_time_end = val; + } + if(formInfo.value.apply_time_start && formInfo.value.apply_time_end){ + if(formInfo.value.apply_time_start > formInfo.value.apply_time_end){ + return window.$message?.warning('开始时间不能大于结束时间'); + } + searchHandle(); + } +} // 状态选择 const statusChoose = (val:string) => { formInfo.value.status = val; @@ -231,8 +256,8 @@ const getList = async () => { duration: formInfo.value.duration, status: formInfo.value.status, org_id: formInfo.value.org_id, - apply_time_start: formInfo.value.apply_time_start, - apply_time_end: formInfo.value.apply_time_end, + apply_time_start: formatTimestamp(formInfo.value.apply_time_start), + apply_time_end: formatTimestamp(formInfo.value.apply_time_end), self: formInfo.value.self, page_num: pagination.value.page, page_size: pagination.value.pageSize, @@ -324,7 +349,7 @@ onMounted(async () => { 显示未关闭
- + @@ -355,9 +380,9 @@ onMounted(async () => { 时间 {{ p.label }} - + - +

diff --git a/src/views/my/highRisk/index.vue b/src/views/my/highRisk/index.vue index c01598c..ead280e 100644 --- a/src/views/my/highRisk/index.vue +++ b/src/views/my/highRisk/index.vue @@ -1,476 +1,54 @@ +