.
This commit is contained in:
@@ -60,45 +60,50 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 实体表信息 -->
|
||||
<div class="col-md-10" v-show="status!=7 && status!=8">
|
||||
<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>
|
||||
<th v-show="status==1"></th>
|
||||
<th>字段名</th>
|
||||
<th>中文名</th>
|
||||
<th>数据类型</th>
|
||||
<!--
|
||||
<th>输入类型</th>
|
||||
<th>附加属性</th>
|
||||
-->
|
||||
<th>主键</th>
|
||||
</tr>
|
||||
<tr v-for="(item, index) in meta.items" class="item">
|
||||
<td v-show="status==1" class="icon icon-move"></td>
|
||||
<td v-show="status!=2" v-text="item.name" style="background-color: rgb(235, 235, 228);"></td>
|
||||
<td v-show="status!=2" v-text="item.label"></td>
|
||||
<td v-show="status!=2" v-text="item.type"></td>
|
||||
<!--
|
||||
<td v-show="status!=2" v-text="item.inType"></td>
|
||||
<td v-show="status!=2" v-text="item.inExt"></td>
|
||||
-->
|
||||
<td v-show="status!=2">
|
||||
<i v-if="item.pk" class="icon icon-check"></i>
|
||||
</td>
|
||||
<div class="col-md-10">
|
||||
<!-- 实体属性列表 -->
|
||||
<div class="panel" v-show="status!=7 && status!=8">
|
||||
<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>
|
||||
<th v-show="status==1"></th>
|
||||
<th>字段名</th>
|
||||
<th>中文名</th>
|
||||
<th>数据类型</th>
|
||||
<!--
|
||||
<th>输入类型</th>
|
||||
<th>附加属性</th>
|
||||
-->
|
||||
<th>非空</th>
|
||||
<th>主键</th>
|
||||
</tr>
|
||||
<tr v-for="(item, index) in meta.items" class="item">
|
||||
<td v-show="status==1" class="icon icon-move"></td>
|
||||
<td v-show="status!=2" v-text="item.name" style="background-color: rgb(235, 235, 228);"></td>
|
||||
<td v-show="status!=2" v-text="item.label"></td>
|
||||
<td v-show="status!=2" v-text="item.type"></td>
|
||||
<!--
|
||||
<td v-show="status!=2" v-text="item.inType"></td>
|
||||
<td v-show="status!=2" v-text="item.inExt"></td>
|
||||
-->
|
||||
<td v-show="status!=2">
|
||||
<i v-if="item.notNull" class="icon icon-check"></i>
|
||||
</td>
|
||||
<td v-show="status!=2">
|
||||
<i v-if="item.pk" class="icon icon-check"></i>
|
||||
</td>
|
||||
|
||||
<td v-show="status==2">
|
||||
<input type="hidden" name="item" :value="JSON.stringify(item)">
|
||||
<input v-model="item" type="hidden">
|
||||
<input :value="item.name" disabled class="form-control">
|
||||
<input v-model="item.name" type="hidden">
|
||||
<input name="name" type="hidden" :value="item.name">
|
||||
</td>
|
||||
<td v-show="status==2"><input v-model="item.label" class="form-control"></td>
|
||||
<td v-show="status==2"><input v-model="item.type" class="form-control"></td>
|
||||
<!--
|
||||
<td v-show="status==2">
|
||||
<input type="hidden" name="item" :value="JSON.stringify(item)">
|
||||
<input v-model="item" type="hidden">
|
||||
<input :value="item.name" disabled class="form-control">
|
||||
<input v-model="item.name" type="hidden">
|
||||
<input name="name" type="hidden" :value="item.name">
|
||||
</td>
|
||||
<td v-show="status==2"><input v-model="item.label" class="form-control"></td>
|
||||
<td v-show="status==2"><input v-model="item.type" class="form-control"></td>
|
||||
<!--
|
||||
<td v-show="status==2">
|
||||
<select v-model="item.inType" class="form-control" style="width: 130px">
|
||||
<option></option>
|
||||
@@ -107,16 +112,19 @@
|
||||
</td>
|
||||
<td v-show="status==2"><input v-model="item.inExt" class="form-control"></td>
|
||||
-->
|
||||
<td v-show="status==2" style="text-align: center">
|
||||
<label>
|
||||
<input v-model="item.pk" type="checkbox">
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="col-md-10">
|
||||
<td v-show="status==2" style="text-align: center">
|
||||
<label>
|
||||
<input v-model="item.notNull" type="checkbox">
|
||||
</label>
|
||||
</td>
|
||||
<td v-show="status==2" style="text-align: center">
|
||||
<label>
|
||||
<input v-model="item.pk" type="checkbox">
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- baseInfo -->
|
||||
<div class="panel" v-show="status==7 ">
|
||||
@@ -166,6 +174,12 @@
|
||||
|
||||
<p style="padding: 5px">整理中,【实体关系】放到此处维护</p>
|
||||
</div>
|
||||
|
||||
<textarea class="form-control layui-code" v-model="upsql" rows="10" id="content" placeholder="/* 没有提交要执行的查询 */" />
|
||||
</div>
|
||||
|
||||
<div class="col-md-10">
|
||||
|
||||
</div>
|
||||
|
||||
</row>
|
||||
@@ -175,10 +189,10 @@
|
||||
let {showOk} = red
|
||||
let {dbList} = plat
|
||||
|
||||
var vm = new Vue({
|
||||
let vm = new Vue({
|
||||
el: ".meta-list",
|
||||
data: {
|
||||
inTypes: ["INPUT", "SELECT_EXT", "INPUT_DT", "FMT_FUN"],
|
||||
inTypes: ["INPUT", "SELECT_EXT", "INPUT_DT", "FMT_FUN", "FILE"],
|
||||
dataTypes: ["bigint(20)", "varchar(255)", "varchar(64)", "varchar(32)", "varchar(16)", "int(11)", "int(3)", "int(2)", "datetime"],
|
||||
filterCate: ["EQUAL", "NOTEQUAL", "LIKE", "IN"],
|
||||
tables: [],//所有的业务类型,【测试用】
|
||||
@@ -199,6 +213,8 @@
|
||||
dbPlats:[],
|
||||
row: {key: "", platId: "", dbPlatId:"", catalog: "", name:"", comment:"", alias: ""},
|
||||
filter: {db: "", catalog: "", name: ""},//tableList 过滤条件
|
||||
|
||||
upsql: "", // 需要执行的 sql语句
|
||||
},
|
||||
watch: {
|
||||
metaTable(v) {
|
||||
@@ -207,6 +223,7 @@
|
||||
},
|
||||
status: function (v) {
|
||||
this.setMove(v)
|
||||
this.upsql = ''
|
||||
},
|
||||
alias: function () {
|
||||
this.loadDetail();
|
||||
@@ -217,7 +234,7 @@
|
||||
let itemOv = this.oldItems || [];
|
||||
if (itemOv.length == 0) return;
|
||||
|
||||
let attr = ["label", "name", "pk", "type", "inType","inExt"];
|
||||
let attr = ["label", "name", "pk", "type", "inType","inExt", 'notNull'];
|
||||
let itemEdit = [];
|
||||
a:for (let i = 0; i < itemOv.length; i++) {
|
||||
for (let j = 0; j < attr.length; j++) {
|
||||
@@ -243,6 +260,33 @@
|
||||
//vm.table = v[0]["name"];
|
||||
}
|
||||
},
|
||||
|
||||
// 基础信息变更 sql
|
||||
row: {
|
||||
handler: function (row) {
|
||||
//console.log(vm.metaTable.name, " -> ",v.name)
|
||||
vm.upsql = ''
|
||||
if (vm.metaTable.name != row.name) {
|
||||
vm.upsql += 'RENAME TABLE `{0}`.`{1}` TO `{2}`.`{3}`;\n'.format(vm.metaTable.catalog, vm.metaTable.name, vm.metaTable.catalog, row.name)
|
||||
}
|
||||
if (vm.metaTable.comment != row.comment) {
|
||||
vm.upsql += 'ALTER TABLE `{0}`.`{1}` COMMENT=\'{2}\';\n'.format(vm.metaTable.catalog, vm.metaTable.name, row.comment)
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
|
||||
// 属性表更 sql
|
||||
itemEdit: {
|
||||
handler: function (items) {
|
||||
// vm.upsql = 'ALTER TABLE `{0}`.`{1}'.format()
|
||||
/*`
|
||||
CHANGE `rankcate` `rankcate` VARCHAR(64) CHARSET utf8 COLLATE utf8_general_ci DEFAULT '' NOT NULL COMMENT '[排行类型]',
|
||||
CHANGE `remark` `remark1` VARCHAR(128) CHARSET utf8 COLLATE utf8_general_ci DEFAULT '' NOT NULL COMMENT '[说明]';*/
|
||||
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
meta: function (v) {
|
||||
this.row = {key:v.key, dbPlatId: v.dbPlatId, catalog: v.catalog, name:v.name, comment:v.comment, alias: v.alias};
|
||||
let oldItems = v['items'] || []
|
||||
@@ -253,6 +297,7 @@
|
||||
methods: {
|
||||
loadDetail() {
|
||||
tableInfo({alias: this.alias}).then(res => {
|
||||
this.metaTable = res
|
||||
let row = res;
|
||||
vm.meta = row;
|
||||
let oldItems = [];
|
||||
@@ -422,14 +467,22 @@
|
||||
},
|
||||
showInfo() {
|
||||
$('#f-info').modal({moveable: true})
|
||||
}
|
||||
},
|
||||
buildSql() {
|
||||
|
||||
}
|
||||
},
|
||||
mounted: function (){
|
||||
dbList().then(res => {
|
||||
this.dbPlats = res.rows;
|
||||
})
|
||||
this.tableList();
|
||||
|
||||
/*setTimeout(function () {
|
||||
layui.use('code', function(){ //加载code模块
|
||||
layui.code({title:"",about: false, height: "500"}); //引用code方法
|
||||
});
|
||||
}, 300)*/
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user