This commit is contained in:
2019-03-07 10:24:29 +08:00
parent 6c8c683c31
commit e057d613b9
215 changed files with 70917 additions and 118 deletions

237
root/qtask/list.html Normal file
View File

@@ -0,0 +1,237 @@
<row class="qtask-list">
<div class="col-md-12">
<h3 v-text="cfg.title"></h3>
</div>
<div class="col-md-12 ">
<!--<div class="col-md-2" style="padding-left: 0">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default" type="button">选择业务平台</button>
</span>
<select class="form-control">
<option>sdfa</option>
<option>sadf</option>
</select>
</div>
</div>-->
<div class="input-group pull-right">
<button @click="openDia({})" class="btn btn-primary" type="button"> 添加QTask</button>
<!--<button @click="openDia({})" class="btn btn-primary" type="button" style="margin-left: 5px"> 添加QTask</button>-->
</div>
</div>
<div class="col-md-12" style="padding-top: 10px;overflow:auto;">
<table class="table table-bordered table-hover" style="width: 100%">
<thead>
<tr>
<th v-for="field in cfg.cols" v-text="field.label"></th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="row in list.rows">
<td v-for="field in cfg.cols" v-title="row[field.col]" v-text="row[field.col]"></td>
<td v-text="dealStatus(row.status)"></td>
<td>
<a @click="openDia(row)" href="javascript:;">编辑</a>|
<a @click="row['status']=1;qsave(row);" v-show="row.status != 1" href="javascript:;">启用</a>
<a @click="row['status']=0;qsave(row);" v-show="row.status == 1" href="javascript:;">不启用</a> |
<a @click="row['status']=-1;comfirmDel(row);" href="javascript:;">删除</a>
</td>
</tr>
</tbody>
</table>
</div>
<!-- modal-tpl -->
<div class="col-md-12">
<!-- 对话框触发按钮 -->
<!-- 对话框HTML -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<h4 class="modal-title">QTask - [编辑]</h4>
</div>
<div class="modal-body">
<form class="form-horizontal">
<div class="form-group">
<label for="queryId" class="col-sm-2">查询ID</label>
<div class="col-md-6 col-sm-10">
<input v-model="row.queryId" :readonly="row.key" class="form-control" id="queryId" placeholder="请输入queryId">
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2">业务名称</label>
<div class="col-md-6 col-sm-10">
<input v-model="row.name" class="form-control" id="name" placeholder="请输入 业务名称">
</div>
</div>
<div class="form-group">
<label for="para" class="col-sm-2">任务类型</label>
<div class="col-md-6">
<select v-model="row.cate" class="form-control">
<option v-for="item in cfg.cates" :value="item" v-text="item"></option>
</select>
</div>
</div>
<div class="form-group">
<label for="name" class="col-sm-2">说明</label>
<div class="col-md-6 col-sm-10">
<input v-model="row.remark" class="form-control" id="remark" placeholder="请输入 说明">
</div>
</div>
<div class="form-group" style="margin-bottom: 0">
<label for="sql" class="col-md-2">SQL</label>
<div class="col-md-10">
<textarea v-model="row.sql" class="form-control layui-code" rows="10" id="sql" placeholder="请输入 SQL (支持jfinal-enjoy模板语法)" > </textarea>
</div>
</div>
<div class="form-group">
<label for="para" class="col-sm-2">默认查询参数</label>
<div class="col-sm-10">
<input v-model="row.para" class="form-control" id="para" placeholder="请输入 默认查询参数格式: {k:v}">
</div>
</div>
<div class="form-group">
<label for="para" class="col-sm-2">数据平台</label>
<div class="col-md-6">
<select v-model="row.platId" class="form-control">
<option></option>
<option v-for="item in dbPlats" :value="item.key" v-text="item.name"></option>
</select>
</div>
<div class="col-md-4">
<select v-model="row.catalog" class="form-control">
<option></option>
<option v-for="item in catalogs()" :value="item" v-text="item"></option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button @click="qsave(row)" type="button" class="btn btn-primary">确定</button>
</div>
</div>
</div>
</div>
<!-- 小对话框 -->
<!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mySmModal">小对话框</button>-->
<div class="modal fade" id="mySmModal">
<div class="modal-dialog modal-sm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">关闭</span></button>
<h4 class="modal-title">确认删除数据吗?</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button @click="qsave(row);$('#mySmModal').modal('hide');" type="button" class="btn btn-primary">确定</button>
</div>
</div>
</div>
</div>
</row>
<script src="http://www.1216.top/res/layui/layui.js"></script>
<script>
var vm = new Vue({
el: ".qtask-list",
data: {
sysPlat: red.getData("sysPlat"),
cfg: {
title: "QTask 管理",
cols: [
{col: "queryId", label: "查询id",},
{col: "name", label: "业务名称",},
{col: "remark", label: "说明"}
],
filters: [],
cates: ["find","update"]
},
list: {rows:[], total: 0},
row: {},
dbPlats: [],
sysPlats: [{name: "工控系统"}]
},
watch: {
},
methods: {
loadList: function () {
var para = {
pn:1,
ps:120,
doc:"qtask",
clazz:"net.tccn.common.qtask.Qtask",
filter: JSON.stringify([{col:"status",type:"!=",value:-1},{col:"sysPlatId",type:"==",value:this.sysPlat._key}])
};
red.getJSON("/meta/find", para, function (json) {
vm.list = json;
});
},
openDia: function (row) {
vm.row = row;
$('#myModal').modal({moveable: true});
if (this.dbPlats.length == 0) {
var para = {
doc:"db_plat",
clazz:"net.tccn.common.qtask.DbPlat",
};
red.getJSON("/meta/find", para, function (json) {
vm.dbPlats = json.rows;
});
}
},
qsave: function (row) {
row = row || vm.row;
if (!row["sysPlatId"]) {//设置平台id
row["sysPlatId"] = red.getPlatId();
}
red.post("/qtask/qsave", {qtask: JSON.stringify(row)}, function (json) {
vm.row = {};
$('#myModal').modal('hide');
vm.loadList();
red.showMsg();
});
},
dealStatus: function (n) {
var arr = {"0":"未启用", "1":"启用", "-1":"删除",}
return arr[n+""] || "";
},
comfirmDel: function (row) {
vm.row = row;
$('#mySmModal').modal({});
},
abc: function () {
$(".container-fixed").load("abc.html");
},
catalogs: function () {
var dbPlats = this.dbPlats;
for (i in dbPlats) {
if (dbPlats[i].key == this.row.platId) {
return dbPlats[i]["catalogs"]
}
}
}
},
mounted: function () {
this.loadList();
setTimeout(function () {
layui.use('code', function(){ //加载code模块
layui.code(/*{skin: 'notepad'}*/); //引用code方法
});
}, 500)
}
});
</script>