Commit 432b5b0e authored by 王晓铜's avatar 王晓铜

修改监控bug

parent 2d759c40
......@@ -423,7 +423,6 @@ export default {
}
}
})
console.log('保存信息', this.caseForm)
},
// 取消按钮
cancelCaseFrom() {
......
......@@ -11,19 +11,20 @@
</el-select>
</el-form-item>
<el-form-item label="SQL脚本:" prop="sql">
<div style="border:1.5px solid #DCDCDC">
<codemirror ref="editQuerySQL" v-model="sqlMonitorForm.sql" :options="cmOptions"></codemirror>
<div style="border:1.5px solid #DCDCDC;width:90%;">
<codemirror ref="editQuerySQL" v-model="sqlMonitorForm.sql" :options="cmOptions" @focus="testFoucs">
</codemirror>
</div>
</el-form-item>
<el-form-item style="margin-left:1000px">
<el-button type="primary" icon="el-icon-caret-right" @click="executeSqlBtn">执行</el-button>
<el-button type="primary" icon="el-icon-message-solid" @click="setPoliceBtn">设置报警</el-button>
<el-button type="primary" size="mini" icon="el-icon-caret-right" @click="executeSqlBtn">执行</el-button>
<el-button type="primary" size="mini" icon="el-icon-message-solid" @click="setPoliceBtn">设置报警</el-button>
</el-form-item>
<el-form-item style="margin-left:-80px">
<!-- 动态绑定表格数据 -->
<el-table :data="sqlList" border style="font-size:8px;"
:header-cell-style="{background:'#eee',color:'#606266'}" v-if="isShow">
<af-table-column v-for="(val, key) in columnArr" :label="val" :prop="val" :key="key" class="table-dynamic">
<el-table id="tabId" :data="sqlList" border style="font-size:8px;"
:header-cell-style="{background:'#eee',color:'#606266'}" v-if="isShow" ref="tabRef">
<af-table-column v-for="(val, key) in columnArr" :label="val" :prop="val" :key="key" :fontRate='fontRate'>
</af-table-column>
</el-table>
</el-form-item>
......@@ -108,7 +109,7 @@ export default {
data() {
return {
cmOptions: {
tabSize: 4,
tabSize: 6,
lineNumbers: true,
line: true,
indentWithTabs: true,
......@@ -199,47 +200,63 @@ export default {
trigger: 'blur'
}
]
},
tableWidth: ''
}
}
},
watch: {
tableWidth: 'getTableWidth'
},
// 接收列表页面传递的参数
activated() {
var data = this.$route.query.data
// console.log('rrr', data)
if (data === 'add') {
this.sqlMonitorForm = {}
this.sqlMonitorForm.status = 1
} else {
this.sqlMonitorForm.id = data.id
this.sqlMonitorForm.dingText = data.dingText
this.sqlMonitorForm.dingUrl = data.dingUrl
this.sqlMonitorForm.dsId = data.dsId
this.sqlMonitorForm.serviceName = data.serviceName
this.sqlMonitorForm.sql = data.sql
this.sqlMonitorForm.status = data.status
this.sqlMonitorForm.taskCron = data.taskCron
this.sqlMonitorForm.taskName = data.taskName
}
},
// activated() {
// this.DialogVisible = false
// var data = this.$route.query.data
// console.log('rrr', data)
// if (data === 'add') {
// this.isShow = false
// this.sqlMonitorForm = {}
// this.sqlMonitorForm.status = 1
// this.sqlMonitorForm.sql = ''
// } else {
// this.isShow = false
// this.sqlMonitorForm.id = data.id
// this.sqlMonitorForm.dingText = data.dingText
// this.sqlMonitorForm.dingUrl = data.dingUrl
// this.sqlMonitorForm.dsId = data.dsId
// this.sqlMonitorForm.serviceName = data.serviceName
// this.sqlMonitorForm.sql = data.sql
// this.sqlMonitorForm.status = data.status
// this.sqlMonitorForm.taskCron = data.taskCron
// this.sqlMonitorForm.taskName = data.taskName
// }
// },
created() {
this.getSqlMonitorDataSource()
},
mounted() {
var editor = this.$refs.editQuerySQL.codemirror
editor.on('cursorActivity', function () {
editor.showHint()
this.$bus.$on('data', (row) => {
console.log('rrr', row)
if (row !== null) {
if (row === 'add') {
this.isShow = false
this.sqlMonitorForm = {}
this.sqlMonitorForm.status = 1
this.sqlMonitorForm.sql = ''
} else {
this.isShow = false
this.sqlMonitorForm.id = row.id
this.sqlMonitorForm.dingText = row.dingText
this.sqlMonitorForm.dingUrl = row.dingUrl
this.sqlMonitorForm.dsId = row.dsId
this.sqlMonitorForm.serviceName = row.serviceName
this.sqlMonitorForm.sql = row.sql
this.sqlMonitorForm.status = row.status
this.sqlMonitorForm.taskCron = row.taskCron
this.sqlMonitorForm.taskName = row.taskName
}
}
})
},
methods: {
getTableWidth() {
for (let i = 0; i < document.getElementsByClassName('table-dynamic').length; i++) {
var item = document.getElementsByClassName('table-dynamic')[i]
console.log(item)
}
testFoucs() {
var editor = this.$refs.editQuerySQL.codemirror
editor.on('cursorActivity', function () {
editor.showHint()
})
},
// 获取数据源列表
getSqlMonitorDataSource() {
......@@ -302,7 +319,6 @@ export default {
getMonitorStrategy() {
getMonitorStrategy().then((resp) => {
this.taskCronList = resp.data.data
console.log('ww', this.taskCronList)
})
},
// 获取服务列表
......@@ -315,34 +331,49 @@ export default {
saveSqlMonitorFrom() {
this.sqlMonitorForm.owner = this.getUserName
this.sqlMonitorForm.taskClass = 'SqlMonitorHandler'
// 编辑接口
if (this.sqlMonitorForm.id) {
editSqlMonitor(this.sqlMonitorForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success('编辑成功!')
this.$router.push({
path: `/monitor/sqlMonitorList`,
query: { data: 'refresh' }
this.$refs.sqlMonitorFormRef.validate((valid) => {
if (!valid) {
return false
} else {
// 编辑接口
if (this.sqlMonitorForm.id) {
editSqlMonitor(this.sqlMonitorForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success('编辑成功!')
this.DialogVisible = false
this.$router.push({
path: `/monitor/sqlMonitorList`
})
this.sendResh()
} else {
return this.$message.error(resp.data.msg)
}
})
} else {
return this.$message.error(resp.data.msg)
}
})
} else {
// 添加接口
addSqlMonitor(this.sqlMonitorForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success('添加成功!')
this.$router.push({
path: `/monitor/sqlMonitorList`,
query: { data: 'refresh' }
// 添加接口
addSqlMonitor(this.sqlMonitorForm).then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success('添加成功!')
this.DialogVisible = false
this.$router.push({
path: `/monitor/sqlMonitorList`
})
this.sendResh()
} else {
return this.$message.error(resp.data.msg)
}
})
} else {
return this.$message.error(resp.data.msg)
}
})
}
// 添加接口
}
})
},
// 刷新列表
sendResh() {
// bus使用
this.$nextTick(function () {
// DOM 现在更新了
this.$bus.$emit('refresh')
})
}
}
}
......
......@@ -26,7 +26,7 @@
<p v-if="scope.row.taskCron==='0 0 10 ? * 2'">每周一上午10点执行一次</p>
</template>
</el-table-column>
<el-table-column label="sql" width="150px">
<el-table-column label="sql" width="80px">
<template slot-scope="scope">
<el-popover placement="top-start" title="sql" width="50" trigger="hover" :content="scope.row.sql">
<div slot="reference" style="color:#409EFF">SQL</div>
......@@ -88,15 +88,19 @@ export default {
}
},
// 接收参数
activated() {
var data = this.$route.query.data
if (data === 'refresh') {
this.getSqlMonitorList()
}
},
// activated() {
// var data = this.$route.query.data
// if (data === 'refresh') {
// this.getSqlMonitorList()
// }
// },
created() {
this.getSqlMonitorList()
this.getServiceList()
// 接收参数
this.$bus.$on('refresh', () => {
this.getSqlMonitorList()
})
},
methods: {
// 获取sql监控列表
......@@ -113,19 +117,28 @@ export default {
// 添加按钮
addSqlMonitor() {
this.$router.push({
path: `/monitor/addSqlMonitor`,
query: {
data: 'add'
}
path: `/monitor/addSqlMonitor`
// query: {
// data: 'add'
// }
})
this.$nextTick(function () {
// DOM 现在更新了
var row = 'add'
this.$bus.$emit('data', row)
})
},
// 编辑按钮
openEditMonitorDialog(row) {
this.$router.push({
path: `/monitor/addSqlMonitor`,
query: {
data: row
}
path: `/monitor/addSqlMonitor`
// query: {
// data: row
// }
})
this.$nextTick(function () {
// DOM 现在更新了
this.$bus.$emit('data', row)
})
},
// 获取服务列表
......@@ -153,7 +166,7 @@ export default {
delSqlMonitor(row)
.then((resp) => {
if (resp.data.businessCode === '0000') {
this.$message.success(resp.data.msg)
this.$message.success('删除成功!')
this.getSqlMonitorList()
} else {
this.$message.error(resp.data.msg)
......@@ -187,7 +200,6 @@ export default {
formData.set('taskId', row.id)
formData.set('status', 1)
isEnableSqlMonitor(formData).then((resp) => {
console.log('999', resp)
if (resp.data.businessCode === '0000') {
this.getSqlMonitorList()
return this.$message.success(resp.data.msg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment