cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>industryList.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    [@static_file /]
    <script type="text/javascript">
        var up_id = 0;
        $(document).ready(function(){
            $("#content").css({"height":$(document).height()*0.97});
            var options = {
                url : 'industryListJson.html',
                singleSelect : true,
                toolbar:'#tb',
                border:true,
                pagination:true,
                pageSize:5,
                pageList:[5,10,15,20],
                fit:true,
                queryParams : {
                },
                columns : [[
                    {field:'checkbox',title:"选择",checkbox:true},
                    {field:'ID',title:"ID",width:5,hidden:true},
                    {field:'SN',title:"顺序号",width:100,sortable:true},
                    {field:'INDUSTRY_NAME',title:"行业名称",width:100,sortable:true},
                    {field:'STATUS',title:"状态",width:100,sortable:true,
                        formatter: function(value,row,index){
                            if (row.STATUS == "1"){
                                return "在用";
                            } else if(row.STATUS == "2") {
                                return "禁用";
                            } else{
                                return "";
                            }
                        }
                    }
                ]]
            };
 
            $("#industryList").datagrid(initOptions(options));
            
            $('#industryTree').tree({
                url:'industryTree.html',
                method:'get',
                onBeforeExpand:function(node,param){  
                     $('#industryTree').tree('options').url = "industryTree.html?Id="+node.id;
                 },
                onClick: function(node){
                    up_id = node.id;
                    reloadDataGrid("industryList",{up_id:up_id});
                }
            });
        });
        
        function add(){
            window.top.openDialog(0,50,50,'地址添加',$.http.getAbsoluteUrl('addIndustry.html?up_id='+up_id),{
                    buttons:[{text:"提交",iconCls:'icon-add',_handler:"_onFormSubmit()"},{text:"关闭",_handler:"closeWin()"}]
                });
            return false;
        }
        
        function modify(){
        var row = $("#industryList").datagrid("getSelected");
        if(row == null){alert("请选择要修改的数据");return false;}    
        window.top.openDialog(0,50,50,'修改功能',$.http.getAbsoluteUrl('addIndustry.html?id='+row.ID),{
                buttons:[{text:"提交",iconCls:'icon-add',_handler:"_onFormSubmit()"},{text:"关闭",_handler:"closeWin()"}]
            });
        }
        
        function disable(){
            var row = $("#industryList").datagrid("getSelected");
            if(row == null){alert("请选择要禁用的地址");return false;}
            if(row.ADDRESS_STATUS == 2){alert("禁用失败,地址已处于禁用中");return false;}
            if(!confirm('确定要禁用该地址吗?')) return false;
            $.get("disable.html",{id:row.ID},function(data){
                  if(data == "1"){
                      alert('禁用成功!');
                      reloadDataGrid("industryList",{});
                      removeTreeNode("industryTree",row.ID);
                  } else {
                      alert('禁用失败,请重试!');
                  }
            });
        }
        
        function able(){
            var row = $("#industryList").datagrid("getSelected");
            if(row == null){alert("请选择要启用的地址");return false;}
            if(row.ADDRESS_STATUS == 1){alert("启用失败,地址已处于启用中");return false;}
            if(!confirm('确定要启用该地址吗?')) return false;
            $.get("able.html",{id:row.ID},function(data){
                  if(data == "1"){
                      alert('启用成功!');
                      reloadDataGrid("industryList",{});
                      reloadTree("industryTree");
                  } else {
                      alert('启用失败,状态已处于启用中!');
                  }
            });
        }
        
        function del(){
            var row = $("#industryList").datagrid("getSelected");
            if(row == null){alert("请选择要删除的数据");return false;}    
            if(!confirm('确定要删除该数据吗?')) return false;
            $.get("del.html", {id:row.ID},function(data){
                  if(data == "1"){
                      alert("该地址下存在正在使用的地址,不允许删除!");    
                  } else {
                    reloadDataGrid("industryList",{up_id:up_id});
                      removeTreeNode("industryTree",row.ID);
                      alert('删除成功!');              
                  }
            });
        }
    </script>
</head>
 
<body>
    <div style="float:left;width:15%">
        <ul id="industryTree" class="easyui-tree"></ul>
    </div>
    <div id="content" style="float:right;width:85%" >
        <div id="tb">
            <a href="####" onclick="return add();"  class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-add'">添加</a>
            <a href="####" onclick="return modify();"  class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-edit'">修改</a>
            <a href="####" onclick="return disable()"  class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-remove'">禁用</a>
            <a href="####" onclick="return able()"  class="easyui-linkbutton" plain="true" data-options="iconCls:'icon-ok'">启用</a>
        </div>
        <table id="industryList"></table>
    </div>
</body>
</html>