1、实体导入,已存在表支持重复导入,重复导入将更新原来的表结构

2、加入表单验证配置
This commit is contained in:
2019-06-11 18:48:51 +08:00
parent 4037398598
commit f3e5ef4ad7
7 changed files with 108 additions and 16 deletions

View File

@@ -1,3 +1,26 @@
<style>
/* 自定义下拉菜单外观 */
.dropdown-menu-table {
padding: 0;
border: none;
}
.dropdown-menu-table .table {
margin-bottom: 0;
}
.dropdown-menu-table .table td {
padding: 0;
}
.dropdown-menu-table .table a {
padding: 8px;
display: block;
}
/*.dropdown-menu-table .table a:hover,
.dropdown-menu-table .table a:active,
.dropdown-menu-table .table a:focus {
background-color: #e5e5e5;
text-decoration: none;
}*/
</style>
<row class="meta-service">
<div class="col-md-12">
<div class="info" style="padding-left: 10px">
@@ -287,6 +310,7 @@
<th>展示名称</th>
<th>表单组件</th>
<th>数据格式化</th>
<th>表单校验</th>
</tr>
</thead>
<tbody>
@@ -295,7 +319,7 @@
<input type="hidden" name="item" :value="JSON.stringify(item)">
</td>
<td v-text="item.col" style="background-color: rgb(235, 235, 228);"></td>
<td style="padding: 1px;"><input v-model="item.label" class="form-control" style="width: 130px;padding: 0px"></td>
<td style="padding: 1px;"><input v-model="item.label" class="form-control" style="width: 100px;padding: 0px"></td>
<td style="padding: 1px;">
<select v-model="item.inType" class="form-control" style="width: 130px">
<option></option>
@@ -305,6 +329,27 @@
<td style="padding: 1px;">
<input v-model="item.fmt" class="form-control" style="width: 130px;padding: 0px">
</td>
<td style="padding: 1px;overflow: inherit;">
<div class="dropdown dropdown-hover">
<button class="btn" type="button" data-toggle="dropdown">选择校验规则 <span class="caret"></span></button>
<div class="dropdown-menu dropdown-menu-table">
<table class="table table-bordered">
<thead>
<tr>
<th>规则</th>
<th>选择</th>
</tr>
</thead>
<tbody>
<tr v-for="c in ckTypes">
<td v-text="c.label"></td>
<td><input type="checkbox" v-model="item.cks" :value="c.name"></td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</tbody>
</table>
@@ -324,7 +369,7 @@
<input type="radio" v-model="serviceInfo.dels.cate" value="SQL"> 策略一执行完整SQL
</label>
<label class="radio-inline">
<input disabled type="radio" v-model="serviceInfo.dels.cate" value="QTASK"> 策略二执行QTask
<input disabled type="radio" v-model="serviceInfo.dels.cate" value="QTASK"> 策略二执行QTask:开发中
</label>
<br>
<br>
@@ -410,6 +455,7 @@
sheet: "a",//别名
inTypes: ["INPUT", "DICT", "INPUT_DAY", "INPUT_TIME", "FUNC", "QTASK", "HIDDEN"],
ckTypes: [{label:"必填", name: "NOTNULL"},{label:"IP", name: "IP"},{label:"IPv4", name: "IPv4"},{label:"电话号码", name: "phone"}],
dataTypes: ["bigint(20)", "varchar(255)", "varchar(64)", "varchar(32)", "varchar(16)", "int(11)", "int(3)", "int(2)", "datetime"],
filterCate: ["EQUAL", "NOTEQUAL", "LIKE", "IN"],
serviceInfo: {
@@ -710,7 +756,7 @@
// 新的
let label = this.getFieldLabel(v[i])
let fmt = this.getFiledInExt(v[i]) || ""
edits.push({col: v[i], label: label, fmt: fmt})
edits.push({col: v[i], label: label, fmt: fmt, cks:[]})
}
//去除删除的
@@ -731,6 +777,14 @@
loadInfo(name) {
getServiceInfo({name}, (json) => {
json.dels = json.dels || {cate:"", sql1:"", sql:"", qtask:""}
json.edits = json.edits || []
for (let i in json.edits) {
if (!json.edits[i].cks) {
json.edits[i].cks = []
}
}
this.serviceInfo = json;
})
},

View File

