From 600fe725775e28af1f86f7f7f1e2521f494252b1 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 01 九月 2026 15:27:26 +0800
Subject: [PATCH] feat(mes): 新增管理驾驶舱页面
---
src/views/mes/trace/integrity/index.vue | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 229 insertions(+), 0 deletions(-)
diff --git a/src/views/mes/trace/integrity/index.vue b/src/views/mes/trace/integrity/index.vue
new file mode 100644
index 0000000..a21c28f
--- /dev/null
+++ b/src/views/mes/trace/integrity/index.vue
@@ -0,0 +1,229 @@
+<script lang="ts" setup>
+ import type { VxeTableGridOptions } from '#/adapter/vxe-table';
+ import type { MesTraceIntegrityApi } from '#/api/mes/trace/integrity';
+
+ import { gsap } from 'gsap';
+
+ import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
+
+ import { Page } from '@vben/common-ui';
+ import { IconifyIcon } from '@vben/icons';
+
+ import {
+ Button,
+ Card,
+ InputNumber,
+ message,
+ Select,
+ Tag,
+ } from 'ant-design-vue';
+
+ import { useVbenVxeGrid } from '#/adapter/vxe-table';
+ import {
+ getTraceIntegrityPage,
+ verifyTraceIntegrity,
+ } from '#/api/mes/trace/integrity';
+
+ import { BIZ_TYPE_OPTIONS, getBizTypeLabel, useGridColumns, useGridFormSchema } from './data';
+
+ defineOptions({ name: 'MesTraceIntegrity' });
+
+ /** 鏍¢獙杈撳叆 */
+ const verifyBizType = ref('BATCH');
+ const verifyBizId = ref<number>();
+ const verifyLoading = ref(false);
+
+ /** 鏍¢獙缁撴灉 */
+ const verifyResult = ref<MesTraceIntegrityApi.VerifyResult>();
+
+ /** GSAP 鍏ュ満鍔ㄧ敾涓婁笅鏂囷紙鍗歌浇鏃惰嚜鍔ㄨ繕鍘燂級 */
+ let animationContext: gsap.Context | undefined;
+ let resultTween: gsap.core.Tween | undefined;
+
+ /** 鎵ц鏍¢獙 */
+ async function handleVerify() {
+ if (!verifyBizId.value) {
+ message.warning('璇疯緭鍏ヤ笟鍔¤褰曠紪鍙�');
+ return;
+ }
+ if (verifyLoading.value) return;
+ verifyLoading.value = true;
+ try {
+ verifyResult.value = await verifyTraceIntegrity(
+ verifyBizType.value,
+ verifyBizId.value,
+ );
+ } catch {
+ message.error('鏍¢獙澶辫触锛岃绋嶅悗閲嶈瘯');
+ } finally {
+ verifyLoading.value = false;
+ }
+ }
+
+ onMounted(async () => {
+ await nextTick();
+ animationContext = gsap.context(() => {
+ const reduceMotion = window.matchMedia(
+ '(prefers-reduced-motion: reduce)',
+ ).matches;
+ gsap.from('.mes-it-verify, .mes-it-grid', {
+ autoAlpha: reduceMotion ? 1 : 0,
+ y: reduceMotion ? 0 : 14,
+ duration: reduceMotion ? 0 : 0.45,
+ stagger: reduceMotion ? 0 : 0.08,
+ ease: 'power2.out',
+ });
+ });
+ });
+
+ onUnmounted(() => {
+ resultTween?.kill();
+ animationContext?.revert();
+ });
+
+ /** 鏍¢獙缁撴灉鍗$墖鍑虹幇鏃剁殑杞婚噺鍏ュ満 */
+ watch(verifyResult, async (result) => {
+ if (!result) return;
+ await nextTick();
+ resultTween?.kill();
+ resultTween = gsap.from('.mes-it-result', {
+ autoAlpha: 0,
+ y: 8,
+ duration: 0.35,
+ ease: 'power2.out',
+ });
+ });
+
+ const [Grid, gridApi] = useVbenVxeGrid({
+ formOptions: {
+ schema: useGridFormSchema(),
+ },
+ gridOptions: {
+ columns: useGridColumns(),
+ height: 'auto',
+ keepSource: true,
+ proxyConfig: {
+ ajax: {
+ query: async ({ page }, formValues) => {
+ return await getTraceIntegrityPage({
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ ...formValues,
+ });
+ },
+ },
+ },
+ rowConfig: {
+ keyField: 'id',
+ isHover: true,
+ },
+ toolbarConfig: {
+ refresh: true,
+ search: true,
+ },
+ } as VxeTableGridOptions<MesTraceIntegrityApi.Record>,
+ });
+</script>
+
+<template>
+ <Page auto-content-height>
+ <Card title="鏁版嵁瀹屾暣鎬ф牎楠�" class="mes-it-verify mb-4">
+ <div class="flex flex-wrap items-center gap-3">
+ <span class="text-muted-foreground text-sm">涓氬姟绫诲瀷</span>
+ <Select
+ v-model:value="verifyBizType"
+ :options="BIZ_TYPE_OPTIONS"
+ class="w-40"
+ placeholder="璇烽�夋嫨涓氬姟绫诲瀷"
+ />
+ <span class="text-muted-foreground text-sm">涓氬姟缂栧彿</span>
+ <InputNumber
+ v-model:value="verifyBizId"
+ class="w-48"
+ :min="1"
+ :precision="0"
+ placeholder="璇疯緭鍏ヤ笟鍔¤褰曠紪鍙�"
+ @press-enter="handleVerify"
+ />
+ <Button
+ v-access:code="['mes:trace-integrity:verify']"
+ type="primary"
+ :loading="verifyLoading"
+ @click="handleVerify"
+ >
+ 鍙戣捣鏍¢獙
+ </Button>
+ </div>
+
+ <div
+ v-if="verifyResult"
+ class="mes-it-result mt-4 rounded-lg border border-dashed p-4"
+ :class="
+ verifyResult.matched
+ ? 'border-[#67c23a] bg-[#67c23a]/5'
+ : 'border-[#f56c6c] bg-[#f56c6c]/5'
+ "
+ >
+ <div class="flex items-center gap-2">
+ <IconifyIcon
+ class="size-6"
+ :class="
+ verifyResult.matched ? 'text-[#67c23a]' : 'text-[#f56c6c]'
+ "
+ :icon="
+ verifyResult.matched ? 'lucide:circle-check' : 'lucide:circle-x'
+ "
+ />
+ <span class="text-base font-bold">
+ {{ verifyResult.matched ? '鏍¢獙閫氳繃' : '鏍¢獙涓嶉�氳繃' }}
+ </span>
+ <span class="text-muted-foreground ml-2 text-sm">
+ {{ verifyResult.message }}
+ </span>
+ </div>
+ <div class="mt-3 grid gap-3 text-sm md:grid-cols-2">
+ <div class="min-w-0">
+ <div class="text-muted-foreground mb-1">涓氬姟淇℃伅</div>
+ <div class="break-all">
+ {{ getBizTypeLabel(verifyResult.bizType) }}
+ <span class="text-muted-foreground">#{{ verifyResult.bizId }}</span>
+ <Tag v-if="verifyResult.bizCode" class="ml-1">
+ {{ verifyResult.bizCode }}
+ </Tag>
+ </div>
+ </div>
+ <div class="min-w-0">
+ <div class="text-muted-foreground mb-1">瀛樺偍鎽樿锛圫HA-256锛�</div>
+ <div class="break-all font-mono text-xs">
+ {{ verifyResult.storedHash }}
+ </div>
+ </div>
+ <div class="min-w-0">
+ <div class="text-muted-foreground mb-1">褰撳墠鎽樿锛圫HA-256锛�</div>
+ <div
+ class="break-all font-mono text-xs"
+ :class="verifyResult.matched ? '' : 'text-[#f56c6c]'"
+ >
+ {{ verifyResult.currentHash }}
+ </div>
+ </div>
+ <div v-if="verifyResult.bagSetHash" class="min-w-0">
+ <div class="text-muted-foreground mb-1">琚嬬爜闆嗗悎鎽樿</div>
+ <div class="break-all font-mono text-xs">
+ {{ verifyResult.bagSetHash }}
+ </div>
+ </div>
+ </div>
+ </div>
+ </Card>
+
+ <Grid class="mes-it-grid" table-title="瀹屾暣鎬ц褰曞垪琛�">
+ <template #bizType="{ row }">
+ <Tag color="blue">{{ getBizTypeLabel(row.bizType) }}</Tag>
+ </template>
+ <template #contentHash="{ row }">
+ <span class="font-mono text-xs">{{ row.contentHash }}</span>
+ </template>
+ </Grid>
+ </Page>
+</template>
--
Gitblit v1.9.3