feat: 统一两端界面并扩展受权限约束的AI助手
This commit is contained in:
1 parent
79a31ebe9d
commit
0b35a58f07
141 files changed
+7999
-2213
No files matched your search
@@ -0,0 +1,232 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { PERMISSION_LABELS, type PermissionKey } from '@classhelper/shared';
|
||||
const props = withDefaults(defineProps<{ value: unknown; depth?: number }>(), { depth: 0 });
|
||||
const labels: Record<string, string> = {
|
||||
id: '记录标识',
|
||||
name: '名称',
|
||||
version: '版本',
|
||||
fileName: '文件',
|
||||
notes: '说明',
|
||||
current: '当前登记',
|
||||
file: '缓存文件',
|
||||
fileReady: '文件可用',
|
||||
title: '标题',
|
||||
content: '内容',
|
||||
classId: '班级',
|
||||
className: '班级',
|
||||
courseId: '科目',
|
||||
courseName: '科目',
|
||||
studentId: '学生',
|
||||
studentName: '学生',
|
||||
teacherId: '教师',
|
||||
username: '工号',
|
||||
role: '角色',
|
||||
grade: '年级',
|
||||
studentNo: '学号',
|
||||
examName: '考试',
|
||||
score: '分数',
|
||||
level: '等级',
|
||||
startTime: '开始',
|
||||
endTime: '结束',
|
||||
date: '日期',
|
||||
assignDate: '所属日期',
|
||||
archiveDate: '归档日期',
|
||||
points: '时间点',
|
||||
entries: '课程安排',
|
||||
columns: '列',
|
||||
rows: '数据',
|
||||
previewRows: '预览',
|
||||
suggestedMapping: '字段对应',
|
||||
warnings: '提示',
|
||||
errors: '问题',
|
||||
size: '大小',
|
||||
mode: '方式',
|
||||
priority: '优先级',
|
||||
classIds: '目标班级',
|
||||
count: '数量',
|
||||
totalRows: '总行数',
|
||||
countInTotal: '计入总分',
|
||||
isEnabled: '启用',
|
||||
weekday: '星期',
|
||||
weekStart: '起始周',
|
||||
weekEnd: '结束周',
|
||||
timeLayoutId: '时间表',
|
||||
timeLayoutItemId: '时间点',
|
||||
kind: '类型',
|
||||
message: '结果',
|
||||
createdAt: '创建时间',
|
||||
keys: '功能权限',
|
||||
scope: '范围',
|
||||
scopeValue: '范围值',
|
||||
assignments: '岗位分配',
|
||||
teacher: '教师',
|
||||
classes: '可见班级',
|
||||
nameBefore: '修改前',
|
||||
nameAfter: '修改后',
|
||||
};
|
||||
const hidden =
|
||||
/password|secret|token|api.?key|storagePath|contentBase64|sha256|^id$|Ids?$|^fields$|^mapping$|^suggestedMapping$|^templateCsv$/i;
|
||||
const fileTable = computed(() => {
|
||||
const value = props.value as
|
||||
| { columns?: string[]; rows?: string[][]; errors?: string[]; warnings?: string[]; totalRows?: number }
|
||||
| undefined;
|
||||
return value && Array.isArray(value.columns) && Array.isArray(value.rows)
|
||||
? {
|
||||
columns: value.columns,
|
||||
rows: value.rows.map((row) =>
|
||||
Object.fromEntries(value.columns!.map((key, i) => [key, row[i] ?? ''])),
|
||||
),
|
||||
errors: value.errors ?? [],
|
||||
warnings: value.warnings ?? [],
|
||||
total: value.totalRows,
|
||||
}
|
||||
: null;
|
||||
});
|
||||
const entries = computed(() =>
|
||||
props.value && typeof props.value === 'object' && !Array.isArray(props.value)
|
||||
? Object.entries(props.value).filter(
|
||||
([key, value]) => !hidden.test(key) && value !== undefined && value !== null,
|
||||
)
|
||||
: [],
|
||||
);
|
||||
const rows = computed(() => (Array.isArray(props.value) ? props.value : []));
|
||||
const columns = computed(() =>
|
||||
[
|
||||
...new Set(
|
||||
rows.value.slice(0, 20).flatMap((row) => (row && typeof row === 'object' ? Object.keys(row) : [])),
|
||||
),
|
||||
]
|
||||
.filter(
|
||||
(key) =>
|
||||
key !== 'id' &&
|
||||
!key.endsWith('Id') &&
|
||||
!hidden.test(key) &&
|
||||
rows.value.some(
|
||||
(row) =>
|
||||
row && typeof row === 'object' && ['string', 'number', 'boolean'].includes(typeof row[key]),
|
||||
),
|
||||
)
|
||||
.slice(0, 8),
|
||||
);
|
||||
function text(value: unknown): string {
|
||||
if (value === true) return '是';
|
||||
if (value === false) return '否';
|
||||
if (value === null || value === undefined) return '—';
|
||||
if (typeof value === 'object')
|
||||
return Array.isArray(value) ? `${value.length} 项` : 'name' in value ? String(value.name) : '详情';
|
||||
const label = (
|
||||
{
|
||||
ADMIN: '管理员',
|
||||
shutdown: '关机',
|
||||
restart: '重启',
|
||||
logoff: '注销',
|
||||
lock: '锁屏',
|
||||
TEACHER: '教师',
|
||||
TEACHING: '任教班级',
|
||||
HEAD: '班主任班级',
|
||||
ALL: '全校',
|
||||
GRADE: '年级',
|
||||
DIVISION: '部',
|
||||
URGENT: '紧急',
|
||||
NORMAL: '普通',
|
||||
HIGH: '重要',
|
||||
LOW: '低',
|
||||
push: '推送',
|
||||
cloud: '云端保存',
|
||||
merge: '合并',
|
||||
replace: '覆盖',
|
||||
upsert: '更新或新增',
|
||||
append: '新增',
|
||||
} as Record<string, string>
|
||||
)[String(value)];
|
||||
return label ?? PERMISSION_LABELS[String(value) as PermissionKey] ?? String(value);
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="assistant-data">
|
||||
<template v-if="fileTable">
|
||||
<p v-if="fileTable.total">共 {{ fileTable.total }} 行</p>
|
||||
<el-alert
|
||||
v-for="message in fileTable.errors"
|
||||
:key="message"
|
||||
:title="message"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
/>
|
||||
<el-alert
|
||||
v-for="message in fileTable.warnings"
|
||||
:key="message"
|
||||
:title="message"
|
||||
type="info"
|
||||
:closable="false"
|
||||
/>
|
||||
<el-table :data="fileTable.rows" max-height="360">
|
||||
<el-table-column
|
||||
v-for="key in fileTable.columns"
|
||||
:key="key"
|
||||
:prop="key"
|
||||
:label="key"
|
||||
min-width="110"
|
||||
/>
|
||||
</el-table>
|
||||
</template>
|
||||
<template v-else-if="Array.isArray(value)">
|
||||
<el-table v-if="columns.length" :data="rows.slice(0, 100)" max-height="360" empty-text="暂无记录">
|
||||
<el-table-column
|
||||
v-for="key in columns"
|
||||
:key="key"
|
||||
:label="labels[key] || key"
|
||||
min-width="100"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">{{ text(row[key]) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<ul v-else>
|
||||
<li v-for="(row, n) in rows.slice(0, 100)" :key="n">{{ text(row) }}</li>
|
||||
</ul>
|
||||
<span v-if="rows.length > 100" class="text-muted">共 {{ rows.length }} 项,展示前 100 项</span>
|
||||
</template>
|
||||
<dl v-else-if="entries.length" class="assistant-fields">
|
||||
<template v-for="[key, item] in entries" :key="key">
|
||||
<dt>{{ labels[key] || key }}</dt>
|
||||
<dd>
|
||||
<details v-if="item && typeof item === 'object' && depth < 3">
|
||||
<summary>{{ Array.isArray(item) ? `${item.length} 项` : '查看' }}</summary>
|
||||
<AssistantData :value="item" :depth="depth + 1" />
|
||||
</details>
|
||||
<span v-else>{{ text(item) }}</span>
|
||||
</dd>
|
||||
</template>
|
||||
</dl>
|
||||
<span v-else>{{ text(value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped>
|
||||
.assistant-data {
|
||||
overflow: auto;
|
||||
font-size: var(--el-font-size-base);
|
||||
}
|
||||
.assistant-fields {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(80px, 120px) minmax(0, 1fr);
|
||||
gap: 10px 16px;
|
||||
margin: 8px 0;
|
||||
}
|
||||
dt {
|
||||
color: var(--ch-ui-muted);
|
||||
}
|
||||
dd {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
summary {
|
||||
cursor: pointer;
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
ul {
|
||||
padding-left: 20px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,20 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* ClassIsland 课程表(ClassPlan)导入弹窗,支持单双周。
|
||||
* 课表导入弹窗:ClassIsland 档案 JSON + 课表 YAML 两种格式。
|
||||
*
|
||||
* 流程:粘贴 JSON / 选择 .json 文件(整份 ClassIsland 档案)
|
||||
* → 解析预览(后端解析 TimeLayouts + ClassPlans + Subjects,单双周取 WeekCountDiv/WeekCountDivTotal)
|
||||
* → 查看解析出的课程、缺失科目与校验结果 → 选择覆盖(replace) / 合并(merge) → 导入。
|
||||
* 流程:粘贴文本 / 选择 .json、.yaml、.yml 文件
|
||||
* → 自动识别格式(JSON 能解析走 ClassIsland 档案接口,否则走 YAML 接口)
|
||||
* → 解析预览(课程、单双周、缺失科目、校验结果)→ 覆盖(replace) / 合并(merge) → 导入。
|
||||
*
|
||||
* YAML 是给「手写 / 大模型生成」准备的简化格式,弹窗里内置可复制的 AI 提示词、
|
||||
* 示例 YAML(来自 shared,与服务端解析器共用同一份)与下载入口。
|
||||
*
|
||||
* 安全与一致性:
|
||||
* - JSON 语法错误、结构无法识别、没有解析出任何课程时后端返回 errors(或 400),
|
||||
* - 语法错误、结构无法识别、没有解析出任何课程时后端返回 errors(导入接口返回 400),
|
||||
* 导入按钮会被禁用/阻止,原课表不会被改成"导入一半"的脏状态;
|
||||
* - 缺失的科目在导入时由后端自动补建(预览里提前列出,避免意外建课);
|
||||
* - 权限与课表管理一致(管理员或本班班主任),科任老师看不到入口,后端亦会二次校验。
|
||||
*/
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { WEEK_PARITY_LABELS, type ClassPlanEntryDto, type ClassPlanPreviewDto } from '@classhelper/shared';
|
||||
import {
|
||||
CLASS_PLAN_YAML_AI_PROMPT,
|
||||
CLASS_PLAN_YAML_SAMPLE,
|
||||
WEEK_PARITY_LABELS,
|
||||
type ClassPlanEntryDto,
|
||||
type ClassPlanPreviewDto,
|
||||
type ClassPlanYamlEntryDto,
|
||||
type ClassPlanYamlPreviewDto,
|
||||
} from '@classhelper/shared';
|
||||
import { importApi } from '@/api';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -79,23 +90,48 @@ const CLASS_PLAN_SAMPLE = `{
|
||||
|
||||
/** 输入框提示(用常量避免模板里的引号破坏 lint 规则) */
|
||||
const TEXTAREA_PLACEHOLDER =
|
||||
'粘贴 ClassIsland 导出的档案 JSON(含 TimeLayouts / ClassPlans / Subjects),或点击「选择 .json 文件」';
|
||||
'粘贴 ClassIsland 档案 JSON(含 TimeLayouts / ClassPlans / Subjects),或课表 YAML(含 version / subjects / schedules);也可以点击「选择文件」';
|
||||
|
||||
const jsonText = ref('');
|
||||
const sourceText = ref('');
|
||||
const mode = ref<'replace' | 'merge'>('replace');
|
||||
const preview = ref<ClassPlanPreviewDto | null>(null);
|
||||
/** 预览时识别到的格式;导入按钮据此决定调哪个接口 */
|
||||
const previewFormat = ref<'json' | 'yaml' | null>(null);
|
||||
/** 文件扩展名给出的格式提示:.json 强制走 JSON 以便报"JSON 解析失败",粘贴文本时清空 */
|
||||
const sourceHint = ref<'json' | 'yaml' | null>(null);
|
||||
const aiPanel = ref<string[]>([]);
|
||||
const parsing = ref(false);
|
||||
const importing = ref(false);
|
||||
const fileInputRef = ref<HTMLInputElement>();
|
||||
let previewRevision = 0;
|
||||
|
||||
watch(visible, (value) => {
|
||||
if (value) {
|
||||
jsonText.value = '';
|
||||
sourceText.value = '';
|
||||
preview.value = null;
|
||||
previewFormat.value = null;
|
||||
sourceHint.value = null;
|
||||
mode.value = 'replace';
|
||||
aiPanel.value = [];
|
||||
}
|
||||
});
|
||||
|
||||
// 输入内容一旦变化,旧预览即失效:避免"改了文本却仍按旧预览导入"。
|
||||
watch(
|
||||
[sourceText, mode, () => props.classId, visible],
|
||||
() => {
|
||||
previewRevision += 1;
|
||||
preview.value = null;
|
||||
previewFormat.value = null;
|
||||
},
|
||||
{ flush: 'sync' },
|
||||
);
|
||||
|
||||
/** 文件选择后提示文件来源格式;手动输入时清空提示,回到内容自动识别 */
|
||||
function onManualInput(): void {
|
||||
sourceHint.value = null;
|
||||
}
|
||||
|
||||
function pickFile(): void {
|
||||
fileInputRef.value?.click();
|
||||
}
|
||||
@@ -104,22 +140,34 @@ async function onFileChange(event: Event): Promise<void> {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
if (!file) return;
|
||||
if (!/\.json$/i.test(file.name)) {
|
||||
ElMessage.warning('请选择 ClassIsland 导出的 .json 文件');
|
||||
input.value = '';
|
||||
if (file.size > 8 * 1024 * 1024) {
|
||||
ElMessage.warning('课表文件不能超过 8 MB');
|
||||
return;
|
||||
}
|
||||
const lower = file.name.toLowerCase();
|
||||
if (!/\.(json|ya?ml)$/i.test(lower)) {
|
||||
ElMessage.warning('请选择 .json / .yaml / .yml 文件');
|
||||
input.value = '';
|
||||
return;
|
||||
}
|
||||
jsonText.value = await file.text();
|
||||
sourceText.value = await file.text();
|
||||
preview.value = null;
|
||||
ElMessage.success(`已读取 ${file.name}(${jsonText.value.length} 字符),请点击「解析预览」`);
|
||||
previewFormat.value = null;
|
||||
sourceHint.value = lower.endsWith('.json') ? 'json' : 'yaml';
|
||||
ElMessage.success(
|
||||
`已读取 ${file.name}(${sourceText.value.length} 字符),请点击「解析预览」(自动识别 JSON / YAML)`,
|
||||
);
|
||||
}
|
||||
|
||||
/** JSON 语法错误由后端统一报错,这里保留原文让后端给出精确原因 */
|
||||
function parseJsonOrText(text: string): unknown {
|
||||
/** JSON 能解析就按 ClassIsland 档案处理,否则按 YAML;文件扩展名优先。 */
|
||||
function resolveFormat(): 'json' | 'yaml' {
|
||||
if (sourceHint.value) return sourceHint.value;
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
JSON.parse(sourceText.value);
|
||||
return 'json';
|
||||
} catch {
|
||||
return text;
|
||||
return 'yaml';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,10 +182,20 @@ const parityCount = computed(() => {
|
||||
return parts.join(' / ');
|
||||
});
|
||||
|
||||
/** 解析预览:把 JSON 文本或对象交给后端解析(不写库) */
|
||||
/** YAML 预览里的课表张数(同一天的单周/双周各算一张) */
|
||||
const yamlPlanCount = computed(() =>
|
||||
previewFormat.value === 'yaml' ? ((preview.value as ClassPlanYamlPreviewDto | null)?.planCount ?? 0) : 0,
|
||||
);
|
||||
|
||||
/** 有科目教室时表格才显示「地点」列,避免 JSON 预览多一列空白 */
|
||||
const showLocationColumn = computed(
|
||||
() => preview.value?.entries.some((item) => Boolean((item as ClassPlanYamlEntryDto).location)) ?? false,
|
||||
);
|
||||
|
||||
/** 解析预览:JSON / YAML 自动分流(只解析不写库) */
|
||||
async function doPreview(): Promise<void> {
|
||||
if (!jsonText.value.trim()) {
|
||||
ElMessage.warning('请先粘贴 JSON 或选择 .json 文件');
|
||||
if (!sourceText.value.trim()) {
|
||||
ElMessage.warning('请先粘贴课表内容或选择文件');
|
||||
return;
|
||||
}
|
||||
if (!props.classId) {
|
||||
@@ -145,22 +203,37 @@ async function doPreview(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const format = resolveFormat();
|
||||
const revision = previewRevision;
|
||||
const input = { classId: props.classId, mode: mode.value, text: sourceText.value };
|
||||
parsing.value = true;
|
||||
try {
|
||||
preview.value = await importApi.previewClassPlan({
|
||||
classId: props.classId,
|
||||
mode: mode.value,
|
||||
payload: parseJsonOrText(jsonText.value),
|
||||
});
|
||||
let result: ClassPlanPreviewDto;
|
||||
if (format === 'json') {
|
||||
result = await importApi.previewClassPlan({
|
||||
classId: input.classId,
|
||||
mode: input.mode,
|
||||
payload: JSON.parse(input.text),
|
||||
});
|
||||
} else {
|
||||
result = await importApi.previewYamlClassPlan(input);
|
||||
}
|
||||
if (revision !== previewRevision) return;
|
||||
preview.value = result;
|
||||
previewFormat.value = format;
|
||||
if (preview.value.errors.length > 0) {
|
||||
ElMessage.warning(`解析发现 ${preview.value.errors.length} 个问题,请修正后再导入`);
|
||||
} else {
|
||||
const extra = format === 'yaml' ? ` / ${yamlPlanCount.value} 张课表` : '';
|
||||
ElMessage.success(
|
||||
`解析成功:共 ${preview.value.entries.length} 节课${parityCount.value ? `(${parityCount.value})` : ''}`,
|
||||
`解析成功:共 ${preview.value.entries.length} 节课${extra}${parityCount.value ? `(${parityCount.value})` : ''}`,
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
} catch (error) {
|
||||
if (revision !== previewRevision) return;
|
||||
if (error instanceof SyntaxError) ElMessage.error('JSON 格式不正确,请检查文件内容');
|
||||
preview.value = null;
|
||||
previewFormat.value = null;
|
||||
} finally {
|
||||
parsing.value = false;
|
||||
}
|
||||
@@ -176,14 +249,27 @@ async function doImport(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
const format = previewFormat.value ?? resolveFormat();
|
||||
importing.value = true;
|
||||
try {
|
||||
const result = await importApi.importClassPlan({
|
||||
classId: props.classId,
|
||||
mode: mode.value,
|
||||
payload: parseJsonOrText(jsonText.value),
|
||||
});
|
||||
ElMessage.success(`${result.created} 新增 / ${result.updated} 更新`);
|
||||
if (format === 'yaml') {
|
||||
const result = await importApi.importYamlClassPlan({
|
||||
classId: props.classId,
|
||||
mode: mode.value,
|
||||
text: sourceText.value,
|
||||
});
|
||||
ElMessage.success(
|
||||
`${result.created} 新增 / ${result.updated} 更新` +
|
||||
`${result.warnings.length > 0 ? `(另有 ${result.warnings.length} 条提示)` : ''}`,
|
||||
);
|
||||
} else {
|
||||
const result = await importApi.importClassPlan({
|
||||
classId: props.classId,
|
||||
mode: mode.value,
|
||||
payload: JSON.parse(sourceText.value),
|
||||
});
|
||||
ElMessage.success(`${result.created} 新增 / ${result.updated} 更新`);
|
||||
}
|
||||
emit('imported');
|
||||
visible.value = false;
|
||||
} finally {
|
||||
@@ -192,22 +278,87 @@ async function doImport(): Promise<void> {
|
||||
}
|
||||
|
||||
function fillSample(): void {
|
||||
jsonText.value = CLASS_PLAN_SAMPLE;
|
||||
sourceHint.value = 'json';
|
||||
sourceText.value = CLASS_PLAN_SAMPLE;
|
||||
preview.value = null;
|
||||
previewFormat.value = null;
|
||||
}
|
||||
|
||||
function fillYamlSample(): void {
|
||||
sourceHint.value = 'yaml';
|
||||
sourceText.value = CLASS_PLAN_YAML_SAMPLE;
|
||||
preview.value = null;
|
||||
previewFormat.value = null;
|
||||
ElMessage.success('已填入示例 YAML,可直接点击「解析预览」');
|
||||
}
|
||||
|
||||
/** 复制文本:优先 Clipboard API,失败时退回隐藏 textarea(HTTP 内网环境也能复制) */
|
||||
async function copyText(text: string): Promise<boolean> {
|
||||
try {
|
||||
if (navigator.clipboard?.writeText) {
|
||||
await navigator.clipboard.writeText(text);
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
/* 浏览器拒绝时走下面的兜底 */
|
||||
}
|
||||
try {
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.opacity = '0';
|
||||
document.body.appendChild(textarea);
|
||||
textarea.select();
|
||||
const ok = document.execCommand('copy');
|
||||
document.body.removeChild(textarea);
|
||||
return ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyAiPrompt(): Promise<void> {
|
||||
const ok = await copyText(CLASS_PLAN_YAML_AI_PROMPT);
|
||||
if (ok) ElMessage.success('AI 提示词已复制,粘贴给大模型并附上课表内容即可');
|
||||
else ElMessage.warning('复制失败,请手动全选提示词复制');
|
||||
}
|
||||
|
||||
/** 下载示例 YAML(与「填入示例 YAML」、服务端验收解析的是同一份内容) */
|
||||
function downloadYamlSample(): void {
|
||||
const blob = new Blob([CLASS_PLAN_YAML_SAMPLE], { type: 'text/yaml;charset=utf-8' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const anchor = document.createElement('a');
|
||||
anchor.href = url;
|
||||
anchor.download = '课表导入示例.yaml';
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
anchor.remove();
|
||||
URL.revokeObjectURL(url);
|
||||
ElMessage.success('示例 YAML 已下载');
|
||||
}
|
||||
|
||||
function parityLabel(item: ClassPlanEntryDto): string {
|
||||
return WEEK_PARITY_LABELS[item.weekParity] ?? item.weekParity;
|
||||
}
|
||||
|
||||
function entryLocation(item: ClassPlanEntryDto): string {
|
||||
return (item as ClassPlanYamlEntryDto).location ?? '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-dialog v-model="visible" title="导入 ClassIsland 课程表(支持单双周)" width="860px" top="5vh">
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
title="导入课表(ClassIsland JSON / YAML)"
|
||||
width="860px"
|
||||
top="5vh"
|
||||
class="class-plan-import-dialog"
|
||||
>
|
||||
<el-alert type="info" :closable="false" show-icon class="mb-12">
|
||||
<template #title>
|
||||
支持 ClassIsland 档案 JSON(含 TimeLayouts / ClassPlans / Subjects 的 Guid 字典)。单双周由 ClassPlan
|
||||
的 WeekCountDiv / WeekCountDivTotal 决定(两条 ClassPlan = 单周 +
|
||||
双周各一节);课间(TimeType=1)会自动跳过。解析失败不会修改原有课表。
|
||||
支持两种格式,粘贴或选择文件后自动识别:① ClassIsland 档案 JSON(含 TimeLayouts / ClassPlans /
|
||||
Subjects 的 Guid 字典);② 课表 YAML(version / subjects / schedules,enable_day 1=周一 … 7=周日,
|
||||
weeks 取 all / odd / even)。单双周各一条课表,同一天的单周与双周拆成两条;解析失败不会修改原有课表。
|
||||
</template>
|
||||
</el-alert>
|
||||
|
||||
@@ -225,16 +376,47 @@ function parityLabel(item: ClassPlanEntryDto): string {
|
||||
|
||||
<div class="toolbar mb-8">
|
||||
<el-button size="small" :loading="parsing" type="primary" @click="doPreview">解析预览</el-button>
|
||||
<el-button size="small" @click="pickFile">选择 .json 文件</el-button>
|
||||
<el-button size="small" @click="fillSample">填入示例</el-button>
|
||||
<input ref="fileInputRef" type="file" accept=".json" class="hidden-input" @change="onFileChange" />
|
||||
<el-button size="small" @click="pickFile">选择文件(.json / .yaml / .yml)</el-button>
|
||||
<el-button size="small" @click="fillSample">填入示例 JSON</el-button>
|
||||
<input
|
||||
ref="fileInputRef"
|
||||
type="file"
|
||||
accept=".json,.yaml,.yml"
|
||||
class="hidden-input"
|
||||
@change="onFileChange"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-input v-model="jsonText" type="textarea" :rows="7" :placeholder="TEXTAREA_PLACEHOLDER" />
|
||||
<el-collapse v-model="aiPanel" class="ai-panel mb-8">
|
||||
<el-collapse-item name="ai" title="不会写 YAML?复制 AI 提示词,让大模型按格式生成课表">
|
||||
<div class="ai-actions mb-8">
|
||||
<el-button size="small" type="primary" @click="copyAiPrompt">复制 AI 提示词</el-button>
|
||||
<el-button size="small" @click="fillYamlSample">填入示例 YAML</el-button>
|
||||
<el-button size="small" @click="downloadYamlSample">下载示例 YAML</el-button>
|
||||
</div>
|
||||
<el-input
|
||||
:model-value="CLASS_PLAN_YAML_AI_PROMPT"
|
||||
type="textarea"
|
||||
:rows="7"
|
||||
readonly
|
||||
class="prompt-box"
|
||||
/>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
|
||||
<el-input
|
||||
v-model="sourceText"
|
||||
type="textarea"
|
||||
:rows="7"
|
||||
:placeholder="TEXTAREA_PLACEHOLDER"
|
||||
@input="onManualInput"
|
||||
/>
|
||||
|
||||
<template v-if="preview">
|
||||
<div class="preview-meta">
|
||||
<span>识别格式:{{ previewFormat === 'yaml' ? '课表 YAML' : 'ClassIsland JSON' }}</span>
|
||||
<span>解析课程:{{ preview.entries.length }} 节</span>
|
||||
<span v-if="yamlPlanCount">课表:{{ yamlPlanCount }} 张</span>
|
||||
<span v-if="parityCount">单双周分布:{{ parityCount }}</span>
|
||||
<span>识别科目:{{ preview.subjects.length }} 个</span>
|
||||
<span v-if="preview.layoutNames.length">时间表:{{ preview.layoutNames.join('、') }}</span>
|
||||
@@ -281,6 +463,9 @@ function parityLabel(item: ClassPlanEntryDto): string {
|
||||
<template #default="{ row }">{{ row.startTime }}-{{ row.endTime }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subject" label="科目" min-width="110" />
|
||||
<el-table-column v-if="showLocationColumn" label="地点" min-width="110">
|
||||
<template #default="{ row }">{{ entryLocation(row) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单双周" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.weekParity !== 'ALL'" size="small" effect="plain">
|
||||
@@ -308,24 +493,52 @@ function parityLabel(item: ClassPlanEntryDto): string {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:global(.el-dialog.class-plan-import-dialog) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 90dvh;
|
||||
}
|
||||
:global(.class-plan-import-dialog .el-dialog__header),
|
||||
:global(.class-plan-import-dialog .el-dialog__footer) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
:global(.class-plan-import-dialog .el-dialog__body) {
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.hidden-input {
|
||||
display: none;
|
||||
}
|
||||
.preview-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
margin-top: 10px;
|
||||
gap: var(--ch-space-4);
|
||||
margin-top: var(--ch-space-3);
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.ai-panel {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: var(--ch-radius-sm);
|
||||
padding: 0 var(--ch-space-3);
|
||||
}
|
||||
.ai-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--ch-space-2);
|
||||
}
|
||||
.prompt-box :deep(.el-textarea__inner) {
|
||||
font-family: var(--ch-font-mono, Consolas, 'Courier New', monospace);
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.mb-8 {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: var(--ch-space-2);
|
||||
}
|
||||
.mb-12 {
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: var(--ch-space-3);
|
||||
}
|
||||
.mt-8 {
|
||||
margin-top: 8px;
|
||||
margin-top: var(--ch-space-2);
|
||||
}
|
||||
</style>
|
||||
@@ -60,7 +60,7 @@ const mb = (bytes: number) => `${(bytes / 1048576).toFixed(1)} MB`;
|
||||
<style scoped>
|
||||
.update-status {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
padding-block: 6px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ watch(
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
padding: 12px 8px;
|
||||
padding: var(--ch-space-3) var(--ch-space-2);
|
||||
}
|
||||
.management-group-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
gap: var(--ch-space-3);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
@@ -68,10 +68,10 @@ watch(
|
||||
margin: 0;
|
||||
}
|
||||
.management-menu :deep(.el-sub-menu__title) {
|
||||
padding: 0 14px;
|
||||
padding: 0 var(--ch-space-4);
|
||||
height: 46px;
|
||||
margin-bottom: 4px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: var(--ch-space-1);
|
||||
border-radius: var(--ch-radius-sm);
|
||||
color: var(--ch-text-secondary);
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -83,9 +83,9 @@ watch(
|
||||
}
|
||||
.management-menu :deep(.el-menu-item) {
|
||||
height: 42px;
|
||||
padding-left: 26px;
|
||||
margin: 3px 0 3px 10px;
|
||||
border-radius: 8px;
|
||||
padding-left: var(--ch-space-7);
|
||||
margin: var(--ch-space-1) 0 var(--ch-space-1) var(--ch-space-3);
|
||||
border-radius: var(--ch-radius-sm);
|
||||
min-width: 0;
|
||||
color: var(--ch-text-secondary);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ watch(
|
||||
}
|
||||
.management-menu.menu-rail :deep(.el-sub-menu__title) {
|
||||
padding: 0 !important;
|
||||
margin: 4px 0 !important;
|
||||
margin: var(--ch-space-1) 0 !important;
|
||||
width: 48px;
|
||||
height: 44px;
|
||||
justify-content: center;
|
||||
|
||||
@@ -95,12 +95,12 @@ const emit = defineEmits<{
|
||||
.plan-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: var(--ch-space-3);
|
||||
}
|
||||
.detail-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: var(--el-font-size-small);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ const emit = defineEmits<{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
}
|
||||
.inline-fields :deep(.el-input-number) {
|
||||
width: 74px;
|
||||
@@ -134,8 +134,8 @@ const emit = defineEmits<{
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
align-self: flex-start;
|
||||
gap: 5px;
|
||||
padding: 4px 0;
|
||||
gap: var(--ch-space-1);
|
||||
padding: var(--ch-space-1) 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--el-color-primary);
|
||||
@@ -147,7 +147,7 @@ const emit = defineEmits<{
|
||||
height: 16px;
|
||||
}
|
||||
.save-plan {
|
||||
margin-top: 4px;
|
||||
margin-top: var(--ch-space-1);
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -143,7 +143,7 @@ onMounted(load);
|
||||
<el-input-number v-model="status.config.hour" :min="0" :max="23" />
|
||||
</el-form-item>
|
||||
<el-form-item label="新学期开学日(空则当年 9 月 1 日)">
|
||||
<el-date-picker
|
||||
<ch-date-picker
|
||||
v-model="status.plan.termStartDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
|
||||
@@ -122,7 +122,7 @@ function formatValue(value: number): string {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 18px 0 28px;
|
||||
padding: var(--ch-space-5) 0 var(--ch-space-7);
|
||||
}
|
||||
|
||||
.tick {
|
||||
@@ -130,7 +130,7 @@ function formatValue(value: number): string {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding-right: 8px;
|
||||
padding-right: var(--ch-space-2);
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
@@ -159,9 +159,9 @@ function formatValue(value: number): string {
|
||||
.bars {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 8px;
|
||||
gap: var(--ch-space-2);
|
||||
height: 100%;
|
||||
padding: 0 6px;
|
||||
padding: 0 var(--ch-space-2);
|
||||
}
|
||||
|
||||
.bar-col {
|
||||
@@ -194,14 +194,14 @@ function formatValue(value: number): string {
|
||||
.bar {
|
||||
width: 46%;
|
||||
max-width: 46px;
|
||||
border-radius: 4px 4px 0 0;
|
||||
border-radius: var(--ch-radius-xs) var(--ch-radius-xs) 0 0;
|
||||
transition: height 0.2s ease;
|
||||
}
|
||||
|
||||
.bar-label {
|
||||
flex: none;
|
||||
height: 28px;
|
||||
padding-top: 6px;
|
||||
padding-top: var(--ch-space-2);
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
|
||||
@@ -179,7 +179,7 @@ function formatValue(value: number): string {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
padding: 18px 0 28px;
|
||||
padding: var(--ch-space-5) 0 var(--ch-space-7);
|
||||
}
|
||||
|
||||
.tick {
|
||||
@@ -187,7 +187,7 @@ function formatValue(value: number): string {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
padding-right: 8px;
|
||||
padding-right: var(--ch-space-2);
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
white-space: nowrap;
|
||||
@@ -256,7 +256,7 @@ function formatValue(value: number): string {
|
||||
.x-label {
|
||||
flex: 1 1 0;
|
||||
min-width: 0;
|
||||
padding-top: 6px;
|
||||
padding-top: var(--ch-space-2);
|
||||
font-size: 11px;
|
||||
line-height: 1.3;
|
||||
text-align: center;
|
||||
|
||||
@@ -432,7 +432,7 @@ async function submit(): Promise<void> {
|
||||
.import-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: var(--ch-space-2);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.file-name {
|
||||
@@ -444,14 +444,14 @@ async function submit(): Promise<void> {
|
||||
}
|
||||
.import-meta {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
gap: var(--ch-space-4);
|
||||
flex-wrap: wrap;
|
||||
margin: 12px 0 4px;
|
||||
margin: var(--ch-space-3) 0 var(--ch-space-1);
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.required-hint {
|
||||
margin-left: 8px;
|
||||
margin-left: var(--ch-space-2);
|
||||
color: var(--el-color-danger);
|
||||
font-size: 12px;
|
||||
}
|
||||
@@ -462,7 +462,7 @@ async function submit(): Promise<void> {
|
||||
}
|
||||
.result-stats {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
gap: var(--ch-space-4);
|
||||
flex-wrap: wrap;
|
||||
font-size: 13px;
|
||||
}
|
||||
@@ -476,15 +476,15 @@ async function submit(): Promise<void> {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
.mb-8 {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: var(--ch-space-2);
|
||||
}
|
||||
.mb-12 {
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: var(--ch-space-3);
|
||||
}
|
||||
.mt-8 {
|
||||
margin-top: 8px;
|
||||
margin-top: var(--ch-space-2);
|
||||
}
|
||||
.mt-12 {
|
||||
margin-top: 12px;
|
||||
margin-top: var(--ch-space-3);
|
||||
}
|
||||
</style>
|
||||
@@ -65,6 +65,7 @@ const nowMinutes = ref(currentMinutes());
|
||||
let nowTimer: ReturnType<typeof setInterval> | null = null;
|
||||
let reorderFrom = '';
|
||||
let reorderTo = '';
|
||||
let draftSequence = 0;
|
||||
|
||||
const visibleLayouts = computed(() => props.layouts.filter((item) => item.name.includes(search.value)));
|
||||
const points = computed(() => layout.value?.points ?? []);
|
||||
@@ -164,7 +165,8 @@ function addPoint(type: TimePointType): void {
|
||||
? '分割线'
|
||||
: '行动';
|
||||
const point: TimePointDto = {
|
||||
id: `draft-${crypto.randomUUID()}`,
|
||||
// 草稿 id 只用于本次编辑;HTTP 内网没有 randomUUID,不能依赖安全上下文 API。
|
||||
id: `draft-${Date.now()}-${draftSequence++}`,
|
||||
position: points.value.length,
|
||||
name,
|
||||
startTime: toTime(start),
|
||||
@@ -385,7 +387,12 @@ onUnmounted(() => {
|
||||
</header>
|
||||
|
||||
<div class="tl-body">
|
||||
<div class="layout-canvas" :inert="saving">
|
||||
<!--
|
||||
只在保存过程中置为 inert。不能写成 :inert="saving":旧内核没有 inert DOM property,
|
||||
Vue 会把 false 落成 inert="false" 属性,而 inert 属性只要存在就整块不可交互。
|
||||
undefined 会让 Vue 直接移除属性,现代浏览器与旧内核行为一致。
|
||||
-->
|
||||
<div class="layout-canvas" :inert="saving ? true : undefined">
|
||||
<div v-if="!layout" class="panel-empty">
|
||||
<ArchiveIcon name="clock" />
|
||||
<p>新建一份时间表开始编辑</p>
|
||||
@@ -739,14 +746,14 @@ onUnmounted(() => {
|
||||
flex: 0 0 210px;
|
||||
width: 210px;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
gap: var(--ch-space-2);
|
||||
padding: var(--ch-space-3);
|
||||
overflow: auto;
|
||||
border-right: 1px solid var(--ch-border);
|
||||
}
|
||||
.explorer-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
gap: var(--ch-space-1);
|
||||
}
|
||||
.layout-explorer .command {
|
||||
flex: 1;
|
||||
@@ -756,11 +763,11 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 3px;
|
||||
gap: var(--ch-space-1);
|
||||
width: 100%;
|
||||
padding: 9px 10px;
|
||||
padding: var(--ch-space-2) var(--ch-space-3);
|
||||
border: 1px solid transparent;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--ch-radius-sm);
|
||||
background: transparent;
|
||||
color: var(--ch-text);
|
||||
font: inherit;
|
||||
@@ -799,20 +806,20 @@ onUnmounted(() => {
|
||||
flex-shrink: 0;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
gap: var(--ch-space-1);
|
||||
min-height: 48px;
|
||||
padding: 6px 12px;
|
||||
padding: var(--ch-space-2) var(--ch-space-3);
|
||||
border-bottom: 1px solid var(--ch-border);
|
||||
}
|
||||
.command {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
min-height: 32px;
|
||||
padding: 6px 9px;
|
||||
padding: var(--ch-space-2) var(--ch-space-2);
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--ch-radius-sm);
|
||||
background: transparent;
|
||||
color: var(--ch-text-secondary);
|
||||
font: inherit;
|
||||
@@ -844,7 +851,7 @@ onUnmounted(() => {
|
||||
}
|
||||
.command.small {
|
||||
min-height: 28px;
|
||||
padding: 3px 6px;
|
||||
padding: var(--ch-space-1) var(--ch-space-2);
|
||||
}
|
||||
.command.wide {
|
||||
justify-content: flex-start;
|
||||
@@ -854,7 +861,7 @@ onUnmounted(() => {
|
||||
.command-separator {
|
||||
flex: 0 0 1px;
|
||||
height: 22px;
|
||||
margin: 0 3px;
|
||||
margin: 0 var(--ch-space-1);
|
||||
background: var(--ch-border);
|
||||
}
|
||||
.tl-body {
|
||||
@@ -877,22 +884,22 @@ onUnmounted(() => {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
gap: var(--ch-space-2);
|
||||
min-height: 240px;
|
||||
color: var(--ch-text-muted);
|
||||
}
|
||||
.point-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 8px 12px 16px;
|
||||
padding: var(--ch-space-2) var(--ch-space-3) var(--ch-space-4);
|
||||
overflow: auto;
|
||||
}
|
||||
.time-point-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
gap: var(--ch-space-3);
|
||||
min-height: 46px;
|
||||
padding: 6px 8px;
|
||||
padding: var(--ch-space-2) var(--ch-space-2);
|
||||
border-bottom: 1px solid var(--ch-border);
|
||||
cursor: pointer;
|
||||
}
|
||||
@@ -906,7 +913,7 @@ onUnmounted(() => {
|
||||
color: var(--ch-text-secondary);
|
||||
}
|
||||
.drag {
|
||||
padding: 6px 2px;
|
||||
padding: var(--ch-space-2) 2px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--ch-text-muted);
|
||||
@@ -934,9 +941,9 @@ onUnmounted(() => {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.point-badge {
|
||||
padding: 1px 6px;
|
||||
padding: 1px var(--ch-space-2);
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: 999px;
|
||||
border-radius: var(--ch-radius-pill);
|
||||
color: var(--ch-text-muted);
|
||||
font-size: var(--el-font-size-extra-small);
|
||||
white-space: nowrap;
|
||||
@@ -946,7 +953,7 @@ onUnmounted(() => {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
.list-hint {
|
||||
padding: 24px 8px;
|
||||
padding: var(--ch-space-6) var(--ch-space-2);
|
||||
color: var(--ch-text-muted);
|
||||
}
|
||||
.timeline {
|
||||
@@ -962,7 +969,7 @@ onUnmounted(() => {
|
||||
position: relative;
|
||||
display: flex;
|
||||
min-height: 100%;
|
||||
padding-right: 8px;
|
||||
padding-right: var(--ch-space-2);
|
||||
}
|
||||
.timeline-ruler {
|
||||
position: relative;
|
||||
@@ -983,7 +990,7 @@ onUnmounted(() => {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
margin-left: 8px;
|
||||
margin-left: var(--ch-space-2);
|
||||
border-left: 1px solid var(--ch-border);
|
||||
}
|
||||
.time-block {
|
||||
@@ -993,9 +1000,9 @@ onUnmounted(() => {
|
||||
display: flex;
|
||||
overflow: visible;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
padding: 2px var(--ch-space-2);
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
border-radius: var(--ch-radius-xs);
|
||||
background: var(--el-color-primary-light-8);
|
||||
color: var(--el-color-primary-dark-2);
|
||||
cursor: pointer;
|
||||
@@ -1081,8 +1088,8 @@ onUnmounted(() => {
|
||||
flex: 0 0 300px;
|
||||
width: 300px;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
gap: var(--ch-space-3);
|
||||
padding: var(--ch-space-4);
|
||||
overflow: auto;
|
||||
border-left: 1px solid var(--ch-border);
|
||||
background: var(--ch-surface-alt);
|
||||
@@ -1095,7 +1102,7 @@ onUnmounted(() => {
|
||||
.inspector-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: var(--el-font-size-small);
|
||||
}
|
||||
@@ -1105,7 +1112,7 @@ onUnmounted(() => {
|
||||
.time-parts {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
}
|
||||
.time-parts :deep(.el-input-number) {
|
||||
width: 76px;
|
||||
@@ -1117,17 +1124,17 @@ onUnmounted(() => {
|
||||
.type-switch {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
}
|
||||
.type-switch button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
gap: var(--ch-space-1);
|
||||
min-height: 34px;
|
||||
padding: 4px 6px;
|
||||
padding: var(--ch-space-1) var(--ch-space-2);
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: 8px;
|
||||
border-radius: var(--ch-radius-sm);
|
||||
background: var(--ch-surface);
|
||||
color: var(--ch-text);
|
||||
font: inherit;
|
||||
@@ -1163,26 +1170,26 @@ onUnmounted(() => {
|
||||
flex-shrink: 0;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding: 8px 12px;
|
||||
gap: var(--ch-space-3);
|
||||
padding: var(--ch-space-2) var(--ch-space-3);
|
||||
border-top: 1px solid var(--ch-border);
|
||||
}
|
||||
.durations {
|
||||
min-width: 210px;
|
||||
padding: 8px 10px;
|
||||
padding: var(--ch-space-2) var(--ch-space-3);
|
||||
border: 1px solid var(--ch-border);
|
||||
border-radius: 8px;
|
||||
border-radius: var(--ch-radius-sm);
|
||||
background: var(--ch-surface);
|
||||
}
|
||||
.durations.collapsed {
|
||||
padding: 4px 8px;
|
||||
padding: var(--ch-space-1) var(--ch-space-2);
|
||||
}
|
||||
.durations-toggle {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
gap: var(--ch-space-2);
|
||||
padding: 2px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
@@ -1202,13 +1209,13 @@ onUnmounted(() => {
|
||||
.duration-fields {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding-top: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
padding-top: var(--ch-space-2);
|
||||
}
|
||||
.duration-fields label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
gap: var(--ch-space-2);
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: var(--el-font-size-small);
|
||||
}
|
||||
@@ -1218,7 +1225,7 @@ onUnmounted(() => {
|
||||
.view-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
gap: var(--ch-space-1);
|
||||
}
|
||||
.icon-command {
|
||||
display: inline-flex;
|
||||
@@ -1226,9 +1233,9 @@ onUnmounted(() => {
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
padding: 4px;
|
||||
padding: var(--ch-space-1);
|
||||
border: 0;
|
||||
border-radius: 8px;
|
||||
border-radius: var(--ch-radius-sm);
|
||||
background: transparent;
|
||||
color: var(--ch-text-secondary);
|
||||
cursor: pointer;
|
||||
@@ -1255,7 +1262,7 @@ onUnmounted(() => {
|
||||
}
|
||||
.import-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
gap: var(--ch-space-2);
|
||||
width: 100%;
|
||||
}
|
||||
.import-row :deep(.el-select) {
|
||||
@@ -1269,7 +1276,7 @@ onUnmounted(() => {
|
||||
.point-inspector {
|
||||
flex-basis: 260px;
|
||||
width: 260px;
|
||||
padding: 10px;
|
||||
padding: var(--ch-space-3);
|
||||
}
|
||||
.point-duration,
|
||||
.point-badge {
|
||||
|
||||
@@ -291,21 +291,21 @@ function fillSample(): void {
|
||||
}
|
||||
.preview-meta {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-top: 10px;
|
||||
gap: var(--ch-space-4);
|
||||
margin-top: var(--ch-space-3);
|
||||
color: var(--ch-text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
.mb-8 {
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: var(--ch-space-2);
|
||||
}
|
||||
.mb-12 {
|
||||
margin-bottom: 12px;
|
||||
margin-bottom: var(--ch-space-3);
|
||||
}
|
||||
.mt-8 {
|
||||
margin-top: 8px;
|
||||
margin-top: var(--ch-space-2);
|
||||
}
|
||||
.mt-12 {
|
||||
margin-top: 12px;
|
||||
margin-top: var(--ch-space-3);
|
||||
}
|
||||
</style>
|
||||
@@ -137,21 +137,21 @@ watch(
|
||||
}
|
||||
|
||||
.update-name {
|
||||
margin-top: 12px;
|
||||
margin-top: var(--ch-space-3);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.update-notes-label {
|
||||
margin: 12px 0 6px;
|
||||
margin: var(--ch-space-3) 0 var(--ch-space-2);
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.update-notes {
|
||||
margin: 0;
|
||||
padding: 10px 12px;
|
||||
padding: var(--ch-space-3) var(--ch-space-3);
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
background: var(--el-fill-color-light);
|
||||
@@ -166,14 +166,14 @@ watch(
|
||||
|
||||
.update-assets {
|
||||
margin: 0;
|
||||
padding-left: 18px;
|
||||
padding-left: var(--ch-space-5);
|
||||
font-size: 12px;
|
||||
line-height: 1.9;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.update-asset-size {
|
||||
margin-left: 6px;
|
||||
margin-left: var(--ch-space-2);
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
</style>
|
||||
@@ -160,8 +160,8 @@ function handleConfirm(): void {
|
||||
.urgent-card {
|
||||
width: 520px;
|
||||
max-width: calc(100vw - 48px);
|
||||
padding: 28px 30px 22px;
|
||||
border-radius: 16px;
|
||||
padding: var(--ch-space-7) var(--ch-space-8) var(--ch-space-6);
|
||||
border-radius: var(--ch-radius-lg);
|
||||
background: var(--ch-surface);
|
||||
border-top: 4px solid #f56c6c;
|
||||
box-shadow: 0 24px 60px rgba(120, 20, 20, 0.35);
|
||||
@@ -171,7 +171,7 @@ function handleConfirm(): void {
|
||||
.urgent-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 0 auto 12px;
|
||||
margin: 0 auto var(--ch-space-3);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -194,13 +194,13 @@ function handleConfirm(): void {
|
||||
}
|
||||
|
||||
.urgent-title {
|
||||
margin: 0 0 8px;
|
||||
margin: 0 0 var(--ch-space-2);
|
||||
font-size: 22px;
|
||||
color: var(--ch-text);
|
||||
}
|
||||
|
||||
.urgent-subtitle {
|
||||
margin: 0 0 18px;
|
||||
margin: 0 0 var(--ch-space-5);
|
||||
font-size: 14px;
|
||||
line-height: 1.7;
|
||||
color: var(--ch-text-secondary);
|
||||
@@ -214,10 +214,10 @@ function handleConfirm(): void {
|
||||
.urgent-preview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
gap: var(--ch-space-3);
|
||||
padding: var(--ch-space-3) var(--ch-space-4);
|
||||
border-radius: var(--ch-radius-sm);
|
||||
margin-bottom: var(--ch-space-3);
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
}
|
||||
@@ -250,16 +250,16 @@ function handleConfirm(): void {
|
||||
|
||||
.urgent-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
gap: var(--ch-space-3);
|
||||
justify-content: center;
|
||||
margin: 18px 0 12px;
|
||||
margin: var(--ch-space-5) 0 var(--ch-space-3);
|
||||
}
|
||||
|
||||
.urgent-progress {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
gap: var(--ch-space-3);
|
||||
min-height: 52px;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user