var $url="/cms/contents/contentsLayerImport",data=utils.init({checkedLevels:null,form:{siteId:utils.getQueryInt("siteId"),channelId:utils.getQueryInt("channelId"),importType:"zip",checkedLevel:null,isOverride:!1,fileNames:[]},uploadUrl:null,uploadList:[]}),methods={apiGet:function(){var e=this;utils.loading(this,!0),$api.get($url,{params:{siteId:this.form.siteId,channelId:this.form.channelId}}).then(function(t){var i=t.data;e.checkedLevels=i.checkedLevels,e.form.checkedLevel=i.value,e.uploadUrl=$apiUrl+$url+"/actions/upload?siteId="+e.form.siteId+"&channelId="+e.form.channelId}).catch(function(e){utils.error(e)}).then(function(){utils.loading(e,!1)})},apiSubmit:function(){var e=this;utils.loading(this,!0),$api.post($url,this.form).then(function(t){t.data;utils.closeLayer(),parent.$vue.apiList(e.form.channelId,1,"文件导入成功！",!0)}).catch(function(e){utils.error(e)}).then(function(){utils.loading(e,!1)})},btnSubmitClick:function(){if(0===this.form.fileNames.length)return utils.error("请选择需要导入的文件！");this.apiSubmit()},btnCancelClick:function(){utils.closeLayer()},uploadBefore(e){var t=/(\.zip|\.xlsx|\.txt)$/i;return"zip"===this.importType?t=/(\.zip)$/i:"xlsx"===this.importType?t=/(\.xlsx)$/i:"txt"===this.importType&&(t=/(\.txt)$/i),!!t.exec(e.name)||(utils.error("请选择有效的文件上传!"),!1)},uploadProgress:function(){utils.loading(this,!0)},uploadRemove(e){e.response&&this.form.fileNames.splice(this.form.fileNames.indexOf(e.response.name),1)},uploadSuccess:function(e){this.form.fileNames.push(e.name),utils.loading(this,!1)},uploadError:function(e){utils.loading(this,!1);var t=JSON.parse(e.message);utils.error(t.message)}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});