天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
7.9 KiB

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
Inherits="System.Web.Mvc.ViewPage<QMAPP.Web.Models.Sys.NoticeInfoModel>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
添加联系人
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<table id="editTable">
<tr>
<td colspan="2">
<table width="90%">
<tr>
<td>
<div id="p" class="easyui-panel" title="通讯录" style="width: 135px; height: 308px;
padding: 0px; border: 1">
<%=Html.QTreeView("systemLimitMeun", "GetTreeData", false)%>
</div>
</td>
<td style="width: 0.3px; background-color: Gray;">
</td>
<td valign="top">
<div id="divInterval" class="easyui-panel" title="联系人" style="width: 310px; height: 308px; padding: 0px; border: 1">
<%=Html.QDateGrid<QMAPP.Web.Models.Sys.ContractUserModel>(Model)%>
</div>
</td>
<td>
<a class="easyui-linkbutton" href="#" plain="false" title="选中" onclick="Choose()">>></a>
<a class="easyui-linkbutton" href="#" plain="false" title="移出" onclick="CancleChoose()"><<</a>
</td>
<td id="tdselect" align="left" valign="top">
<div id="div1" class="easyui-panel" title="联系人" style="height: 308px;
padding: 0px; border: 1">
<table width="50%" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<td><select id="objSelect" multiple="multiple" style="width: 115px; height: 262px"></select></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%=Html.Hidden("selectKey") %>
<%=Html.HiddenFor(p => p.UserID)%>
<%=Html.HiddenFor(p => p.SENDAIM)%>
<%=Html.HiddenFor(p => p.SENDAIMNAME)%>
<%=Html.HiddenFor(p => p.CorpID)%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<%=Html.QTButton("ok", "save", QMFrameWork.WebUI.IconCls.save, "Save()", QMAPP.Common.Web.SystemLimit.isLimt)%>
<%=Html.QTButton("cancel", "save","close", "parent.closeAppWindow1();return false;", QMAPP.Common.Web.SystemLimit.isLimt)%>
</td>
</tr>
</table>
<script type="text/javascript">
$(function () {
var sendaimname = document.getElementById("SENDAIMNAME").value;
var sendaim = document.getElementById("SENDAIM").value;
var listUserID = sendaim.split(",");
var listUserName = sendaimname.split(",");
var objSelect = $("#objSelect");
if (sendaim != "" && sendaim !== null) {
for (var i = 0; i < listUserID.length; i++) {
objItemValue = listUserID[i];
objItemText = listUserName[i];
var varItem = new Option(objItemText, objItemValue);
objSelect[0].options.add(varItem);
}
}
//绑定树状click事件
$('#systemLimitMeun').tree({
onClick: function () {
var node = $('#systemLimitMeun').tree('getSelected');
var id = node.id;
document.getElementById("CorpID").value = id;
if ($('#systemLimitMeun').tree('isLeaf', node.target)) {
LoadNoticeUser2(node.id);
}
else {
LoadNoticeUser2("");
}
}
});
});
//根据选择的组织结构查询联系人
function LoadNoticeUser2(id) {
$.ajax({
type: "POST",
url: "/Notice/DefaultUserList",
dataType: "json",
data: {
OrgaID: id
},
success: function (data) {
$('#QDateGrid').datagrid('loaded');
$("#QDateGrid").datagrid('loadData', data);
}
});
}
//添加选中联系人
function Choose() {
var objSelect = $("#objSelect");
var selected = $('#QDateGrid').datagrid('getSelections');
for (var i=0; i < selected.length; i++) {
var objItemText = selected[i].UserName;
var objItemValue = selected[i].UserID;
//判断是否存在
if (jsSelectIsExitItem(objSelect, objItemValue)) {
alert("联系人" + objItemText + "已经存在");
return false;
}
else {
var varItem = new Option(objItemText, objItemValue);
objSelect[0].options.add(varItem);
}
}
//清除选中行
$('#QDateGrid').datagrid('clearSelections');
}
//删除选中联系人
function CancleChoose() {
var objSelect = $("#objSelect");
var selected = $('#QDateGrid').datagrid('getSelections');
if (objSelect.selectedIndex == -1)
alert("请选中要删除的联系人!");
for (var i = 0; i < objSelect[0].options.length; i++) {
var objItemValue = objSelect[0].options[i].value;
if (objSelect[0].options[i].selected) {
objSelect[0].options.remove(i);
break;
}
}
}
//判断联系人是否已添加
function jsSelectIsExitItem(objSelect, objItemValue) {
var isExit = false;
for (var i = 0 ; i < objSelect[0].options.length; i++) {
if (objSelect[0].options[i].value == objItemValue) {
isExit = true;
break;
}
}
return isExit;
}
//确定添加联系人,返回到通知管理编辑页
function Save() {
var objSelect = $("#objSelect");
var strUserName = "";
var strUserID = "";
for (var i = 0; i < objSelect[0].options.length; i++) {
var userName = objSelect[0].options[i].text;
var userID = objSelect[0].options[i].value;
if (strUserName == "") {
strUserName += userName;
}
else {
strUserName += "," + userName;
}
if (strUserID == "") {
strUserID += userID;
}
else {
strUserID += "," + userID;
}
}
// //联系人姓名
// window.parent.document.getElementById("SENDAIMNAME").value = strUserName;
// //联系人ID
// window.parent.document.getElementById("SENDAIM").value = strUserID;
parent.saveUser(strUserID, strUserName);
parent.closeAppWindow1();
return false;
}
function ClickGridCell(rowIndex, field, value) {
}
</script>
</asp:Content>