目前引入顺序:css文件 -> jquery.js - >baseSource.js
如:bool = true - > model小窗口,bool = false - >打开新页面
如:[“id”,“reqIp”]代表从ajax的返回值中取id和reqIp的值传给跳转的页面。
用于资源树形选择插件,由开发者自由配置
"Log": {
//table标识
"tableNameInit": "Log",//源样式名不可更改
//table标题
"tableTitleInit": ["序号", "创建时间", "参数", "操作IP", "操作人", "标识"],
//table标题对应后端返回的Key
"tableKeyListInit": ["id", "createTime", "dataText", "reqIp", "userId", "threadId"],
//最后一列是否有动作展示
"activeShowInit": false
}
"Log1": {
"tableNameInit": "Log1",
"tableTitleInit": ["序号", "创建时间", "参数", "操作IP", "操作人", "操作"],
"tableKeyListInit": ["id", "createTime", "dataText", "reqIp", "userId"],
"activeShowInit": true,//是否显示btn
"activeListInit": [{
"activeImgInit": "../images/xq1.png",
"activeTypeInit": "我是操作1",
"activeDescInit": "jumptest.html",//配置的跳转页面
"activeFromInit": true,//弹出|新建 页面
"activeValueInit": ["id", "reqIp"]
}
}
"SysOrgPosts": {
"tableNameInit": "SysOrgPosts",
"valueKeyInit": "postId",
"tableTitleInit": [" ", "岗位名称", "岗位下人员", "操作"],
"tableKeyListInit": [" ", "postName", "users"],
"activeShowInit": true,
"activeListInit": [{
"activeImgInit": "../images/xq1.png",
"activeTypeInit": "修改",
"activeDescInit": "jumptest.html",
"activeFromInit": false,
"activeValueInit": ["id", "reqIp"]
}
}
"selectTextTable": {
"tableNameInit": "selectTextTable",
"valueKeyInit": "postId",
"tableTitleInit": ["序号", "岗位名称", "岗位下人员", "操作"],
"tableKeyListInit": [" ", "postName", "users"],
"tableDispalyConfig": [{//表格单元格样式配置
"type": "text",//文本样式 没有点击事件
"actionUrl": "none",
"actionType": "none"
}, {
"type": "button",//按钮样式 有点击事件
"actionUrl": "temp.html",//点击事件调转连接
"actionType": "model"//页面跳转样式配置 model:弹窗
}, {
"type": "button",//按钮样式 有点击事件
"actionUrl": "temp.html",
"actionType": "_target"//页面跳转样式配置 _target:打开新窗口
}, {
"type": "text",
"actionUrl": "",
"actionType": ""
}],
"activeShowInit": true,
"activeListInit": [{
"activeImgInit": "../images/xq1.png",
"activeTypeInit": "修改",
"activeDescInit": "jumptest.html",
"activeFromInit": false,
"activeValueInit": ["id", "reqIp"]
}, {
"activeImgInit": "../images/xq2.png",
"activeTypeInit": "岗位人员管理",
"activeDescInit": "jumptest.html",
"activeFromInit": false,
"activeValueInit": ["createTime", "dataText"]
}]
},
<script type="text/javascript">
$(document).ready(function() {
appendTable($("#aDiv"), false, "../model/dataDemo.json", "get", {
id: 1
}, "Log1");
appendTable($("#sDiv"), false, "../model/sysOrig.json", "get", {
id: 1
}, "SysOrgPosts");
$("#selecteBtn").click(function() {
// 回调
$("#fDiv").empty();
$("#fDiv").append($("#sDiv").find(".cellSelected").clone(true));
var pararm = "";
for(var i = 0; i < $("#sDiv").find(".cellSelected").length; i++){
pararm+=","+$("#sDiv").find(".cellSelected").eq(i).data("postId");
}
alert(pararm.substr(1));
});
appendTable($("#selectTble"), false, "../model/sysOrig.json", "get", {
id: 1
}, "selectTextTable");
$("#fDiv").delegate(".cell", "click", function() {
alert(JSON.stringify($(this)) + " " + $(this).attr("class") + " " +
$(this).data("postId"));
$(this).remove();
});
});
</script>
<script type="text/javascript">
$(document).ready(function() {
//添加下拉框
addSelectNode($("#aDiv"), "../model/selectModels.json", "get", {}, "id", "text", function(result) {
alert("sendData :\n\n" + "type = " + typeof(result) + "\njsonText = " + JSON.stringify(result));
});
</script>
{
"status":"success",
"data":[
{
"id":1,//此处 "id" 对应sendykey
"text":"选项一"//此处 "text" 对应displaykey
},
Object{...},
Object{...},
Object{...},
Object{...}
]
}
//结合SVN中html文件demo-temp.html便于理解
//获取选择框默认值
$("#getSND").click(function() {
//方法: getSelectData(node, index)
var data = getSelectData($("#aDiv"), 0);
alert(JSON.stringify(data));
});
<script type="text/javascript">
$(document).ready(function() {
//添加树形下拉框
addSelectTreeNode($("#sDiv"), "../model/selectTreeNode.json", "get", {},
function(id) {
alert('id =' + id);
});
});
</script>
<script type="text/javascript">
function childCallBack() {
alert("保存时会调用model层的的函数");
}
function parentCallBack() {
window.parent.hideModelView(true);
}
</script>
<script type="text/javascript">
$(document).ready(function() {
//添加表格
appendTable($(".customTable"), false, "../model/dataDemo.json", "get", {
id: 1
}, "Log");
var node = $(".pageControl").find(".selectNode");
//添加下拉框
addSelectNode(node, "../model/pageContol.json", "get", {}, "id", "pageNumber", function(result) {
alert("sendData :\n\n" + "type = " + typeof(result) + "\njsonText = " + JSON.stringify(result));
});
//添加分页插件
//node, url, type, dataParament, displayNumber, callback
appendPageControl($(".pageControl"), "../model/dataDemo.json", "get", {
id: 1
}, 5, function(callbackData) {
alert("callbackData = " + callbackData);
});
});
</script>
{
"codeId":1,
"message":"success",
"data":{
"pageNum":1,//该key不可更改
"pageSize":2,
"total":174,//该key不可更改
"pages":87,//该key不可更改
"list":Array[7],
"isFirstPage":true,
"isLastPage":false
}
}
用于资源树形选择插件,由开发者自由配置
<body>
<div id="" style="margin-left: 100px;">
</div>
<div id="abtn" style="margin-top: 20px;border: 1px solid dodgerblue;width: 100%;text-align: center;margin-bottom: 50px;cursor: pointer;">
//点击获取页面数据
</div>
<script type="text/javascript">
//定义目标node
var node = $("body");
$(document).ready(function() {
appendResurceSelectNode($(node), '../model/demo-resourceTreeData.json', 'get', {}, 'id');
});
//获取页面参数方法
$("#abtn").click(function() {
//存放数据数组
var valueArr = [];
$.each($(".selectedSubcells"), function(i) {
var tempVlaue = $(".selectedSubcells").eq(i).data("id");
valueArr.push(tempVlaue);
});
//数组转字符串
var stringValue = valueArr.toString();
var jsonValue = $(node).find(".selectResourceTreeCell").data("value");
alert("vlaueArrary = " + stringValue + "\n\n jsonString = " + JSON.stringify(jsonValue));
});
</script>
</body>
{
"codeId":1,
"message":"success",
"data":{//该key不可更改
"treebo":[//该key不可更改
{
"id":1,
"parentId":null,
"name":"我的工作台",//该key不可更改
"iconPath":"/amidn/img",
"path":"/amidn/img",
"grade":1,//该key不可更改
"sn":1,
"createTime":"2017-08-31 11:36:35",
"updateTime":null,
"operator":null,
"struts":"1",//该key不可更改,选中:"1" 未选:"0"
"childOrgs":Array[3]
},
Object{...},
Object{...},
Object{...},
Object{...}
],
"sysrols":Array[1]//插件绑定数据
}
}
如:页面链接 xxxhtml?key=value
var value =GetRequest(key);
打开目录
维护信息
移动顶部