修改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> </h1>
</div> </div>
<div class="site-navbar__body clearfix"> <div class="site-navbar__body clearfix">
<el-menu <el-menu class="site-navbar__menu" mode="horizontal">
class="site-navbar__menu"
mode="horizontal">
<el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold"> <el-menu-item class="site-navbar__switch" index="0" @click="sidebarFold = !sidebarFold">
<icon-svg name="zhedie"></icon-svg> <icon-svg name="zhedie"></icon-svg>
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
<el-menu <el-menu class="site-navbar__menu site-navbar__menu--right" mode="horizontal">
class="site-navbar__menu site-navbar__menu--right"
mode="horizontal">
<el-menu-item index="1" @click="$router.push({ name: 'theme' })"> <el-menu-item index="1" @click="$router.push({ name: 'theme' })">
<template slot="title"> <template slot="title">
<el-badge> <el-badge>
@ -43,60 +39,60 @@
</template> </template>
<script> <script>
import UpdatePassword from './main-navbar-update-password' import { clearLoginInfo } from '@/utils'
import { clearLoginInfo } from '@/utils' import UpdatePassword from './main-navbar-update-password'
export default { export default {
data () { data() {
return { return {
updatePassowrdVisible: false updatePassowrdVisible: false
} }
},
components: {
UpdatePassword
},
computed: {
navbarLayoutType: {
get() { return this.$store.state.common.navbarLayoutType }
}, },
components: { sidebarFold: {
UpdatePassword get() { return this.$store.state.common.sidebarFold },
set(val) { this.$store.commit('common/updateSidebarFold', val) }
}, },
computed: { mainTabs: {
navbarLayoutType: { get() { return this.$store.state.common.mainTabs },
get () { return this.$store.state.common.navbarLayoutType } set(val) { this.$store.commit('common/updateMainTabs', val) }
},
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 }
}
}, },
methods: { userName: {
// get() { return this.$store.state.user.name }
updatePasswordHandle () { }
this.updatePassowrdVisible = true },
this.$nextTick(() => { methods: {
this.$refs.updatePassowrd.init() //
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' })
}
}) })
}, }).catch(() => { })
// 退
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(() => {})
}
} }
} }
}
</script> </script>

View File

@ -1,9 +1,7 @@
<template> <template>
<el-dialog <el-dialog :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" :visible.sync="visible">
:title="!dataForm.id ? '新增' : '修改'" <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()"
:close-on-click-modal="false" label-width="100px">
: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-form-item label="bean名称" prop="beanName">
<el-input v-model="dataForm.beanName" placeholder="spring bean名称, 如: testTask"></el-input> <el-input v-model="dataForm.beanName" placeholder="spring bean名称, 如: testTask"></el-input>
</el-form-item> </el-form-item>
@ -25,84 +23,84 @@
</template> </template>
<script> <script>
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
id: 0, id: 0,
beanName: '', beanName: '',
params: '', params: '',
cronExpression: '', cronExpression: '',
remark: '', remark: '',
status: 0 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
}
})
}
})
}, },
// dataRule: {
dataFormSubmit () { beanName: [
this.$refs['dataForm'].validate((valid) => { { required: true, message: '用户名不能为空', trigger: 'blur' }
if (valid) { ],
this.$http({ cronExpression: [
url: this.$http.adornUrl(`/sys/schedule/${!this.dataForm.id ? 'save' : 'update'}`), { required: true, message: 'cron表达式不能为空', trigger: 'blur' }
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)
}
})
}
})
} }
} }
},
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> </script>

View File

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