提交 4883ba89 编写于 作者: doc_wei's avatar doc_wei

轻应用类型托管到表单布局

上级 93aabf44
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.$;
// 初始化上传
$("#iconpicPath").upload(systemCommonUtil.uploadCommon003Config('iconpicPath', 12, '', 1));
// 图标类型变化事件
form.on('radio(iconType)', function (data) {
var val = data.value;
if(val == '1'){//icon
$(".menuIconTypeIsTwo").addClass("layui-hide");
$(".menuIconTypeIsOne").removeClass("layui-hide");
} else if (val == '2'){//图片
$(".menuIconTypeIsTwo").removeClass("layui-hide");
$(".menuIconTypeIsOne").addClass("layui-hide");
} else {
winui.window.msg('状态值错误', {icon: 2, time: 2000});
}
});
// 图标选中事件
$("body").on("focus", "#iconPath", function (e) {
systemCommonUtil.openSysEveIconChoosePage(function(sysIconChooseClass){
$("#iconPath").val(sysIconChooseClass);
$("#iconShow").css({'color': 'black'});
$("#iconShow").attr("class", "fa fa-fw " + $("#iconPath").val());
});
});
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
typeName: $("#typeName").val(),
iconType: data.field.iconType
};
if (data.field.iconType == '1'){
params.iconPath = $("#iconPath").val();
} else if (data.field.iconType == '2'){
params.iconPath = $("#iconpicPath").find("input[type='hidden'][name='upload']").attr("oldurl");
} else {
winui.window.msg("状态值错误。", {icon: 2, time: 2000});
return false;
}
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype002", params: params, type: 'json', callback: function (json) {
parent.layer.close(index);
parent.refreshCode = '0';
}});
}
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', 'fileUpload'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$;
showGrid({
id: "showForm",
url: sysMainMation.lightAppBasePath + "lightapptype003",
params: {rowId: parent.rowId},
pagination: false,
template: $("#beanTemplate").html(),
ajaxSendLoadBefore: function(hdb) {
},
ajaxSendAfter:function (json) {
//类型
$("input:radio[name=iconType][value=" + json.bean.iconType + "]").attr("checked", true);
if(json.bean.iconType == '1'){//icon
$(".menuIconTypeIsTwo").addClass("layui-hide");
$(".menuIconTypeIsOne").removeClass("layui-hide");
// 初始化上传
$("#iconpicPath").upload(systemCommonUtil.uploadCommon003Config('iconpicPath', 12, '', 1));
} else if (json.bean.iconType == '2'){//图片
$(".menuIconTypeIsTwo").removeClass("layui-hide");
// 初始化上传
$("#iconpicPath").upload(systemCommonUtil.uploadCommon003Config('iconpicPath', 12, json.bean.iconPath, 1));
$(".menuIconTypeIsOne").addClass("layui-hide");
}
$("#iconShow").attr("class", "fa fa-fw " + $("#iconPath").val());
$("#iconShow").css({'color': 'black'});
matchingLanguage();
form.render();
//图标类型变化事件
form.on('radio(iconType)', function (data) {
var val = data.value;
if(val == '1'){//icon
$(".menuIconTypeIsTwo").addClass("layui-hide");
$(".menuIconTypeIsOne").removeClass("layui-hide");
} else if (val == '2'){//图片
$(".menuIconTypeIsTwo").removeClass("layui-hide");
$(".menuIconTypeIsOne").addClass("layui-hide");
} else {
winui.window.msg('状态值错误', {icon: 2, time: 2000});
}
});
// 图标选中事件
$("body").on("focus", "#iconPath", function (e) {
systemCommonUtil.openSysEveIconChoosePage(function(sysIconChooseClass){
$("#iconPath").val(sysIconChooseClass);
$("#iconShow").css({'color': 'black'});
$("#iconShow").attr("class", "fa fa-fw " + $("#iconPath").val());
});
});
form.on('submit(formEditMenu)', function (data) {
if (winui.verifyForm(data.elem)) {
var params = {
typeName: $("#typeName").val(),
iconType: data.field.iconType,
rowId: parent.rowId,
};
if (data.field.iconType == '1'){
params.iconPath = $("#iconPath").val();
} else if (data.field.iconType == '2'){
params.iconPath = $("#iconpicPath").find("input[type='hidden'][name='upload']").attr("oldurl");
} else {
winui.window.msg("状态值错误。", {icon: 2, time: 2000});
return false;
}
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype004", params: params, type: 'json', callback: function (json) {
parent.layer.close(index);
parent.refreshCode = '0';
}});
}
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('1559201340836');
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: sysMainMation.lightAppBasePath + 'lightapptype001',
where: getTableParams(),
even: true,
page: true,
limits: getLimits(),
limit: getLimit(),
cols: [[
{ title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers' },
{ field: 'typeName', title: '名称', width: 120 },
{ field: 'iconPath', title: 'logo', width: 60, templet: function (d) {
if(isNull(d.iconPath)){
return '';
} else {
var str = '';
if(d.iconType == '1'){
str += '<div class="winui-icon winui-icon-font" style="text-align: center;">';
str += '<i class="fa fa-fw ' + d.iconPath + '" style="color: black"></i>';
str += '</div>';
} else if (d.iconType = '2'){
str = '<img src="' + fileBasePath + d.iconPath + '" class="photo-img" lay-event="iconPath">';
}
return str;
}
}},
{ field: 'useNum', title: '轻应用数量', align: 'center', width: 120 },
{ field: 'state', title: '状态', width: 100, align: 'center', templet: function (d) {
if(d.state == '1'){
return "<span class='state-new'>新建</span>";
} else if (d.state == '2'){
return "<span class='state-up'>上线</span>";
} else if (d.state == '3'){
return "<span class='state-down'>下线</span>";
} else {
return "参数错误";
}
}},
{ field: 'createName', title: systemLanguage["com.skyeye.createName"][languageType], align: 'left', width: 120 },
{ field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 },
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 250, toolbar: '#tableBar' }
]],
done: function(json) {
matchingLanguage();
initTableSearchUtil.initAdvancedSearch(this, json.searchFilter, form, "请输入名称", function () {
table.reloadData("messageTable", {page: {curr: 1}, where: getTableParams()});
});
}
});
table.on('tool(messageTable)', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'edit') { // 编辑
edit(data);
} else if (layEvent === 'iconPath') { // 预览
systemCommonUtil.showPicImg(fileBasePath + data.iconPath);
} else if (layEvent === 'delete') { // 删除
del(data);
} else if (layEvent === 'up') { // 上线
up(data);
} else if (layEvent === 'down') { // 下线
down(data);
} else if (layEvent === 'top') { // 上移
topOne(data);
} else if (layEvent === 'lower') { // 下移
lowerOne(data);
}
});
// 新增
$("body").on("click", "#addBean", function() {
_openNewWindows({
url: "../../tpl/lightAppType/lightAppTypeAdd.html",
title: systemLanguage["com.skyeye.addPageTitle"][languageType],
pageId: "lightAppTypeAdd",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
loadTable();
}});
});
// 编辑
function edit(data) {
rowId = data.id;
_openNewWindows({
url: "../../tpl/lightAppType/lightAppTypeEdit.html",
title: systemLanguage["com.skyeye.editPageTitle"][languageType],
pageId: "lightAppTypeEdit",
area: ['90vw', '90vh'],
callBack: function (refreshCode) {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
loadTable();
}});
}
// 删除
function del(data, obj) {
var msg = obj ? '确认删除【' + obj.data.typeName + '】吗?' : '确认删除选中数据吗?';
layer.confirm(msg, { icon: 3, title: '删除轻应用类型' }, function (index) {
layer.close(index);
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype007", params: {rowId: data.id}, type: 'json', callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.deleteOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable();
}});
});
}
// 上线
function up(data, obj){
var msg = obj ? '确认将【' + obj.data.typeName + '】上线吗?' : '确认将选中数据上线吗?';
layer.confirm(msg, { icon: 3, title: '轻应用类型上线' }, function (index) {
layer.close(index);
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype008", params: {rowId: data.id}, type: 'json', callback: function (json) {
winui.window.msg("上线成功", {icon: 1, time: 2000});
loadTable();
}});
});
}
// 下线
function down(data, obj){
var msg = obj ? '确认将【' + obj.data.typeName + '】下线吗?' : '确认将选中数据下线吗?';
layer.confirm(msg, { icon: 3, title: '轻应用类型下线' }, function (index) {
layer.close(index);
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype009", params: {rowId: data.id}, type: 'json', callback: function (json) {
winui.window.msg("下线成功", {icon: 1, time: 2000});
loadTable();
}});
});
}
// 上移
function topOne(data) {
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype005", params: {rowId: data.id}, type: 'json', callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.moveUpOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable();
}});
}
// 下移
function lowerOne(data) {
AjaxPostUtil.request({url: sysMainMation.lightAppBasePath + "lightapptype006", params: {rowId: data.id}, type: 'json', callback: function (json) {
winui.window.msg(systemLanguage["com.skyeye.moveDownOperationSuccessMsg"][languageType], {icon: 1, time: 2000});
loadTable();
}});
}
form.render();
$("body").on("click", "#reloadTable", function() {
loadTable();
});
function loadTable() {
table.reloadData("messageTable", {where: getTableParams()});
}
function getTableParams() {
return $.extend(true, {}, initTableSearchUtil.getSearchValue("messageTable"));
}
exports('lightAppTypeList', {});
});
<!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" />
</head>
<body>
<div style="padding:20px; margin:0 auto;">
<form class="layui-form" action="" id="showForm">
<div class="layui-form-item">
<label class="layui-form-label">类型名称<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="typeName" name="typeName" win-verify="required" placeholder="请输入类型名称" class="layui-input" maxlength="10"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">logo类型<i class="red">*</i></label>
<div class="layui-input-block winui-radio">
<input type="radio" name="iconType" value="1" title="Icon" lay-filter="iconType" checked/>
<input type="radio" name="iconType" value="2" title="图片" lay-filter="iconType" />
</div>
</div>
<div class="layui-form-item menuIconTypeIsOne">
<label class="layui-form-label">logo</label>
<div class="layui-input-block">
<input type="text" id="iconPath" name="iconPath" placeholder="请输入图标src或者class" class="layui-input" />
</div>
</div>
<div class="layui-form-item menuIconTypeIsOne">
<label class="layui-form-label">logo预览</label>
<div class="layui-input-block">
<div class="layui-col-xs12">
<div class="layui-col-xs2">
<div class="winui-icon winui-icon-font" style="width: 60px; height: 60px;"><i id="iconShow" class="" style="font-size: 48px; line-height: 65px;"></i></div>
</div>
</div>
</div>
</div>
<div class="layui-form-item menuIconTypeIsTwo layui-hide">
<label class="layui-form-label">logo图片</label>
<div class="layui-input-block">
<div class="upload" id="iconpicPath"></div>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
<button class="winui-btn" lay-submit lay-filter="formAddBean"><language showName="com.skyeye.save"></language></button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/lightAppType/'}).use('lightAppTypeAdd');
</script>
</body>
</html>
\ 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" />
</head>
<body>
<div style="margin:0 auto;padding:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
</form>
</div>
<script type="text/x-handlebars-template" id="beanTemplate">
{{#bean}}
<div class="layui-form-item">
<label class="layui-form-label">类型名称<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="typeName" name="typeName" win-verify="required" placeholder="请输入类型名称" class="layui-input" maxlength="10" value="{{typeName}}" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">logo类型<i class="red">*</i></label>
<div class="layui-input-block winui-radio">
<input type="radio" name="iconType" value="1" title="Icon" lay-filter="iconType" checked/>
<input type="radio" name="iconType" value="2" title="图片" lay-filter="iconType" />
</div>
</div>
<div class="layui-form-item menuIconTypeIsOne">
<label class="layui-form-label">logo</label>
<div class="layui-input-block">
<input type="text" id="iconPath" name="iconPath" placeholder="请输入图标src或者class" class="layui-input" value="{{iconPath}}" />
</div>
</div>
<div class="layui-form-item menuIconTypeIsOne">
<label class="layui-form-label">logo预览</label>
<div class="layui-input-block">
<div class="layui-col-xs12">
<div class="layui-col-xs2">
<div class="winui-icon winui-icon-font" style="width: 60px; height: 60px;"><i id="iconShow" class="" style="font-size: 48px; line-height: 65px;"></i></div>
</div>
</div>
</div>
</div>
<div class="layui-form-item menuIconTypeIsTwo layui-hide">
<label class="layui-form-label">logo图片</label>
<div class="layui-input-block">
<div class="upload" id="iconpicPath"></div>
</div>
</div>
<div class="layui-form-item layui-col-xs12">
<div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
<button class="winui-btn" lay-submit lay-filter="formEditMenu"><language showName="com.skyeye.save"></language></button>
</div>
</div>
{{/bean}}
</script>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/lightAppType/'}).use('lightAppTypeEdit');
</script>
</body>
</html>
\ 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" />
</head>
<body>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn search-table-btn-right"><i class="fa fa-refresh" aria-hidden="true"></i><language showName="com.skyeye.refreshDataBtn"></language></button>
<button id="addBean" class="winui-toolbtn search-table-btn-right" auth="1559201340836"><i class="fa fa-plus" aria-hidden="true"></i><language showName="com.skyeye.addBtn"></language></button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
{{# if(d.state == 1||d.state == 3){ }}
{{# if(auth('1559267011961')){ }}
<a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="edit"><language showName="com.skyeye.editBtn"></language></a>
{{# } }}
{{# } }}
{{# if((d.state == 1||d.state == 3)&&(d.useNum==0)){ }}
{{# if(auth('1559267181326')){ }}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="delete"><language showName="com.skyeye.deleteBtn"></language></a>
{{# } }}
{{# } }}
{{# if(d.state == 1||d.state == 3){ }}
{{# if(auth('1559267156790')){ }}
<a class="layui-btn layui-btn-xs" lay-event="up">上线</a>
{{# } }}
{{# } }}
{{# if(d.state == 2){ }}
{{# if(auth('1559267166049')){ }}
<a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="down">下线</a>
{{# } }}
{{# } }}
{{# if(d.orderBy != 1 && auth('1559267212753')){ }}
<a class="layui-btn layui-btn-xs" lay-event="top">上移</a>
{{# } }}
{{# if(auth('1559267220792')){ }}
<a class="layui-btn layui-btn-xs" lay-event="lower">下移</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/lightAppType/'}).use('lightAppTypeList');
</script>
</body>
</html>
\ No newline at end of file
......@@ -424,6 +424,7 @@ var systemCommonUtil = {
initIconChooseHtml: function (showBoxId, form, colorpicker, uploadType) {
$("#" + showBoxId).html(systemCommonUtil.iconChooseHtml);
systemCommonUtil.initIconEvent(form, colorpicker, uploadType, "", "#1c97f5" , "#1c97f5");
form.render();
},
// 编辑时初始化html,并添加监听事件
initEditIconChooseHtml: function (showBoxId, form, colorpicker, uploadType, params) {
......@@ -460,6 +461,7 @@ var systemCommonUtil = {
$("#iconShow").parent().css({'background-color': params.iconBg});
}
systemCommonUtil.initIconEvent(form, colorpicker, uploadType, params.iconPic, params.iconBg, params.iconColor);
form.render();
},
initIconEvent: function (form, colorpicker, uploadType, uploadDefaultValue, iconBg, iconColor) {
// 初始化上传
......@@ -531,7 +533,11 @@ var systemCommonUtil = {
});
},
// 获取图标选中数据
getIconChoose: function (params) {
getIconChoose: function (inputParams) {
var params = {};
if (!isNull(inputParams)) {
params = inputParams;
}
params["iconChooseResult"] = true;
var iconType = $("input[name='iconType']:checked").val();
params["iconType"] = iconType;
......@@ -560,6 +566,9 @@ var systemCommonUtil = {
initIconShow: function (bean) {
var str = '';
if (bean.iconType == '1') {
if (isNull(bean.icon)) {
return str;
}
if (isNull(bean.iconBg)) {
str += '<div class="winui-icon winui-icon-font" style="text-align: center; overflow: hidden">';
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册