|
|
|
@ -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> |
|
|
|
@ -60,10 +60,14 @@ |
|
|
|
|
<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"> |
|
|
|
|
<div class="flex-center mgb20"> |
|
|
|
|
<p class="hr_tag"></p> |
|
|
|
|
<span>预览</span> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="fieldData" stripe header-align="center"> |
|
|
|
|
<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> |
|
|
|
@ -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,14 +294,17 @@ 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 |
|
|
|
|
} |
|
|
|
@ -301,18 +313,27 @@ export default { |
|
|
|
|
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.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 |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|