Files
syops/frontend/src/features/admin/modules/shipping-identity-rules/ShippingIdentityRulesPage.vue
T
hugo 386f93108c feat(shipping-notice): 库存缺口料号兜底自动放行并新增料号可用量列
- 匹配器按料号二次汇总 part_available_qty 随行级匹配事实持久化(新列,迁移 0a575f3a)
- 缺口行料号总库存满足需求时系统自动放行,复用人工放行同一落库/审计/门禁链路,证据按预约优先→料号兜底自动带出
- 前端库存匹配表原「可用数量」列改为「预约数量」,其后新增「可用数量」(料号总库存)列
- DSV 连接器防误点「忘记密码」链接并参数化料号报表取数,库存 worker 按料号查询配套
- 收料就绪与来源状态联动调整;casdoor 未识别认证错误日志保留原始异常堆栈
- 同步门禁/投影/持久化测试、调拨卡片文案四语言与文档
2026-10-11 17:42:55 +08:00

389 lines
28 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
features/admin/modules/shipping-identity-rules/ShippingIdentityRulesPage.vue
用途:维护引用已发布订单上下文字段的客户/送货站点识别定义,并发布不可变规则集。
依赖:规则 API、Vue Composition API、Vue I18n。
逻辑:管理员只能选择服务端提供的已发布识别字段,运行时只消费该字段的已裁决值。
-->
<script setup lang="ts">
import { computed, onMounted, reactive, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';
import { ArrowUpRight, Check, CircleDotDashed, CircleHelp, FileCheck2, Layers3, Plus, Send, Tags } from 'lucide-vue-next';
import { BusinessError } from '@/shared/api/client';
import { useMessage } from '@/shared/composables/useMessage';
import {
createShippingIdentityRuleSet,
getShippingIdentityRuleCatalog,
listShippingIdentityRuleSets,
publishShippingIdentityRuleSet,
saveShippingIdentityDefinition,
saveShippingIdentityRuleSet,
} from '@/features/admin/api/shipping-identity-rules.api';
import type { ShippingIdentityDefinition, ShippingIdentityRuleCatalog, ShippingIdentityRuleSet } from '@/features/admin/types/shipping-identity-rules.types';
const { t } = useI18n();
const router = useRouter();
const message = useMessage();
const catalog = ref<ShippingIdentityRuleCatalog | null>(null);
const ruleSets = ref<ShippingIdentityRuleSet[]>([]);
const selectedRuleSet = ref<ShippingIdentityRuleSet | null>(null);
const selectedDefinitionIds = ref<string[]>([]);
const loading = ref(false);
const saving = ref(false);
const form = reactive({
display_name: '', description: '', evidence_label: '', target_type: 'customer', context_field_id: '',
default_weight: 100, max_automation: 'none' as 'none' | 'conditional',
});
const selectedDefinitionCount = computed(() => selectedDefinitionIds.value.length);
const activeDefinitions = computed(() => catalog.value?.definitions.filter((item) => item.status === 'active') || []);
const publishedRuleSet = computed(() => ruleSets.value.find((item) => item.status === 'published') || null);
const selectedAutomation = computed(() => {
return form.max_automation;
});
/** 说明当前来源实际从何处取值和自动化边界,帮助管理员在提交前理解选择结果。 */
const selectedSourceHint = computed(() => {
const field = catalog.value?.context_fields.find((item) => item.field_id === form.context_field_id);
return field ? `${field.display_name} (${field.field_code})` : t('admin.shippingIdentityRules.selectFieldHint');
});
const sourceDisplay = (definition: { context_field?: { field_code: string; display_name?: string } | null }): string => {
return definition.context_field?.display_name || definition.context_field?.field_code || '';
};
watch(selectedRuleSet, (ruleSet) => {
selectedDefinitionIds.value = ruleSet?.definition?.definitions.map((item) => item.id) || [];
}, { immediate: true });
const showError = (error: unknown): void => {
message.error(error instanceof BusinessError ? error.message : t('admin.shippingIdentityRules.operationFailed'));
};
const load = async (): Promise<void> => {
loading.value = true;
try {
const [nextCatalog, nextRuleSets] = await Promise.all([getShippingIdentityRuleCatalog(), listShippingIdentityRuleSets()]);
catalog.value = nextCatalog;
ruleSets.value = nextRuleSets.items;
selectedRuleSet.value = nextRuleSets.items.find((item) => item.status === 'draft') || nextRuleSets.items.find((item) => item.status === 'published') || null;
} catch (error) {
showError(error);
} finally {
loading.value = false;
}
};
/**
* 将定义写接口返回的最新数据合并到本地目录,避免保存后整页重新加载并打断管理员当前操作。
* @param definition - 后端已校验并保存的识别定义。
*/
const upsertDefinition = (definition: ShippingIdentityDefinition): void => {
if (!catalog.value) return;
const index = catalog.value.definitions.findIndex((item) => item.id === definition.id);
if (index === -1) {
catalog.value.definitions = [...catalog.value.definitions, definition];
return;
}
catalog.value.definitions.splice(index, 1, definition);
};
/**
* 用规则集写接口返回的快照更新本地版本列表,保留当前页面的编辑位置和加载状态。
* @param ruleSet - 后端返回的最新规则集版本。
*/
const upsertRuleSet = (ruleSet: ShippingIdentityRuleSet): void => {
const index = ruleSets.value.findIndex((item) => item.id === ruleSet.id);
if (index === -1) {
ruleSets.value = [ruleSet, ...ruleSets.value];
return;
}
ruleSets.value.splice(index, 1, ruleSet);
};
const saveDefinition = async (): Promise<void> => {
saving.value = true;
try {
const saved = await saveShippingIdentityDefinition({ ...form });
upsertDefinition(saved);
Object.assign(form, { display_name: '', description: '', evidence_label: '', max_automation: 'none' });
message.success(t('admin.shippingIdentityRules.definitionSaved'));
} catch (error) {
showError(error);
} finally {
saving.value = false;
}
};
/** 更新已有定义的自动化授权;已发布快照不变,下一次发布规则集时才会生效。 */
const updateDefinitionAutomation = async (
definition: ShippingIdentityDefinition,
maxAutomation: 'none' | 'conditional',
): Promise<void> => {
if (definition.max_automation === maxAutomation) return;
saving.value = true;
try {
const saved = await saveShippingIdentityDefinition({
definition_code: definition.definition_code,
display_name: definition.display_name,
description: definition.description,
evidence_label: definition.evidence_label,
target_type: definition.target_type,
context_field_id: definition.context_field_id,
default_weight: definition.default_weight,
max_automation: maxAutomation,
}, definition.id);
upsertDefinition(saved);
message.success(t('admin.shippingIdentityRules.definitionSaved'));
} catch (error) {
showError(error);
} finally {
saving.value = false;
}
};
const createDraft = async (): Promise<void> => {
saving.value = true;
try {
const draft = await createShippingIdentityRuleSet({
copy_from_rule_set_id: ruleSets.value.find((item) => item.status === 'published')?.id,
});
upsertRuleSet(draft);
selectedRuleSet.value = draft;
} catch (error) {
showError(error);
} finally {
saving.value = false;
}
};
const saveDraft = async (): Promise<void> => {
if (!selectedRuleSet.value || selectedRuleSet.value.status !== 'draft' || !catalog.value) return;
saving.value = true;
try {
const saved = await saveShippingIdentityRuleSet(selectedRuleSet.value.id, {
expected_lock_version: selectedRuleSet.value.lock_version,
definition_ids: selectedDefinitionIds.value,
});
upsertRuleSet(saved);
selectedRuleSet.value = saved;
message.success(t('admin.shippingIdentityRules.ruleSetSaved'));
} catch (error) {
showError(error);
} finally {
saving.value = false;
}
};
const publishDraft = async (): Promise<void> => {
if (!selectedRuleSet.value || selectedRuleSet.value.status !== 'draft' || !selectedDefinitionCount.value) return;
saving.value = true;
try {
// 发布必须先持久化当前勾选,避免投产上一次保存的旧规则快照。
const saved = await saveShippingIdentityRuleSet(selectedRuleSet.value.id, {
expected_lock_version: selectedRuleSet.value.lock_version,
definition_ids: selectedDefinitionIds.value,
});
const published = await publishShippingIdentityRuleSet(saved.id, saved.lock_version);
// 新发布版本会替代旧发布版本;本地同步状态而不重新装载整页。
ruleSets.value = ruleSets.value.map((item) => (
item.status === 'published' && item.id !== published.id ? { ...item, status: 'retired' } : item
));
upsertRuleSet(published);
selectedRuleSet.value = published;
message.success(t('admin.shippingIdentityRules.ruleSetPublished'));
} catch (error) {
showError(error);
} finally {
saving.value = false;
}
};
/** 发布规则集后才可维护证据,跳转保留既有工作台管理员入口。 */
const openCustomerMaster = (): void => {
router.push({ name: 'workspace-shipping-customers' });
};
onMounted(() => { void load(); });
</script>
<template>
<section class="identity-rules-page">
<header class="identity-hero">
<div>
<h1 class="section-title">{{ t('admin.shippingIdentityRules.title') }}</h1>
<p class="section-desc mt-1">{{ t('admin.shippingIdentityRules.subtitle') }}</p>
</div>
<div class="identity-hero__meta">
<div class="identity-hero__status">
<span class="identity-pulse" :class="{ 'identity-pulse--draft': !publishedRuleSet }" />
<span v-if="publishedRuleSet">V{{ publishedRuleSet.version }} · {{ t('admin.shippingIdentityRules.status.published') }}</span>
<span v-else>{{ t('admin.shippingIdentityRules.status.draft') }}</span>
</div>
<button type="button" class="btn-ghost identity-hero__link" @click="openCustomerMaster">
{{ t('admin.shippingIdentityRules.openCustomerMaster') }}<ArrowUpRight class="h-4 w-4" />
</button>
</div>
</header>
<section class="identity-flow" aria-label="workflow">
<div class="identity-flow__rail" />
<div class="identity-flow__step identity-flow__step--active"><span>01</span><div><strong>{{ t('admin.shippingIdentityRules.definitions') }}</strong><small>{{ t('admin.shippingIdentityRules.definitionHint') }}</small></div></div>
<div class="identity-flow__step"><span>02</span><div><strong>{{ t('admin.shippingIdentityRules.ruleSets') }}</strong><small>{{ t('admin.shippingIdentityRules.saveDraft') }}</small></div></div>
<div class="identity-flow__step"><span>03</span><div><strong>{{ t('admin.shippingIdentityRules.openCustomerMaster') }}</strong><small>{{ t('admin.shippingIdentityRules.workflowHint') }}</small></div></div>
</section>
<p v-if="loading" class="identity-loading"><CircleDotDashed class="h-4 w-4 animate-spin" />{{ t('admin.shippingIdentityRules.loading') }}</p>
<div v-else class="identity-workbench">
<section class="identity-panel identity-panel--definitions">
<div class="identity-panel__heading">
<div><p class="identity-panel__eyebrow"><Tags class="h-4 w-4" />{{ t('admin.shippingIdentityRules.definitions') }}</p><h3>{{ activeDefinitions.length }}</h3></div>
<p>{{ t('admin.shippingIdentityRules.definitionHint') }}</p>
</div>
<div v-if="catalog?.definitions.length" class="identity-definition-list">
<article v-for="definition in catalog.definitions" :key="definition.id" class="identity-definition-row">
<div class="identity-definition-row__icon"><Tags class="h-4 w-4" /></div>
<div class="min-w-0"><strong>{{ definition.display_name }}</strong><p>{{ definition.description || sourceDisplay(definition) }}</p></div>
<span class="identity-target">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</span>
<select class="identity-automation identity-automation-select" :class="{ 'identity-automation--enabled': definition.max_automation === 'conditional' }" :value="definition.max_automation" :disabled="saving" @change="updateDefinitionAutomation(definition, ($event.target as HTMLSelectElement).value as 'none' | 'conditional')"><option value="none">{{ t('admin.shippingIdentityRules.automations.none') }}</option><option value="conditional">{{ t('admin.shippingIdentityRules.automations.conditional') }}</option></select>
</article>
</div>
<div v-else class="identity-empty"><Tags class="h-5 w-5" /><span>{{ t('admin.shippingIdentityRules.definitionHint') }}</span></div>
<form class="identity-definition-form" @submit.prevent="saveDefinition">
<div class="identity-form-title"><Plus class="h-4 w-4" /><strong>{{ t('admin.shippingIdentityRules.addDefinition') }}</strong></div>
<p class="identity-form-guide">{{ t('admin.shippingIdentityRules.formGuide') }}</p>
<label><span>{{ t('admin.shippingIdentityRules.displayName') }}</span><input v-model="form.display_name" required class="input-field" :placeholder="t('admin.shippingIdentityRules.displayNamePlaceholder')"></label>
<label><span>{{ t('admin.shippingIdentityRules.selectField') }}</span><select v-model="form.context_field_id" required class="input-field"><option value="">{{ t('admin.shippingIdentityRules.selectField') }}</option><option v-for="field in catalog?.context_fields" :key="field.field_id" :value="field.field_id">{{ field.display_name }}</option></select></label>
<label><span>{{ t('admin.shippingIdentityRules.target') }}</span><select v-model="form.target_type" class="input-field"><option value="customer">{{ t('admin.shippingIdentityRules.targets.customer') }}</option><option value="site">{{ t('admin.shippingIdentityRules.targets.site') }}</option></select></label>
<label><span>{{ t('admin.shippingIdentityRules.evidenceLabel') }}</span><input v-model="form.evidence_label" required class="input-field" :placeholder="t('admin.shippingIdentityRules.evidenceLabelPlaceholder')"></label>
<label><span>{{ t('admin.shippingIdentityRules.description') }}</span><input v-model="form.description" class="input-field" :placeholder="t('admin.shippingIdentityRules.descriptionPlaceholder')"></label>
<label><span class="identity-label-with-tip">{{ t('admin.shippingIdentityRules.automationPolicy') }}<CircleHelp class="identity-label-tip" :title="t('admin.shippingIdentityRules.automationPolicyHint')" :aria-label="t('admin.shippingIdentityRules.automationPolicyHint')" /></span><select v-model="form.max_automation" class="input-field"><option value="none">{{ t('admin.shippingIdentityRules.automations.none') }}</option><option value="conditional">{{ t('admin.shippingIdentityRules.automations.conditional') }}</option></select></label>
<div class="identity-source-help"><strong>{{ t('admin.shippingIdentityRules.selectionResult') }}</strong><span>{{ selectedSourceHint }}</span><small>{{ t(`admin.shippingIdentityRules.automations.${selectedAutomation}`) }}</small></div>
<button type="submit" class="btn-primary identity-definition-form__submit" :disabled="saving || !form.context_field_id"><Plus class="h-4 w-4" />{{ t('admin.shippingIdentityRules.addDefinition') }}</button>
</form>
</section>
<aside class="identity-panel identity-panel--publication">
<div class="identity-publication__header">
<div class="identity-panel__eyebrow"><Layers3 class="h-4 w-4" />{{ t('admin.shippingIdentityRules.ruleSets') }}</div>
<button type="button" class="btn-ghost btn-sm" :disabled="saving" @click="createDraft"><Plus class="h-4 w-4" />{{ t('admin.shippingIdentityRules.createDraft') }}</button>
</div>
<p class="identity-publication__hint">{{ t('admin.shippingIdentityRules.ruleSetHint') }}</p>
<div class="identity-version-list">
<button v-for="item in ruleSets" :key="item.id" type="button" class="identity-version" :class="{ 'identity-version--selected': selectedRuleSet?.id === item.id }" @click="selectedRuleSet = item">
<span>V{{ item.version }}</span><small>{{ t(`admin.shippingIdentityRules.status.${item.status}`) }}</small>
</button>
</div>
<div v-if="selectedRuleSet?.status === 'draft'" class="identity-selection">
<div class="identity-selection__heading"><span>{{ t('admin.shippingIdentityRules.definitions') }}</span><strong>{{ selectedDefinitionCount }}/{{ activeDefinitions.length }}</strong></div>
<label v-for="definition in activeDefinitions" :key="definition.id" class="identity-check-row">
<input v-model="selectedDefinitionIds" type="checkbox" :value="definition.id"><span>{{ definition.display_name }}</span><small>{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</small>
</label>
</div>
<div v-else-if="selectedRuleSet" class="identity-published-definitions">
<div class="identity-selection__heading"><span>{{ t('admin.shippingIdentityRules.publishedDefinitions') }}</span><strong>{{ selectedRuleSet.definition?.definitions.length || 0 }}</strong></div>
<div v-if="selectedRuleSet.definition?.definitions.length" class="identity-published-definition-list">
<div v-for="definition in selectedRuleSet.definition.definitions" :key="definition.id" class="identity-published-definition">
<div><strong>{{ definition.display_name }}</strong><small>{{ definition.context_field?.display_name || definition.context_field?.field_code || '-' }}</small></div>
<span class="identity-target">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</span>
<span class="identity-automation" :class="{ 'identity-automation--enabled': definition.max_automation === 'conditional' }">{{ t(`admin.shippingIdentityRules.automations.${definition.max_automation}`) }}</span>
</div>
</div>
<p v-else class="identity-published-empty">{{ t('admin.shippingIdentityRules.publishedDefinitionsEmpty') }}</p>
</div>
<div v-if="selectedRuleSet" class="identity-publication__actions">
<template v-if="selectedRuleSet.status === 'draft'">
<button type="button" class="btn-ghost" :disabled="saving || !selectedDefinitionCount" @click="saveDraft"><FileCheck2 class="h-4 w-4" />{{ t('admin.shippingIdentityRules.saveDraft') }}</button>
<button type="button" class="btn-primary" :disabled="saving || !selectedDefinitionCount" @click="publishDraft"><Send class="h-4 w-4" />{{ t('admin.shippingIdentityRules.publish') }}</button>
</template>
<div v-else class="identity-published"><Check class="h-4 w-4" /><span>{{ t('admin.shippingIdentityRules.status.published') }}</span><code>{{ selectedRuleSet.checksum || '-' }}</code></div>
</div>
</aside>
</div>
</section>
</template>
<style scoped>
.identity-rules-page { max-width: 1380px; margin: 0 auto; display: grid; gap: 1.25rem; color: #183253; }
.identity-hero { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding: .5rem .25rem .75rem; }
.identity-panel__eyebrow { display: flex; align-items: center; gap: .45rem; color: #475569; font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.identity-hero h1 { margin: 0; }
.identity-hero p { max-width: 760px; }
.identity-hero__meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
/* 状态/品牌色统一 Tailwind 标准语义值(brand=sky 系 #0284c7、启用=green、草稿=amber),不再使用自造蓝绿 */
.identity-hero__status { display: inline-flex; align-items: center; gap: .48rem; padding: .5rem .75rem; border: 1px solid #bae6fd; border-radius: 999px; background: #f0f9ff; color: #0369a1; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.identity-pulse { width: .5rem; height: .5rem; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px #d1fae5; }.identity-pulse--draft { background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
.identity-hero__link { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.identity-flow { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; padding: 1rem; overflow: hidden; border: 1px solid #dce9f2; border-radius: 1rem; background: linear-gradient(105deg, #f4fbff, #fff); }
.identity-flow__rail { position: absolute; top: 1.84rem; left: 12%; right: 12%; height: 1px; background: #cce5f2; }
.identity-flow__step { position: relative; z-index: 1; display: flex; gap: .75rem; align-items: flex-start; min-width: 0; }
.identity-flow__step > span { display: grid; place-items: center; flex: 0 0 1.65rem; height: 1.65rem; border: 1px solid #b9d8e8; border-radius: 50%; background: #fff; color: #6b8298; font-size: .66rem; font-weight: 800; }
.identity-flow__step--active > span { border-color: #0284c7; background: #0284c7; color: #fff; box-shadow: 0 0 0 4px #e0f2fe; }
.identity-flow strong { display: block; color: #193652; font-size: .82rem; font-weight: 800; }
.identity-flow small { display: -webkit-box; overflow: hidden; margin-top: .15rem; color: #7a8fa6; font-size: .72rem; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.identity-loading { display: flex; align-items: center; gap: .5rem; padding: 2rem; color: #6f839b; font-size: .9rem; }
.identity-workbench { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 1.25rem; align-items: start; }
.identity-panel { border: 1px solid #dce8f0; border-radius: 1rem; background: #fff; box-shadow: 0 10px 28px rgba(32, 78, 114, .055); }
.identity-panel--definitions { overflow: hidden; }
.identity-panel__heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem 1rem; border-bottom: 1px solid #edf3f7; }
.identity-panel__heading h3 { margin: .2rem 0 0; color: #12395a; font-size: 2rem; font-weight: 800; line-height: 1; }
.identity-panel__heading > p { max-width: 28rem; color: #71879e; font-size: .78rem; line-height: 1.55; text-align: right; }
.identity-definition-list { display: grid; }
.identity-definition-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .78rem 1.35rem; border-bottom: 1px solid #edf3f7; transition: background .18s ease; }
.identity-definition-row:hover { background: #f7fbfd; }
.identity-definition-row__icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: #f0f9ff; color: #0284c7; }
.identity-definition-row strong { color: #1a3856; font-size: .86rem; font-weight: 750; }
.identity-definition-row p { overflow: hidden; margin-top: .18rem; color: #8194a8; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.identity-target, .identity-automation { padding: .32rem .52rem; border-radius: 999px; background: #f1f5f8; color: #677f98; font-size: .7rem; white-space: nowrap; }
.identity-automation-select { border: 1px solid #dce8ef; cursor: pointer; }
.identity-automation--enabled { background: #dcfce7; color: #15803d; }
.identity-empty { display: flex; align-items: center; gap: .55rem; min-height: 5.5rem; padding: 1.2rem 1.35rem; color: #7c91a7; font-size: .82rem; }
.identity-definition-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; padding: 1.1rem 1.35rem 1.35rem; background: linear-gradient(135deg, #f7fbfd 0%, #f3f9fc 100%); }
.identity-form-title { grid-column: 1 / -1; display: flex; align-items: center; gap: .42rem; color: #173857; font-size: .85rem; }
.identity-form-guide { grid-column: 1 / -1; margin: -.45rem 0 .1rem; color: #73889e; font-size: .75rem; line-height: 1.55; }
.identity-definition-form label { display: grid; gap: .35rem; color: #667f99; font-size: .72rem; font-weight: 700; }
.identity-label-with-tip { display: inline-flex; align-items: center; gap: .28rem; }
.identity-label-tip { width: .9rem; height: .9rem; color: #7d93a8; cursor: help; }
.identity-label-tip:focus-visible { border-radius: 50%; outline: 2px solid #7dd3fc; outline-offset: 2px; }
.identity-definition-form label small { color: #8295a8; font-size: .67rem; font-weight: 500; line-height: 1.35; }
.identity-definition-form .input-field, .identity-static-field { box-sizing: border-box; min-width: 0; height: 2.75rem; padding: 0 .8rem; border-color: #d9e7ef; background: #fff; font-size: .83rem; line-height: 1.25; }
.identity-definition-form select.input-field { padding-top: 0; padding-bottom: 0; line-height: 2.75rem; }
.identity-static-field { display: flex; align-items: center; padding: 0 .8rem; border: 1px solid #d9e7ef; border-radius: .65rem; color: #5f7893; }
.identity-source-help { display: grid; align-content: center; gap: .12rem; min-height: 2.75rem; padding: .48rem .7rem; border: 1px solid #d6eaf5; border-radius: .65rem; background: #edf8fe; color: #537189; font-size: .69rem; line-height: 1.35; }
.identity-source-help strong { color: #0369a1; font-size: .72rem; }.identity-source-help small { color: #16a34a; font-size: .68rem; }
.identity-definition-form__submit { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; align-self: end; min-height: 2.5rem; }
.identity-panel--publication { position: sticky; top: 1rem; padding: 1.25rem; }
.identity-publication__header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.identity-publication__header .btn-ghost, .identity-publication__actions button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.identity-publication__hint { margin: .75rem 0 1rem; color: #75899f; font-size: .78rem; line-height: 1.6; }
.identity-version-list { display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: 1rem; border-bottom: 1px solid #e9f0f4; }
.identity-version { display: inline-flex; align-items: center; gap: .35rem; padding: .46rem .6rem; border: 1px solid #dbe7ee; border-radius: .6rem; background: #fff; color: #668099; font-size: .73rem; transition: all .18s ease; }
.identity-version:hover, .identity-version--selected { border-color: #0284c7; background: #f0f9ff; color: #0369a1; }
.identity-version span { font-weight: 800; }.identity-version small { font-size: .68rem; }
.identity-selection { margin: 1rem 0; }
.identity-published-definitions { margin: 1rem 0; }
.identity-published-definition-list { display: grid; gap: .45rem; }
.identity-published-definition { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; align-items: center; padding: .58rem .65rem; border: 1px solid #e5eef3; border-radius: .6rem; background: #fbfdfe; }
.identity-published-definition strong, .identity-published-definition small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-published-definition strong { color: #294660; font-size: .76rem; }
.identity-published-definition small { margin-top: .15rem; color: #8194a8; font-size: .68rem; }
.identity-published-empty { margin: 0; color: #8194a8; font-size: .76rem; }
.identity-selection__heading { display: flex; justify-content: space-between; margin-bottom: .6rem; color: #274563; font-size: .78rem; font-weight: 750; }
.identity-selection__heading strong { color: #0284c7; }
.identity-check-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .54rem 0; border-bottom: 1px dashed #e2ebf1; color: #37516c; font-size: .78rem; }
/* @tailwindcss/forms 接管原生 checkbox 后 accent-color 无效:勾选填充取 currentColor,用 color 指定选中蓝 */
.identity-check-row input { color: #0284c7; }.identity-check-row small { color: #8496a8; font-size: .68rem; }
.identity-publication__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; padding-top: 1rem; }
.identity-publication__actions .btn-primary, .identity-publication__actions .btn-ghost { min-width: 0; font-size: .79rem; }
.identity-published { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: .45rem; padding: .7rem; border-radius: .65rem; background: #dcfce7; color: #15803d; font-size: .78rem; font-weight: 700; }.identity-published code { overflow: hidden; color: #16a34a; font-size: .67rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 980px) { .identity-workbench { grid-template-columns: 1fr; }.identity-panel--publication { position: static; }.identity-hero { align-items: flex-start; flex-direction: column; gap: .85rem; }.identity-hero__meta { justify-content: flex-start; }.identity-flow__rail { display: none; } }
@media (max-width: 700px) { .identity-rules-page { gap: 1rem; }.identity-flow { grid-template-columns: 1fr; }.identity-definition-form { grid-template-columns: 1fr; }.identity-definition-row { grid-template-columns: auto minmax(0, 1fr); }.identity-target, .identity-automation { justify-self: start; }.identity-panel__heading { align-items: flex-start; flex-direction: column; }.identity-panel__heading > p { text-align: left; }.identity-definition-row__icon { grid-row: span 2; }.identity-publication__actions { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .identity-definition-row, .identity-version { transition: none; } }
</style>