var $url="/common/form/layerVideoUpload",data=utils.init({attributeName:utils.getQueryString("attributeName"),no:utils.getQueryInt("no"),uploadUrl:null,form:{siteId:utils.getQueryInt("siteId"),isChangeFileName:!0,isLibrary:!0,filePaths:[]}}),methods={insert:function(i,t){parent.$vue.runFormLayerVideoUpload&&parent.$vue.runFormLayerVideoUpload(this.attributeName,i,t.fileVirtualUrl)},apiGet:function(){var i=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.form.siteId}}).then(function(t){var e=t.data;i.form.isChangeFileName=e.isChangeFileName,i.form.isLibrary=e.isLibrary,i.uploadUrl=$apiUrl+$url+"/actions/upload?siteId="+i.form.siteId+"&isChangeFileName="+i.form.isChangeFileName}).catch(function(i){utils.error(i)}).then(function(){utils.loading(i,!1)})},apiSubmit:function(){var i=this;utils.loading(this,!0),$api.post($url,this.form).then(function(t){var e=t.data;if(e&&e.length>0)for(var a=0;a<e.length;a++){var r=e[a];i.insert(i.no+a,r)}utils.closeLayer()}).catch(function(i){utils.error(i)}).then(function(){utils.loading(i,!1)})},btnSubmitClick:function(){if(0===this.form.filePaths.length)return utils.error("请上传需要插入的视频文件！"),!1;this.apiSubmit()},btnCancelClick:function(){utils.closeLayer()},uploadProgress:function(){utils.loading(this,!0)},uploadFileSuccess:function(i){this.form.filePaths.push(i.path),utils.loading(this,!1)},uploadError:function(i){utils.loading(this,!1);var t=JSON.parse(i.message);utils.error(t.message)},uploadRemove(i){i.response&&this.form.filePaths.splice(this.form.filePaths.indexOf(i.response.path),1)}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});