509 lines
21 KiB
Plaintext
509 lines
21 KiB
Plaintext
<!DOCTYPE html
|
||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
|
||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||
<script type="text/javascript">
|
||
/*** 上半部分 */
|
||
var show4SelectFun = function () {
|
||
$.post(ext.contextPath + '/base/basicComponents/show4Select.do', { formId: "basicComponentsForm", hiddenId: "pid", textId: "_pname" }, function (data) {
|
||
$("#basicComponents4SelectDiv").html(data);
|
||
openModal("basicComponents4SelectModal");
|
||
});
|
||
};
|
||
|
||
var floorTbName = "TB_doc_file";
|
||
var showUnit4SelectCopyFun = function () {
|
||
$.post(ext.contextPath + '/base/basicComponents/showUnit4Select_Limited.do', { formId: "basicComponentsForm", hiddenId: "copyId", textId: "copyName" }, function (data) {
|
||
$("#unit4SelectCopyDiv").html(data);
|
||
openModal("unit4SelectModal_Limited");
|
||
});
|
||
};
|
||
|
||
|
||
$("#basicComponentsForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
name: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '名称不能为空'
|
||
}
|
||
}
|
||
},
|
||
longitude: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '经度不能为空'
|
||
},
|
||
regexp: {
|
||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,10})$)|^([^0][0-9]+|0)$/,
|
||
message: '请输入正确的经度'
|
||
}
|
||
}
|
||
},
|
||
latitude: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '纬度不能为空'
|
||
},
|
||
regexp: {
|
||
regexp: /^(([^0][0-9]+|0)\.([0-9]{1,10})$)|^([^0][0-9]+|0)$/,
|
||
message: '请输入正确的纬度'
|
||
}
|
||
}
|
||
},
|
||
ename: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '英文编码不能为空'
|
||
}
|
||
}
|
||
},
|
||
morder: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '顺序不能为空'
|
||
},
|
||
regexp: {
|
||
regexp: /^[0-9]*$/,
|
||
message: '顺序必须为数字'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
function doSave() {
|
||
$("#basicComponentsForm").data('bootstrapValidator').resetForm();
|
||
$("#basicComponentsForm").bootstrapValidator('validate');//提交验证
|
||
if ($("#basicComponentsForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
|
||
$.post(ext.contextPath + "/base/basicComponents/update.do", $("#basicComponentsForm").serialize(), function (data) {
|
||
if (data.res == "1") {
|
||
initTreeView();
|
||
} else {
|
||
showAlert('d', '保存失败');
|
||
}
|
||
}, 'json');
|
||
}
|
||
}
|
||
|
||
function del() {
|
||
swal({
|
||
text: "您确定要删除此记录?",
|
||
dangerMode: true,
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
classname: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
classname: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(willDelete => {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/base/basicComponents/delete.do', $("#basicComponentsForm").serialize(), function (data) {
|
||
if (data.res > 0) {
|
||
showAlert('s', '删除成功');
|
||
initTreeView();
|
||
} else {
|
||
showAlert('d', '删除失败');
|
||
}
|
||
}, 'json');
|
||
}
|
||
});
|
||
}
|
||
|
||
//文件导入
|
||
var fileinput = function () {
|
||
//var url='/maintenance/updateProblemFile.do';//保存数据表方法
|
||
$.post(ext.contextPath + '/base/fileinput.do', { masterId: masterId, tbName: tbName, nameSpace: nameSpace }, function (data) {
|
||
$("#fileInputDiv").html(data);
|
||
openModal('fileInputModal');
|
||
});
|
||
};
|
||
var masterId = $('#id').val();
|
||
var tbName = 'TB_doc_file'; //数据表
|
||
var nameSpace = 'File';//保存文件夹
|
||
var previews = new Array();
|
||
var previewConfigs = new Array();
|
||
/* var student = {
|
||
"caption":"lilei",
|
||
|
||
}
|
||
previewConfigs[0]=student; */
|
||
//初始化fileinput控件(第一次初始化)
|
||
function showFileInput(ctrlName) {
|
||
var control = $('#' + ctrlName);
|
||
|
||
control.fileinput('destroy');
|
||
control.fileinput({
|
||
language: 'zh', //设置语言
|
||
showUpload: false, //是否显示上传按钮
|
||
showRemove: false,
|
||
showCaption: false,//是否显示标题
|
||
showBrowse: false,//选择按钮
|
||
showClose: false,//右上角关闭按钮
|
||
dropZoneEnabled: false,//是否显示拖拽区域
|
||
fileActionSettings: {
|
||
showDrag: false
|
||
},
|
||
browseClass: "btn btn-primary", //按钮样式
|
||
maxFileCount: 10, //表示允许同时上传的最大文件个数
|
||
enctype: 'multipart/form-data',
|
||
validateInitialCount: true,
|
||
previewFileIcon: "<i class='glyphicon glyphicon-king'></i>",
|
||
initialPreviewAsData: true,
|
||
initialPreview: previews,
|
||
initialPreviewConfig: previewConfigs,
|
||
layoutTemplates: {
|
||
actionUpload: ''
|
||
},
|
||
deleteUrl: ext.contextPath + "/base/deleteInputFile.do",
|
||
deleteExtraData: function () { //传参
|
||
var data = {
|
||
"tbName": tbName
|
||
};
|
||
return data;
|
||
}
|
||
});
|
||
$('#kvFileinputModal').on("hidden.bs.modal", function () {
|
||
$(this).removeData("bs.modal");
|
||
//modal重复打开会导致前面的滚动条失去作用
|
||
$('.modal').css("overflow", "auto");
|
||
});
|
||
}
|
||
//名称定义不可修改
|
||
var getFileList = function () {
|
||
$.post(ext.contextPath + '/base/getInputFileList.do', { masterId: masterId, tbName: tbName }, function (data) {
|
||
//console.info(data)
|
||
previews = new Array();
|
||
|
||
for (var i = 0; i < data.length; i++) {
|
||
var path = data[i].abspath;
|
||
path = path.substring(path.indexOf('webapps') + 7, path.length);
|
||
path = ext.basePath.replace(ext.contextPath, '') + path.replace(/\\/g, "\/");;
|
||
if (data[i].type.indexOf("audio") != -1) {
|
||
var id = data[i].id;
|
||
var blob = path;
|
||
//console.info(blob)
|
||
if ($("#" + id).length > 0) {
|
||
continue;
|
||
}
|
||
recblob[id] = { blob: blob, rec: rec };
|
||
|
||
reclog('<div class="form-group" id=' + id + '> ' + data[i].insdt.substring(0, 16) + '录制 ' +
|
||
'<div class="btn-group">' +
|
||
'<button class="btn btn-primary btn-sm" onclick="recplay(\'' + id + '\')" type="button"><i class="fa fa-play " ></i></button>' +
|
||
'<button class="btn btn-danger btn-sm" onclick="deleteFIleInput(\'' + id + '\')" type="button"><i class="fa fa-remove "></i></button>' +
|
||
'</div>' +
|
||
'</div>');
|
||
} else {
|
||
var previewConfig = new Object();
|
||
|
||
previews.push(path);
|
||
previewConfig['width'] = '50px';
|
||
previewConfig['caption'] = data[i].filename;
|
||
previewConfig['key'] = data[i].id;
|
||
previewConfigs.push(previewConfig);
|
||
}
|
||
|
||
}
|
||
if (previews.length > 0) {
|
||
$('#basicComponentsfile').show();
|
||
showFileInput("basicComponentsfile");
|
||
} else {
|
||
$('#basicComponentsfile').hide();
|
||
}
|
||
|
||
}, 'json');
|
||
|
||
};
|
||
|
||
/*** 下半部分 */
|
||
var addUserFun = function () {
|
||
$.post(ext.contextPath + '/base/basicComponents/addUser.do', {}, function (data) {
|
||
$("#userDiv").html(data + "<div id='unit4SelectDiv'></div> ");
|
||
openModal('subModal');
|
||
});
|
||
};
|
||
|
||
var delUserFun = function () {
|
||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||
var datas = "";
|
||
$.each(checkedItems, function (index, item) {
|
||
datas += item.id + ",";
|
||
});
|
||
if (datas == "") {
|
||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||
} else {
|
||
swal({
|
||
text: "您确定要禁用这些用户吗?",
|
||
dangerMode: true,
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
classname: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
classname: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(willDelete => {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/base/basicComponents/deleteUsers.do', { ids: datas }, function (data) {
|
||
if (data > 0) {
|
||
$("#table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '禁用失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
}
|
||
};
|
||
|
||
var editUserFun = function (id) {
|
||
$.post(ext.contextPath + '/base/basicComponents/editUser.do', { id: id }, function (data) {
|
||
$("#userDiv").html(data);
|
||
openModal('subModal');
|
||
});
|
||
};
|
||
|
||
//重置密码
|
||
var pwdFun = function (id) {
|
||
swal({
|
||
text: "您确定要重置密码吗?",
|
||
dangerMode: true,
|
||
buttons: {
|
||
cancel: {
|
||
text: "取消",
|
||
value: null,
|
||
visible: true,
|
||
classname: "btn btn-default btn-sm",
|
||
closeModal: true,
|
||
},
|
||
confirm: {
|
||
text: "确定",
|
||
value: true,
|
||
visible: true,
|
||
classname: "btn btn-danger btn-sm",
|
||
closeModal: true
|
||
}
|
||
}
|
||
})
|
||
.then(willDelete => {
|
||
if (willDelete) {
|
||
$.post(ext.contextPath + '/base/basicComponents/resetPassword.do', { id: id }, function (data) {
|
||
if (data == 1) {
|
||
showAlert('s', '重置成功', 'mainAlertdiv');
|
||
$("#table").bootstrapTable('refresh');
|
||
} else {
|
||
showAlert('d', '重置失败', 'mainAlertdiv');
|
||
}
|
||
});
|
||
|
||
}
|
||
});
|
||
};
|
||
|
||
$("#copyPatrolForm").bootstrapValidator({
|
||
live: 'disabled',//验证时机,enabled是内容有变化就验证(默认),disabled和submitted是提交再验证
|
||
fields: {
|
||
copyName: {
|
||
validators: {
|
||
notEmpty: {
|
||
message: '复制模板不能为空'
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
|
||
$(function () {
|
||
$("#active").select2({ minimumResultsForSearch: 10 }).val("${basicComponents.active}").trigger("change");
|
||
fixSelect2ToForm("active");
|
||
$("#table").bootstrapTable({ // 对应table标签的id
|
||
url: ext.contextPath + '/base/basicConfigure/getlist.do', // 获取表格数据的url
|
||
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
|
||
striped: true, //表格显示条纹,默认为false
|
||
pagination: true, // 在表格底部显示分页组件,默认false
|
||
pageList: [10, 20, 50], // 设置页面可以显示的数据条数
|
||
pageSize: 50, // 页面数据条数
|
||
pageNumber: 1, // 首页页码
|
||
sidePagination: 'server', // 设置为服务器端分页
|
||
queryParams: function (params) { // 请求服务器数据时发送的参数,可以在这里添加额外的查询参数,返回false则终止请求
|
||
return {
|
||
rows: params.limit, // 每页要显示的数据条数
|
||
page: params.offset / params.limit + 1, // 每页显示数据的开始页码
|
||
sort: params.sort, // 要排序的字段
|
||
order: params.order, // 排序规则
|
||
pid:'${basicComponents.id}'
|
||
}
|
||
},
|
||
sortName: 'id', // 要排序的字段
|
||
sortOrder: 'desc', // 排序规则
|
||
columns: [/*{
|
||
checkbox: true, // 显示一个勾选框
|
||
},*/
|
||
{
|
||
field: 'name', // 返回json数据中的name
|
||
title: '名称', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
}, {
|
||
field: '_pname', // 返回json数据中的name
|
||
title: '上级', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle' // 上下居中
|
||
}, {
|
||
field: 'type', // 返回json数据中的name
|
||
title: '形式', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle', // 上下居中
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case 'file':
|
||
return '附件';
|
||
case 'text':
|
||
return '文字';
|
||
default:
|
||
return '';
|
||
}
|
||
}
|
||
}, {
|
||
field: 'active', // 返回json数据中的name
|
||
title: '状态', // 表格表头显示文字
|
||
align: 'center', // 左右居中
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
switch (value) {
|
||
case '0':
|
||
return '禁用';
|
||
case '1':
|
||
return '启用';
|
||
default:
|
||
return '';
|
||
}
|
||
}
|
||
},{
|
||
title: "操作",
|
||
align: 'center',
|
||
valign: 'middle',
|
||
formatter: function (value, row, index) {
|
||
var str = '';
|
||
str+='<button class="btn btn-default btn-sm" title="编辑" onclick="editConfigureFun(\'' + row.id + '\')"><i class="fa fa-edit"></i></button>';
|
||
str+='<button class="btn btn-default btn-sm" title="启用" onclick="useConfigureFun(\'' + row.id + '\')"><i class="fa fa-repeat"></i></button>';
|
||
str='<div class="btn-group" >'+str+'</div>';
|
||
return str;
|
||
}
|
||
}
|
||
],
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
$(".bs-checkbox").css({ 'text-align': 'center', 'vertical-align': 'middle' })
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.info("加载数据失败");
|
||
}
|
||
});
|
||
getFileList();
|
||
|
||
});
|
||
</script>
|
||
<div class="box box-primary">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">详情</h3>
|
||
|
||
<div class="box-tools pull-right">
|
||
<a onclick="doSave()" class="btn btn-box-tool" data-toggle="tooltip" title="保存"><i
|
||
class="glyphicon glyphicon-floppy-disk"></i></a>
|
||
<security:authorize buttonUrl="user/delete.do">
|
||
<a onclick="del()" class="btn btn-box-tool" data-toggle="tooltip" title="删除"><i
|
||
class="glyphicon glyphicon-trash"></i></a>
|
||
</security:authorize>
|
||
</div>
|
||
</div>
|
||
<!-- /.box-header -->
|
||
<div class="box-body ">
|
||
<form class="form-horizontal " id="basicComponentsForm">
|
||
<input id="id" name="id" type="hidden" value="${basicComponents.id}" />
|
||
<!-- 界面提醒div强制id为alertDiv -->
|
||
<div id="alertDiv"></div>
|
||
<div id="basicComponents4SelectDiv"></div>
|
||
<div id="unit4SelectCopyDiv"></div>
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*名称</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="name" name="name" placeholder="名称"
|
||
style="border-radius:4px" value="${basicComponents.name }">
|
||
</div>
|
||
<label class="col-sm-2 control-label">*上级</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="_pname" name="_pname" placeholder="上级"
|
||
style="border-radius:4px;background-color: white;" onclick="show4SelectFun();"
|
||
value="${pname}" readonly>
|
||
<input id="pid" name="pid" type="hidden" value="${basicComponents.pid}" />
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*ID编码</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="code" name=""code"" placeholder="ID编码"
|
||
style="border-radius:4px" value="${basicComponents.code}">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-group">
|
||
<label class="col-sm-2 control-label">*顺序</label>
|
||
<div class="col-sm-4">
|
||
<input type="text" class="form-control" id="morder" name="morder" placeholder="顺序"
|
||
style="border-radius:4px" value="${basicComponents.morder}">
|
||
</div>
|
||
<security:authorize buttonUrl="user/delete.do">
|
||
<label class="col-sm-2 control-label">启用</label>
|
||
<div class="col-sm-4">
|
||
<select id="active" name="active" class="form-control select2">
|
||
<option value="1">启用</option>
|
||
<option value="0">禁用</option>
|
||
</select>
|
||
</div>
|
||
</security:authorize>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<div class="box box-solid">
|
||
<div class="box-header with-border">
|
||
<h3 class="box-title">配置内容</h3>
|
||
<div class="box-tools pull-right">
|
||
</div>
|
||
</div>
|
||
<!-- /.box-header -->
|
||
<div class="box-body ">
|
||
<div>
|
||
<div id="alertDiv_user"></div>
|
||
<div id="userDiv"></div>
|
||
<div id="user4SelectDiv_func"></div>
|
||
<br>
|
||
<table id="table"></table>
|
||
</div>
|
||
</div>
|
||
</div> |