修改bug

This commit is contained in:
hj 2023-04-10 11:13:40 +08:00
parent 9730d1c936
commit ec39d76372
3 changed files with 208 additions and 258 deletions

View File

@ -7,16 +7,12 @@
</h1>
</div>
<div class="site-navbar__body clearfix">
<el-menu
class="site-navbar__menu"
mode="horizontal">
<el-menu class="site-navbar__menu" mode="horizontal">
<el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
<icon-svg name="zhedie"></icon-svg>
</el-menu-item>
</el-menu>
<el-menu
class="site-navbar__menu site-navbar__menu--right"
mode="horizontal">
<el-menu class="site-navbar__menu site-navbar__menu--right" mode="horizontal">
<el-menu-item index="1" @click="$router.push({ name: 'theme' })">
<template slot="title">
<el-badge>
@ -43,60 +39,60 @@
</template>
<script>
import UpdatePassword from './main-navbar-update-password'
import { clearLoginInfo } from '@/utils'
export default {
data () {
return {
updatePassowrdVisible: false
}
import { clearLoginInfo } from '@/utils'
import UpdatePassword from './main-navbar-update-password'
export default {
data() {
return {
updatePassowrdVisible: false
}
},
components: {
UpdatePassword
},
computed: {
navbarLayoutType: {
get() { return this.$store.state.common.navbarLayoutType }
},
components: {
UpdatePassword
sidebarFold: {
get() { return this.$store.state.common.sidebarFold },
set(val) { this.$store.commit('common/updateSidebarFold', val) }
},
computed: {
navbarLayoutType: {
get () { return this.$store.state.common.navbarLayoutType }
},
sidebarFold: {
get () { return this.$store.state.common.sidebarFold },
set (val) { this.$store.commit('common/updateSidebarFold', val) }
},
mainTabs: {
get () { return this.$store.state.common.mainTabs },
set (val) { this.$store.commit('common/updateMainTabs', val) }
},
userName: {
get () { return this.$store.state.user.name }
}
mainTabs: {
get() { return this.$store.state.common.mainTabs },
set(val) { this.$store.commit('common/updateMainTabs', val) }
},
methods: {
//
updatePasswordHandle () {
this.updatePassowrdVisible = true
this.$nextTick(() => {
this.$refs.updatePassowrd.init()
userName: {
get() { return this.$store.state.user.name }
}
},
methods: {
//
updatePasswordHandle() {
this.updatePassowrdVisible = true
this.$nextTick(() => {
this.$refs.updatePassowrd.init()
})
},
// 退
logoutHandle() {
this.$confirm(`确定进行[退出]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/logout'),
method: 'post',
data: this.$http.adornData()
}).then(({ data }) => {
if (data && data.code === 0) {
clearLoginInfo()
this.$router.push({ name: 'login' })
}
})
},
// 退
logoutHandle () {
this.$confirm(`确定进行[退出]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/logout'),
method: 'post',
data: this.$http.adornData()
}).then(({data}) => {
if (data && data.code === 0) {
clearLoginInfo()
this.$router.push({ name: 'login' })
}
})
}).catch(() => {})
}
}).catch(() => { })
}
}
}
</script>

View File

@ -1,9 +1,7 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="100px">
<el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
label-width="100px">
<el-form-item label="bean名称" prop="beanName">
<el-input v-model="dataForm.beanName" placeholder="spring bean名称, 如: testTask"></el-input>
</el-form-item>
@ -25,84 +23,84 @@
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
beanName: '',
params: '',
cronExpression: '',
remark: '',
status: 0
},
dataRule: {
beanName: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }
],
cronExpression: [
{ required: true, message: 'cron表达式不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/schedule/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm.beanName = data.schedule.beanName
this.dataForm.params = data.schedule.params
this.dataForm.cronExpression = data.schedule.cronExpression
this.dataForm.remark = data.schedule.remark
this.dataForm.status = data.schedule.status
}
})
}
})
export default {
data() {
return {
visible: false,
dataForm: {
id: 0,
beanName: '',
params: '',
cronExpression: '',
remark: '',
status: 0
},
//
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/schedule/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'jobId': this.dataForm.id || undefined,
'beanName': this.dataForm.beanName,
'params': this.dataForm.params,
'cronExpression': this.dataForm.cronExpression,
'remark': this.dataForm.remark,
'status': !this.dataForm.id ? undefined : this.dataForm.status
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
dataRule: {
beanName: [
{ required: true, message: '用户名不能为空', trigger: 'blur' }
],
cronExpression: [
{ required: true, message: 'cron表达式不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init(id) {
this.dataForm.id = id || 0
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/schedule/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataForm.beanName = data.schedule.beanName
this.dataForm.params = data.schedule.params
this.dataForm.cronExpression = data.schedule.cronExpression
this.dataForm.remark = data.schedule.remark
this.dataForm.status = data.schedule.status
}
})
}
})
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/schedule/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'jobId': this.dataForm.id || undefined,
'beanName': this.dataForm.beanName,
'params': this.dataForm.params,
'cronExpression': this.dataForm.cronExpression,
'remark': this.dataForm.remark,
'status': !this.dataForm.id ? undefined : this.dataForm.status
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>

