(window.webpackJsonp=window.webpackJsonp||[]).push([[127],{471:function(e,t,a){},704:function(e,t,a){"use strict";var s=a(471);a.n(s).a},960:function(e,t,a){"use strict";a.r(t),a(25);var s,n=a(0),i=a.n(n),c=(a(8),a(1)),r=a.n(c),l=(a(26),a(16),a(17),a(18),a(36),a(203)),o=a.n(l),u=(a(209),a(29),a(210)),d=(a(224),a(223)),h=(a(34),a(257),a(248)),b={components:(s={},o()(s,h.a.name,h.a),o()(s,d.a.name,d.a),o()(s,u.a.name,u.a),s),data:function(){return{isIndeterminate:!1,checkAll:!1,tables:[],systemTables:{},height:null}},mounted:function(){var e=this;this.heightFn(),window.onresize=function(){e.heightFn()}},computed:{datasource:function(){return this.$store.state.database.database[this.$route.params.id]}},methods:{heightFn:function(){this.height=document.documentElement.clientHeight-48-60-40-20-20+"px"},handleCheckAll:function(){this.isIndeterminate=!1,this.tables=this.checkAll?Object.values(this.systemTables).map((function(e){return e.key})):[]},checkTable:function(){0===this.tables.length?(this.isIndeterminate=!1,this.checkAll=!1):this.tables.length<Object.keys(this.systemTables).length?(this.isIndeterminate=!0,this.checkAll=!1):(this.isIndeterminate=!1,this.checkAll=!0)},addExternalTables:function(){var e=this;return r()(i.a.mark((function t(){var a,s,n;return i.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0===e.tables.length)return e.$message({type:"warning",message:"请选择至少一张表"}),t.abrupt("return");t.next=3;break;case 3:return a=e.$loading(),t.next=6,e.$store.dispatch({type:"addExternalTableToDatasource",databaseId:e.datasource.database_id,tables:e.tables});case 6:s=t.sent,n=s.database,e.$store.commit({type:"updateDatabaseTable",fromDict:null,toDict:n.dict_id,table:Object.values(s.tables)}),a.close(),e.$router.push({name:"datasource-review",params:{id:e.$route.params.id}});case 11:case"end":return t.stop()}}),t)})))()},cancel:function(){this.$router.go(-1)}},watch:{datasource:{handler:function(e){var t=this;return r()(i.a.mark((function a(){var s,n,c,r;return i.a.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(e){a.next=2;break}return a.abrupt("return");case 2:return s=t.$loading({target:t.$refs.checkList,fullscreen:!1}),a.next=5,t.$store.dispatch({type:"connectDatabase",form:{id:e.database_id}});case 5:return n=a.sent,c=[],a.next=9,t.$store.dispatch({type:"getDatasourceTable",id:e.database_id});case 9:c=a.sent,t.systemTables={},r=c.map((function(e){return e.tableName})),n.tables.map((function(e){0<=r.indexOf(e.TABLE_NAME)||Reflect.set(t.systemTables,e.TABLE_NAME,{name:e.TABLE_NAME,key:e.TABLE_NAME})})),s.close();case 14:case"end":return a.stop()}}),a)})))()},deep:!0,immediate:!0}}},m=(a(704),a(88)),p=Object(m.a)(b,(function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"system"},[a("el-row",{staticClass:"title",attrs:{type:"flex",align:"middle",justify:"start"}},[a("span",[e._v("添加数据表 - "+e._s(e.datasource?e.datasource.name:"加载中..."))])]),a("div",{staticClass:"content"},[a("div",{ref:"board",staticClass:"board"},[a("el-checkbox",{attrs:{indeterminate:e.isIndeterminate},on:{change:e.handleCheckAll},model:{value:e.checkAll,callback:function(t){e.checkAll=t},expression:"checkAll"}},[e._v("全选")]),a("el-basis-scroll",{attrs:{height:e.height}},[a("el-checkbox-group",{model:{value:e.tables,callback:function(t){e.tables=t},expression:"tables"}},e._l(e.systemTables,(function(t,s){return a("el-checkbox",{key:t.key,staticClass:"table",staticStyle:{width:"100%","margin-left":"0",color:"#999999"},attrs:{label:t.key},on:{change:e.checkTable}},[e._v(e._s(t.name))])})),1)],1)],1)]),a("el-row",{staticClass:"button-group",attrs:{type:"flex",justify:"center",align:"middle"}},[a("el-button",{staticStyle:{"margin-right":"30px"},attrs:{type:"primary",size:"small"},on:{click:e.addExternalTables}},[e._v("导入数据")]),a("el-button",{attrs:{size:"small",plain:""},on:{click:e.cancel}},[e._v("取消")])],1)],1)}),[],!1,null,"0745aad6",null);t.default=p.exports}}]);