This commit is contained in:
RenCheng 2025-06-21 21:38:32 +08:00
commit 714f22247b
6 changed files with 783 additions and 621 deletions

View File

@ -40,18 +40,25 @@ export default {
submitForm: { submitForm: {
schemaMass: null, schemaMass: null,
tableName: null, tableName: null,
fieldValues: null fieldValues: null,
sourceType: null,
mdl: null,
hn: null
} }
} }
}, },
created() { created() {
}, },
methods: { methods: {
initForm(schemaMass, tableName, columns, record) { initForm(schemaMass, tableName, columns, record, sourceType, mdl, hn) {
console.log('接收', sourceType)
this.visible = true; this.visible = true;
this.nodes = columns this.nodes = columns
this.submitForm.schemaMass = schemaMass this.submitForm.schemaMass = schemaMass
this.submitForm.tableName = tableName this.submitForm.tableName = tableName
this.submitForm.sourceType = sourceType
this.submitForm.mdl = mdl
this.submitForm.hn = hn
this.form = record this.form = record
}, },
close() { close() {
@ -64,6 +71,7 @@ export default {
if (valid) { if (valid) {
that.confirmLoading = true; that.confirmLoading = true;
that.submitForm.fieldValues = that.form that.submitForm.fieldValues = that.form
updateDmTableBySeqNo(that.submitForm).then((res) => { updateDmTableBySeqNo(that.submitForm).then((res) => {
if (res.success) { if (res.success) {
that.$message.success(res.message); that.$message.success(res.message);

View File

@ -50,7 +50,10 @@ import {getAction} from '@/api/manage'
title:"导出日志", title:"导出日志",
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
sourceType: null,
schemaMass:null, schemaMass:null,
mdl: null,
hn: null,
dataSource:[], dataSource:[],
selectedRowKeys: [], selectedRowKeys: [],
columns: [ columns: [
@ -115,13 +118,16 @@ import {getAction} from '@/api/manage'
}, },
methods: { methods: {
add (schemaMass) { add (sourceType, schemaMass, mdl, hn) {
this.visible =true; this.visible =true;
this.sourceType = sourceType;
this.schemaMass = schemaMass; this.schemaMass = schemaMass;
this.mdl = mdl;
this.hn = hn;
this.getTableInfo(); this.getTableInfo();
}, },
getTableInfo(){ getTableInfo(){
getAction("/dataManager/DmExportLog?schemaMass="+this.schemaMass,{}).then(res => { getAction("/dataManager/DmExportLog?schemaMass="+this.schemaMass + '&mdl='+ this.mdl + '&hn=' + this.hn + '&sourceType='+this.sourceType,{}).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.dataSource = res.result this.dataSource = res.result
console.log(this.dataSource) console.log(this.dataSource)

View File

@ -46,9 +46,11 @@ import { metaDataTypeTree } from '@/api/metaData'
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
queryParam: { queryParam: {
sourceType: 2, sourceType: null,
schemaMass: null, schemaMass: null,
massKey: null massKey: null,
mdl: null,
hn: null
}, },
dataSource:[], dataSource:[],
selectedRowKeys: [], selectedRowKeys: [],
@ -80,9 +82,12 @@ import { metaDataTypeTree } from '@/api/metaData'
}, },
methods: { methods: {
add (schemaMass) { add (sourceType, schemaMass, mdl, hn) {
this.visible =true; this.visible =true;
this.queryParam.sourceType = sourceType;
this.queryParam.schemaMass = schemaMass; this.queryParam.schemaMass = schemaMass;
this.queryParam.mdl = mdl;
this.queryParam.hn = hn;
this.getTableInfo(); this.getTableInfo();
}, },
getTableInfo(){ getTableInfo(){

View File

@ -47,9 +47,9 @@
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="24" :sm="24" style="text-align: right;"> <a-col :md="24" :sm="24" style="text-align: right;">
<a-button @click="getTableDataList" type="primary">查询</a-button>&nbsp; <a-button @click="getTableDataList" type="primary">查询</a-button>&nbsp;
<a-button @click="exportTool" type="primary">导出dmp</a-button>&nbsp; <!-- <a-button @click="exportTool" type="primary">导出dmp</a-button>&nbsp;
<a-button @click="handleAdd" type="primary">导出csvtxt</a-button>&nbsp; <a-button @click="handleAdd" type="primary">导出csvtxt</a-button>&nbsp;
<a-button @click="openexptable" type="primary">导出日志</a-button> <a-button @click="openexptable" type="primary">导出日志</a-button> -->
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
@ -192,9 +192,9 @@ export default {
getselect() { getselect() {
getAction("/dataType/getExistingDataTypes", {}).then((res) => { getAction("/dataType/getExistingDataTypes", {}).then((res) => {
if (res.success) { if (res.success) {
this.dataTypedataSources = res.result.result.DATA_CONN_STANDARD this.dataTypedataSources = res.result.result.special
if (res.result.result.DATA_CONN_STANDARD.length > 0) { if (res.result.result.special.length > 0) {
this.queryParam.schemaMass = res.result.result.DATA_CONN_STANDARD[0].cnName this.queryParam.schemaMass = res.result.result.special[0].cnName
} }
this.getMetaDataTypeTree(); this.getMetaDataTypeTree();
} else { } else {

View File

@ -1,88 +1,109 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="30"> <a-row :gutter="30">
<a-col :md="20"> <a-col :md="20">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="4" :sm="4"> <a-col :md="4" :sm="4">
<a-form-item label="数据类型"> <a-form-item label="型号">
<a-select placeholder="选择数据类型" option-filter-prop="children" v-model="queryParam.schemaMass" <a-select placeholder="选择型号" option-filter-prop="children" show-search
@change="handleTypeChange"> :filter-option="filterOption" v-model="queryParam.mdl" @change="changeshipModel">
<a-select-option v-for="d in dataTypedataSources" :key="d.cnName"> <a-select-option v-for="item in shipModel" :value="item">
{{ d.cnName }} {{ item }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="4" :sm="4"> <a-col :md="4" :sm="4">
<a-form-item label="任务"> <a-form-item label="舷号">
<a-select placeholder="选择任务" option-filter-prop="children" v-model="activeTaskId" <a-select placeholder="选择舷号" option-filter-prop="children" show-search
@change="handleTaskChange"> :filter-option="filterOption" v-model="queryParam.hn" @change="changeshipNumber">
<a-select-option v-for="d in allTask" :key="d.id"> <a-select-option v-for="item in shipNumber" :value="item">
{{ d.name }} {{ item }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="8"> <a-col :md="4" :sm="4">
<a-form-item label="时间范围"> <a-form-item label="数据类型">
<!-- <a-range-picker :default-value="defaultTime" show-time :show-time="{ format: 'HH:mm:ss' }" <a-select placeholder="选择数据类型" option-filter-prop="children" v-model="queryParam.schemaMass"
@change="handleTypeChange">
<a-select-option v-for="item in dataTypeList" :value="item.cnName">
{{ item.cnName }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="4">
<a-form-item label="任务">
<a-select placeholder="选择任务" option-filter-prop="children" v-model="activeTaskId"
@change="handleTaskChange">
<a-select-option v-for="d in allTask" :key="d.id">
{{ d.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="8" :sm="8">
<a-form-item label="时间范围">
<!-- <a-range-picker :default-value="defaultTime" show-time :show-time="{ format: 'HH:mm:ss' }"
:format="dateFormat" @change="onChangeTime" /> --> :format="dateFormat" @change="onChangeTime" /> -->
<a-range-picker :show-time="{ format: 'HH:mm:ss' }" v-model="defaultTime" format="YYYY-MM-DD HH:mm:ss" <a-range-picker :show-time="{ format: 'HH:mm:ss' }" v-model="defaultTime"
@change="onChangeTime" /> format="YYYY-MM-DD HH:mm:ss" @change="onChangeTime" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="5" :sm="5"> <a-col :md="5" :sm="5">
<a-form-item label="关键词"> <a-form-item label="关键词">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.massKey"></a-input> <a-input placeholder="请输入搜索关键词" v-model="queryParam.massKey"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="24" :sm="24" style="text-align: right;"> <a-col :md="24" :sm="24" style="text-align: right;">
<a-button @click="getTableDataList" type="primary">查询</a-button>&nbsp; <a-button @click="getTableDataList" type="primary">查询</a-button>&nbsp;
<a-button @click="exportTool" type="primary">导出dmp</a-button>&nbsp; <a-button @click="exportTool" type="primary">导出dmp</a-button>&nbsp;
<a-button @click="handleAdd" type="primary">导出csvtxt</a-button>&nbsp; <a-button @click="handleAdd" type="primary">导出csvtxt</a-button>&nbsp;
<a-button @click="openexptable" type="primary">导出日志</a-button> <a-button @click="openexptable" type="primary">导出日志</a-button>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<a-row :gutter="30" style="padding: 0 10px;"> <a-row :gutter="30" style="padding: 0 10px;">
<a-col :md="6"> <a-col :md="6">
<div class="linese"></div> <div class="linese"></div>
<!-- 分类区域 --> <!-- 分类区域 -->
<div style="height:calc(100vh - 366px);overflow: auto;background: #e6e9f1;padding:10px;" ref="treeContainer"> <div style="height:calc(100vh - 420px);overflow: auto;background: #e6e9f1;padding:10px;"
<a-tree :tree-data="treeDate" @select="onSelect" /> ref="treeContainer">
</div> <a-tree :tree-data="treeDate" @select="onSelect" />
<div class="linese"></div> </div>
</a-col> <div class="linese"></div>
<a-col :md="18"> </a-col>
<div class="linese"></div> <a-col :md="18">
<!-- 表格区域 --> <div class="linese"></div>
<div style="height:calc(100vh - 420px);background: #e6e9f1;overflow:hidden;padding: 15px;"> <!-- 表格区域 -->
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading" <div style="height:calc(100vh - 420px);background: #e6e9f1;overflow:hidden;padding: 15px;">
:pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号" <a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
@change="handleTableChange"> :pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号"
<template slot="operation" slot-scope="text, record"> @change="handleTableChange">
<a-button type="primary" @click="handelEdit(record)">编辑</a-button> <template slot="operation" slot-scope="text, record">
</template> <a-button type="primary" @click="handelEdit(record)">编辑</a-button>
</a-table> </template>
</div> </a-table>
<div class="linese"></div> </div>
</a-col> <div class="linese"></div>
</a-row> </a-col>
<tablelist ref="modalForm"></tablelist> </a-row>
<exptable ref="exptable"></exptable> <tablelist ref="modalForm"></tablelist>
<editdataseach ref="editdataseachForm" @ok="getTableDataList" /> <exptable ref="exptable"></exptable>
</a-card> <editdataseach ref="editdataseachForm" @ok="getTableDataList" />
</a-card>
</template> </template>
<script> <script>
import { metaDataTypeTree, tableDataList, DmExportTool } from '@/api/metaData' import { metaDataTypeTree, tableDataList, DmExportTool } from '@/api/metaData'
@ -91,238 +112,289 @@ import { getAllTask } from '@/api/task'
import moment from 'moment'; import moment from 'moment';
import tablelist from '../../data/modules/tablelist.vue' import tablelist from '../../data/modules/tablelist.vue'
import exptable from '../../data/modules/exptable.vue' import exptable from '../../data/modules/exptable.vue'
import editdataseach from '../../data/modules/editdataseach.vue' import editdataseach from '../../data/modules/editdataseach.vue'
export default { export default {
name: "metadata", name: "metadata",
components: { components: {
tablelist, tablelist,
exptable, exptable,
editdataseach editdataseach
}, },
data() { data() {
return { return {
moment, moment,
dateFormat: 'YYYY-MM-DD HH:mm:ss', dateFormat: 'YYYY-MM-DD HH:mm:ss',
defaultTime: [], defaultTime: [],
loading: false, loading: false,
allTask: [], allTask: [],
activeTaskId: null, activeTaskId: null,
// pagination: {
queryParam: { defaultCurrent: 1, //
sourceType: 2, defaultPageSize: 10, // total: 0, //
schemaMass: null, showSizeChanger: true,
massKey: null showQuickJumper: false,
}, pageSizeOptions: ['10', '20', '30'],
pagination: { showTotal: total => `总共 ${total} 个项目`, //
defaultCurrent: 1, // onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize)
defaultPageSize: 10, // total: 0, // },
showSizeChanger: true, //
showQuickJumper: false, queryParam: {
pageSizeOptions: ['10', '20', '30'], sourceType: 2,
showTotal: total => `总共 ${total} 个项目`, // massKey: null,
onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize) mdl: null, //
}, hn: null, //
tableParams: { schemaMass: null,
schemaMass: null, tableName: null,
tableName: null, startTime: null,
startTime: null, endTime: null,
endTime: null, pageSize: 10,
pageSize: 10, pageNum: 1
pageNum: 1 },
}, treeDate: [],
treeDate: [], dataSource: [],
dataSource: [], columns: [],
columns: [], dataTypeList: [],
dataTypedataSources: [], shipModel: [],
treeHeight: 0 shipNumber: [],
} existingDataTypes: {},
}, treeHeight: 0
watch: { }
'queryParam.massKey'(value) { },
this.queryParam.massKey = value watch: {
this.getMetaDataTypeTree() 'queryParam.massKey'(value) {
} this.queryParam.massKey = value
}, this.getMetaDataTypeTree()
mounted() { }
this.calculateScrollY(); },
}, mounted() {
computed: { this.calculateScrollY();
},
computed: {
},
created() {
this.getselect()
this.queryAllTask()
// this.initDate()
},
methods: {
queryAllTask() {
getAllTask().then(res => {
console.log('res', res)
if (res.success) {
this.allTask = res.result
if (res.result.length > 0) {
this.activeTaskId = res.result[0].id
const start = moment(res.result[0].startTime)
const end = moment(res.result[0].endTime)
this.defaultTime.push(start, end)
this.tableParams.startTime = start.format(this.dateFormat);
this.tableParams.endTime = end.format(this.dateFormat)
}
} else {
this.$message.warning(res.message);
}
})
}, },
handleTaskChange(value) { created() {
var curTask = this.allTask.filter(item => item.id == value)[0] this.getselect()
if (curTask) { this.queryAllTask()
const start = moment(curTask.startTime) // this.initDate()
const end = moment(curTask.endTime)
this.defaultTime=[start, end]
this.tableParams.startTime = start.format(this.dateFormat);
this.tableParams.endTime = end.format(this.dateFormat)
}
}, },
calculateScrollY() { methods: {
// queryAllTask() {
const container = this.$refs.treeContainer; getAllTask().then(res => {
this.treeHeight = container.clientHeight; if (res.success) {
}, this.allTask = res.result
getselect() { if (res.result.length > 0) {
getAction("/dataType/getExistingDataTypes", {}).then((res) => { this.activeTaskId = res.result[0].id
if (res.success) { const start = moment(res.result[0].startTime)
this.dataTypedataSources = res.result.result.DATA_CONN_STANDARD const end = moment(res.result[0].endTime)
if (res.result.result.DATA_CONN_STANDARD.length > 0) { this.defaultTime.push(start, end)
this.queryParam.schemaMass = res.result.result.DATA_CONN_STANDARD[0].cnName this.queryParam.startTime = start.format(this.dateFormat);
} this.queryParam.endTime = end.format(this.dateFormat)
this.getMetaDataTypeTree(); }
} else { } else {
this.$message.warning(res.message); this.$message.warning(res.message);
} }
}); })
}, },
handleAdd() { handleTaskChange(value) {
if (this.queryParam.schemaMass == "") { var curTask = this.allTask.filter(item => item.id == value)[0]
this.$message.warning("请选择导出的数据类型"); if (curTask) {
return; const start = moment(curTask.startTime)
} const end = moment(curTask.endTime)
this.$refs.modalForm.add(this.queryParam.schemaMass); this.defaultTime = [start, end]
}, this.queryParam.startTime = start.format(this.dateFormat);
openexptable() { this.queryParam.endTime = end.format(this.dateFormat)
if (this.queryParam.schemaMass == "") { }
this.$message.warning("请选择查询的导出的数据类型"); },
return; calculateScrollY() {
} //
this.$refs.exptable.add(this.queryParam.schemaMass); const container = this.$refs.treeContainer;
}, this.treeHeight = container.clientHeight;
getMetaDataTypeTree() { },
metaDataTypeTree(this.queryParam).then(res => {
if (res.code == 200) { filterOption(input, option) {
this.treeDate = [] return (
var keys = Object.keys(res.result) option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
keys.forEach((element, index) => { );
const _children = res.result[element] },
var childrenList = [] changeshipModel(value) {
_children.forEach((childrenNode, chil) => { this.queryParam.shipModel = value
childrenList.push({ var number = Object.keys(this.existingDataTypes[value])
key: childrenNode.tableName, this.shipNumber = []
type: 'childern', number.forEach((element, index) => {
title: childrenNode.massName this.shipNumber.push(element);
})
}); });
this.treeDate.push({ this.dataTypeList = this.existingDataTypes[value][this.shipNumber[0]]
key: 'type_' + index, this.queryParam.mdl = this.shipNumber[0]
type: 'parentType', this.queryParam.schemaMass = this.dataTypeList[0].cnName
title: element, },
children: childrenList changeshipNumber(value) {
this.dataTypeList = this.existingDataTypes[this.queryParam.shipModel][value]
this.queryParam.mdl = value
this.queryParam.schemaMass = this.dataTypeList[0].cnName
},
getselect() {
getAction("/dataType/getExistingDataTypes", {}).then((res) => {
if (res.success) {
this.existingDataTypes = res.result.result.standard
var ship = Object.keys(this.existingDataTypes)
ship.forEach((element, index) => {
this.shipModel.push(element);
});
var number = Object.keys(this.existingDataTypes[this.shipModel[0]])
number.forEach((element, index) => {
this.shipNumber.push(element);
});
this.dataTypeList = this.existingDataTypes[this.shipModel[0]][this.shipNumber[0]]
this.queryParam.mdl = this.shipModel[0]
this.queryParam.hn = this.shipNumber[0]
this.queryParam.schemaMass = this.dataTypeList[0].cnName
this.getMetaDataTypeTree()
} else {
this.$message.warning(res.message);
}
});
},
handleAdd() {
if (this.queryParam.mdl == "") {
this.$message.warning("请选择型号");
return;
}
if (this.queryParam.hn == "") {
this.$message.warning("请选择舷号");
return;
}
if (this.queryParam.schemaMass == "") {
this.$message.warning("请选择导出的数据类型");
return;
}
this.$refs.modalForm.add(this.queryParam.sourceType, this.queryParam.schemaMass, this.queryParam.mdl, this.queryParam.hn);
},
openexptable() {
if (this.queryParam.mdl == "") {
this.$message.warning("请选择型号");
return;
}
if (this.queryParam.hn == "") {
this.$message.warning("请选择舷号");
return;
}
if (this.queryParam.schemaMass == "") {
this.$message.warning("请选择查询的导出的数据类型");
return;
}
this.$refs.exptable.add(this.queryParam.sourceType, this.queryParam.schemaMass, this.queryParam.mdl, this.queryParam.hn);
},
getMetaDataTypeTree() {
metaDataTypeTree(this.queryParam).then(res => {
if (res.code == 200) {
this.treeDate = []
var keys = Object.keys(res.result)
keys.forEach((element, index) => {
const _children = res.result[element]
var childrenList = []
_children.forEach((childrenNode, chil) => {
childrenList.push({
key: childrenNode.tableName,
type: 'childern',
title: childrenNode.massName
})
});
this.treeDate.push({
key: 'type_' + index,
type: 'parentType',
title: element,
children: childrenList
})
});
}
}) })
}); },
} handleTypeChange(value) {
}) this.queryParam.schemaMass = value
}, this.getMetaDataTypeTree()
handleTypeChange(value) { },
this.queryParam.schemaMass = value onSelect(selectedKeys, info) {
this.getMetaDataTypeTree() if (info.node.dataRef.type && info.node.dataRef.type == 'childern') {
}, this.queryParam.schemaMass = info.node.$parent.dataRef.title
onSelect(selectedKeys, info) { this.queryParam.tableName = info.node.dataRef.key
if (info.node.dataRef.type && info.node.dataRef.type == 'childern') { this.getTableDataList()
this.tableParams.schemaMass = info.node.$parent.dataRef.title }
this.tableParams.tableName = info.node.dataRef.key },
this.getTableDataList() handleTableChange(pagination, filters, sorter) {
} this.pagination = pagination
}, this.queryParam.pageNum = pagination.current
handleTableChange(pagination, filters, sorter) { this.queryParam.pageSize = pagination.pageSize
this.pagination = pagination this.getTableDataList()
this.tableParams.pageNum = pagination.current },
this.tableParams.pageSize = pagination.pageSize onChangeTime(date, dateString) {
this.getTableDataList() if (date.length == 0) {
}, this.queryParam.startTime = null
onChangeTime(date, dateString) { this.queryParam.endTime = null
if (date.length == 0) { this.queryParam.pageNum = 1
this.tableParams.startTime = null } else {
this.tableParams.endTime = null this.queryParam.startTime = moment(date[0]).format(this.dateFormat);
this.tableParams.pageNum = 1 this.queryParam.endTime = moment(date[1]).format(this.dateFormat);
} else { this.queryParam.pageNum = 1
this.tableParams.startTime = moment(date[0]).format(this.dateFormat); }
this.tableParams.endTime = moment(date[1]).format(this.dateFormat); },
this.tableParams.pageNum = 1 handelEdit(record) {
} console.log('sdfsdf', record)
}, const filteredColumn = this.columns.filter(item => item.dataIndex != 'operation' && item.dataIndex != 'ROW_ID' && item.dataIndex != '数据');
handelEdit(record) { delete record['ROW_ID'];
const filteredColumn = this.columns.filter(item => item.dataIndex != 'operation' && item.dataIndex != 'ROW_ID'); delete record['数据'];
delete record['ROW_ID']; this.$refs.editdataseachForm.initForm(this.queryParam.schemaMass, this.queryParam.tableName, filteredColumn, record, this.queryParam.sourceType, this.queryParam.mdl, this.queryParam.hn);
this.$refs.editdataseachForm.initForm(this.tableParams.schemaMass, this.tableParams.tableName, filteredColumn, record); },
}, getTableDataList() {
getTableDataList() { console.log(this.queryParam)
console.log(this.tableParams) if (this.queryParam.schemaMass == null || this.queryParam.tableName == null) {
if (this.tableParams.schemaMass == null || this.tableParams.tableName == null) { this.$message.warning('必须选择查询的表')
this.$message.warning('必须选择查询的表') return
return }
} tableDataList(this.queryParam).then(res => {
tableDataList(this.tableParams).then(res => { if (res.code == 200) {
if (res.code == 200) { this.columns = []
this.columns = [] if (res.result.columnNames.length > 0) {
if (res.result.columnNames.length > 0) { res.result.columnNames.forEach(columns => {
res.result.columnNames.forEach(columns => { this.columns.push({
this.columns.push({ title: columns,
title: columns, dataIndex: columns,
dataIndex: columns, ellipsis: true,
ellipsis: true, width: 180
width: 180 })
}) })
}) this.columns.push({
this.columns.push({ fixed: 'right',
fixed: 'right', align: 'center',
align: 'center', width: 100,
width: 100, title: '操作',
title: '操作', dataIndex: 'operation',
dataIndex: 'operation', scopedSlots: { customRender: 'operation' },
scopedSlots: { customRender: 'operation' }, })
}) }
}
const pagination = { ...this.pagination } const pagination = { ...this.pagination }
pagination.total = res.result.total pagination.total = res.result.total
this.dataSource = res.result.rows this.dataSource = res.result.rows
this.pagination = pagination this.pagination = pagination
} }
}) })
}, },
exportTool() { exportTool() {
if (this.queryParam.schemaMass == "") { if (this.queryParam.schemaMass == "") {
this.$message.warning("请选择导出的数据类型"); this.$message.warning("请选择导出的数据类型");
return; return;
} }
postAction("/dataManager/DmExportTool?schemaMass=" + this.queryParam.schemaMass + "&tableNames=" + "" + "&exportType=0", {}).then(res => { postAction("/dataManager/DmExportTool?schemaMass=" + this.queryParam.schemaMass + "&tableNames=" + "" + "&exportType=0", {}).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success(res.result); this.$message.success(res.result);
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)
}
})
} }
})
} }
}
} }
</script> </script>

View File

@ -1,88 +1,109 @@
<template> <template>
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 查询区域 --> <!-- 查询区域 -->
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline"> <a-form layout="inline">
<a-row :gutter="30"> <a-row :gutter="30">
<a-col :md="20"> <a-col :md="20">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="4" :sm="4"> <a-col :md="4" :sm="4">
<a-form-item label="数据类型"> <a-form-item label="型号">
<a-select placeholder="选择数据类型" option-filter-prop="children" v-model="queryParam.schemaMass" <a-select placeholder="选择型号" option-filter-prop="children" show-search
@change="handleTypeChange"> :filter-option="filterOption" v-model="queryParam.mdl" @change="changeshipModel">
<a-select-option v-for="d in dataTypedataSources" :key="d.cnName"> <a-select-option v-for="item in shipModel" :value="item">
{{ d.cnName }} {{ item }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="4" :sm="4"> <a-col :md="4" :sm="4">
<a-form-item label="任务"> <a-form-item label="舷号">
<a-select placeholder="选择任务" option-filter-prop="children" v-model="activeTaskId" <a-select placeholder="选择舷号" option-filter-prop="children" show-search
@change="handleTaskChange"> :filter-option="filterOption" v-model="queryParam.hn" @change="changeshipNumber">
<a-select-option v-for="d in allTask" :key="d.id"> <a-select-option v-for="item in shipNumber" :value="item">
{{ d.name }} {{ item }}
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="8" :sm="8"> <a-col :md="4" :sm="4">
<a-form-item label="时间范围"> <a-form-item label="数据类型">
<!-- <a-range-picker :default-value="defaultTime" show-time :show-time="{ format: 'HH:mm:ss' }" <a-select placeholder="选择数据类型" option-filter-prop="children" v-model="queryParam.schemaMass"
@change="handleTypeChange">
<a-select-option v-for="item in dataTypeList" :value="item.cnName">
{{ item.cnName }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="4">
<a-form-item label="任务">
<a-select placeholder="选择任务" option-filter-prop="children" v-model="activeTaskId"
@change="handleTaskChange">
<a-select-option v-for="d in allTask" :key="d.id">
{{ d.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :md="8" :sm="8">
<a-form-item label="时间范围">
<!-- <a-range-picker :default-value="defaultTime" show-time :show-time="{ format: 'HH:mm:ss' }"
:format="dateFormat" @change="onChangeTime" /> --> :format="dateFormat" @change="onChangeTime" /> -->
<a-range-picker :show-time="{ format: 'HH:mm:ss' }" v-model="defaultTime" format="YYYY-MM-DD HH:mm:ss" <a-range-picker :show-time="{ format: 'HH:mm:ss' }" v-model="defaultTime"
@change="onChangeTime" /> format="YYYY-MM-DD HH:mm:ss" @change="onChangeTime" />
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="5" :sm="5"> <a-col :md="5" :sm="5">
<a-form-item label="关键词"> <a-form-item label="关键词">
<a-input placeholder="请输入搜索关键词" v-model="queryParam.massKey"></a-input> <a-input placeholder="请输入搜索关键词" v-model="queryParam.massKey"></a-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :md="24" :sm="24" style="text-align: right;"> <a-col :md="24" :sm="24" style="text-align: right;">
<a-button @click="getTableDataList" type="primary">查询</a-button>&nbsp; <a-button @click="getTableDataList" type="primary">查询</a-button>&nbsp;
<a-button @click="exportTool" type="primary">导出dmp</a-button>&nbsp; <a-button @click="exportTool" type="primary">导出dmp</a-button>&nbsp;
<a-button @click="handleAdd" type="primary">导出csvtxt</a-button>&nbsp; <a-button @click="handleAdd" type="primary">导出csvtxt</a-button>&nbsp;
<a-button @click="openexptable" type="primary">导出日志</a-button> <a-button @click="openexptable" type="primary">导出日志</a-button>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<a-row :gutter="30" style="padding: 0 10px;"> <a-row :gutter="30" style="padding: 0 10px;">
<a-col :md="6"> <a-col :md="6">
<div class="linese"></div> <div class="linese"></div>
<!-- 分类区域 --> <!-- 分类区域 -->
<div style="height:calc(100vh - 366px);overflow: auto;background: #e6e9f1;padding:10px;" ref="treeContainer"> <div style="height:calc(100vh - 420px);overflow: auto;background: #e6e9f1;padding:10px;"
<a-tree :tree-data="treeDate" @select="onSelect" /> ref="treeContainer">
</div> <a-tree :tree-data="treeDate" @select="onSelect" />
<div class="linese"></div> </div>
</a-col> <div class="linese"></div>
<a-col :md="18"> </a-col>
<div class="linese"></div> <a-col :md="18">
<!-- 表格区域 --> <div class="linese"></div>
<div style="height:calc(100vh - 420px);background: #e6e9f1;overflow:hidden;padding: 15px;"> <!-- 表格区域 -->
<a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading" <div style="height:calc(100vh - 420px);background: #e6e9f1;overflow:hidden;padding: 15px;">
:pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号" <a-table size="middle" bordered :columns="columns" :data-source="dataSource" :loading="loading"
@change="handleTableChange"> :pagination="pagination" :scroll="{ x: 1200, y: 'calc(100vh - 450px)' }" rowKey="序号"
<template slot="operation" slot-scope="text, record"> @change="handleTableChange">
<a-button type="primary" @click="handelEdit(record)">编辑</a-button> <template slot="operation" slot-scope="text, record">
</template> <a-button type="primary" @click="handelEdit(record)">编辑</a-button>
</a-table> </template>
</div> </a-table>
<div class="linese"></div> </div>
</a-col> <div class="linese"></div>
</a-row> </a-col>
<tablelist ref="modalForm"></tablelist> </a-row>
<exptable ref="exptable"></exptable> <tablelist ref="modalForm"></tablelist>
<editdataseach ref="editdataseachForm" @ok="getTableDataList" /> <exptable ref="exptable"></exptable>
</a-card> <editdataseach ref="editdataseachForm" @ok="getTableDataList" />
</a-card>
</template> </template>
<script> <script>
import { metaDataTypeTree, tableDataList, DmExportTool } from '@/api/metaData' import { metaDataTypeTree, tableDataList, DmExportTool } from '@/api/metaData'
@ -91,239 +112,289 @@ import { getAllTask } from '@/api/task'
import moment from 'moment'; import moment from 'moment';
import tablelist from '../../data/modules/tablelist.vue' import tablelist from '../../data/modules/tablelist.vue'
import exptable from '../../data/modules/exptable.vue' import exptable from '../../data/modules/exptable.vue'
import editdataseach from '../../data/modules/editdataseach.vue' import editdataseach from '../../data/modules/editdataseach.vue'
export default { export default {
name: "metadata", name: "metadata",
components: { components: {
tablelist, tablelist,
exptable, exptable,
editdataseach editdataseach
}, },
data() { data() {
return { return {
moment, moment,
dateFormat: 'YYYY-MM-DD HH:mm:ss', dateFormat: 'YYYY-MM-DD HH:mm:ss',
defaultTime: [], defaultTime: [],
loading: false, loading: false,
allTask: [], allTask: [],
activeTaskId: null, activeTaskId: null,
// pagination: {
queryParam: { defaultCurrent: 1, //
sourceType: 2, defaultPageSize: 10, // total: 0, //
schemaMass: null, showSizeChanger: true,
massKey: null showQuickJumper: false,
}, pageSizeOptions: ['10', '20', '30'],
pagination: { showTotal: total => `总共 ${total} 个项目`, //
defaultCurrent: 1, // onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize)
defaultPageSize: 10, // total: 0, // },
showSizeChanger: true, //
showQuickJumper: false, queryParam: {
pageSizeOptions: ['10', '20', '30'], sourceType: 1,
showTotal: total => `总共 ${total} 个项目`, // massKey: null,
onShowSizeChange: (current, pageSize) => (this.pageSize = pageSize) mdl: null, //
}, hn: null, //
tableParams: { schemaMass: null,
schemaMass: null, tableName: null,
tableName: null, startTime: null,
startTime: null, endTime: null,
endTime: null, pageSize: 10,
pageSize: 10, pageNum: 1
pageNum: 1 },
}, treeDate: [],
treeDate: [], dataSource: [],
dataSource: [], columns: [],
columns: [], dataTypeList: [],
dataTypedataSources: [], shipModel: [],
treeHeight: 0 shipNumber: [],
} existingDataTypes: {},
}, treeHeight: 0
watch: { }
'queryParam.massKey'(value) { },
this.queryParam.massKey = value watch: {
this.getMetaDataTypeTree() 'queryParam.massKey'(value) {
} this.queryParam.massKey = value
}, this.getMetaDataTypeTree()
mounted() { }
this.calculateScrollY(); },
}, mounted() {
computed: { this.calculateScrollY();
},
computed: {
},
created() {
this.getselect()
this.queryAllTask()
// this.initDate()
},
methods: {
queryAllTask() {
getAllTask().then(res => {
console.log('res', res)
if (res.success) {
this.allTask = res.result
if (res.result.length > 0) {
this.activeTaskId = res.result[0].id
const start = moment(res.result[0].startTime)
const end = moment(res.result[0].endTime)
this.defaultTime.push(start, end)
this.tableParams.startTime = start.format(this.dateFormat);
this.tableParams.endTime = end.format(this.dateFormat)
}
} else {
this.$message.warning(res.message);
}
})
}, },
handleTaskChange(value) { created() {
var curTask = this.allTask.filter(item => item.id == value)[0] this.getselect()
if (curTask) { this.queryAllTask()
const start = moment(curTask.startTime) // this.initDate()
const end = moment(curTask.endTime)
this.defaultTime=[start, end]
this.tableParams.startTime = start.format(this.dateFormat);
this.tableParams.endTime = end.format(this.dateFormat)
}
}, },
calculateScrollY() { methods: {
// queryAllTask() {
const container = this.$refs.treeContainer; getAllTask().then(res => {
this.treeHeight = container.clientHeight; if (res.success) {
}, this.allTask = res.result
getselect() { if (res.result.length > 0) {
getAction("/dataType/getExistingDataTypes", {}).then((res) => { this.activeTaskId = res.result[0].id
console.log('类型结果', res) const start = moment(res.result[0].startTime)
if (res.success) { const end = moment(res.result[0].endTime)
this.dataTypedataSources = res.result.result.DATA_CONN_STANDARD this.defaultTime.push(start, end)
if (res.result.result.DATA_CONN_STANDARD.length > 0) { this.queryParam.startTime = start.format(this.dateFormat);
this.queryParam.schemaMass = res.result.result.DATA_CONN_STANDARD[0].cnName this.queryParam.endTime = end.format(this.dateFormat)
} }
this.getMetaDataTypeTree(); } else {
} else { this.$message.warning(res.message);
this.$message.warning(res.message); }
} })
}); },
}, handleTaskChange(value) {
handleAdd() { var curTask = this.allTask.filter(item => item.id == value)[0]
if (this.queryParam.schemaMass == "") { if (curTask) {
this.$message.warning("请选择导出的数据类型"); const start = moment(curTask.startTime)
return; const end = moment(curTask.endTime)
} this.defaultTime = [start, end]
this.$refs.modalForm.add(this.queryParam.schemaMass); this.queryParam.startTime = start.format(this.dateFormat);
}, this.queryParam.endTime = end.format(this.dateFormat)
openexptable() { }
if (this.queryParam.schemaMass == "") { },
this.$message.warning("请选择查询的导出的数据类型"); calculateScrollY() {
return; //
} const container = this.$refs.treeContainer;
this.$refs.exptable.add(this.queryParam.schemaMass); this.treeHeight = container.clientHeight;
}, },
getMetaDataTypeTree() {
metaDataTypeTree(this.queryParam).then(res => { filterOption(input, option) {
if (res.code == 200) { return (
this.treeDate = [] option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
var keys = Object.keys(res.result) );
keys.forEach((element, index) => { },
const _children = res.result[element] changeshipModel(value) {
var childrenList = [] this.queryParam.shipModel = value
_children.forEach((childrenNode, chil) => { var number = Object.keys(this.existingDataTypes[value])
childrenList.push({ this.shipNumber = []
key: childrenNode.tableName, number.forEach((element, index) => {
type: 'childern', this.shipNumber.push(element);
title: childrenNode.massName
})
}); });
this.treeDate.push({ this.dataTypeList = this.existingDataTypes[value][this.shipNumber[0]]
key: 'type_' + index, this.queryParam.mdl = this.shipNumber[0]
type: 'parentType', this.queryParam.schemaMass = this.dataTypeList[0].cnName
title: element, },
children: childrenList changeshipNumber(value) {
this.dataTypeList = this.existingDataTypes[this.queryParam.shipModel][value]
this.queryParam.mdl = value
this.queryParam.schemaMass = this.dataTypeList[0].cnName
},
getselect() {
getAction("/dataType/getExistingDataTypes", {}).then((res) => {
if (res.success) {
this.existingDataTypes = res.result.result.original
var ship = Object.keys(this.existingDataTypes)
ship.forEach((element, index) => {
this.shipModel.push(element);
});
var number = Object.keys(this.existingDataTypes[this.shipModel[0]])
number.forEach((element, index) => {
this.shipNumber.push(element);
});
this.dataTypeList = this.existingDataTypes[this.shipModel[0]][this.shipNumber[0]]
this.queryParam.mdl = this.shipModel[0]
this.queryParam.hn = this.shipNumber[0]
this.queryParam.schemaMass = this.dataTypeList[0].cnName
this.getMetaDataTypeTree()
} else {
this.$message.warning(res.message);
}
});
},
handleAdd() {
if (this.queryParam.mdl == "") {
this.$message.warning("请选择型号");
return;
}
if (this.queryParam.hn == "") {
this.$message.warning("请选择舷号");
return;
}
if (this.queryParam.schemaMass == "") {
this.$message.warning("请选择导出的数据类型");
return;
}
this.$refs.modalForm.add(this.queryParam.sourceType, this.queryParam.schemaMass, this.queryParam.mdl, this.queryParam.hn);
},
openexptable() {
if (this.queryParam.mdl == "") {
this.$message.warning("请选择型号");
return;
}
if (this.queryParam.hn == "") {
this.$message.warning("请选择舷号");
return;
}
if (this.queryParam.schemaMass == "") {
this.$message.warning("请选择查询的导出的数据类型");
return;
}
this.$refs.exptable.add(this.queryParam.sourceType, this.queryParam.schemaMass, this.queryParam.mdl, this.queryParam.hn);
},
getMetaDataTypeTree() {
metaDataTypeTree(this.queryParam).then(res => {
if (res.code == 200) {
this.treeDate = []
var keys = Object.keys(res.result)
keys.forEach((element, index) => {
const _children = res.result[element]
var childrenList = []
_children.forEach((childrenNode, chil) => {
childrenList.push({
key: childrenNode.tableName,
type: 'childern',
title: childrenNode.massName
})
});
this.treeDate.push({
key: 'type_' + index,
type: 'parentType',
title: element,
children: childrenList
})
});
}
}) })
}); },
} handleTypeChange(value) {
}) this.queryParam.schemaMass = value
}, this.getMetaDataTypeTree()
handleTypeChange(value) { },
this.queryParam.schemaMass = value onSelect(selectedKeys, info) {
this.getMetaDataTypeTree() if (info.node.dataRef.type && info.node.dataRef.type == 'childern') {
}, this.queryParam.schemaMass = info.node.$parent.dataRef.title
onSelect(selectedKeys, info) { this.queryParam.tableName = info.node.dataRef.key
if (info.node.dataRef.type && info.node.dataRef.type == 'childern') { this.getTableDataList()
this.tableParams.schemaMass = info.node.$parent.dataRef.title }
this.tableParams.tableName = info.node.dataRef.key },
this.getTableDataList() handleTableChange(pagination, filters, sorter) {
} this.pagination = pagination
}, this.queryParam.pageNum = pagination.current
handleTableChange(pagination, filters, sorter) { this.queryParam.pageSize = pagination.pageSize
this.pagination = pagination this.getTableDataList()
this.tableParams.pageNum = pagination.current },
this.tableParams.pageSize = pagination.pageSize onChangeTime(date, dateString) {
this.getTableDataList() if (date.length == 0) {
}, this.queryParam.startTime = null
onChangeTime(date, dateString) { this.queryParam.endTime = null
if (date.length == 0) { this.queryParam.pageNum = 1
this.tableParams.startTime = null } else {
this.tableParams.endTime = null this.queryParam.startTime = moment(date[0]).format(this.dateFormat);
this.tableParams.pageNum = 1 this.queryParam.endTime = moment(date[1]).format(this.dateFormat);
} else { this.queryParam.pageNum = 1
this.tableParams.startTime = moment(date[0]).format(this.dateFormat); }
this.tableParams.endTime = moment(date[1]).format(this.dateFormat); },
this.tableParams.pageNum = 1 handelEdit(record) {
} console.log('sdfsdf', record)
}, const filteredColumn = this.columns.filter(item => item.dataIndex != 'operation' && item.dataIndex != 'ROW_ID' && item.dataIndex != '数据');
handelEdit(record) { delete record['ROW_ID'];
const filteredColumn = this.columns.filter(item => item.dataIndex != 'operation' && item.dataIndex != 'ROW_ID'); delete record['数据'];
delete record['ROW_ID']; this.$refs.editdataseachForm.initForm(this.queryParam.schemaMass, this.queryParam.tableName, filteredColumn, record, this.queryParam.sourceType, this.queryParam.mdl, this.queryParam.hn);
this.$refs.editdataseachForm.initForm(this.tableParams.schemaMass, this.tableParams.tableName, filteredColumn, record); },
}, getTableDataList() {
getTableDataList() { console.log(this.queryParam)
console.log(this.tableParams) if (this.queryParam.schemaMass == null || this.queryParam.tableName == null) {
if (this.tableParams.schemaMass == null || this.tableParams.tableName == null) { this.$message.warning('必须选择查询的表')
this.$message.warning('必须选择查询的表') return
return }
} tableDataList(this.queryParam).then(res => {
tableDataList(this.tableParams).then(res => { if (res.code == 200) {
if (res.code == 200) { this.columns = []
this.columns = [] if (res.result.columnNames.length > 0) {
if (res.result.columnNames.length > 0) { res.result.columnNames.forEach(columns => {
res.result.columnNames.forEach(columns => { this.columns.push({
this.columns.push({ title: columns,
title: columns, dataIndex: columns,
dataIndex: columns, ellipsis: true,
ellipsis: true, width: 180
width: 180 })
}) })
}) this.columns.push({
this.columns.push({ fixed: 'right',
fixed: 'right', align: 'center',
align: 'center', width: 100,
width: 100, title: '操作',
title: '操作', dataIndex: 'operation',
dataIndex: 'operation', scopedSlots: { customRender: 'operation' },
scopedSlots: { customRender: 'operation' }, })
}) }
}
const pagination = { ...this.pagination } const pagination = { ...this.pagination }
pagination.total = res.result.total pagination.total = res.result.total
this.dataSource = res.result.rows this.dataSource = res.result.rows
this.pagination = pagination this.pagination = pagination
} }
}) })
}, },
exportTool() { exportTool() {
if (this.queryParam.schemaMass == "") { if (this.queryParam.schemaMass == "") {
this.$message.warning("请选择导出的数据类型"); this.$message.warning("请选择导出的数据类型");
return; return;
} }
postAction("/dataManager/DmExportTool?schemaMass=" + this.queryParam.schemaMass + "&tableNames=" + "" + "&exportType=0", {}).then(res => { postAction("/dataManager/DmExportTool?schemaMass=" + this.queryParam.schemaMass + "&tableNames=" + "" + "&exportType=0", {}).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.$message.success(res.result); this.$message.success(res.result);
} else { } else {
this.$message.warning(res.message) this.$message.warning(res.message)
}
})
} }
})
} }
}
} }
</script> </script>