新增:1、qtask-debug结果渲染为表格
2、mdict 存贮到MySQL, meta 业务预览支持字典渲染验证
3、其他交互优化
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
|
||||
<div class="col-md-5" style="">
|
||||
<ul id="treeDemo" class="ztree" style="display: none"></ul>
|
||||
<table class="table table-bordered table-hover" style="width: 100%; ">
|
||||
<table class="table table-bordered tlist" style="width: 100%; ">
|
||||
<thead>
|
||||
<tr>
|
||||
<th v-for="field in cfg.cols" v-text="field.label"></th>
|
||||
@@ -47,7 +47,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in list.rows" @click="openDia(row)">
|
||||
<tr v-for="row in list.rows" @click="openDia(row)" :class="{'active': row.name == _row.name}">
|
||||
<td v-for="field in cfg.cols" v-title="row[field.col]" v-text="row[field.col]"></td>
|
||||
<td>
|
||||
<a @click="openDia(row)" href="javascript:;">编辑</a> |
|
||||
@@ -106,19 +106,19 @@
|
||||
<td>
|
||||
<input v-model="row.title" class="form-control">
|
||||
</td>
|
||||
<th style="width: 120px">任务KEY</th>
|
||||
<th>数据平台</th>
|
||||
<td>
|
||||
<input v-model="row.name" class="form-control">
|
||||
<select v-model="row.dbid" class="form-control">
|
||||
<option v-for="item in dbPlats" :value="item.dbid" v-text="item.dbname"></option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>数据平台</th>
|
||||
<th>任务KEY</th>
|
||||
<td>
|
||||
<select v-model="row.dbid" class="form-control">
|
||||
<option v-for="item in dbPlats" :value="item.dbid" v-text="item.dbname"></option>
|
||||
</select>
|
||||
<input v-model="row.name" class="form-control">
|
||||
</td>
|
||||
<th>CataLog</th>
|
||||
<th style="width: 120px">CataLog</th>
|
||||
<td>
|
||||
<select v-model="row.catalog" class="form-control">
|
||||
<option v-for="item in catalogs()" :value="item" v-text="item"></option>
|
||||
@@ -171,8 +171,43 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>调试结果</th>
|
||||
<td colspan="3" class="tpl-debug"><pre class="pre-scrollable">{{debugRet}}</pre></td>
|
||||
<td colspan="4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="4" style="text-align: center">
|
||||
调试结果
|
||||
<div class="pull-right">
|
||||
<button @click="copyToClipboard(debugRet)" class="btn btn-default btn-mini"
|
||||
title="拷贝调试结果"><i
|
||||
class="icon icon-copy"></i></button>
|
||||
<button @click="debugView ='JSON'" class="btn btn-default btn-mini" title="展示JSON"><i
|
||||
class="icon icon-code"></i></button>
|
||||
<button @click="debugView ='TABLE'" class="btn btn-default btn-mini" title="展示表格"><i
|
||||
class="icon icon-table"></i></button>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4" class="tpl-debug" style="padding: 0">
|
||||
|
||||
<pre class="pre-scrollable"
|
||||
v-if="debugView === 'JSON' || !(debugData.header && debugData.header.length)">{{debugRet}}<p
|
||||
v-if="!debugRet" class="text-muted">暂无调试信息</p></pre>
|
||||
<table v-if="debugView === 'TABLE' && (debugData.header && debugData.header.length)"
|
||||
style="width: 100%;overflow: auto;">
|
||||
<tr>
|
||||
<th v-for="item in debugData.header">{{item}}</th>
|
||||
</tr>
|
||||
<tr v-for="item in debugData.list">
|
||||
<td v-for="i in debugData.header">{{item[i]}}</td>
|
||||
</tr>
|
||||
<!--<tr>
|
||||
<td colspan="{{debugData.header.length}}" class="pull-right">
|
||||
{{debugData.total}}
|
||||
</td>
|
||||
</tr>-->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div v-show="editStatus!=1" style="text-align: center">
|
||||
@@ -272,7 +307,7 @@
|
||||
let {dbList} = plat
|
||||
|
||||
function beforeDrag(treeId, treeNodes) {
|
||||
for (var i=0,l=treeNodes.length; i<l; i++) {
|
||||
for (let i=0,l=treeNodes.length; i<l; i++) {
|
||||
if (treeNodes[i].drag === false) {
|
||||
return false;
|
||||
}
|
||||
@@ -305,7 +340,9 @@
|
||||
dbPlats: [],
|
||||
sysPlats: [{name: "工控系统"}],
|
||||
editStatus: 0,
|
||||
debugRet:"",
|
||||
debugRet: "",
|
||||
debugData: "",
|
||||
debugView: "TABLE", // 0:TABLE, 1:SQL, 3:JSON
|
||||
|
||||
// ZTree
|
||||
setting : {
|
||||
@@ -338,6 +375,7 @@
|
||||
})
|
||||
}
|
||||
this.debugRet = ""
|
||||
this.debugData = ""
|
||||
$(".tpl-content>textarea").attr("rows", this.countLines(row.content))
|
||||
$(".tpl-remark>textarea").attr("rows", this.countLines(row.remark, 2, 5))
|
||||
}
|
||||
@@ -420,9 +458,9 @@
|
||||
},
|
||||
debug: function () {
|
||||
qtask.qtaskDebug({task: this.row}).then(res => {
|
||||
this.debugRet = "";
|
||||
this.debugRet = res;
|
||||
red.showOk("查询成功")
|
||||
this.parseDebugRet(res)
|
||||
})
|
||||
},
|
||||
countLines: function (text='', min=3, max=15) {
|
||||
@@ -452,6 +490,51 @@
|
||||
}
|
||||
|
||||
this.row.para = JSON.stringify(_para)
|
||||
},
|
||||
parseDebugRet(_res) {
|
||||
let res = red.deepClone(_res)
|
||||
if (res.list && res.list.length > 0) {
|
||||
let header = []
|
||||
for (let key in res.list[0]) {
|
||||
header.push(key)
|
||||
}
|
||||
res['header'] = header
|
||||
|
||||
this.debugData = res
|
||||
return
|
||||
}
|
||||
|
||||
if (!res.total && res instanceof Object) {
|
||||
let header = []
|
||||
let _res = {}
|
||||
for (let key in res) {
|
||||
header.push(key)
|
||||
}
|
||||
// _res = {header: header, total: 1, list: [res]}
|
||||
res['header'] = header
|
||||
res['list'] = [res]
|
||||
this.debugData = res
|
||||
return
|
||||
}
|
||||
this.debugData = res
|
||||
},
|
||||
copyToClipboard(text) {
|
||||
if (!navigator.clipboard) {
|
||||
console.error("Clipboard API not supported.");
|
||||
return;
|
||||
}
|
||||
let _text = text
|
||||
if (typeof text !== 'string') {
|
||||
_text = JSON.stringify(text)
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(_text)
|
||||
.then(() => {
|
||||
red.showOk("调试结果已拷贝到剪贴板")
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Failed to copy text:", error);
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
|
||||
Reference in New Issue
Block a user