199 lines
7.3 KiB
Plaintext
199 lines
7.3 KiB
Plaintext
@model WX.CRM.Model.Entity.BAS_RIGHT_LEVEL
|
|
@using WX.CRM.WebHelper
|
|
@{
|
|
ViewBag.Title = "";
|
|
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
|
|
|
|
}
|
|
@{
|
|
List<WX.CRM.Model.Entity.BAS_RIGHT_LEVEL_DETAIL> detailList = ViewBag.detail;
|
|
string JSON = "[]";
|
|
string JSON2 = "[]";
|
|
if (detailList != null)
|
|
{
|
|
List<WX.CRM.Model.Entity.BAS_RIGHT_LEVEL_DETAIL> deptm = detailList.Where(m => m.TYPEID == 2).ToList();
|
|
JSON = JsonHelper.ObjDivertToJson(deptm.Select(m => m.CID).ToArray());
|
|
List<WX.CRM.Model.Entity.BAS_RIGHT_LEVEL_DETAIL> gropm = detailList.Where(m => m.TYPEID == 1).ToList();
|
|
JSON2 = JsonHelper.ObjDivertToJson(gropm.Select(m => m.CID).ToArray());
|
|
}
|
|
}
|
|
<script type="text/javascript">
|
|
var dept =@Html.Raw(JSON);
|
|
var group=@Html.Raw(JSON2);
|
|
$(function () {
|
|
$("#btnSave").click(function () {
|
|
var group = [];
|
|
//var nodes = $('#tt').tree('getChecked');
|
|
var imm = 0;
|
|
////部门
|
|
//console.log(nodes);
|
|
//$(nodes).each(function (a, x) {
|
|
// group[a] = { CID: x.id, TYPEID: 2 };
|
|
// imm++;
|
|
//});
|
|
//销售组
|
|
var asd2 = $('#bb').tree('getChecked');
|
|
console.log(asd2);
|
|
$(asd2).each(function (a, x) {
|
|
console.log(x);
|
|
if (x.id.indexOf("sale_") == -1) {
|
|
group[imm] = { CID: x.id, TYPEID: 1 };
|
|
} else {
|
|
group[imm] = { CID: x.id.replace("sale_",""), TYPEID: 2 };
|
|
}
|
|
imm++;
|
|
});
|
|
|
|
if ($("#CreateForm").valid()) {
|
|
var sz = $('#CreateForm').serializeArray();
|
|
var obj = {};
|
|
$.each(sz, function (i, v) {
|
|
obj[v.name] = v.value;
|
|
|
|
})
|
|
obj["Detail"] = JSON.stringify(group);
|
|
var data1 = obj;
|
|
console.log(data1);
|
|
$.r_ajax({
|
|
url: "/Base/Role/LevelEdiSavet",
|
|
type: "Post",
|
|
data: obj,
|
|
dataType: "json",
|
|
loading: true,
|
|
success: function (data) {
|
|
if (data.type == 1) {
|
|
window.parent.frameReturnByMes(data.message);
|
|
window.parent.frameReturnByReload(true);
|
|
window.parent.frameReturnByClose()
|
|
}
|
|
else {
|
|
window.parent.frameReturnByMes(data.message);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
});
|
|
//$('#tt').tree({
|
|
// url: "/Base/salesDepartment/GetTreeList",
|
|
// checkbox: true,
|
|
// onlyLeafCheck: true,
|
|
// onLoadSuccess: function () {
|
|
// $(dept).each(function (asd, s) {
|
|
// var node = $('#tt').tree('find', s);
|
|
// console.log(node);
|
|
// if (node != null)
|
|
// $('#tt').tree('check', node.target);
|
|
// });
|
|
|
|
// }
|
|
//});
|
|
$('#bb').tree({
|
|
url: "/Base/InnerGroup/GetTreeList?type=3",
|
|
checkbox: true,
|
|
//onlyLeafCheck: true,
|
|
onLoadSuccess: function () {
|
|
$(group).each(function (asd, s) {
|
|
var node = $('#bb').tree('find', s);
|
|
if (node != null)
|
|
$('#bb').tree('check', node.target);
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|
|
<div style="border: 1px #cccccc solid;width:100%;height:100%;">
|
|
<div class="mvctool bgb">
|
|
@Html.ToolButtonPlain("btnSave", "icon-save", "保存", false, "")
|
|
</div>
|
|
<div style=" height: 80%; width: 100%;overflow-y: auto">
|
|
@using (Html.BeginForm("Edit", "bas_role", null, FormMethod.Post, new { Id = "CreateForm" }))
|
|
{
|
|
@Html.ValidationSummary(true)
|
|
<table class="fromEditTable setTextWidth300">
|
|
<tbody>
|
|
<tr>
|
|
<td width="60px" style="width:100px;">
|
|
角色编码
|
|
</td>
|
|
<td style="width:300px">
|
|
@Html.Raw(Model.ROLECODE)
|
|
@Html.HiddenFor(m => m.PKID)
|
|
@Html.HiddenFor(m => m.ROLECODE)
|
|
</td>
|
|
<td width="120px">
|
|
@Html.ValidationMessageFor(m => m.ROLECODE)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
权限ID
|
|
</td>
|
|
<td>
|
|
@Html.TextBoxFor(m => m.RIGHTID)
|
|
</td>
|
|
<td>
|
|
@Html.ValidationMessageFor(m => m.RIGHTID)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
权限名称
|
|
</td>
|
|
<td>
|
|
@Html.TextBoxFor(m => m.RNAME)
|
|
</td>
|
|
<td>
|
|
@Html.ValidationMessageFor(m => m.RNAME)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
状态
|
|
</td>
|
|
<td>
|
|
@Html.DropDownListFor(m => m.STATUS, new List<SelectListItem>() { new SelectListItem() { Text = "正常", Value = "1" }, new SelectListItem() { Text = "禁用", Value = "0" } })
|
|
</td>
|
|
<td>
|
|
@Html.ValidationMessageFor(m => m.STATUS)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
备注
|
|
</td>
|
|
<td>
|
|
@Html.TextAreaFor(m => m.REMARKS)
|
|
</td>
|
|
<td>
|
|
@Html.ValidationMessageFor(m => m.REMARKS)
|
|
</td>
|
|
</tr>
|
|
@*<tr>
|
|
<td width="60px" style="width:100px;">
|
|
可见营业部
|
|
</td>
|
|
<td style="width:310px">
|
|
<ul id="tt"></ul>
|
|
</td>
|
|
<td width="120px"></td>
|
|
</tr>*@
|
|
<tr>
|
|
<td>
|
|
可见部门
|
|
</td>
|
|
<td>
|
|
<ul id="bb"></ul>
|
|
</td>
|
|
<td style="color:red">
|
|
勾选“全部”将看到所有组织结构<br/>
|
|
勾选“某部门”将看对应部门数据
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
}
|
|
</div>
|
|
</div>
|