155 lines
5.7 KiB
Plaintext
155 lines
5.7 KiB
Plaintext
@{
|
|
ViewBag.Title = "UserComBox";
|
|
Layout = null;
|
|
}
|
|
|
|
@{ var controlType = (string)ViewBag.type;}
|
|
|
|
销售组:
|
|
<input type="text" id="nb1_combox_innerGroup" class="easyui-combotree" style="width: 220px; cursor: pointer; height: 28px; line-height: 26px;" />
|
|
|
|
<span style="@Html.Raw((controlType == "OnlyGroup") ? "display:none" : "")">
|
|
<span>员工:</span>
|
|
<select id="nb1_combox_user" style="cursor: pointer; width: 136px;" lay-ignore>
|
|
<option>请选择</option>
|
|
</select>
|
|
</span>
|
|
@{
|
|
if ((@ViewBag.isShowDismiss as string) == "True")
|
|
{
|
|
<span>状态:</span>
|
|
<select id="slt_isdismiss" name="slt_isdismiss">
|
|
<option value="">请选择</option>
|
|
<option value="0" selected="selected">在职</option>
|
|
<option value="1">离职</option>
|
|
</select>
|
|
}
|
|
}
|
|
|
|
<input id="level" type="hidden" value="@ViewBag.level" />
|
|
<input id="isShowDismiss" type="hidden" value="@ViewBag.isShowDismiss" />
|
|
<input id="isSelf" type="hidden" value="@ViewBag.isSelf" />
|
|
<input id="currentUserId" type="hidden" value="@ViewBag.currentUserId" />
|
|
<input id="currentGroupId" type="hidden" value="@ViewBag.currentGroupId" />
|
|
<input id="currentDeptId" type="hidden" value="@ViewBag.currentDeptId" />
|
|
<input id="currentCompanyId" type="hidden" value="@ViewBag.currentCompanyId" />
|
|
|
|
<input id="txt_companyId" name="txt_companyId" type="hidden" />
|
|
<input id="txt_deptId" name="txt_deptId" type="hidden" />
|
|
<input id="txt_groupIds" name="txt_groupIds" type="hidden" />
|
|
<input id="txt_userId" name="txt_userId" type="hidden" />
|
|
|
|
<script type="text/javascript">
|
|
var isFirst = true;
|
|
var isSelfFirst = true;
|
|
var treeData = @Html.Raw(ViewBag.tree);
|
|
var onload = function () {
|
|
if (isFirst) {
|
|
onLoadSucced();
|
|
isFirst = false;
|
|
}
|
|
};
|
|
function ComBoxLoad() {
|
|
$("#nb1_combox_innerGroup").combotree({
|
|
data: treeData,
|
|
onLoadSuccess: function () {
|
|
var level = $("#level").val();
|
|
//if (level == "Company") {
|
|
// $("#nb1_combox_innerGroup").combotree('setValue', $("#currentCompanyId").val());
|
|
//}
|
|
//else if (level == "Dept") {
|
|
// var groupvalue = $("#currentGroupId").val();
|
|
// console.log(groupvalue);
|
|
// if (groupvalue && groupvalue != "0") {
|
|
// $("#nb1_combox_innerGroup").combotree('setValue', $("#currentGroupId").val());
|
|
// } else {
|
|
// $("#nb1_combox_innerGroup").combotree('setValue', $("#currentDeptId").val());
|
|
// }
|
|
//}
|
|
//else
|
|
if (level == "Group") {
|
|
$("#nb1_combox_innerGroup").combotree('setValue', $("#currentGroupId").val());
|
|
}
|
|
else if (level == "Self") {
|
|
$("#nb1_combox_innerGroup").combotree('setValue', $("#currentGroupId").val());
|
|
$("#txt_userId").val($("#currentUserId").val());
|
|
} else {
|
|
var groupvalue = $("#currentGroupId").val();
|
|
if (groupvalue && groupvalue != "0") {
|
|
$("#nb1_combox_innerGroup").combotree('setValue', $("#currentGroupId").val());
|
|
} else {
|
|
$("#nb1_combox_innerGroup").combotree('setValue', $("#currentDeptId").val());
|
|
}
|
|
}
|
|
|
|
var isSelf = $("#isSelf").val();
|
|
if(isSelf == "True")
|
|
{
|
|
$("#nb1_combox_innerGroup").combotree('setValue', $("#currentGroupId").val());
|
|
}
|
|
|
|
@*@Html.Raw((controlType == "OnlyGroup") ? "onload();" : "")*@
|
|
|
|
},
|
|
onSelect: function (node) {
|
|
console.log(node);
|
|
var attr = JSON.parse(node.attributes);
|
|
$("#txt_companyId").val(attr.companyId);
|
|
$("#txt_deptId").val(attr.deptId);
|
|
$("#txt_groupIds").val(attr.groupId);
|
|
//console.log(node);
|
|
|
|
combox_GetUser();
|
|
}
|
|
});
|
|
|
|
}
|
|
var loaded = false;
|
|
$(function () {
|
|
if (!loaded) {
|
|
ComBoxLoad();
|
|
loaded = true;
|
|
}
|
|
$("#nb1_combox_user").change(function () {
|
|
$("#txt_userId").val($(this).val());
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
function combox_GetUser() {
|
|
var companyId = $("#txt_companyId").val();
|
|
var deptId = $("#txt_deptId").val();
|
|
var groupId = $("#txt_groupIds").val();
|
|
var isShowDismiss = $("#isShowDismiss").val();
|
|
var level = $("#level").val();
|
|
if (deptId != "" || groupId != "") {
|
|
$.r_post("/Control/GetUserSSOCombo", { companyId, deptId, groupId, level, isShowDismiss }, function (res) {
|
|
//console.log(res);
|
|
$("#nb1_combox_user").empty();
|
|
if (level != "Self") {
|
|
$("#nb1_combox_user").append(new Option('请选择', ''));
|
|
}
|
|
$(res).each(function (n, m) {
|
|
$("#nb1_combox_user").append(new Option(m.Eid + '--' + m.UName + (m.IsDimiss == 1 ? '(离职)' : ''), m.UserId));
|
|
});
|
|
var isSelf = $("#isSelf").val();
|
|
if (isSelf == "True") {
|
|
$("#nb1_combox_user").val($("#currentUserId").val());
|
|
$("#txt_userId").val($("#currentUserId").val());
|
|
}
|
|
|
|
$("#nb1_combox_user").change();
|
|
$("#txt_userId").val($("#nb1_combox_user").val());
|
|
|
|
onload();
|
|
|
|
});
|
|
}
|
|
//else {
|
|
// onload();
|
|
//}
|
|
}
|
|
</script>
|