'新增业务添加'
This commit is contained in:
@@ -7,6 +7,9 @@ const meta = {
|
|||||||
red.getJSON("/meta/tableinfo",{name}, json => callback(json));
|
red.getJSON("/meta/tableinfo",{name}, json => callback(json));
|
||||||
},*/
|
},*/
|
||||||
|
|
||||||
|
serviceSave({service}) {
|
||||||
|
return red.postX('/meta/service_save', {service: JSON.stringify(service)})
|
||||||
|
},
|
||||||
getServiceList(callback) {
|
getServiceList(callback) {
|
||||||
red.getJSON("/meta/service_list",{}, json => {
|
red.getJSON("/meta/service_list",{}, json => {
|
||||||
json = red.replacePoint(json);
|
json = red.replacePoint(json);
|
||||||
|
|||||||
@@ -50,30 +50,29 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clearfix" style="padding-top: 5px"></div>
|
<div class="clearfix"></div>
|
||||||
<div class="col-xs-2 sheet-cell">
|
<div class="col-xs-2 sheet-cell">
|
||||||
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> DB-Table</div>
|
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 实体表(Meta-Table)</div>
|
||||||
<ul class="nav nav-tabs nav-stacked tlist" style="height: 100%">
|
<ul class="nav nav-tabs nav-stacked tlist" style="height: 100%">
|
||||||
<li class="['clearfix', {'active' == item.alias}]" v-for="item in tables" >
|
<li :class="['clearfix', {'active': aliasA == item.alias}]" v-for="item in tables" >
|
||||||
<a href="javascript:;" @click="aliasA=item.alias" data-target="#tab3Content1" data-toggle="tab" v-text="dealTableLabel(item)"></a>
|
<a href="javascript:;" @click="aliasA=item.alias" data-target="#tab3Content1" data-toggle="tab" v-text="dealTableLabel(item)"></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!--<p v-show="ckTable && ckTable.length">已选择 <code v-text="ckTable.length||0"></code> 个实体待导入</p>-->
|
<!--<p v-show="ckTable && ckTable.length">已选择 <code v-text="ckTable.length||0"></code> 个实体待导入</p>-->
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-8">
|
<div class="col-xs-10">
|
||||||
|
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 关联关系管理 </div>
|
||||||
<!-- 关联表列表 -->
|
<!-- 关联表列表 -->
|
||||||
<button v-for="link in linkInfos" @click="aliasB=link.alias" :class="['btn', {'btn-primary' :aliasB==link.alias}]" v-text="link.comment" style="margin-right: 5px"> </button>
|
<button v-for="link in linkInfos" @click="aliasB=link.alias" :class="['btn', {'btn-primary' :aliasB==link.alias}]" v-text="link.comment" style="margin: 5px"> </button>
|
||||||
|
|
||||||
<div class="pull-right">
|
<div class="pull-right" style="margin: 5px;">
|
||||||
<button @click="status=1" v-show="status==0" class="btn">修改关联关系</button>
|
<button @click="status=1" v-show="status==0 && aliasB" class="btn">修改关联关系</button>
|
||||||
<button @click="status=0" v-show="status==1" class="btn">取消修改</button>
|
<button @click="status=0" v-show="status==1" class="btn">取消修改</button>
|
||||||
<button @click="addLinkDia()" class="btn">+ 添加关联表</button>
|
<button @click="addLinkDia()" class="btn">+ 添加关联表</button>
|
||||||
<button @click="saveLink()" v-show="status==1" class="btn btn-primary" style="margin-right: 15px">保存</button>
|
<button @click="saveLink()" v-show="status==1" class="btn btn-primary" style="margin-right: 15px">保存</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
<table class="table-bordered" style="width: 100%;">
|
||||||
<table class="table-bordered" style="width: 100%; margin-top: 10px">
|
|
||||||
<tr>
|
<tr>
|
||||||
<th v-text="tableInfo[aliasA] && tableInfo[aliasA]['comment']"></th>
|
<th v-text="tableInfo[aliasA] && tableInfo[aliasA]['comment']"></th>
|
||||||
<th v-text="tableInfo[aliasB] && tableInfo[aliasB]['comment']"></th>
|
<th v-text="tableInfo[aliasB] && tableInfo[aliasB]['comment']"></th>
|
||||||
@@ -110,6 +109,11 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div v-show="!linkInfos || linkInfos.length == 0" style="text-align: center">
|
||||||
|
<img src="../res/img/none.png">
|
||||||
|
<p>暂无关联表</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 选择关联表 -->
|
<!-- 选择关联表 -->
|
||||||
@@ -149,7 +153,7 @@
|
|||||||
data: {
|
data: {
|
||||||
status: 0,
|
status: 0,
|
||||||
tables: [], //所有的表数据{name,comment, alias, linkCount}
|
tables: [], //所有的表数据{name,comment, alias, linkCount}
|
||||||
aliasA: red.getData('aliasA', ''), //选中的主体表别名
|
aliasA: '', //选中的主体表别名
|
||||||
tableInfo:{items:{}},
|
tableInfo:{items:{}},
|
||||||
|
|
||||||
links: [], //
|
links: [], //
|
||||||
@@ -165,12 +169,15 @@
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
aliasA(v) {
|
aliasA(v) {
|
||||||
red.setData('aliasA', v)
|
//red.setData('aliasA', v)
|
||||||
|
this.links = []
|
||||||
|
this.linkInfoA = {}
|
||||||
|
this.aliasB = '' // 如果不置空,存在变更主体表,但数据不刷新的异常
|
||||||
|
|
||||||
tableInfo({alias: v}).then(res => {
|
tableInfo({alias: v}).then(res => {
|
||||||
this.tableInfoA = res
|
this.tableInfoA = res
|
||||||
linkList({alias: v}).then(res => {
|
linkList({alias: v}).then(res => {
|
||||||
this.links = res
|
this.links = res
|
||||||
this.aliasB = '' // 如果不置空,存在变更主体表,但数据不刷新的异常
|
|
||||||
})
|
})
|
||||||
linkInfoList({alias: v}).then(res => {
|
linkInfoList({alias: v}).then(res => {
|
||||||
this.linkInfos = res
|
this.linkInfos = res
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<span class="input-group-btn pull-left" style="padding-left: 20px">
|
<span class="input-group-btn pull-left" style="padding-left: 20px">
|
||||||
<button @click="tipShow('开发中')" :class="['btn']" type="button"> 新建业务</button>
|
<button @click="createService()" :class="['btn']" type="button"> 新建业务</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
@@ -260,12 +260,54 @@
|
|||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 新建业务 -->
|
||||||
|
<div class="modal fade" id="createServiceDia">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
|
||||||
|
<h4 class="modal-title">新建业务</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form class="form-horizontal">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3">选择业务主表</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select class="form-control" v-model="createRow.table">
|
||||||
|
<option v-for="x in tables" :value="x.alias" v-text="x.name + ' --- ' + x.comment"></option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3">业务名称</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input v-model="createRow.comment" class="form-control" placeholder="请输入 业务名称">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3">业务标识码</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input v-model="createRow.name" class="form-control" placeholder="请输入 业务标识码,如:user_service">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||||
|
<button @click="saveService()" type="button" class="btn btn-primary">确定</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</row>
|
</row>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
//import { login } from '../api/user.js'
|
//import { login } from '../api/user.js'
|
||||||
//import { getServiceInfo, getServiceDetail, getServiceList } from '/api/meta.js'
|
//import { getServiceInfo, getServiceDetail, getServiceList } from '/api/meta.js'
|
||||||
let { getServiceInfo, getServiceDetail, getServiceList } = meta;
|
let { getServiceInfo, getServiceDetail, getServiceList, tableLinkList, serviceSave } = meta;
|
||||||
let { showOk } = red
|
let { showOk } = red
|
||||||
|
|
||||||
var vm = new Vue({
|
var vm = new Vue({
|
||||||
@@ -309,13 +351,16 @@
|
|||||||
table: "",//表别名
|
table: "",//表别名
|
||||||
filterArr:[],
|
filterArr:[],
|
||||||
filterMap:{},
|
filterMap:{},
|
||||||
|
|
||||||
|
createRow: {},
|
||||||
|
tables: [],
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
status: function (v) {
|
status: function (v) {
|
||||||
this.setMove(v)
|
this.setMove(v)
|
||||||
},
|
},
|
||||||
services: function (v) {
|
services: function (v) {
|
||||||
if(v.length > 0) {
|
if(v.length > 0 && !vm.service) {
|
||||||
vm.service = v[0]["name"];
|
vm.service = v[0]["name"];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -555,8 +600,25 @@
|
|||||||
red.showMsg();
|
red.showMsg();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tipShow() {
|
createService() {
|
||||||
red.showMsg({msg: '开发中'})
|
this.createRow = {}
|
||||||
|
if (this.tables.length == 0) {
|
||||||
|
tableLinkList().then(res => {
|
||||||
|
this.tables = res
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$('#createServiceDia').modal()
|
||||||
|
},
|
||||||
|
saveService() {
|
||||||
|
serviceSave({service: this.createRow}).then(res => {
|
||||||
|
red.showOk("创建成功, 请对业务进行配置")
|
||||||
|
$('#createServiceDia').modal('hide')
|
||||||
|
|
||||||
|
this.service = this.createRow.name
|
||||||
|
getServiceList(json => {
|
||||||
|
vm.services = json;
|
||||||
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
showInfo() {
|
showInfo() {
|
||||||
$('#f-info').modal({moveable: true})
|
$('#f-info').modal({moveable: true})
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 实体表信息 -->
|
<!-- 实体表信息 -->
|
||||||
<div class="col-md-5">
|
<div class="col-md-10" v-show="status!=7 && status!=8">
|
||||||
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 实体字段信息</div>
|
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 实体字段信息</div>
|
||||||
<table :class="[{'table':status!=2},'table-bordered']" style="width: 100%">
|
<table :class="[{'table':status!=2},'table-bordered']" style="width: 100%">
|
||||||
<tr style="background-color: #f1f1f1">
|
<tr style="background-color: #f1f1f1">
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-10">
|
||||||
|
|
||||||
<!-- baseInfo -->
|
<!-- baseInfo -->
|
||||||
<div class="panel" v-show="status==7 ">
|
<div class="panel" v-show="status==7 ">
|
||||||
@@ -140,6 +140,12 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="panel" v-show="status==8">
|
||||||
|
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> 实体关系</div>
|
||||||
|
|
||||||
|
<p style="padding: 5px">整理中,【实体关系】放到此处维护</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</row>
|
</row>
|
||||||
@@ -159,7 +165,7 @@
|
|||||||
items: [],
|
items: [],
|
||||||
},//完整的元数据数据,
|
},//完整的元数据数据,
|
||||||
move: false,
|
move: false,
|
||||||
status: 7, //页面默认状态
|
status: 0, //页面默认状态
|
||||||
table: "", //页面选择的table表名称
|
table: "", //页面选择的table表名称
|
||||||
alias: "", //页面选择的table表别名
|
alias: "", //页面选择的table表别名
|
||||||
metaTable: {},
|
metaTable: {},
|
||||||
|
|||||||
BIN
root/res/img/none.png
Normal file
BIN
root/res/img/none.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -126,6 +126,43 @@ public class MetadataService extends BaseService { //arango
|
|||||||
return jBean.setBody(metaTable);
|
return jBean.setBody(metaTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RestMapping(name = "service_save", comment = "service信息保存")
|
||||||
|
public JBean serviceSave(@RestParam(name = "platToken") String token, @RestParam(name = "service") String serviceBean) {
|
||||||
|
JBean jBean = new JBean();
|
||||||
|
|
||||||
|
MetaService service = gson.fromJson(serviceBean, MetaService.class);
|
||||||
|
|
||||||
|
do {
|
||||||
|
// 标识码非空校验
|
||||||
|
if (isEmpty.test(service.getTable())) {
|
||||||
|
jBean.set(-1, "请选择业务主表");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标识码非空校验
|
||||||
|
if (isEmpty.test(service.getName())) {
|
||||||
|
jBean.set(-1, "业务标识码无效");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标识码重复校验
|
||||||
|
MetaService metaService = MetaKit.getMetaService(service.getName());
|
||||||
|
if (metaService != null && !metaService.getKey().equals(service.getKey())) {
|
||||||
|
jBean.set(-1, "业务标识码被占用,修改业务标识码重试");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (service.getKey() != null) {
|
||||||
|
service.update();
|
||||||
|
} else {
|
||||||
|
service.save();
|
||||||
|
}
|
||||||
|
MetaKit.reload(MetaService.class);
|
||||||
|
|
||||||
|
} while (false);
|
||||||
|
return jBean;
|
||||||
|
}
|
||||||
|
|
||||||
@RestMapping(name = "service_info", comment = "service基本信息")
|
@RestMapping(name = "service_info", comment = "service基本信息")
|
||||||
public JBean serviceInfo(@RestParam(name = "platToken") String token, String name) {
|
public JBean serviceInfo(@RestParam(name = "platToken") String token, String name) {
|
||||||
MetaService metaService = MetaKit.getMetaService(name);
|
MetaService metaService = MetaKit.getMetaService(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user