Files
dbswitch/dbswitch-admin/src/main/resources/static/js/20.beeb2cdb187564a0c9fe.js
2024-08-21 22:12:09 +08:00

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

webpackJsonp([20],{Cr6a:function(e,t){},D0I9:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a("mvHQ"),s=a.n(n),i={data:function(){return{loading:!0,currentPage:1,pageSize:10,totalCount:2,keyword:null,tableData:[],isSelected:!0,idsSelected:[]}},methods:{loadData:function(){var e=this;this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/list",data:s()({searchText:this.keyword,page:this.currentPage,size:this.pageSize})}).then(function(t){0===t.data.code?(e.currentPage=t.data.pagination.page,e.pageSize=t.data.pagination.size,e.totalCount=t.data.pagination.total,e.tableData=t.data.data):alert("加载任务列表失败:"+t.data.message)},function(){console.log("load assignments list failed")})},searchByKeyword:function(){this.currentPage=1,this.loadData()},boolFormatPublish:function(e,t){return!0===e.isPublished?"已启动":"已停止"},scheduleTimeFormat:function(e,t){return null==e.scheduleTime?"--":e.scheduleTime},stringFormatSchedule:function(e,t){return"MANUAL"==e.scheduleMode?"手动":"定时"},handleSelectionChange:function(e){e.length>0?(this.isSelected=!1,this.idsSelected.push(e.map(function(e){return e.id}))):(this.isSelected=!0,this.idsSelected=[])},batchStart:function(){var e=this;console.log(this.idsSelected),this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/deploy?ids="+this.idsSelected}).then(function(t){0===t.data.code?(e.$message({message:"任务发布成功!",type:"success"}),e.loadData()):t.data.message&&e.$message.error("任务发布失败,"+t.data.message)})},batchStop:function(){var e=this;this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/retire?ids="+this.idsSelected}).then(function(t){0===t.data.code?(e.$message({message:"下线任务成功!",type:"success"}),e.loadData()):t.data.message&&e.$message.error("下线任务失败,"+t.data.message)})},batchExport:function(){var e=this;this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/export?ids="+this.idsSelected,responseType:"blob"}).then(function(t){200===t.status?(e.downloadFile(t),e.$message({message:"导出任务成功!",type:"success"}),e.loadData()):t.data.message&&e.$message.error("导出任务失败,"+t.data.message)})},batchImport:function(){this.$message({message:"功能暂未开放,敬请期待!",center:!0})},downloadFile:function(e){var t=e.headers["content-type"];if(!e.data)return console.error("响应异常:",e),!1;console.info("下载文件:",e);var a=new Blob([e.data],{type:t}),n="unknown";e.headers["content-disposition"]&&(n=window.decodeURI(e.headers["content-disposition"].split("=")[1])),console.log("文件名称:",n),this.downFile(a,n)},downFile:function(e,t){if("download"in document.createElement("a")){var a=document.createElement("a");a.href=window.URL.createObjectURL(e),a.download=t,a.style.display="none",document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(a.href),document.body.removeChild(a)}else window.navigator.msSaveBlob(e,t)},handleCreate:function(){this.$router.push("/task/create")},handleDetail:function(e,t){this.$router.push({path:"/task/detail",query:{id:t.id}})},handleUpdate:function(e,t){this.$router.push({path:"/task/update",query:{id:t.id}})},handleDelete:function(e,t){var a=this;this.$confirm("是否确定删除任务【"+t.name+"】?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(function(){a.$http.delete("/dbswitch/admin/api/v1/assignment/delete/"+t.id).then(function(e){0===e.data.code?a.loadData():e.data.message&&alert("删除任务失败:"+e.data.message)})})},schedulingLog:function(e,t){this.$router.push({path:"/task/schedule?id="+t.id})},handlePublish:function(e,t){var a=this;this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/deploy?ids="+t.id}).then(function(e){0===e.data.code?(a.$message({message:"任务发布成功!",type:"success"}),a.loadData()):e.data.message&&a.$message.error("任务发布失败,"+e.data.message)})},handleRunTask:function(e,t){var a=this;this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/run",data:s()([t.id])}).then(function(e){0===e.data.code?(a.$message({message:"手动启动执行任务成功!",type:"success"}),a.loadData()):e.data.message&&a.$message.error("手动启动执行任务失败,"+e.data.message)})},handleRetireTask:function(e,t){var a=this;this.$http({method:"POST",headers:{"Content-Type":"application/json"},url:"/dbswitch/admin/api/v1/assignment/retire?ids="+t.id}).then(function(e){0===e.data.code?(a.$message({message:"下线任务成功!",type:"success"}),a.loadData()):e.data.message&&a.$message.error("下线任务失败,"+e.data.message)})},handleSizeChange:function(e){this.loading=!0,this.pageSize=e,this.loadData()},handleCurrentChange:function(e){this.loading=!0,this.currentPage=e,this.loadData()}},created:function(){this.loadData()}},o={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-card",[a("el-row",[a("el-button",{attrs:{size:"mini",icon:"el-icon-switch-button",disabled:e.isSelected,plain:""},on:{click:function(t){return e.batchStart()}}},[e._v("启动\n ")]),e._v(" "),a("el-button",{attrs:{size:"mini",icon:"el-icon-video-pause",disabled:e.isSelected,plain:""},on:{click:function(t){return e.batchStop()}}},[e._v("停用")]),e._v(" "),a("span",{staticStyle:{color:"#e9e9f3"}},[e._v("  |  ")]),e._v(" "),a("el-button",{attrs:{size:"mini",plain:""},on:{click:function(t){return e.batchImport()}}},[e._v("导入")]),e._v(" "),a("el-button",{attrs:{size:"mini",disabled:e.isSelected,plain:""},on:{click:function(t){return e.batchExport()}}},[e._v("导出")]),e._v(" "),a("el-button",{staticClass:"right-add-button-group",attrs:{type:"primary",size:"mini",icon:"el-icon-document-add"},on:{click:e.handleCreate}},[e._v("创建\n ")])],1),e._v(" "),a("div",{staticClass:"assignment-list-top"},[a("div",{staticClass:"left-search-input-group"},[a("div",{staticClass:"left-search-input"},[a("el-input",{staticStyle:{width:"100%"},attrs:{size:"mini",placeholder:"请输入任务名称关键字搜索",clearable:!0},on:{change:e.searchByKeyword},model:{value:e.keyword,callback:function(t){e.keyword=t},expression:"keyword"}},[a("el-button",{attrs:{slot:"append",icon:"el-icon-search"},on:{click:e.searchByKeyword},slot:"append"})],1)],1)])]),e._v(" "),a("el-table",{attrs:{"header-cell-style":{background:"#eef1f6",color:"#606266"},data:e.tableData,size:"small",border:""},on:{"selection-change":e.handleSelectionChange}},[a("el-table-column",{attrs:{prop:"id",label:"编号",type:"selection","min-width":"6%"}}),e._v(" "),a("el-table-column",{attrs:{label:"任务名称","show-overflow-tooltip":!0,"min-width":"15%"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",{staticClass:"task-name",on:{click:function(a){return e.handleDetail(t.$index,t.row)}}},[e._v(e._s(t.row.name))])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"scheduleMode",label:"模式",sortable:"",formatter:e.stringFormatSchedule,"min-width":"8%"}}),e._v(" "),a("el-table-column",{attrs:{label:"源端","min-width":"10%"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-popover",{attrs:{trigger:"hover",placement:"top"}},[a("p",[e._v("源端数据源类型:"+e._s(t.row.sourceType))]),e._v(" "),a("p",[e._v("源端模式名:"+e._s(t.row.sourceSchema))]),e._v(" "),a("div",{staticClass:"name-wrapper",attrs:{slot:"reference"},slot:"reference"},[a("el-tag",{attrs:{size:"medium"}},[e._v(e._s(t.row.sourceSchema))])],1)])]}}])}),e._v(" "),a("el-table-column",{attrs:{label:"目标端","min-width":"10%"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-popover",{attrs:{trigger:"hover",placement:"top"}},[a("p",[e._v("目标端数据源类型:"+e._s(t.row.targetType))]),e._v(" "),a("p",[e._v("目标端模式名:"+e._s(t.row.targetSchema))]),e._v(" "),a("div",{staticClass:"name-wrapper",attrs:{slot:"reference"},slot:"reference"},[a("el-tag",{attrs:{size:"medium"}},[e._v(e._s(t.row.targetSchema))])],1)])]}}])}),e._v(" "),a("el-table-column",{attrs:{label:"运行状态","show-overflow-tooltip":"",sortable:"","min-width":"10%"},scopedSlots:e._u([{key:"default",fn:function(t){return["执行成功"==t.row.runStatus?a("el-icon",{staticClass:"el-icon-success color-success"}):e._e(),e._v(" "),"执行异常"==t.row.runStatus?a("el-icon",{staticClass:"el-icon-error color-error"}):e._e(),e._v(" "),"任务取消"==t.row.runStatus?a("el-icon",{staticClass:"el-icon-remove color-cancel"}):e._e(),e._v(" "),"执行中"==t.row.runStatus?a("el-icon",{staticClass:"el-icon-video-play color-running"}):e._e(),e._v(" "),"待执行"==t.row.runStatus?a("el-icon",{staticClass:"el-icon-loading color-await"}):e._e(),e._v(" "),a("span",[e._v(e._s(t.row.runStatus))])]}}])}),e._v(" "),a("el-table-column",{attrs:{prop:"isPublished",label:"任务状态",sortable:"",formatter:e.boolFormatPublish,"show-overflow-tooltip":!0,"min-width":"10%"}}),e._v(" "),a("el-table-column",{attrs:{prop:"scheduleTime",label:"调度时间",formatter:e.scheduleTimeFormat,"min-width":"15%"}}),e._v(" "),a("el-table-column",{attrs:{label:"操作","min-width":"35%"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-button-group",[a("el-tooltip",{attrs:{content:"跳转到调度监控",placement:"top"}},[!0===t.row.isPublished?a("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-timer",round:""},on:{click:function(a){return e.schedulingLog(t.$index,t.row)}}},[e._v("日志\n ")]):e._e()],1),e._v(" "),!1===t.row.isPublished?a("el-button",{attrs:{size:"small",type:"primary",icon:"el-icon-timer",round:""},on:{click:function(a){return e.handlePublish(t.$index,t.row)}}},[e._v("启动\n ")]):e._e(),e._v(" "),!0===t.row.isPublished?a("el-button",{attrs:{size:"small",type:"info",icon:"el-icon-delete-location",round:""},on:{click:function(a){return e.handleRetireTask(t.$index,t.row)}}},[e._v("停用\n ")]):e._e(),e._v(" "),a("el-tooltip",{attrs:{content:"人工触发调度执行",placement:"top"}},[!0===t.row.isPublished?a("el-button",{attrs:{size:"small",type:"danger",icon:"el-icon-video-play",round:""},on:{click:function(a){return e.handleRunTask(t.$index,t.row)}}},[e._v("执行\n ")]):e._e()],1),e._v(" "),!1===t.row.isPublished?a("el-button",{attrs:{size:"small",type:"warning",icon:"el-icon-edit",round:""},on:{click:function(a){return e.handleUpdate(t.$index,t.row)}}},[e._v("修改\n ")]):e._e(),e._v(" "),a("el-button",{attrs:{size:"small",type:"success",icon:"el-icon-document",round:""},on:{click:function(a){return e.handleDetail(t.$index,t.row)}}},[e._v("详情\n ")]),e._v(" "),!1===t.row.isPublished?a("el-button",{attrs:{size:"small",type:"danger",icon:"el-icon-delete",round:""},on:{click:function(a){return e.handleDelete(t.$index,t.row)}}},[e._v("删除\n ")]):e._e()],1)]}}])})],1),e._v(" "),a("div",{staticClass:"page",attrs:{align:"right"}},[a("el-pagination",{attrs:{"current-page":e.currentPage,"page-sizes":[5,10,20,40],"page-size":e.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.totalCount},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],1)],1)},staticRenderFns:[]};var l=a("VU/8")(i,o,!1,function(e){a("Cr6a")},"data-v-12708364",null);t.default=l.exports}});
//# sourceMappingURL=20.beeb2cdb187564a0c9fe.js.map