diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index c06f70f..2c57368 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -199,6 +199,7 @@ export const generatedRoutes: GeneratedRoute[] = [ component: 'view.my_highriskdetail', meta: { title: '高风险场景详情', + constant: true, hideInMenu: true, i18nKey: 'route.my_highriskdetail' } @@ -310,6 +311,7 @@ export const generatedRoutes: GeneratedRoute[] = [ meta: { title: '修改密码', i18nKey: 'route.systemmanage_changepassword', + constant: true, order: 5 } }, diff --git a/src/service/api/pending.ts b/src/service/api/pending.ts new file mode 100644 index 0000000..d83f6cc --- /dev/null +++ b/src/service/api/pending.ts @@ -0,0 +1,11 @@ +import { request } from '../request'; + +/** 获取列表 + * + */ +export function pendingListApi() { + return request({ + url: `/api/my-tasks`, + method: 'get', + }); +} \ No newline at end of file diff --git a/src/utils/common.ts b/src/utils/common.ts index 1c0d05b..ff9ce11 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -97,6 +97,66 @@ export function formatTimestamp(timestamp: number | string | Date | null,format: return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; } +/** + * 任意时间格式 → 时间戳(支持 只有小时) + * @param {string|number|Date} input + * @param {'ms'|'s'} unit 默认毫秒 + */ +export function anyToTimestamp(input: string | number | Date | null | undefined, unit = 'ms') { + if (input == null || input === '') return null; + + const toResult = (ms: number) => + Number.isNaN(ms) ? null : unit === 's' ? Math.floor(ms / 1000) : ms; + + // 1. 数字 + if (typeof input === 'number') return toResult(input); + + // 2. Date + if (input instanceof Date) return toResult(input.getTime()); + + let str = String(input).trim(); + + // 3. 纯数字字符串 + if (/^\d+$/.test(str)) return toResult(Number(str)); + + // 4. 统一分隔符 + str = str + .replace(/[年月]/g, '-') + .replace(/[日号]/g, '') + .replace(/[时分]/g, ':') + .replace(/秒/g, '') + .replace(/[./]/g, '-') + .replace(/\s+/g, ' ') + .trim(); + + // 5. 手动解析:小时、分钟、秒、毫秒全部可选 + const m = str.match( + /^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T](\d{1,2}))?(?::(\d{1,2}))?(?::(\d{1,2}))?(?:\.(\d{1,3}))?/ + ); + if (m) { + const [, y, mo, d, h = '0', mi = '0', s = '0', ms = '0'] = m; + const t = new Date( + +y, + +mo - 1, + +d, + +h, + +mi, + +s, + +ms.padEnd(3, '0') + ).getTime(); + if (!Number.isNaN(t)) return toResult(t); + } + + // 6. 兜底 + let t = new Date(str.replace(' ', 'T')).getTime(); + if (!Number.isNaN(t)) return toResult(t); + + t = Date.parse(str); + if (!Number.isNaN(t)) return toResult(t); + + return null; +}; + // 辅助函数:Fisher-Yates 洗牌算法 function shuffle(arr:any) { for (let i = arr.length - 1; i > 0; i--) { diff --git a/src/views/my/initiateChange/index.vue b/src/views/my/initiateChange/index.vue index 0a98135..50f8a9c 100644 --- a/src/views/my/initiateChange/index.vue +++ b/src/views/my/initiateChange/index.vue @@ -10,7 +10,7 @@ import { useChangeStore } from '@/store/modules/change'; import { queryUnsavedApi, saveChangeApi, submitChangeApi, getChangeDetailApi } from '@/service/api/change'; import { systemConfigApi, templateListApi, } from '@/service/api/system'; import { orgListApi } from '@/service/api/user'; -import { formatTimestamp } from "@/utils/common"; +import { formatTimestamp, anyToTimestamp } from "@/utils/common"; import ChangePre from "./modules/changePre.vue"; import ChangeApply from "./modules/changeApply.vue"; import ChangeTraining from "./modules/changeTraining.vue"; @@ -230,7 +230,7 @@ const submitConfirm = async (type: string) => { // 变更申请表 if(type==='form'){ - if(changeApplyRules(form)){ + if(changeApplyRules(form?.apply_form)){ return; } } @@ -254,6 +254,11 @@ const getChangeDetail = async () => { changeNo.value = data.change_no; changePreForm.value = data.precheck; changeApplyForm.value = data.apply_form; + + // 解析时间戳 + changeApplyForm.value.plan_use_date = anyToTimestamp(changeApplyForm.value.plan_use_date); + changeApplyForm.value.restore_deadline = anyToTimestamp(changeApplyForm.value.restore_deadline); + riskAnalysisForm.value = data.risk_records; changeTrainingForm.value = data.train; pssrForm.value = data.pssr; diff --git a/src/views/my/initiateChange/modules/ChangeCompareTable.vue b/src/views/my/initiateChange/modules/ChangeCompareTable.vue index 2333256..5a1b48d 100644 --- a/src/views/my/initiateChange/modules/ChangeCompareTable.vue +++ b/src/views/my/initiateChange/modules/ChangeCompareTable.vue @@ -1,16 +1,18 @@ - + + + + + {{data.length ? `变更识别结果(${data.length}项)` : '变更识别结果(空表 · 可手动录入,或由 AI 识别生成)'}} + + + >(() => { +