|
|
|
@ -5,9 +5,9 @@ |
|
|
|
|
<div class="plus"> |
|
|
|
|
<i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i> |
|
|
|
|
</div> |
|
|
|
|
<el-tree ref="type" :data="typeList" node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" highlight-current @current-change="typeClick"> |
|
|
|
|
<el-tree ref="type" :data="typeList" node-key="id" accordion :default-expanded-keys="defaultActive" :current-node-key="categoryId" :props="defaultProps" :highlight-current="true" @current-change="typeClick"> |
|
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
|
<span>{{ node.label }}</span> |
|
|
|
|
<span :title="node.label">{{ node.label }}</span> |
|
|
|
|
<span class="actions"> |
|
|
|
|
<i v-if="!data.isThird" class="el-icon-circle-plus-outline" @click.stop="addType(node)"></i> |
|
|
|
|
<i class="el-icon-edit" @click.stop="editType(node)"></i> |
|
|
|
@ -21,7 +21,7 @@ |
|
|
|
|
<el-card shadow="hover"> |
|
|
|
|
<el-form label-width="80px" class="flex-between mgb20"> |
|
|
|
|
<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="initData"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-input placeholder="请输入数据表名称" v-model="keyword" prefix-icon="el-icon-search" clearable></el-input> |
|
|
|
@ -41,7 +41,7 @@ |
|
|
|
|
{{scope.row.dataSize}}M |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="updateTime" label="更新时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="createTime" label="更新时间" align="center"></el-table-column> |
|
|
|
|
<el-table-column label="操作" width="220" align="center"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-button type="text" @click="preview(scope.row)">预览</el-button> |
|
|
|
@ -60,11 +60,15 @@ |
|
|
|
|
<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;"> |
|
|
|
|
<div style="overflow:auto;height: 558px;width:330px;padding:15px;background:#fff"> |
|
|
|
|
<el-tree ref="typeTree" :data="importTypeList" node-key="id" accordion :default-expanded-keys="defaultTypeActive" :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"></el-tree> |
|
|
|
|
</div> |
|
|
|
|
<el-main style="padding-top: 0;padding-bottom: 0;"> |
|
|
|
|
<el-card shadow="hover"> |
|
|
|
|
<el-table :data="fieldData" stripe header-align="center"> |
|
|
|
|
<div class="flex-center mgb20"> |
|
|
|
|
<p class="hr_tag"></p> |
|
|
|
|
<span>预览</span> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="fieldData" stripe header-align="center" v-if="fieldHead.length"> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column v-for="(item,index) in fieldHead" :prop="item.field" :key="index" :label="item.comment" align="center"></el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -112,6 +116,7 @@ export default { |
|
|
|
|
updateTime: '', |
|
|
|
|
importVisible: false, |
|
|
|
|
defaultTypeActive: [], |
|
|
|
|
defaultTypeChecked: [], |
|
|
|
|
listData: [], |
|
|
|
|
keyword: '', |
|
|
|
|
page: 1, |
|
|
|
@ -119,6 +124,7 @@ export default { |
|
|
|
|
total: 0, |
|
|
|
|
multipleSelection: [], |
|
|
|
|
importTypeList: [], |
|
|
|
|
importTypeIndex: 10000, |
|
|
|
|
fieldData: [], |
|
|
|
|
fieldHead: [], |
|
|
|
|
tableName: '', |
|
|
|
@ -126,7 +132,8 @@ export default { |
|
|
|
|
categoryIndex: 0, |
|
|
|
|
previewVisible: false, |
|
|
|
|
previewHead: [], |
|
|
|
|
previewData: [] |
|
|
|
|
previewData: [], |
|
|
|
|
submited: false, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
@ -164,7 +171,9 @@ export default { |
|
|
|
|
this.categoryId = res[0].id |
|
|
|
|
this.defaultActive = [res[0].id] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.$refs.type.setCurrentKey(res[0].children[0].id) |
|
|
|
|
}) |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
@ -285,34 +294,46 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getTable(n,i){ |
|
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.id}&showName=&pageNum=1&pageSize=10000`).then(res => { |
|
|
|
|
this.$post(`${this.api.originalListById}?categoryId=${n.realId}&showName=&pageNum=1&pageSize=10000`).then(res => { |
|
|
|
|
res.list.map(n => { |
|
|
|
|
n.label = n.showName |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
if(this.defaultTypeChecked.includes(n.id)){ |
|
|
|
|
n.disabled = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
n.children = res.list |
|
|
|
|
if(!i && !this.tableName){ |
|
|
|
|
this.defaultTypeActive = [res.list[0].id] |
|
|
|
|
this.tableName = res.list[0].name |
|
|
|
|
this.curId = res.list[0].id |
|
|
|
|
} |
|
|
|
|
// if(!i && !this.tableName){ |
|
|
|
|
// this.tableName = res.list[0].name |
|
|
|
|
// this.curId = res.list[0].id |
|
|
|
|
// } |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
batchImport(){ |
|
|
|
|
this.$post(this.api.originalList).then(res => { |
|
|
|
|
res.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
this.importTypeIndex++ |
|
|
|
|
n.realId = n.id |
|
|
|
|
n.id = String(this.importTypeIndex + n.id) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.children.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
n.realId = n.id |
|
|
|
|
this.importTypeIndex++ |
|
|
|
|
n.id = String(this.importTypeIndex + n.id) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.children.map(n => { |
|
|
|
|
n.id = String(n.id) |
|
|
|
|
this.importTypeIndex++ |
|
|
|
|
n.realId = n.id |
|
|
|
|
n.id = String(this.importTypeIndex + n.id) |
|
|
|
|
n.label = n.categoryName |
|
|
|
|
n.isThird = true |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=10000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => { |
|
|
|
|
this.defaultTypeChecked = res1.list.map(n => n.copyId) |
|
|
|
|
|
|
|
|
|
res.map((n,i) => { |
|
|
|
|
if(n.children.length){ |
|
|
|
|
n.children.map(n => { |
|
|
|
@ -328,8 +349,12 @@ export default { |
|
|
|
|
}) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.importTypeList = res |
|
|
|
|
this.getFields() |
|
|
|
|
// this.defaultTypeActive = [res[0].id] |
|
|
|
|
// if(res[0].children.length) this.defaultTypeActive.push(res[0].children[0].id) |
|
|
|
|
// this.getFields() |
|
|
|
|
},500) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
|
|
this.importVisible = true |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
@ -349,7 +374,6 @@ export default { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.fieldData = data |
|
|
|
|
console.log(data,'data'); |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
this.importVisible = true |
|
|
|
|
}, |
|
|
|
@ -361,19 +385,23 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
closeImport(){ |
|
|
|
|
|
|
|
|
|
this.$refs.typeTree.setCheckedKeys([]) |
|
|
|
|
}, |
|
|
|
|
confirmImport(){ |
|
|
|
|
if(this.submited) return false |
|
|
|
|
let list = this.$refs.typeTree.getCheckedNodes() |
|
|
|
|
let names = [] |
|
|
|
|
let showNames = [] |
|
|
|
|
list.map(n => { |
|
|
|
|
if(n.name){ |
|
|
|
|
if(n.name && !n.disabled){ |
|
|
|
|
names.push(n.name) |
|
|
|
|
showNames.push(n.showName) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
console.log(11,names,showNames) |
|
|
|
|
if(!names.length) return this.$message.warning('请选择数据') |
|
|
|
|
|
|
|
|
|
this.submited = true |
|
|
|
|
let data = [] |
|
|
|
|
let categoryId = Number(this.categoryId) |
|
|
|
|
names.map((n,i) => { |
|
|
|
@ -385,9 +413,14 @@ export default { |
|
|
|
|
}) |
|
|
|
|
this.$post(this.api.saveTable,data).then(res => { |
|
|
|
|
this.$message.success('导入成功') |
|
|
|
|
this.getType() |
|
|
|
|
this.getData() |
|
|
|
|
this.importVisible = false |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.submited = false |
|
|
|
|
},1000) |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.submited = false |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|