TG.WXCRM.V4/WEB/Views/MsgToolPlan/ChoosePeople.cshtml

121 lines
3.5 KiB
Plaintext

@model WX.CRM.Model.Entity.WW_HHUSER_EID
@{ ViewBag.Title = "Edit";
Layout = "~/Views/Shared/_EasyUI_Layout.cshtml";
}
@{
string isok = ViewBag.isOk == null ? "1" : Convert.ToString(ViewBag.isOk);
}
<script>
var isOk = "@Html.Raw(isok)";
</script>
<div class="layui-form-item" style="margin-top:20px;">
<div>
<div title="业务部门" style="overflow:auto;height:400px">
<ul id="ultree"></ul>
</div>
</div>
<div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block my_form_iterm">
<button class="layui-btn layui-btn-ok" lay-submit lay-filter="formDemo">保存</button>
<button onclick="parent.Closed()" type="button" class="layui-btn layui-btn-primary">取消</button>
</div>
</div>
@if (isok == "0")
{
<div class="layui-form-item">
<label class="layui-form-label erro_msg">错误提示:</label>
<div class="layui-input-block my_form_iterm erro_msg">
@Html.Raw(ViewBag.Msg)
</div>
</div>
}
<script>
var checkData = [];
var isInit = true;
$(function () {
debugger
$('#ultree').tree({
onLoadSuccess: function (node) {
//debugger
Load_TreeRight();
},
url: "/Base/InnerGroup/GetTreeList?type=5&hasuser=true",
checkbox: true
});
});
layui.use('form', function () {
var form = layui.form;
var layer = layui.layer;
var type = "@Html.Raw(ViewBag.type)";
//监听提交
form.on('submit(formDemo)', function (data) {
debugger
var nodes = $('#ultree').tree('getChecked');
var checkData = [];
var removeids = [];
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
var isPass = false;
for (var j = 0; j < removeids.length; j++) {
if (removeids[j] == node.id) {
isPass = true;
break;
}
}
if (isPass) {
continue;
}
var type = 3;
if (node.iconCls.indexOf("dept") > -1) {
type = 1;
}
if (node.iconCls.indexOf("group") > -1) {
type = 2;
}
debugger
var obj = {
Type : type,
Receiverid: node.id,
Text : node.text
};
checkData.push(obj);
removeids = removeids.concat(node.filterId);
}
if (isOk == "1") {
parent.SetPeople(checkData);
return false;
} else {
layer.msg('系统错误!请关闭编辑页重试!', { icon: 2 });
return false;
}
});
});
function Load_TreeRight() { //加载角色对应的权限
var postdata = "@Html.Raw(ViewBag.data)";
if (postdata == "" || postdata == undefined) {
return;
}
var data = postdata.split(",");
if (data) {
$(".tool_button").each(function () {
$(this).removeAttr("checked");
});
}
$(data).each(function (i, n) {
var node = $('#ultree').tree('find', n);
if (node != null) {
$('#ultree').tree('check', node.target);
}
});
}
</script>