var $url="/common/form/layerFileUpload",data=utils.init({attributeName:utils.getQueryString("attributeName"),no:utils.getQueryInt("no"),uploadUrl:null,form:{siteId:utils.getQueryInt("siteId"),isChangeFileName:!0,filePaths:[]}}),methods={insert:function(t,i){parent.$vue.runFormLayerFileUpload&&parent.$vue.runFormLayerFileUpload(this.attributeName,t,i.fileVirtualUrl)},apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.form.siteId}}).then(function(i){var e=i.data;t.form.isChangeFileName=e.isChangeFileName,t.uploadUrl=$apiUrl+$url+"/actions/upload?siteId="+t.form.siteId+"&isChangeFileName="+t.form.isChangeFileName}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},apiSubmit:function(){var t=this;utils.loading(this,!0),$api.post($url,this.form).then(function(i){var e=i.data;if(e&&e.length>0)for(var a=0;a<e.length;a++){var n=e[a];t.insert(t.no+a,n)}utils.closeLayer()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!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(t){this.form.filePaths.push(t.path),utils.loading(this,!1)},uploadError:function(t){utils.loading(this,!1);var i=JSON.parse(t.message);utils.error(i.message)},uploadRemove(t){t.response&&this.form.filePaths.splice(this.form.filePaths.indexOf(t.response.path),1)}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});