<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ordertypemanageedit.aspx.cs"
    Inherits="HySoft.BaseCallCenter.Web.workordermanage.workorderset.ordertypemanageedit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>编辑类型</title>
    <link href="../../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <link href="../../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery/jquery.form.js"></script>
    <script type="text/javascript" src="../../scripts/jquery/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery/messages_cn.js"></script>
    <script type="text/javascript" src="../../scripts/ui/js/ligerBuild.min.js"></script>
    <script type="text/javascript" src="../../scripts/function.js"></script>
    <script src="../../scripts/calendar.js" type="text/javascript"></script>
    <link href="../../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script src="../../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerLayout.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerMenu.js" type="text/javascript"></script>
    <link href="../../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <link href="../../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var gridlist;
        $(function () {
            InitList();
        });
        function InitList() {
            try {
                gridlist = $("#tableList").ligerGrid({
                    width: '80%', height: '80%',
                    checkbox: true,
                    columns: [
                { display: 'ID', name: '_f_workorderstateid', width: '20%' },
                { display: '名称', name: '_f_name', width: '36%' }
                ],
                    url: '../ajax/WorkOrderStateAjax.ashx?action=getlist', pageSize: 10, rownumbers: true, pageSizeOptions: [2, 4, 6, 8], isChecked: f_isChecked
                });
            }
            catch (e) {
                alert(e.Message);
            }
            gridlist.changePage('first');
            $("#pageloading").hide();
        }
        function f_isChecked(rowdata) {
            var res = false;
            var arr = new Array();
            if (document.getElementById("hfTypeStateStr").value.length > 0) {
                arr = document.getElementById("hfTypeStateStr").value.split(',');
                for (i = 0; i < arr.length; i++) {
                    if (arr[i] == rowdata._f_workorderstateid)
                        res = true;
                }
            }
            return res;
        }

        function CloseThis() {
            var dialog = frameElement.dialog;
            parent.InitList();
            parent.tree();
            dialog.close();
        }

        function validate() {
            var rows = gridlist.getSelectedRows();
            if (rows.length > 0) {
                var arr = new Array();
                var i = 0;
                for (var i = 0; i < rows.length; i++) {
                    arr[i] = rows[i]._f_workorderstateid;
                }
                document.getElementById("hfStatelist").value = arr.toString();
            }
            var i = 0;
            if (!validatelogin_name()) {
                i++;
            }
            if (!validatepruc_name()) {
                i++;
            }
            if (!validatelogin_ename()) {
                i++;
            }
            if (!validatelogin_code()) {
                i++;
            }
            if (i > 0) {
                return false;
            }
            return true;

        }
        function validatelogin_name() {
            if ($("#F_ParamCode").val() == "" || $("#F_ParamCode").val() == undefined) {
                document.getElementById("lbF_ParamCode").innerHTML = "* 类型名称不为空！";
                document.getElementById("lbF_ParamCode").style.color = "red";
                return false;
            }
            else {
                document.getElementById("lbF_ParamCode").innerHTML = "*";
                document.getElementById("lbF_ParamCode").style.color = "#414141";
                return true;
            }
        }

        function validatelogin_ename() {
            if ($("#F_Ename").val() == "" || $("#F_Ename").val() == undefined) {
                document.getElementById("lbF_Ename").innerHTML = "* 类型简称不为空！";
                document.getElementById("lbF_Ename").style.color = "red";
                return false;
            }
            else {
                document.getElementById("lbF_ParamCode").innerHTML = "*";
                document.getElementById("lbF_ParamCode").style.color = "#414141";
                return true;
            }
        }
        function validatelogin_code() {

            var rows = gridlist.getSelectedRows();
            if (rows.length > 0) {
                document.getElementById("F_StateType").innerHTML = "*";
                document.getElementById("F_StateType").style.color = "#414141";
                return true;
            } else {
                document.getElementById("F_StateType").innerHTML = "*类型编码不为空！";
                document.getElementById("F_StateType").style.color = "red";
                return false;
            }

//                    if ($("#F_ParamValue").val() == "" || $("#F_ParamValue").val() == undefined) {
//                        document.getElementById("lbF_ParamValue").innerHTML = "*类型编码不为空！";
//                        document.getElementById("lbF_ParamValue").style.color = "red";
//                        return false;
//                    }
//                    else {
//                        document.getElementById("lbF_ParamValue").innerHTML = "*";
//                        document.getElementById("lbF_ParamValue").style.color = "#414141";
//                        return true;
//                    }
                }
        function validatepruc_name() {
            if ($("#F_ParamDes").val() == "" || $("#F_ParamDes").val() == undefined) {
                document.getElementById("lbF_ParamDes").innerHTML = "* 描述不为空！";
                document.getElementById("lbF_ParamDes").style.color = "red";
                return false;
            }
            else {
                document.getElementById("lbF_ParamDes").innerHTML = "*";
                document.getElementById("lbF_ParamDes").style.color = "#414141";
                return true;
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField ID="hfStatelist" runat="server" />
    <asp:HiddenField ID="hfTypeStateStr" runat="server" />
    <div id="contentTab">
        <%-- <ul class="tab_nav">
            <li class="selected"><a onclick="tabs('#contentTab',0);" href="javascript:;">类型信息</a></li>
        </ul>--%>
        <div class="tab_con" style="display: block;">
            <table class="form_table">
                <col width="100px" />
                <col />
                <col width="100px" />
                <col />
                <tbody>
                    <tr>
                        <th>
                            <span style="color: red;">*&nbsp;类型名称：</span>
                        </th>
                        <td>
                            <asp:TextBox ID="F_ParamCode" runat="server" Width="120px" CssClass="txtInput normal"></asp:TextBox><label
                                id="lbF_ParamCode" for="F_ParamCode"></label>
                        </td>
                        <th>
                            <span style="color: Black;">&nbsp;类型简称：</span>
                        </th>
                        <td>
                            <asp:TextBox ID="F_Ename" runat="server" Width="120px" CssClass="txtInput normal"></asp:TextBox><label
                                id="lbF_Ename" for="F_Ename"></label>
                        </td>
                    </tr>
                    <tr>
                        <th style="display: none">
                            <span style="color: red;">*&nbsp;类型编码：</span>
                        </th>
                        <td style="display: none">
                            <asp:TextBox ID="F_ParamValue" runat="server" CssClass="txtInput normal" Style="width: 120px;"></asp:TextBox><label
                                id="lbF_ParamValue" for="F_ParamValue"></label>
                        </td>
                        <th>
                            <span style="color: Black;">*&nbsp;排&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;序：</span>
                        </th>
                        <td>
                            <asp:TextBox ID="textF_Sort" runat="server" CssClass="txtInput normal" Style="width: 120px;"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            描&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;述：
                        </th>
                        <td colspan="3">
                            <asp:TextBox ID="F_ParamDes" runat="server" CssClass="txtInput normal" TextMode="MultiLine"
                                Style="width: 440px; height: 30px;"></asp:TextBox><label id="lbF_ParamDes" for="F_ParamDes"></label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            <span style="color: red;">*&nbsp;工单状态：</span>
                        </th>
                        <td colspan="3">
                            <div position="center" style="width: 450px;">
                                <div id="tableList">
                                </div>
                            </div>
                            <label
                                id="F_StateType" ></label>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="foot_btn_box">
        <asp:Button ID="btnSubmit" runat="server" Text="保&nbsp;&nbsp;存" CssClass="btnSubmit"
            OnClientClick="return validate();" OnClick="btnSubmit_Click" />
    </div>
    </form>
</body>
</html>
