修改:1、arangodb -> mysql,去除arangodb

2、部分字段逻辑重构
This commit is contained in:
2024-04-01 15:53:48 +08:00
parent 81e1a59e65
commit 9973ad18ca
59 changed files with 926 additions and 660 deletions

View File

@@ -1,12 +1,12 @@
const db = {
catalogList({dbAccount, dbPlatId}) { // database列表
catalogList({dbAccount, dbid}) { // database列表
console.log(JSON.stringify(dbAccount))
return red.postX('/_db/catalog_list', {dbAccount: escape(JSON.stringify(dbAccount)), dbPlatId})
return red.postX('/_db/catalog_list', {dbAccount: escape(JSON.stringify(dbAccount)), dbid})
},
tableList({dbPlatId, catalog}) { // 数据库表列表
return red.postX('/_db/table_list', {dbPlatId, catalog})
tableList({dbid, catalog}) { // 数据库表列表
return red.postX('/_db/table_list', {dbid, catalog})
},
tableInfo({dbPlatId, catalog, tableName}) {
return red.postX('/_db/table_info', {dbPlatId, catalog, tableName})
tableInfo({dbid, catalog, tableName}) {
return red.postX('/_db/table_info', {dbid, catalog, tableName})
}
}

View File

@@ -19,9 +19,9 @@ const meta = {
getServiceInfo({name}, callback) {
red.getJSON("/meta/service_info",{name}, res => {
let {name, comment, table, edits, imports, shows, exports, filters, details, dels} = red.replacePoint(res)
let {name, comment, tablealias, edits, imports, shows, exports, filters, details, dels} = red.replacePoint(res)
callback({name, comment, table, edits, imports, shows, exports, filters, details, dels});
callback({name, comment, tablealias, edits, imports, shows, exports, filters, details, dels});
});
},
getServiceDetail({name}, callback) {
@@ -97,7 +97,7 @@ const meta = {
//client
exportData({fbean, cate}) {
if (cate == 'excel') {
location.href = "/data/export?fBean=" + JSON.stringify(fbean) + "&platToken=" + red.getPlatToken() + "&cate=excel";
location.href = "/data/export?fBean=" + JSON.stringify(fbean) + "&plattoken=" + red.getPlatToken() + "&cate=excel";
} else if (cate == 'cvs') {
} else if (cate == 'json') {

View File

@@ -2,7 +2,7 @@
const plat = {
platList(params = {}) { // 平台列表
params['platToken'] = 'xx'
params['plattoken'] = 'xx'
return red.getX('/plat/list', params)
},
platSave({plat}) {

View File

@@ -1,19 +1,19 @@
const table = {
_sheets({cate, filePath, dbAccount, dbPlatId, catalog}) {
return red.postX('/_table/sheets',{cate, filePath, dbAccount, dbPlatId, catalog})
_sheets({cate, filePath, dbAccount, dbid, catalog}) {
return red.postX('/_table/sheets',{cate, filePath, dbAccount, dbid, catalog})
},
sheetsExcel({filePath}) {
return table._sheets({cate: "excel", filePath})
},
sheetMySql({dbPlatId, catalog}) {
return table._sheets({cate: "mysql", dbPlatId, catalog})
sheetMySql({dbid, catalog}) {
return table._sheets({cate: "mysql", dbid, catalog})
},
sheetInfo({filePath, sheetName}) {
return red.postX('/_table/sheet_info', {cate: 'excel', filePath, sheetName})
},
saveTable({dbPlatId, catalog, tableArr}) { //
return red.postX('/_table/table_save', {cate: 'mysql', dbPlatId, catalog, tableArr: JSON.stringify(tableArr)})
saveTable({dbid, catalog, tableArr}) { //
return red.postX('/_table/table_save', {cate: 'mysql', dbid, catalog, tableArr: JSON.stringify(tableArr)})
},
saveSheet({filePath, sheetNames}) {
return red.postX('/_table/table_save', {cate: 'excel', filePath, sheetNames: JSON.stringify(sheetNames)})

View File

@@ -1,7 +1,7 @@
//import red from '../res/js/red'
const login = ({username, pwd}) => {
return red.postX("/user/login", {username, pwd, platToken: 'xx'})
return red.postX("/user/login", {username, pwd, plattoken: 'xx'})
}
const logout = () => {

View File

@@ -88,7 +88,7 @@
<div class="form-group">
<label for="para" class="col-sm-2 required">数据平台</label>
<div class="col-md-6">
<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>

View File

@@ -16,7 +16,7 @@
<div class="col-md-12 col-xs-12" id="top">
<div class="logo">
<!--<h1>Meta-Kit</h1>-->
<h1>{{sysPlat.name}}</h1>
<h1>{{sysPlat.platname}}</h1>
</div>
<ul class="nav nav-tabs">
<!--item in pages-->
@@ -38,7 +38,7 @@
<li class="pull-right">
<select v-model="sysPlat" class="form-control plat-switch">
<option v-for="item in sysPlats" :value="item" v-text="item.name"></option>
<option v-for="item in sysPlats" :value="item" v-text="item.platname"></option>
</select>
</li>
</ul>

View File

@@ -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()
})

View File

@@ -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) {

View File

@@ -292,7 +292,7 @@
tableData: {},
tableArr: [],
dbPlat: red.getData("dbPlat",{}),
dbPlatId: red.getData("dbPlatId",''),
dbid: red.getData("dbPlatId",''),
catalog: '',
tableName: '',
ckTable: [],

View File

@@ -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

View File

@@ -81,7 +81,7 @@
<div class="form-group">
<label for="queryId" class="col-sm-2 required">平台名称</label>
<div class="col-md-6 col-sm-10">
<input v-model="row.name" class="form-control" id="queryId" placeholder="请输入 平台名称">
<input v-model="row.dbname" class="form-control" id="queryId" placeholder="请输入 平台名称">
</div>
</div>
<div class="form-group">
@@ -151,7 +151,7 @@
cfg: {
title: "数据中心 管理",
cols: [
{col: "name", label: "数据平台名称"},
{col: "dbname", label: "数据平台名称"},
{col: "url", label: "数据平台连接地址"},
{col: "user", label: "用户"},
{col: "remark", label: "备注"},
@@ -222,7 +222,7 @@
loadCatalogs: function () {
vm.catalogs = [];
//let [cate, url, user, pwd] = this.row
let dbAccount = {key: '',cate:'', url:'', user:'', pwd:''}
let dbAccount = {dbid: '',cate:'', url:'', user:'', pwd:''}
for (let key in dbAccount) {
dbAccount[key] = this.row[key]
}
@@ -233,7 +233,7 @@
dbPulse: function (row) {
/*row["check"] = true;
$.getJSON("/_db/pulse", {
dbPlatId: row._id
dbid: row._id
}, function (json) {
row["pulse"] = json.body;
row["check"] = false;

View File

@@ -48,13 +48,13 @@
<div class="form-group">
<label for="queryId" class="col-md-2 required">平台名称</label>
<div class="col-md-8">
<input v-model="row.name" class="form-control" id="queryId" placeholder="请输入 平台名称">
<input v-model="row.platname" class="form-control" id="queryId" placeholder="请输入 平台名称">
</div>
</div>
<div class="form-group">
<label for="token" class="col-md-2 required">平台 Token</label>
<div class="col-md-8 col-sm-10">
<input v-model="row.token" class="form-control" id="token" placeholder="请输入 Token">
<input v-model="row.plattoken" class="form-control" id="token" placeholder="请输入 Token">
</div>
</div>
@@ -84,8 +84,8 @@
cfg: {
title: "业务平台 管理",
cols: [
{col: "name", label: "业务名称"},
{col: "token", label: "Token"},
{col: "platname", label: "业务名称"},
{col: "plattoken", label: "Token"},
{col: "remark", label: "说明"},
{col: "status", label: "状态", fmt: function (v) {
return {"0":"未启用", "1":"启用", "-1":"删除"}[v] || "";

View File

@@ -26,7 +26,7 @@
<div class="form-group">
<label for="para" class="col-sm-2 required">数据平台</label>
<div class="col-md-6">
<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>
@@ -87,7 +87,7 @@
catalogs: function () {
let dbPlats = this.dbPlats;
for (i in dbPlats) {
if (dbPlats[i].key == this.row.dbplatid) {
if (dbPlats[i].key == this.row.dbid) {
return dbPlats[i]["catalogs"]
}
}

View File

@@ -128,7 +128,7 @@
<tr>
<th>数据平台</th>
<td>
<select v-model="row.dbplatid" class="form-control">
<select v-model="row.dbid" class="form-control">
<option v-for="item in dbPlats" :value="item.key" v-text="item.name"></option>
</select>
</td>

View File

@@ -46,10 +46,10 @@ var red = {
location.href = "/user/login.html";
}, 2000);
}*/
return plat["token"];
return plat["plattoken"];
},
getJSON: function (url, params = {}, callback) {
params["platToken"] = red.getPlatToken()
params["plattoken"] = red.getPlatToken()
axios.get(url, {params}).then(res => {
let data = res.data || {}
red.loginCheck(data)
@@ -124,8 +124,8 @@ var red = {
})
},
getX(url, params = {}) {
if (!params['platToken'])
params['platToken'] = red.getPlatToken()
if (!params['plattoken'])
params['plattoken'] = red.getPlatToken()
return new Promise(resolve => {
axios.get(url, params).then(res => {
let data = res.data || {}
@@ -146,8 +146,8 @@ var red = {
})
},
postX(url, params = {}) {
if (!params['platToken'])
params['platToken'] = red.getPlatToken()
if (!params['plattoken'])
params['plattoken'] = red.getPlatToken()
return new Promise(resolve => {
axios({
url,
@@ -178,7 +178,7 @@ var red = {
})
},
post: function(url, params = {}, callback) {
//params['platToken'] = red.getPlatToken()
//params['plattoken'] = red.getPlatToken()
axios.post(url, params).then(res => {
/*let data = red.loginCheck(res.data)
if (data && data.code == -1) {

View File

@@ -80,7 +80,7 @@
<label for="username" class="col-md-3">业务平台</label>
<div class="col-md-8">
<select v-model="sysPlat" class="form-control">
<option v-for="item in sysPlats" :value="item" v-text="item.name"></option>
<option v-for="item in sysPlats" :value="item" v-text="item.platname"></option>
</select>
</div>
</div>
@@ -88,7 +88,7 @@
</div>
<div class="modal-footer">
<!--<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>-->
<button @click="goIndex()" type="button" class="btn btn-primary btn-block">确定选择 <span v-text="[sysPlat.name]"></span></button>
<button @click="goIndex()" type="button" class="btn btn-primary btn-block">确定选择 <span v-text="[sysPlat.platname]"></span></button>
</div>
</div>
</div>