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>
|
||||
|
||||
Reference in New Issue
Block a user