Kaynağa Gözat

视频bug修改

MSI\liwei 7 yıl önce
ebeveyn
işleme
165bc92bfc

+ 2 - 2
VisualInspection/js/lib/mytable.js

@@ -245,7 +245,7 @@ String.prototype.replaceAll = function(s1, s2) {
                         //  picStr +="<input id='fileupload' type='file' style='display:none'></input>"
                         picStr += '<div style="position:absolute;bottom:10px;width:200px"><div id="uploaderExample_' + obj.id +'_'+cols[i].field+ '" 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>'; +
+                        picStr += '<button 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);
@@ -297,7 +297,7 @@ String.prototype.replaceAll = function(s1, s2) {
                             "</div>"+
                             "<button onclick='saveMonitor(\""+obj.id+"\")' style='width:80%;background-color:#2196F3;color:white'>保存</button>"
                     dArr.push(str);
-                    }else if (cols[i].oper != null) {
+                    } else if (cols[i].oper != null) {
                         var oper = cols[i].oper;
                         var operStr = "";
                         for (var j = 0; j < oper.length; j++) {

+ 25 - 15
VisualInspection/qzd/js/task/new.js

@@ -169,20 +169,34 @@ function queryTask() {
                         // 不允许上传重复文件
                         prevent_duplicates: true
                     },
-                    onFileUploaded: function(file, responseObject) {
+                    onUploadComplete: function(file) {
                         var id = this.$.attr("id").split("_")[1];
-                        var file_src = recordVideos;
-                        var datas = eval('(' + responseObject.response + ')');
-                        if (file_src != '' && file_src != null && file_src != undefined) {
-                            file_src += "," + datas.result_data.path;
-                        } else {
-                            file_src += datas.result_data.path;
+                        var type = this.$.attr("id").split("_")[2];
+                        var param = {
+                            "id": id
+                        }
+                        console.log(this.$.attr("id"));
+                       post_common_service('q/record/one', param, function(redata) {
+                        //debugger;
+                        var file_src = '' ;
+                        if(type = "videos"){
+                            file_src = redata.videos;
+                        }else{
+                            file_src = redata.pics;
+                        }
+                        console.log(file[0].remoteData.result_data.path);
+                        for(var index in file){
+                            if (file_src != '' && file_src != null && file_src != undefined) {
+                                file_src += "," + file[index].remoteData.result_data.path;
+                            } else {
+                                file_src += file[index].remoteData.result_data.path;
+                            }
                         }
                         var data = {
                             "id": id,
                             "isComplete": 1
                         };
-                        if (file.type.indexOf('image') === 0) {
+                        if (type == "pics") {
                             data.pics = file_src;
                         } else {
                             data.videos = file_src;
@@ -193,6 +207,7 @@ function queryTask() {
                             cur_page = taskTableObj.options.pager.p_cur;
                             queryTask();
                         });
+                    });
                     },
                     onFilesRemoved: function(files) {
                         // alert(files);
@@ -359,12 +374,6 @@ function getRecord() {
 
 }
 
-function setRecordId(id, videos) {
-    recordVideos = videos;
-    recordId = id;
-}
-
-
 function removeVideo(id, videos, field, index) {
 
 
@@ -380,7 +389,8 @@ function removeVideo(id, videos, field, index) {
     }
     p = p.substring(0, p.length - 1);
     var data = {
-        "id": recordId
+        "id": recordId,
+        "isComplete": 1
     };
 
     if (field == "videos") {