var $url="/common/material/layerFileSelect",data=utils.init({siteId:utils.getQueryInt("siteId"),attributeName:utils.getQueryString("attributeName"),no:utils.getQueryInt("no"),groups:null,count:null,items:null,urlList:null,renameId:0,renameTitle:"",deleteId:0,selectedGroupId:0,form:{keyword:"",groupId:0,page:1,perPage:24}}),methods={insert:function(t){parent.$vue.runMaterialLayerFileSelect&&parent.$vue.runMaterialLayerFileSelect(this.attributeName,this.no,t)},apiList:function(t){var i=this;this.form.page=t,utils.loading(this,!0),$api.get($url,{params:this.form}).then(function(t){var e=t.data;i.groups=e.groups,i.count=e.count,i.items=e.items,i.urlList=_.map(i.items,function(t){return t.fileUrl})}).catch(function(t){utils.error(t)}).then(function(){utils.loading(i,!1)})},getGroupName:function(){var t=this;return this.form.groupId>0?_.find(this.groups,function(i){return i.id===t.form.groupId}).groupName:""},btnSelectClick:function(t){var i=this;utils.loading(this,!0),$api.post($url+"/actions/select",{siteId:this.siteId,materialId:t.id}).then(function(t){var e=t.data;i.insert(e.value),utils.closeLayer()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(i,!1)})},btnSelectGroupClick:function(t){this.selectedGroupId=this.selectedGroupId===t?0:t},btnGroupClick:function(t){var i=this;this.form.groupId=t,this.form.page=1,utils.loading(this,!0),$api.get($url,{params:this.form}).then(function(t){var e=t.data;i.groups=e.groups,i.count=e.count,i.items=e.items,i.urlList=_.map(i.items,function(t){return t.fileUrl})}).catch(function(t){i.$notify.error({title:"错误",message:t.message})}).then(function(){utils.loading(i,!1)})},btnSearchClick(){utils.loading(this,!0),this.apiList(1)},btnPageClick:function(t){utils.loading(this,!0),this.apiList(t)}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiList(1)}});