Files
37duAutomation/tests/样式/计划任务.html
T

330 lines
20 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>37du 自动化工作台 - 计划任务</title>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }
/* 表格行的悬浮微效 */
.table-row-hover:hover {
background-color: #f8fafc;
}
</style>
</head>
<body class="bg-[#f5f6f8] text-gray-800 h-screen overflow-hidden text-sm">
<div id="app" class="flex h-full w-full p-2 gap-2">
<!-- ================= 左侧导航栏 (高亮“计划”) ================= -->
<aside class="w-[220px] bg-white rounded-xl flex flex-col shadow-sm border border-gray-100 overflow-y-auto flex-shrink-0">
<div class="p-4 flex items-center gap-2 border-b border-gray-50">
<div class="w-6 h-6 bg-blue-600 rounded flex items-center justify-center text-white text-xs font-bold">37</div>
<span class="font-bold text-gray-700">37du 自动化工作台</span>
</div>
<div class="p-3 space-y-1">
<a href="#" class="flex items-center justify-between px-3 py-2 text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
<span>总览</span>
</div>
<span class="text-xs text-gray-400">12</span>
</a>
<a href="#" class="flex items-center justify-between px-3 py-2 text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"></path></svg>
<span>场景库</span>
</div>
<span class="text-xs text-gray-400">18</span>
</a>
<!-- 高亮计划 -->
<a href="#" class="flex items-center justify-between px-3 py-2 bg-blue-50 text-blue-600 rounded-lg">
<div class="flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path></svg>
<span>计划</span>
</div>
<span class="text-xs bg-blue-100 text-blue-600 px-2 py-0.5 rounded-full">7</span>
</a>
<a href="#" class="flex items-center justify-between px-3 py-2 text-gray-600 hover:bg-gray-50 rounded-lg">
<div class="flex items-center gap-2">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"></path></svg>
<span>平台账号</span>
</div>
<span class="text-xs bg-green-100 text-green-600 px-2 py-0.5 rounded-full">2/3</span>
</a>
</div>
<div class="px-3 pb-2 mt-2">
<div class="relative">
<svg class="w-3.5 h-3.5 absolute left-2.5 top-2.5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
<input type="text" placeholder="搜索场景" class="w-full bg-gray-50 border border-gray-100 rounded-md py-1.5 pl-8 pr-3 text-xs focus:outline-none focus:ring-1 focus:ring-blue-500">
</div>
</div>
<div class="p-3 mt-1 flex-1">
<div class="text-xs text-gray-400 mb-2 px-1">最近使用</div>
<ul class="space-y-0.5">
<li v-for="item in recentUses" :key="item.name" class="flex items-center justify-between px-2 py-2 hover:bg-gray-50 rounded-md cursor-pointer group">
<div class="flex items-center gap-2 truncate">
<span class="w-1.5 h-1.5 rounded-full shrink-0" :class="item.color"></span>
<span class="text-gray-700 text-xs truncate">{{ item.name }}</span>
</div>
<span class="text-gray-400 text-[10px] shrink-0">{{ item.time }}</span>
</li>
</ul>
</div>
<div class="p-3 border-t border-gray-100">
<div class="flex items-center justify-between bg-gray-50 rounded-lg p-2">
<div class="flex items-center gap-2">
<div class="w-6 h-6 bg-blue-100 rounded-full flex items-center justify-center text-blue-600 text-xs font-bold">李</div>
<div>
<div class="text-xs font-medium text-gray-700">李骁柠</div>
<div class="text-[10px] text-gray-400">本机操作员</div>
</div>
</div>
<button class="text-[10px] text-gray-500 hover:text-gray-700">退出</button>
</div>
</div>
</aside>
<!-- ================= 中间主内容区 ================= -->
<main class="flex-1 flex flex-col min-w-0 bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden">
<!-- 1. 头部区域 -->
<header class="px-6 py-5 border-b border-gray-100 flex justify-between items-end flex-shrink-0">
<div>
<div class="flex items-center gap-2 text-xs text-gray-400 mb-2">
<span>计划</span>
<span class="text-gray-300">/</span>
<span>工作台</span>
</div>
<h1 class="text-2xl font-bold text-gray-800 mb-1">计划任务</h1>
<p class="text-xs text-gray-500">
<span class="text-blue-600 font-medium">{{ stats.active }}</span> 个启用 ·
<span class="text-gray-700 font-medium">{{ stats.paused }}</span> 个暂停 ·
下次执行 {{ stats.nextRun }} ·
平均用时 {{ stats.avgTime }}
</p>
</div>
<div class="flex gap-2 mb-1">
<button class="px-4 py-1.5 bg-white border border-gray-200 text-gray-600 rounded-lg hover:bg-gray-50 text-xs font-medium shadow-sm">
暂停全部
</button>
<button class="px-4 py-1.5 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-xs font-medium shadow-sm">
新建计划
</button>
</div>
</header>
<!-- 2. 图表区域 -->
<div class="px-6 py-4 border-b border-gray-50 flex-shrink-0">
<div class="flex justify-between items-center mb-6">
<h2 class="font-bold text-gray-800 text-sm">本周运行分布</h2>
<span class="text-[11px] text-gray-400">共 12 次 · 峰值 周四 4次</span>
</div>
<!-- 柱状图 (CSS 模拟) -->
<div class="flex items-end justify-between h-20 px-2 mb-2">
<div v-for="(day, index) in chartData" :key="index" class="flex flex-col items-center gap-2 w-full group cursor-pointer">
<div class="w-8 rounded-t-md transition-all duration-300 relative group-hover:opacity-80"
:class="day.isToday ? 'bg-blue-600' : 'bg-gray-100'"
:style="{ height: day.height + 'px' }">
<!-- 悬浮提示框 -->
<div v-if="day.count > 0" class="absolute -top-7 left-1/2 -translate-x-1/2 bg-gray-800 text-white text-[10px] px-2 py-0.5 rounded opacity-0 group-hover:opacity-100 transition-opacity whitespace-nowrap pointer-events-none z-10">
{{ day.count }} 次
</div>
</div>
<span class="text-[11px]" :class="day.isToday ? 'text-blue-600 font-bold' : 'text-gray-400'">{{ day.label }}</span>
</div>
</div>
</div>
<!-- 3. 表格区域 (自适应高度,内部滚动) -->
<div class="flex-1 overflow-y-auto">
<table class="w-full text-left border-collapse">
<thead class="bg-gray-50 text-[11px] text-gray-500 sticky top-0 z-10">
<tr>
<th class="px-6 py-3 font-medium">时间</th>
<th class="px-6 py-3 font-medium">频率</th>
<th class="px-6 py-3 font-medium">场景</th>
<th class="px-6 py-3 font-medium">上次结果</th>
<th class="px-6 py-3 font-medium">下次执行</th>
<th class="px-6 py-3 font-medium text-right">状态</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-50 text-xs">
<tr v-for="task in tasks" :key="task.id" class="table-row-hover transition-colors">
<td class="px-6 py-3 text-gray-800 font-mono">{{ task.time }}</td>
<td class="px-6 py-3 text-gray-600">{{ task.frequency }}</td>
<td class="px-6 py-3 text-gray-800 font-medium">{{ task.scene }}</td>
<!-- 上次结果 -->
<td class="px-6 py-3">
<div class="flex items-center gap-1.5">
<span v-if="task.result.status === '成功'" class="text-green-600">{{ task.result.status }} · {{ task.result.time }}</span>
<span v-else-if="task.result.status === '失败'" class="text-red-500">{{ task.result.status }} · {{ task.result.time }}</span>
<span v-else class="text-orange-500">{{ task.result.status }} · {{ task.result.time }}</span>
</div>
</td>
<td class="px-6 py-3 text-gray-500">{{ task.nextRun }}</td>
<!-- 状态 -->
<td class="px-6 py-3 text-right">
<span v-if="task.status === '启用'" class="inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-green-50 text-green-600 border border-green-100 font-medium">
<span class="w-1.5 h-1.5 rounded-full bg-green-500"></span> 启用
</span>
<span v-else class="inline-flex items-center gap-1 px-2.5 py-1 rounded-md bg-gray-50 text-gray-500 border border-gray-200 font-medium">
<span class="w-1.5 h-1.5 rounded-full bg-gray-400"></span> 暂停
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- 4. 底部信息 -->
<div class="px-6 py-3 border-t border-gray-100 flex justify-between items-center text-xs text-gray-400 bg-white flex-shrink-0">
<span>共 {{ tasks.length }} 个计划 · 调度器每 30 秒轮询一次</span>
<a href="#" class="text-blue-600 hover:text-blue-700 font-medium flex items-center gap-1">
编辑计划
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg>
</a>
</div>
</main>
<!-- ================= 右侧活动面板 (保持统一) ================= -->
<aside class="w-[280px] bg-white rounded-xl shadow-sm border border-gray-100 flex flex-col flex-shrink-0 overflow-y-auto hidden lg:flex">
<div class="p-4">
<div class="flex justify-between items-center mb-4">
<h2 class="font-bold text-gray-800 text-sm">活动</h2>
<span class="text-[10px] text-red-500 bg-red-50 px-2 py-0.5 rounded border border-red-100 flex items-center gap-1">
<span class="w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse"></span> 2 进行中
</span>
</div>
<div class="bg-blue-50/50 border border-blue-100 rounded-lg p-3 mb-6">
<div class="flex justify-between text-xs mb-2">
<span class="font-medium text-gray-700 flex items-center gap-1">
<span class="w-1.5 h-1.5 rounded-full bg-blue-500"></span> 考勤数据采集
</span>
<span class="text-blue-600 font-mono">68%</span>
</div>
<div class="w-full bg-gray-200/60 rounded-full h-1.5 mb-2 overflow-hidden">
<div class="bg-blue-500 h-1.5 rounded-full transition-all duration-500" style="width: 68%"></div>
</div>
<p class="text-[10px] text-gray-500">抽取第 3/12 页 · 已采 246 条</p>
</div>
<div class="mb-6">
<div class="text-[11px] text-gray-400 mb-3">最近运行</div>
<ul class="space-y-3">
<li class="flex items-center justify-between text-xs">
<div class="flex items-center gap-2">
<span class="w-1.5 h-1.5 rounded-full bg-green-500"></span>
<span class="text-gray-700">考勤数据采集</span>
</div>
<span class="text-gray-400 text-[10px]">14:32 成功</span>
</li>
<li class="flex items-center justify-between text-xs">
<div class="flex items-center gap-2">
<span class="w-1.5 h-1.5 rounded-full bg-green-500"></span>
<span class="text-gray-700">销售订单同步</span>
</div>
<span class="text-gray-400 text-[10px]">11:08 成功</span>
</li>
<li class="flex items-center justify-between text-xs">
<div class="flex items-center gap-2">
<span class="w-1.5 h-1.5 rounded-full bg-orange-400"></span>
<span class="text-gray-700">OA流程自动化</span>
</div>
<span class="text-gray-400 text-[10px]">09:45 跳过</span>
</li>
</ul>
</div>
<div>
<div class="flex justify-between text-[11px] text-gray-400 mb-3">
<span>平台账号</span>
<span class="text-green-600">2 / 3</span>
</div>
<ul class="space-y-2">
<li class="flex items-center justify-between bg-gray-50 p-2 rounded-md border border-gray-100">
<div class="flex items-center gap-2">
<span class="w-1.5 h-1.5 rounded-full bg-blue-500"></span>
<span class="text-xs text-gray-700">HR 人力资源</span>
</div>
<span class="text-[10px] text-gray-500">已登录</span>
</li>
<li class="flex items-center justify-between bg-gray-50 p-2 rounded-md border border-gray-100">
<div class="flex items-center gap-2">
<span class="w-1.5 h-1.5 rounded-full bg-orange-400"></span>
<span class="text-xs text-gray-700">OA办公</span>
</div>
<span class="text-[10px] text-orange-500">待登录</span>
</li>
</ul>
</div>
</div>
</aside>
</div>
<script>
const { createApp, ref } = Vue;
createApp({
setup() {
// 左侧最近使用
const recentUses = ref([
{ name: '考勤数据采集', time: '12m', color: 'bg-blue-500' },
{ name: 'OA流程自动化', time: '1h', color: 'bg-orange-400' },
{ name: '钉钉通知推送', time: '3h', color: 'bg-purple-500' },
]);
// 头部统计信息
const stats = ref({
active: 7,
paused: 2,
nextRun: '明天 08:30',
avgTime: '1分12秒'
});
// 图表数据 (高度为像素值)
const chartData = ref([
{ label: '周六 17', height: 30, count: 2 },
{ label: '周日 18', height: 20, count: 1 },
{ label: '周一 19', height: 40, count: 3 },
{ label: '周二 20', height: 35, count: 2 },
{ label: '周三 21', height: 45, count: 3 },
{ label: '周四 22', height: 60, count: 4 },
{ label: '今天 23', height: 75, count: 4, isToday: true },
]);
// 表格数据
const tasks = ref([
{ id: 1, time: '08:30', frequency: '每天', scene: '考勤数据采集', result: { status: '成功', time: '02:14' }, nextRun: '明天 08:30', status: '启用' },
{ id: 2, time: '09:00', frequency: '每周一', scene: '销售订单同步', result: { status: '成功', time: '03:08' }, nextRun: '11-02 09:00', status: '启用' },
{ id: 3, time: '08:00', frequency: '每月1号', scene: '财务对账单导出', result: { status: '成功', time: '05:42' }, nextRun: '11-01 08:00', status: '启用' },
{ id: 4, time: '16:40', frequency: '每周五', scene: '客户回访汇总', result: { status: '成功', time: '01:52' }, nextRun: '10-30 16:40', status: '启用' },
{ id: 5, time: '18:20', frequency: '每天', scene: '仓库库存盘点', result: { status: '成功', time: '02:36' }, nextRun: '今天 18:20', status: '启用' },
{ id: 6, time: '10:00', frequency: '每月15号', scene: '合同归档同步', result: { status: '成功', time: '04:12' }, nextRun: '11-15 10:00', status: '启用' },
{ id: 7, time: '09:00', frequency: '每周一', scene: '钉钉通知推送', result: { status: '跳过', time: '平台未登录' }, nextRun: '暂停中', status: '暂停' },
{ id: 8, time: '14:00', frequency: '每天', scene: 'OA流程自动化', result: { status: '失败', time: '00:31' }, nextRun: '暂停中', status: '暂停' },
{ id: 9, time: '10:30', frequency: '每周三', scene: '邮件日报推送', result: { status: '成功', time: '00:48' }, nextRun: '10-28 10:30', status: '启用' },
]);
return {
recentUses,
stats,
chartData,
tasks
};
}
}).mount('#app');
</script>
</body>
</html>