moc变更管理系统框架

This commit is contained in:
2026-08-13 12:31:16 +08:00
commit 3e5157909c
291 changed files with 39930 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
<script setup lang="ts">
import { ref, computed } from 'vue';
import { useAppStore } from '@/store/modules/app';
import { Icon } from '@iconify/vue'
import { useThemeStore } from '@/store/modules/theme';
const appStore = useAppStore();
const themeStore = useThemeStore();
const gap = computed(() => (appStore.isMobile ? 0 : 16));
const emit = defineEmits<{ go: [v: string, preset?: string];}>();
interface Draft {
id: string;
name: string;
time: string;
step: string;
progress: string;
}
const drafts = ref<Draft[]>([
{ id: "D-2026-011", name: "R-101 搅拌提速至 180rpm(80℃→95℃)", time: "2026-08-02 09:41", step: "已生成申请表 · 待提交", progress: "4/6 页" },
{ id: "D-2026-009", name: "P-301 机封冲洗方案调整(驳回重报)", time: "2026-07-30 16:22", step: "变更预识别完成", progress: "2/6 页" },
{ id: "D-2026-007", name: "化验室新增 COD 在线分析仪", time: "2026-07-28 11:05", step: "仅填写变更描述", progress: "1/6 页" },
]);
const continueEdit = (d: Draft) => {
window.$message?.success(`已载入草稿 ${d.id},从「${d.step}」断点继续编辑`);
emit("go", "apply");
};
const remove = (d: Draft) => {
drafts.value = drafts.value.filter((x: Draft) => x.id !== d.id);
window.$message?.success(`草稿 ${d.id} 已删除`);
};
const progressPct = (p: string) => {
const m = p.match(/(\d+)\s*\/\s*(\d+)/);
return m ? Math.round((Number(m[1]) / Number(m[2])) * 100) : 0;
};
</script>
<template>
<NSpace vertical :size="16">
<!-- 我的草稿箱 -->
<NCard :bordered="false" size="small" :style="{ borderRadius: themeStore.themeRadius + 'px' }">
<NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive class="pb-[16px]">
<NGi span="24 s:24 m:16">
<div class="h-100% flex items-center gap-2">
<Icon icon="akar-icons:file" class="size-16px" :style="{ color: themeStore.themeColor }" />
<p class="text-sm font-600">我的草稿箱</p>
<span class="rounded bg-slate-100 px-1.5 text-xs font-semibold text-slate-700">{{ drafts.length }}</span>
<p class="text-xs text-#94a3b8">草稿仅本人可见,提交后自动从草稿箱移除</p>
</div>
</NGi>
<NGi span="24 s:24 m:8" class="flex items-center justify-end gap-12px">
<NButton type="primary" size="small" @click="emit('go', 'apply')">
<Icon icon="ic:round-plus" class="size-18px" />
新建空白变更
</NButton>
</NGi>
</NGrid>
<div class="space-y-2 scroll">
<div v-for="d in drafts" :key="d.id" class="rounded-lg border px-4 py-3">
<div class="flex flex-wrap items-start gap-3">
<div class="min-w-0 flex-1">
<div class="text-sm font-semibold text-slate-800 dark:text-white">{{ d.name }}</div>
<div class="mt-1 flex flex-wrap items-center gap-2 text-[11px] text-slate-400">
<span class="font-mono">{{ d.id }}</span>
<span>保存于 {{ d.time }}</span>
<NTag type="primary" size="small" class="text-11px">{{ d.step }}</NTag>
</div>
<div class="mt-2 flex items-center gap-2">
<div class="h-1.5 w-40 overflow-hidden rounded-full bg-slate-100">
<div class="h-full rounded-full bg-[#6E93C6]" :style="{ width: progressPct(d.progress) + '%' }" />
</div>
<span class="text-[11px] text-slate-400">编辑进度 {{ d.progress }}</span>
</div>
</div>
<div class="flex shrink-0 items-center gap-2 pt-2px">
<NButton class="text-xs" text type="error" @click="remove(d)">删除</NButton>
<NButton class="text-xs" text type="primary" @click="continueEdit(d)">继续编辑</NButton>
</div>
</div>
</div>
<div v-if="drafts.length === 0" class="rounded-lg border border-dashed bg-white py-12 text-center">
<div class="text-sm text-slate-400">暂无草稿</div>
<div class="mt-1 text-xs text-slate-300">在变更申请页点击右上角「保存」,即可将当前内容存为草稿</div>
</div>
</div>
</NCard>
</NSpace>
</template>
<style scoped>
</style>
<style scoped lang="scss">
.scroll {
height: calc(100vh - 190px);
overflow-y: auto;
@include scrollbar();
}
</style>