username@email.com
2025-05-12 ae6e40362a745caef9ead36f81f38313fb8c2c66
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SiteInfoCate.aspx.cs" Inherits="CY.WebForm.Pages.InfoManage.SiteInfoCate" %>
 
<!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 id="Head1" runat="server">
    <title>新闻信息管理</title>
    <uc:CMSHead ID="CMSHead1" runat="server" />
    <!-- 树start-->
    <script type="text/javascript" src="../../libs/js/tree/ztree/ztree.js"></script>
    <link href="../../libs/js/tree/ztree/ztree.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var setting1 = {
            view: {
//                addHoverDom: addHoverDom,
                removeHoverDom: removeHoverDom,
                selectedMulti: false
            },
            edit: {
                enable: true,
                renameTitle: "修改",
                removeTitle: "删除", 
                showRemoveBtn: showRemoveBtn,
                showRenameBtn: showRenameBtn
            },
            callback: {
                //不允许拖拽
                beforeDrag: beforeDrag1,
                //修改前确认
                beforeEditName: beforeEditName1,
                //删除前确认
                beforeRemove: beforeRemove1,
                //单击展开节点
                onClick: onNodeClick1
            }
        };
 
        //删除按钮
        function showRemoveBtn(treeId, treeNode) {
            return !treeNode.isParent;
        }
        //编辑按钮
        function showRenameBtn(treeId, treeNode) {
            return true;
        }
         
        var zNodes1 = [
        <%=treeHtml %>
    ];
 
        function initComplete() {
            $.fn.zTree.init($("#tree-1"), setting1, zNodes1);
        };
 
        function beforeDrag1(treeId, treeNodes) {
            return false;
        };
 
        //确认是否进入编辑状态
        function beforeEditName1(treeId, treeNode) {
            var KeyId = treeNode.id;
           var treeName_o = treeNode.Name
            if(KeyId == "234" || treeName_o =="新闻资讯分类")
            {
                alertMsg("顶级菜单不可编辑");
            }else{
                $.ajax({
                    url: "/Pages/common/CommonAjax.aspx",
                    type: "POST",
                    dataType: "html",
                    data: { info_datetype: "newsinfo", KeyId: KeyId },
                    global: false,
                    cache: false,
                    success: function (data) {
                        var jnone = [];
                        eval("jnone=" + data);
                        $("#hideKeyId").val(jnone.Keyid);
                        $("#selParentId").val(jnone.ParentId);
                        $("#txtTitle").val(jnone.Title);
                        $("#selIsHomeShow").val(jnone.IsHomeShow+'');
           
                        $("#selIsOtherPage").val(jnone.IsOtherPage+'');
                        $("#txtHerf").val(jnone.Herf);
                        if(jnone.Icon !="")
                        {
                             $("#imgIcon").attr("src",jnone.Icon);
                             $("#imgIcon").show();
                        }
                        $("#txtOrderNum").val(jnone.OrderNum);
                        $("#selStatus").val(jnone.Status);
                    }
                });
            }
            return false;
        };
 
        //确认是否删除+删除处理
        function beforeRemove1(treeId, treeNode) {
            var zTree = $.fn.zTree.getZTreeObj("tree-1");
            //选中该节点
            zTree.selectNode(treeNode);
            top.Dialog.confirm("删除此分类将会删除此分类下面的全部新闻信息,确认删除 <b>" + treeNode.name + "</b> 吗?", function () {
               
                //此处进行ajax后台数据处理
                $.ajax({
                    url: "/Pages/InfoManage/NewsCate.aspx",
                    type: "POST",
                    dataType: "html",
                    data: { deleteid:treeNode.id},
                    global: false,
                    cache: false,
                    success: function (data) {
                        if(data == "1"){
                             zTree.removeNode(treeNode);
                            alertMsg("删除成功");
                            }else{
                            alertMsg("删除失败");
                            }
                    }
                });
            });
            return false;
        };
 
        //单击展开节点
        function onNodeClick1(event, treeId, treeNode){
            var zTree = $.fn.zTree.getZTreeObj("tree-1");
            zTree.expandNode(treeNode);
        };
 
        
        function removeHoverDom(treeId, treeNode) {
            $("#addBtn_" + treeNode.id).unbind().remove();
        };
 
        function ClearKeyId() {
            $("#hideKeyId").val("");
        }
    </script>
    <!-- 树end -->
</head>
<body>
    <form id="form1" runat="server" class="form">
    <div id="scrollContent">
        <div class="box1">
            <div style="float: left; width: 320px; border: 1px solid #CCCCCC; height: 100%; padding: 10px;">
                <ul id="tree-1" class="ztree">
                </ul>
            </div>
            <div style="float: left; border: 1px solid #CCCCCC; margin-left: 20px; height: 100%; padding: 10px;">
                <table>
                    <tr>
                        <td class="ali03 w100px">
                            当前编号:
                        </td>
                        <td>
                            <input type="text" runat="server" id="hideKeyId" class="w40px" readonly="readonly" />
                            新增请点击 <span id="spanClearKeyId" class="red CP" style="text-decoration: underline;" onclick="ClearKeyId();">清空编号</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="ali03 w100px">
                            父级菜单:
                        </td>
                        <td>
                            <select id="selParentId" runat="server" keepdefaultstyle="true">
                                <option value="0">顶级菜单</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="ali03">
                            分类名称:
                        </td>
                        <td>
                            <input type="text" id="txtTitle" runat="server" class="w143px req" />
                        </td>
                    </tr>
                    <%--<tr>
                    <td class="ali03">是否首页展示:</td><td><select id="selIsHomeShow" runat="server" keepDefaultStyle="true" ><option value="true">是</option><option value="false">否</option></select></td>
                </tr>
                <tr>
                    <td class="ali03">是否外部链接:</td><td><select id="selIsOtherPage" runat="server" keepDefaultStyle="true" ><option value="false">否</option><option value="true">是</option></select></td>
                </tr>
                <tr>
                    <td class="ali03">链接地址:</td><td><input type="text" id="txtHerf" runat="server" class="w143px" /></td>
                </tr>
                <tr>
                    <td class="ali03 valign01">分类图标:</td>
                    <td>
                        <input type="file" id="fileIcon" name="fileIcon" runat="server" keepDefaultStyle="true" /><br />
                        <img src="" width="20" height="20" style="display:none;" id="imgIcon" />
                    </td>
                </tr>--%>
                    <tr>
                        <td class="ali03">
                            分类排序:
                        </td>
                        <td>
                            <input type="text" id="txtOrderNum" runat="server" class="req int" value="1" />
                        </td>
                    </tr>
                    <tr>
                        <td class="ali03">
                            状态:
                        </td>
                        <td>
                            <select id="selStatus" runat="server" keepdefaultstyle="true">
                                <option value="True">启用</option>
                                <option value="False">禁止</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="ali03">
                        </td>
                        <td>
                            <asp:Button ID="btn_Submit" Text="提交" runat="server" OnClick="btn_Submit_Config" />
                        </td>
                    </tr>
                </table>
            </div>
            <div class="CB">
            </div>
        </div>
    </div>
    </form>
    <script type="text/javascript">
        $(function () {
            $("#selParentId option").each(function (ii, vv) {
                $(this).html($(this).html().replace(/[.]/g, "&nbsp;"));
            });
        });
    </script>
</body>
</html>