IT-KIMI_SHI\SINOIT.KIMI
2018-06-01 64c40fb427bff513f575f11e4c1e7bd9a1bfe3e3
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
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>流程列表</title>
        <link href="../../../css/common.css" rel="stylesheet" type="text/css">
        <link href="../../../css/control.css" rel="stylesheet" type="text/css"/>
        <link href="../../../css/grid.css" rel="stylesheet" type="text/css">
        
        <script src="../../../js/jquery-1.7.2.min.js"></script>
        <script src="../../../js/foundation-2.0.js"></script>
        <script src="../../../js/grid.js"></script>    
            
        <style>
            .div_coming_label{ margin:30px; color:#808080; text-align:center;font-size: 22px;font-family: STHupo; }
            .img_coming_icon{ display:block; margin:10px auto; width:128px; height:128px; }
        </style>
        
        <script type="text/javascript">
        var grid;
        
        function uploadModel(){
            $("#input_file").click();
            $("#input_commit").commit();
            
        }
        
        function collectFile(e){
            var files = e.target.files || e.dataTransfer.files;
            if(!files){return;}
            fileUploader.uploadOneFile(files[0],0,1);
        }
        
        function downlad(){
            var line = grid.getSelected();
            var modelId = line.id;
            if(modelId){
                download_file("root/process/repository/getModelXml?modleId="+modelId);
            }
        }
        
        function download_file(url) { 
            var iframe = document.createElement("iframe"); 
            download_file.iframe = iframe; 
            document.body.appendChild(download_file.iframe); 
            download_file.iframe.src = url; 
            download_file.iframe.style.display = "none"; 
        } 
        
        function suspensionModel(){
            var line = grid.getSelected();
            var modelId = line.id;    
            var issuspension = line.issuspension;
            var type;
            if(issuspension == "false"){
                type = "suspend";
            }else {
                type = "active";
            }
            
            if (modelId){
                var params = "modelId="+modelId+"&type="+type;
                Server.call("root/process/repository/updateProcessDefStatus",params,function(callback){
                    alert(JSON.stringify(callback));
                    if(callback.success){
                        alert(callback.string);
                        grid.refresh();
                    }
                });
            }
            else{
                alert("当前model不存在");
            }
        }
 
        function deployModel() {
            var line = grid.getSelected();
            var modelId = line.id;
            if (modelId){
                Server.call("root/process/repository/deployModel","modelId="+modelId,function(callback){
                    alert(JSON.stringify(callback));
                    if(callback.success){
                        alert(callback.string);
                        grid.refresh();
                    }
                });
            }
            else{
                alert("当前model不存在");
            }
            
        }
        
        function startprocess(){
            var line = grid.getSelected();
            var isdeploymented = line.isdeploymented;
            if (isdeploymented == "true"){
                var deploymentid = line.category;
                setLocalData("deploymentid",deploymentid);
                setLocalData("modelid",line.id);
                location.href = "../form.html?" + new Date().getTime();
            }
            else {
                alert("model未部署请先部署model");
            }
        } 
        
        function upload(){
            var file = document.getElementById("input_file").files[0];
            var fileName = file.name.toLowerCase();
            // only upload zip,bar,bpmn
            alert(fileName.indexOf('bpmn.xml'));
            if(fileName.indexOf('zip')== -1 && fileName.indexOf('bar')== -1 && fileName.indexOf('bpmn.xml')== -1){
                alert("仅能上传zip,bar,bpmn文件");
            }
            
            uploadFlow(file);
        }
        
        function uploadFlow(data){
            var fileName = data.name.toLowerCase();
            Dialog.confirm("信息提示", "确定上载[" + fileName + "]中的数据?",function(result){
                if(result){
                var formData = new FormData();
                formData.append("file",data);
                        $.ajax({  
                             url : "root/process/repository/uploadProcess",  
                             type : "POST",  
                             data : formData,  
                             success : function(data) {  
                                  alert(JSON.stringify(data));  
                             },  
                             error : function(data) {  
                                  alert(JSON.stringify(data));  
                             }  
                        });  
                }
            });
        }
        
        function Query(){
            param = filter.toFilter();
            var url = "root/data/procedure/getSalesflow/pageno=1&pagesize=10&" + param;
            grid.setURL(url);
        }        
        
        $(document).ready(function() {
        
            fileUploader = new FileUploader({
                sendData: function(xhr, formdata, file, index, count){
                        formdata.append("fileList", file);
                        var url = "";
                        xhr.open("POST", url, true);
                        xhr.send(formdata);
                },
                onSuccess: function(success, dataline, result, callNext){
                }
 
            });
                $("#input_file").bind("input",function(e){
                    
                });
            
            //Server.call("root/process/repository/uploadProcess",null,function(callback){});
                    
            grid = new $.fm.Grid({
                element: "sheet",
                url: "root/process/repository/getProcessList?pageno=1&pagesize=10",
                showPage: true,
                limit: 12,
                columns: [
                    {field: "id", caption: "编号", width: 100},
                    {field: "name", caption: "名称", width: 100},
                    {field: "category", caption: "类别", width: 100},
                    {field: "version", caption: "版本", width: 100},
                    {field: "createtime", caption: "创建时间", width: 180, align: "left"},
                    {field: "lastupdatetime", caption: "最后更新时间", width: 180, align: "left"},
                    {field: "isdeploymented", caption: "是否部署", width: 100, align: "left"},
                    {field: "deploymenttime", caption: "部署时间", width: 180, align: "right"},
                    {field: "description", caption: "描述", width: 100, align: "right"},
                    {field: "issuspension", caption: "挂起", width: 100, align: "right"}
                ],
                onSelect:function(allSelect,SelectedInfo){
                    if(!SelectedInfo){
                        $("#suspension_model").html("挂起");
                        return;
                    }
                
                    if(SelectedInfo.issuspension == "true"){
                        $("#suspension_model").html("激活");
                    }else{
                        $("#suspension_model").html("挂起");
                    }
    
                }
            });        
        });
        </script>        
    </head>
  
<body>
    
    <div id="sheet" style="margin: 0px 15px"></div>
    
    <div style="height: 30px; line-height: 30px; margin-top: 15px;" align="center">
        <div class="btn btn-green" onclick="startprocess();">启动</div>
        <div class="btn btn-green" onclick="deployModel();">部署</div>
        <div class="btn btn-green" onclick="suspensionModel();" id="suspension_model">挂起</div>
        <div class="btn btn-green" onclick="downlad();" >下载</div>
        <div class="btn btn-green" onclick="upload();" style="margin-left: 30px;">上载</div>
        <div id="fileUploader" >
            
                    <input id="input_file" type="file" size="30" >
        </div>
    
    </div>    
</body>
</html>