var $url="/common/tableStyle/layerValidate",data=utils.init({tableName:utils.getQueryString("tableName"),attributeName:utils.getQueryString("attributeName"),relatedIdentities:utils.getQueryString("relatedIdentities"),options:null,rules:[],addPanel:!1,addForm:null}),methods={apiGet:function(){var t=this;utils.loading(this,!0),$api.get($url,{params:{tableName:this.tableName,attributeName:this.attributeName,relatedIdentities:this.relatedIdentities}}).then(function(e){var a=e.data;t.options=a.options,t.rules=a.rules||[]}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},btnSubmitClick:function(){var t=this;utils.loading(this,!0),$api.post($url,{tableName:this.tableName,attributeName:this.attributeName,relatedIdentities:this.relatedIdentities,rules:this.rules}).then(function(t){t.data;utils.closeLayer(),parent.$vue.runTableStyleLayerValidate&&parent.$vue.runTableStyleLayerValidate()}).catch(function(t){utils.error(t)}).then(function(){utils.loading(t,!1)})},btnRemoveClick:function(t){this.rules.splice(this.rules.indexOf(t),1)},btnCancelClick:function(){utils.closeLayer()},handleRuleChange:function(){this.addForm.value=null,this.addForm.message=null;for(var t=0;t<this.options.length;t++){var e=this.options[t];if(e.value==this.addForm.type)return void(this.addForm.message=e.label)}},getAvailableRules:function(){for(var t=[],e=0;e<this.options.length;e++){var a=this.options[e];if("None"!=a.value)-1===_.findIndex(this.rules,function(t){return t.type==a.value})&&t.push(this.options[e])}return t},btnAddCancelClick:function(){this.addPanel=!1},btnAddClick:function(){this.addForm={type:null,value:null,message:null},this.addPanel=!0},btnAddSubmitClick:function(){var t=this;this.$refs.addForm.validate(function(e){e&&(t.rules.push({type:t.addForm.type,value:t.addForm.value,message:t.addForm.message}),t.addPanel=!1)})}},$vue=new Vue({el:"#main",data:data,methods:methods,created:function(){this.apiGet()}});