|
|
@ -22,7 +22,7 @@ |
|
|
|
<el-form label-width="80px" class="flex-between mgb20"> |
|
|
|
<el-form label-width="80px" class="flex-between mgb20"> |
|
|
|
<div class="flex-center"> |
|
|
|
<div class="flex-center"> |
|
|
|
<el-form-item label="更新时间" style="margin: 0 20px 0 0"> |
|
|
|
<el-form-item label="更新时间" style="margin: 0 20px 0 0"> |
|
|
|
<el-date-picker v-model="updateTime" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="searchData"></el-date-picker> |
|
|
|
<el-date-picker v-model="updateTime" type="date" placeholder="选择日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd" @change="initData"></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-input placeholder="请输入数据表名称" v-model="keyword" prefix-icon="el-icon-search" clearable></el-input> |
|
|
|
<el-input placeholder="请输入数据表名称" v-model="keyword" prefix-icon="el-icon-search" clearable></el-input> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -59,8 +59,8 @@ |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="导入" :visible.sync="importVisible" width="80%" center @close="closeImport" class="dialog" :close-on-click-modal="false"> |
|
|
|
<el-dialog title="导入" :visible.sync="importVisible" width="80%" center @close="closeImport" class="dialog" :close-on-click-modal="false"> |
|
|
|
<el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;"> |
|
|
|
<el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;"> |
|
|
|
<div style="overflow:auto;height: 558px;width:330px;padding:15px;background:#fff"> |
|
|
|
<div style="overflow:auto;height: 558px;width:330px;padding:15px;background:#fff" ref="typeTreeWrap" @scroll="loadType"> |
|
|
|
<el-tree ref="typeTree" :data="importTypeList" node-key="id" accordion :default-expanded-keys="defaultTypeActive" :default-checked-keys="defaultTypeChecked" :current-node-key="curId" show-checkbox :props="defaultProps" highlight-current @node-click="importTypeClick"></el-tree> |
|
|
|
<el-tree ref="typeTree" :data="importTypeList" node-key="id" accordion :default-expanded-keys="defaultTypeActive" :default-checked-keys="defaultTypeChecked" :current-node-key="curId" show-checkbox :props="defaultProps" highlight-current @node-click="importTypeClick" @node-expand="importTypeExpand"></el-tree> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-main style="padding-top: 0;padding-bottom: 0;"> |
|
|
|
<el-main style="padding-top: 0;padding-bottom: 0;"> |
|
|
|
<el-card shadow="hover"> |
|
|
|
<el-card shadow="hover"> |
|
|
@ -118,8 +118,6 @@ export default { |
|
|
|
defaultTypeActive: [], |
|
|
|
defaultTypeActive: [], |
|
|
|
defaultTypeChecked: [], |
|
|
|
defaultTypeChecked: [], |
|
|
|
listData: [], |
|
|
|
listData: [], |
|
|
|
listDataAll: [], |
|
|
|
|
|
|
|
searchListData: [], |
|
|
|
|
|
|
|
keyword: '', |
|
|
|
keyword: '', |
|
|
|
page: 1, |
|
|
|
page: 1, |
|
|
|
pageSize: 10, |
|
|
|
pageSize: 10, |
|
|
@ -131,6 +129,10 @@ export default { |
|
|
|
fieldHead: [], |
|
|
|
fieldHead: [], |
|
|
|
tableName: '', |
|
|
|
tableName: '', |
|
|
|
curId: '', |
|
|
|
curId: '', |
|
|
|
|
|
|
|
curExpand: '', |
|
|
|
|
|
|
|
typeTreeUnit: 20, |
|
|
|
|
|
|
|
typeTreeScrollTop: 0, |
|
|
|
|
|
|
|
typeTimer: null, |
|
|
|
categoryIndex: 0, |
|
|
|
categoryIndex: 0, |
|
|
|
previewVisible: false, |
|
|
|
previewVisible: false, |
|
|
|
previewHead: [], |
|
|
|
previewHead: [], |
|
|
@ -142,7 +144,7 @@ export default { |
|
|
|
keyword: function(val) { |
|
|
|
keyword: function(val) { |
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
clearTimeout(this.searchTimer) |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.searchTimer = setTimeout(() => { |
|
|
|
this.searchData() |
|
|
|
this.initData() |
|
|
|
},500) |
|
|
|
},500) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -181,36 +183,10 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
getData(){ |
|
|
|
getData(){ |
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res => { |
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=${this.page}&pageSize=${this.pageSize}&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res => { |
|
|
|
let list = JSON.parse(res.getIdQueryTable) |
|
|
|
this.listData = res.pageList.records |
|
|
|
list.map(n => { |
|
|
|
this.total = res.pageList.total |
|
|
|
n.updateTime = n.updateTime ? this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n.updateTime)) : '' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.listDataAll = list |
|
|
|
|
|
|
|
this.total = list.length |
|
|
|
|
|
|
|
this.handlePage() |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
handlePage(){ |
|
|
|
|
|
|
|
let list = this.keyword ? this.searchListData : this.listDataAll |
|
|
|
|
|
|
|
let result = list.slice((this.page - 1) * this.pageSize,this.page * this.pageSize) |
|
|
|
|
|
|
|
this.listData = result |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
searchData(){ |
|
|
|
|
|
|
|
let list = this.listDataAll |
|
|
|
|
|
|
|
let result = [] |
|
|
|
|
|
|
|
let updateTime = this.updateTime |
|
|
|
|
|
|
|
list.map(n => { |
|
|
|
|
|
|
|
if(updateTime){ |
|
|
|
|
|
|
|
if(n.updateTime && updateTime == this.formatDate('yyyy-MM-dd',new Date(n.updateTime)) && n.showName.includes(this.keyword)) result.push(n) |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
n.showName.includes(this.keyword) && result.push(n) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.searchListData = result |
|
|
|
|
|
|
|
this.listData = result.slice(0,10) |
|
|
|
|
|
|
|
this.total = result.length |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
initData(){ |
|
|
|
initData(){ |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
@ -279,7 +255,6 @@ export default { |
|
|
|
for(let i in n){ |
|
|
|
for(let i in n){ |
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
this.previewData = data |
|
|
|
this.previewData = data |
|
|
|
this.previewVisible = true |
|
|
|
this.previewVisible = true |
|
|
@ -292,7 +267,6 @@ export default { |
|
|
|
this.$post(`${this.api.deleteTable}?tableIds=${row.id}`).then(res => { |
|
|
|
this.$post(`${this.api.deleteTable}?tableIds=${row.id}`).then(res => { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
this.cacheTable(this.typeList) |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -301,7 +275,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleCurrentChange(val) { |
|
|
|
handleCurrentChange(val) { |
|
|
|
this.page = val |
|
|
|
this.page = val |
|
|
|
this.handlePage() |
|
|
|
this.getData() |
|
|
|
}, |
|
|
|
}, |
|
|
|
delAllSelection() { |
|
|
|
delAllSelection() { |
|
|
|
if(this.multipleSelection.length != ''){ |
|
|
|
if(this.multipleSelection.length != ''){ |
|
|
@ -316,16 +290,39 @@ export default { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.getData() |
|
|
|
this.getData() |
|
|
|
this.cacheTable(this.typeList) |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.$message.error('请先选择数据') |
|
|
|
this.$message.error('请先选择数据') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
getTable(n,i){ |
|
|
|
getMoreTable(list,id){ |
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.realId}`).then(res => { |
|
|
|
list.map(n => { |
|
|
|
let list = JSON.parse(res.originalListById) |
|
|
|
if(n.id == id){ |
|
|
|
|
|
|
|
this.getTable(n,1) |
|
|
|
|
|
|
|
}else if(n.children && n.children.length){ |
|
|
|
|
|
|
|
this.getMoreTable(n.children,id) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
loadType(e){ |
|
|
|
|
|
|
|
clearTimeout(this.typeTimer) |
|
|
|
|
|
|
|
let typeTree = this.$refs.typeTreeWrap |
|
|
|
|
|
|
|
this.typeTimer = setTimeout(() => { |
|
|
|
|
|
|
|
this.typeTreeScrollTop = typeTree.scrollTop - this.typeTreeScrollTop |
|
|
|
|
|
|
|
if(this.typeTreeScrollTop > 0 && typeTree.clientHeight + typeTree.scrollTop == typeTree.scrollHeight){ |
|
|
|
|
|
|
|
this.getMoreTable(this.importTypeList,this.curExpand) |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
|
|
this.$refs.typeTree.setCheckedKeys(this.defaultTypeChecked) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
},300) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
},50) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
getTable(n,isConcat){ |
|
|
|
|
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.realId}&pageNum=${n.typeTreePage}&pageSize=${this.typeTreeUnit}`).then(res => { |
|
|
|
|
|
|
|
let list = res.list.records |
|
|
|
list.map(n => { |
|
|
|
list.map(n => { |
|
|
|
n.label = n.showName |
|
|
|
n.label = n.showName |
|
|
|
n.id = String(n.id) |
|
|
|
n.id = String(n.id) |
|
|
@ -333,12 +330,12 @@ export default { |
|
|
|
n.disabled = true |
|
|
|
n.disabled = true |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
if(isConcat){ |
|
|
|
|
|
|
|
n.typeTreePage++ |
|
|
|
|
|
|
|
n.children = n.children.concat(list) |
|
|
|
|
|
|
|
}else{ |
|
|
|
n.children = list |
|
|
|
n.children = list |
|
|
|
// if(!i && !this.tableName){ |
|
|
|
} |
|
|
|
// this.tableName = res.list[0].name |
|
|
|
|
|
|
|
// this.curId = res.list[0].id |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
batchImport(){ |
|
|
|
batchImport(){ |
|
|
@ -363,26 +360,28 @@ export default { |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=10000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => { |
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=10000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => { |
|
|
|
let list = JSON.parse(res1.getIdQueryTable) |
|
|
|
let list = res1.pageList.records |
|
|
|
this.defaultTypeChecked = list.map(n => n.copyId) |
|
|
|
this.defaultTypeChecked = list.map(n => n.copyId) |
|
|
|
res.map((n,i) => { |
|
|
|
res.map((n,i) => { |
|
|
|
if(n.children.length){ |
|
|
|
if(n.children.length){ |
|
|
|
n.children.map(n => { |
|
|
|
n.children.map(n => { |
|
|
|
if(n.children.length){ |
|
|
|
if(n.children.length){ |
|
|
|
n.children.map(n => this.getTable(n,i)) |
|
|
|
n.children.map(n => { |
|
|
|
|
|
|
|
n.typeTreePage = 1 |
|
|
|
|
|
|
|
this.getTable(n) |
|
|
|
|
|
|
|
}) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.getTable(n,i) |
|
|
|
n.typeTreePage = 1 |
|
|
|
|
|
|
|
this.getTable(n) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
this.getTable(n,i) |
|
|
|
n.typeTreePage = 1 |
|
|
|
|
|
|
|
this.getTable(n) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.importTypeList = res |
|
|
|
this.importTypeList = res |
|
|
|
// this.defaultTypeActive = [res[0].id] |
|
|
|
|
|
|
|
// if(res[0].children.length) this.defaultTypeActive.push(res[0].children[0].id) |
|
|
|
|
|
|
|
// this.getFields() |
|
|
|
|
|
|
|
},500) |
|
|
|
},500) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
|
|
|
@ -415,6 +414,10 @@ export default { |
|
|
|
this.getFields() |
|
|
|
this.getFields() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
importTypeExpand(obj,node,com){ |
|
|
|
|
|
|
|
this.curExpand = obj.id |
|
|
|
|
|
|
|
this.$refs.typeTree.setCheckedKeys(this.defaultTypeChecked) |
|
|
|
|
|
|
|
}, |
|
|
|
closeImport(){ |
|
|
|
closeImport(){ |
|
|
|
this.$refs.typeTree.setCheckedKeys([]) |
|
|
|
this.$refs.typeTree.setCheckedKeys([]) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -448,21 +451,10 @@ export default { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submited = false |
|
|
|
this.submited = false |
|
|
|
},1000) |
|
|
|
},1000) |
|
|
|
|
|
|
|
|
|
|
|
this.cacheTable(this.typeList) |
|
|
|
|
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
this.submited = false |
|
|
|
this.submited = false |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
cacheTable(list){ |
|
|
|
|
|
|
|
list.map(n => { |
|
|
|
|
|
|
|
if(n.children.length){ |
|
|
|
|
|
|
|
this.cacheTable(n.children) |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${n.id}&showName=&pageNum=1&pageSize=1000&updateTime=`).then(res => {}).catch(res => {}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|