@@ -118,10 +118,11 @@
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> Excel-Sheet</div>
<ul class="nav nav-tabs nav-stacked tlist" style="height: 100%">
<li class="checkbox-inline clearfix" v-for="item in sheetArr" >
<!-- || sheetData[item]['hv']==1 -->
<input type="checkbox"
v-model="ck"
:value="sheetData[item]['name']"
:disabled="item=='表说明' || item=='表名称' || sheetData[item]['hv']==1"
:disabled="item=='表说明' || item=='表名称'"
>
<a :class="[{hv: sheetData[item]['hv']==1 }]" href="javascript:;" @click="sheet=item" data-target="#tab3Content1" data-toggle="tab" v-text="item"></a>
</li>
@@ -203,10 +204,11 @@
<div style="padding-left: 10px;background-color: #ccc;width: 100%"> DB-Table</div>
<ul class="nav nav-tabs nav-stacked tlist" style="height: 100%">
<li class="checkbox-inline clearfix" v-for="item in tableArr" >
<!-- || tableData[item]['hv']==1 -->
<input type="checkbox"
v-model="ckTable"
:value="tableData[item]['name']"
:disabled="item=='表说明' || item=='表名称' || tableData[item]['hv']==1"
:disabled="item=='表说明' || item=='表名称'"
>
<a :class="[{hv: tableData[item]['hv']==1 }]" href="javascript:;" @click="tableName=item" data-target="#tab3Content1" data-toggle="tab" v-text="item"></a>
</li>

View File

@@ -6,10 +6,7 @@ import net.tccn.dbq.Field;
import net.tccn.dbq.fbean.FilterType;
import net.tccn.dbq.jdbc.api.DbAccount;
import net.tccn.dbq.jdbc.api.DbKit;
import net.tccn.meta.Filter;
import net.tccn.meta.MetaLink;
import net.tccn.meta.MetaService;
import net.tccn.meta.MetaTable;
import net.tccn.meta.*;
import net.tccn.plat.DbPlat;
import net.tccn.plat.SysPlat;
import net.tccn.user.User;
@@ -144,6 +141,10 @@ public final class MetaKit {
}
// -----------------------------------
public void cleanData() {
}
/**
* 通过 别名 查询 MetaTable
@@ -201,7 +202,7 @@ public final class MetaKit {
Kv<String, MetaTable> metaTables = getMetaTables(metaService, false);
List<Map<String, String>> shows = metaService.getShows();
List<Map<String, String>> edits = metaService.getEdits();
List<FromItem> edits = metaService.getEdits();
List<Map<String, String>> details = metaService.getDetails();
List<Filter> filters = metaService.getFilters();
String comment = metaService.getComment();

View File

@@ -0,0 +1,18 @@
package net.tccn.meta;
import lombok.Data;
import java.util.List;
/**
* @author: liangxianyou
*/
@Data
public class FromItem {
private String col;
private String label;
private String inType;
private String fmt;
private List<String> cks;
}

View File

@@ -23,7 +23,7 @@ public class MetaService extends Doc<MetaService> {
private String sysPlatId; //平台id
private List<Map<String,String>> shows = new ArrayList<>();
private List<Map<String,String>> edits = new ArrayList<>();
private List<FromItem> edits = new ArrayList<>();
private List<Map<String,String>> details = new ArrayList<>();
private Map<String, String> dels = new HashMap<>();
private List<Filter> filters = new ArrayList<>();//{name:"", label:"", checked:true, }

View File

@@ -4,10 +4,7 @@ import net.tccn.base.JBean;
import net.tccn.base.Kv;
import net.tccn.base.MetaKit;
import net.tccn.dbq.Field;
import net.tccn.meta.Filter;
import net.tccn.meta.MetaLink;
import net.tccn.meta.MetaService;
import net.tccn.meta.MetaTable;
import net.tccn.meta.*;
import net.tccn.plat.SysPlat;
import org.redkale.net.http.RestMapping;
import org.redkale.net.http.RestParam;
@@ -173,7 +170,7 @@ public class MetadataService extends BaseService { //arango
}
@RestMapping(name = "editsave", comment = "表单配置保存")
public JBean editSave(String name, List<Map<String, String>> edits, @RestParam(name = "platToken") String token) {
public JBean editSave(String name, List<FromItem> edits, @RestParam(name = "platToken") String token) {
if (edits == null || edits.size() == 0) return null;
MetaService metaService = MetaKit.getMetaService(name, token);

View File

@@ -102,6 +102,26 @@ public class _TableService extends BaseService {
}).toArray(MetaTable[]::new);
MetaKit.save(metaTables);
// 已经有的表 更新
MetaTable[] metaTables2 = tables.stream()
.filter(t -> hv.contains(t.getName())) // 去除同名
.map(t -> {
MetaTable table = MetaKit.getMetaTable(t.getName(), token);
MetaTable metaTable = MetaTable.toAs(t);
table.setCatalog(catalog);
table.setDbPlatId(dbPlatId);
table.setAlias(table.getAlias());// 表别名
table.setSysPlatId(platId(token));
table.setItems(metaTable.getItems());
table.setComment(metaTable.getComment());
return table;
}).toArray(MetaTable[]::new);
MetaKit.save(metaTables2);
}
return JBean.OK;
}