feat: 采集任务清单补上表头和任务字段
This commit is contained in:
@@ -134,6 +134,37 @@ function scheduleText(source: Source) {
|
||||
return `每${label} ${clockText}`;
|
||||
}
|
||||
|
||||
function timeText(source: Source) {
|
||||
const mode = source.config.timeMode || "";
|
||||
const found = timeOptions.find((item) => item.value === mode);
|
||||
const count = Number(source.config.timeCount || 1);
|
||||
if (!found) return "未设置";
|
||||
if (mode === "prev_weeks") return `前 ${count} 周`;
|
||||
if (mode === "prev_months") return `前 ${count} 月`;
|
||||
if (mode === "prev_days") return `前 ${count} 天`;
|
||||
return found.label;
|
||||
}
|
||||
|
||||
function tableItems(source: Source) {
|
||||
return Array.isArray(source.config.tables) ? source.config.tables : [];
|
||||
}
|
||||
|
||||
function tablesText(source: Source) {
|
||||
const tables = tableItems(source);
|
||||
if (!tables.length) return "未选择";
|
||||
const first = tables[0].name || tables[0].tablename;
|
||||
if (tables.length === 1) return first;
|
||||
return `${first} 等 ${tables.length} 张`;
|
||||
}
|
||||
|
||||
function tablesTitle(source: Source) {
|
||||
return tableItems(source).map((item) => item.name || item.tablename).join("、");
|
||||
}
|
||||
|
||||
function cityText(source: Source) {
|
||||
return String(source.config.city || "").trim() || "不限";
|
||||
}
|
||||
|
||||
function reset(source?: Source) {
|
||||
editing.value = source || null;
|
||||
name.value = source?.name || "";
|
||||
@@ -267,6 +298,9 @@ onMounted(load);
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>数据表</th>
|
||||
<th>数据时间</th>
|
||||
<th>城市</th>
|
||||
<th>周期</th>
|
||||
<th>状态</th>
|
||||
<th class="col-actions">操作</th>
|
||||
@@ -275,6 +309,9 @@ onMounted(load);
|
||||
<tbody>
|
||||
<tr v-for="source in sources" :key="source.id">
|
||||
<td>{{ source.name }}</td>
|
||||
<td class="cell-clip" :title="tablesTitle(source)">{{ tablesText(source) }}</td>
|
||||
<td>{{ timeText(source) }}</td>
|
||||
<td>{{ cityText(source) }}</td>
|
||||
<td>{{ scheduleText(source) }}</td>
|
||||
<td>
|
||||
<span v-if="source.lastError" class="status-bad">{{ source.lastError }}</span>
|
||||
|
||||
+12
-4
@@ -202,7 +202,8 @@ button, input, select { font: inherit; }
|
||||
/* tables */
|
||||
.admin-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
}
|
||||
.admin-table th,
|
||||
.admin-table td {
|
||||
@@ -214,12 +215,19 @@ button, input, select { font: inherit; }
|
||||
.admin-table th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
z-index: 2;
|
||||
background: var(--panel-2);
|
||||
color: var(--muted);
|
||||
color: var(--ink);
|
||||
font-size: 12px;
|
||||
font-weight: 550;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.01em;
|
||||
box-shadow: inset 0 -1px 0 var(--line);
|
||||
}
|
||||
.admin-table .cell-clip {
|
||||
max-width: 280px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.admin-table tbody tr:last-child td { border-bottom: 0; }
|
||||
.admin-table tbody tr:hover td { background: var(--hover); }
|
||||
|
||||
Reference in New Issue
Block a user