2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
"use strict";(self["webpackChunkdatabasir_frontend"]=self["webpackChunkdatabasir_frontend"]||[]).push([[564],{6299:function(e,a,t){t.d(a,{ew:function(){return d},wu:function(){return n},r6:function(){return s},ns:function(){return i},OE:function(){return u}});var l=t(3872);const r="/api/v1.0/database_types",o="/api/v1.0/simple_database_types",d=e=>l.Z["delete"](r+"/"+e),n=e=>l.Z.post(r,e),s=e=>l.Z.patch(r,e),i=()=>l.Z.get(o),u=e=>l.Z.get(r,{params:e})},2564:function(e,a,t){t.r(a),t.d(a,{default:function(){return h}});var l=t(6252),r=t(3577);const o=(0,l.Uk)("+"),d=["src"],n=(0,l.Uk)("编辑"),s=(0,l.Uk)("删除"),i=(0,l._)("span",null,"内置变量:",-1),u=(0,l.Uk)(" 结果示例:"),p=(0,l.Uk)("保存"),m=(0,l.Uk)("取消");function c(e,a,t,c,b,g){const w=(0,l.up)("el-button"),f=(0,l.up)("el-tooltip"),h=(0,l.up)("el-input"),y=(0,l.up)("el-space"),W=(0,l.up)("el-header"),_=(0,l.up)("el-table-column"),D=(0,l.up)("el-link"),T=(0,l.up)("el-tag"),F=(0,l.up)("el-table"),j=(0,l.up)("el-form-item"),C=(0,l.up)("el-col"),U=(0,l.up)("el-row"),P=(0,l.up)("el-form"),v=(0,l.up)("el-dialog"),V=(0,l.up)("el-main"),k=(0,l.up)("el-pagination"),z=(0,l.up)("el-footer"),E=(0,l.up)("el-container");return(0,l.wg)(),(0,l.j4)(E,null,{default:(0,l.w5)((()=>[(0,l.Wm)(W,null,{default:(0,l.w5)((()=>[(0,l.Wm)(y,null,{default:(0,l.w5)((()=>[(0,l.Wm)(f,{content:"创建"},{default:(0,l.w5)((()=>[(0,l.Wm)(w,{type:"primary",style:{"min-width":"100px"},onClick:a[0]||(a[0]=e=>g.toEditPage())},{default:(0,l.w5)((()=>[o])),_:1})])),_:1}),(0,l.Wm)(h,{onChange:g.onQuery,modelValue:b.pageFilter.databaseTypeContains,"onUpdate:modelValue":a[1]||(a[1]=e=>b.pageFilter.databaseTypeContains=e),placeholder:"数据库类型名称搜索","prefix-icon":"search"},null,8,["onChange","modelValue"])])),_:1})])),_:1}),(0,l.Wm)(V,null,{default:(0,l.w5)((()=>[(0,l.Wm)(F,{data:b.pageData.data,border:"",stripe:""},{default:(0,l.w5)((()=>[(0,l.Wm)(_,{prop:"id",label:"ID",width:"50"}),(0,l.Wm)(_,{prop:"databaseType",label:"数据库类型",resizable:""},{default:(0,l.w5)((e=>[(0,l.Uk)((0,r.zw)(e.row.databaseType),1)])),_:1}),(0,l.Wm)(_,{prop:"icon",label:"图标"},{default:(0,l.w5)((e=>[(0,l._)("img",{src:e.row.icon,style:{"max-width":"25px","max-height":"25px"}},null,8,d)])),_:1}),(0,l.Wm)(_,{prop:"description",label:"描述",resizable:""}),(0,l.Wm)(_,{prop:"jdbcDriverFileUrl",label:"驱动下载地址"},{default:(0,l.w5)((e=>[(0,l.Wm)(D,{underline:!1},{default:(0,l.w5)((()=>[(0,l.Uk)((0,r.zw)(e.row.jdbcDriverFileUrl),1)])),_:2},1024)])),_:1}),(0,l.Wm)(_,{prop:"jdbcDriverClassName",label:"驱动类名",resizable:""}),(0,l.Wm)(_,{label:"协议头"},{default:(0,l.w5)((e=>[(0,l.Wm)(T,{size:"large"},{default:(0,l.w5)((()=>[(0,l.Uk)((0,r.zw)(e.row.jdbcProtocol),1)])),_:2},1024)])),_:1}),(0,l.Wm)(_,{prop:"projectCount",label:"引用项目数",width:"100"}),(0,l.Wm)(_,{prop:"urlPattern",label:"URL 表达式",resizable:""},{default:(0,l.w5)((e=>[(0,l.Wm)(f,{content:g.tableUrlSample(e.row)},{default:(0,l.w5)((()=>[(0,l.Wm)(D,{underline:!1,type:"warning"},{default:(0,l.w5)((()=>[(0,l.Uk)((0,r.zw)(e.row.urlPattern),1)])),_:2},1024)])),_:2},1032,["content"])])),_:1}),(0,l.Wm)(_,{prop:"updateAt",label:"更新时间"}),(0,l.Wm)(_,{prop:"createAt",label:"创建时间"}),(0,l.Wm)(_,{label:"操作",resizable:"",fixed:"right"},{default:(0,l.w5)((e=>[(0,l.Wm)(y,{alignment:"left",direction:"vertical"},{default:(0,l.w5)((()=>[(0,l.Wm)(w,{type:"primary",size:"small",icon:"Edit",onClick:a=>g.toEditPage(e.row)},{default:(0,l.w5)((()=>[n])),_:2},1032,["onClick"]),(0,l.Wm)(w,{type:"danger",size:"small",icon:"Delete",onClick:a=>g.onDelete(e.row)},{default:(0,l.w5)((()=>[s])),_:2},1032,["onClick"])])),_:2},1024)])),_:1})])),_:1},8,["data"]),(0,l.Wm)(v,{modelValue:b.isShowEditDialog,"onUpdate:modelValue":a[11]||(a[11]=e=>b.isShowEditDialog=e),width:"38%",center:"","destroy-on-close":""},{default:(0,l.w5)((()=>[(0,l.Wm)(P,{model:b.databaseTypeForm,rules:b.formDataRule,ref:"formDataRef","label-position":"top"},{default:(0,l.w5)((()=>[(0,l.Wm)(U,{gutter:28},{default:(0,l.w5)((()=>[(0,l.Wm)(C,{span:10},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"数据库类型",prop:"databaseType"},{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.databaseType,"onUpdate:modelValue":a[2]||(a[2]=e=>b.databaseTypeForm.databaseType=e),placeholder:"请输入数据库类型名称"},null,8,["modelValue"])])),_:1})])),_:1}),(0,l.Wm)(C,{span:10},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"图标地址",prop:"icon"},{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.icon,"onUpdate:modelValue":a[3]||(a[3]=e=>b.databaseTypeForm.icon=e),placeholder:"图标地址"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),(0,l.Wm)(U,null,{default:(0,l.w5)((()=>[(0,l.Wm)(C,{span:20},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"描述",prop:"description"},{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.description,"onUpdate:modelValue":a[4]||(a[4]=e=>b.databaseTypeForm.description=e),type:"textarea"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),(0,l.Wm)(U,null,{default:(0,l.w5)((()=>[(0,l.Wm)(C,{span:20},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"JDBC 驱动下载地址",prop:"jdbcDriverFileUrl"},{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.jdbcDriverFileUrl,"onUpdate:modelValue":a[5]||(a[5]=e=>b.databaseTypeForm.jdbcDriverFileUrl=e),placeholder:"jdbc 驱动下载地址,如 https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),(0,l.Wm)(U,{gutter:28},{default:(0,l.w5)((()=>[(0,l.Wm)(C,{span:10},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"驱动类名",prop:"jdbcDriverClassName"},{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.jdbcDriverClassName,"onUpdate:modelValue":a[6]||(a[6]=e=>b.databaseTypeForm.jdbcDriverClassName=e),placeholder:"jdbc 驱动类名,如 com.mysql.jdbc.Driver"},null,8,["modelValue"])])),_:1})])),_:1}),(0,l.Wm)(C,{span:10},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"协议头",prop:"jdbcProtocol"},{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.jdbcProtocol,"onUpdate:modelValue":a[7]||(a[7]=e=>b.databaseTypeForm.jdbcProtocol=e),placeholder:"协议头,如 jdbc:mysql,jdbc:postgresql,jdbc:mariadb 等"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),(0,l.Wm)(U,null,{default:(0,l.w5)((()=>[(0,l.Wm)(C,{span:20},{default:(0,l.w5)((()=>[(0,l.Wm)(j,{label:"URL 生成表达式",prop:"urlPattern"},{default:(0,l.w5)((()=>[(0,l.Wm)(C,null,{default:(0,l.w5)((()=>[(0,l.Wm)(h,{modelValue:b.databaseTypeForm.urlPattern,"onUpdate:modelValue":a[8]||(a[8]=e=>b.databaseTypeForm.urlPattern=e),placeholder:"支持变量 {{jdbc.protocol}}, {{db.url}}, {{db.name}}"},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),(0,l.Wm)(C,null,{default:(0,l.w5)((()=>[(0,l.Wm)(y,null,{default:(0,l.w5)((()=>[i,((0,l.wg)(!0),(0,l.iD)(l.HY,null,(0,l.Ko)(b.constData.availableVariables,((e,a)=>((0,l.wg)(),(0,l.j4)(f,{key:a,content:e.description},{default:(0,l.w5)((()=>[(0,l.Wm)(T,null,{default:(0,l.w5)((()=>[(0,l.Uk)((0,r.zw)(e.name),1)])),_:2},1024)])),_:2},1032,["content"])))),128))])),_:1})])),_:1})])),_:1}),(0,l.Wm)(U,{style:{"margin-top":"20px"}},{default:(0,l.w5)((()=>[(0,l.Wm)(C,null,{default:(0,l.w5)((()=>[u,(0,l.Wm)(D,{type:"success"},{default:(0,l.w5)((()=>[(0,l.Uk)((0,r.zw)(g.urlSample),1)])),_:1})])),_:1})])),_:1}),(0,l.Wm)(j,{style:{"margin-top":"33px"}},{default:(0,l.w5)((()=>[(0,l.Wm)(w,{type:"primary",onClick:a[9]||(a[9]=e=>g.onFormSave("formDataRef"))},{default:(0,l.w5)((()=>[p])),_:1}),(0,l.Wm)(w,{onClick:a[10]||(a[10]=e=>b.isShowEditDialog=!1)},{default:(0,l.w5)((()=>[m])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1},8,["modelValue"])])),_:1}),(0,l.Wm)(z,null,{default:(0,l.w5)((()=>[(0,l.Wm)(k,{layout:"prev, pager, next","hide-on-single-page":!1,currentPage:b.pageData.number,"page-size":b.pageData.size,"page-count":b.pageData.totalPages,onCurrentChange:g.onPageChange},null,8,["currentPage","page-size","page-count","onCurrentChange"])])),_:1})])),_:1})}var b=t(6299),g={data(){return{databaseTypes:[],pageData:{data:[],page:0,number:1,size:15,totalElements:0,totalPages:1},pageFilter:{page:0,size:10,databaseTypeContains:null},databaseTypeForm:{id:null,databaseType:null,icon:null,description:null,jdbcDriverFileUrl:null,jdbcDriverClassName:null,jdbcProtocol:null,urlPattern:""},formDataRule:{databaseType:[{required:!0,message:"请输入数据库类型名称",trigger:"blur"}],description:[{required:!0,message:"请输入描述内容",trigger:"blur"}],jdbcDriverFileUrl:[{required:!0,message:"请输入合法的驱动下载地址",trigger:"blur"}],jdbcDriverClassName:[{required:!0,message:"请输入合法的驱动类名",trigger:"blur"}],jdbcProtocol:[{required:!0,message:"请输入合法的 JDBC 协议头",trigger:"blur"}],urlPattern:[{required:!0,message:"请输入合法的 URL 模式",trigger:"blur"}]},isShowEditDialog:!1,constData:{urlPattern:"{{jdbc.protocol}}://{{db.url}}/{{db.name}}",availableVariables:[{name:"{{jdbc.protocol}}",description:"协议头,如 jdbc:mysql"},{name:"{{db.name}}",description:"数据库名称,如 public"},{name:"{{db.url}}",description:"数据库地址,如 127.0.0.1:3306"},{name:"{{db.schema}}",description:"schema 名称,如 user"}]}}},created(){this.fetchDatabaseTypes()},computed:{urlSample(){const e="127.0.0.1:3306",a="databasir",t="public",l=this.databaseTypeForm.jdbcProtocol?this.databaseTypeForm.jdbcProtocol:"jdbc:mysql";return this.databaseTypeForm.urlPattern.replace("{{jdbc.protocol}}",l).replace("{{db.name}}",a).replace("{{db.schema}}",t).replace("{{db.url}}",e)}},methods:{async fetchDatabaseTypes(){const e=await(0,b.OE)(this.pageFilter);this.pageData.data=e.data.content,this.pageData.number=e.data.number+1,this.pageData.size=e.data.size,this.pageData.totalPages=e.data.totalPages,this.pageData.totalElements=e.data.totalElements},onDelete(e){this.$confirm("确认删除该数据库类型吗?这将导致数据同步失败","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{(0,b.ew)(e.id).then((e=>{e.errCode||(this.$message.success("删除成功"),this.onPageChange(1,!0))}))}))},onFormSave(){this.$refs.formDataRef.validate((e=>{e?this.databaseTypeForm.id?this.onUpdate(this.databaseTypeForm):this.onCreate(this.databaseTypeForm):this.$message.error("请填写表单必填项")}))},onUpdate(){(0,b.r6)(this.databaseTypeForm).then((e=>{e.errCode||(this.$message.success("更新成功"),this.isShowEditDialog=!1,this.fetchDatabaseTypes())}))},onCreate(){(0,b.wu)(this.databaseTypeForm).then((e=>{e.errCode||(this.$message.success("创建成功"),this.isShowEditDialog=!1,this.onPageChange(1,!0))}))},onQuery(){this.fetchDatabaseTypes()},onPageChange(e,a){(e&&e-1!=this.pageFilter.page||a)&&(this.pageFilter.page=e-1,this.fetchDatabaseTypes())},toEditPage(e){e&&e.id?this.databaseTypeForm=JSON.parse(JSON.stringify(e)):(this.databaseTypeForm={},this.databaseTypeForm.urlPattern=this.constData.urlPattern),this.isShowEditDialog=!0},tableUrlSample(e){const a="127.0.0.1:3306",t="databasir";return e.urlPattern.replace("{{jdbc.protocol}}",e.jdbcProtocol).replace("{{db.name}}",t).replace("{{db.url}}",a)}}},w=t(3744);const f=(0,w.Z)(g,[["render",c]]);var h=f}}]);
|
||
//# sourceMappingURL=564.07fcac27.js.map
|