2 lines
9.9 KiB
JavaScript
2 lines
9.9 KiB
JavaScript
webpackJsonp([18],{lPJ6:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l=a("mvHQ"),o=a.n(l),i=a("bOdI"),n=a.n(i),r=(a("D/fc"),{data:function(){var e;return e={dbNames:[],timeout:null,itemOptions:["commnon","outer"],userOptions:[],detailForm:{envCheckList:[]},editForm:{},input:"",sqlList:[],addForm:{dbName:"",operatorTime:"",operatorPerson:"",sqlStatement:"",syncEnv:"",envCheckList:[]},operatorPerson:JSON.parse(localStorage.getItem("userInfo")).nick,dialogVisible:!1,detailDialogVisible:!1,queryInfo:{dbName:"",tableName:"",operatorPerson:"",pageNum:1,pageSize:10},currpage:1,itemList:[],total:0,envOptions:[]},n()(e,"timeout",null),n()(e,"addFormRules",{dbName:[{required:!0,message:"请输入数据库名称",trigger:"blur"}],sqlStatement:[{required:!0,message:"请输入sql语句",trigger:"blur"}],envCheckList:[{type:"array",required:!0,message:"请至少选择一个环境",trigger:"change"}]}),e},mounted:function(){this.getAllUserInfo(),this.queryAllDbName()},created:function(){this.queryAllSqlData()},methods:{handleSizeChange:function(e){this.queryInfo.pageSize=e,this.queryAllSqlData()},handleCurrentChange:function(e){this.queryInfo.pageNum=e,this.queryAllSqlData()},getAllUserInfo:function(){var e=this;this.$api.user.queryAllUserInfo().then(function(t){e.userOptions=t.data.data}).catch(function(){})},queryAllDbName:function(){var e=this,t=[];this.$api.sql.queryAllDbName().then(function(a){for(var l in e.envOptions=a.data.data,e.envOptions)t.push({id:e.envOptions[l].id,dbName:e.envOptions[l].dbName});e.dbNames=t,console.log(e.dbNames)}).catch(function(){return e.loading=!1,dbNames})},queryAllSqlData:function(){var e=this;this.$api.sql.queryAllSqlData(o()(this.queryInfo)).then(function(t){e.loading=!1,e.sqlList=t.data.data,e.total=t.data.count,console.log(t.data)}).catch(function(){e.loading=!1})},insertSqlConfigHistoryInfo:function(){var e=this;this.$refs.addFormRef.validate(function(t){if(t){if(e.addForm.operatorTime=e.$common.getCurrentDateTime(),e.addForm.operatorPerson=e.operatorPerson,e.addForm.envCheckList){for(var a="",l=0;l<e.addForm.envCheckList.length;l++)a+=e.addForm.envCheckList[l]+",";a=a.substring(0,a.lastIndexOf(",")),e.addForm.syncEnv=a}console.log(e.addForm),e.$api.sql.insertSqlConfigHistoryInfo(o()(e.addForm)).then(function(t){e.$notify({message:t.data.msg,type:"success"}),e.dialogVisible=!1,e.queryAllSqlData(),e.$refs.addFormRef.resetFields(),e.loading=!1}).catch(function(){e.loading=!1})}})},delsqlStatement:function(e){var t=this;this.$confirm("确定删除吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){t.$api.sql.deleteSqlStatementById(e).then(function(e){t.$notify({type:"success",message:e.data.msg}),t.selectSqlConfig()}).catch(function(){t.loading=!1})}).catch(function(){})},insertSqlConfigHistoryInfoAgain:function(){var e=this;this.dialogVisible=!1,this.$refs.detailFormRef.validate(function(t){if(t){if(e.detailForm.operatorTime=e.$common.getCurrentDateTime(),e.detailForm.operatorPerson=e.operatorPerson,e.addForm.envCheckList){for(var a="",l=0;l<e.addForm.envCheckList.length;l++)a+=e.addForm.envCheckList[l]+",";a=a.substring(0,a.lastIndexOf(",")),e.detailForm.syncEnv=a}console.log(e.detailForm),e.$api.sql.insertSqlConfigHistoryInfo(o()(e.detailForm)).then(function(t){e.$notify({message:t.data.msg,type:"success"}),e.detailDialogVisible=!1,e.selectSqlConfig(),e.$refs.detailFormRef.resetFields(),e.loading=!1}).catch(function(){e.loading=!1})}})},cancelDialogVisible:function(){this.$refs.addFormRef.resetFields(),this.dialogVisible=!1},canceldetailDialogVisible:function(){this.detailDialogVisible=!1},selectSqlConfig:function(){this.queryInfo.pageNum=1,this.total=0,this.queryAllSqlData()},showDetailDialog:function(e){var t=this;this.detailDialogVisible=!0,this.$api.sql.selectSqlConfigHistoryInfoById(e).then(function(e){t.$refs.detailFormRef.resetFields(),t.loading=!1,t.detailForm=e.data.data}).catch(function(){t.loading=!1})},querySearchAsync:function(e,t){for(var a=this.dbNames,l=0;l<a.length;l++)a[l].value=a[l].dbName;var o=e?a.filter(this.createStateFilter(e)):a;clearTimeout(this.timeout),this.timeout=setTimeout(function(){t(o)},3e3*Math.random())},createStateFilter:function(e){return function(t){return 0===t.value.toLowerCase().indexOf(e.toLowerCase())}},handleSelect:function(e){console.log(e)}}}),s={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"sql-box"},[a("el-form",{staticClass:"sql-form-inline",attrs:{inline:!0}},[a("el-form-item",{attrs:{label:"数据库名称"}},[a("el-autocomplete",{attrs:{"fetch-suggestions":e.querySearchAsync,placeholder:"请输入内容",clearable:""},on:{select:e.handleSelect},model:{value:e.queryInfo.dbName,callback:function(t){e.$set(e.queryInfo,"dbName",t)},expression:"queryInfo.dbName"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"操作人"}},[a("el-select",{attrs:{placeholder:"请选择",clearable:""},model:{value:e.queryInfo.operatorPerson,callback:function(t){e.$set(e.queryInfo,"operatorPerson",t)},expression:"queryInfo.operatorPerson"}},e._l(e.userOptions,function(e){return a("el-option",{key:e.id,attrs:{label:e.nick,value:e.nick}})}),1)],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{type:"primary"},on:{click:e.selectSqlConfig}},[e._v("查询")])],1)],1),e._v(" "),a("el-row",[a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogVisible=!0}}},[e._v("新建")])],1),e._v(" "),a("el-table",{attrs:{data:e.sqlList,border:"",fit:!0}},[a("el-table-column",{attrs:{label:"序号",type:"index",align:"center",width:"80"}}),e._v(" "),a("el-table-column",{attrs:{label:"数据库",prop:"dbName"}}),e._v(" "),a("el-table-column",{attrs:{label:"同步环境",prop:"syncEnv"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作时间",prop:"operatorTime"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作人",prop:"operatorPerson"}}),e._v(" "),a("el-table-column",{attrs:{label:"执行结果",prop:"executingResult"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作",prop:"operation"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.showDetailDialog(t.row.id)}}},[e._v("查看")]),e._v(" "),a("el-button",{attrs:{type:"text",size:"small"},on:{click:function(a){return e.delsqlStatement(t.row.id)}}},[e._v("删除")])]}}])})],1),e._v(" "),a("el-pagination",{attrs:{"current-page":e.currpage,"page-sizes":[5,10,20,30],"page-size":e.queryInfo.pageSize,layout:"prev, pager, next, sizes, total, jumper",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}}),e._v(" "),a("el-dialog",{attrs:{title:"新建",visible:e.dialogVisible,"close-on-click-modal":!1,width:"70%"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.cancelDialogVisible}},[a("el-form",{ref:"addFormRef",attrs:{model:e.addForm,rules:e.addFormRules,"label-width":"100px"}},[a("el-form-item",{attrs:{label:"数据库名称",prop:"dbName"}},[a("el-input",{attrs:{placeholder:"请输入数据库名称"},model:{value:e.addForm.dbName,callback:function(t){e.$set(e.addForm,"dbName",t)},expression:"addForm.dbName"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"sql语句",prop:"sqlStatement"}},[a("el-input",{attrs:{type:"textarea",autosize:{minRows:10,maxRows:12},placeholder:"请输入SQL"},model:{value:e.addForm.sqlStatement,callback:function(t){e.$set(e.addForm,"sqlStatement",t)},expression:"addForm.sqlStatement"}})],1),e._v(" "),a("el-form-item",{attrs:{label:"选择环境",prop:"envCheckList"}},[a("el-checkbox-group",{model:{value:e.addForm.envCheckList,callback:function(t){e.$set(e.addForm,"envCheckList",t)},expression:"addForm.envCheckList"}},[a("el-checkbox",{attrs:{label:"test"}}),e._v(" "),a("el-checkbox",{attrs:{label:"test2"}}),e._v(" "),a("el-checkbox",{attrs:{label:"pressure"}}),e._v(" "),a("el-checkbox",{attrs:{label:"test_platform"}})],1)],1)],1),e._v(" "),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.cancelDialogVisible}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.insertSqlConfigHistoryInfo}},[e._v("确 定")])],1)],1),e._v(" "),a("el-dialog",{attrs:{title:"查看",visible:e.detailDialogVisible,"close-on-click-modal":!1},on:{"update:visible":function(t){e.detailDialogVisible=t},close:e.canceldetailDialogVisible}},[a("el-form",{ref:"detailFormRef",attrs:{model:e.detailForm,"label-width":"100px"}},[a("el-row",[a("el-col",[a("el-form-item",{attrs:{label:"数据库名称"}},[a("el-input",{attrs:{disabled:""},model:{value:e.detailForm.dbName,callback:function(t){e.$set(e.detailForm,"dbName",t)},expression:"detailForm.dbName"}})],1)],1)],1),e._v(" "),a("el-row",[a("el-col",[a("el-form-item",{attrs:{label:"sql语句"}},[a("el-input",{attrs:{type:"textarea",autosize:{maxRows:12},disabled:""},model:{value:e.detailForm.sqlStatement,callback:function(t){e.$set(e.detailForm,"sqlStatement",t)},expression:"detailForm.sqlStatement"}})],1)],1)],1),e._v(" "),a("el-row",[a("el-col",[a("el-form-item",{attrs:{label:"选择环境"}},[a("el-checkbox-group",{model:{value:e.detailForm.envCheckList,callback:function(t){e.$set(e.detailForm,"envCheckList",t)},expression:"detailForm.envCheckList"}},[a("el-checkbox",{attrs:{label:"test",disabled:"111"==e.detailForm.syncEnv}}),e._v(" "),a("el-checkbox",{attrs:{label:"test2",disabled:"test2"==e.detailForm.syncEnv}}),e._v(" "),a("el-checkbox",{attrs:{label:"pressure",disabled:"pressure"==e.detailForm.syncEnv}}),e._v(" "),a("el-checkbox",{attrs:{label:"test_platform",disabled:"test_platform"==e.detailForm.syncEnv}})],1)],1)],1)],1)],1),e._v(" "),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:e.canceldetailDialogVisible}},[e._v("取 消")]),e._v(" "),a("el-button",{attrs:{type:"primary"},on:{click:e.insertSqlConfigHistoryInfoAgain}},[e._v("确 定")])],1)],1)],1)},staticRenderFns:[]};var c=a("VU/8")(r,s,!1,function(e){a("mmYH")},"data-v-536651c4",null);t.default=c.exports},mmYH:function(e,t){}});
|
|
//# sourceMappingURL=18.ed9a1dfedd699e4d2dce.js.map
|