177 lines
6.8 KiB
Plaintext
177 lines
6.8 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="deptId" name="deptId" type="hidden" />
|
||
<input id="userId" name="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() {
|
||
if (treeData.length == 0) {
|
||
$("#deptId").val(0);
|
||
}
|
||
$("#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());
|
||
$("#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) {
|
||
var attr = JSON.parse(node.attributes);
|
||
$("#txt_companyId").val(attr.companyId);
|
||
$("#txt_deptId").val(attr.deptId);
|
||
$("#txt_groupIds").val(attr.groupId);
|
||
//$("#deptId").val(node.deptids);
|
||
//console.log(node);
|
||
//ComBoxOnSelect()
|
||
combox_GetUser();
|
||
}
|
||
});
|
||
|
||
}
|
||
function clear() {
|
||
ComBoxLoad();
|
||
@*var level = $("#level").val();
|
||
if (level == "Self" || level == "Group") {
|
||
ComBoxLoad();
|
||
} else {
|
||
$("#txt_companyId").val('');
|
||
$("#txt_deptId").val('');
|
||
$("#txt_groupIds").val('');
|
||
$("#userId").val('');
|
||
}*@
|
||
}
|
||
var loaded = false;
|
||
$(function () {
|
||
$("#btnReset").remove();//如果采用了SSO控件,reset采用自己控制的方式
|
||
var resethtml = '<input id="btnReset" class="layui-btn layui-btn-sm layui-btn-reset" data-method="reset" type="button" value="清空">'
|
||
$("#btnQuery").after(resethtml);
|
||
if (!loaded) {
|
||
ComBoxLoad();
|
||
loaded = true;
|
||
}
|
||
$("#nb1_combox_user").change(function () {
|
||
$("#userId").val($(this).val());
|
||
});
|
||
$("#btnReset").click(function () {//搜索按钮点击事件
|
||
document.getElementById("myform_1").reset();
|
||
ComBoxLoad();
|
||
});
|
||
});
|
||
|
||
</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.Eid));
|
||
});
|
||
var isSelf = $("#isSelf").val();
|
||
if (isSelf == "True") {
|
||
$("#nb1_combox_user").val($("#currentUserId").val());
|
||
$("#userId").val($("#currentUserId").val());
|
||
}
|
||
$("#nb1_combox_user").change();
|
||
$("#userId").val($("#nb1_combox_user").val());
|
||
onload();
|
||
});
|
||
}
|
||
else {
|
||
$("#nb1_combox_user").empty();
|
||
$("#nb1_combox_user").append(new Option('请选择', ''));
|
||
//onload();
|
||
}
|
||
}
|
||
</script>
|