代码提交

This commit is contained in:
liang.chao 2025-10-23 13:54:32 +08:00
parent 9c94734322
commit 5963863b0b
3 changed files with 85 additions and 55 deletions

View File

@ -10,9 +10,9 @@ export const formLabel = [
]
export const columnsList = [
{ t_props: 'standardType', t_label: '文件命名识别规范类型' },
{ t_props: 'standardTypeName', t_label: '文件命名识别规范类型' },
{ t_props: 'standardName', t_label: '规范识别值' },
{ t_props: 'updateUserName', t_label: '更新人' },
{ t_props: 'updateTime', t_label: '更新时间' },
{ t_props: 'remark', t_label: '备注' }
]
]

View File

@ -82,12 +82,12 @@ export default {
//
handleShare(row) {
// console.log(row);
this.isflag = true;
row.selectedNodeName = this.selectedNodeName;
row.selectedNodeId = this.selectedNodeId;
row.jsonId = row.id;
this.row = row;
},
closeDialog() {
@ -96,7 +96,7 @@ export default {
showColose() {
this.isflag = false;
},
//
onHandleQuery() {
if (!Array.isArray(this.columns) || this.columns.length < 1) return
@ -108,13 +108,13 @@ export default {
this.filteredManual = null
return
}
//
if (!validSecurity(keyword)) {
this.$message.error('搜索内容包含非法字符,请重新输入')
return
}
//
const source = Array.isArray(this.tableData) ? this.tableData : []
const kw = keyword.toLowerCase()
@ -134,56 +134,80 @@ export default {
},
//
async getListDataSetClassFun(node) {
const params = {
dataClassifyId: node,
async getListDataSetClassFun(node) {
const params = {
dataClassifyId: node,
}
const res = await getListDataSetAPI(params)
//
this.columns = []
this.tableData = []
if (!res || !Array.isArray(res.rows) || res.rows.length === 0) {
this.forceTableLayout()
return
}
const firstRow = res.rows[0]
if (!firstRow || !firstRow.dataJson) {
this.forceTableLayout()
return
}
let dataList = []
try {
dataList = JSON.parse(firstRow.dataJson)
} catch (e) {
console.warn('数据集 dataJson 解析失败:', e)
this.forceTableLayout()
return
}
if (!Array.isArray(dataList) || dataList.length === 0) {
this.forceTableLayout()
return
}
const [header, ...rows] = dataList
if (header && typeof header === 'object') {
this.columns = Object.entries(header)
.filter(([prop]) => String(prop).toLowerCase() !== 'id')
.map(([prop, label], index) => ({
label: String(label),
prop: String(prop),
width: index === 0 ? '120' : undefined,
align: index === 0 ? 'left' : 'center',
}))
}
const propOrder = this.columns.map(c => c.prop)
this.tableData = rows.map(row => {
if (Array.isArray(row)) {
const obj = {}
for (let i = 0; i < propOrder.length; i++) {
obj[propOrder[i]] = row[i]
}
const res = await getListDataSetAPI(params)
return obj
}
return row || {}
})
//
this.columns = []
this.tableData = []
if (!res || !Array.isArray(res.rows) || res.rows.length === 0) return
this.forceTableLayout()
},
const firstRow = res.rows[0]
if (!firstRow || !firstRow.dataJson) return
let dataList = []
try {
dataList = JSON.parse(firstRow.dataJson)
} catch (e) {
console.warn('数据集 dataJson 解析失败:', e)
return
//
forceTableLayout() {
this.$nextTick(() => {
setTimeout(() => {
// doLayout
const table = this.$el.querySelector('.el-table')
if (table && table.__vue__) {
table.__vue__.doLayout()
}
if (!Array.isArray(dataList) || dataList.length === 0) return
const [header, ...rows] = dataList
if (header && typeof header === 'object') {
this.columns = Object.entries(header)
.filter(([prop]) => String(prop).toLowerCase() !== 'id')
.map(([prop, label], index) => ({
label: String(label),
prop: String(prop),
width: index === 0 ? '120' : undefined,
align: index === 0 ? 'left' : 'center',
}))
}
// columns prop
const propOrder = this.columns.map(c => c.prop)
this.tableData = rows.map(row => {
if (Array.isArray(row)) {
const obj = {}
for (let i = 0; i < propOrder.length; i++) {
obj[propOrder[i]] = row[i]
}
return obj
}
return row || {}
})
//
this.computeTableHeight()
},
}, 100)
})
},
// 使 height
computeTableHeight() {
this.$nextTick(() => {

View File

@ -17,7 +17,7 @@
</tr>
<tr>
<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>
<th>HTTP请求方式</th>
@ -88,7 +88,13 @@ export default {
payload = this.rowData
}
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) {
this.resultJson = String(payload)
}
@ -192,4 +198,4 @@ export default {
white-space: pre-wrap;
word-break: break-all;
}
</style>
</style>