修改:1、arangodb -> mysql,去除arangodb
2、部分字段逻辑重构
This commit is contained in:
@@ -60,12 +60,12 @@
|
||||
<th v-show="status==1">操作</th>
|
||||
</tr>
|
||||
|
||||
<tr v-show="status==0" v-for="(k, v) in linkInfo.link">
|
||||
<tr v-show="status==0" v-for="(k, v) in linkInfo.links">
|
||||
<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, index) in link2">
|
||||
<tr v-show="status==1" v-for="(linkItem, index) in links2">
|
||||
<td>
|
||||
<select class="form-control" v-model="linkItem.f1">
|
||||
<option></option>
|
||||
@@ -107,7 +107,7 @@
|
||||
</div>
|
||||
<div class="modal-body" style="text-align: center">
|
||||
<select class="form-control" v-model="newLinkTable">
|
||||
<option v-for="x in tables" :value="x" v-text="strJoin(x.name, x.comment, '---')" v-show="!isDisable(x)"></option>
|
||||
<option v-for="x in tables" :value="x" v-text="strJoin(x.tablename, x.comment, '---')" v-show="!isDisable(x)"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -141,7 +141,7 @@
|
||||
links: [], //
|
||||
linkInfos: [],
|
||||
linkInfo: {},
|
||||
link2: [],
|
||||
links2: [],
|
||||
newLinkTable: {},
|
||||
|
||||
aliasB: '',
|
||||
@@ -184,20 +184,20 @@
|
||||
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]]
|
||||
let links = {}
|
||||
let links2 = [] // [{f1:"", f2:""}]
|
||||
for(k in linkInfo["links"]) {
|
||||
let [_k, _v] = [k, linkInfo["links"][k]]
|
||||
if (k.startsWith(this.aliasA + '.')) {
|
||||
link[_k] = _v
|
||||
link2.push({f1: _k, f2: _v})
|
||||
links[_k] = _v
|
||||
links2.push({f1: _k, f2: _v})
|
||||
} else {
|
||||
link[_v] = _k
|
||||
link2.push({f1: _v, f2: _k})
|
||||
links[_v] = _k
|
||||
links2.push({f1: _v, f2: _k})
|
||||
}
|
||||
}
|
||||
linkInfo['link'] = link
|
||||
this.link2 = link2
|
||||
linkInfo['links'] = links
|
||||
this.link2 = links2
|
||||
}
|
||||
}
|
||||
this.linkInfo = linkInfo
|
||||
@@ -222,11 +222,11 @@
|
||||
})
|
||||
},
|
||||
dealTableLabel(table) {
|
||||
return `${table.name} (${table.comment||'-'}) [${table.linkCount}]`
|
||||
return `${table.tablename} (${table.comment||'-'}) [${table.linkCount}]`
|
||||
},
|
||||
dealFilter(table) {
|
||||
// table.name 中是否包含 thiss.filter 的值
|
||||
if (table.name.indexOf(this.filter) > -1 || table.comment.indexOf(this.filter) > -1) {
|
||||
if (table.tablename.indexOf(this.filter) > -1 || table.comment.indexOf(this.filter) > -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -257,28 +257,28 @@
|
||||
// 保存(同修改)
|
||||
},
|
||||
addLinkField() {
|
||||
let link2 = this.link2
|
||||
link2.push({f1: "", f2: ""})
|
||||
this.link2 = link2
|
||||
let links2 = this.links2
|
||||
links2.push({f1: "", f2: ""})
|
||||
this.links2 = links2
|
||||
},
|
||||
delLinkField(index) {
|
||||
let link2 = []
|
||||
let links2 = []
|
||||
for (let i in this.link2) {
|
||||
if (i != index) {
|
||||
link2.push(this.link2[i])
|
||||
links2.push(this.link2[i])
|
||||
}
|
||||
}
|
||||
this.link2 = link2
|
||||
this.links2 = links2
|
||||
},
|
||||
saveLink() {
|
||||
let link = {}
|
||||
for(let i in this.link2) {
|
||||
let item = this.link2[i]
|
||||
let links = {}
|
||||
for(let i in this.links2) {
|
||||
let item = this.links2[i]
|
||||
if (item['f1'] && item['f2']) {
|
||||
link[item['f1']] = item['f2']
|
||||
links[item['f1']] = item['f2']
|
||||
}
|
||||
}
|
||||
if (link.size == 0) {
|
||||
if (links.size === 0) {
|
||||
red.showError("请填写完整的关联字段信息")
|
||||
return false
|
||||
}
|
||||
@@ -288,7 +288,7 @@
|
||||
if (!linkInfo['tables']) {
|
||||
linkInfo['tables'] = [this.aliasA, this.aliasB]
|
||||
}
|
||||
linkInfo["link"] = link
|
||||
linkInfo["links"] = links
|
||||
linkSave({link: linkInfo}).then(res => {
|
||||
red.showOk()
|
||||
})
|
||||
|
||||
@@ -515,8 +515,8 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 required">选择业务主表</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 class="form-control" v-model="createRow.tablealias">
|
||||
<option v-for="x in tables" :value="x.alias" v-text="x.tablename + ' --- ' + x.comment"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -571,7 +571,7 @@
|
||||
filterCate: ["EQUAL", "NOTEQUAL", "LIKE", "IN"],
|
||||
serviceInfo: {
|
||||
name: "",
|
||||
table: "",
|
||||
tablealias: "",
|
||||
items: [],
|
||||
shows: [],
|
||||
exports: [],
|
||||
@@ -601,7 +601,7 @@
|
||||
services: [],//业务列表
|
||||
service: "", //页面选择的业务类型
|
||||
serviceLabel: "",
|
||||
table: "",//表别名
|
||||
tablealias: "",//表别名
|
||||
|
||||
//filter
|
||||
filterArr: [],
|
||||
@@ -687,7 +687,7 @@
|
||||
//console.log("dels", dels)
|
||||
let cate = dels["cate"] || "UP_FIELD"
|
||||
let sql1 = dels["sql1"] || "update #(table) set status=9 where id=#(id);"
|
||||
let sql = dels["sql"] || `update ${v['tables'][this.serviceInfo.table]['name']} set status=9 where id=#(id);`
|
||||
let sql = dels["sql"] || `update ${v['tables'][this.serviceInfo.tablealias]['tablename']} set status=9 where id=#(id);`
|
||||
let qtask = dels["qtask"] || ""
|
||||
|
||||
let serviceInfo = this.serviceInfo
|
||||
@@ -695,7 +695,7 @@
|
||||
this.serviceInfo = serviceInfo
|
||||
},
|
||||
sheet: function (v) {
|
||||
this.table = v;
|
||||
this.tablealias = v;
|
||||
},
|
||||
filterArr: function (v) { // 添加或删除选项触发
|
||||
let filters = this.serviceInfo.filters
|
||||
@@ -900,7 +900,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
this.serviceInfo = json;
|
||||
vm.serviceInfo = json;
|
||||
})
|
||||
},
|
||||
loadDetail(name) {
|
||||
|
||||
@@ -292,7 +292,7 @@
|
||||
tableData: {},
|
||||
tableArr: [],
|
||||
dbPlat: red.getData("dbPlat",{}),
|
||||
dbPlatId: red.getData("dbPlatId",''),
|
||||
dbid: red.getData("dbPlatId",''),
|
||||
catalog: '',
|
||||
tableName: '',
|
||||
ckTable: [],
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-md-2">数据平台</label>
|
||||
<div class="col-sm-2">
|
||||
<select v-model="row.dbPlatId" class="form-control">
|
||||
<select v-model="row.dbid" class="form-control">
|
||||
<option></option>
|
||||
<option v-for="item in dbPlats" :value="item.key" v-text="item.name"></option>
|
||||
</select>
|
||||
@@ -241,7 +241,7 @@
|
||||
itemEdit: {}, //待修改的字段属性
|
||||
|
||||
dbPlats:[],
|
||||
row: {key: "", platId: "", dbPlatId:"", catalog: "", name:"", comment:"", alias: ""},
|
||||
row: {tableid: "", platid: "", dbid:"", catalog: "", tablename:"", comment:"", alias: ""},
|
||||
filter: {db: "", catalog: "", name: ""},//tableList 过滤条件
|
||||
|
||||
upsql: "", // 需要执行的 sql语句
|
||||
@@ -250,7 +250,7 @@
|
||||
},
|
||||
watch: {
|
||||
metaTable(v) {
|
||||
this.name = v.name
|
||||
this.tablename = v.tablename
|
||||
this.alias = v.alias
|
||||
},
|
||||
status: function (v) {
|
||||
@@ -298,11 +298,11 @@
|
||||
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.tablename !== row.tablename) {
|
||||
vm.upsql += 'RENAME TABLE `{0}`.`{1}` TO `{2}`.`{3}`;\n'.format(vm.metaTable.catalog, vm.metaTable.tablename, vm.metaTable.catalog, row.tablename)
|
||||
}
|
||||
if (vm.metaTable.comment !== row.comment) {
|
||||
vm.upsql += 'ALTER TABLE `{0}`.`{1}` COMMENT=\'{2}\';\n'.format(vm.metaTable.catalog, vm.metaTable.name, row.comment)
|
||||
vm.upsql += 'ALTER TABLE `{0}`.`{1}` COMMENT=\'{2}\';\n'.format(vm.metaTable.catalog, vm.metaTable.tablename, row.comment)
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
@@ -320,7 +320,7 @@
|
||||
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};
|
||||
this.row = {tableid:v.tableid, dbid: v.dbid, catalog: v.catalog, tablename:v.tablename, comment:v.comment, alias: v.alias};
|
||||
let oldItems = v['items'] || []
|
||||
this.oldItems = JSON.parse(JSON.stringify(oldItems))
|
||||
},
|
||||
@@ -347,7 +347,7 @@
|
||||
catalogs: function() {
|
||||
let dbPlats = this.dbPlats;
|
||||
for (i in dbPlats) {
|
||||
if (dbPlats[i].key == this.row.dbPlatId) {
|
||||
if (dbPlats[i].dbid === this.row.dbid) {
|
||||
return dbPlats[i]["catalogs"]
|
||||
}
|
||||
}
|
||||
@@ -482,11 +482,11 @@
|
||||
},
|
||||
dealTableLabel(table) {
|
||||
// (${table.linkCount})
|
||||
return `${table.name} [${table.comment}]`
|
||||
return `${table.tablename} [${table.comment}]`
|
||||
},
|
||||
dealFilter(table) {
|
||||
// table.name 中是否包含 thiss.filter 的值
|
||||
if (table.name.indexOf(this.filter) > -1 || table.comment.indexOf(this.filter) > -1) {
|
||||
if (table.tablename.indexOf(this.filter) > -1 || table.comment.indexOf(this.filter) > -1) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user