温红权 7 yıl önce
ebeveyn
işleme
f6f45a88c4

+ 28 - 14
VisualInspection/js/lib/mytable.js

@@ -23,13 +23,15 @@ String.prototype.replaceAll = function(s1, s2) {
             isShoWPager: true,
             pager: {
                 page_size: 10
-            }
+            },
+            renderfunction: function() {}
         };
         this.options = $.extend(true, {}, DEFAULTS, options);
         this.element = element;
         // this.options = options;
         this.pager = options.pager;
         this.con = $(element);
+        this.renderfunction = options.renderfunction;
         this.obj = this;
         $(element).html('');
         if (flag) return;
@@ -91,6 +93,7 @@ String.prototype.replaceAll = function(s1, s2) {
                 } else {
                     $("#kkpager").css("display", "block");
                 }
+                options.renderfunction();
             }, function(error) {
                 // alert(error);
             });
@@ -183,10 +186,12 @@ String.prototype.replaceAll = function(s1, s2) {
                             }
                         }
                         dArr.push(picStr);
-                    }else if (cols[i].type == "imagebutton") {
+                    } else if (cols[i].type == "imagebutton") {
                         var pics = obj[cols[i].field];
                         //pics ='chart/chart17,chart/chart17,chart/chart17,chart/chart17,chart/chart17';
                         var picStr = '';
+                        picStr = "<div style='padding-bottom:80px;position:relative'>";
+                        picStr += "<div style='border:1px solid #ddd;text-align:left'>";
                         var num = uuid();
                         if (pics) {
                             var picArr = pics.split(',');
@@ -199,6 +204,7 @@ String.prototype.replaceAll = function(s1, s2) {
                                 if (!src.startWith("http"))
                                     src = base_image_server_url + src;
 
+
                                 var videosrc = src;
                                 if (src.indexOf('.avi') != -1) {
                                     src = src.split('.avi')[0] + "_screen_0.png"
@@ -212,22 +218,30 @@ String.prototype.replaceAll = function(s1, s2) {
                                     src = src.split('.mp4')[0] + "_screen_0.png"
                                     ispic = false;
                                 }
-                                var pic = (ispic ? '<a class="card lightbox-toggle" onclick="img_play(\'' + src + '\')" href="javascript:void(0)" style="width:60px;height:50px;float:left;">' : '<a class="card" onclick="video_paly(\'' + videosrc + '\')" href="javascript:void(0)" style="width:60px;height:50px;">') +
-                                    '<img class="pic-class  img-thumbnail" style="width:60px;height:50px;" src="' + src + '" alt="">' + (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 30px;position: absolute;top: 10px;left: 15px;color: white;"></i>') +
-                                    '</a>';
+                                // var pic = (ispic ? '<a class="card lightbox-toggle" onclick="img_play(\'' + src + '\')" href="javascript:void(0)" style="width:60px;height:50px;float:left;">' : '<a class="card" onclick="video_paly(\'' + videosrc + '\')" href="javascript:void(0)" style="width:60px;height:50px;">') +
+                                //     '<img class="pic-class  img-thumbnail" style="width:60px;height:50px;" src="' + src + '" alt="">' + (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 30px;position: absolute;top: 10px;left: 15px;color: white;"></i>') +
+                                //     '</a>';
+
+                                var pic = '<div class="img_item" style="width:80px;height:45px;display:inline-block;margin-right:5px">' +
+                                    '<a href="javascript:void(0)" onclick="removeVideo(\'' + obj.id + '\',\'' + pics + '\',\'' + j + '\')" style="float:right;position:relative;z-index:100;font-size:10px"><span class="label label-danger" style="padding:0"><i class="icon icon-remove-circle"></i> 删除</span></a>' +
+                                    (ispic ? '<a class="card lightbox-toggle" data-group="image-group-1" data-lightbox-group="example-3" href="' + src + '" style="position:absolute">' : '<a class="card" onclick="video_paly(\'' + videosrc + '\')" href="javascript:void(0)" style="position:absolute">') +
+                                    '<img class="pic-class img-thumbnail" path="' + videosrc + '" style="width:80px;height:45px;" src="' + src + '" alt="">' + (ispic ? '' : '<i class="icon icon-play-circle" style=" font-size: 20px;position: absolute;top: 15px;left: 30px;color: white;"></i>') +
+                                    '</a>' +
+                                    '</div>';
                                 picStr += pic;
                             }
                         }
+                        picStr += "</div>";
                         // picStr += '<a href="javascript:void(0)" class="btn-table" onclick=""><i class="icon ' +' text-center' + '"></i>' + "继续上传" + ' </a>';
                         //picStr +="<button onclick='openUpload()' style='width:80%;background-color:#2196F3;color:white'>继续上传</button>"
-                      //  picStr +="<input id='fileupload' type='file' style='display:none'></input>"
-                      picStr +='<div id="uploaderExample_'+obj.id+'" class="uploader">'
-                              +'<div class="file-list" data-drag-placeholder="请拖拽文件到此处" style=""></div>';
-                      picStr +='<button onclick="setRecordId(\''+obj.id+'\',\''+pics+'\')" type="button" class="btn btn-primary uploader-btn-browse" style="float:left;"><i class="icon icon-cloud-upload"></i> 选择文件</button>';
-                              +'</div>'; 
-                      dArr.push(picStr);
-                    }
-                     else if (cols[i].oper != null) {
+                        //  picStr +="<input id='fileupload' type='file' style='display:none'></input>"
+                        picStr += '<div style="position:absolute;bottom:10px;width:200px"><div id="uploaderExample_' + obj.id + '" class="uploader uploadervideo">' +
+                            '<div class="file-list" data-drag-placeholder="请拖拽文件到此处" style="margin-bottom:5px"></div>';
+                        picStr += '<button onclick="setRecordId(\'' + obj.id + '\',\'' + pics + '\')" type="button" class="btn btn-primary uploader-btn-browse" style="float:left;width:100%"><i class="icon icon-cloud-upload"></i> 选择文件</button>'; +
+                        '</div></div>';
+                        picStr += "</div>";
+                        dArr.push(picStr);
+                    } else if (cols[i].oper != null) {
                         var oper = cols[i].oper;
                         var operStr = "";
                         for (var j = 0; j < oper.length; j++) {
@@ -242,7 +256,7 @@ String.prototype.replaceAll = function(s1, s2) {
                                 dArr.push(timeStamp2String(obj[cols[i].field], cols[i].date_type));
                             }
 
-                        } else if (obj[cols[i].field] || obj[cols[i].field]==0) {
+                        } else if (obj[cols[i].field] || obj[cols[i].field] == 0) {
                             if (cols[i].custom) {
                                 dArr.push(obj[cols[i].field] + cols[i].custom);
                             } else {

+ 113 - 47
VisualInspection/qzd/js/task/new.js

@@ -117,6 +117,46 @@ function queryTask() {
         'pager': {
             'p_cur': cur_page
         },
+        renderfunction: function() {
+            // console.log("-------------------------")
+
+
+
+            $(".uploadervideo").each(function() {
+                $(this).uploader({
+                    autoUpload: true, // 当选择文件后立即自动进行上传操作
+                    url: base_image_server_url + 'fileServer/file/upload', // 文件上传提交地址
+                    chunk_size: 0,
+                    filters: {
+                        mime_types: [{
+                            title: '视频',
+                            extensions: 'mp4,avi'
+                        }],
+                        // 不允许上传重复文件
+                        prevent_duplicates: true
+                    },
+                    onFileUploaded: function(file, responseObject) {
+                        var file_src = recordVideos;
+                        var datas = eval('(' + responseObject.response + ')');
+                        if (file_src != '' && file_src != null) {
+                            file_src += "," + datas.result_data.path;
+                        } else {
+                            file_src += datas.result_data.path;
+                        }
+                        var data = {
+                            "videos": file_src,
+                            "id": recordId
+                        };
+                        post_common_service('q/record/update', data, function(redata) {
+                            queryTask();
+                        });
+                    },
+                    onFilesRemoved: function(files) {
+                        // alert(files);
+                    }
+                });
+            });
+        }
     });
 
     $.zui.store.set('store_param_' + current_url, data);
@@ -205,56 +245,82 @@ function resert() {
 }
 
 function getRecord() {
-    var t = getTimeByMonth(GV("#start_time"));
-    var data = {
-        "startTime": getMomentTimeFormat(t.starttime),
-        "endTime": getMomentTimeFormat(t.endtime),
-        "dept": $("#deptlist").val(),
-        // "check_status": cur_status
-    };
-    post_common_service('q/record/getall/0/0', data, function(redata) {
-        console.log(redata);
-       for(var index in redata.records){
-           var obj = redata.records[index];
-        var file_src = recordVideos;
-        $("#uploaderExample_"+obj.id).uploader({
-            autoUpload: true, // 当选择文件后立即自动进行上传操作
-            url: base_image_server_url + 'fileServer/file/upload', // 文件上传提交地址
-            chunk_size:0,
-            filters: {
-                mime_types: [ {
-                    title: '视频',
-                    extensions: 'mp4,avi'
-                }],
-                // 不允许上传重复文件
-                prevent_duplicates: true
-            },
-            onFileUploaded: function(file, responseObject) {
-                var datas = eval('(' + responseObject.response + ')');
-                if(file_src != '' && file_src != null){
-                    file_src +=","+ datas.result_data.path ;
-                }else{
-                    file_src += datas.result_data.path ;
-                }
-                var data = {
-                    "videos": file_src,
-                    "id" : recordId
-                };
-                post_common_service('q/record/update', data, function(redata) {
-                    queryTask();
-                });
-            },
-            onFilesRemoved: function(files) {
-                // alert(files);
-            }
-        });
-       }
-    });
+
+    // var t = getTimeByMonth(GV("#start_time"));
+    // var data = {
+    //     "startTime": getMomentTimeFormat(t.starttime),
+    //     "endTime": getMomentTimeFormat(t.endtime),
+    //     "dept": $("#deptlist").val(),
+    //     // "check_status": cur_status
+    // };
+    // post_common_service('q/record/getall/0/0', data, function(redata) {
+    //     console.log(redata);
+    //     for (var index in redata.records) {
+    //         var obj = redata.records[index];
+    //         var file_src = recordVideos;
+    //         $("#uploaderExample_" + obj.id).uploader({
+    //             autoUpload: true, // 当选择文件后立即自动进行上传操作
+    //             url: base_image_server_url + 'fileServer/file/upload', // 文件上传提交地址
+    //             chunk_size: 0,
+    //             filters: {
+    //                 mime_types: [{
+    //                     title: '视频',
+    //                     extensions: 'mp4,avi'
+    //                 }],
+    //                 // 不允许上传重复文件
+    //                 prevent_duplicates: true
+    //             },
+    //             onFileUploaded: function(file, responseObject) {
+    //                 var datas = eval('(' + responseObject.response + ')');
+    //                 if (file_src != '' && file_src != null) {
+    //                     file_src += "," + datas.result_data.path;
+    //                 } else {
+    //                     file_src += datas.result_data.path;
+    //                 }
+    //                 var data = {
+    //                     "videos": file_src,
+    //                     "id": recordId
+    //                 };
+    //                 post_common_service('q/record/update', data, function(redata) {
+    //                     queryTask();
+    //                 });
+    //             },
+    //             onFilesRemoved: function(files) {
+    //                 // alert(files);
+    //             }
+    //         });
+    //     }
+    // });
 
 }
 
-function setRecordId(id,videos){
+function setRecordId(id, videos) {
     recordVideos = videos;
-   recordId = id;
+    recordId = id;
 }
 
+
+function removeVideo(id, videos, index) {
+
+
+    var p = "";
+    var recordVideos = videos;
+    var recordId = id;
+    var vvs = recordVideos.split(",");
+    for (var i = 0; i < vvs.length; i++) {
+        console.log(vvs)
+        if (vvs[i].length > 0 && i != index) {
+            p += vvs[i] + ",";
+        }
+    }
+    p = p.substring(0, p.length - 1);
+
+    var data = {
+        "videos": p,
+        "id": recordId
+    };
+    post_common_service('q/record/update', data, function(redata) {
+        queryTask();
+    });
+
+}

+ 5 - 0
VisualInspection/qzd/view/task/addtask.html

@@ -1,3 +1,8 @@
+<style>
+    td {
+        vertical-align: middle !important;
+    }
+</style>
 <div>
     <form class="form-horizontal" style="margin-top:10px;">
         <div class="form-group" style="margin:0px;width: 100%">

+ 5 - 0
VisualInspection/qzd/view/task/task_list.html

@@ -1,5 +1,10 @@
 <script src="/js/statistics/common_statistic.js?__inline"></script>
 <script src="/qzd/js/task/task_list.js?__inline"></script>
+<style>
+    td {
+        vertical-align: middle !important;
+    }
+</style>
 
 <div class="container-fluid ">
     <div class="row">