Commit 7afe6a21 by 郑杰

v1.4 版本发布,修复bug、优化细节、新增定时任务管理,详细信息查看发行版说明

parent ff0c36b5
......@@ -5,6 +5,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
yarn.lock
# Editor directories and files
.idea
......
......@@ -28,7 +28,7 @@
"vue-count-to": "1.0.13",
"echarts": "4.1.0",
"screenfull": "3.3.3",
"vue-router": "3.0.1",
"vue-router": "3.0.2",
"vuex": "3.0.1",
"xlsx": "^0.11.16",
"jszip": "3.1.5",
......
......@@ -8,10 +8,14 @@ export function add(data) {
})
}
export function del(id) {
export function del(key) {
const data = {
key
}
return request({
url: 'api/redis/' + id,
method: 'delete'
url: 'api/redis/',
method: 'delete',
data
})
}
......
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/jobs',
method: 'post',
data
})
}
export function del(id) {
return request({
url: 'api/jobs/' + id,
method: 'delete'
})
}
export function edit(data) {
return request({
url: 'api/jobs',
method: 'put',
data
})
}
export function updateIsPause(id) {
return request({
url: 'api/jobs/' + id,
method: 'put'
})
}
export function execution(id) {
return request({
url: 'api/jobs/exec/' + id,
method: 'put'
})
}
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1546864403462" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2986" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M814.502 270.913l30.18-30.18 30.58 30.58 37.825-37.825-86.377-86.378-37.825 37.825 30.58 30.58-30.18 30.18c-66.856-61.301-154.087-100.642-250.374-106.858V66.548h-53.499v72.289c-214.046 13.792-383.407 191.652-383.407 409.199 0 226.533 183.624 410.157 410.157 410.157s410.157-183.624 410.157-410.157c-0.001-106.858-40.892-204.139-107.817-277.123zM529.994 598.26v74.606h-35.666V598.26c-20.724-7.385-35.666-26.958-35.666-50.225 0-23.267 14.942-42.842 35.666-50.225v-235.1h35.666v235.102c20.724 7.383 35.666 26.958 35.666 50.225 0 23.265-14.942 42.839-35.666 50.223z" p-id="2987" fill="#bfbfbf"></path></svg>
\ No newline at end of file
......@@ -38,7 +38,7 @@ export const filterAsyncRouter = (routers) => { // 遍历后台传来的路由
}
export const loadView = (view) => { // 路由懒加载
return () => import(/* webpackChunkName: "view-[request]" */ `@/views/${view}.vue`)
return () => import(`@/views/${view}`)
}
export default permission
......@@ -24,7 +24,7 @@
</el-table-column>
<el-table-column prop="createTime" label="创建日期" width="180px">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
......@@ -51,6 +51,7 @@ export default {
})
},
methods: {
parseTime,
beforeInit() {
this.url = 'api/logs'
const sort = 'id,desc'
......@@ -61,9 +62,6 @@ export default {
if (username && username) { this.params['username'] = username }
if (logType !== '' && logType !== null) { this.params['logType'] = logType }
return true
},
time(time) {
return parseTime(time)
}
}
}
......
......@@ -3,7 +3,7 @@
<div id="console" :style="'height:'+ height" class="console">
<div v-for="item in data" :key="item.time">
<span>{{ item.name }}</span>
<span style="color:#CD0066 ">{{ time(item.timestamp)+' ' }}</span>
<span style="color:#CD0066 ">{{ parseTime(item.timestamp)+' ' }}</span>
<span style="color: #00CD00">{{ item.threadName+' ' }}</span>
<span :style="'color:'+ getColor(item.level) ">
{{ item.level+' ' }}
......@@ -55,9 +55,7 @@ export default {
window.clearInterval(this.timer)
},
methods: {
time(date) {
return parseTime(date)
},
parseTime,
initWebSocket() {
this.connection(this)
// 断开重连机制,尝试发送消息,捕获异常发生时重连
......
<template >
<router-view />
</template>
<template >
<div style="padding:30px;">
<el-alert :closable="false" title="三级菜单1" type="success">
<router-view />
</el-alert>
</div>
</template>
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="三级菜单2" type="success">
<router-view />
</el-alert>
</div>
</template>
<template>
<div style="padding:30px;">
<el-alert :closable="false" title="二级菜单"/>
</div>
</template>
......@@ -23,7 +23,7 @@
</el-table-column>
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
......@@ -78,6 +78,7 @@ export default {
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/menus'
......@@ -105,9 +106,6 @@ export default {
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
},
getMenus() {
getMenusTree().then(res => {
this.menus = []
......
......@@ -5,7 +5,7 @@
<tree-table v-loading="loading" :data="data" :expand-all="true" :columns="columns" border size="small">
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
......@@ -63,6 +63,7 @@ export default {
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/permissions'
......@@ -90,9 +91,6 @@ export default {
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
},
getPermissions() {
getPermissionTree().then(res => {
this.permissions = []
......
......@@ -7,7 +7,7 @@
<el-table-column prop="remark" label="描述"/>
<el-table-column prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
......@@ -61,6 +61,7 @@ export default {
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/roles'
......@@ -88,9 +89,6 @@ export default {
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
},
getPermissions() {
getPermissionTree().then(res => {
this.permissions = res
......
<template>
<div class="app-container">
<eHeader :query="query"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;">
<el-table-column :show-overflow-tooltip="true" prop="jobName" width="100px" label="任务名称"/>
<el-table-column :show-overflow-tooltip="true" prop="beanName" label="Bean名称"/>
<el-table-column :show-overflow-tooltip="true" prop="methodName" width="90px" label="执行方法"/>
<el-table-column :show-overflow-tooltip="true" prop="params" width="80px" label="参数"/>
<el-table-column :show-overflow-tooltip="true" prop="cronExpression" width="100px" label="cron表达式"/>
<el-table-column :show-overflow-tooltip="true" prop="isPause" width="90px" label="状态">
<template slot-scope="scope">
<el-tag :type="scope.row.isPause ? 'warning' : 'success'">{{ scope.row.isPause ? '已暂停' : '运行中' }}</el-tag>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="remark" label="描述"/>
<el-table-column :show-overflow-tooltip="true" prop="updateTime" label="更新日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180px" align="center">
<template slot-scope="scope">
<edit v-if="checkPermission(['ADMIN','JOB_ALL','JOB_EDIT'])" :data="scope.row" :sup_this="sup_this"/>
<el-button v-if="checkPermission(['ADMIN','JOB_ALL','JOB_EDIT'])" style="margin-left: -2px" type="text" size="mini" @click="execute(scope.row.id)">执行</el-button>
<el-button v-if="checkPermission(['ADMIN','JOB_ALL','JOB_EDIT'])" style="margin-left: 3px" type="text" size="mini" @click="updateStatus(scope.row.id,scope.row.isPause ? '恢复' : '暂停')">
{{ scope.row.isPause ? '恢复' : '暂停' }}
</el-button>
<el-popover
v-if="checkPermission(['ADMIN','JOB_ALL','JOB_DELETE'])"
v-model="scope.row.delPopover"
placement="top"
width="200">
<p>确定停止并删除该任务吗?</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="scope.row.delPopover = false">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.$index, scope.row)">确定</el-button>
</div>
<el-button slot="reference" type="text" size="mini" @click="scope.row.delPopover = true">删除</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '../../../mixins/initData'
import { del, updateIsPause, execution } from '@/api/timing'
import { parseTime } from '@/utils/index'
import eHeader from './module/header'
import edit from './module/edit'
export default {
components: { eHeader, edit },
mixins: [initData],
data() {
return {
delLoading: false, sup_this: this
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/jobs'
const sort = 'id,desc'
const query = this.query
const value = query.value
this.params = { page: this.page, size: this.size, sort: sort }
if (value) { this.params['jobName'] = value }
return true
},
execute(id) {
execution(id).then(res => {
this.$notify({
title: '执行成功',
type: 'success',
duration: 2500
})
}).catch(err => {
console.log(err.response.data.message)
})
},
updateStatus(id, status) {
updateIsPause(id).then(res => {
this.init()
this.$notify({
title: status + '成功',
type: 'success',
duration: 2500
})
}).catch(err => {
console.log(err.response.data.message)
})
},
subDelete(index, row) {
this.delLoading = true
del(row.id).then(res => {
this.delLoading = false
row.delPopover = false
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
row.delPopover = false
console.log(err.response.data.message)
})
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<el-button size="mini" type="text" @click="to">编辑</el-button>
<eForm ref="form" :sup_this="sup_this" :is-add="false"/>
</div>
</template>
<script>
import eForm from './form'
export default {
components: { eForm },
props: {
data: {
type: Object,
required: true
},
sup_this: {
type: Object,
required: true
}
},
methods: {
to() {
const _this = this.$refs.form
_this.form = { id: this.data.id, jobName: this.data.jobName, beanName: this.data.beanName, methodName: this.data.methodName, params: this.data.params, cronExpression: this.data.cronExpression, isPause: this.data.isPause.toString(), remark: this.data.remark }
_this.dialog = true
}
}
}
</script>
<style scoped>
div{
display: inline-block;
margin-right: 3px;
}
</style>
<template>
<el-dialog :append-to-body="true" :visible.sync="dialog" :title="isAdd ? '新增任务' : '编辑任务'" width="600px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
<el-form-item label="任务名称" prop="jobName">
<el-input v-model="form.jobName" style="width: 460px;"/>
</el-form-item>
<el-form-item label="Bean名称" prop="beanName">
<el-input v-model="form.beanName" style="width: 460px;"/>
</el-form-item>
<el-form-item label="执行方法" prop="methodName">
<el-input v-model="form.methodName" style="width: 460px;"/>
</el-form-item>
<el-form-item label="参数内容">
<el-input v-model="form.params" style="width: 460px;"/>
</el-form-item>
<el-form-item label="Cron表达式" prop="cronExpression">
<el-input v-model="form.cronExpression" style="width: 460px;"/>
</el-form-item>
<el-form-item label="任务状态">
<el-radio v-model="form.isPause" label="false">启用</el-radio>
<el-radio v-model="form.isPause" label="true" >暂停</el-radio>
</el-form-item>
<el-form-item label="任务描述">
<el-input v-model="form.remark" style="width: 460px;" rows="2" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/timing'
export default {
props: {
isAdd: {
type: Boolean,
required: true
},
sup_this: {
type: Object,
default: null
}
},
data() {
return {
loading: false, dialog: false,
form: { jobName: '', beanName: '', methodName: '', params: '', cronExpression: '', isPause: 'false', remark: '' }, permissionIds: [],
rules: {
jobName: [
{ required: true, message: '请输入任务名称', trigger: 'blur' }
],
beanName: [
{ required: true, message: '请输入Bean名称', trigger: 'blur' }
],
methodName: [
{ required: true, message: '请输入方法名称', trigger: 'blur' }
],
cronExpression: [
{ required: true, message: '请输入Cron表达式', trigger: 'blur' }
]
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
} else {
return false
}
})
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.sup_this.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = { jobName: '', beanName: '', methodName: '', params: '', cronExpression: '', isPause: 'false', remark: '' }
}
}
}
</script>
<style scoped>
</style>
<template>
<div class="head-container">
<!-- 搜索 -->
<el-input v-model="query.value" clearable placeholder="输入任务名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-if="checkPermission(['ADMIN','JOB_ALL','JOB_CREATE'])"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="$refs.form.dialog = true">新增</el-button>
<eForm ref="form" :is-add="true"/>
</div>
<!-- 任务日志 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
class="filter-item"
size="mini"
type="warning"
icon="el-icon-tickets"
@click="doLog">执行日志</el-button>
<Log ref="log"/>
</div>
</div>
</template>
<script>
import checkPermission from '@/utils/permission' // 权限判断函数
import eForm from './form'
import Log from './log'
// 查询条件
export default {
components: { eForm, Log },
props: {
query: {
type: Object,
required: true
}
},
data() {
return {
downloadLoading: false
}
},
methods: {
checkPermission,
toQuery() {
this.$parent.page = 0
this.$parent.init()
},
doLog() {
this.$refs.log.dialog = true
this.$refs.log.doInit()
}
}
}
</script>
<template>
<el-dialog :append-to-body="true" :visible.sync="dialog" style="margin-left: 50px;" title="执行日志" width="1040px">
<!-- 搜索 -->
<div class="head-container">
<el-input v-model="query.value" clearable placeholder="输入任务名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
<el-select v-model="query.isSuccess" placeholder="日志状态" clearable class="filter-item" style="width: 110px" @change="toQuery">
<el-option v-for="item in enabledTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-button class="filter-item" size="mini" type="primary" icon="el-icon-search" @click="toQuery">搜索</el-button>
</div>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" border style="width: 100%;margin-top: -10px;">
<el-table-column :show-overflow-tooltip="true" prop="jobName" width="90px" label="任务名称"/>
<el-table-column :show-overflow-tooltip="true" prop="beanName" width="90px" label="Bean名称"/>
<el-table-column :show-overflow-tooltip="true" prop="methodName" width="80px" label="执行方法"/>
<el-table-column :show-overflow-tooltip="true" prop="params" width="80px" label="参数"/>
<el-table-column :show-overflow-tooltip="true" prop="cronExpression" width="100px" label="cron表达式"/>
<el-table-column :show-overflow-tooltip="true" prop="exceptionDetail" width="90px" label="异常详情"/>
<el-table-column :show-overflow-tooltip="true" align="center" prop="time" width="100px" label="耗时(毫秒)"/>
<el-table-column align="center" prop="isSuccess" width="80px" label="状态">
<template slot-scope="scope">
<el-tag :type="scope.row.isSuccess ? 'success' : 'danger'">{{ scope.row.isSuccess ? '成功' : '失败' }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="remark" width="120px" label="描述"/>
<el-table-column :show-overflow-tooltip="true" prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
style="margin-top:8px;"
layout="total, prev, pager, next"
@size-change="sizeChange"
@current-change="pageChange"/>
</el-dialog>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '../../../../mixins/initData'
import { parseTime } from '@/utils/index'
export default {
mixins: [initData],
data() {
return {
dialog: false, delLoading: false, sup_this: this,
enabledTypeOptions: [
{ key: 'true', display_name: '成功' },
{ key: 'false', display_name: '失败' }
]
}
},
methods: {
parseTime,
checkPermission,
doInit() {
this.$nextTick(() => {
this.init()
})
},
toQuery() {
this.page = 0
this.doInit()
},
beforeInit() {
this.url = 'api/jobLogs'
const sort = 'id,desc'
const query = this.query
const value = query.value
const isSuccess = query.isSuccess
this.size = 6
this.params = { page: this.page, size: this.size, sort: sort }
if (value) { this.params['jobName'] = value }
if (isSuccess !== '' && isSuccess !== null) { this.params['isSuccess'] = isSuccess }
return true
}
}
}
</script>
......@@ -35,7 +35,6 @@
<ul>
<li>安全管理,密码重置与修改</li>
<li>账号使用,使用邮箱登录系统</li>
<li>站内通知,站内信接收</li>
</ul>
</el-card>
</div>
......
......@@ -17,7 +17,7 @@
</el-table-column>
<el-table-column prop="createTime" label="注册日期">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="150px" align="center">
......@@ -71,6 +71,7 @@ export default {
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/users'
......@@ -101,9 +102,6 @@ export default {
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
},
getRoles() {
getRoleTree().then(res => {
this.roles = res
......
......@@ -15,7 +15,7 @@
<el-table-column prop="width" label="宽度"/>
<el-table-column width="180px" prop="createTime" label="创建日期">
<template slot-scope="scope">
<span>{{ time(scope.row.createTime) }}</span>
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="100px" align="center">
......@@ -65,6 +65,7 @@ export default {
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/pictures'
......@@ -91,9 +92,6 @@ export default {
row.delPopover = false
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
}
}
}
......
......@@ -14,7 +14,7 @@
<el-table-column prop="type" label="空间类型"/>
<el-table-column width="180px" prop="updateTime" label="更新日期">
<template slot-scope="scope">
<span>{{ time(scope.row.updateTime) }}</span>
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="160px" align="center">
......@@ -82,6 +82,7 @@ export default {
})
},
methods: {
parseTime,
checkPermission,
beforeInit() {
this.url = 'api/qiNiuContent'
......@@ -120,9 +121,6 @@ export default {
this.downloadLoading = false
console.log(err.response.data.message)
})
},
time(time) {
return parseTime(time)
}
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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