产品及数据架构修复

dev
yujialong 3 years ago
parent 9853159956
commit 2b40bb0620
  1. 1
      src/components/Header.vue
  2. 97
      src/views/data/Framework.vue
  3. 16
      src/views/data/Product.vue

@ -28,7 +28,6 @@ export default {
methods: {
getUserInfo(){
this.$get(this.api.queryUserInfoDetails).then(res => {
console.log(res,'头像处理');
let userInfo = res.result.hrUserInfo
if(userInfo.userAvatars) this.$store.commit('userAvatar',{avatar: userInfo.userAvatars})
this.userName = userInfo.userName

@ -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,35 +313,48 @@ 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
})
})
})
res.map((n,i) => {
if(n.children.length){
n.children.map(n => {
if(n.children.length){
n.children.map(n => this.getTable(n,i))
}else{
this.getTable(n,i)
}
})
}else{
this.getTable(n,i)
}
})
setTimeout(() => {
this.importTypeList = res
this.getFields()
},500)
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 => {
if(n.children.length){
n.children.map(n => this.getTable(n,i))
}else{
this.getTable(n,i)
}
})
}else{
this.getTable(n,i)
}
})
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
})
},
}
};

@ -71,7 +71,7 @@
</el-row>
<el-dialog :title="isDetail ? '查看产品' : (id ? '编辑产品' : '新增产品')" :visible.sync="productVisible" width="30%" center @close="closeProduct" class="dialog" :close-on-click-modal="false">
<el-form ref="form" label-width="120px" :disabled="isDetail">
<el-form ref="form" label-width="98px" :disabled="isDetail">
<el-form-item label="数据产品名称">
<el-input v-model="productName" placeholder="请输入数据产品名称"></el-input>
</el-form-item>
@ -82,7 +82,11 @@
</el-form-item>
<el-form-item label="已选数据">
<el-button type="primary" size="small" @click="configData">配置数据权限</el-button>
<el-tree ref="type" :data="typeList" show-checkbox node-key="id" :default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps"></el-tree>
<el-tree ref="type" :data="typeList" show-checkbox node-key="id" :default-expanded-keys="checkedIds" :default-checked-keys="checkedIds" :props="defaultProps">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :title="node.label">{{ node.label }}</span>
</span>
</el-tree>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
@ -94,7 +98,11 @@
<el-dialog title="数据配置" :visible.sync="configVisible" width="70%" center @close="closeConfig" :close-on-click-modal="false">
<el-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;">
<el-aside width="300px">
<el-tree style="margin: 10px;" ref="typeConfig" :data="typeConfigList" show-checkbox node-key="id" accordion :default-expanded-keys="configIds" :default-checked-keys="configIds" :current-node-key="categoryId" :props="defaultProps" highlight-current @current-change="typeConfigClick"></el-tree>
<el-tree style="margin: 10px;" ref="typeConfig" :data="typeConfigList" show-checkbox node-key="id" accordion :default-expanded-keys="configIds" :default-checked-keys="configIds" :current-node-key="categoryId" :props="defaultProps" highlight-current @current-change="typeConfigClick">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :title="node.label">{{ node.label }}</span>
</span>
</el-tree>
</el-aside>
<el-main style="padding-top: 0;padding-bottom: 0;">
@ -166,7 +174,7 @@ export default {
}],
page: 1,
pageSize: 10,
totals: 1,
totals: 0,
productVisible: false,
id: '',
userId: '',

Loading…
Cancel
Save