@model GBLab.Entities.T_Department
@using GBLab.Common.Expand
@{
    Layout = null;
}

<form method="post" action="/Manage/Department/Action_Edit_Add" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
    <span id="Department_TypeId" style="display: none;">@Request.QueryString["F_TypeId"].ToString()</span>
    <div class="tabs" currentindex="0" eventtype="click">
        <div class="tabsHeader">
            <div class="tabsHeaderContent">
                <ul>
                    <li><a href="javascript:;"><span>基本信息</span></a></li>
                    <li><a href="javascript:;"><span>图片信息</span></a></li>
                    <li><a href="javascript:;"><span>附件信息</span></a></li>
                    <li style="display:none"><a href="javascript:;"><span>SEO信息</span></a></li>
                    <li><a href="javascript:;"><span>辅助信息</span></a></li>
                </ul>
            </div>
        </div>

        <div class="tabsContent" layoutH="78">
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl style="display: none;">
                        <dt>执行参数：</dt>
                        <dd>
                            <input type="text" name="Action" maxlength="20" alt="请输入执行参数" value='@Request.QueryString["Action"].ToString()' />
                        </dd>
                    </dl>


                    <dl class='nowrap' style="display: none;">
                        <dt>类别ID：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_TypeId", "类别ID", Model.F_TypeId == null ? "" : Model.F_TypeId.ToString(), "true", "", "1", "80", "", ""))
                        </dd>
                    </dl>

                    <dl class='nowrap' style="display: none;">
                        <dt>类别名称：</dt>
                        <dd>
                            <input style="width: 300px" id="Item_F_TypeName" type="text" readonly value="@(Model.T_Type==null?"":Model.T_Type.F_Name.ToString())" onclick="Item_F_TypeName_ShowMenu()" />
                        </dd>
                    </dl>



                    <dl class='nowrap' style="display:none;">
                        <dt>相关类别IDS：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_TypeIds", "类别ID", Model.F_TypeIds == null ? "" : Model.F_TypeIds.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>

                    <dl class='nowrap' style="display: none;">
                        <dt>相关类别：</dt>
                        <dd>
                            <input id="Item_F_TypeNames" type="text" readonly value="@(Model.F_TypeIds == null ? "" : GBLab.Entities.T_Type.GetNamesByIds(Model.F_TypeIds.ToString()))" style="width:300px;" onclick="Item_F_TypeNames_ShowMenu()" />
                        </dd>
                    </dl>
                    <dl>
                        <dt>唯一标识：</dt>
                        <dd style="color:green;font-weight:bold;">
                            @("【ID:" + Model.F_Id.ToString() + "】-【Guid:" + Model.F_Guid.ToString() + "】")
                        </dd>
                    </dl>


                    <dl class='nowrap'>
                        <dt>名称：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Name", "名称", Model.F_Name == null ? "" : Model.F_Name.ToString(), "true", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>副标题：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_SubTitle", Model.F_SubTitle == null ? "" : Model.F_SubTitle.ToString(), "5", "100"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>状态：</dt>
                        <dd>
                            @Html.DropDownListFor(model => model.F_MarkStatus, ViewData["MarkStatus"] as List<SelectListItem>, new { @class = "combox", })
                        </dd>
                    </dl>

                    <dl class='nowrap' style="display: none;">
                        <dt>扩展分类标识：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_MarkName", "扩展分类标识", Model.F_MarkName == null ? "" : Model.F_MarkName.ToString(), "false", "", "1", "80", "", ""))
                        </dd>
                    </dl>


                    <dl class='nowrap' style="display: none;">
                        <dt>父节点：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_FatherId", "父节点", Model.F_FatherId == null ? "" : Model.F_FatherId.ToString(), "true", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>父节点：</dt>
                        <dd>
                            <input id="Item_F_FatherName" type="text" readonly value="@(Model.T_FatherDepartment==null?"":Model.T_FatherDepartment.F_Name.ToString())" onclick="Item_F_FatherName_ShowMenu()" />
                        </dd>
                    </dl>


                    <dl class='nowrap'>
                        <dt>排序：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_SortOrder", "排序", Model.F_SortOrder == null ? "" : Model.F_SortOrder.ToString(), "true", "", "1", "80", "", ""))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>下级子类数量：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_ItemCount", "下级子类数量", Model.F_ItemCount == null ? "" : Model.F_ItemCount.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>所有子类数量：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_ItemAllCount", "所有子类数量", Model.F_ItemAllCount == null ? "" : Model.F_ItemAllCount.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>

                    <dl class='nowrap' style="display: none;">
                        <dt>标签：</dt>
                        <dd>
                            <div>
                                @Html.Raw(Html.WebInput_BackValue("Tags.name", "Tags", Model.F_Tags == null ? "" : Model.F_Tags.ToString(), "标签"))
                            </div>

                            <a class="btnLook" href="/manage/tags/list?back=0&single=0" lookupGroup="Tags" target='dialog' max="true" minable="false" mask="true">查找带回</a>
                        </dd>
                    </dl>


                    <dl class='nowrap'>
                        <dt>说明：</dt>
                        <dd>
                            @Html.Raw(Html.WebEditor("F_Info", Model.F_Info == null ? "" : Model.F_Info.ToString(), "18", "120"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>封面图：</dt>
                        <dd style='margin-bottom:15px;'>
                            @Html.Raw(Html.WebFile_Image("F_Logo", Model.F_Logo == null ? "" : Model.F_Logo.ToString(), "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>内容相册：</dt>
                        <dd style='margin-bottom:15px;'>
                            @Html.Raw(Html.WebFile_Image("F_Imgs", Model.F_Imgs == null ? "" : Model.F_Imgs.ToString(), "true"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>内容附件：</dt>
                        <dd style='margin-bottom:15px;'>
                            @Html.Raw(Html.WebFile_File("F_Files", Model.F_Files == null ? "" : Model.F_Files.ToString(), "true"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div style="display:none">
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>SEO标题：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_SeoTitle", Model.F_SeoTitle == null ? "" : Model.F_SeoTitle.ToString(), "5", "100"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>SEO关键词：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_SeoKeyWord", Model.F_SeoKeyWord == null ? "" : Model.F_SeoKeyWord.ToString(), "5", "100"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>SEO描述：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_MutiRow("F_SeoDescription", Model.F_SeoDescription == null ? "" : Model.F_SeoDescription.ToString(), "5", "100"))
                        </dd>
                    </dl>
                </div>
            </div>
            <div>
                <div class="pageFormContent" style="padding: 5px; background-color: #eef4f5;border-style:none;" layoutH="88">
                    <dl class='nowrap'>
                        <dt>Id：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Id", "Id", Model.F_Id == null ? "" : Model.F_Id.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>Guid：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Guid", "Guid", Model.F_Guid == null ? "" : Model.F_Guid.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>树形路径：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_Path", "树形路径", Model.F_Path == null ? "" : Model.F_Path.ToString(), "false", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>添加人：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_AddUserId", "添加人", Model.T_AddUser == null ? "" : Model.T_AddUser.F_Name, "true", "", "1", "80", "", "", "true", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>添加日期：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Date("F_AddDate", Model.F_AddDate.ToString("yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss", "-30", "20", "true", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>更新人：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_UpdateUserId", "更新人", Model.T_UpdateUser == null ? "" : Model.T_UpdateUser.F_Name, "true", "", "1", "80", "", "", "true", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>更新日期：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Date("F_UpdateDate", Model.F_UpdateDate.ToString("yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss", "-30", "20", "true", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>浏览次数：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_ViewNum", "浏览次数", Model.F_ViewNum == null ? "" : Model.F_ViewNum.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>留言次数：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_GuestBookNum", "留言次数", Model.F_GuestBookNum == null ? "" : Model.F_GuestBookNum.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>点赞数量：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_GoodNum", "点赞数量", Model.F_GoodNum == null ? "" : Model.F_GoodNum.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                    <dl class='nowrap'>
                        <dt>差评数量：</dt>
                        <dd>
                            @Html.Raw(Html.WebInput_Common("F_BadNum", "差评数量", Model.F_BadNum == null ? "" : Model.F_BadNum.ToString(), "true", "", "1", "80", "", "", "true"))
                        </dd>
                    </dl>
                </div>
            </div>
        </div>
        <div class="tabsFooter">
            <div class="tabsFooterContent">
            </div>
        </div>
    </div>
    <div class="tabsFooter">
        <div class="tabsFooterContent">
            <div class="formBar" style="padding: 0;border-width: 1px;margin-top:3px;">
                <ul style="margin-top: 3px; margin-right: 3px;">
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="submit">
                                    提交
                                </button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonActive">
                            <div class="buttonContent">
                                <button type="button" onclick="$.pdialog.reload('/Manage/Department/Edit?Action=Add&F_TypeId=' + @Request.QueryString["F_TypeId"].ToString(), '' , 'TagEditPage' )">
                                    创建
                                </button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="button">
                            <div class="buttonContent">
                                <button type="button" class="close">
                                    取消
                                </button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</form>

@*单选树*@
<div id="Item_F_TypeName_Div" class="menuContent" style="display:none; position: absolute;">
    <ul id="Item_TypeName_Div_Tree" class="ztree" style="margin-top:0; width:180px; height: 300px;background-color:white;border:1px solid #efefef;"></ul>
</div>

@*单选树*@
<script type="text/javascript" language="javascript">
    var Item_TypeId = 10174;

    var Item_F_TypeName_Setting = {
        check: {
            enable: true,
            chkStyle: "radio",
            radioType: "all"
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: Item_F_TypeName_OnClick,
            onCheck: Item_F_TypeName_OnCheck
        }
        ,
        async: {
            enable: true,
            url: "/Manage/HeDiaoCases/Action_GetType",
            autoParam: ["id"],
            otherParam: { "typeid": Item_TypeId },
            dataFilter: Item_F_TypeName_Filter
        }
        , showLine: true,
    };

    function Item_F_TypeName_Filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }

    function Item_F_TypeName_OnClick(event, treeId, treeNode, clickFlag) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeName_Div_Tree");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function Item_F_TypeName_OnCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeName_Div_Tree");

        nodes = zTree.getCheckedNodes(true),

        v = "";
        name = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            v += nodes[i].id;
            name += nodes[i].name;
        }

        $("#Item_F_TypeId").attr("value", v);
        $("#Item_F_TypeName").attr("value", name);
    }

    function Item_F_TypeName_ShowMenu() {
        $("#Item_F_TypeName_Div").css({ left: "146px", top: "97px" }).slideDown("fast");
        $("body").bind("mousedown", Item_F_TypeName_OnBodyDown);
    }

    function Item_F_TypeName_OnBodyDown(event) {

        if (!(
            event.target.id == "Item_F_TypeId"
            || event.target.id == "Item_F_TypeName_Div"
            || $(event.target).parents("#Item_F_TypeName_Div").length > 0
            )) {

            $("#Item_F_TypeName_Div").fadeOut("fast");
            $("body").unbind("mousedown", Item_F_TypeName_OnBodyDown);
        }
    }

    $(function () {
        $.fn.zTree.init($("#Item_TypeName_Div_Tree"), Item_F_TypeName_Setting);
    })

</script>

@*部门单选树*@
<div id="Item_F_FatherName_Div" class="menuContent" style="display:none; position: absolute;">
    <ul id="Item_F_FatherName_Div_Tree" class="ztree" style="margin-top:0; width:180px; height: 300px;background-color:white;border:1px solid #efefef;"></ul>
</div>

@*部门单选树*@
<script type="text/javascript" language="javascript">
    var Item_DepartmentId = 1;

    var Item_F_FatherName_Setting = {
        check: {
            enable: true,
            chkStyle: "radio",
            radioType: "all"
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: Item_F_FatherName_OnClick,
            onCheck: Item_F_FatherName_OnCheck
        }
        ,
        async: {
            enable: true,
            url: "/Manage/Department/Action_GetDepartmentTree",
            autoParam: ["id"],
            otherParam: { "typeid": Item_DepartmentId },
            dataFilter: Item_F_FatherName_Filter
        }
        , showLine: true,
    };

    function Item_F_FatherName_Filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }

    function Item_F_FatherName_OnClick(event, treeId, treeNode, clickFlag) {
        var zTree = $.fn.zTree.getZTreeObj("Item_F_FatherName_Div_Tree");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function Item_F_FatherName_OnCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("Item_F_FatherName_Div_Tree");

        nodes = zTree.getCheckedNodes(true),

        v = "";
        name = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            v += nodes[i].id;
            name += nodes[i].name;
        }

        $("#Item_F_FatherId").attr("value", v);
        $("#Item_F_FatherName").attr("value", name);
    }

    function Item_F_FatherName_ShowMenu() {
        $("#Item_F_FatherName_Div").css({ left: "146px", top: "237px" }).slideDown("fast");
        $("body").bind("mousedown", Item_F_FatherName_OnBodyDown);
    }

    function Item_F_FatherName_OnBodyDown(event) {

        if (!(
            event.target.id == "Item_F_FatherId"
            || event.target.id == "Item_F_FatherName_Div"
            || $(event.target).parents("#Item_F_FatherName_Div").length > 0
            )) {

            $("#Item_F_FatherName_Div").fadeOut("fast");
            $("body").unbind("mousedown", Item_F_TypeName_OnBodyDown);
        }
    }

    $(function () {
        $.fn.zTree.init($("#Item_F_FatherName_Div_Tree"), Item_F_FatherName_Setting);
    })

</script>

@*相关类别多选下拉树*@
<div id="Item_F_TypeNames_Div" class="menuContent" style="display:none; position: absolute;">
    <ul id="Item_TypeNames_Div_Tree" class="ztree" style="margin-top:0; width:180px; height: 300px;background-color:white;border:1px solid #efefef;"></ul>
</div>

@*相关类别多选下拉树*@
<script type="text/javascript" language="javascript">

    var Item_F_TypeNames_Setting = {
        check: {
            enable: true,
            chkboxType: { "Y": "", "N": "" }
        },
        view: {
            dblClickExpand: false
        },
        data: {
            simpleData: {
                enable: true
            }
        },
        callback: {
            onClick: Item_F_TypeNames_OnClick,
            onCheck: Item_F_TypeNames_OnCheck
        }
        ,
        async: {
            enable: true,
            url: "/Manage/HeDiaoCases/Action_GetType",
            autoParam: ["id"],
            otherParam: { "typeid": Item_TypeId },
            dataFilter: Item_F_TypeNames_Filter
        }
        , showLine: true,
    };

    function Item_F_TypeNames_Filter(treeId, parentNode, childNodes) {
        if (!childNodes) return null;
        for (var i = 0, l = childNodes.length; i < l; i++) {
            childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
        }
        return childNodes;
    }

    function Item_F_TypeNames_OnClick(event, treeId, treeNode, clickFlag) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeNames_Div_Tree");
        zTree.checkNode(treeNode, !treeNode.checked, null, true);
        return false;
    }

    function Item_F_TypeNames_OnCheck(e, treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("Item_TypeNames_Div_Tree");

        nodes = zTree.getCheckedNodes(true),

        v = "";
        name = "";
        for (var i = 0, l = nodes.length; i < l; i++) {
            v += nodes[i].id + ',';
            name += nodes[i].name + ',';
        }

        $("#Item_F_TypeIds").attr("value", v);
        $("#Item_F_TypeNames").attr("value", name);
    }

    function Item_F_TypeNames_ShowMenu() {
        $("#Item_F_TypeNames_Div").css({ left: "146px", top: "123px" }).slideDown("fast");
        $("body").bind("mousedown", Item_F_TypeNames_OnBodyDown);
    }

    function Item_F_TypeNames_OnBodyDown(event) {

        if (!(
            event.target.id == "Item_F_TypeIds"
            || event.target.id == "Item_F_TypeNames_Div"
            || $(event.target).parents("#Item_F_TypeNames_Div").length > 0
            )) {

            $("#Item_F_TypeNames_Div").fadeOut("fast");
            $("body").unbind("mousedown", Item_F_TypeNames_OnBodyDown);

        }

    }

    $(function () {
        $.fn.zTree.init($("#Item_TypeNames_Div_Tree"), Item_F_TypeNames_Setting);
    })

</script>