IT-KIMI_SHI\SINOIT.KIMI
2018-06-04 b12dfac6e495d6cf38df6b7e5222191f59762900
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
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>上传记录</title>
    <link href="../../css/commons.css" rel="stylesheet" type="text/css">
    <link href="../../css/controls.css" rel="stylesheet" />
    <link href="../../css/grid.css" rel="stylesheet" type="text/css">
    <script src="../../js/jquery-1.7.2.min.js"></script>
    <script src="../../js/core.js"></script>
    <script src="../../js/grid.js"></script>
    
    <script type="text/javascript" >
        var user, grid, filter, param = "";
        
        //1.查询条件
        function clearFilter(){
            filter.clear();
        }
        
        function query(){
            param = filter.toFilter();
            
            var url = "root/data/customerorgmsg/getSetByPage?pageno=1&pagesize=20&orderby=updatetime desc";
            grid.setURL(url);
        }
        
        //2.单据操作
        function newCompany() {
            var data = grid.getSelected();
            if(data) {
                data = data.record;
            }
            Win.popup({
                width: 800,
                height: 500,
                data: data,
                url: "root/page/manager/newcompany.html",
                callback: saveLine
            });
        }
        
        function newProject() {
            var data = grid.getSelected();
            if(data) {
                data = data.record;
            }
            Win.popup({
                width: 800,
                height: 500,
                data: data,
                url: "root/page/manager/newproject.html",
                callback: saveLine
            });
        }
        
        function saveLine(data)  {
            if(!data || !data.table) {
                return;
            }
            var tablename = data.table;
            data.table = null;
            Server.saveData("root/data/"+ tablename,data,function(result){
                if(result){
                    window.top.location.href = "manager_index.html?num=2&" + new Date().getTime();
                }
            });
        }
        
        function Changetype(element, value) {
            if ("top" == value) {
                value = "Top客户";
            }
            else if ("potentialingtop" == value) {
                value = "潜力Top客户";
            }
            else if ("nottop" == value) {
                value = "非TOP";
            }
            else if ("common" == value) {
                value = "普通客户";
            }
            element.html(value);
            
        }
        
        function isActive(element, value) {
            if ("T" == value) {
                value = "激活";
            }
            else if ("F" == value) {
                value = "冻结";
            }
            element.html(value);
        }
        
        function changeActive() {
            var line = grid.getSelected() ? grid.getSelected().record : null;
            
            if (!line) {
                Dialog.alert("请选择一条记录");
                return;
            }
            if (!line.id){
                Dialog.alert("未有相关记录");
                return;
            }
            
            var params = "table=customerorgmsg&field=active&filter=id='" + line.id + "'";
            if(line.active == "T") {
                params += "&active=F"
            }
            else if(line.active == "F") {
                params += "&active=T"
            }
            Server.call("root/data/procedure/updatetableactive/changecount", params, function(result){
                if(result.success) {
                    if(result.integer == 1) {
                        window.top.location.href = "manager_index.html?num=2&" + new Date().getTime();
                    }
                }
            });
        }
        
        function addcompanyproject() {
            var line = grid.getSelected() ? grid.getSelected().record : null;
            if(!line) {
                alert("请选择一个公司");
                return;
            }
            line.opttype = "add";
            Win.popup({
                width: 800,
                height: 500,
                data: line,
                url: "root/page/manager/projectList.html",
                callback: saveLine
            });
            
        }
        
        function delcompanyproject() {
            var line = grid.getSelected() ? grid.getSelected().record : null;
            if(!line) {
                alert("请选择一个公司");
                return;
            }
            
            line.opttype = "del";
            
            Win.popup({
                width: 800,
                height: 500,
                data: line,
                url: "root/page/manager/projectList.html",
                callback: saveLine
            });
            
        }
        
        //4.
        $(document).ready(function() {
            user = window.top.user;
            
            grid = new $.fm.Grid({
                element: "sheet",
                showPage:true,
                limit: 18,
                columns: [
                    {field: "id", caption: "id", width: 120},
                    {field: "opttype", caption: "操作类型", width: 200},
                    {field: "filetype", caption: "文件类型", width: 200},
                    {field: "uploaduserid", caption: "上传人员id", width: 120},
                    {field: "status", caption: "状态", width: 240, align: "left"},
                    {field: "excellines", caption: "excel条数", width: 100,  render: Changetype},
                    {field: "updatetime", caption: "操作时间", width: 180},
                    {field: "logurl", caption: "Log文件路径", width: 150, render: isActive}
                ]
            });
            
            filter = new Filter({
                element: "query"
            });
            
            query();
        });
    </script>    
</head>
 
<body style="overflow: hidden;">
    <div id="sheet" style="margin: 0px 15px"></div>
    
</body>
</html>