代码提交
This commit is contained in:
parent
9c94734322
commit
5963863b0b
|
|
@ -10,7 +10,7 @@ export const formLabel = [
|
||||||
]
|
]
|
||||||
|
|
||||||
export const columnsList = [
|
export const columnsList = [
|
||||||
{ t_props: 'standardType', t_label: '文件命名识别规范类型' },
|
{ t_props: 'standardTypeName', t_label: '文件命名识别规范类型' },
|
||||||
{ t_props: 'standardName', t_label: '规范识别值' },
|
{ t_props: 'standardName', t_label: '规范识别值' },
|
||||||
{ t_props: 'updateUserName', t_label: '更新人' },
|
{ t_props: 'updateUserName', t_label: '更新人' },
|
||||||
{ t_props: 'updateTime', t_label: '更新时间' },
|
{ t_props: 'updateTime', t_label: '更新时间' },
|
||||||
|
|
|
||||||
|
|
@ -143,20 +143,30 @@ export default {
|
||||||
// 安全解析与渲染
|
// 安全解析与渲染
|
||||||
this.columns = []
|
this.columns = []
|
||||||
this.tableData = []
|
this.tableData = []
|
||||||
if (!res || !Array.isArray(res.rows) || res.rows.length === 0) return
|
if (!res || !Array.isArray(res.rows) || res.rows.length === 0) {
|
||||||
|
this.forceTableLayout()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const firstRow = res.rows[0]
|
const firstRow = res.rows[0]
|
||||||
if (!firstRow || !firstRow.dataJson) return
|
if (!firstRow || !firstRow.dataJson) {
|
||||||
|
this.forceTableLayout()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let dataList = []
|
let dataList = []
|
||||||
try {
|
try {
|
||||||
dataList = JSON.parse(firstRow.dataJson)
|
dataList = JSON.parse(firstRow.dataJson)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('数据集 dataJson 解析失败:', e)
|
console.warn('数据集 dataJson 解析失败:', e)
|
||||||
|
this.forceTableLayout()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Array.isArray(dataList) || dataList.length === 0) return
|
if (!Array.isArray(dataList) || dataList.length === 0) {
|
||||||
|
this.forceTableLayout()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const [header, ...rows] = dataList
|
const [header, ...rows] = dataList
|
||||||
if (header && typeof header === 'object') {
|
if (header && typeof header === 'object') {
|
||||||
|
|
@ -169,7 +179,7 @@ export default {
|
||||||
align: index === 0 ? 'left' : 'center',
|
align: index === 0 ? 'left' : 'center',
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
// 将数据行统一转换为对象行,按 columns 的 prop 顺序映射,确保搜索可用
|
|
||||||
const propOrder = this.columns.map(c => c.prop)
|
const propOrder = this.columns.map(c => c.prop)
|
||||||
this.tableData = rows.map(row => {
|
this.tableData = rows.map(row => {
|
||||||
if (Array.isArray(row)) {
|
if (Array.isArray(row)) {
|
||||||
|
|
@ -181,8 +191,22 @@ export default {
|
||||||
}
|
}
|
||||||
return row || {}
|
return row || {}
|
||||||
})
|
})
|
||||||
// 数据变更后重新计算高度
|
|
||||||
|
this.forceTableLayout()
|
||||||
|
},
|
||||||
|
|
||||||
|
// 强制表格重新布局
|
||||||
|
forceTableLayout() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
// 获取表格实例并调用 doLayout
|
||||||
|
const table = this.$el.querySelector('.el-table')
|
||||||
|
if (table && table.__vue__) {
|
||||||
|
table.__vue__.doLayout()
|
||||||
|
}
|
||||||
this.computeTableHeight()
|
this.computeTableHeight()
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 计算表格高度(使用固定 height,滚动更顺滑)
|
// 计算表格高度(使用固定 height,滚动更顺滑)
|
||||||
computeTableHeight() {
|
computeTableHeight() {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>URL</th>
|
<th>URL</th>
|
||||||
<td>smartArchives/data/Collect/queryById?id={{ rowData.selectedNodeId }}&jsonId={{ rowData.jsonId }}</td>
|
<td>smart-archiving-api/smartArchives/data/Collect/queryById?id={{ rowData.selectedNodeId }}&jsonId={{ rowData.jsonId }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>HTTP请求方式</th>
|
<th>HTTP请求方式</th>
|
||||||
|
|
@ -88,7 +88,13 @@ export default {
|
||||||
payload = this.rowData
|
payload = this.rowData
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.resultJson = JSON.stringify(payload, null, 2)
|
this.resultJson = JSON.stringify(payload, function(key, value) {
|
||||||
|
// 过滤掉指定的字段
|
||||||
|
if (key === 'selectedNodeName' || key === 'selectedNodeId' || key === 'jsonId') {
|
||||||
|
return undefined; // 返回 undefined 会忽略该属性
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}, 2);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.resultJson = String(payload)
|
this.resultJson = String(payload)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue