数据汇集管理

This commit is contained in:
cwchen 2025-09-12 15:46:53 +08:00
parent 4878d9c12f
commit 53d74048a1
4 changed files with 270 additions and 8 deletions

View File

@ -52,17 +52,23 @@ export default {
methods: { methods: {
// //
onHandleNodeClick(data) { onHandleNodeClick(data) {
console.log(data)
this.$emit('handleNodeClick', data) this.$emit('handleNodeClick', data)
}, },
convertToVueTree(data) {
return data.map(item => ({
id: item.code,
label: item.name,
children: item.kyDataClassifyList ? item.kyDataClassifyList.map(child => ({
id: child.id,
label: child.dataTypeName,
children: []
})) : []
}));
},
// //
async getLeftTreeList() { async getLeftTreeList() {
const res = await getLeftTreeListAPI() const res = await getLeftTreeListAPI()
const transformedData = res.rows.map(item => ({ const transformedData = this.convertToVueTree(res.rows)
id: item.id,
label: item.dataTypeName
}));
this.treeDataList[0].children = transformedData this.treeDataList[0].children = transformedData
// //
this.originalTreeData = JSON.parse(JSON.stringify(this.treeDataList)) this.originalTreeData = JSON.parse(JSON.stringify(this.treeDataList))

View File

@ -20,27 +20,46 @@
</el-form> </el-form>
<!-- 表格 --> <!-- 表格 -->
<el-table :data="filteredTableData" border :height="tableHeight" style="width: 100%"> <el-table :data="filteredTableData" border :height="tableHeight" style="width: 100%" header-align="center">
<el-table-column v-if="tableData && tableData.length" type="index" label="序号" width="60" align="center" /> <el-table-column v-if="tableData && tableData.length" type="index" label="序号" width="60" align="center" />
<el-table-column align="center" :key="column.prop" :prop="column.prop" :label="column.label" <el-table-column align="center" :key="column.prop" :prop="column.prop" :label="column.label"
v-for="column in columns" /> v-for="column in columns" />
<el-table-column v-if="tableData && tableData.length" label="操作" width="100" align="center" fixed="right" class-name="action-col" label-class-name="action-col-header">
<template slot-scope="{ row }">
<el-button plain type="primary" size="mini" class="action-btn" icon="el-icon-share" @click="handleShare(row)">分享</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<Share v-if="isflag" :rowData="row" :title="title"
@closeDialog="closeDialog" @showColose="showColose" :dataForm="row" :disabled="loading" :width="600" />
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import { getListDataSetAPI } from '@/api/data-collect/data-set-manage' import { getListDataSetAPI } from '@/api/data-collect/data-set-manage'
import Share from './share.vue'
export default { export default {
name: 'RightTable', name: 'RightTable',
components: {
Share
},
props: { props: {
selectedNodeId: { selectedNodeId: {
type: [Number, String], type: [Number, String],
default: 0, default: 0,
}, },
selectedNodeName: {
type: [String],
default: '',
},
}, },
data() { data() {
return { return {
isflag: false,
loading: false,
row: {},
title: '分享',
queryParams: { queryParams: {
dataTypeName: undefined, dataTypeName: undefined,
}, },
@ -59,6 +78,21 @@ export default {
}, },
}, },
methods: { methods: {
//
handleShare(row) {
this.isflag = true;
row.selectedNodeName = this.selectedNodeName;
row.selectedNodeId = this.selectedNodeId;
console.log(row);
this.row = row;
},
closeDialog() {
this.isflag = false;
},
showColose() {
this.isflag = false;
},
// //
onHandleQuery() { onHandleQuery() {
if (!Array.isArray(this.columns) || this.columns.length < 1) return if (!Array.isArray(this.columns) || this.columns.length < 1) return
@ -164,6 +198,12 @@ export default {
}, },
immediate: true, // immediate: true, //
}, },
selectedNodeName: {
handler(newVal2) {
this.selectedNodeName = newVal2
},
immediate: true, //
},
}, },
mounted() { mounted() {
@ -201,4 +241,23 @@ export default {
::v-deep .el-table__fixed-body-wrapper::-webkit-scrollbar-thumb:hover { ::v-deep .el-table__fixed-body-wrapper::-webkit-scrollbar-thumb:hover {
background: #a6a6a6; background: #a6a6a6;
} }
/* 操作列样式统一,避免按钮受表格行样式影响抖动或换行 */
/* 操作列单元格与其它列统一高度与内边距,避免不对齐 */
::v-deep .action-col .cell {
display: flex;
align-items: center;
justify-content: center;
padding: 0 8px !important;
height: 100%;
}
::v-deep .action-col-header .cell {
font-weight: 600;
}
.action-btn {
padding: 3px 8px;
line-height: 1;
}
</style> </style>

View File

@ -0,0 +1,195 @@
<template>
<!-- 小型弹窗 -->
<el-dialog class="l-dialog" :class="lDialog" :title="title" :visible.sync="dialogVisible" :showClose="true"
:closeOnClickModal="false" @close="handleClose" :append-to-body="true">
<div>
<!-- 文档式表格 -->
<div class="doc-wrap">
<table class="doc-table">
<tbody>
<tr>
<th>名称</th>
<td>获取{{ rowData.selectedNodeName }}接口</td>
</tr>
<tr>
<th>描述</th>
<td>依据ID获取{{ rowData.selectedNodeName }}相关信息</td>
</tr>
<tr>
<th>URL</th>
<td>smartArchives/data/Collect/list?id={{ rowData.id }}</td>
</tr>
<tr>
<th>HTTP请求方式</th>
<td>GET</td>
</tr>
<tr>
<th>请求参数</th>
<td>
<table class="inner-table">
<thead>
<tr>
<th>参数名称</th>
<th>必选</th>
<th>类型及范围</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>true</td>
<td>字符串</td>
<td>/</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<th>返回结果</th>
<td>
<pre class="code" v-text="resultJson"></pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="clear-btn" @click="handleClose" :disabled="disabled">取消</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
name: "Share",
props: ["width", "dataForm", "title", "disabled", "rowData"],
data() {
return {
lDialog: this.width > 500 ? "w700" : "w500",
dialogVisible: true,
isDisabled: true,
resultJson: '',
};
},
created() {
this.initFormData();
},
methods: {
/** 初始化表单数据 */
initFormData() {
if (this.rowData) {
// rowData data JSON
let payload = this.rowData && this.rowData.data
if (payload === undefined) {
// data rowData
payload = this.rowData
}
try {
this.resultJson = JSON.stringify(payload, null, 2)
} catch (e) {
this.resultJson = String(payload)
}
}
},
/*关闭弹窗 */
handleClose() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
/**确认弹窗 */
sureBtnClick() {
this.dialogVisible = false;
this.$emit("closeDialog");
setTimeout(() => {
this.dialogVisible = true;
});
},
},
};
</script>
<style lang="scss">
.w700 .el-dialog {
width: 700px;
}
.w500 .el-dialog {
width: 500px;
}
.w500 .el-dialog__header,
.w700 .el-dialog__header {
// background: #eeeeee;
.el-dialog__title {
font-size: 16px;
}
}
.yxq .el-range-separator {
margin-right: 7px !important;
}
.el-date-editor--daterange.el-input__inner {
width: 260px;
}
.form-item {
width: 100%;
}
.select-style {
display: flex;
justify-content: space-between;
}
.doc-wrap {
margin-top: 8px;
}
.doc-table {
width: 100%;
border-collapse: collapse;
table-layout: fixed;
}
.doc-table th,
.doc-table td {
border: 1px solid #dcdfe6;
padding: 8px 10px;
vertical-align: top;
}
.doc-table th {
width: 120px;
background: #f5f7fa;
color: #303133;
text-align: right;
}
.doc-table .inner-table {
width: 100%;
border-collapse: collapse;
}
.doc-table .inner-table th,
.doc-table .inner-table td {
border: 1px solid #e4e7ed;
padding: 6px 8px;
text-align: left;
}
.code {
background: #f8f8f8;
border: 1px solid #ebeef5;
padding: 8px;
border-radius: 4px;
white-space: pre-wrap;
word-break: break-all;
}
</style>

View File

@ -6,7 +6,7 @@
<LeftTree @handleNodeClick="handleNodeClick" /> <LeftTree @handleNodeClick="handleNodeClick" />
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<RightTable :selectedNodeId="selectedNodeId" /> <RightTable :selectedNodeId="selectedNodeId" :selectedNodeName="selectedNodeName" />
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -25,12 +25,14 @@ export default {
return { return {
// ID // ID
selectedNodeId: 0, selectedNodeId: 0,
selectedNodeName: '',
} }
}, },
methods: { methods: {
// //
handleNodeClick(data) { handleNodeClick(data) {
this.selectedNodeId = data.id this.selectedNodeId = data.id
this.selectedNodeName = data.label
}, },
}, },
} }