mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-07-15 14:04:41 +08:00
分离用户JS与系统JS
This commit is contained in:
parent
ae79e59d48
commit
54fb980b07
@ -181,9 +181,8 @@
|
||||
<Content Include="images\login\logo.png" />
|
||||
<Content Include="images\login\right_hand.png" />
|
||||
<Content Include="images\login\tou.png" />
|
||||
<Content Include="js\categories.js" />
|
||||
<Content Include="js\assign.js" />
|
||||
<Content Include="js\forms.js" />
|
||||
<Content Include="userJs\categories.js" />
|
||||
<Content Include="userJs\assign.js" />
|
||||
<Content Include="js\openauth.js" />
|
||||
<Content Include="js\droptree.js" />
|
||||
<Content Include="css\images.css" />
|
||||
@ -208,10 +207,10 @@
|
||||
<Content Include="images\userface4.jpg" />
|
||||
<Content Include="images\userface5.jpg" />
|
||||
<Content Include="images\wechat.jpg" />
|
||||
<Content Include="js\modules.js" />
|
||||
<Content Include="userJs\modules.js" />
|
||||
<Content Include="js\queryString.js" />
|
||||
<Content Include="js\orgs.js" />
|
||||
<Content Include="js\roles.js" />
|
||||
<Content Include="userJs\orgs.js" />
|
||||
<Content Include="userJs\roles.js" />
|
||||
<Content Include="js\ueditor\dialogs\anchor\anchor.html" />
|
||||
<Content Include="js\ueditor\dialogs\attachment\attachment.css" />
|
||||
<Content Include="js\ueditor\dialogs\attachment\attachment.html" />
|
||||
@ -466,12 +465,12 @@
|
||||
<Content Include="js\ueditor\ueditor.config.js" />
|
||||
<Content Include="js\ueditor\ueditor.parse.js" />
|
||||
<Content Include="js\ueditor\ueditor.parse.min.js" />
|
||||
<Content Include="js\users.js" />
|
||||
<Content Include="userJs\users.js" />
|
||||
<Content Include="js\bodyTab.js" />
|
||||
<Content Include="js\index.js" />
|
||||
<Content Include="js\leftNav.js" />
|
||||
<Content Include="js\login.js" />
|
||||
<Content Include="js\main.js" />
|
||||
<Content Include="userJs\login.js" />
|
||||
<Content Include="userJs\main.js" />
|
||||
<Content Include="js\vue.js" />
|
||||
<Content Include="layui\css\layui.css" />
|
||||
<Content Include="layui\css\layui.mobile.css" />
|
||||
|
@ -78,4 +78,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/categories.js"></script>
|
||||
<script type="text/javascript" src="/userJs/categories.js"></script>
|
@ -18,19 +18,11 @@
|
||||
<th lay-data="{field:'Name', width:150}">表单名称</th>
|
||||
<th lay-data="{field:'Fields', width:150}">字段个数</th>
|
||||
<th lay-data="{field:'ContentData', width:150}">表单中的字段数据</th>
|
||||
<th lay-data="{field:'ContentParse', width:150}">表单替换的模板 经过处理</th>
|
||||
<th lay-data="{field:'Content', width:150}">表单原html模板未经处理的</th>
|
||||
<th lay-data="{field:'SortCode', width:150}">排序码</th>
|
||||
<th lay-data="{field:'Delete', width:150}">删除标记</th>
|
||||
<th lay-data="{field:'FrmDbId', width:150}">数据库Id</th>
|
||||
<th lay-data="{field:'FrmDbId', width:150}">关联的数据库</th>
|
||||
<th lay-data="{field:'Enabled', width:150}">有效</th>
|
||||
<th lay-data="{field:'Description', width:150}">备注</th>
|
||||
<th lay-data="{field:'CreateDate', width:150}">创建时间</th>
|
||||
<th lay-data="{field:'CreateUserId', width:150}">创建用户主键</th>
|
||||
<th lay-data="{field:'CreateUserName', width:150}">创建用户</th>
|
||||
<th lay-data="{field:'ModifyDate', width:150}">修改时间</th>
|
||||
<th lay-data="{field:'ModifyUserId', width:150}">修改用户主键</th>
|
||||
<th lay-data="{field:'ModifyUserName', width:150}">修改用户</th>
|
||||
<th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#barList'}"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -41,10 +33,11 @@
|
||||
</script>
|
||||
|
||||
<!--用户添加/编辑窗口-->
|
||||
<div id="divEdit" style="display: none">
|
||||
<div id="divEdit" style="display: none">
|
||||
<form class="layui-form" action="" id="formEdit">
|
||||
<input type="hidden" name="Id" v-model="Id" />
|
||||
<input type="hidden" name="Fields" id="Fields" value="0">
|
||||
|
||||
<div class="layui-row">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="tab">
|
||||
<ul class="layui-tab-title">
|
||||
@ -62,7 +55,7 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">关联数据表名称</label>
|
||||
<label class="layui-form-label">关联数据表名称【英文】</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="FrmDbId" v-model="FrmDbId" required lay-verify="required"
|
||||
placeholder="关联数据表名称" autocomplete="off" class="layui-input">
|
||||
@ -72,12 +65,10 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="SortCode" value="1" title="value1" checked>
|
||||
<input type="radio" name="SortCode" value="0" title="value2">
|
||||
<input type="text" name="SortCode" value="1" v-model="SortCode" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">备注</label>
|
||||
<div class="layui-input-block">
|
||||
@ -103,15 +94,13 @@
|
||||
</div>
|
||||
<div class="layui-col-xs9">
|
||||
<script id="myFormDesign" type="text/plain" style="width:100%;">
|
||||
<input style="text-align: left; width: 150px;" title="文本框" value="OpenAuth.Net"
|
||||
name="leipiNewField" orgheight="" orgwidth="150" orgalign="left"
|
||||
orgfontsize="" orghide="0" leipiplugins="text" orgtype="text" />
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-row">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
|
||||
|
@ -118,7 +118,7 @@ tpwidget("init", {
|
||||
</div>
|
||||
<!-- 底部 -->
|
||||
<div class="layui-footer footer">
|
||||
<p>copyright @@2017 yubaolee <a onclick="donation()" class="layui-btn layui-btn-danger l·ayui-btn-small">捐赠作者</a></p>
|
||||
<p>copyright @@2018 yubaolee <a onclick="donation()" class="layui-btn layui-btn-danger l·ayui-btn-small">捐赠作者</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -140,4 +140,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/main.js"></script>
|
||||
<script type="text/javascript" src="/userJs/main.js"></script>
|
||||
|
@ -66,8 +66,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="loginbm">版权所有 2017 李玉宝 </div>
|
||||
<div class="loginbm">版权所有 2018 李玉宝 </div>
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/login.js"></script>
|
||||
<script type="text/javascript" src="/userJs/login.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -10,4 +10,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/assign.js"></script>
|
||||
<script type="text/javascript" src="/userJs/assign.js"></script>
|
@ -170,4 +170,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/modules.js"></script>
|
||||
<script type="text/javascript" src="/userJs/modules.js"></script>
|
@ -72,4 +72,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/orgs.js"></script>
|
||||
<script type="text/javascript" src="/userJs/orgs.js"></script>
|
@ -65,4 +65,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/roles.js"></script>
|
||||
<script type="text/javascript" src="/userJs/roles.js"></script>
|
@ -83,4 +83,4 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="/layui/layui.js"></script>
|
||||
<script type="text/javascript" src="/js/users.js"></script>
|
||||
<script type="text/javascript" src="/userJs/users.js"></script>
|
158
OpenAuth.Mvc/userJs/assign.js
Normal file
158
OpenAuth.Mvc/userJs/assign.js
Normal file
@ -0,0 +1,158 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery','queryString'], function () {
|
||||
var //layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var id = $.getUrlParam("id"); //待分配的id
|
||||
var type = $.getUrlParam("type"); //待分配的类型
|
||||
var menuType = $.getUrlParam("menuType"); //待分配菜单的类型
|
||||
|
||||
//菜单列表
|
||||
var menucon = {}; //table的参数,如搜索key,点击tree的id
|
||||
//菜单树状列表,等lay table没问题了,可以换成table
|
||||
var menutree = function () {
|
||||
var url = '/ModuleManager/LoadMenus';
|
||||
var menuTree;
|
||||
var setting = {
|
||||
view: { selectedMulti: true },
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox",
|
||||
chkboxType: { "Y": "", "N": "" } //去掉勾选时级联
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
//
|
||||
},
|
||||
onCheck: function (event, treeId, treeNode) {
|
||||
var url = "/RelevanceManager/Assign";
|
||||
if (!treeNode.checked) {
|
||||
url = "/RelevanceManager/UnAssign";
|
||||
}
|
||||
|
||||
$.post(url, { type: menuType, firstId: id, secIds: [treeNode.Id] }
|
||||
, function (data) {
|
||||
layer.msg(data.Message);
|
||||
}
|
||||
, "json");
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(menucon, options);
|
||||
}
|
||||
|
||||
$.getJSON(url, menucon, function (json) {
|
||||
menuTree = $.fn.zTree.init($("#menutree"), setting);
|
||||
menuTree.addNodes(null, json.data);
|
||||
//如果该用户已经分配菜单了,则设置相应的状态
|
||||
var url = "/ModuleManager/LoadMenusForUser";
|
||||
if (type.indexOf("Role") != -1) {
|
||||
url = "/ModuleManager/LoadMenusForRole";
|
||||
}
|
||||
$.getJSON(url,
|
||||
{
|
||||
firstId: id
|
||||
, moduleId: options.moduleId
|
||||
}
|
||||
, function (data) {
|
||||
$.each(data,
|
||||
function (i) {
|
||||
var that = this;
|
||||
var node = menuTree.getNodeByParam("Id", that.Id, null);
|
||||
menuTree.checkNode(node, true, false);
|
||||
});
|
||||
});
|
||||
menuTree.expandAll(true);
|
||||
});
|
||||
};
|
||||
return {
|
||||
load: load
|
||||
}
|
||||
}();
|
||||
|
||||
//模块列表
|
||||
var ztree = function () {
|
||||
var url = '/UserSession/QueryModuleList';
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: { selectedMulti: true },
|
||||
check: {
|
||||
enable: true,
|
||||
chkStyle: "checkbox",
|
||||
chkboxType: { "Y": "", "N": "" } //去掉勾选时级联
|
||||
},
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
menutree.load({ moduleId: treeNode.Id });
|
||||
},
|
||||
onCheck: function (event, treeId, treeNode) {
|
||||
var url = "/RelevanceManager/Assign";
|
||||
if (!treeNode.checked) {
|
||||
url = "/RelevanceManager/UnAssign";
|
||||
}
|
||||
|
||||
$.post(url, { type: type, firstId: id, secIds: [treeNode.Id] }
|
||||
, function (data) {
|
||||
layer.msg(data.Message);
|
||||
}
|
||||
, "json");
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function () {
|
||||
$.getJSON(url, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||
zTreeObj.addNodes(null, json);
|
||||
//如果该用户已经分配模块了,则设置相应的状态
|
||||
var url = "/ModuleManager/LoadForUser";
|
||||
if (type.indexOf("Role") != -1) {
|
||||
url = "/ModuleManager/LoadForRole";
|
||||
}
|
||||
$.getJSON(url, { firstId: id }
|
||||
, function (data) {
|
||||
$.each(data,
|
||||
function(i) {
|
||||
var that = this;
|
||||
var node = zTreeObj.getNodeByParam("Id", that.Id, null);
|
||||
zTreeObj.checkNode(node, true, false);
|
||||
});
|
||||
});
|
||||
$("#menutree").html("点击左边的模块开始分配菜单");
|
||||
// menutree.load({ moduleId: json[0].Id });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
load();
|
||||
return {
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
//监听页面主按钮操作 end
|
||||
})
|
154
OpenAuth.Mvc/userJs/categories.js
Normal file
154
OpenAuth.Mvc/userJs/categories.js
Normal file
@ -0,0 +1,154 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||
var form = layui.form,
|
||||
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
layui.droptree("/Categories/AllTypes", "#TypeName", "#TypeId", false);
|
||||
|
||||
//主列表加载,可反复调用进行刷新
|
||||
var config= {}; //table的参数,如搜索key,点击tree的id
|
||||
var mainList = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(config, options);
|
||||
}
|
||||
table.reload('mainList', {
|
||||
url: '/Categories/All',
|
||||
where: config
|
||||
});
|
||||
}
|
||||
//左边树状机构列表
|
||||
var ztree = function () {
|
||||
var url = '/Categories/AllTypes';
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
mainList({ typeId: treeNode.Id });
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function () {
|
||||
$.getJSON(url, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||
zTreeObj.addNodes(null, json);
|
||||
mainList({ typeId: "" });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
load();
|
||||
return {
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function() {
|
||||
var vm = new Vue({
|
||||
el: "#formEdit"
|
||||
});
|
||||
var update = false; //是否为更新
|
||||
var show = function (data) {
|
||||
var title = update ? "编辑信息" : "添加";
|
||||
layer.open({
|
||||
title: title,
|
||||
area: ["500px", "400px"],
|
||||
type: 1,
|
||||
content: $('#divEdit'),
|
||||
success: function() {
|
||||
vm.$set('$data', data);
|
||||
},
|
||||
end: mainList
|
||||
});
|
||||
var url = "/Categories/Add";
|
||||
if (update) {
|
||||
url = "/Categories/Update"; //暂时和添加一个地址
|
||||
}
|
||||
//提交数据
|
||||
form.on('submit(formSubmit)',
|
||||
function(data) {
|
||||
$.post(url,
|
||||
data.field,
|
||||
function(data) {
|
||||
layer.msg(data.Message);
|
||||
},
|
||||
"json");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function() { //弹出添加
|
||||
update = false;
|
||||
show({
|
||||
Id: ''
|
||||
});
|
||||
},
|
||||
update: function(data) { //弹出编辑框
|
||||
update = true;
|
||||
show(data);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//监听表格内部按钮
|
||||
table.on('tool(list)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'detail') { //查看
|
||||
layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听页面主按钮操作
|
||||
var active = {
|
||||
btnDel: function () { //批量删除
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/Categories/Delete",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
mainList);
|
||||
}
|
||||
, btnAdd: function () { //添加
|
||||
editDlg.add();
|
||||
}
|
||||
, btnEdit: function () { //编辑
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择编辑的行,且同时只能编辑一行");
|
||||
return;
|
||||
}
|
||||
editDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, search: function () { //搜索
|
||||
mainList({ key: $('#key').val() });
|
||||
}
|
||||
, btnRefresh: function() {
|
||||
mainList();
|
||||
}
|
||||
};
|
||||
|
||||
$('.toolList .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
//监听页面主按钮操作 end
|
||||
})
|
92
OpenAuth.Mvc/userJs/login.js
Normal file
92
OpenAuth.Mvc/userJs/login.js
Normal file
@ -0,0 +1,92 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form', 'layer'], function () {
|
||||
var form = layui.form,
|
||||
layer = parent.layer === undefined ? layui.layer : parent.layer,
|
||||
$ = layui.jquery;
|
||||
|
||||
// Cloud Float...
|
||||
var $main = $cloud = mainwidth = null;
|
||||
var offset1 = 450;
|
||||
var offset2 = 0;
|
||||
var offsetbg = 0;
|
||||
|
||||
$(document).ready(
|
||||
function () {
|
||||
$main = $("#mainBody");
|
||||
$body = $("body");
|
||||
$cloud1 = $("#cloud1");
|
||||
$cloud2 = $("#cloud2");
|
||||
|
||||
mainwidth = $main.outerWidth();
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
setInterval(function flutter() {
|
||||
if (offset1 >= mainwidth) {
|
||||
offset1 = -580;
|
||||
}
|
||||
|
||||
if (offset2 >= mainwidth) {
|
||||
offset2 = -580;
|
||||
}
|
||||
|
||||
offset1 += 1.1;
|
||||
offset2 += 1;
|
||||
$cloud1.css("background-position", offset1 + "px 100px")
|
||||
|
||||
$cloud2.css("background-position", offset2 + "px 460px")
|
||||
}, 70);
|
||||
setInterval(function bg() {
|
||||
if (offsetbg >= mainwidth) {
|
||||
offsetbg = -580;
|
||||
}
|
||||
|
||||
offsetbg += 0.9;
|
||||
$body.css("background-position", -offsetbg + "px 0")
|
||||
}, 90);
|
||||
$(function () {
|
||||
//得到焦点
|
||||
$("#password").focus(function () {
|
||||
$("#left_hand").animate({
|
||||
left: "150",
|
||||
top: " -38"
|
||||
}, {
|
||||
step: function () {
|
||||
if (parseInt($("#left_hand").css("left")) > 140) {
|
||||
$("#left_hand").attr("class", "left_hand");
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
$("#right_hand").animate({
|
||||
right: "-64",
|
||||
top: "-38px"
|
||||
}, {
|
||||
step: function () {
|
||||
if (parseInt($("#right_hand").css("right")) > -70) {
|
||||
$("#right_hand").attr("class", "right_hand");
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
//失去焦点
|
||||
$("#password").blur(function () {
|
||||
$("#left_hand").attr("class", "initial_left_hand");
|
||||
$("#left_hand").attr("style", "left:100px;top:-12px;");
|
||||
$("#right_hand").attr("class", "initial_right_hand");
|
||||
$("#right_hand").attr("style", "right:-112px;top:-12px");
|
||||
});
|
||||
|
||||
$('.loginbox').css({ 'position': 'absolute', 'left': ($(window).width() - 692) / 2 });
|
||||
$(window).resize(function () {
|
||||
$('.loginbox').css({ 'position': 'absolute', 'left': ($(window).width() - 692) / 2 });
|
||||
})
|
||||
});
|
||||
|
||||
//登录按钮事件
|
||||
form.on("submit(login)", function (data) {
|
||||
window.location.href = "/Login/LoginByDev";
|
||||
return false;
|
||||
})
|
||||
})
|
89
OpenAuth.Mvc/userJs/main.js
Normal file
89
OpenAuth.Mvc/userJs/main.js
Normal file
@ -0,0 +1,89 @@
|
||||
layui.config({
|
||||
base : "/js/"
|
||||
}).use(['form','element','layer','jquery'],function(){
|
||||
var form = layui.form,
|
||||
layer = parent.layer === undefined ? layui.layer : parent.layer,
|
||||
element = layui.element,
|
||||
$ = layui.jquery;
|
||||
|
||||
$(".panel a").on("click",function(){
|
||||
window.parent.addTab($(this));
|
||||
})
|
||||
|
||||
//动态获取文章总数和待审核文章数量,最新文章
|
||||
$.get("/json/newsList.json",
|
||||
function(data){
|
||||
var waitNews = [];
|
||||
$(".allNews span").text(data.length); //文章总数
|
||||
for(var i=0;i<data.length;i++){
|
||||
var newsStr = data[i];
|
||||
if(newsStr["newsStatus"] == "待审核"){
|
||||
waitNews.push(newsStr);
|
||||
}
|
||||
}
|
||||
$(".waitNews span").text(waitNews.length); //待审核文章
|
||||
}
|
||||
)
|
||||
|
||||
//图片总数
|
||||
$.get("/json/images.json",
|
||||
function(data){
|
||||
$(".imgAll span").text(data.length);
|
||||
}
|
||||
)
|
||||
|
||||
//用户数
|
||||
$.getJSON("/UserManager/Load?limit=1&page=1",
|
||||
function(data){
|
||||
$(".userAll span").text(data.count);
|
||||
}
|
||||
)
|
||||
|
||||
//新消息
|
||||
$.get("/json/message.json",
|
||||
function(data){
|
||||
$(".newMessage span").text(data.length);
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
//数字格式化
|
||||
$(".panel span").each(function(){
|
||||
$(this).html($(this).text()>9999 ? ($(this).text()/10000).toFixed(2) + "<em>万</em>" : $(this).text());
|
||||
})
|
||||
|
||||
//系统基本参数
|
||||
if(window.sessionStorage.getItem("systemParameter")){
|
||||
var systemParameter = JSON.parse(window.sessionStorage.getItem("systemParameter"));
|
||||
fillParameter(systemParameter);
|
||||
}else{
|
||||
$.ajax({
|
||||
url : "/json/systemParameter.json",
|
||||
type : "get",
|
||||
dataType : "json",
|
||||
success : function(data){
|
||||
fillParameter(data);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//填充数据方法
|
||||
function fillParameter(data){
|
||||
//判断字段数据是否存在
|
||||
function nullData(data){
|
||||
if(data == '' || data == "undefined"){
|
||||
return "未定义";
|
||||
}else{
|
||||
return data;
|
||||
}
|
||||
}
|
||||
$(".version").text(nullData(data.version)); //当前版本
|
||||
$(".author").text(nullData(data.author)); //开发作者
|
||||
$(".homePage").text(nullData(data.homePage)); //网站首页
|
||||
$(".server").text(nullData(data.server)); //服务器环境
|
||||
$(".dataBase").text(nullData(data.dataBase)); //数据库版本
|
||||
$(".maxUpload").text(nullData(data.maxUpload)); //最大上传限制
|
||||
$(".userRights").text(nullData(data.userRights));//当前用户权限
|
||||
}
|
||||
|
||||
})
|
249
OpenAuth.Mvc/userJs/modules.js
Normal file
249
OpenAuth.Mvc/userJs/modules.js
Normal file
@ -0,0 +1,249 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||
var form = layui.form,
|
||||
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
layui.droptree("/UserSession/QueryModuleList", "#ParentName", "#ParentId", false);
|
||||
|
||||
//主列表加载,可反复调用进行刷新
|
||||
var config= {}; //table的参数,如搜索key,点击tree的id
|
||||
var mainList = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(config, options);
|
||||
}
|
||||
table.reload('mainList', {
|
||||
url: '/UserSession/GetModules',
|
||||
where: config
|
||||
});
|
||||
}
|
||||
|
||||
//菜单列表
|
||||
var menucon = {}; //table的参数,如搜索key,点击tree的id
|
||||
var menuList = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(menucon, options);
|
||||
}
|
||||
table.reload('menuList', {
|
||||
url: '/ModuleManager/LoadMenus',
|
||||
where: menucon
|
||||
});
|
||||
}
|
||||
|
||||
//左边树状机构列表
|
||||
var ztree = function () {
|
||||
var url = '/UserSession/QueryModuleList';
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
mainList({ pId: treeNode.Id });
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function () {
|
||||
$.getJSON(url, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||
var newNode = { Name: "根节点", Id: null, ParentId: "" };
|
||||
json.push(newNode);
|
||||
zTreeObj.addNodes(null, json);
|
||||
mainList({ pId: "" });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
load();
|
||||
return {
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
|
||||
//添加(编辑)模块对话框
|
||||
var editDlg = function() {
|
||||
var vm = new Vue({
|
||||
el: "#formEdit"
|
||||
});
|
||||
var update = false; //是否为更新
|
||||
var show = function (data) {
|
||||
var title = update ? "编辑信息" : "添加";
|
||||
layer.open({
|
||||
title: title,
|
||||
area: ["500px", "400px"],
|
||||
type: 1,
|
||||
content: $('#divEdit'),
|
||||
success: function() {
|
||||
vm.$set('$data', data);
|
||||
},
|
||||
end: mainList
|
||||
});
|
||||
var url = "/moduleManager/Add";
|
||||
if (update) {
|
||||
url = "/moduleManager/Update";
|
||||
}
|
||||
//提交数据
|
||||
form.on('submit(formSubmit)',
|
||||
function(data) {
|
||||
$.post(url,
|
||||
data.field,
|
||||
function(data) {
|
||||
layer.msg(data.Message);
|
||||
},
|
||||
"json");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function() { //弹出添加
|
||||
update = false;
|
||||
show({
|
||||
Id: "",
|
||||
SortNo:1
|
||||
});
|
||||
},
|
||||
update: function(data) { //弹出编辑框
|
||||
update = true;
|
||||
show(data);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//添加菜单对话框
|
||||
var meditDlg = function () {
|
||||
var vm = new Vue({
|
||||
el: "#mfromEdit"
|
||||
});
|
||||
var update = false; //是否为更新
|
||||
var show = function (data) {
|
||||
var title = update ? "编辑信息" : "添加";
|
||||
layer.open({
|
||||
title: title,
|
||||
area: ["500px", "400px"],
|
||||
type: 1,
|
||||
content: $('#divMenuEdit'),
|
||||
success: function () {
|
||||
vm.$set('$data', data);
|
||||
},
|
||||
end: menuList
|
||||
});
|
||||
var url = "/moduleManager/AddMenu";
|
||||
if (update) {
|
||||
url = "/moduleManager/UpdateMenu";
|
||||
}
|
||||
//提交数据
|
||||
form.on('submit(mformSubmit)',
|
||||
function (data) {
|
||||
$.post(url,
|
||||
data.field,
|
||||
function (data) {
|
||||
layer.msg(data.Message);
|
||||
},
|
||||
"json");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function (moduleId) { //弹出添加
|
||||
update = false;
|
||||
show({
|
||||
Id: "",
|
||||
ModuleId:moduleId,
|
||||
SortNo: 1
|
||||
});
|
||||
},
|
||||
update: function (data) { //弹出编辑框
|
||||
update = true;
|
||||
show(data);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//监听模块表格内部按钮
|
||||
table.on('tool(list)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'detail') { //查看
|
||||
//layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||
menuList({moduleId:data.Id});
|
||||
}
|
||||
});
|
||||
|
||||
//监听菜单表格内部按钮
|
||||
table.on('tool(menulist)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'del') { //删除菜单
|
||||
openauth.del("/moduleManager/delMenu",
|
||||
data.Id,menuList);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听页面主按钮操作
|
||||
var active = {
|
||||
btnDel: function () { //批量删除
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/moduleManager/Delete",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
mainList);
|
||||
}
|
||||
, btnAdd: function () { //添加模块
|
||||
editDlg.add();
|
||||
}
|
||||
, btnAddMenu: function () { //添加菜单
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择一个要添加菜单的模块");
|
||||
return;
|
||||
}
|
||||
meditDlg.add(data[0].Id);
|
||||
}
|
||||
, btnEdit: function () { //编辑
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择编辑的行,且同时只能编辑一行");
|
||||
return;
|
||||
}
|
||||
editDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, search: function () { //搜索
|
||||
mainList({ key: $('#key').val() });
|
||||
}
|
||||
, btnRefresh: function() {
|
||||
mainList();
|
||||
}
|
||||
, btnAccessModule: function () {
|
||||
var index = layer.open({
|
||||
title: "为用户分配模块",
|
||||
type: 2,
|
||||
content: "newsAdd.html",
|
||||
success: function(layero, index) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('.toolList .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
//监听页面主按钮操作 end
|
||||
})
|
167
OpenAuth.Mvc/userJs/orgs.js
Normal file
167
OpenAuth.Mvc/userJs/orgs.js
Normal file
@ -0,0 +1,167 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||
var form = layui.form,
|
||||
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
layui.droptree("/UserSession/GetOrgs", "#ParentName", "#ParentId", false);
|
||||
|
||||
//主列表加载,可反复调用进行刷新
|
||||
var config= {}; //table的参数,如搜索key,点击tree的id
|
||||
var mainList = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(config, options);
|
||||
}
|
||||
table.reload('mainList', {
|
||||
url: '/UserSession/GetSubOrgs',
|
||||
where: config
|
||||
});
|
||||
}
|
||||
//左边树状机构列表
|
||||
var ztree = function () {
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: 'null'
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
mainList({ orgId: treeNode.Id });
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function () {
|
||||
$.getJSON(url, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||
var newNode = { Name: "根节点", Id: null, ParentId: "" };
|
||||
json.push(newNode);
|
||||
zTreeObj.addNodes(null, json);
|
||||
mainList({ orgId: "" });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
load();
|
||||
return {
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function() {
|
||||
var vm = new Vue({
|
||||
el: "#formEdit"
|
||||
});
|
||||
var update = false; //是否为更新
|
||||
var show = function (data) {
|
||||
var title = update ? "编辑信息" : "添加";
|
||||
layer.open({
|
||||
title: title,
|
||||
area: ["500px", "400px"],
|
||||
type: 1,
|
||||
content: $('#divEdit'),
|
||||
success: function() {
|
||||
vm.$set('$data', data);
|
||||
},
|
||||
end: mainList
|
||||
});
|
||||
var url = "/OrgManager/Add";
|
||||
if (update) {
|
||||
url = "/OrgManager/Update"; //暂时和添加一个地址
|
||||
}
|
||||
//提交数据
|
||||
form.on('submit(formSubmit)',
|
||||
function(data) {
|
||||
$.post(url,
|
||||
data.field,
|
||||
function(data) {
|
||||
layer.msg(data.Message);
|
||||
},
|
||||
"json");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function() { //弹出添加
|
||||
update = false;
|
||||
show({
|
||||
Id: '',
|
||||
SortNo:1
|
||||
});
|
||||
},
|
||||
update: function(data) { //弹出编辑框
|
||||
update = true;
|
||||
show(data);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//监听表格内部按钮
|
||||
table.on('tool(list)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'detail') { //查看
|
||||
layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听页面主按钮操作
|
||||
var active = {
|
||||
btnDel: function () { //批量删除
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/OrgManager/Delete",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
mainList);
|
||||
}
|
||||
, btnAdd: function () { //添加
|
||||
editDlg.add();
|
||||
}
|
||||
, btnEdit: function () { //编辑
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择编辑的行,且同时只能编辑一行");
|
||||
return;
|
||||
}
|
||||
editDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, search: function () { //搜索
|
||||
mainList({ key: $('#key').val() });
|
||||
}
|
||||
, btnRefresh: function() {
|
||||
mainList();
|
||||
}
|
||||
, btnAccessModule: function () {
|
||||
var index = layer.open({
|
||||
title: "为用户分配模块",
|
||||
type: 2,
|
||||
content: "newsAdd.html",
|
||||
success: function(layero, index) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('.toolList .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
//监听页面主按钮操作 end
|
||||
})
|
174
OpenAuth.Mvc/userJs/roles.js
Normal file
174
OpenAuth.Mvc/userJs/roles.js
Normal file
@ -0,0 +1,174 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||
var form = layui.form,
|
||||
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
layui.droptree("/UserSession/GetOrgs", "#Organizations", "#OrganizationIds");
|
||||
|
||||
//主列表加载,可反复调用进行刷新
|
||||
var config= {}; //table的参数,如搜索key,点击tree的id
|
||||
var mainList = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(config, options);
|
||||
}
|
||||
table.reload('mainList', {
|
||||
url: '/RoleManager/Load',
|
||||
where: config
|
||||
});
|
||||
}
|
||||
//左边树状机构列表
|
||||
var ztree = function () {
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: ""
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
mainList({ orgId: treeNode.Id });
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function () {
|
||||
$.getJSON(url, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||
var newNode = { Name: "根节点", Id: null,ParentId:"" };
|
||||
json.push(newNode);
|
||||
zTreeObj.addNodes(null, json);
|
||||
mainList({ orgId: "" });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
load();
|
||||
return {
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function() {
|
||||
var vm = new Vue({
|
||||
el: "#formEdit"
|
||||
});
|
||||
var update = false; //是否为更新
|
||||
var show = function (data) {
|
||||
var title = update ? "编辑信息" : "添加";
|
||||
layer.open({
|
||||
title: title,
|
||||
area: ["500px", "400px"],
|
||||
type: 1,
|
||||
content: $('#divEdit'),
|
||||
success: function() {
|
||||
vm.$set('$data', data);
|
||||
},
|
||||
end: mainList
|
||||
});
|
||||
var url = "/RoleManager/Add";
|
||||
if (update) {
|
||||
url = "/RoleManager/Update";
|
||||
}
|
||||
//提交数据
|
||||
form.on('submit(formSubmit)',
|
||||
function(data) {
|
||||
$.post(url,
|
||||
data.field,
|
||||
function(data) {
|
||||
layer.msg(data.Message);
|
||||
},
|
||||
"json");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function() { //弹出添加
|
||||
update = false;
|
||||
show({
|
||||
Id: ''
|
||||
});
|
||||
},
|
||||
update: function(data) { //弹出编辑框
|
||||
update = true;
|
||||
show(data);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//监听表格内部按钮
|
||||
table.on('tool(list)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'detail') { //查看
|
||||
layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听页面主按钮操作
|
||||
var active = {
|
||||
btnDel: function () { //批量删除
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/RoleManager/Delete",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
mainList);
|
||||
}
|
||||
, btnAdd: function () { //添加
|
||||
editDlg.add();
|
||||
}
|
||||
, btnEdit: function () { //编辑
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择编辑的行,且同时只能编辑一行");
|
||||
return;
|
||||
}
|
||||
editDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, search: function () { //搜索
|
||||
mainList({ key: $('#key').val() });
|
||||
}
|
||||
, btnRefresh: function() {
|
||||
mainList();
|
||||
}
|
||||
, btnAccessModule: function () {
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择要分配的角色");
|
||||
return;
|
||||
}
|
||||
|
||||
var index = layer.open({
|
||||
title: "为用角色配模块",
|
||||
type: 2,
|
||||
area: ['450px', '400px'],
|
||||
content: "/ModuleManager/Assign?type=RoleModule&menuType=RoleElement&id=" + data[0].Id,
|
||||
success: function (layero, index) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('.toolList .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
//监听页面主按钮操作 end
|
||||
})
|
174
OpenAuth.Mvc/userJs/users.js
Normal file
174
OpenAuth.Mvc/userJs/users.js
Normal file
@ -0,0 +1,174 @@
|
||||
layui.config({
|
||||
base: "/js/"
|
||||
}).use(['form','vue', 'ztree', 'layer', 'jquery', 'table','droptree','openauth'], function () {
|
||||
var form = layui.form,
|
||||
//layer = (parent == undefined || parent.layer === undefined )? layui.layer : parent.layer,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery;
|
||||
var table = layui.table;
|
||||
var openauth = layui.openauth;
|
||||
layui.droptree("/UserSession/GetOrgs", "#Organizations", "#OrganizationIds");
|
||||
|
||||
//主列表加载,可反复调用进行刷新
|
||||
var config= {}; //table的参数,如搜索key,点击tree的id
|
||||
var mainList = function (options) {
|
||||
if (options != undefined) {
|
||||
$.extend(config, options);
|
||||
}
|
||||
table.reload('mainList', {
|
||||
url: '/UserManager/Load',
|
||||
where: config
|
||||
});
|
||||
}
|
||||
//左边树状机构列表
|
||||
var ztree = function () {
|
||||
var url = '/UserSession/GetOrgs';
|
||||
var zTreeObj;
|
||||
var setting = {
|
||||
view: { selectedMulti: false },
|
||||
data: {
|
||||
key: {
|
||||
name: 'Name',
|
||||
title: 'Name'
|
||||
},
|
||||
simpleData: {
|
||||
enable: true,
|
||||
idKey: 'Id',
|
||||
pIdKey: 'ParentId',
|
||||
rootPId: ""
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onClick: function (event, treeId, treeNode) {
|
||||
mainList({ orgId: treeNode.Id });
|
||||
}
|
||||
}
|
||||
};
|
||||
var load = function () {
|
||||
$.getJSON(url, function (json) {
|
||||
zTreeObj = $.fn.zTree.init($("#tree"), setting);
|
||||
var newNode = { Name: "根节点", Id: null,ParentId:"" };
|
||||
json.push(newNode);
|
||||
zTreeObj.addNodes(null, json);
|
||||
mainList({ orgId: "" });
|
||||
zTreeObj.expandAll(true);
|
||||
});
|
||||
};
|
||||
load();
|
||||
return {
|
||||
reload: load
|
||||
}
|
||||
}();
|
||||
|
||||
//添加(编辑)对话框
|
||||
var editDlg = function() {
|
||||
var vm = new Vue({
|
||||
el: "#formEdit"
|
||||
});
|
||||
var update = false; //是否为更新
|
||||
var show = function (data) {
|
||||
var title = update ? "编辑信息" : "添加";
|
||||
layer.open({
|
||||
title: title,
|
||||
area: ["500px", "400px"],
|
||||
type: 1,
|
||||
content: $('#divEdit'),
|
||||
success: function() {
|
||||
vm.$set('$data', data);
|
||||
},
|
||||
end: mainList
|
||||
});
|
||||
var url = "/UserManager/AddOrUpdate";
|
||||
if (update) {
|
||||
url = "/UserManager/AddOrUpdate"; //暂时和添加一个地址
|
||||
}
|
||||
//提交数据
|
||||
form.on('submit(formSubmit)',
|
||||
function(data) {
|
||||
$.post(url,
|
||||
data.field,
|
||||
function(data) {
|
||||
layer.msg(data.Message);
|
||||
},
|
||||
"json");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return {
|
||||
add: function() { //弹出添加
|
||||
update = false;
|
||||
show({
|
||||
Id: ''
|
||||
});
|
||||
},
|
||||
update: function(data) { //弹出编辑框
|
||||
update = true;
|
||||
show(data);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
//监听表格内部按钮
|
||||
table.on('tool(list)', function (obj) {
|
||||
var data = obj.data;
|
||||
if (obj.event === 'detail') { //查看
|
||||
layer.msg('ID:' + data.Id + ' 的查看操作');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//监听页面主按钮操作
|
||||
var active = {
|
||||
btnDel: function () { //批量删除
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
openauth.del("/UserManager/Delete",
|
||||
data.map(function (e) { return e.Id; }),
|
||||
mainList);
|
||||
}
|
||||
, btnAdd: function () { //添加
|
||||
editDlg.add();
|
||||
}
|
||||
, btnEdit: function () { //编辑
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择编辑的行,且同时只能编辑一行");
|
||||
return;
|
||||
}
|
||||
editDlg.update(data[0]);
|
||||
}
|
||||
|
||||
, search: function () { //搜索
|
||||
mainList({ key: $('#key').val() });
|
||||
}
|
||||
, btnRefresh: function() {
|
||||
mainList();
|
||||
}
|
||||
, btnAccessModule: function () {
|
||||
var checkStatus = table.checkStatus('mainList')
|
||||
, data = checkStatus.data;
|
||||
if (data.length != 1) {
|
||||
layer.msg("请选择要分配的用户");
|
||||
return;
|
||||
}
|
||||
|
||||
var index = layer.open({
|
||||
title: "为用户分配模块",
|
||||
type: 2,
|
||||
area: ['450px', '400px'],
|
||||
content: "/ModuleManager/Assign?type=UserModule&menuType=UserElement&id=" + data[0].Id,
|
||||
success: function(layero, index) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$('.toolList .layui-btn').on('click', function () {
|
||||
var type = $(this).data('type');
|
||||
active[type] ? active[type].call(this) : '';
|
||||
});
|
||||
|
||||
//监听页面主按钮操作 end
|
||||
})
|
Loading…
Reference in New Issue
Block a user