Initial project source
这个提交包含在:
@@ -0,0 +1,35 @@
|
||||
<template><main class="review-shell"><header class="review-header"><div><strong>数据治理 · 可视化工作台</strong><small>真实组件 / 合成数据 / 无业务写入</small></div><el-button @click="theme">切换亮暗</el-button></header><el-tabs v-model="view"><el-tab-pane name="completion" label="更多业务观察" /><el-tab-pane name="profile" label="数据剖析" /><el-tab-pane name="remediation" label="整改闭环" /><el-tab-pane name="quality-overview" label="质量总览" /><el-tab-pane name="catalog-overview" label="资产总览" /><el-tab-pane name="model" label="模型设计" /><el-tab-pane name="quality" label="质量观测" /><el-tab-pane name="catalog" label="资产地图" /><el-tab-pane name="lifecycle" label="治理流程" /></el-tabs><el-card shadow="never">
|
||||
<CompletionReview v-if="view === 'completion'" /><template v-if="view === 'profile'"><div class="mb-4"><el-radio-group v-model="profileScene"><el-radio-button value="normal">常规画像</el-radio-button><el-radio-button value="empty">空表画像</el-radio-button><el-radio-button value="invalid">异常统计</el-radio-button><el-radio-button value="none">无快照</el-radio-button></el-radio-group><el-checkbox v-model="profileUnknown">当前请求未知</el-checkbox></div><ProfileWorkspace :snapshot="profileScene === 'none' ? undefined : profileScene === 'empty' ? emptyProfileSnapshot : profileScene === 'invalid' ? invalidProfileSnapshot : profileSnapshot" :request-status="profileUnknown ? 'UNKNOWN' : 'SUCCEEDED'" target="commerce.customer_orders" /></template>
|
||||
<template v-if="view === 'remediation'"><RemediationWorkspace v-if="remediationSelected" :plan-id="remediationSelected" @close="remediationSelected = ''" @manage="remediationManage = true" /><RemediationBoard v-else :rows="remediationPlans" :total="37" @select="remediationSelected = String($event.planId)" /><div class="mt-3"><el-button @click="remediationScenario.failPlan = true">模拟计划读取失败</el-button><el-button @click="remediationScenario.failAttempts = true">模拟尝试读取失败</el-button><el-checkbox v-model="remediationScenario.delayAttempts">延迟执行观测</el-checkbox><el-checkbox v-model="remediationScenario.noRepairs">空修复请求</el-checkbox></div><el-dialog v-model="remediationManage" title="处理入口联动" width="min(500px, 100vw)"><p>合成预览已收到所选计划;正式页面打开原有整改详情及处理表单。这里不提交业务操作。</p></el-dialog></template>
|
||||
<QualityOverview v-if="view === 'quality-overview'" @close="view = 'quality'" /><CatalogOverview v-if="view === 'catalog-overview'" @close="view = 'catalog'" />
|
||||
<div v-if="view === 'catalog-overview'" class="mt-3"><el-select v-model="identityScenario.state" style="width:160px" aria-label="合成身份核验状态"><el-option v-for="state in ['MAPPED', 'UNMAPPED', 'AMBIGUOUS', 'UNKNOWN', 'FORBIDDEN']" :key="state" :label="state" :value="state" /></el-select><el-checkbox v-model="identityScenario.delay">延迟身份响应</el-checkbox><el-checkbox v-model="identityScenario.shortExpiry">6 秒证据有效期</el-checkbox><el-button @click="identityScenario.failRead = true">模拟登记读取失败</el-button></div>
|
||||
<ModelWorkspace v-if="view === 'model'" :design-id="design.designId" />
|
||||
<template v-if="view === 'quality'"><el-button class="mb-4" @click="empty = !empty">切换空数据</el-button><QualityObservation :rule="rule" :rows="empty ? [] : validations" :loading="false" error="" @close="view = 'model'" /></template>
|
||||
<template v-if="view === 'catalog'"><CatalogAtlas v-if="!catalogSelected" :tree="tree" @select="catalogSelected = true" /><template v-else><el-button class="mb-4" @click="catalogSelected = false">返回目录地图</el-button><CatalogPortfolio :detail="portfolio" /></template></template>
|
||||
<template v-if="view === 'lifecycle'"><el-button class="mb-4" @click="history = !history">{{ history ? '仅看当前' : '读取历史' }}</el-button><LifecycleJourney :detail="history ? lifecycle : { ...lifecycle, reviews:[], trajectories:[], impacts:[], notifications:[] }" :history-loaded="history" /></template>
|
||||
</el-card><div v-if="view === 'model'" class="mt-3"><el-button @click="scenario.fail = true">模拟下次字段读取失败</el-button><el-button @click="scenario.loseSaveReply = true">模拟下次保存响应丢失</el-button><span>合成接口保存 {{ scenario.modelSaves }} 次</span></div><div v-if="view.endsWith('overview')" class="mt-3"><el-button @click="aggregateScenario.fail = true">模拟下次总览读取失败</el-button><el-button @click="aggregateScenario.empty = !aggregateScenario.empty">切换总览空数据</el-button><span>已读取 {{ aggregateScenario.reads }} 次;切换场景后点击刷新</span></div></main></template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import CompletionReview from './CompletionReview.vue';
|
||||
import ProfileWorkspace from '@/views/datagov/governance/data-profile/ProfileWorkspace.vue';
|
||||
import { profileSnapshot, emptyProfileSnapshot, invalidProfileSnapshot } from './profile';
|
||||
const profileScene = ref('normal'), profileUnknown = ref(false);
|
||||
import RemediationBoard from '@/views/datagov/governance/quality-remediation/RemediationBoard.vue';
|
||||
import RemediationWorkspace from '@/views/datagov/governance/quality-remediation/RemediationWorkspace.vue';
|
||||
import { remediationPlans, remediationScenario } from './remediation';
|
||||
const remediationSelected = ref(''); const remediationManage = ref(false);
|
||||
import QualityOverview from '@/views/datagov/governance/quality-rule/QualityOverview.vue';
|
||||
import CatalogOverview from '@/views/datagov/governance/asset-catalog/CatalogOverview.vue';
|
||||
import { aggregateScenario } from './aggregates';
|
||||
import { identityScenario } from './catalogIdentities';
|
||||
import ModelWorkspace from '@/views/datagov/governance/model-design/ModelWorkspace.vue';
|
||||
import QualityObservation from '@/views/datagov/governance/quality-rule/QualityObservation.vue';
|
||||
import CatalogAtlas from '@/views/datagov/governance/asset-catalog/CatalogAtlas.vue';
|
||||
import CatalogPortfolio from '@/views/datagov/governance/asset-catalog/CatalogPortfolio.vue';
|
||||
import LifecycleJourney from '@/views/datagov/governance/asset-lifecycle/LifecycleJourney.vue';
|
||||
import { design, rule, validations, tree, portfolio, lifecycle } from './data';
|
||||
import { scenario } from './api';
|
||||
const view = ref('completion'); const empty = ref(false); const catalogSelected = ref(false); const history = ref(false);
|
||||
function theme() { document.documentElement.classList.toggle('dark'); }
|
||||
</script>
|
||||
<style>.review-shell{padding:20px;max-width:1680px;margin:auto}.review-header{display:flex;justify-content:space-between;gap:16px;align-items:center}.review-header strong{font-size:20px}.review-header small{display:block;margin-top:6px;color:var(--el-text-color-secondary)}@media(max-width:600px){.review-shell{padding:10px}.review-header strong{font-size:16px}.el-card__body{padding:12px}}</style>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<section>
|
||||
<div class="completion-controls"><el-select v-model="scene" aria-label="观察场景"><el-option v-for="item in scenes" :key="item[0]" :value="item[0]" :label="item[1]" /></el-select><el-checkbox v-model="empty">空数据</el-checkbox><el-checkbox v-model="unknown">未知或过期</el-checkbox></div>
|
||||
<StandardObservation v-if="scene==='standard'" :detail="standard" />
|
||||
<ClassificationMatrix v-if="scene==='classification'" :candidates="empty?[]:candidates" :labels="labels" @review="notice='已连接原候选复核入口'" />
|
||||
<PolicyMatrix v-if="scene==='policy'" :context="policy" />
|
||||
<IngestionTopology v-if="scene==='ingestion'" :detail="ingestion" />
|
||||
<NodeObservation v-if="scene==='node'" :detail="node" />
|
||||
<TransformationMapping v-if="scene==='transformation'" :rules="rules" scope-key="fixture-transformation" />
|
||||
<BatchMappingMap v-if="scene==='batch'" :mappings="empty?[]:mappings" source="业务库 · 订单明细" target="数仓 · 标准订单" scope-key="fixture-batch" />
|
||||
<FormulaDependencyMap v-if="scene==='formula'" :nodes="empty?[]:formula" :labels="formulaLabels" scope-key="fixture-formula" />
|
||||
<AlertObservation v-if="scene==='alert'" :detail="alert" />
|
||||
<AssetEvidenceMap v-if="scene==='asset'" :detail="asset" />
|
||||
<InventoryDifferences v-if="scene==='inventory'" :candidates="inventoryCandidates" :differences="empty?[]:differences" @resolve="notice='已连接原盘点差异处理入口'" />
|
||||
<MetricDependencyMap v-if="scene==='metric'" :lineage="empty?undefined:lineage" :labels="metricLabels" :impact="impact" impact-mode />
|
||||
<ApiDependencyMap v-if="scene==='api'" :dependencies="empty?[]:dependencies" management-id="101" label="订单分析接口" />
|
||||
<el-alert v-if="notice" :title="notice" type="info" :closable="false" />
|
||||
</section>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import StandardObservation from '@/views/datagov/governance/standard-operation/StandardObservation.vue';
|
||||
import ClassificationMatrix from '@/views/datagov/governance/security-classification/ClassificationMatrix.vue';
|
||||
import PolicyMatrix from '@/views/datagov/governance/security-policy-review/PolicyMatrix.vue';
|
||||
import IngestionTopology from '@/views/datagov/governance/metadata-ingestion/IngestionTopology.vue';
|
||||
import NodeObservation from '@/views/datagov/integration/collection-nodes/NodeObservation.vue';
|
||||
import TransformationMapping from '@/views/datagov/dataops/transformation-cleaning/TransformationMapping.vue';
|
||||
import BatchMappingMap from '@/views/datagov/dataops/batch-ingestion/BatchMappingMap.vue';
|
||||
import FormulaDependencyMap from '@/views/datagov/dataproduct/metric-calculation/FormulaDependencyMap.vue';
|
||||
import AlertObservation from '@/views/datagov/dataops/alert-events/AlertObservation.vue';
|
||||
import AssetEvidenceMap from '@/views/datagov/governance/asset-detail/AssetEvidenceMap.vue';
|
||||
import InventoryDifferences from '@/views/datagov/governance/asset-inventory/InventoryDifferences.vue';
|
||||
import MetricDependencyMap from '@/views/datagov/dataproduct/metric-lineage/MetricDependencyMap.vue';
|
||||
import ApiDependencyMap from '@/views/datagov/dataproduct/api-management/ApiDependencyMap.vue';
|
||||
const scenes = [['standard','标准覆盖与版本'],['classification','分类复核矩阵'],['policy','策略对照'],['ingestion','采集拓扑'],['node','采集节点能力'],['transformation','清洗字段映射'],['batch','同步字段映射'],['formula','公式依赖'],['alert','告警处置'],['asset','资产证据关联'],['inventory','盘点差异'],['metric','指标血缘与影响'],['api','接口消费依赖']];
|
||||
const scene=ref('batch'), empty=ref(false), unknown=ref(false), notice=ref('');
|
||||
watch(scene,()=>{empty.value=false;unknown.value=false;notice.value='';});
|
||||
const now=new Date().toISOString(), later=new Date(Date.now()+3600000).toISOString(), earlier=new Date(Date.now()-3600000).toISOString(), sha='a'.repeat(64);
|
||||
// These fixtures contain no real business data or credentials; this preview makes no writes.
|
||||
const standard=computed(()=>({publications:empty.value?[]:[{publicationId:1,publicationVersion:1,publishedAt:'2026-10-20 09:00',contentSnapshot:'客户编号:统一采用客户主键\n联系邮箱:允许为空\n地域:使用行政区划代码'},{publicationId:2,publicationVersion:2,publishedAt:now,contentSnapshot:'客户编号:统一采用客户主键\n联系邮箱:采用小写格式\n地域:使用行政区划代码\n订单金额:精确到两位小数'}],coverageAnalyses:empty.value?[]:[{analysisId:1,sourceType:'订单主题',sourceRef:'orders',observedAt:now,status:unknown.value?'UNKNOWN':'COMPLETED',referenceCoverageRate:85,adoptionRate:72,exemptionRate:8,issueRate:3},{analysisId:2,sourceType:'客户主题',sourceRef:'customers',observedAt:now,status:'UNKNOWN'}],effectEvaluations:empty.value?[]:[{evaluationId:1,createTime:now,status:unknown.value?'UNKNOWN':'PARTIAL',weightedScore:76,reason:'客户邮箱格式仍存在待复核问题'}]}));
|
||||
const candidates=[{candidateId:1,resourceRef:'customer.email',classificationCode:'个人联系信息',levelCode:'L2',status:'PENDING_REVIEW'},{candidateId:2,resourceRef:'customer.email',classificationCode:'个人联系信息',levelCode:'L2',status:'CONFIRMED'},{candidateId:3,resourceRef:'order.customer_id',classificationCode:'客户标识',levelCode:'L1',status:'CONFIRMED'},{candidateId:4,resourceRef:'customer.mobile',classificationCode:'个人联系信息',levelCode:'L2',status:'PENDING_REVIEW'},{candidateId:5,resourceRef:'customer.name',classificationCode:'客户标识',levelCode:'L1',status:'REJECTED'}];
|
||||
const labels={'customer.email':'客户 · 邮箱','order.customer_id':'订单 · 客户编号','customer.mobile':'客户 · 手机号码','customer.name':'客户 · 姓名'};
|
||||
const policy=computed(()=>({tableLabel:'客户信息表',action:'READ',observedAt:now,policies:empty.value?[]:[{key:'a',policy:{name:'分析人员只读',version:3}},{key:'b',policy:{name:'联系信息保护',version:2}}],facts:empty.value?[]:[{key:'f1',summary:'联系信息字段',fields:['email','mobile'],policyKeys:['b']},{key:'f2',summary:'客户标识读取范围',fields:['customer_id'],policyKeys:['a','b']},{key:'f3',summary:'集合范围存在交集',fields:[],policyKeys:[]}]}));
|
||||
const ingestion=computed(()=>({connector:{connectorId:1,name:'订单业务元数据采集',connectorType:'MYSQL',bindingMode:'DATA_SOURCE',sourceDataSourceName:'业务库 · commerce',sourceDataSourceVersion:4,version:3,status:'ACTIVE',updatedAt:now},policy:{version:4,enabled:true},recentRuns:empty.value?[]:[{runId:1,policyId:2,status:'SUCCEEDED',startedAt:earlier,finishedAt:now,snapshotSha256:sha},{runId:2,policyId:3,status:unknown.value?'UNKNOWN':'RUNNING',startedAt:now,snapshotSha256:sha}]}));
|
||||
const node=computed(()=>({node:{observationStale:unknown.value||empty.value},latestObservation:empty.value?undefined:{status:unknown.value?'UNKNOWN':'ONLINE',stale:unknown.value,observedAt:now,totalSlot:24,unassignedSlot:8,runningJobs:6,workers:4},capabilities:empty.value?[]:[{connectorType:'JDBC',runMode:'BATCH',direction:'SOURCE',status:'SUPPORTED',stale:unknown.value},{connectorType:'DORIS',runMode:'BATCH',direction:'SINK',status:'SUPPORTED',stale:unknown.value},{connectorType:'MYSQL',runMode:'STREAM',direction:'SOURCE',status:'UNKNOWN',stale:false}]}));
|
||||
const rules=computed(()=>({standardizationRules:empty.value?[]:[{ruleCode:'normalize_email',sourceField:'Email',targetField:'email',operation:'TEXT_LOWER'},{ruleCode:'amount_format',sourceField:'amount',targetField:'amount',operation:'NUMBER_FORMAT'}],completionRules:empty.value?[]:[{ruleCode:'region_default',field:'region',operation:'DEFAULT_VALUE'}],deduplicationRules:empty.value?[]:[{ruleCode:'order_key',keyFields:['order_id'],matchMode:'EXACT',keepPriority:'FIRST'}],dirtyIsolationRules:empty.value?[]:[{ruleCode:'invalid_amount',field:'amount',disposition:'ISOLATE'}]}));
|
||||
const mappings=[{sourceField:'order_id',targetField:'order_id',sourceType:'BIGINT',targetType:'BIGINT',transform:'NONE',filterValues:[]},{sourceField:'Email',targetField:'email',sourceType:'VARCHAR(128)',targetType:'STRING',transform:'LOWER',filterValues:[]},{sourceField:'amount',targetField:'amount',sourceType:'DECIMAL(18,2)',targetType:'DECIMAL(18,2)',transform:'NONE',filterValues:[]},{sourceField:'created_at',targetField:'created_at',sourceType:'DATETIME',targetType:'DATETIME',transform:'CAST',filterValues:[]}];
|
||||
const formula=computed(()=>[{nodeKey:'sales',nodeType:'METRIC',dependencies:[]},{nodeKey:'orders',nodeType:'METRIC',dependencies:[]},{nodeKey:'model',nodeType:'SEMANTIC_MODEL',dependencies:[]},{nodeKey:'aggregate',nodeType:'AGGREGATE',aggregateOperator:'SUM',dependencies:['sales','model']},{nodeKey:'average',nodeType:'ARITHMETIC',arithmeticOperator:'DIVIDE',dependencies:unknown.value?['absent']:['aggregate','orders']}]);
|
||||
const formulaLabels={sales:'订单销售金额',orders:'有效订单数量',model:'订单分析模型',aggregate:'销售金额求和',average:'平均客单价'};
|
||||
const alert=computed(()=>({summary:{status:unknown.value?'UNKNOWN':'PROCESSING',ruleName:'订单采集失败告警',metric:'FAILED_COUNT'},occurrences:empty.value?[]:[{occurrenceId:1,observedFrom:'2026-10-22 08:00',observedTo:'2026-10-22 09:00',metricValue:3,sampleCount:20,evidenceSha256:sha},{occurrenceId:2,observedFrom:'2026-10-22 09:00',observedTo:'2026-10-22 10:00',metricValue:2,sampleCount:18,evidenceSha256:sha}],timeline:empty.value?[]:[{timelineId:1,action:'创建事件',toStatus:'OPEN',createdAt:earlier,reasonSummary:'已记录采集失败观测'},{timelineId:2,action:'分派处理',toStatus:'PROCESSING',createdAt:now,reasonSummary:'由数据运营组检查来源连接'}],notifications:empty.value?[]:[{notificationId:1,recipientUserName:'示例处理人',contentSummary:'请核对订单采集状态',recordedAt:now,status:'RECORDED'}]}));
|
||||
const asset=computed(()=>({asset:{assetDetailId:1,assetFqn:'数仓 · 标准订单',version:2},sections:empty.value?[]:['SCHEMA','LINEAGE','QUALITY','SECURITY','USAGE'].map((sectionType,i)=>({sectionSnapshotId:i+1,snapshotVersion:2,sectionType,sourceType:'已登记章节观测',observedAt:now,reliable:!unknown.value&&i<3,evidenceState:i<3?'KNOWN':'UNKNOWN',payloadSha256:sha})),relations:empty.value?[]:[{relationRecordId:1,relationType:'加工任务',targetRef:'订单清洗任务',evidenceRef:'task:1',observedAt:now},{relationRecordId:2,relationType:'消费指标',targetRef:'订单销售金额',evidenceRef:'metric:1',observedAt:now},{relationRecordId:3,relationType:'所属模型',targetRef:'订单分析模型',evidenceRef:'model:1',observedAt:now}]}));
|
||||
const inventoryCandidates=[{candidateId:1,fqn:'commerce.orders'},{candidateId:2,fqn:'commerce.customers'},{candidateId:3,fqn:'warehouse.order_daily'}];
|
||||
const differences=[{differenceId:1,candidateId:1,differenceType:'NEW',status:'OPEN'},{differenceId:2,candidateId:1,differenceType:'OWNER_CONFLICT',status:'OPEN'},{differenceId:3,candidateId:2,differenceType:'DUPLICATE',status:'RESOLVED'},{differenceId:4,candidateId:3,differenceType:'MISSING',status:'OPEN'}];
|
||||
const metricLabels={source:'标准订单表',calculation:'订单销售额计算',metric:'订单销售金额',dashboard:'经营分析看板'};
|
||||
const lineage=computed(()=>({snapshotId:'101',state:unknown.value?'UNKNOWN':'RELIABLE',reliable:!unknown.value,observedAt:now,nodes:Object.entries(metricLabels).map(([nodeId])=>({nodeId,nodeType:nodeId.toUpperCase(),sourceId:nodeId,sourceSha256:sha})),edges:[['source','calculation'],['calculation','metric'],['metric','dashboard']].map(([fromNodeId,toNodeId],i)=>({edgeId:`e${i}`,fromNodeId,toNodeId,sourceId:'fixture',sourceSha256:sha}))}));
|
||||
const impact={lineageSnapshotId:'101',state:'RELIABLE',paths:[{nodeIds:['calculation','metric','dashboard']}]};
|
||||
const dependencies=computed(()=>[{dependencyId:1,snapshotId:1,status:unknown.value?'UNKNOWN':'RELIABLE',sourceType:'API_VERSION_SNAPSHOT',sourceRef:'api-version-snapshot:1',sourceSha256:sha,observedAt:now,expiresAt:unknown.value?earlier:later,createTime:now,callers:['经营分析看板','销售查询应用'],downstreamSystems:['管理驾驶舱','经营报告'],impacts:['接口字段调整需要核对两个调用方的请求响应模型']}]);
|
||||
</script>
|
||||
<style scoped>.completion-controls{display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:20px}.completion-controls .el-select{width:min(320px,100%)}</style>
|
||||
@@ -0,0 +1,34 @@
|
||||
import { reactive } from 'vue';
|
||||
import type { QualityOverviewData, ObservationState } from '@/api/datagov/quality-rule/observations';
|
||||
import type { CatalogOverviewData } from '@/api/datagov/asset-catalog/overview';
|
||||
export const aggregateScenario = reactive({ fail: false, empty: false, reads: 0 });
|
||||
const names = ['订单主键唯一性', '客户编号完整性', '订单金额取值范围', '每日订单量', '商品编号唯一性', '支付时间完整性', '退款金额范围', '渠道编码完整性', '客户维度重复校验', '库存数量范围', '物流单号完整性', '商品日快照行数'];
|
||||
export async function getQualityOverview(params: { from?: string; to?: string; after?: string }) {
|
||||
aggregateScenario.reads++; if (aggregateScenario.fail) { aggregateScenario.fail = false; throw new Error('合成场景:读取失败,请刷新重试'); }
|
||||
const from = params.from || '2026-10-08', to = params.to || '2026-10-21';
|
||||
const base = params.after && params.after !== '0' ? 12 : 0;
|
||||
const rules = aggregateScenario.empty ? [] : (base ? ['会员等级完整性', '成本中心唯一性', '营销转化范围'] : names).map((ruleName, i) => ({ ruleId: String(9007199254740993n + BigInt(base + i)), ruleName, currentTarget: ['dwd.fact_orders', 'dim.customer', 'dwd.fact_payment', 'dws.inventory_daily'][i % 4], currentDataSourceId: '9007199254741001', currentColumn: i === 3 ? undefined : 'id', version: 3 }));
|
||||
const cells: QualityOverviewData['cells'] = [];
|
||||
rules.forEach((rule, i) => { const start = Date.parse(from + 'T00:00:00Z'), end = Date.parse(to + 'T00:00:00Z'); for (let time = start, d = 0; time <= end && d < 31; time += 86400000, d++) {
|
||||
if ((i === 10 && d < 5) || (i === 11 && d > 10)) continue;
|
||||
const state: ObservationState = i === 1 && d === 13 ? 'UNKNOWN' : i === 8 && d < 4 ? 'LEGACY' : i === 5 && d === 12 ? 'EXECUTION_FAILED' : (i === 2 || i === 6) && d > 8 ? 'THRESHOLD_FAILED' : 'PASSED';
|
||||
const date = new Date(time).toISOString().slice(0, 10);
|
||||
const latest = { validationId: String(100000 + i * 100 + d), snapshotId: '9007199254741999', configSha256: (d > 8 ? 'a' : 'b').repeat(64), state, attempts: d === 13 ? 3 : 1, method: i === 3 ? 'ROW_COUNT' : 'NOT_NULL', unit: i === 3 ? '行数' : '违规记录数', value: state === 'UNKNOWN' || state === 'EXECUTION_FAILED' ? undefined : i === 3 ? 12843 : state === 'THRESHOLD_FAILED' ? 27 : 0, evidenceRef: state === 'UNKNOWN' ? undefined : 'fixture/validation/semantics/v1', errorCode: state === 'THRESHOLD_FAILED' ? 'QUALITY_RULE_THRESHOLD_NOT_MET' : state === 'EXECUTION_FAILED' ? 'SOURCE_UNAVAILABLE' : undefined, observedAt: state === 'UNKNOWN' ? undefined : date + ' 09:30:00', requestedAt: date + ' 09:29:00' };
|
||||
if (i === 8 && d < 4) { latest.value = undefined; latest.method = 'UNKNOWN'; latest.unit = '单位未声明'; latest.evidenceRef = 'fixture/legacy'; }
|
||||
const configurations = [latest];
|
||||
if (d === 9) configurations.push({ ...latest, validationId: String(80000 + i), snapshotId: '9007199254741998', configSha256: 'b'.repeat(64), state: 'PASSED', attempts: 2, value: 0, errorCode: undefined, observedAt: date + ' 08:30:00', requestedAt: date + ' 08:29:00' });
|
||||
const unverified = i === 8 && d < 4, historical = i === 0 && d < 8;
|
||||
const cell: QualityOverviewData['cells'][number] = { ...latest, ruleId: rule.ruleId, date, attempts: configurations.reduce((sum, item) => sum + item.attempts, 0), versionChanged: d === 9, targetKey: unverified ? 'unverified' : historical ? 'old-orders' : 'current-' + i, targetStatus: unverified ? 'UNVERIFIED' : 'VERIFIED', target: unverified ? undefined : historical ? 'ods.order_archive' : rule.currentTarget, targetDataSourceId: unverified ? undefined : rule.currentDataSourceId, targetColumn: unverified ? undefined : rule.currentColumn, configurations };
|
||||
cells.push(cell);
|
||||
if (i === 0 && d === 8) {
|
||||
const prior = { ...latest, validationId: '79999', snapshotId: '9007199254741997', state: 'THRESHOLD_FAILED' as const, value: 18, observedAt: date + ' 08:00:00', requestedAt: date + ' 07:59:00', errorCode: 'QUALITY_RULE_THRESHOLD_NOT_MET' };
|
||||
cells.push({ ...cell, ...prior, targetKey: 'old-orders', target: 'ods.order_archive', configurations: [prior] });
|
||||
}
|
||||
} });
|
||||
return { data: { scopeHash: 'c'.repeat(64), from, to, dateBasis: 'OBSERVED_AT_ELSE_REQUESTED_AT', timezone: 'UNDECLARED', aggregationBasis: 'RULE_FROZEN_TARGET_DAY_V1', readAt: '2026-10-22T02:00:00Z', rules, cells, nextCursor: base || aggregateScenario.empty ? undefined : rules.at(-1)?.ruleId, truncated: !base && !aggregateScenario.empty } satisfies QualityOverviewData };
|
||||
}
|
||||
export async function getCatalogOverview() {
|
||||
aggregateScenario.reads++; if (aggregateScenario.fail) { aggregateScenario.fail = false; throw new Error('合成场景:读取失败,请刷新重试'); }
|
||||
const groups = aggregateScenario.empty ? [] : ['交易域', '客户域', '商品域', '财务域', '营销域', '供应链域', '运营指标', '共享维度', '待建设目录'].map((name, i) => ({ catalogId: String(9007199254740993n + BigInt(i)), name, status: i < 6 ? 'PUBLISHED' : 'DRAFT', types: i === 8 ? [] : ['TABLE', 'DATASET', 'FILE', 'REPORT', 'API', 'MODEL'].map((type, j) => ({ type, reliable: Math.max(0, 140 - i * 14 - j * 18), uncertain: (i + j) % 4 === 0 ? 8 : 0 })) }));
|
||||
return { data: { scopeHash: 'd'.repeat(64), readAt: '2026-10-21T02:00:00Z', lastRegistrationUpdate: '2026-10-21 09:42:00', countKind: 'REGISTRATION', truncated: false, groups } satisfies CatalogOverviewData };
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { reactive } from 'vue';
|
||||
import { design } from './data';
|
||||
import type { LogicalSnapshot } from '@/api/datagov/model-design/types';
|
||||
export const scenario = reactive({ fail: false, loseSaveReply: false, modelSaves: 0 });
|
||||
let savedDesign = structuredClone(design);
|
||||
const receipts = new Map<string, string>();
|
||||
const blocked = async () => { throw new Error('此检查环境不执行业务写入'); };
|
||||
export const getModelDesign = async () => ({ data: structuredClone(savedDesign) });
|
||||
export const saveLogicalModel = async (id: string, command: { snapshot: LogicalSnapshot; version: string | number }, key: string) => {
|
||||
const body = JSON.stringify(command);
|
||||
if (receipts.has(key)) { if (receipts.get(key) !== body) throw new Error('合成接口:原键载荷变化'); return { data: { result: structuredClone(savedDesign) } }; }
|
||||
if (String(id) !== String(savedDesign.designId) || String(command.version) !== String(savedDesign.version)) throw { response: { status: 409 } };
|
||||
savedDesign = { ...savedDesign, logical: JSON.parse(JSON.stringify(command.snapshot)), version: String(BigInt(savedDesign.version) + 1n), currentVersionNo: String(BigInt(savedDesign.currentVersionNo) + 1n) };
|
||||
receipts.set(key, body); scenario.modelSaves++;
|
||||
if (scenario.loseSaveReply) { scenario.loseSaveReply = false; throw new Error('合成接口:已保存但响应丢失'); }
|
||||
return { data: { result: structuredClone(savedDesign) } };
|
||||
};
|
||||
export const getModelLayout = async (_id: string, layer: string) => ({ data: { designId: design.designId, layer: layer.toUpperCase(), layoutVersion:'0',snapshotSha256:'a'.repeat(64),positions:[],viewport:null,stale:false,updatedAt:null,droppedNodeIds:[] } });
|
||||
export const pageModelDesignVersions = async () => { const old = structuredClone(design); old.physical.tables[0].fields[2].nullable = true; old.physical.tables[0].fields[2].dataType = 'DOUBLE'; return { data: { rows: [{ ...old, versionNo:'7',versionId:'v7',changeSummary:'调整金额类型与非空约束',createTime:'2026-10-20T09:00:00' }], total:1 } }; };
|
||||
export const sourceCandidates = async () => ({ data: [{ tableId:'fixture-table',label:'交易库 / orders',engineType:'MYSQL' }] });
|
||||
export const sourceStructure = async (id: string) => { if (scenario.fail) { scenario.fail = false; throw new Error('模拟字段读取失败'); } return {data: { tableId:id,sourceVersion:'12',revision:'3',observedAt:'2026-10-21T08:30:00',engineType:'MYSQL',fields:[{name:'id',dataType:'BIGINT',nullable:false,restricted:false},{name:'customer_id',dataType:'BIGINT',nullable:null,restricted:false},{name:'amount',dataType:'DOUBLE',nullable:true,restricted:false}],uniqueKeys:[['id']] }}; };
|
||||
export const saveModelLayout=blocked,saveConceptualModel=blocked,savePhysicalModel=blocked,saveModelDefinition=blocked,structureContext=blocked,generateStructure=blocked,reviewStructure=blocked,prepareStructure=blocked;
|
||||
@@ -0,0 +1,82 @@
|
||||
import { reactive } from 'vue';
|
||||
import type { CatalogIdentityCommand, CatalogIdentityInspection, CatalogIdentityLink, CatalogIdentityRequestReceipt } from '@/api/datagov/asset-catalog/identity';
|
||||
export { getCatalogOverview } from './aggregates';
|
||||
export const identityScenario = reactive({ state: 'MAPPED', failRead: false, delay: false, shortExpiry: false });
|
||||
const catalogs = ['交易域', '客户域', '商品域', '财务域', '营销域', '供应链域', '运营指标', '共享维度', '待建设目录'].map((name, i) => ({ catalogId: String(9007199254740993n + BigInt(i)), name, status: 'PUBLISHED' }));
|
||||
const fixtures = [
|
||||
['asset:orders:daily', '每日交易订单', [0, 1, 3, 6]],
|
||||
['asset:customer:profile', '客户统一画像', [1, 6, 7]],
|
||||
['asset:product:master', '商品主数据', [0, 7]],
|
||||
['asset:revenue:monthly', '月度营收指标', [3, 6]],
|
||||
['asset:Orders:daily', '每日交易订单', [0]],
|
||||
['asset:city:dimension', '城市维度', [7]]
|
||||
] as const;
|
||||
const rows = fixtures.flatMap(([assetRef, name, positions], fi) => positions.map((c, i) => ({ registrationId: String(9107199254740993n + BigInt(fi * 10 + i)), catalogId: catalogs[c].catalogId, assetRef, name: fi === 0 && i === 2 ? '订单收入基础表' : name, type: fi === 0 && i === 3 ? 'DATASET' : 'TABLE', reliable: i !== 1, version: '1' })));
|
||||
export async function getCatalogRegistrations(catalogId?: string) {
|
||||
if (identityScenario.failRead) { identityScenario.failRead = false; throw new Error('合成场景:当前目录读取失败,请重试'); }
|
||||
return { data: { scopeHash: 'e'.repeat(64), readAt: new Date().toISOString(), catalogs: catalogs.filter(c => !catalogId || c.catalogId === catalogId), rows: rows.filter(r => !catalogId || r.catalogId === catalogId) } };
|
||||
}
|
||||
export async function resolveIdentityReference(assetRef: string) {
|
||||
const state = identityScenario.state; const shortExpiry = identityScenario.shortExpiry;
|
||||
if (identityScenario.delay) await new Promise(resolve => setTimeout(resolve, 4000));
|
||||
if (state === 'FORBIDDEN') throw new Error('合成场景:无权读取资产详情或生命周期');
|
||||
if (state !== 'MAPPED') return { data: { state, identity: null, error: state === 'AMBIGUOUS' ? 'SOURCE_CONFLICT' : 'OWNER_UNKNOWN' } };
|
||||
return { data: { state, error: null, identity: { assetId: '9007199254741237', assetRef, businessVersion: '4', sourceEvidence: [{ observedAt: new Date(Date.now() - 1000).toISOString(), expiresAt: new Date(Date.now() + (shortExpiry ? 6000 : 300000)).toISOString() }] } } };
|
||||
}
|
||||
const links = new Map<string, CatalogIdentityLink>();
|
||||
const linkReceipts = new Map<string, { command: string; link: CatalogIdentityLink }>();
|
||||
const canceledRequests = new Set<string>();
|
||||
const requestScope = (id: string, key: string) => JSON.stringify([id, key]);
|
||||
export async function inspectCatalogIdentity(id: string): Promise<{ data: CatalogIdentityInspection }> {
|
||||
const row = rows.find(value => value.registrationId === id);
|
||||
if (!row) throw new Error('合成场景:登记不存在');
|
||||
const resolution = row.type === 'TABLE' ? (await resolveIdentityReference(row.assetRef)).data : { state: 'UNKNOWN', identity: null };
|
||||
const candidate = resolution.identity ? { assetId: String(resolution.identity.assetId), businessVersion: '4', evidenceSha256: 'a'.repeat(64), expiresAt: resolution.identity.sourceEvidence[0].expiresAt } : null;
|
||||
const link = links.get(id) || null;
|
||||
return { data: { registrationId: id, registrationVersion: row.version, assetRef: row.assetRef, readAt: new Date().toISOString(),
|
||||
resolutionState: resolution.state as CatalogIdentityInspection['resolutionState'], candidate, link,
|
||||
associationState: !link ? 'UNLINKED' : Date.parse(link.expiresAt) <= Date.now() ? 'STALE' : candidate ? 'CURRENT' : 'UNKNOWN', unavailableReason: row.type === 'TABLE' ? undefined : '当前已有身份来源只支持表;其他登记类型需先建立对应来源证明' } };
|
||||
}
|
||||
export async function saveCatalogIdentity(id: string, command: CatalogIdentityCommand, key: string) {
|
||||
if (canceledRequests.has(requestScope(id, key))) throw { response: { status: 409 } };
|
||||
const receipt = linkReceipts.get(key);
|
||||
if (receipt) { if (receipt.command !== JSON.stringify(command) || receipt.link.registrationId !== id) throw { response: { status: 409 } }; return { data: receipt.link }; }
|
||||
const current = (await inspectCatalogIdentity(id)).data;
|
||||
if (canceledRequests.has(requestScope(id, key))) throw { response: { status: 409 } };
|
||||
if (!current.candidate || command.assetId !== current.candidate.assetId || command.registrationVersion !== current.registrationVersion || command.expectedLinkVersion !== (current.link?.version || '0')) throw { response: { status: 409 } };
|
||||
const link = { linkId: String(9207199254740993n + BigInt(links.size)), registrationId: id, version: String(BigInt(command.expectedLinkVersion) + 1n), ...current.candidate, linkedAt: new Date().toISOString(), requestId: `SYNTHETIC-${key}` };
|
||||
links.set(id, link); linkReceipts.set(key, { command: JSON.stringify(command), link }); return { data: link };
|
||||
}
|
||||
export async function readCatalogIdentityRequest(id: string, key: string): Promise<{ data: CatalogIdentityRequestReceipt }> {
|
||||
const link = linkReceipts.get(key)?.link;
|
||||
return { data: { state: link?.registrationId === id ? 'COMPLETED' : canceledRequests.has(requestScope(id, key)) ? 'CANCELED_NO_WRITE' : 'NOT_OBSERVED', registrationId: id, requestKey: key, link: link?.registrationId === id ? link : null } };
|
||||
}
|
||||
export async function cancelCatalogIdentityRequest(id: string, key: string): Promise<{ data: CatalogIdentityRequestReceipt }> {
|
||||
if (!rows.some(row => row.registrationId === id)) throw { response: { status: 404 } };
|
||||
const result = await readCatalogIdentityRequest(id, key);
|
||||
if (result.data.state === 'COMPLETED') return result;
|
||||
canceledRequests.add(requestScope(id, key));
|
||||
return readCatalogIdentityRequest(id, key);
|
||||
}
|
||||
export async function getCatalogIdentitySummary(catalogId?: string) {
|
||||
const registrations = (await getCatalogRegistrations(catalogId)).data;
|
||||
let expires: number | undefined;
|
||||
const stats = { registrations: registrations.rows.length, tableRegistrations: 0, verifiedRegistrations: 0, distinctIdentities: 0, duplicateRegistrations: 0, unlinked: 0, stale: 0, unknown: 0, unsupported: 0 };
|
||||
const distinct = new Set<string>();
|
||||
for (const row of registrations.rows) {
|
||||
if (row.type !== 'TABLE') { stats.unsupported++; continue; }
|
||||
stats.tableRegistrations++;
|
||||
if (!row.reliable) { stats.unknown++; continue; }
|
||||
const value = (await inspectCatalogIdentity(row.registrationId)).data;
|
||||
if (value.associationState === 'CURRENT' && value.link && value.candidate) {
|
||||
stats.verifiedRegistrations++; distinct.add(value.link.assetId);
|
||||
expires = Math.min(expires ?? Infinity, Date.parse(value.link.expiresAt), Date.parse(value.candidate.expiresAt));
|
||||
}
|
||||
else if (value.associationState === 'UNLINKED') stats.unlinked++;
|
||||
else if (value.associationState === 'STALE') stats.stale++;
|
||||
else stats.unknown++;
|
||||
}
|
||||
if (expires !== undefined && expires <= Date.now()) throw new Error('合成场景:核验证据已过期,请重新核验');
|
||||
stats.distinctIdentities = distinct.size; stats.duplicateRegistrations = stats.verifiedRegistrations - distinct.size;
|
||||
return { data: { scopeHash: registrations.scopeHash, readAt: new Date().toISOString(), expiresAt: expires === undefined ? undefined : new Date(expires).toISOString(), countKind: 'DISTINCT_CURRENT_LINKED_TABLE_IDENTITY', ...stats } };
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { DesignView } from '@/api/datagov/model-design/types';
|
||||
import type { RuleVO, ValidationHistory } from '@/api/datagov/quality-rule/types';
|
||||
import type { AssetCatalogDetail, AssetCatalogTreeNode } from '@/api/datagov/asset-catalog/types';
|
||||
import type { AssetLifecycleDetail } from '@/api/datagov/asset-lifecycle/types';
|
||||
const entities = [{ code: 'ORDER', name: '订单', conceptualEntityCode: 'BUSINESS_ORDER', attributes: [{ code: 'ID', name: '订单编号', dataType: 'BIGINT', nullable: false, conceptualEntityCode: 'BUSINESS_ORDER', conceptualAttributeCode: 'ORDER_NUMBER' }, { code: 'CUSTOMER_ID', name: '客户编号', dataType: 'BIGINT', nullable: false }, { code: 'AMOUNT', name: '订单金额', dataType: 'DECIMAL', nullable: false }] }, { code: 'CUSTOMER', name: '客户', conceptualEntityCode: 'BUSINESS_CUSTOMER', attributes: [{ code: 'ID', name: '客户编号', dataType: 'BIGINT', nullable: false, conceptualEntityCode: 'BUSINESS_CUSTOMER', conceptualAttributeCode: 'CUSTOMER_NUMBER' }, { code: 'NAME', name: '客户名称', dataType: 'VARCHAR', nullable: false, conceptualEntityCode: 'BUSINESS_CUSTOMER', conceptualAttributeCode: 'CUSTOMER_NAME' }] }];
|
||||
export const design = { designId: '9007199254740997', designCode: 'ORDER_DOMAIN', designName: '交易主题模型', ownerType: 'USER', ownerId: '9007199254740993', ownerName: '演示负责人', status: 'DRAFT', currentVersionNo: '8', version: '8', contentSha256: 'a'.repeat(64), createDept: 'fixture-org', conceptual: { entities: [{ code: 'BUSINESS_ORDER', name: '业务订单', attributes: [{ code: 'ORDER_NUMBER', name: '订单号' }, { code: 'ORDER_AMOUNT', name: '订单金额' }] }, { code: 'BUSINESS_CUSTOMER', name: '业务客户', attributes: [{ code: 'CUSTOMER_NUMBER', name: '客户号' }, { code: 'CUSTOMER_NAME', name: '客户名称' }] }], relations: [{ code: 'CUSTOMER_ORDER', name: '客户下单', sourceEntityCode: 'BUSINESS_CUSTOMER', targetEntityCode: 'BUSINESS_ORDER', cardinality: 'ONE_TO_MANY' }] }, logical: { entities, relations: [], keys: [], businessRules: [] }, physical: { tables: entities.map(e => ({ code: e.code === 'ORDER' ? 'ORDERS' : 'CUSTOMERS', name: e.name + '明细表', engineType: 'MYSQL', logicalEntityCode: e.code, fields: e.attributes.map(f => ({ code: f.code, name: f.name, dataType: f.dataType, nullable: f.nullable, logicalEntityCode: e.code, logicalAttributeCode: f.code })), partitions: [], indexes: [], constraints: [] })) }, sourceEvidence: { grains: [], fields: [] } } as DesignView;
|
||||
export const rule = { ruleId: '9007199254740997', ruleName: '订单金额完整性', objectFqn: 'demo.trade.orders', targetColumn: 'amount' } as unknown as RuleVO;
|
||||
export const validations = Array.from({ length: 16 }, (_, i) => ({ validationId: String(9000 + i), requestId: 'fixture-' + i, ruleId: rule.ruleId, snapshotId: i < 9 ? '4' : '5', configSha256: (i < 9 ? 'a' : 'b').repeat(64), status: i === 15 ? 'UNKNOWN' : i === 11 ? 'FAILED' : i === 6 || i === 8 ? 'FAILED' : 'SUCCEEDED', observedValue: i === 15 || i === 11 ? undefined : [0, 0, 1, 0, 2, 1, 8, 1, 9, 0, 1, 0, 0, 1, 0, 0][i], thresholdOperator: 'LE', thresholdValue: 2, violationCount: i === 6 || i === 8 ? 1 : 0, evidenceRef: i === 15 ? undefined : 'fixture-evidence-' + i, errorCode: i === 11 ? 'SOURCE_TIMEOUT' : i === 6 || i === 8 ? 'QUALITY_RULE_THRESHOLD_NOT_MET' : undefined, observedAt: i === 15 ? undefined : `2026-10-${String(14 + Math.floor(i / 2)).padStart(2, '0')}T${i % 2 ? '16' : '09'}:00:00`, createdAt: `2026-10-${String(14 + Math.floor(i / 2)).padStart(2, '0')}T${i % 2 ? '16' : '09'}:00:00` })).toReversed() as unknown as ValidationHistory[];
|
||||
export const tree = [{ catalogId: '101', catalogName: '企业数据资产', catalogCode: 'ENTERPRISE', status: 'PUBLISHED', children: [{ catalogId: '102', parentId: '101', catalogName: '交易域', catalogCode: 'TRADE', status: 'PUBLISHED', children: [{ catalogId: '105', parentId: '102', catalogName: '订单主题', catalogCode: 'ORDER', status: 'PUBLISHED' }, { catalogId: '106', parentId: '102', catalogName: '支付主题', catalogCode: 'PAYMENT', status: 'DRAFT' }] }, { catalogId: '103', parentId: '101', catalogName: '客户域', catalogCode: 'CUSTOMER', status: 'PUBLISHED' }, { catalogId: '104', parentId: '101', catalogName: '经营分析', catalogCode: 'ANALYTICS', status: 'DRAFT' }] }] as unknown as AssetCatalogTreeNode[];
|
||||
export const portfolio = { node: { catalogId: '102', catalogName: '交易域', description: '交易数据、分析报表与服务接口的统一资产目录' }, assets: ['TABLE','TABLE','TABLE','DATASET','REPORT','API','MODEL','FILE'].map((type,i)=>({catalogAssetId:String(i),assetName:['订单明细','支付流水','订单归档','交易分析数据集','交易日报','订单查询服务','交易主题模型','对账文档'][i],assetType:type,assetFqn:'demo.trade.asset_'+i,assetRef:'asset-'+i,reliable:i!==2,observedAt:'2026-10-21T08:30:00'})), publications:[],permissions:[],trajectories:[] } as unknown as AssetCatalogDetail;
|
||||
export const lifecycle = { asset: { lifecycleId:'9007199254740997',name:'订单明细数据资产',assetRef:'demo.trade.orders',status:'ACTIVE',currentBusinessVersion:3 }, currentSnapshot: { name:'订单明细数据资产',assetRef:'demo.trade.orders',responsibilities:[],governanceAttributes:[] }, versions:[],snapshots:[],reviews:[{reviewId:'r2',reviewType:'CHANGE',decision:'APPROVED',reason:'已补充责任人及质量规则,批准变更',snapshotId:'s3',snapshot:{name:'订单明细数据资产',assetRef:'demo.trade.orders'},producedBusinessVersion:3,createTime:'2026-10-21T10:00:00'},{reviewId:'r1',reviewType:'CHANGE',decision:'REJECTED',reason:'质量证据尚不完整,请补充后重新提交',snapshotId:'s2',snapshot:{name:'订单明细数据资产',assetRef:'demo.trade.orders'},createTime:'2026-10-20T09:30:00'}],impacts:[],notifications:[],trajectories:[{trajectoryId:'t2',summary:'变更审核通过',beforeStatus:'ACTIVE',afterStatus:'ACTIVE',createTime:'2026-10-21T10:00:00'},{trajectoryId:'t1',summary:'首次发布生效',beforeStatus:'DRAFT',afterStatus:'ACTIVE',createTime:'2026-10-19T09:30:00'}] } as unknown as AssetLifecycleDetail;
|
||||
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>治理可视化 · 合成数据检查</title></head><body><div id="app"></div><script type="module" src="/main.ts"></script></body></html>
|
||||
@@ -0,0 +1,7 @@
|
||||
import { createApp } from 'vue';
|
||||
import ElementPlus from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/assets/styles/index.scss';
|
||||
import App from './App.vue';
|
||||
createApp(App).use(ElementPlus).directive('hasPermi', {}).component('Pagination', { render: () => null }).mount('#app');
|
||||
@@ -0,0 +1,15 @@
|
||||
import type { ProfileDetail, ColumnProfile } from '@/api/datagov/data-profile/types';
|
||||
const field = (column: string, dataType: string, nulls: number, distinct: number, extra: Partial<ColumnProfile> = {}): ColumnProfile => ({ column, dataType, nullCount: String(nulls), nullRate: nulls / 128000, distinctCount: String(distinct), distinctRate: distinct / 128000, topValues: [], patterns: [], ...extra });
|
||||
export const profileSnapshot: NonNullable<ProfileDetail['snapshot']> = {
|
||||
snapshotId: 5001, requestId: 4001, attemptId: 6001, rowCount: '128000', observedAt: '2026-10-22T10:42:18',
|
||||
columns: [
|
||||
field('customer_email', 'VARCHAR', 24320, 98240, { minimum: 'sample-a@example.invalid', maximum: 'sample-z@example.invalid', topValues: [{ value: 'service@example.invalid', count: '3200' }, { value: 'guest@example.invalid', count: '2100' }, { value: '', count: '1400' }, { value: 'sales@example.invalid', count: '680' }, { value: 'support@example.invalid', count: '420' }], patterns: [{ pattern: 'EMAIL', count: 760 }, { pattern: 'NULL', count: 190 }, { pattern: 'EMPTY', count: 35 }, { pattern: 'TEXT', count: 15 }] }),
|
||||
field('region', 'VARCHAR', 6400, 8, { minimum: '东北', maximum: '西部', topValues: [{ value: '华东', count: 46000 }, { value: '华南', count: 32000 }, { value: '华北', count: 21000 }, { value: '西南', count: 11200 }, { value: '华中', count: 6400 }, { value: '东北', count: 2800 }, { value: '西北', count: 1800 }, { value: '其他', count: 400 }], patterns: [{ pattern: 'TEXT', count: 950 }, { pattern: 'NULL', count: 50 }] }),
|
||||
field('order_amount', 'DECIMAL', 1280, 85432, { minimum: '0.00', maximum: '26840.50', average: '684.52', standardDeviation: '1253.18', topValues: [{ value: '99.00', count: 8240 }, { value: '199.00', count: 3860 }, { value: '299.00', count: 2140 }, { value: '59.90', count: 1580 }], patterns: [{ pattern: 'DECIMAL', count: 990 }, { pattern: 'NULL', count: 10 }] }),
|
||||
field('order_id', 'BIGINT', 0, 128000, { minimum: '100000', maximum: '227999', patterns: [{ pattern: 'INTEGER', count: 1000 }] }),
|
||||
field('created_at', 'TIMESTAMP', 0, 121600, { patterns: [{ pattern: 'TIMESTAMP', count: 1000 }] }),
|
||||
field('is_active', 'BOOLEAN', 0, 2, { topValues: [{ value: 'true', count: 116800 }, { value: 'false', count: 11200 }], patterns: [{ pattern: 'BOOLEAN', count: 1000 }] })
|
||||
]
|
||||
};
|
||||
export const emptyProfileSnapshot = { ...profileSnapshot, snapshotId: 5002, rowCount: 0, columns: [field('empty_field', 'VARCHAR', 0, 0)] };
|
||||
export const invalidProfileSnapshot = { ...profileSnapshot, snapshotId: 5003, columns: [field('inconsistent_count', 'VARCHAR', 200000, 10, { topValues: [{ value: 'invalid', count: '-2' }], patterns: [{ pattern: 'TEXT', count: 1001 }] })] };
|
||||
@@ -0,0 +1,27 @@
|
||||
import { reactive } from 'vue';
|
||||
import type { PlanVO, RepairVO, AttemptVO, TimelineVO } from '../src/api/datagov/quality-remediation/types';
|
||||
export const remediationScenario = reactive({ failPlan: false, failAttempts: false, delayAttempts: false, noRepairs: false });
|
||||
const labels = ['订单手机号空值修复', '客户证件格式规范', '交易金额重复记录', '客户归属字段缺失', '指标口径修正', '商品编码重复', '账期字段一致性'];
|
||||
export const remediationPlans: PlanVO[] = labels.map((title, i) => ({ planId: String(9007199254741101n + BigInt(i)), planNo: `ZG-20261022-00${i + 1}`, issueLogicalId: `issue:${i + 1}`, issueDisplaySnapshot: title, rootCauseLogicalId: `root:${i + 1}`, rootCauseDisplaySnapshot: '增量任务字段映射遗漏,历史分区未覆盖', rootCauseEvidenceSha: 'a'.repeat(64), cause: '业务字段已新增,但旧增量任务仍使用早期映射。', measure: '校正字段映射并补录历史分区\n重新执行质量规则,保留修复前后和验证快照', ownerLogicalId: 'user:fixture', dueDate: '2026-10-28', verificationMethod: '按同一目标与冻结配置复测,核对修复后和验证证据', status: (['OPEN', 'ASSIGNED', 'PROCESSING', 'PROCESSING', 'RESOLVED', 'VERIFIED', 'CLOSED'] as const)[i], version: 4, updateTime: '2026-10-22T08:40:00' }));
|
||||
const slicePage = <T>(rows: T[], params: { pageNum?: number; pageSize?: number }) => ({ data: { rows: rows.slice(((params.pageNum || 1) - 1) * (params.pageSize || 20), (params.pageNum || 1) * (params.pageSize || 20)), total: rows.length } });
|
||||
export async function getPlan(id: string | number) { if (remediationScenario.failPlan) { remediationScenario.failPlan = false; throw new Error('合成场景:计划读取失败'); } const plan = remediationPlans.find(p => p.planId === String(id)); if (!plan) throw new Error('合成场景:计划不可见'); return { data: { ...plan } }; }
|
||||
export async function pageRepairs(planId: string | number, params: { pageNum?: number; pageSize?: number }) {
|
||||
const rows: RepairVO[] = [0, 1].map(i => ({ repairRequestId: String(9007199254742101n + BigInt(i)), planId, repairType: i ? 'MANUAL' : 'DATAOPS_JOB', targetLogicalId: 'table:order-detail', actionReference: i ? 'manual:historical-partition' : 'job:order-field-repair', attemptStatus: 'NOT_SUBMITTED', beforeSourceId: 'validation:before', beforeSha: 'a'.repeat(64), afterState: 'RELIABLE', afterSourceId: 'validation:after', afterSha: 'b'.repeat(64), verificationState: i ? 'RELIABLE' : 'UNKNOWN', verificationSourceId: i ? 'validation:verify' : undefined, verificationSha: i ? 'c'.repeat(64) : undefined, version: 3, createTime: '2026-10-22T08:30:00' }));
|
||||
return slicePage(remediationScenario.noRepairs ? [] : rows, params);
|
||||
}
|
||||
export async function pageRepairAttempts(_planId: string | number, repairId: string | number, params: { pageNum?: number; pageSize?: number }) {
|
||||
if (remediationScenario.delayAttempts) await new Promise(resolve => setTimeout(resolve, 3500));
|
||||
if (remediationScenario.failAttempts) { remediationScenario.failAttempts = false; throw new Error('合成场景:执行尝试读取失败'); }
|
||||
const rows: AttemptVO[] = String(repairId).endsWith('2102') ? [] : ['UNKNOWN', 'SUCCEEDED'].map((status, i) => ({ attemptId: String(9007199254743102n - BigInt(i)), repairRequestId: repairId, repairType: 'DATAOPS_JOB', actionReference: 'job:order-field-repair', status: status as AttemptVO['status'], fresh: false, platformRunId: String(9007199254744102n - BigInt(i)), sourceStatus: i ? 'SUCCESS' : 'UNKNOWN', errorCode: i ? undefined : 'OBSERVATION_UNAVAILABLE', observedAt: i ? '2026-10-21T17:20:00' : undefined, version: 2, createdAt: i ? '2026-10-21T17:00:00' : '2026-10-22T08:35:00' }));
|
||||
return slicePage(rows, params);
|
||||
}
|
||||
export async function pagePlanTimeline(planId: string | number, params: { pageNum?: number; pageSize?: number }) {
|
||||
const rows: TimelineVO[] = [
|
||||
{ eventType: 'REVIEWED', beforeStatus: 'RESOLVED', afterStatus: 'PROCESSING', summary: '验证证据仍缺失,复核退回补充;保留此前修复结果。' },
|
||||
{ eventType: 'STATUS_CHANGED', beforeStatus: 'PROCESSING', afterStatus: 'RESOLVED', summary: '责任人提交复核。' },
|
||||
{ eventType: 'SNAPSHOT_ADDED', summary: '修复后快照已登记,验证来源暂不可用。' },
|
||||
{ eventType: 'REPAIR_REQUESTED', beforeStatus: 'ASSIGNED', afterStatus: 'PROCESSING', summary: '登记数据开发任务修复请求。' },
|
||||
{ eventType: 'CREATED', afterStatus: 'OPEN', summary: '计划已关联质量问题与已确认根因。' }
|
||||
].map((r, i) => ({ ...r, timelineId: String(9007199254745105n - BigInt(i)), planId, actorId: '9007199254746101', createTime: `2026-10-22T0${8 - i}:00:00` }));
|
||||
return slicePage(rows, params);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
import { reactive } from 'vue';
|
||||
const user = reactive({ userId: '9007199254740101', deptId: '9007199254740102', permissions: ['*:*:*'], roles: [] });
|
||||
export const useUserStore = () => user;
|
||||
@@ -0,0 +1,14 @@
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
const root = process.cwd();
|
||||
export default { root: root + '/.governance-review', plugins: [vue()], resolve: { alias: [
|
||||
{ find: /^@\/api\/datagov\/quality-remediation$/, replacement: root + '/.governance-review/remediation.ts' },
|
||||
{ find: /^@\/api\/datagov\/quality-rule\/observations$/, replacement: root + '/.governance-review/aggregates.ts' },
|
||||
{ find: /^@\/api\/datagov\/asset-catalog\/overview$/, replacement: root + '/.governance-review/catalogIdentities.ts' },
|
||||
{ find: /^@\/api\/datagov\/asset-catalog\/identity$/, replacement: root + '/.governance-review/catalogIdentities.ts' },
|
||||
{ find: /^@\/api\/datagov\/asset-catalog\/summary$/, replacement: root + '/.governance-review/catalogIdentities.ts' },
|
||||
{ find: /^@\/api\/datagov\/asset-identity$/, replacement: root + '/.governance-review/catalogIdentities.ts' },
|
||||
{ find: /^@\/store\/modules\/user$/, replacement: root + '/.governance-review/user.ts' },
|
||||
{ find: /^@\/api\/datagov\/model-design\/assist$/, replacement: root + '/.governance-review/api.ts' },
|
||||
{ find: /^@\/api\/datagov\/model-design$/, replacement: root + '/.governance-review/api.ts' },
|
||||
{ find: '@', replacement: root + '/src' }
|
||||
] }, server: { host: '127.0.0.1', port: 59645, strictPort: true, fs: { allow: [root] } } };
|
||||
在新工单中引用
屏蔽一个用户