View File

@ -1,9 +1,5 @@
<template>
<el-dialog
title="日志列表"
:close-on-click-modal="false"
:visible.sync="visible"
width="75%">
<el-dialog title="日志列表" :close-on-click-modal="false" :visible.sync="visible" width="75%">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.id" placeholder="任务ID" clearable></el-input>
@ -12,141 +8,101 @@
<el-button @click="getDataList()">查询</el-button>
</el-form-item>
</el-form>
<el-table
:data="dataList"
border
v-loading="dataListLoading"
height="460"
style="width: 100%;">
<el-table-column
prop="logId"
header-align="center"
align="center"
width="80"
label="日志ID">
<el-table :data="dataList" border v-loading="dataListLoading" height="460" style="width: 100%;">
<el-table-column prop="logId" header-align="center" align="center" width="80" label="日志ID">
</el-table-column>
<el-table-column
prop="jobId"
header-align="center"
align="center"
width="80"
label="任务ID">
<el-table-column prop="jobId" header-align="center" align="center" width="80" label="任务ID">
</el-table-column>
<el-table-column
prop="beanName"
header-align="center"
align="center"
label="bean名称">
<el-table-column prop="beanName" header-align="center" align="center" label="bean名称">
</el-table-column>
<el-table-column
prop="params"
header-align="center"
align="center"
label="参数">
<el-table-column prop="params" header-align="center" align="center" label="参数">
</el-table-column>
<el-table-column
prop="status"
header-align="center"
align="center"
label="状态">
<el-table-column prop="status" header-align="center" align="center" label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 0" size="small">成功</el-tag>
<el-tag v-else @click.native="showErrorInfo(scope.row.logId)" size="small" type="danger" style="cursor: pointer;">失败</el-tag>
<el-tag v-else @click.native="showErrorInfo(scope.row.logId)" size="small" type="danger"
style="cursor: pointer;">失败</el-tag>
</template>
</el-table-column>
<el-table-column
prop="times"
header-align="center"
align="center"
label="耗时(单位: 毫秒)">
<el-table-column prop="times" header-align="center" align="center" label="耗时(单位: 毫秒)">
</el-table-column>
<el-table-column
prop="createTime"
header-align="center"
align="center"
width="180"
label="执行时间">
<el-table-column prop="createTime" header-align="center" align="center" width="180" label="执行时间">
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-dialog>
</template>
<script>
export default {
data () {
return {
visible: false,
dataForm: {
id: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false
}
export default {
data() {
return {
visible: false,
dataForm: {
id: ''
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false
}
},
methods: {
init() {
this.visible = true
this.getDataList()
},
methods: {
init () {
this.visible = true
this.getDataList()
},
//
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/scheduleLog/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'jobId': this.dataForm.id
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
//
getDataList() {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/scheduleLog/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'jobId': this.dataForm.id
})
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.getDataList()
},
//
showErrorInfo (id) {
this.$http({
url: this.$http.adornUrl(`/sys/scheduleLog/info/${id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.$alert(data.log.error)
} else {
this.$message.error(data.msg)
}
})
}
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
//
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
},
//
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
},
//
showErrorInfo(id) {
this.$http({
url: this.$http.adornUrl(`/sys/scheduleLog/info/${id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({ data }) => {
if (data && data.code === 0) {
this.$alert(data.log.error)
} else {
this.$message.error(data.msg)
}
})
}
}
}
</script>