.
This commit is contained in:
@@ -24,9 +24,6 @@
|
||||
.tlist>li>a:hover {
|
||||
background-color: #92b0cb;
|
||||
}
|
||||
th,td {
|
||||
padding: 5px;
|
||||
}
|
||||
</style>
|
||||
<row class="meta-link">
|
||||
<div class="info">
|
||||
@@ -65,7 +62,13 @@
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
<button v-for="link in linkInfos" @click="aliasB=link.alias" :class="['btn', {'primary' :aliasB==link.alias}]" v-text="link.comment" style="margin-right: 5px"> </button>
|
||||
<button class="btn btn-primary" style="margin-right: 15px">+ 添加关联表</button>
|
||||
|
||||
<div class="pull-right">
|
||||
<button @click="status=1" class="btn">修改关联关系</button>
|
||||
<button class="btn">+ 添加关联表</button>
|
||||
<button class="btn btn-primary" style="margin-right: 15px">保存</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<table class="table-bordered" style="width: 100%; margin-top: 10px">
|
||||
<tr>
|
||||
@@ -73,11 +76,37 @@
|
||||
<th v-text="tableInfo[aliasB] && tableInfo[aliasB]['comment']"></th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
<tr v-for="(k, v) in linkInfo.link">
|
||||
<td v-text="k.startsWith(aliasA + '\.') ? k : v"></td>
|
||||
<td v-text="v.startsWith(aliasB + '\.') ? v : k"></td>
|
||||
<td>修改</td>
|
||||
|
||||
<tr v-show="status==0" v-for="(k, v) in linkInfo.link">
|
||||
<td v-text="k.startsWith(aliasA + '.') ? k : v"></td>
|
||||
<td v-text="v.startsWith(aliasB + '.') ? v : k"></td>
|
||||
</tr>
|
||||
|
||||
<tr v-show="status==1" v-for="linkItem in link2">
|
||||
<td>
|
||||
<select class="form-control" v-model="linkItem.f1">
|
||||
<option></option>
|
||||
<option v-for="item in tableInfoA.items"
|
||||
:value="aliasA + '.' +item.name" v-text="item.name"></option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" v-model="linkItem.f2">
|
||||
<option></option>
|
||||
<option v-for="item in tableInfoB.items"
|
||||
|
||||
:value="aliasB + '.' +item.name" v-text="aliasB + '.' +item.name">
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
<a href="javascript:;">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center"> <a href="javascript:;">+添加更多</a> </td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</row>
|
||||
@@ -91,10 +120,11 @@
|
||||
* 4、点击点击关联后选择,关联表和关联字段 保持建立关联信息
|
||||
* 5、已经建立的关联,点击编辑后,进入关联字段编辑状态
|
||||
*/
|
||||
let {tableLinkList,linkList, linkInfoList} = meta
|
||||
var vm = new Vue({
|
||||
let {tableLinkList,linkList, linkInfoList, tableInfo} = meta
|
||||
let vm = new Vue({
|
||||
el: ".meta-link",
|
||||
data: {
|
||||
status: 1,
|
||||
tables: [], //所有的表数据{name,comment, alias, linkCount}
|
||||
aliasA: '', //选中的主体表别名
|
||||
tableInfo:{a:{}},
|
||||
@@ -102,33 +132,57 @@
|
||||
links: [], //
|
||||
linkInfos: [],
|
||||
linkInfo: {},
|
||||
link2: [],
|
||||
|
||||
aliasB: ''
|
||||
aliasB: '',
|
||||
|
||||
tableInfoA: {},
|
||||
tableInfoB: {},
|
||||
},
|
||||
watch: {
|
||||
aliasA(v) {
|
||||
//tableInfo({alias: v}).then(res => this.tableInfo = res)
|
||||
tableInfo({alias: v}).then(res => this.tableInfoA = res)
|
||||
linkList({alias: v}).then(res => {
|
||||
this.links = res
|
||||
this.aliasB = '' // 如果不置空,存在变更主体表,但数据不刷新的异常
|
||||
})
|
||||
linkInfoList({alias: v}).then(res => {
|
||||
this.linkInfos = res
|
||||
this.aliasB = res[0]['alias']
|
||||
if (res && res.length > 0) {
|
||||
this.aliasB = res[0]['alias']
|
||||
}
|
||||
})
|
||||
},
|
||||
aliasB(v) {
|
||||
let linkInfo = {}
|
||||
for (let i in this.links) { // 数据转换
|
||||
if (this.links[i]['tables'][0] == v || this.links[i]['tables'][1] == v) {
|
||||
linkInfo = this.links[i]
|
||||
tableInfo({alias: v}).then(res => {
|
||||
this.tableInfoB = res
|
||||
|
||||
let linkInfo = {}
|
||||
for (let i in this.links) { // 数据转换
|
||||
if (this.links[i]['tables'][0] == v || this.links[i]['tables'][1] == v) {
|
||||
linkInfo = this.links[i]
|
||||
let link = {}
|
||||
let link2 = [] // [{f1:"", f2:""}]
|
||||
for(k in linkInfo["link"]) {
|
||||
let [_k, _v] = [k, linkInfo["link"][k]]
|
||||
if (k.startsWith(this.aliasA + '.')) {
|
||||
link[_k] = _v
|
||||
link2.push({f1: _k, f2: _v})
|
||||
} else {
|
||||
link[_v] = _k
|
||||
link2.push({f1: _v, f2: _k})
|
||||
}
|
||||
}
|
||||
linkInfo['link'] = link
|
||||
this.link2 = link2
|
||||
}
|
||||
}
|
||||
}
|
||||
this.linkInfo = linkInfo
|
||||
this.linkInfo = linkInfo
|
||||
})
|
||||
|
||||
},
|
||||
linkInfo(v) {
|
||||
console.log(v)
|
||||
//console.log(v)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -40,10 +40,12 @@
|
||||
<button @click="save()" :class="['btn',{'btn-primary':status!=0},{'disabled':status==0}]" type="button"> 保存</button>
|
||||
</span>
|
||||
</div>
|
||||
<hr style="margin: 0px 5px 5px">
|
||||
</div>
|
||||
|
||||
<!-- 实体列表 -->
|
||||
<div class="col-md-2">
|
||||
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 实体表(Meta-Table)</div>
|
||||
<ul class="nav nav-tabs nav-stacked tlist" style="height: 100%">
|
||||
<li :class="['clearfix',{'active':alias==item.alias}]" v-for="item in tables" >
|
||||
<a @click="alias=item.alias" :title="dealTableLabel(item)" v-text="dealTableLabel(item)" href="javascript:;"></a>
|
||||
@@ -53,6 +55,7 @@
|
||||
|
||||
<!-- 实体表信息 -->
|
||||
<div class="col-md-5">
|
||||
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 实体字段信息</div>
|
||||
<table :class="[{'table':status!=2},'table-bordered']" style="width: 100%">
|
||||
<tr style="background-color: #f1f1f1">
|
||||
<td v-show="status==3 || status==4 || status==5 || status==6"><input type="checkbox"></td>
|
||||
@@ -97,7 +100,8 @@
|
||||
|
||||
<!-- baseInfo -->
|
||||
<div class="panel" v-show="status==7">
|
||||
<div class="panel-heading">基本属性配置</div>
|
||||
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 基本属性配置</div>
|
||||
<!--<div class="panel-heading">基本属性配置</div>-->
|
||||
<div class="panel-body" style="overflow:auto;">
|
||||
<form class="form-horizontal">
|
||||
<input type="hidden" v-model="row.key">
|
||||
|
||||
Reference in New Issue
Block a user