提交 41a82f5a 编写于 作者: doc_wei's avatar doc_wei

集成报表模块

上级 9e4eac96
......@@ -58,6 +58,7 @@
<module>boss</module>
<module>member</module>
<module>shop</module>
<module>report</module>
</modules>
<properties>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>skyeye-web</artifactId>
<groupId>com.skyeye.web</groupId>
<version>1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>report</artifactId>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</project>
\ No newline at end of file
body {
width: 100%;
height: 100%;
position: absolute;
margin: 0px;
}
.skyeyeScaleBox {
position: fixed;
left: 0;
top: 60px;
_position: absolute;
overflow: hidden;
webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
.report-content {
position: fixed;
left: 44px;
top: 104px;
_position: absolute;
z-index: 990;
overflow: auto;
width: calc(100% - 420px);
height: calc(100% - 130px);
border: 1px solid RGB(130, 214, 195);
webkit-user-select: none;
-moz-user-select: none;
user-select: none;
overflow-x: hidden;
}
.skyeyeScaleRuler_h,
.skyeyeScaleRuler_v {
position: absolute;
left: 0;
top: 0;
overflow: hidden;
z-index: 999;
}
.skyeyeScaleRuler_h {
width: 100%;
height: 18px;
background-blend-mode: lighten;
}
.skyeyeScaleRuler_v {
width: 18px;
height: 100%;
background-blend-mode: lighten;
}
.skyeyeScaleRuler_v .n,
.skyeyeScaleRuler_h .n {
position: absolute;
font: 10px/1 Arial, sans-serif;
color: #333;
cursor: default;
}
.skyeyeScaleRuler_v .n {
width: 8px;
left: 3px;
word-wrap: break-word;
}
.skyeyeScaleRuler_h .n {
top: 1px;
}
.hd-main {
height: 60px;
background: #fff;
z-index: 15;
border-bottom: #b3b3b3 1px solid;
box-shadow: 0 0 5px #333
}
.hd-main {
padding: 0 5px;
height: 60px;
min-width: 800px;
background: #252525;
border-bottom: 0
}
.hd-main .pulldown {
position: absolute;
cursor: default;
display: none;
top: 60px;
z-index: 9999;
width: 450px;
max-height: 270px;
overflow-y: auto;
}
.hd-main .pulldown .child-menu {
background: #F6F6F9;
color: #333;
text-align: left;
border-radius: 3px;
border: rgb(175, 175, 175) 1px solid;
border-width: 0 1px 1px 1px;
box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
position: relative;
z-index: 1
}
.hd-main .navs {
padding: 0 0 0px 25px;
height: 100%;
float: left;
}
.hd-main .navs a:hover,
.hd-main .navs a:active {
text-decoration: none;
}
.hd-main .navs .def-nav,
.hd-main .navs .pulldown-nav,
.hd-main .navs .separate {
display: block;
float: left;
height: 100%;
color: white;
text-align: center;
width: 90px;
font-size: 14px;
}
.hd-main .navs .separate {
width: 2px;
}
.hd-main .navs .app-url .child-menu {
display: flow-root;
}
.hd-main .navs .app-url .child-menu a,
.hd-main .navs .app-url .child-menu a:hover {
color: #333;
}
.hd-main .navs .app-url .li {
cursor: pointer;
padding-top: 4px;
border-radius: 3px;
display: block;
float: left;
text-align: center;
margin: 8px 0px;
}
.hd-main .navs .app-url .li:hover {
background-color: #e0e1e5;
}
.hd-main .navs .def-nav .icon,
.hd-main .navs .app-url .li .icon {
margin: 0 auto;
width: 35px;
height: 35px;
display: block;
font-size: 21px;
line-height: 35px;
}
.hd-main .navs .app-url .li .image{
margin: 0 auto;
width: 90px;
height: 60px;
display: block;
font-size: 25px;
line-height: 40px;
}
.hd-main .navs .def-nav .icon,
.hd-main .navs .app-url .li:hover .icon {}
.hd-main .navs .app-url .li .text {
height: 30px;
display: block;
font: 14px/30px "Microsoft YaHei", "Microsoft JhengHei";
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
white-space: nowrap;
}
.hd-main .navs .pulldown-nav {
position: relative
}
.hd-main .navs .pulldown-nav em {
position: absolute;
display: block;
left: 69px;
top: 30px;
font-size: 0;
background-position: -89px -45px
}
.arrow-bottom {
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 8px solid white;
font-size: 0;
line-height: 0;
}
.arrow-top {
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 8px solid white;
font-size: 0;
line-height: 0;
}
.logo-title{
float: left;
line-height: 60px;
color: cornflowerblue;
font-size: 16px;
font-family: cursive;
}
.kuang {
box-sizing: border-box;
border: 1px solid darkgray;
width: 450px;
height: 300px;
position: absolute;
top: 0px;
background-color: white;
z-index: 100;
}
.kuang .dian {
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
background: #0f0;
}
.left_top {
left: -5px;
top: -5px;
cursor: nw-resize;
}
.right_top {
right: -5px;
top: -5px;
cursor: ne-resize;
}
.left_bottom {
left: -5px;
bottom: -5px;
cursor: ne-resize;
}
.right_bottom {
right: -5px;
bottom: -5px;
cursor: nw-resize;
}
.top {
top: -5px;
left: 50%;
transform: translateX(-50%);
cursor: n-resize;
}
.bottom {
bottom: -5px;
left: 50%;
transform: translateX(-50%);
cursor: n-resize;
}
.left {
left: -5px;
top: 50%;
transform: translateY(-50%);
cursor: e-resize;
}
.right {
right: -5px;
top: 50%;
transform: translateY(-50%);
cursor: e-resize;
}
.echarts-box{
width: 100%;
height: 100%;
}
.word-box{
width: 100%;
height: 100%;
position: absolute;
}
.form-box{
height: calc(100% - 78px);
position: fixed;
width: 350px;
top: 78px;
right: 0px;
background-color: white;
z-index: 300;
border-left: 1px solid gainsboro;
}
.layui-form-label{
width: 100px !important;
}
.layui-input-block {
margin-left: 115px !important;
}
/******************reportContent的八个角start**********************/
.cape {
position: absolute;
width: 4px;
height: 4px;
background: RGB(131, 217, 179);
}
.cape_left1 {
left: 40px;
top: 100px;
height: 30px;
}
.cape_left1_top {
left: 40px;
top: 100px;
width: 30px;
}
.cape_right1 {
right: 372px;
top: 100px;
height: 30px;
}
.cape_right1_top {
right: 372px;
top: 100px;
width: 30px;
}
.cape_left2 {
bottom: 22px;
left: 40px;
height: 30px;
}
.cape_left2_bottom {
bottom: 22px;
left: 40px;
width: 30px;
}
.cape_right2 {
right: 372px;
bottom: 22px;
height: 30px;
}
.cape_right2_bottom {
right: 372px;
bottom: 22px;
width: 30px;
}
/******************reportContent的八个角end**********************/
.layui-colorpicker-trigger-bgcolor{
height: 19px;
}
.layui-colla-item{
height: auto;
width: 100%;
display: table;
}
.layui-colla-title{
height: 35px;
line-height: 35px;
padding: 0 15px 0 15px;
}
.layui-colla-title .f-icon{
position: absolute;
line-height: 35px;
top: 13px;
}
.layui-colla-title .arrow-top{
border-bottom: 8px solid darkgray;
}
.layui-colla-title .arrow-bottom{
border-top: 8px solid darkgray;
}
.layui-colla-title span{
margin-left: 25px;
}
.layui-colla-content{
height: auto;
position: relative;
padding: 5px 0px;
}
.save-btn{
position: absolute;
right: 0px;
height: 60px !important;
}
.active{
border: 1px solid #0f0 !important;
z-index: 200 !important;
}
@keyframes masked-animation {
0% {
background-position: 0 0;
}
100% {
background-position: -100% 0;
}
}
layui.define(["jquery"], function(exports) {
var jQuery = layui.jquery;
//监听div大小变化
(function ($, h, c) {
var a = $([]),
e = $.resize = $.extend($.resize, {}),
i,
k = "setTimeout",
j = "resize",
d = j + "-special-event",
b = "delay",
f = "throttleWindow";
e[b] = 250;
e[f] = true;
$.event.special[j] = {
setup: function () {
if (!e[f] && this[k]) {
return false;
}
var l = $(this);
a = a.add(l);
$.data(this, d, {
w: l.width(),
h: l.height()
});
if (a.length === 1) {
g();
}
},
teardown: function () {
if (!e[f] && this[k]) {
return false;
}
var l = $(this);
a = a.not(l);
l.removeData(d);
if (!a.length) {
clearTimeout(i);
}
},
add: function (l) {
if (!e[f] && this[k]) {
return false;
}
var n;
function m(s, o, p) {
var q = $(this),
r = $.data(this, d);
r.w = o !== c ? o : q.width();
r.h = p !== c ? p : q.height();
n.apply(this, arguments);
}
if ($.isFunction(l)) {
n = l;
return m;
} else {
n = l.handler;
l.handler = m;
}
}
};
function g() {
i = h[k](function () {
a.each(function () {
var n = $(this),
m = n.width(),
l = n.height(),
o = $.data(this, d);
if (m !== o.w || l !== o.h) {
n.trigger(j, [o.w = m, o.h = l]);
}
});
g();
},
e[b]);
}
})(jQuery, this);
exports('loadboxresize', null);
});
\ No newline at end of file
var skyeyeReportUtil = {
/**
* 获取报表编辑器支持的类型
*
* @param showDomId 展示的bom结构id
* @param template 模板
* @param callBack 回调函数
*/
getReportEditorType: function(showDomId, template, callBack){
$.getJSON("../../assets/report/json/skyeyeEditor.json", function (data) {
var rows = new Array();
$.each(data, function (key, value){
rows.push({
id: key,
name: value.name
});
});
if(!isNull(showDomId)){
$("#" + showDomId).html(getDataUseHandlebars(template, {rows: rows}));
}
if(typeof(callBack) == "function") {
callBack(rows);
}
});
}
};
{
"1": {
"key": "radio",
"name": "单选框",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='radio' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block winui-radio'>{{{showValueTemplate}}}</div></div>",
"js": "$('input:radio[name={{boxId}}{{indexNumber}}][value={{context}}]').attr('checked', true);form.on('radio({{boxId}}{{indexNumber}})', function(data){var value = data.value; dataValueChange(value, $(this));});",
"showValueTemplate": "{{#each rows}}<input type='radio' name='{{boxId}}{{indexNumber}}' title='{{name}}' rowId='{{id}}' value='{{id}}' lay-filter='{{boxId}}{{indexNumber}}' />{{/each}}"
},
"2": {
"key": "input",
"name": "输入框",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='input' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'><input type='text' id='input{{boxId}}{{indexNumber}}' name='input{{boxId}}{{indexNumber}}' class='layui-input' value='{{context}}'/></div></div>",
"js": "$('#input{{boxId}}{{indexNumber}}').on('input',function(e){var value = e.delegateTarget.value; dataValueChange(value, $(this));});",
"showValueTemplate": ""
},
"3": {
"key": "inputColor",
"name": "颜色选择器",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='inputColor' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'><div class='layui-input-inline'><input type='text' value='{{context}}' class='layui-input' id='{{boxId}}{{indexNumber}}-color' /></div><div class='layui-inline'><div id='{{boxId}}{{indexNumber}}-colorBtn'></div></div></div></div>",
"js": "var colorpicker = layui.colorpicker; colorpicker.render({elem: '#{{boxId}}{{indexNumber}}-colorBtn', color: '{{context}}', alpha: true, format: 'rgb', change: function(color){$('#{{boxId}}{{indexNumber}}-color').val(color); dataValueChange(color, $('#{{boxId}}{{indexNumber}}-colorBtn'));}, done: function(color){$('#{{boxId}}{{indexNumber}}-color').val(color); dataValueChange(color, $('#{{boxId}}{{indexNumber}}-colorBtn'));}});",
"showValueTemplate": ""
},
"4": {
"key": "numberInput",
"name": "数字输入框",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='numberInput' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'><input type='number' id='numberInput{{boxId}}{{indexNumber}}' name='numberInput{{boxId}}{{indexNumber}}' class='layui-input' value='{{context}}'/></div></div>",
"js": "$('#numberInput{{boxId}}{{indexNumber}}').on('input',function(e){var value = e.delegateTarget.value; dataValueChange(value, $(this));});",
"showValueTemplate": ""
},
"5": {
"key": "inputMoreColor",
"name": "多行颜色选择器",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='inputMoreColor' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'>{{#each context}}<div class='layui-input-inline'><input type='text' value='{{this}}' class='layui-input customer-attr' id='{{boxId}}{{indexNumber}}-color{{@index}}' /></div><div class='layui-inline'><div id='{{boxId}}{{indexNumber}}-colorBtn{{@index}}'></div></div>{{/each}}</div></div>",
"js": "var colorpicker = layui.colorpicker; {{#each context}}colorpicker.render({elem: '#{{boxId}}{{indexNumber}}-colorBtn{{@index}}', color: '{{this}}', alpha: true, format: 'rgb', change: function(color){$('#{{boxId}}{{indexNumber}}-color{{@index}}').val(color); dataValueChange(color, $('#{{boxId}}{{indexNumber}}-colorBtn{{@index}}'));}, done: function(color){$('#{{boxId}}{{indexNumber}}-color{{@index}}').val(color); dataValueChange(color, $('#{{boxId}}{{indexNumber}}-colorBtn{{@index}}'));}});{{/each}}",
"showValueTemplate": ""
},
"9": {
"key": "dynamicData",
"name": "动态数据",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='dynamicData' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'><select lay-search id='dynamicData{{boxId}}{{indexNumber}}' name='dynamicData{{boxId}}{{indexNumber}}' lay-filter='dynamicData{{boxId}}{{indexNumber}}'>{{{showValueTemplate}}}</select></div></div>",
"js": "$('#dynamicData{{boxId}}{{indexNumber}}').val('{{pointValue}}');form.on('select(dynamicData{{boxId}}{{indexNumber}})', function(data) { var val = data.value; dataValueChange(val, $(this)); });",
"showValueTemplate": "<option value=''>请选择</option>{{#each rows}}<option value='{{key}}'>{{key}}--{{name}}</option>{{/each}}"
},
"98": {
"key": "readOnlyinput",
"name": "只读的输入框",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='readOnlyinput' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'><input type='text' id='input{{boxId}}{{indexNumber}}' name='input{{boxId}}{{indexNumber}}' class='layui-input' value='{{context}}' readonly='readonly'/></div></div>",
"js": "$('#input{{boxId}}{{indexNumber}}').on('input',function(e){var value = e.delegateTarget.value; dataValueChange(value, $(this));});",
"showValueTemplate": ""
},
"99": {
"key": "dataBaseFrom",
"name": "数据源选择",
"html": "<div class='layui-form-item {{defaultWidth}}' controlType='dataBaseFrom' modelKey='{{modelKey}}' boxId='{{boxId}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block'><input type='text' id='input{{boxId}}{{indexNumber}}' name='input{{boxId}}{{indexNumber}}' class='layui-input' value='{{context.name}}' readonly='readonly'/><i class='fa fa-plus-circle input-icon' id='choose{{boxId}}{{indexNumber}}'></i></div></div>",
"js": "$('body').on('click', '#choose{{boxId}}{{indexNumber}}', function(e){_openNewWindows({url:'../../tpl/reportDataFrom/reportDataFromChooseList.html', title:'选择数据源',pageId:'dataBaseFrom',area:['90vw','90vh'],callBack:function(refreshCode){if(refreshCode=='0'){$('#input{{boxId}}{{indexNumber}}').val(dataBaseMation.name); dataValueChange(dataBaseMation, $('#input{{boxId}}{{indexNumber}}')); }else if(refreshCode=='-9999'){winui.window.msg(systemLanguage['com.skyeye.operationFailed'][languageType],{icon:2,time:2000});}}});});",
"showValueTemplate": ""
},
"100": {
"key": "showDetail",
"name": "详情展示",
"html": "<div class='layui-form-item {{defaultWidth}}'><label class='layui-form-label'><i class='layui-icon layui-icon-tips' lay-tips='{{desc}}'></i>{{labelContent}}:</label><div class='layui-input-block ver-center'>{{{context}}}</div></div>",
"js": "",
"showValueTemplate": ""
}
}
\ No newline at end of file
[
{
"id": "00000000000000000000000000000000",
"name": "Echarts模型分类"
},
{
"id": "11111111111111111111111111111111",
"name": "文字模型分类"
},
{
"id": "22222222222222222222222222222222",
"name": "图片模型分类"
},
{
"id": "33333333333333333333333333333333",
"name": "脚本模型分类"
},
{
"id": "44444444444444444444444444444444",
"name": "表格模型分类"
}
]
\ No newline at end of file
var rowId;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window',
echarts: '../echarts/echarts',
echartsTheme: '../echarts/echartsTheme'
}).define(['window', 'jquery', 'winui', 'form', 'echarts', 'colorpicker'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form;
rowId = GetUrlParam("rowId");
var echartsModel = {};
// 获取echarts模型配置
AjaxPostUtil.request({url:reportBasePath + "reportimporthistory003", params: {}, type:'json', method: "GET", callback:function(json){
if(json.returnCode == 0){
echartsModel = json.rows;
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}, async: false});
var bgImages = {};
// 获取所有背景图片列表信息
AjaxPostUtil.request({url:reportBasePath + "reportbgimage004", params: {}, type:'json', method: "GET", callback:function(json){
if(json.returnCode == 0){
bgImages = json.rows;
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}, async: false});
var wordModel = {};
// 获取已经发布的文字模型
AjaxPostUtil.request({url:reportBasePath + "reportwordmodel007", params: {state: 2}, type:'json', method: "GET", callback:function(json){
if(json.returnCode == 0){
wordModel = json.rows;
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}, async: false});
var initData = {};
// 获取初始化数据
AjaxPostUtil.request({url:reportBasePath + "reportpage006", params: {rowId: rowId}, type:'json', method: "GET", callback:function(json){
if(json.returnCode == 0){
initData = JSON.parse(getContentStr(json.bean.content));
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}, async: false});
function getContentStr(str){
if(!isNull(str)){
str = str.replace(/%/g, '%25');
return decodeURIComponent(str);
}
return "{}";
}
$.skyeyeReportDesigner({
mouseLineColor: "blue",
initData: initData,
headerMenuJson: [{
"icon": " fa fa-area-chart fa-fw",
"title": "文字",
"id": "wordModel",
"children": wordModel
}, {
"icon": " fa fa-area-chart fa-fw",
"title": "图表",
"id": "echartsModel",
"children": echartsModel
}, {
"icon": " fa fa-table fa-fw",
"title": "表格",
"children": [{
"icon": " fa fa-table fa-fw",
"title": "简单表格",
}, {
"icon": " fa fa-list-alt fa-fw",
"title": "复杂表格",
}]
}, {
"icon": " fa fa-area-chart fa-fw",
"title": "背景图",
"id": "bgImages",
"children": bgImages
}, {
"icon": " fa fa-fw fa-save",
"title": "保存",
"class": "save-btn",
"id": "save"
}]
});
form.render();
exports('pageReportDesign', {});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'fileUpload'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
// 初始化上传
$("#imagePath").upload({
"action": reqBasePath + "common003",
"data-num": "1",
"data-type": "PNG,JPG,jpeg,gif",
"uploadType": 18,
"function": function (_this, data) {
show("#imagePath", data);
}
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
title: $("#title").val(),
imagePath: ""
};
params.imagePath = $("#imagePath").find("input[type='hidden'][name='upload']").attr("oldurl");
if(isNull(params.imagePath)){
winui.window.msg('请上传图片', {icon: 2,time: 2000});
return false;
}
AjaxPostUtil.request({url:reportBasePath + "reportbgimage002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window',
}).define(['window', 'table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form;
authBtn('1625280805000');
//初始化数据
showGrid({
id: "showForm",
url: reportBasePath + "reportbgimage001",
params: {},
pagination: true,
pagesize: 18,
template: getFileContent('tpl/reportBgImage/bgpic-item.tpl'),
ajaxSendLoadBefore: function(hdb){
hdb.registerHelper("compare1", function(v1, options){
return fileBasePath + v1;
});
},
options: {'click .del':function(index, row){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url:reportBasePath + "reportbgimage003", params:{rowId: row.id}, type:'json', method: "DELETE", callback:function(json){
if(json.returnCode == 0){
winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}, 'click .sel':function(index, row){
layer.open({
type:1,
title:false,
closeBtn:0,
offset:["5vh", "5vw"],
area:['90vw', '90vh'],
shadeClose:true,
content:'<img src="' + fileBasePath + row.imagePath + '" style="max-width:100%;">',
scrollbar:false
});
}
},
ajaxSendAfter:function(json){
authBtn('1625280815182');
matchingLanguage();
}
});
// 添加
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/reportBgImage/reportBgImageAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "reportBgImageAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
refreshGrid("showForm", {params:{}});
}
exports('reportBgImageList', {});
});
// 表格的序号
var rowNum = 1;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
// 数据源信息
var dataBaseFrom = new Array();
// 连接池信息
var poolList = new Array();
var usetableTemplate = $("#usetableTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
// 加载数据源类型
showGrid({
id: "dataType",
url: reportBasePath + "reportcommon006",
params: {},
pagination: false,
template: selOption,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter: function(data){
dataBaseFrom = [].concat(data.rows);
form.render('select');
}
});
// 加载连接池类型
showGrid({
id: "poolClass",
url: reportBasePath + "reportcommon007",
params: {},
pagination: false,
template: selOption,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter: function(data){
poolList = [].concat(data.rows);
form.render('select');
}
});
// 连接池数据变化
form.on('select(poolClass)', function(data) {
var val = data.value;
var options = getInPoingArr(poolList, "id", val, "options");
options = JSON.parse(options);
$("#useTable").html("");
rowNum = 1;
$.each(options, function(key, value){
addRow();
$("#configKey" + (rowNum - 1)).val(key);
$("#configValue" + (rowNum - 1)).val(value);
});
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var tableData = new Array();
var rowTr = $("#useTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
configKey: $("#configKey" + rowNum).val(),
configValue: $("#configValue" + rowNum).val(),
remark: $("#remark" + rowNum).val()
};
tableData.push(row);
});
var params = {
name: $("#name").val(),
jdbcUrl: $("#jdbcUrl").val(),
user: $("#user").val(),
password: $("#password").val(),
dataType: $("#dataType").val(),
poolClass: $("#poolClass").val(),
comment: $("#comment").val(),
options: JSON.stringify(tableData),
};
AjaxPostUtil.request({url:reportBasePath + "reportdatabase002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
// 连接测试
form.on('submit(testConnection)', function (data) {
if (winui.verifyForm(data.elem)) {
var driverClass = getInPoingArr(dataBaseFrom, "id", $("#dataType").val(), "driverClass");
var params = {
driverClass: driverClass,
url: $("#jdbcUrl").val(),
user: $("#user").val(),
pass: $("#password").val()
};
AjaxPostUtil.request({url:reportBasePath + "reportcommon001", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
winui.window.msg('连接成功', {icon: 1,time: 2000});
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
//新增行
$("body").on("click", "#addRow", function() {
addRow();
});
//删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
});
//新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
configKey: "configKey" + rowNum.toString(), // 配置项id
configValue: "configValue" + rowNum.toString(), // 配置值id
remark: "remark" + rowNum.toString() // 备注id
};
$("#useTable").append(getDataUseHandlebars(usetableTemplate, par));
form.render();
rowNum++;
}
//删除行
function deleteRow() {
var checkRow = $("#useTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
// 表格的序号
var rowNum = 1;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
// 数据源信息
var dataBaseFrom = new Array();
// 连接池信息
var poolList = new Array();
var usetableTemplate = $("#usetableTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
showGrid({
id: "showForm",
url: reportBasePath + "reportdatabase005",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showBaseTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(j){
// 加载数据源类型
showGrid({
id: "dataType",
url: reportBasePath + "reportcommon006",
params: {},
pagination: false,
template: selOption,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter: function(data){
$("#dataType").val(j.bean.dataType);
dataBaseFrom = [].concat(data.rows);
form.render('select');
}
});
// 加载连接池类型
showGrid({
id: "poolClass",
url: reportBasePath + "reportcommon007",
params: {},
pagination: false,
template: selOption,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter: function(data){
$("#poolClass").val(j.bean.poolClass);
poolList = [].concat(data.rows);
form.render('select');
}
});
var options = JSON.parse(j.bean.options);
// 加载配置选项
$.each(options, function(i, item){
addRow();
$("#configKey" + (rowNum - 1)).val(item.configKey);
$("#configValue" + (rowNum - 1)).val(item.configValue);
$("#remark" + (rowNum - 1)).val(item.remark);
});
// 连接池数据变化
form.on('select(poolClass)', function(data) {
var val = data.value;
var options = getInPoingArr(poolList, "id", val, "options");
options = JSON.parse(options);
$("#useTable").html("");
rowNum = 1;
$.each(options, function(key, value){
addRow();
$("#configKey" + (rowNum - 1)).val(key);
$("#configValue" + (rowNum - 1)).val(value);
});
});
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var tableData = new Array();
var rowTr = $("#useTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
configKey: $("#configKey" + rowNum).val(),
configValue: $("#configValue" + rowNum).val(),
remark: $("#remark" + rowNum).val()
};
tableData.push(row);
});
var params = {
name: $("#name").val(),
jdbcUrl: $("#jdbcUrl").val(),
user: $("#user").val(),
password: $("#password").val(),
dataType: $("#dataType").val(),
poolClass: $("#poolClass").val(),
comment: $("#comment").val(),
options: JSON.stringify(tableData),
id: parent.rowId
};
AjaxPostUtil.request({url:reportBasePath + "reportdatabase004", params: params, type:'json', method: "PUT", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
}
});
// 连接测试
form.on('submit(testConnection)', function (data) {
if (winui.verifyForm(data.elem)) {
var driverClass = getInPoingArr(dataBaseFrom, "id", $("#dataType").val(), "driverClass");
var params = {
driverClass: driverClass,
url: $("#jdbcUrl").val(),
user: $("#user").val(),
pass: $("#password").val()
};
AjaxPostUtil.request({url:reportBasePath + "reportcommon001", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
winui.window.msg('连接成功', {icon: 1,time: 2000});
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
//新增行
$("body").on("click", "#addRow", function() {
addRow();
});
//删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
});
//新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
configKey: "configKey" + rowNum.toString(), // 配置项id
configValue: "configValue" + rowNum.toString(), // 配置值id
remark: "remark" + rowNum.toString() // 备注id
};
$("#useTable").append(getDataUseHandlebars(usetableTemplate, par));
form.render();
rowNum++;
}
//删除行
function deleteRow() {
var checkRow = $("#useTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
authBtn('1622288190650');
// 数据源列表
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reportBasePath + 'reportdatabase001',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'name', title: '数据库名称', align: 'left', width: 150},
{ field: 'jdbcUrl', title: '连接串', align: 'left', width: 150 },
{ field: 'user', title: '用户名', align: 'left', width: 100 },
{ field: 'password', title: '密码', align: 'left', width: 100 },
{ field: 'dataType', title: '数据源', align: 'left', width: 120 },
{ field: 'poolClass', title: '连接池', align: 'left', width: 120 },
{ field: 'comment', title: '备注', align: 'left', width: 180 },
{ field: 'createName', title: '创建人', align: 'left', width: 100 },
{ field: 'createTime', title: '创建时间', align: 'center', width: 140 },
{ field: 'lastUpdateName', title: '最后修改人', align: 'left', width: 100 },
{ field: 'lastUpdateTime', title: '最后修改时间', align: 'center', width: 140},
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 200, toolbar: '#tableBar'}
]],
done: function(){
matchingLanguage();
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'delet') { //删除
delet(data);
}
});
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
refreshloadTable();
}
return false;
});
//添加
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/reportDataBase/reportDataBaseAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "reportDataBaseAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
// 删除
function delet(data){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url:reportBasePath + "reportdatabase003", params:{id: data.id}, type:'json', method: "DELETE", callback:function(json){
if(json.returnCode == 0){
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1,time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
// 编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/reportDataBase/reportDataBaseEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
pageId: "reportDataBaseEdit",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}
});
}
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function refreshloadTable(){
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()});
}
function getTableParams(){
return {
name: $("#name").val()
};
}
exports('reportDataBaseList', {});
});
// 表格的序号
var rowNum = 1;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'codemirror', 'xml', 'sql'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
var radioTemplate = '{{#each rows}}<input type="radio" name="dataFromType" value="{{id}}" title="{{name}}" lay-filter="dataFromType" {{checked}} />{{/each}}';
var selOption = getFileContent('tpl/template/select-option.tpl');
var dataFromTypeList = [];
var xmlContent, jsonContent, sqlContent, restRequestBodyContent;
// 数据源类型列表
showGrid({
id: "dataFromTypeBox",
url: reportBasePath + "reportcommon008",
params: {},
pagination: false,
template: radioTemplate,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
dataFromTypeList = [].concat(json.rows);
$.each(dataFromTypeList, function (i, item){
if(item.checked){
initDataFromBoxContent(item.id);
form.render('radio');
}
});
}
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
name: $("#name").val(),
remark: $("#remark").val(),
type: $("input[name='dataFromType']:checked").val(),
analysisData: getAnalysisData()
};
if(JSON.parse(params.analysisData).length == 0){
winui.window.msg('请进行字段解析操作。', {icon: 2,time: 2000});
return false;
}
var otherData = getDataByType();
if((isNull(otherData.xmlContent) && params.type == 1)
|| (isNull(otherData.jsonContent) && params.type == 2)
|| (isNull(otherData.sqlContent) && params.type == 4)){
winui.window.msg('必填项不能为空', {icon: 2,time: 2000});
return false;
}
params = $.extend(true, params, otherData);
AjaxPostUtil.request({url:reportBasePath + "reportdatafrom002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
function getDataByType(){
var dataFromType = $("input[name='dataFromType']:checked").val();
if(dataFromType == 1){
// XML数据源
return getXMLData();
} else if(dataFromType == 2){
// JSON数据源
return getJSONData();
} else if(dataFromType == 3){
// Rest接口数据源
return getRESTData();
} else if(dataFromType == 4){
// SQL数据源
return getSQLData();
}
return {};
}
function getXMLData(){
return {
xmlContent: xmlContent.getValue()
};
}
function getJSONData(){
return {
jsonContent: jsonContent.getValue()
};
}
function getRESTData(){
return {
restUrl: $("#restUrl").val(),
method: $("#restMethod").val(),
header: getRestRequestHeaderData(),
requestBody: restRequestBodyContent.getValue()
};
}
function getSQLData(){
return {
sqlDataBaseId: $("#sqlDataBase").val(),
sqlContent: sqlContent.getValue()
};
}
function getAnalysisData(){
var tableData = new Array();
var rowTr = $("#analysisTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
key: $("#key" + rowNum).val(),
title: $("#title" + rowNum).val(),
dataType: $("#dataType" + rowNum).val(),
dataLength: $("#dataLength" + rowNum).val(),
dataPrecision: $("#dataPrecision" + rowNum).val(),
remark: $("#remark" + rowNum).val()
};
tableData.push(row);
});
return JSON.stringify(tableData);
}
function getRestRequestHeaderData(){
var tableData = new Array();
var rowTr = $("#restHeaderTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
headerKey: $("#headerKey" + rowNum).val(),
headerValue: $("#headerValue" + rowNum).val(),
headerDescription: $("#headerDescription" + rowNum).val()
};
tableData.push(row);
});
return JSON.stringify(tableData);
}
form.on('radio(dataFromType)', function (data) {
var val = data.value;
initDataFromBoxContent(val);
});
function initDataFromBoxContent(val){
var staticTplPath = getInPoingArr(dataFromTypeList, "id", val, "staticTplPath");
var html = getFileContent(staticTplPath);
$("#dataBox").html(html);
// 加载字段解析信息
$("#analysisHeader").html($("#analysisHeaderTemplate").html());
$("#analysisTable").html("");
initEvent(val);
form.render();
}
function initEvent(dataFromType){
// 获取公共的配置信息
var commonOptions = getCommonCodeMirrorOptions();
if(dataFromType == 1){
// XML数据源
xmlContent = CodeMirror.fromTextArea(document.getElementById("xmlData"), $.extend(true, commonOptions, {
mode: "xml",
theme: "default"
}));
} else if(dataFromType == 2){
// JSON数据源
jsonContent = CodeMirror.fromTextArea(document.getElementById("jsonData"), $.extend(true, commonOptions, {
mode: "xml",
theme: "default"
}));
} else if(dataFromType == 3){
// Rest接口数据源
restRequestBodyContent = CodeMirror.fromTextArea(document.getElementById("requestBody"), $.extend(true, commonOptions, {
mode: "xml",
theme: "default"
}));
} else if(dataFromType == 4){
// SQL数据源
showGrid({
id: "sqlDataBase",
url: reportBasePath + "reportdatabase006",
params: {},
pagination: false,
template: selOption,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
}
});
sqlContent = CodeMirror.fromTextArea(document.getElementById("sqlData"), $.extend(true, commonOptions, {
mode: "text/x-sql",
theme: "default"
}));
}
}
function getCommonCodeMirrorOptions(){
return {
mode: "xml", // 模式
theme: "eclipse", // CSS样式选择
indentUnit: 4, // 缩进单位,默认2
smartIndent: true, // 是否智能缩进
tabSize: 4, // Tab缩进,默认4
readOnly: false, // 是否只读,默认false
showCursorWhenSelecting: true,
lineNumbers: true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
extraKeys:{
"F7": function autoFormat(editor) {
// 代码格式化
var totalLines = editor.lineCount();
editor.autoFormatRange({line:0, ch:0}, {line:totalLines});
}
}
};
}
/**
* 字段解析
*/
$("body").on("click", "#fieldResolution", function(e) {
var dataFromType = $("input[name='dataFromType']:checked").val();
var url = "";
var params = getResolutionInputParams(dataFromType, e);
if(params == null){
return false;
}
if(dataFromType == 1){
// XML数据源
url = "reportcommon002";
} else if(dataFromType == 2){
// JSON数据源
url = "reportcommon003";
} else if(dataFromType == 3){
// Rest接口数据源
url = "reportcommon005";
} else if(dataFromType == 4){
// SQL数据源
url = "reportcommon004";
}
AjaxPostUtil.request({url:reportBasePath + url, params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
var data = getDataByDataFromType(dataFromType, json);
loadFieldResolution(dataFromType, data);
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
/**
* 字段解析时根据不同的数据源类型获取入参
*
* @param dataFromType 数据源类型
* @returns {boolean}
*/
function getResolutionInputParams(dataFromType, e){
var params = {};
if(dataFromType == 1){
// XML数据源
params = {
xmlText: xmlContent.getValue()
};
} else if(dataFromType == 2){
// JSON数据源
params = {
jsonText: jsonContent.getValue()
};
} else if(dataFromType == 3){
// Rest接口数据源
if(isNull($("#restUrl").val())){
winui.window.msg('请填写url', {icon: 2,time: 2000});
return null;
}
params = {
requestUrl: $("#restUrl").val(),
requestMethod: $("#restMethod").val(),
requestHeader: getRestRequestHeaderDataToResolution(),
requestBody: restRequestBodyContent.getValue()
};
} else if(dataFromType == 4){
// SQL数据源
if(isNull($("#sqlDataBase").val())){
winui.window.msg('请选择数据库', {icon: 2,time: 2000});
return null;
}
if(isNull(sqlContent.getValue())){
winui.window.msg('请填写sql语句', {icon: 2,time: 2000});
return null;
}
params = {
sqlText: sqlContent.getValue(),
dataBaseId: $("#sqlDataBase").val()
};
}
return params;
}
function getRestRequestHeaderDataToResolution(){
var tableData = new Array();
var rowTr = $("#restHeaderTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
tableData[$("#headerKey" + rowNum).val()] = $("#headerValue" + rowNum).val();
});
return JSON.stringify(tableData);
}
function getDataByDataFromType(dataFromType, json){
if(dataFromType == 1){
// XML数据源
return json.bean.nodeArray;
} else if(dataFromType == 2){
// JSON数据源
return json.bean.nodeArray;
} else if(dataFromType == 3){
// Rest接口数据源
return json.bean.nodeArray;
} else if(dataFromType == 4){
// SQL数据源
return json.rows;
}
}
/**
* 加载解析的字段
*
* @param dataFromType 数据源类型
* @param data 数据
*/
function loadFieldResolution(dataFromType, data){
$("#analysisTable").html("");
$.each(data, function (i, item){
addAnalysisRow();
$("#key" + (rowNum - 1)).val(item);
if(dataFromType == 1){
// XML数据源
} else if(dataFromType == 2){
// JSON数据源
} else if(dataFromType == 3){
// Rest接口数据源
} else if(dataFromType == 4){
// SQL数据源
$("#key" + (rowNum - 1)).val(item.name);
$("#dataType" + (rowNum - 1)).val(item.dataType);
$("#dataLength" + (rowNum - 1)).val(item.width);
$("#dataPrecision" + (rowNum - 1)).val(item.decimals);
}
});
}
/**********************************rest数据源header--start**************************************/
//新增行
$("body").on("click", "#addRow", function() {
addRow();
});
//删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
});
//新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
headerKey: "headerKey" + rowNum.toString(), // 配置项id
headerValue: "headerValue" + rowNum.toString(), // 配置值id
headerDescription: "headerDescription" + rowNum.toString() // 备注id
};
$("#restHeaderTable").append(getDataUseHandlebars($("#headerTemplate").html(), par));
form.render();
rowNum++;
}
//删除行
function deleteRow() {
var checkRow = $("#restHeaderTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
/**********************************rest数据源header--end**************************************/
/**********************************字段解析--start**************************************/
//新增行
$("body").on("click", "#addAnalysisRow", function() {
addAnalysisRow();
});
//删除行
$("body").on("click", "#deleteAnalysisRow", function() {
deleteAnalysisRow();
});
//新增行
function addAnalysisRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
key: "key" + rowNum.toString(), // 字段id
title: "title" + rowNum.toString(), // 含义id
dataType: "dataType" + rowNum.toString(), // 字段类型id
dataLength: "dataLength" + rowNum.toString(), // 字段长度id
dataPrecision: "dataPrecision" + rowNum.toString(), // 字段精度id
remark: "remark" + rowNum.toString() // 备注id
};
$("#analysisTable").append(getDataUseHandlebars($("#analysisTemplate").html(), par));
form.render();
rowNum++;
}
//删除行
function deleteAnalysisRow() {
var checkRow = $("#analysisTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
/**********************************字段解析--end**************************************/
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
var index = parent.layer.getFrameIndex(window.name);
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
// 数据源类型列表
showGrid({
id: "dataFromType",
url: reportBasePath + "reportcommon008",
params: {},
pagination: false,
template: getFileContent('tpl/template/select-option.tpl'),
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
initTable();
}
});
// 数据源选择列表
function initTable(){
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reportBasePath + 'reportdatafrom006',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ type: 'radio'},
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'name', title: '名称', align: 'left', width: 150},
{ field: 'typeName', title: '来源', align: 'left', width: 100 },
{ field: 'remark', title: '备注', align: 'left', width: 150 },
{ field: 'createName', title: '创建人', align: 'left', width: 100 },
{ field: 'createTime', title: '创建时间', align: 'center', width: 140 },
{ field: 'lastUpdateName', title: '最后修改人', align: 'left', width: 100 },
{ field: 'lastUpdateTime', title: '最后修改时间', align: 'center', width: 140}
]],
done: function(res){
matchingLanguage();
$('#messageTable').next().find('.layui-table-body').find("table" ).find("tbody").children("tr").on('dblclick',function(){
var dubClick = $('#messageTable').next().find('.layui-table-body').find("table").find("tbody").find(".layui-table-hover");
dubClick.find("input[type='radio']").prop("checked", true);
form.render();
var id = JSON.stringify(dubClick.data('index'));
var obj = res.rows[id];
parent.dataBaseMation = obj;
parent.layer.close(index);
parent.refreshCode = '0';
});
$('#messageTable').next().find('.layui-table-body').find("table" ).find("tbody").children("tr").on('click',function(){
var click = $('#messageTable').next().find('.layui-table-body').find("table").find("tbody").find(".layui-table-hover");
click.find("input[type='radio']").prop("checked", true);
form.render();
})
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
});
}
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
refreshloadTable();
}
return false;
});
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function refreshloadTable(){
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()});
}
function getTableParams(){
return {
name: $("#name").val(),
type: $("#dataFromType").val()
};
}
exports('reportDataFromChooseList', {});
});
// 表格的序号
var rowNum = 1;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'codemirror', 'xml', 'sql'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
var selOption = getFileContent('tpl/template/select-option.tpl');
var xmlContent, jsonContent, sqlContent, restRequestBodyContent;
// 数据来源类型
var dataFromType;
showGrid({
id: "showForm",
url: reportBasePath + "reportdatafrom005",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showBaseTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(j){
$("#dataBox").html(getFileContent(j.bean.staticTplPath));
dataFromType = j.bean.type;
initEvent(j.bean);
$("#analysisHeader").html($("#analysisHeaderTemplate").html());
$.each(j.bean.analysisData, function (i, item){
addAnalysisRow();
$("#key" + (rowNum - 1)).val(item.key);
$("#title" + (rowNum - 1)).val(item.name);
$("#remark" + (rowNum - 1)).val(item.remark);
if(dataFromType == 4){
$("#dataType" + (rowNum - 1)).val(item.dataType);
$("#dataLength" + (rowNum - 1)).val(item.dataLength);
$("#dataPrecision" + (rowNum - 1)).val(item.dataPrecision);
}
});
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
name: $("#name").val(),
remark: $("#remark").val(),
analysisData: getAnalysisData(),
type: dataFromType,
id: parent.rowId
};
if(JSON.parse(params.analysisData).length == 0){
winui.window.msg('请进行字段解析操作。', {icon: 2,time: 2000});
return false;
}
var otherData = getDataByType();
if((isNull(otherData.xmlContent) && dataFromType == 1)
|| (isNull(otherData.jsonContent) && dataFromType == 2)
|| (isNull(otherData.sqlContent) && dataFromType == 4)){
winui.window.msg('必填项不能为空', {icon: 2,time: 2000});
return false;
}
params = $.extend(true, params, otherData);
AjaxPostUtil.request({url:reportBasePath + "reportdatafrom004", params: params, type:'json', method: "PUT", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
}
});
function getDataByType(){
if(dataFromType == 1){
// XML数据源
return getXMLData();
} else if(dataFromType == 2){
// JSON数据源
return getJSONData();
} else if(dataFromType == 3){
// Rest接口数据源
return getRESTData();
} else if(dataFromType == 4){
// SQL数据源
return getSQLData();
}
return {};
}
function getXMLData(){
return {
xmlContent: xmlContent.getValue()
};
}
function getJSONData(){
return {
jsonContent: jsonContent.getValue()
};
}
function getRESTData(){
return {
restUrl: $("#restUrl").val(),
method: $("#restMethod").val(),
header: getRestRequestHeaderData(),
requestBody: restRequestBodyContent.getValue()
};
}
function getSQLData(){
return {
sqlDataBaseId: $("#sqlDataBase").val(),
sqlContent: sqlContent.getValue()
};
}
function getAnalysisData(){
var tableData = new Array();
var rowTr = $("#analysisTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
key: $("#key" + rowNum).val(),
title: $("#title" + rowNum).val(),
dataType: $("#dataType" + rowNum).val(),
dataLength: $("#dataLength" + rowNum).val(),
dataPrecision: $("#dataPrecision" + rowNum).val(),
remark: $("#remark" + rowNum).val()
};
tableData.push(row);
});
return JSON.stringify(tableData);
}
function getRestRequestHeaderData(){
var tableData = new Array();
var rowTr = $("#restHeaderTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
headerKey: $("#headerKey" + rowNum).val(),
headerValue: $("#headerValue" + rowNum).val(),
headerDescription: $("#headerDescription" + rowNum).val()
};
tableData.push(row);
});
return JSON.stringify(tableData);
}
function initEvent(bean){
// 获取公共的配置信息
var commonOptions = getCommonCodeMirrorOptions();
if(dataFromType == 1){
// XML数据源
xmlContent = CodeMirror.fromTextArea(document.getElementById("xmlData"), $.extend(true, commonOptions, {
mode: "xml",
theme: "default"
}));
xmlContent.setValue(bean.xmlContent);
} else if(dataFromType == 2){
// JSON数据源
jsonContent = CodeMirror.fromTextArea(document.getElementById("jsonData"), $.extend(true, commonOptions, {
mode: "xml",
theme: "default"
}));
jsonContent.setValue(bean.jsonContent);
} else if(dataFromType == 3){
// Rest接口数据源
$("#restUrl").val(bean.restUrl);
$("#restMethod").val(bean.restMethod);
if(!isNull(bean.restHeader)) {
$.each(JSON.parse(bean.restHeader), function (i, item) {
addRow();
$("#headerKey" + (rowNum - 1)).val(item.headerKey);
$("#headerValue" + (rowNum - 1)).val(item.headerValue);
$("#headerDescription" + (rowNum - 1)).val(item.headerDescription);
});
}
restRequestBodyContent = CodeMirror.fromTextArea(document.getElementById("requestBody"), $.extend(true, commonOptions, {
mode: "xml",
theme: "default"
}));
if(!isNull(bean.restContent)){
restRequestBodyContent.setValue(bean.restContent);
}
} else if(dataFromType == 4){
// SQL数据源
showGrid({
id: "sqlDataBase",
url: reportBasePath + "reportdatabase006",
params: {},
pagination: false,
template: selOption,
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
$("#sqlDataBase").val(bean.sqlDataBaseId);
}
});
sqlContent = CodeMirror.fromTextArea(document.getElementById("sqlData"), $.extend(true, commonOptions, {
mode: "text/x-sql",
theme: "default"
}));
sqlContent.setValue(bean.sqlContent);
}
}
function getCommonCodeMirrorOptions(){
return {
mode: "xml", // 模式
theme: "eclipse", // CSS样式选择
indentUnit: 4, // 缩进单位,默认2
smartIndent: true, // 是否智能缩进
tabSize: 4, // Tab缩进,默认4
readOnly: false, // 是否只读,默认false
showCursorWhenSelecting: true,
lineNumbers: true, // 是否显示行号
styleActiveLine: true, //line选择是是否加亮
matchBrackets: true,
extraKeys:{
"F7": function autoFormat(editor) {
// 代码格式化
var totalLines = editor.lineCount();
editor.autoFormatRange({line:0, ch:0}, {line:totalLines});
}
}
};
}
/**
* 字段解析
*/
$("body").on("click", "#fieldResolution", function(e) {
var url = "";
var params = getResolutionInputParams(e);
if(params == null){
return false;
}
if(dataFromType == 1){
// XML数据源
url = "reportcommon002";
} else if(dataFromType == 2){
// JSON数据源
url = "reportcommon003";
} else if(dataFromType == 3){
// Rest接口数据源
url = "reportcommon005";
} else if(dataFromType == 4){
// SQL数据源
url = "reportcommon004";
}
AjaxPostUtil.request({url: reportBasePath + url, params: params, type: 'json', method: "POST", callback: function(json) {
if (json.returnCode == 0) {
var data = getDataByDataFromType(json);
loadFieldResolution(data);
} else {
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
});
/**
* 字段解析时根据不同的数据源类型获取入参
*
* @returns {boolean}
*/
function getResolutionInputParams(e){
var params = {};
if(dataFromType == 1){
// XML数据源
params = {
xmlText: xmlContent.getValue()
};
} else if(dataFromType == 2){
// JSON数据源
params = {
jsonText: jsonContent.getValue()
};
} else if(dataFromType == 3){
// Rest接口数据源
if(isNull($("#restUrl").val())){
winui.window.msg('请填写url', {icon: 2,time: 2000});
return null;
}
params = {
requestUrl: $("#restUrl").val(),
requestMethod: $("#restMethod").val(),
requestHeader: getRestRequestHeaderDataToResolution(),
requestBody: restRequestBodyContent.getValue()
};
} else if(dataFromType == 4){
// SQL数据源
if(isNull($("#sqlDataBase").val())){
winui.window.msg('请选择数据库', {icon: 2,time: 2000});
return null;
}
if(isNull(sqlContent.getValue())){
winui.window.msg('请填写sql语句', {icon: 2,time: 2000});
return null;
}
params = {
sqlText: sqlContent.getValue(),
dataBaseId: $("#sqlDataBase").val()
};
}
return params;
}
function getRestRequestHeaderDataToResolution(){
var tableData = new Array();
var rowTr = $("#restHeaderTable tr");
$.each(rowTr, function(i, item) {
//获取行编号
var rowNum = $(item).attr("trcusid").replace("tr", "");
tableData[$("#headerKey" + rowNum).val()] = $("#headerValue" + rowNum).val();
});
return JSON.stringify(tableData);
}
function getDataByDataFromType(json){
if(dataFromType == 1){
// XML数据源
return json.bean.nodeArray;
} else if(dataFromType == 2){
// JSON数据源
return json.bean.nodeArray;
} else if(dataFromType == 3){
// Rest接口数据源
return json.bean.nodeArray;
} else if(dataFromType == 4){
// SQL数据源
return json.rows;
}
}
/**
* 加载解析的字段
*
* @param data 数据
*/
function loadFieldResolution(data){
$("#analysisTable").html("");
$.each(data, function (i, item){
addAnalysisRow();
$("#key" + (rowNum - 1)).val(item);
if(dataFromType == 1){
// XML数据源
} else if(dataFromType == 2){
// JSON数据源
} else if(dataFromType == 3){
// Rest接口数据源
} else if(dataFromType == 4){
// SQL数据源
$("#key" + (rowNum - 1)).val(item.name);
$("#dataType" + (rowNum - 1)).val(item.dataType);
$("#dataLength" + (rowNum - 1)).val(item.width);
$("#dataPrecision" + (rowNum - 1)).val(item.decimals);
}
});
}
/**********************************rest数据源header--start**************************************/
//新增行
$("body").on("click", "#addRow", function() {
addRow();
});
//删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
});
//新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
headerKey: "headerKey" + rowNum.toString(), // 配置项id
headerValue: "headerValue" + rowNum.toString(), // 配置值id
headerDescription: "headerDescription" + rowNum.toString() // 备注id
};
$("#restHeaderTable").append(getDataUseHandlebars($("#headerTemplate").html(), par));
form.render();
rowNum++;
}
//删除行
function deleteRow() {
var checkRow = $("#restHeaderTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
/**********************************rest数据源header--end**************************************/
/**********************************字段解析--start**************************************/
//新增行
$("body").on("click", "#addAnalysisRow", function() {
addAnalysisRow();
});
//删除行
$("body").on("click", "#deleteAnalysisRow", function() {
deleteAnalysisRow();
});
//新增行
function addAnalysisRow() {
var par = {
id: "row" + rowNum.toString(), //checkbox的id
trId: "tr" + rowNum.toString(), //行的id
key: "key" + rowNum.toString(), // 字段id
title: "title" + rowNum.toString(), // 含义id
dataType: "dataType" + rowNum.toString(), // 字段类型id
dataLength: "dataLength" + rowNum.toString(), // 字段长度id
dataPrecision: "dataPrecision" + rowNum.toString(), // 字段精度id
remark: "remark" + rowNum.toString() // 备注id
};
$("#analysisTable").append(getDataUseHandlebars($("#analysisTemplate").html(), par));
form.render();
rowNum++;
}
//删除行
function deleteAnalysisRow() {
var checkRow = $("#analysisTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
//移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
/**********************************字段解析--end**************************************/
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
authBtn('1622876929121');
// 数据源类型列表
showGrid({
id: "dataFromType",
url: reportBasePath + "reportcommon008",
params: {},
pagination: false,
template: getFileContent('tpl/template/select-option.tpl'),
method: "GET",
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
initTable();
}
});
// 数据源列表
function initTable(){
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reportBasePath + 'reportdatafrom001',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'name', title: '名称', align: 'left', width: 150},
{ field: 'typeName', title: '来源', align: 'left', width: 150 },
{ field: 'remark', title: '备注', align: 'left', width: 150 },
{ field: 'createName', title: '创建人', align: 'left', width: 100 },
{ field: 'createTime', title: '创建时间', align: 'center', width: 140 },
{ field: 'lastUpdateName', title: '最后修改人', align: 'left', width: 100 },
{ field: 'lastUpdateTime', title: '最后修改时间', align: 'center', width: 140},
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 200, toolbar: '#tableBar'}
]],
done: function(){
matchingLanguage();
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'delet') { //删除
delet(data);
}
});
}
//添加
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/reportDataFrom/reportDataFromAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "reportDataFromAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
// 删除
function delet(data){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url:reportBasePath + "reportdatafrom003", params:{id: data.id}, type:'json', method: "DELETE", callback:function(json){
if(json.returnCode == 0){
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1,time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
// 编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/reportDataFrom/reportDataFromEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
pageId: "reportDataFromEdit",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}
});
}
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
refreshloadTable();
}
return false;
});
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function refreshloadTable(){
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()});
}
function getTableParams(){
return {
name: $("#name").val(),
type: $("#dataFromType").val()
};
}
exports('reportDataFromList', {});
});
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
authBtn('1624176433377');
// 数据源列表
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reportBasePath + 'reportimporthistory001',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'fileName', title: '文件名称', align: 'left', width: 200},
{ field: 'fileSize', title: '文件大小', align: 'left', width: 100 },
{ field: 'createName', title: '上传人', align: 'left', width: 100 },
{ field: 'createTime', title: '上传时间', align: 'center', width: 140 }
]],
done: function(){
matchingLanguage();
}
});
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
refreshloadTable();
}
return false;
});
// 导入数据
$("body").on("click", "#addBean", function(){
$("#upfile").val("");
$("#upfile").click();
});
// 上传
$("body").on("change", "#upfile", function(){
var formData = new FormData();
var name = $("#upfile").val();
formData.append("file", $("#upfile")[0].files[0]);
formData.append("name", name);
$.ajax({
url : reportBasePath + 'reportimporthistory002?loginPCIp=' + returnCitySN["cip"],
type : 'POST',
async : false,
data : formData,
headers: getRequestHeaders(),
// 告诉jQuery不要去处理发送的数据
processData : false,
// 告诉jQuery不要去设置Content-Type请求头
contentType : false,
dataType:"json",
beforeSend:function(){
winui.window.msg("正在进行,请稍候", { shift: 1 });
},
success : function(json) {
if(json.returnCode == "0"){
winui.window.msg("成功导入", { shift: 1 });
loadTable();
}else{
winui.window.msg("导入失败", {icon: 2,time: 2000});
}
}
});
});
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function refreshloadTable(){
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()});
}
function getTableParams(){
return {
fileName: $("#fileName").val()
};
}
exports('reportImportHistoryList', {});
});
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
fileName: $("#fileName").val(),
modelId: $("#modelId").val()
};
AjaxPostUtil.request({url:reportBasePath + "reportimportmodel002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
showGrid({
id: "showForm",
url: reportBasePath + "reportimportmodel005",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showBaseTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(j){
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
fileName: $("#fileName").val(),
modelId: $("#modelId").val(),
id: parent.rowId
};
AjaxPostUtil.request({url:reportBasePath + "reportimportmodel004", params: params, type:'json', method: "PUT", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
}
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
authBtn('1621139557781');
// 文件模型配置列表
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reportBasePath + 'reportimportmodel001',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'fileName', title: '文件名称', align: 'left', width: 250},
{ field: 'modelId', title: '模型ID', align: 'left', width: 250 },
{ field: 'createName', title: '创建人', align: 'left', width: 100 },
{ field: 'createTime', title: '创建时间', align: 'center', width: 140 },
{ field: 'lastUpdateName', title: '最后修改人', align: 'left', width: 100 },
{ field: 'lastUpdateTime', title: '最后修改时间', align: 'center', width: 140},
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 200, toolbar: '#tableBar'}
]],
done: function(){
matchingLanguage();
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'delet') { //删除
delet(data);
}
});
// 添加
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/reportImportModel/reportImportModelAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "reportImportModelAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
// 删除
function delet(data){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url:reportBasePath + "reportimportmodel003", params:{rowId: data.id}, type:'json', method: "DELETE", callback:function(json){
if(json.returnCode == 0){
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1,time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
// 编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/reportImportModel/reportImportModelEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
pageId: "reportImportModelEdit",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}
});
}
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
refreshloadTable();
}
return false;
});
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function refreshloadTable(){
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()});
}
function getTableParams(){
return {
fileName: $("#fileName").val(),
modelId: $("#modelId").val()
};
}
exports('reportImportModelList', {});
});
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
showGrid({
id: "parentId",
url: reportBasePath + "reportmodeltype006",
params: {"parentId": 0},
pagination: false,
method: "GET",
template: getFileContent('tpl/template/select-option.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
form.render('select');
}
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
name: $("#name").val(),
parentId: $("#parentId").val()
};
AjaxPostUtil.request({url:reportBasePath + "reportmodeltype002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
showGrid({
id: "showForm",
url: reportBasePath + "reportmodeltype005",
params: {id: parent.rowId},
pagination: false,
method: "GET",
template: $("#showBaseTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(j){
showGrid({
id: "parentId",
url: reportBasePath + "reportmodeltype006",
params: {"parentId": 0},
pagination: false,
method: "GET",
template: getFileContent('tpl/template/select-option.tpl'),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(json){
$("#parentId").val(j.bean.parentId);
form.render('select');
}
});
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
name: $("#name").val(),
parentId: $("#parentId").val(),
id: parent.rowId
};
AjaxPostUtil.request({url:reportBasePath + "reportmodeltype004", params: params, type:'json', method: "PUT", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
}
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window',
}).define(['window', 'treeGrid', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
treeGrid = layui.treeGrid;
authBtn('1635086167509');
treeGrid.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
idField: 'id',
url: reportBasePath + 'reportmodeltype001',
cellMinWidth: 100,
where: getTableParams(),
treeId: 'id',//树形id字段名称
treeUpId: 'parentId',//树形父id字段名称
treeShowName: 'name',//以树形式显示的字段
cols: [[
{ field: 'name', width: 300, title: '名称'},
{ field: 'createName', title: '创建人', align: 'left', width: 100 },
{ field: 'createTime', title: '创建时间', align: 'center', width: 140 },
{ field: 'lastUpdateName', title: '最后修改人', align: 'left', width: 100 },
{ field: 'lastUpdateTime', title: '最后修改时间', align: 'center', width: 140},
{ title: '操作', fixed: 'right', align: 'center', width: 120, toolbar: '#tableBar'}
]],
done: function(){
matchingLanguage();
},
isPage:false
});
treeGrid.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'del') { //删除
del(data);
}else if (layEvent === 'edit') { //编辑
edit(data);
}
});
// 删除
function del(data){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url:reportBasePath + "reportmodeltype003", params:{id: data.id}, type:'json', method: "DELETE", callback:function(json){
if(json.returnCode == 0){
winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
// 编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/reportModelType/reportModelTypeEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
pageId: "reportModelTypeEdit",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
}
// 新增
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/reportModelType/reportModelTypeAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "reportModelTypeAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg("操作成功", {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg("操作失败", {icon: 2,time: 2000});
}
}});
});
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
loadTable();
}
return false;
});
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
treeGrid.query("messageTable", {where: getTableParams()});
}
function getTableParams(){
return {
name: $("#name").val()
};
}
exports('reportModelTypeList', {});
});
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
nameCh: $("#nameCh").val(),
nameEn: $("#nameEn").val()
};
AjaxPostUtil.request({url:reportBasePath + "reportpage002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
showGrid({
id: "showForm",
url: reportBasePath + "reportpage003",
params: {rowId: parent.rowId},
pagination: false,
method: "GET",
template: $("#showBaseTemplate").html(),
ajaxSendLoadBefore: function(hdb){
},
ajaxSendAfter:function(j){
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
nameCh: $("#nameCh").val(),
nameEn: $("#nameEn").val(),
rowId: parent.rowId
};
AjaxPostUtil.request({url:reportBasePath + "reportpage004", params: params, type:'json', method: "PUT", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
}
});
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
var rowId = "";
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form,
table = layui.table;
authBtn('1624759338639');
// 报表页面列表
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reportBasePath + 'reportpage001',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
{ field: 'nameCh', title: '页面中文名称', align: 'left', width: 150},
{ field: 'nameEn', title: '页面英文名称', align: 'left', width: 150 },
{ field: 'createName', title: '创建人', align: 'left', width: 100 },
{ field: 'createTime', title: '创建时间', align: 'center', width: 140 },
{ field: 'lastUpdateName', title: '最后修改人', align: 'left', width: 100 },
{ field: 'lastUpdateTime', title: '最后修改时间', align: 'center', width: 140},
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 250, toolbar: '#tableBar'}
]],
done: function(){
matchingLanguage();
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'delet') { //删除
delet(data);
}else if (layEvent === 'design') { //设计
design(data);
}else if (layEvent === 'showPage') { //预览
showPage(data);
}
});
form.render();
form.on('submit(formSearch)', function (data) {
if (winui.verifyForm(data.elem)) {
refreshloadTable();
}
return false;
});
//添加
$("body").on("click", "#addBean", function(){
_openNewWindows({
url: "../../tpl/reportPage/reportPageAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "reportPageAdd",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}});
});
// 删除
function delet(data){
layer.confirm(systemLanguage["com.skyeye.deleteOperationMsg"][languageType], {icon: 3, title: systemLanguage["com.skyeye.deleteOperation"][languageType]}, function(index){
layer.close(index);
AjaxPostUtil.request({url:reportBasePath + "reportpage005", params:{rowId: data.id}, type:'json', method: "DELETE", callback:function(json){
if(json.returnCode == 0){
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1,time: 2000});
loadTable();
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
// 编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/reportPage/reportPageEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
pageId: "reportPageEdit",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}
});
}
// 设计
function design(data){
parent._openNewWindows({
url: "../../tpl/pageReportDesign/pageReportDesign.html?rowId=" + data.id,
title: '报表设计',
pageId: "pageReportDesign",
area: ['100vw', '100vh'],
callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}
});
}
// 预览
function showPage(data){
window.open("../../tpl/reportPage/reportPageShow.html?rowId=" + data.id, "_blank");
}
// 刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where: getTableParams()});
}
function refreshloadTable(){
table.reload("messageTable", {page: {curr: 1}, where: getTableParams()});
}
function getTableParams(){
return {
name: $("#name").val()
};
}
exports('reportPageList', {});
});
var rowId;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window',
echarts: '../echarts/echarts',
echartsTheme: '../echarts/echartsTheme'
}).define(['window', 'jquery', 'winui', 'form', 'echarts', 'colorpicker'], function (exports) {
winui.renderColor();
var $ = layui.$,
form = layui.form;
rowId = GetUrlParam("rowId");
var content = $(document.body);
var initData = {};
// 获取初始化数据
AjaxPostUtil.request({url:reportBasePath + "reportpage006", params: {rowId: rowId}, type:'json', method: "GET", callback:function(json){
if(json.returnCode == 0){
initData = JSON.parse(getContentStr(json.bean.content));
var widthScale = getScale(initData.contentWidth, content.width());
var heightScale = getScale(initData.contentHeight, content.height());
initEchartsData(widthScale, heightScale);
initWordMationData(widthScale, heightScale);
if(!isNull(initData.bgImage)){
content.css({
"background-image": "url(" + initData.bgImage + ")",
"background-size": content.width() + "px " + content.height() + "px"
});
}
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
function initEchartsData(widthScale, heightScale) {
var modelList = initData.modelList;
if (!isNull(modelList)) {
$.each(modelList, function (i, item) {
var leftNum = multiplication(item.attrMation.attr["custom.move.x"].value, widthScale);
var topNum = multiplication(item.attrMation.attr["custom.move.y"].value, heightScale);
item.attrMation.attr["custom.move.x"].value = leftNum;
item.attrMation.attr["custom.move.y"].value = topNum;
item.attrMation.attr = getDataFromRest(item.attrMation.attr);
// 加载模型
var boxId = addNewModel(item.modelId, item.attrMation);
$("#" + boxId).css({
left: leftNum + "px",
top: topNum + "px",
width: multiplication(item.width, widthScale),
height: multiplication(item.height, heightScale)
});
setBoxAttrMation("custom.box.background", boxId, item.attrMation.attr["custom.box.background"].value);
setBoxAttrMation("custom.box.border-color", boxId, item.attrMation.attr["custom.box.border-color"].value);
});
}
}
function initWordMationData(widthScale, heightScale) {
var wordMationList = initData.wordMationList;
if (!isNull(wordMationList)) {
$.each(wordMationList, function (i, item) {
var leftNum = multiplication(item.attrMation.attr["custom.move.x"].value, widthScale);
var topNum = multiplication(item.attrMation.attr["custom.move.y"].value, heightScale);
item.attrMation.attr["custom.move.x"].value = leftNum;
item.attrMation.attr["custom.move.y"].value = topNum;
var boxId = addNewWordModel(item.modelId, item.attrMation);
$("#" + boxId).css({
left: leftNum + "px",
top: topNum + "px",
width: multiplication(item.width, widthScale),
height: multiplication(item.height, heightScale)
});
setBoxAttrMation("custom.box.background", boxId, item.attrMation.attr["custom.box.background"].value);
setBoxAttrMation("custom.box.border-color", boxId, item.attrMation.attr["custom.box.border-color"].value);
});
}
}
function getContentStr(str){
if(!isNull(str)){
str = str.replace(/%/g, '%25');
return decodeURIComponent(str);
}
return "{}";
}
function getDataFromRest(attr){
var fromId = attr['custom.dataBaseMation'].value.id;
var needGetData = {};
$.each(attr, function(key, value){
if(value.editor == 9){
var pointValue = attr[key].pointValue;
if(!isNull(pointValue)){
needGetData[pointValue] = attr[key].value;
}
}
});
if(isNull(fromId) || needGetData.length == 0){
return attr;
}
var params = {
fromId: fromId,
needGetDataStr: JSON.stringify(needGetData)
};
AjaxPostUtil.request({url:reportBasePath + "reportdatafrom007", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
$.each(json.bean, function(key, value){
$.each(attr, function(key1, value1){
if(value1.editor == 9){
var pointValue = attr[key1].pointValue;
if(!isNull(pointValue) && key == pointValue){
attr[key1].value = value;
}
}
});
});
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}, async: false});
return attr;
}
function addNewModel(modelId, echartsMation){
if(!isNull(echartsMation)){
var option = getEchartsOptions(echartsMation);
// 获取boxId
var boxId = modelId + getRandomValueToString();
// 获取echarts图表id
var echartsId = getEchartsBox(boxId, modelId);
// 加载图表
var newChart = echarts.init(document.getElementById(echartsId));
newChart.setOption(option);
$("#" + echartsId).resize(function () {
newChart.resize();
});
// 加入页面属性
inPageEcharts[boxId] = $.extend(true, {}, echartsMation);
inPageEchartsObject[boxId] = newChart;
return boxId;
}
return "";
}
// 加载文字模型
function addNewWordModel(modelId, wordStyleMation){
var styleStr = getWordStyleStr(wordStyleMation.attr);
// 获取boxId
var boxId = modelId + getRandomValueToString();
// 获取文字模型id
var wordId = getWordBox(boxId, modelId, styleStr, wordStyleMation);
// 加入页面属性
wordStyleMation.attr = $.extend(true, {}, wordStyleMation.attr);
inPageWordMation[boxId] = $.extend(true, {}, wordStyleMation);
return boxId;
}
function getEchartsBox(boxId, modelId){
var echartsId = "echarts" + boxId;
var echartsBox = document.createElement("div");
// 为div设置类名
echartsBox.className = "echarts-box";
echartsBox.id = echartsId;
var box = createBox(boxId, modelId, null);
box.appendChild(echartsBox);
return echartsId;
}
function getWordBox(boxId, modelId, styleStr, wordStyleMation){
var wordId = "word" + boxId;
var wordBox = document.createElement("font");
// 为div设置类名
wordBox.className = "word-box";
wordBox.innerHTML = wordStyleMation["attr"]["custom.textContent"].value;
wordBox.style = styleStr;
wordBox.id = wordId;
var box = createBox(boxId, modelId, setDesignAttr(wordStyleMation));
box.appendChild(wordBox);
return wordId;
}
function setDesignAttr(wordStyleMation){
var otherStyle = {
width: wordStyleMation.defaultWidth + 'px',
height: wordStyleMation.defaultHeight + 'px'
};
return otherStyle;
}
function createBox(id, modelId, otherStyle){
// 创建一个div
var div = document.createElement("div");
// 为div设置类名
div.className = "kuang";
div.id = id;
div.dataset.boxId = id;
div.dataset.modelId = modelId;
div.style.top = "0px";
div.style.left = "0px";
if(!isNull(otherStyle)){
$.each(otherStyle, function (key, value){
div.style[key] = value;
});
}
$(document.body)[0].appendChild(div);
return div;
}
form.render();
});
\ No newline at end of file
// 表格的序号
var rowNum = 1;
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
var usetableTemplate = $("#usetableTemplate").html();
var selOption = getFileContent('tpl/template/select-option.tpl');
skyeyeReportUtil.getReportEditorType("editorType", selOption, function (){
form.render('select');
});
// 属性值是否可选的变化变化
form.on('radio(optional)', function(data) {
var val = data.value;
if(val == 1){
$("#canChoose").show();
$("#canNotChoose").hide();
}else{
$("#canChoose").hide();
$("#canNotChoose").show();
}
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
// 是否可选
var optional = $("input[name='optional']:checked").val();
var tableData = new Array();
if(optional == 1){
var rowTr = $("#useTable tr");
$.each(rowTr, function(i, item) {
var rowNum = $(item).attr("trcusid").replace("tr", "");
var row = {
title: $("#title" + rowNum).val(),
value: $("#value" + rowNum).val(),
defaultChoose: encodeURIComponent($("input[name='defaultChoose" + rowNum + "']:checked").val())
};
tableData.push(row);
});
if(tableData.length == 0){
winui.window.msg('请最少填写一条属性值', {icon: 2,time: 2000});
return false;
}
}else{
if(isNull($("#defaultValue").val())){
winui.window.msg('请填写默认值', {icon: 2,time: 2000});
return false;
}
}
var params = {
title: $("#title").val(),
attrCode: $("#attrCode").val(),
editorType: $("#editorType").val(),
optional: optional,
defaultValue: encodeURIComponent($("#defaultValue").val()),
options: JSON.stringify(tableData),
};
AjaxPostUtil.request({url:reportBasePath + "reportproperty002", params: params, type:'json', method: "POST", callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
// 新增行
$("body").on("click", "#addRow", function() {
addRow();
});
// 删除行
$("body").on("click", "#deleteRow", function() {
deleteRow();
});
// 新增行
function addRow() {
var par = {
id: "row" + rowNum.toString(), // checkbox的id
trId: "tr" + rowNum.toString(), // 行的id
title: "title" + rowNum.toString(), // 标题id
value: "value" + rowNum.toString(), // 属性值id
defaultChoose: "defaultChoose" + rowNum.toString() // 是否默认id
};
$("#useTable").append(getDataUseHandlebars(usetableTemplate, par));
form.render();
rowNum++;
}
// 删除行
function deleteRow() {
var checkRow = $("#useTable input[type='checkbox'][name='tableCheckRow']:checked");
if(checkRow.length > 0) {
$.each(checkRow, function(i, item) {
// 移除界面上的信息
$(item).parent().parent().remove();
});
} else {
winui.window.msg('请选择要删除的行', {icon: 2, time: 2000});
}
}
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/report/css/ruler.css" rel="stylesheet" />
</head>
<body>
</body>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript" src="../../assets/report/js/loadboxresize.js"></script>
<script type="text/javascript" src="../../assets/report/js/skyeyeReportDesigner.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/pageReportDesign/'}).use('pageReportDesign');
</script>
</html>
\ No newline at end of file
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册