webpackJsonp([18],{MKq3:function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r=t("mvHQ"),s=t.n(r),o=(t("ftAF"),{created:function(){var e=this;this.$route.query.id&&this.$http.get({url:"/dataSourceInfo/getOne",data:{id:this.$route.query.id}}).then(function(a){a.success&&(e.formData=a.data)})},data:function(){return{saving:!1,formData:{databaseType:"Mysql"},rules:{code:[{required:!0,message:"请输入 code",trigger:"blur"}],databaseType:[{required:!0,message:"请输入 数据库类型",trigger:"blur"}],url:[{required:!0,message:"请输入 链接",trigger:"blur"}],username:[{required:!0,message:"请输入 用户名",trigger:"blur"}],password:[{required:!0,message:"请输入 密码",trigger:"blur"}],databaseName:[{required:!0,message:"请输入 名称",trigger:"blur"}]}}},methods:{onSave:function(){var e=this;this.$refs.form.validate(function(a){if(!a)return!1;e.submit()})},submit:function(){var e=this,a=JSON.parse(s()(this.formData));this.$http.post({url:this.formData.id?"/dataSourceInfo/update":"/dataSourceInfo/save",data:a}).then(function(a){a.success?(e.$message.success("成功"),e.$router.go(-1)):e.$message.warning("失败")})},onDelete:function(){var e=this;this.$alert("删除将无法恢复，确认要删除么？","警告",{type:"error"}).then(function(){return e.$http.post({url:"/dataSourceInfo/del",data:{id:e.formData.id}})}).then(function(){e.$message.success("删除成功"),e.$router.go(-1)}).catch(function(a){"cancel"===a?e.$message.info("删除取消"):e.$message.error("删除失败")})}}}),l={render:function(){var e=this,a=e.$createElement,t=e._self._c||a;return t("div",[t("el-form",{ref:"form",staticStyle:{"max-width":"500px"},attrs:{model:e.formData,rules:e.rules,"label-width":"80px","label-position":"right",size:"small"}},[t("el-form-item",{attrs:{prop:"databaseType",label:"类型"}},[t("el-select",{staticClass:"filter-item",attrs:{placeholder:"数据库",size:"small"},model:{value:e.formData.databaseType,callback:function(a){e.$set(e.formData,"databaseType",a)},expression:"formData.databaseType"}},[t("el-option",{attrs:{label:"Mysql",value:"Mysql"}}),e._v(" "),t("el-option",{attrs:{label:"SqlServer",value:"SqlServer"}})],1)],1),e._v(" "),t("el-form-item",{attrs:{prop:"code",label:"code"}},[t("el-input",{model:{value:e.formData.code,callback:function(a){e.$set(e.formData,"code",a)},expression:"formData.code"}})],1),e._v(" "),t("el-form-item",{attrs:{prop:"databaseName",label:"名称"}},[t("el-input",{model:{value:e.formData.databaseName,callback:function(a){e.$set(e.formData,"databaseName",a)},expression:"formData.databaseName"}})],1),e._v(" "),t("el-form-item",{attrs:{prop:"url",label:"链接"}},[t("el-input",{model:{value:e.formData.url,callback:function(a){e.$set(e.formData,"url",a)},expression:"formData.url"}})],1),e._v(" "),t("el-form-item",{attrs:{prop:"username",label:"用户名"}},[t("el-input",{model:{value:e.formData.username,callback:function(a){e.$set(e.formData,"username",a)},expression:"formData.username"}})],1),e._v(" "),t("el-form-item",{attrs:{prop:"password",label:"密码"}},[t("el-input",{model:{value:e.formData.password,callback:function(a){e.$set(e.formData,"password",a)},expression:"formData.password"}})],1),e._v(" "),t("el-form-item",[t("el-button",{attrs:{loading:e.$store.state.fetchingData,type:"primary"},on:{click:e.onSave}},[e._v("保存")]),e._v(" "),e.formData.id?t("el-button",{attrs:{type:"danger"},on:{click:e.onDelete}},[e._v("删除")]):e._e(),e._v(" "),t("el-button",{on:{click:function(a){e.$router.go(-1)}}},[e._v("取消")])],1)],1)],1)},staticRenderFns:[]};var i=t("VU/8")(o,l,!1,function(e){t("xA1s")},"data-v-8416623a",null);a.default=i.exports},xA1s:function(e,a){}});
//# sourceMappingURL=18.d1b9ea124ad2a68af29b.js.map