<%@ Page Title="" Language="C#" MasterPageFile="~/Styles/MasterPage/MasterPage_Edit.master" AutoEventWireup="true" CodeFile="ModuleFormat_Edit.aspx.cs" Inherits="System_ModuleFormat_ModuleFormat_Edit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script src="../../Scripts/iColorPicker/iColorPicker.js" type="text/javascript"></script>
    <script type="text/javascript">
        var action = '<%=xview["action"]%>';
        function save() {
            var id = $("#id").val();
            var field_name = $("#field_name").val();
            var title = $("#title").val();
            var width = $("#width").val();
            var sort = $("#sort").val();
            var show = $("#show").val();
            var sum_field = $("#sum_field").val();
            if (sum_field == undefined || sum_field == "") sum_field = "0";
            var color = $("#color").val();
            var auth_view = $("#auth_view").val();
            var auth_edit = $("#auth_edit").val();
            var can_edit = $("#can_edit").val();
            var default_value = $("#default_value").val();
            if (title == "") {
                parent.AlertNO("显示标题不允许为空!"); return;
            }
            if (width == "" || isNaN(width)) {
                parent.AlertNO("宽度不允许为空或非数值!");return;
            }
            if (sort == "" || isNaN(sort)) {
                parent.AlertNO("显示顺序不允许为空或非数值!"); return;
            }
            ShowLoadingMask(); //显示遮罩
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: 'ModuleFormat_Service.asmx/<%=xview["action"]%>',
                data: "{id:'" + id + "',field_name:'" + field_name + "',title:'" + title
                    + "',width:'" + width + "',sort:'" + sort + "',show:'" + show
                    + "',sum_field:'" + sum_field + "',color:'" + color
                    + "',auth_view:'" + auth_view + "',auth_edit:'" + auth_edit
                    + "',can_edit:'" + can_edit + "',default_value:'" + default_value + "'}",
                dataType: 'json',
                success: function (result) {
                    HideLoadingMask(); //关闭遮罩
                    var r = result.d;
                    if (r == "success") {
                        parent.AlertOK('保存成功!');
                        parent.search_grid();
                        CloseDivWin(); //关闭窗口
                    } else {
                        parent.AlertNO(r);
                    }
                    
                }
            });

        }
    </script>
    <div style="width:350px;height:340px;overflow:auto;">
	    <table style="margin:auto;">
            <tr style='display:none'>
                <td style="text-align:right">ID:</td>
                <td><input type="text" class="edit_text_box" id="id" disabled="disabled" value="<%=xview["id"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">列:</td>
                <td><input type="text" class="edit_text_box" id="field" disabled="disabled" value="<%=xview["field"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">列名:</td>
                <td><input type="text" class="edit_text_box" id="field_name" disabled="disabled" value="<%=xview["field_name"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">显示标题:</td>
                <td><input type="text" class="edit_text_box" id="title"value="<%=xview["title"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">颜色:</td>
                <td><input type="text" class="iColorPicker" id="color" style="width:50px"value="<%=xview["color"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">宽度:</td>
                <td><input type="text" class="edit_text_box" id="width" style="width:50px" value="<%=xview["width"]%>"/>(像素)</td>
            </tr>
            <tr>
                <td style="text-align:right">显示顺序:</td>
                <td><input type="text" class="edit_text_box" id="sort" style="width:50px"value="<%=xview["sort"]%>"/>(数值小的排在前面)</td>
            </tr>
            <tr>
                <td style="text-align:right">是否显示:</td>
                <td>
                    <select id="show">
                        <option value="1">显示</option>
                        <option value="0">隐藏</option>
                    </select>
                    <script type="text/javascript">
                        document.getElementById("show").value = '<%=xview["show"]%>';
                    </script>
                </td>
            </tr>
            <tr>
                <td style="text-align:right">合计行:</td>
                <td>
                    <select id="sum_field">
                        <option value="1">是</option>
                        <option value="0">否</option>
                    </select>
                    <script type="text/javascript">
                        document.getElementById("sum_field").value = '<%=xview["sum_field"]%>';
                    </script>
                </td>
            </tr>
            <tr>
                <td style="text-align:right">是否可编辑:</td>
                <td>
                    <select id="can_edit">
                        <option value="1">是</option>
                        <option value="0">否</option>
                    </select>
                    <script type="text/javascript">
                        document.getElementById("can_edit").value = '<%=xview["can_edit"]%>';
                    </script>
                </td>
            </tr>
            <tr>
                <td style="text-align:right">查看权限:</td>
                <td><input type="text" class="edit_text_box" id="auth_view" style="width:200px" value="<%=xview["auth_view"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">编辑权限:</td>
                <td><input type="text" class="edit_text_box" id="auth_edit" style="width:200px" value="<%=xview["auth_edit"]%>"/></td>
            </tr>
            <tr>
                <td style="text-align:right">默认值:</td>
                <td><input type="text" class="edit_text_box" id="default_value" style="width:200px" value="<%=xview["default_value"]%>"/></td>
            </tr>
	    </table>
        <div style="text-align:center;margin-top:10px">
            <input type="button" class='SiteButton' value="保存" onclick="save()"/>
        </div>
    </div>
</asp:Content>

