Commit 29987689 authored by Data Governance Dev's avatar Data Governance Dev

feat(web3): 任务列表加「表注释」列 + TaskModal 选表时拉存

1. TaskModal.vue

   form 加 tableComment 字段

   watch(form.table) 从 tableOptions 找对应项的 table_comment 写入

   编辑场景从 props.task.table_comment 回填

   payload 加 table_comment: form.tableComment || null

   选表时存一次到 task,列表直接读,零 N+1 查询

2. TaskConfigView.vue

   模板加 <th>表注释</th>(位置在数据表后)

   colspan 8 → 9

   td 渲染 {{ row.table_comment || '—' }}

3. 后端 commit 已加 task.table_comment 列 + 字段流通(commit 3)

   老任务没存过 → 列表显示「—」,重新编辑任务选一次表就有
parent 21ee05b2
...@@ -330,6 +330,8 @@ const form = reactive({ ...@@ -330,6 +330,8 @@ const form = reactive({
oracleClientDir: '', oracleClientDir: '',
schema: '', schema: '',
table: '', table: '',
// 2026-08-21:数据表注释,从 tableOptions 里同步过来,提交时一起发到后端
tableComment: '',
}) })
// 测试连接:调用真实后端 // 测试连接:调用真实后端
...@@ -541,8 +543,12 @@ async function refreshColumnsForEdit() { ...@@ -541,8 +543,12 @@ async function refreshColumnsForEdit() {
} }
// 表变了 → 拉该表的字段(数据字典),刷新校验规则 Tab // 表变了 → 拉该表的字段(数据字典),刷新校验规则 Tab
// 同时同步 table_comment 到 form(提交时一起发到后端存到 task.table_comment,
// 任务列表直接读这列,避免 list_tasks 接口 N+1 查询 list_tables)
watch(() => form.table, (newVal, oldVal) => { watch(() => form.table, (newVal, oldVal) => {
if (newVal !== oldVal) { if (newVal !== oldVal) {
const opt = tableOptions.value.find((t) => t.table_name === newVal)
form.tableComment = opt ? (opt.table_comment || '') : ''
loadColumns() loadColumns()
} }
}) })
...@@ -623,6 +629,8 @@ watch(() => props.open, async (v) => { ...@@ -623,6 +629,8 @@ watch(() => props.open, async (v) => {
form.schema = props.task.schema || '' form.schema = props.task.schema || ''
// 数据表:后端存的是「t_user_info」纯名,前端直接展示 // 数据表:后端存的是「t_user_info」纯名,前端直接展示
form.table = props.task.source_table || '' form.table = props.task.source_table || ''
// 表注释:从 task 回填(之前选表时存进去的);loadTables 完会再同步一次(防 schema 改了 list 重新拉后 comment 不一致)
form.tableComment = props.task.table_comment || ''
// 注:编辑场景不自动拉 schema/表 —— 等用户点「测试连接」再拉 // 注:编辑场景不自动拉 schema/表 —— 等用户点「测试连接」再拉
// 编辑场景:把详情里的 field_list(带 rules)回填到字段表,省得用户重新走一遍 // 编辑场景:把详情里的 field_list(带 rules)回填到字段表,省得用户重新走一遍
// cn/data_type 是「编辑时重新取」的——不回填,留空让用户重新测试连接后从 listColumns 补 // cn/data_type 是「编辑时重新取」的——不回填,留空让用户重新测试连接后从 listColumns 补
...@@ -708,6 +716,8 @@ function onSave() { ...@@ -708,6 +716,8 @@ function onSave() {
source_table: form.table || null, source_table: form.table || null,
description: form.desc, description: form.desc,
conn_json: connJson, conn_json: connJson,
// 2026-08-21:选表时从 tableOptions 同步到 form.tableComment,提交时发给后端存到 task.table_comment
table_comment: form.tableComment || null,
fields: fieldList.value.map((f) => ({ // P4 落库用 fields: fieldList.value.map((f) => ({ // P4 落库用
key: f.key, key: f.key,
en: f.en, en: f.en,
......
...@@ -31,19 +31,20 @@ ...@@ -31,19 +31,20 @@
<table class="config-list"> <table class="config-list">
<thead> <thead>
<tr> <tr>
<th>任务名称</th><th>分组</th><th>数据库</th><th>数据表</th> <th>任务名称</th><th>分组</th><th>数据库</th><th>数据表</th><th>表注释</th>
<th>字段数</th><th>规则数</th><th>最近检测</th><th>操作</th> <th>字段数</th><th>规则数</th><th>最近检测</th><th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-if="!loading && list.length === 0"> <tr v-if="!loading && list.length === 0">
<td colspan="8" style="text-align:center;color:#909399;padding:24px;">暂无任务,点击右上「+ 新增任务」</td> <td colspan="9" style="text-align:center;color:#909399;padding:24px;">暂无任务,点击右上「+ 新增任务」</td>
</tr> </tr>
<tr v-for="row in list" :key="row.id"> <tr v-for="row in list" :key="row.id">
<td>{{ row.name }}</td> <td>{{ row.name }}</td>
<td><span class="tag" :class="`tag-${tagColor(row.group)}`">{{ row.group }}</span></td> <td><span class="tag" :class="`tag-${tagColor(row.group)}`">{{ row.group }}</span></td>
<td>{{ row.db || row.db_type }}</td> <td>{{ row.db || row.db_type }}</td>
<td>{{ row.source_table || '—' }}</td> <td>{{ row.source_table || '—' }}</td>
<td>{{ row.table_comment || '—' }}</td>
<td>{{ row.fields }}</td> <td>{{ row.fields }}</td>
<td>{{ row.rules }}</td> <td>{{ row.rules }}</td>
<td>{{ formatCheckedAt(row.checked_at) }}</td> <td>{{ formatCheckedAt(row.checked_at) }}</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment