<%@ Page Title="" Language="C#" MasterPageFile="~/Styles/MasterPage/MasterPage_Edit.master" AutoEventWireup="true" CodeFile="Employee_Edit.aspx.cs" Inherits="Base_Employee_Employee_Edit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript">
        var action = '<%=xview["action"]%>';
        //保存
        function Save() {
            <%=xview["Script_GetInput"] %>
            var action = '<%=xview["action"]%>';
            parent.ShowLoadingMask(); //显示遮罩
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: 'Employee_Service.asmx/Save',
                data: "{action:'" + action + "',<%=xview["Script_SaveJSON"]%>}",
                dataType: 'json',
                success: function (result) {
                    parent.HideLoadingMask(); //关闭遮罩
                    var r = result.d;
                    if (r == "success") {
                        parent.AlertOK('保存成功!');
                        parent.search_grid();
                        parent.load_tree();
                        CloseDivWin(); //关闭窗口
                    } else {
                        parent.AlertNO(r);
                    }
                }
            });
        }
    </script>
    <!--工具栏-->
    <div class="list_menu_bar">
        <a plain="true" class="easyui-linkbutton" iconcls="icon-save" onclick="Save()" style='<%=auth.AuthView("Base_Employee_Edit")%>'>保存</a>
        <a plain="true" class="easyui-linkbutton" onclick="parent.DesignModuleFormat('Base_Employee_Input');CloseDivWin();" style='<%=auth.FormatView()%>'>格式</a>
    </div>
    <div style="width:800px;height:500px;overflow:auto;">
        <div class="edit_area">
        <%=xview["input_ui"]%>
        </div>
    </div>
    <script type="text/javascript">
        //初始化页面
        function init_page() {
            var sex = $F("sex");
            AddOption(sex,'男','1');
            AddOption(sex,'女','0');
            AddOption(sex,'未知','2');
            var degree = $F("degree");
            AddOption(degree,'','');
            AddOption(degree,'小学','小学');
            AddOption(degree,'初中','初中');
            AddOption(degree,'高中','高中');
            AddOption(degree,'中专','中专');
            AddOption(degree,'成人专科','成人专科');
            AddOption(degree,'普通专科','普通专科');
            AddOption(degree,'本科','本科');
            AddOption(degree,'硕士','硕士');
            AddOption(degree,'博士','博士');

            FastSearch_Member(); //登录用户
            $F("trigger_dep_name").onclick = function () {
                AdvancedSearch_Department($("#dep_name").val());
            };
            //弹出窗口_选择部门
            function AdvancedSearch_Department(keyword) {
                var url = "../../Component/AdvancedSearch/Department_List.aspx?keyword=" + escape(keyword);
                parent.asyncbox.open({
                    id: 'win_select',
                    url: url,
                    modal: true,
                    width: 400,
                    height: 400,
                    title: '选择部门'
                });
            }
            //选择自定义项档案
            <%for(int i=1;i<=5;i++){ %>
                $F("trigger_sdefine<%=i%>").onclick = function () {
                    AdvancedSearch_DefineItem($("#sdefine<%=i%>").val(),'Employee_sdefine<%=i%>','sdefine<%=i%>');
                };
            <%}
              for(int i=1;i<=5;i++){ %>
                $F("trigger_ndefine<%=i%>").onclick = function () {
                    AdvancedSearch_DefineItem($("#ndefine<%=i%>").val(),'Employee_ndefine<%=i%>','ndefine<%=i%>');
                };
            <%} %>

            <%if(action.Equals("Update")){ %>
                sex.value = '<%=m.sex%>';
                degree.value = '<%=m.degree%>';
                $F("dep_name").value = '<%=m.department.dep_name%>';
                $F("username").value = '<%=m.member==null?"":m.member.username%>';
            <%} %>
            if(action == "Add"){
                $F("dep_id").value = '<%=xview["dep_id"]%>';
                $F("dep_name").value = '<%=xview["dep_name"]%>';
            }
        }
        init_page();
    </script>
</asp:Content>

