产品及数据架构修复

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: { methods: {
getUserInfo(){ getUserInfo(){
this.$get(this.api.queryUserInfoDetails).then(res => { this.$get(this.api.queryUserInfoDetails).then(res => {
console.log(res,'头像处理');
let userInfo = res.result.hrUserInfo let userInfo = res.result.hrUserInfo
if(userInfo.userAvatars) this.$store.commit('userAvatar',{avatar: userInfo.userAvatars}) if(userInfo.userAvatars) this.$store.commit('userAvatar',{avatar: userInfo.userAvatars})
this.userName = userInfo.userName this.userName = userInfo.userName

@ -5,9 +5,9 @@
<div class="plus"> <div class="plus">
<i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i> <i class="el-icon-circle-plus-outline" @click.stop="addType(0)"></i>
</div> </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 class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span> <span :title="node.label">{{ node.label }}</span>
<span class="actions"> <span class="actions">
<i v-if="!data.isThird" class="el-icon-circle-plus-outline" @click.stop="addType(node)"></i> <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> <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-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">
<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> </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">
<div class="flex-center mgb20">
<p class="hr_tag"></p>
<span>预览</span>
</div>
<el-table :data="fieldData" stripe header-align="center"> <el-table :data="fieldData" stripe header-align="center">
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> <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-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: '', updateTime: '',
importVisible: false, importVisible: false,
defaultTypeActive: [], defaultTypeActive: [],
defaultTypeChecked: [],
listData: [], listData: [],
keyword: '', keyword: '',
page: 1, page: 1,
@ -119,6 +124,7 @@ export default {
total: 0, total: 0,
multipleSelection: [], multipleSelection: [],
importTypeList: [], importTypeList: [],
importTypeIndex: 10000,
fieldData: [], fieldData: [],
fieldHead: [], fieldHead: [],
tableName: '', tableName: '',
@ -126,7 +132,8 @@ export default {
categoryIndex: 0, categoryIndex: 0,
previewVisible: false, previewVisible: false,
previewHead: [], previewHead: [],
previewData: [] previewData: [],
submited: false,
}; };
}, },
watch: { watch: {
@ -164,7 +171,9 @@ export default {
this.categoryId = res[0].id this.categoryId = res[0].id
this.defaultActive = [res[0].id] this.defaultActive = [res[0].id]
} }
this.$nextTick(() => {
this.$refs.type.setCurrentKey(res[0].children[0].id)
})
this.getData() this.getData()
}).catch(res => {}) }).catch(res => {})
}, },
@ -285,14 +294,17 @@ export default {
} }
}, },
getTable(n,i){ 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 => { res.list.map(n => {
n.label = n.showName n.label = n.showName
n.id = String(n.id) n.id = String(n.id)
if(this.defaultTypeChecked.includes(n.id)){
n.disabled = true
}
}) })
n.children = res.list n.children = res.list
if(!i && !this.tableName){ if(!i && !this.tableName){
this.defaultTypeActive = [res.list[0].id]
this.tableName = res.list[0].name this.tableName = res.list[0].name
this.curId = res.list[0].id this.curId = res.list[0].id
} }
@ -301,35 +313,48 @@ export default {
batchImport(){ batchImport(){
this.$post(this.api.originalList).then(res => { this.$post(this.api.originalList).then(res => {
res.map(n => { 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.label = n.categoryName
n.children.map(n => { 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.label = n.categoryName
n.children.map(n => { 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.label = n.categoryName
n.isThird = true n.isThird = true
}) })
}) })
}) })
res.map((n,i) => { this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=10000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => {
if(n.children.length){ this.defaultTypeChecked = res1.list.map(n => n.copyId)
n.children.map(n => {
if(n.children.length){ res.map((n,i) => {
n.children.map(n => this.getTable(n,i)) if(n.children.length){
}else{ n.children.map(n => {
this.getTable(n,i) if(n.children.length){
} n.children.map(n => this.getTable(n,i))
}) }else{
}else{ this.getTable(n,i)
this.getTable(n,i) }
} })
}) }else{
setTimeout(() => { this.getTable(n,i)
this.importTypeList = res }
this.getFields() })
},500) 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 this.importVisible = true
}).catch(res => {}) }).catch(res => {})
}, },
@ -349,7 +374,6 @@ export default {
} }
}) })
this.fieldData = data this.fieldData = data
console.log(data,'data');
}).catch(res => {}) }).catch(res => {})
this.importVisible = true this.importVisible = true
}, },
@ -361,19 +385,23 @@ export default {
} }
}, },
closeImport(){ closeImport(){
this.$refs.typeTree.setCheckedKeys([])
}, },
confirmImport(){ confirmImport(){
if(this.submited) return false
let list = this.$refs.typeTree.getCheckedNodes() let list = this.$refs.typeTree.getCheckedNodes()
let names = [] let names = []
let showNames = [] let showNames = []
list.map(n => { list.map(n => {
if(n.name){ if(n.name && !n.disabled){
names.push(n.name) names.push(n.name)
showNames.push(n.showName) showNames.push(n.showName)
} }
}) })
console.log(11,names,showNames)
if(!names.length) return this.$message.warning('请选择数据') if(!names.length) return this.$message.warning('请选择数据')
this.submited = true
let data = [] let data = []
let categoryId = Number(this.categoryId) let categoryId = Number(this.categoryId)
names.map((n,i) => { names.map((n,i) => {
@ -385,9 +413,14 @@ export default {
}) })
this.$post(this.api.saveTable,data).then(res => { this.$post(this.api.saveTable,data).then(res => {
this.$message.success('导入成功') this.$message.success('导入成功')
this.getType() this.getData()
this.importVisible = false this.importVisible = false
}).catch(res => {}) setTimeout(() => {
this.submited = false
},1000)
}).catch(res => {
this.submited = false
})
}, },
} }
}; };

@ -71,7 +71,7 @@
</el-row> </el-row>
<el-dialog :title="isDetail ? '查看产品' : (id ? '编辑产品' : '新增产品')" :visible.sync="productVisible" width="30%" center @close="closeProduct" class="dialog" :close-on-click-modal="false"> <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-form-item label="数据产品名称">
<el-input v-model="productName" placeholder="请输入数据产品名称"></el-input> <el-input v-model="productName" placeholder="请输入数据产品名称"></el-input>
</el-form-item> </el-form-item>
@ -82,7 +82,11 @@
</el-form-item> </el-form-item>
<el-form-item label="已选数据"> <el-form-item label="已选数据">
<el-button type="primary" size="small" @click="configData">配置数据权限</el-button> <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-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail"> <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-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-container style="padding: 20px 0 20px 20px;background-color: #f0f0f0;">
<el-aside width="300px"> <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-aside>
<el-main style="padding-top: 0;padding-bottom: 0;"> <el-main style="padding-top: 0;padding-bottom: 0;">
@ -166,7 +174,7 @@ export default {
}], }],
page: 1, page: 1,
pageSize: 10, pageSize: 10,
totals: 1, totals: 0,
productVisible: false, productVisible: false,
id: '', id: '',
userId: '', userId: '',

Loading…
Cancel
Save