Merge pull request '更新' (#2) from zwq into master

Reviewed-on: #2
This commit is contained in:
朱文强 2023-05-12 13:44:33 +08:00
commit acdeccdba9
21 changed files with 7993 additions and 7245 deletions

2
.gitignore vendored
View File

@ -19,3 +19,5 @@ yarn-error.log*
*.njsproj
*.sln
*.sw*
/public/index.html
/package-lock.json

14195
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
"axios": "^0.19.2",
"babel-eslint": "^8.0.1",
"babel-plugin-component": "^1.1.1",
"code-brick-zj": "0.0.4",
"code-brick-zj": "0.0.7",
"core-js": "^3.6.5",
"echarts": "^5.3.3",
"element-theme": "^2.0.1",

View File

@ -1,8 +1,8 @@
<!--
* @Author: zwq
* @Date: 2022-08-22 14:57:50
* @LastEditors: zhp
* @LastEditTime: 2023-01-31 09:41:18
* @LastEditors: zwq
* @LastEditTime: 2023-05-12 13:29:06
* @Description:
-->
<!DOCTYPE html>
@ -38,7 +38,7 @@
<!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV==='dev' ) { %>
<script>
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.23:8080';
window.SITE_CONFIG['apiURL'] = 'http://demo.open.renren.io/renren-security-server/';
</script>
<% } %>
<!-- 集成测试环境 -->

View File

@ -390,7 +390,7 @@ img {
}
.aui-navbar__icon-menu {
vertical-align: middle;
font-size: 16px;
font-size: 24px;
}
.el-dropdown {
color: $--color-text-secondary;

View File

@ -2,7 +2,7 @@
/*
* @Date: 2020-12-29 16:49:28
* @LastEditors: zwq
* @LastEditTime: 2023-01-05 15:49:17
* @LastEditTime: 2023-05-12 12:39:26
* @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description:
*/
@ -29,6 +29,10 @@ const table = {
'0': i18n.t('logLogin.status0'),
'1': i18n.t('logLogin.status1')
},
scheduleStatus: {
'0': i18n.t('schedule.status0'),
'1': i18n.t('schedule.status1')
},
}
export default function(dictTable) {

267
src/i18n/en.js Normal file
View File

@ -0,0 +1,267 @@
import module from './en'
const t = {}
t.module = module
t.loading = 'loading...'
t.brand = {}
t.brand.lg = 'SPC'
t.brand.mini = 'spc'
t.public = {}
t.public.operation = 'operation'
t.add = 'add'
t.delete = 'delete'
t.deleteBatch = 'deleteBatch'
t.update = 'update'
t.query = 'query'
t.export = 'export'
t.handle = 'handle'
t.confirm = 'confirm'
t.cancel = 'cancel'
t.clear = 'clear'
t.logout = 'logout'
t.manage = 'manage'
t.createDate = 'createDate'
t.keyword = 'keyword:'
t.choose = 'choose'
t.prompt = {}
t.prompt.title = 'Tips'
t.prompt.info = '确定进行[{handle}]操作?'
t.prompt.success = 'Operation succeeded'
t.prompt.failed = 'Operation failed'
t.prompt.deleteBatch = 'Please select delete item'
t.validate = {}
t.validate.required = 'required'
t.validate.format = '{attr}Format error'
t.upload = {}
t.upload.text = '将文件拖到此处,或<em>点击上传</em>'
t.upload.tip = '只支持{format}格式文件!'
t.upload.button = 'upload'
t.datePicker = {}
t.datePicker.range = 'range'
t.datePicker.start = 'start'
t.datePicker.end = 'end'
t.fullscreen = {}
t.fullscreen.prompt = 'Your browser does not support this operation'
t.updatePassword = {}
t.updatePassword.title = 'Change Password'
t.updatePassword.username = 'account number'
t.updatePassword.password = 'Original password'
t.updatePassword.newPassword = 'New password'
t.updatePassword.confirmPassword = 'Confirm Password'
t.updatePassword.validate = {}
t.updatePassword.validate.confirmPassword = 'The confirmed password is inconsistent with the new password'
t.contentTabs = {}
t.contentTabs.closeCurrent = 'close Current Page'
t.contentTabs.closeOther = 'close Other Page'
t.contentTabs.closeAll = 'close All'
/* 页面 */
t.notFound = {}
t.notFound.desc = '抱歉!您访问的页面<em>失联</em>啦...'
t.notFound.back = 'back'
t.notFound.home = 'home'
t.login = {}
t.login.title = 'login'
t.login.username = 'username'
t.login.password = 'password'
t.login.captcha = 'captcha'
t.login.demo = 'demo'
t.login.copyright = '中建材智能自动化研究院'
t.schedule = {}
t.schedule.beanName = 'bean名称'
t.schedule.beanNameTips = 'spring bean名称, 如: testTask'
t.schedule.pauseBatch = 'pause'
t.schedule.resumeBatch = 'resume'
t.schedule.runBatch = 'run'
t.schedule.log = 'log'
t.schedule.params = 'params'
t.schedule.cronExpression = 'cron表达式'
t.schedule.cronExpressionTips = '如: 0 0 12 * * ?'
t.schedule.remark = 'remark'
t.schedule.status = 'status'
t.schedule.status0 = 'pause'
t.schedule.status1 = 'normal'
t.schedule.statusLog0 = 'fail'
t.schedule.statusLog1 = 'success'
t.schedule.pause = 'pause'
t.schedule.resume = 'resume'
t.schedule.run = 'run'
t.schedule.jobId = '任务ID'
t.schedule.times = 'times(单位: 毫秒)'
t.schedule.createDate = 'create Date'
t.oss = {}
t.oss.config = 'Cloud storage configuration'
t.oss.upload = 'upload'
t.oss.url = 'URL'
t.oss.createDate = 'create Date'
t.oss.type = 'type'
t.oss.type1 = '七牛'
t.oss.type2 = '阿里云'
t.oss.type3 = '腾讯云'
t.oss.qiniuDomain = '域名'
t.oss.qiniuDomainTips = '七牛绑定的域名'
t.oss.qiniuPrefix = '路径前缀'
t.oss.qiniuPrefixTips = '不设置默认为空'
t.oss.qiniuAccessKey = 'AccessKey'
t.oss.qiniuAccessKeyTips = '七牛AccessKey'
t.oss.qiniuSecretKey = 'SecretKey'
t.oss.qiniuSecretKeyTips = '七牛SecretKey'
t.oss.qiniuBucketName = '空间名'
t.oss.qiniuBucketNameTips = '七牛存储空间名'
t.oss.aliyunDomain = '域名'
t.oss.aliyunDomainTips = '阿里云绑定的域名http://cdn.renren.io'
t.oss.aliyunPrefix = '路径前缀'
t.oss.aliyunPrefixTips = '不设置默认为空'
t.oss.aliyunEndPoint = 'EndPoint'
t.oss.aliyunEndPointTips = '阿里云EndPoint'
t.oss.aliyunAccessKeyId = 'AccessKeyId'
t.oss.aliyunAccessKeyIdTips = '阿里云AccessKeyId'
t.oss.aliyunAccessKeySecret = 'AccessKeySecret'
t.oss.aliyunAccessKeySecretTips = '阿里云AccessKeySecret'
t.oss.aliyunBucketName = 'BucketName'
t.oss.aliyunBucketNameTips = '阿里云BucketName'
t.oss.qcloudDomain = '域名'
t.oss.qcloudDomainTips = '腾讯云绑定的域名'
t.oss.qcloudPrefix = '路径前缀'
t.oss.qcloudPrefixTips = '不设置默认为空'
t.oss.qcloudAppId = 'AppId'
t.oss.qcloudAppIdTips = '腾讯云AppId'
t.oss.qcloudSecretId = 'SecretId'
t.oss.qcloudSecretIdTips = '腾讯云SecretId'
t.oss.qcloudSecretKey = 'SecretKey'
t.oss.qcloudSecretKeyTips = '腾讯云SecretKey'
t.oss.qcloudBucketName = 'BucketName'
t.oss.qcloudBucketNameTips = '腾讯云BucketName'
t.oss.qcloudRegion = '所属地区'
t.oss.qcloudRegionTips = '请选择'
t.oss.qcloudRegionBeijing1 = '北京一区(华北)'
t.oss.qcloudRegionBeijing = '北京'
t.oss.qcloudRegionShanghai = '上海(华东)'
t.oss.qcloudRegionGuangzhou = '广州(华南)'
t.oss.qcloudRegionChengdu = '成都(西南)'
t.oss.qcloudRegionChongqing = '重庆'
t.oss.qcloudRegionSingapore = '新加坡'
t.oss.qcloudRegionHongkong = '香港'
t.oss.qcloudRegionToronto = '多伦多'
t.oss.qcloudRegionFrankfurt = '法兰克福'
t.dept = {}
t.dept.name = 'name'
t.dept.parentName = 'Superior department'
t.dept.sort = 'sort'
t.dept.parentNameDefault = 'Primary department'
t.dept.chooseerror = 'Please select a department'
t.dept.title = 'Please select a department'
t.dict = {}
t.dict.dictName = 'dictName'
t.dict.dictType = 'dictType'
t.dict.dictLabel = 'dictLabel'
t.dict.dictValue = 'dictValue'
t.dict.sort = 'sort'
t.dict.remark = 'remark'
t.dict.createDate = 'create Date'
t.logError = {}
t.logError.requestUri = 'requestURI'
t.logError.requestMethod = 'requestMethod'
t.logError.requestParams = 'requestParams'
t.logError.ip = 'IP'
t.logError.userAgent = 'userAgent'
t.logError.createDate = 'createDate'
t.logError.errorInfo = 'errorInfo'
t.logLogin = {}
t.logLogin.creatorName = 'creatorName'
t.logLogin.status = 'status'
t.logLogin.status0 = 'fail'
t.logLogin.status1 = 'success'
t.logLogin.status2 = 'Account locked'
t.logLogin.operation = 'operation'
t.logLogin.operation0 = 'login'
t.logLogin.operation1 = 'loginOut'
t.logLogin.ip = 'IP'
t.logLogin.userAgent = 'User-Agent'
t.logLogin.createDate = 'createDate'
t.logOperation = {}
t.logOperation.status = 'status'
t.logOperation.status0 = 'fail'
t.logOperation.status1 = 'success'
t.logOperation.creatorName = 'creatorName'
t.logOperation.operation = 'operation'
t.logOperation.requestUri = 'requestURI'
t.logOperation.requestMethod = 'requestMethod'
t.logOperation.requestParams = 'requestParams'
t.logOperation.requestTime = 'requestTime'
t.logOperation.ip = 'IP'
t.logOperation.userAgent = 'User-Agent'
t.logOperation.createDate = 'createDate'
t.menu = {}
t.menu.name = 'name'
t.menu.icon = 'icon'
t.menu.type = 'type'
t.menu.type0 = 'menu'
t.menu.type1 = 'button'
t.menu.sort = 'sort'
t.menu.url = 'url'
t.menu.permissions = 'permissions'
t.menu.permissionsTips = '多个用逗号分隔sys:menu:save,sys:menu:update'
t.menu.parentName = 'parentName'
t.menu.parentNameDefault = 'parentNameDefault'
t.menu.resource = 'resource'
t.menu.resourceUrl = 'resourceUrl'
t.menu.resourceMethod = 'resourceMethod'
t.menu.resourceAddItem = 'resourceAddItem'
t.params = {}
t.params.paramCode = 'code'
t.params.paramValue = 'value'
t.params.remark = 'remark'
t.role = {}
t.role.name = 'name'
t.role.remark = 'remark'
t.role.createDate = 'createDate'
t.role.menuList = 'menuList'
t.role.deptList = 'deptList'
t.user = {}
t.user.username = 'username'
t.user.deptName = 'deptName'
t.user.email = 'email'
t.user.mobile = 'mobile'
t.user.status = 'status'
t.user.status0 = 'Deactivate'
t.user.status1 = 'Normal'
t.user.createDate = 'createDate'
t.user.password = 'password'
t.user.confirmPassword = 'confirmPassword'
t.user.realName = 'realName'
t.user.gender = 'gender'
t.user.gender0 = 'male'
t.user.gender1 = 'female'
t.user.gender2 = 'secrecy'
t.user.roleIdList = 'Role configuration'
t.user.validate = {}
t.user.validate.confirmPassword = 'The confirmation password is inconsistent with the password input'
t.user.select = 'Select user'
t.user.selecterror = 'Please select a record'
export default t

14
src/i18n/en/basicData.js Normal file
View File

@ -0,0 +1,14 @@
/*
* @Author: zwq
* @Date: 2023-02-28 14:21:52
* @LastEditors: zwq
* @LastEditTime: 2023-02-28 14:24:19
* @Description:
*/
export default {
name: 'name',
code: 'code',
status: 'status',
createTime: 'create time',
}

13
src/i18n/en/index.js Normal file
View File

@ -0,0 +1,13 @@
/*
* @Author: gtz
* @Date: 2021-03-04 16:12:46
* @LastEditors: gtz
* @LastEditTime: 2021-12-08 14:29:14
* @Description: file content
*/
import basicData from './basicData'
export default {
basicData,
}

View File

@ -1,8 +1,17 @@
/*
* @Author: zwq
* @Date: 2023-05-12 12:37:21
* @LastEditors: zwq
* @LastEditTime: 2023-05-12 12:40:16
* @Description:
*/
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import Cookies from 'js-cookie'
import zhCNLocale from 'element-ui/lib/locale/lang/zh-CN'
import zhCN from './zh-CN'
import EnLocale from 'element-ui/lib/locale/lang/en'
import en from './en'
Vue.use(VueI18n)
@ -10,8 +19,13 @@ export const messages = {
'zh-CN': {
'_lang': '简体中文',
...zhCN,
...zhCNLocale
}
...zhCNLocale,
},
'en': {
'_lang': 'English',
...en,
...EnLocale
},
}
export default new VueI18n({

View File

@ -1,11 +1,19 @@
import module from './zh'
const t = {}
t.module = module
t.loading = '加载中...'
t.brand = {}
t.brand.lg = 'QMS'
t.brand.mini = 'qms'
t.public = {}
t.public.operation = '操作'
t.add = '新增'
t.delete = '删除'
t.deleteBatch = '删除'

14
src/i18n/zh/basicData.js Normal file
View File

@ -0,0 +1,14 @@
/*
* @Author: zwq
* @Date: 2023-02-28 14:21:52
* @LastEditors: zwq
* @LastEditTime: 2023-02-28 14:24:19
* @Description:
*/
export default {
name: '名称',
code: '编码',
status: '状态',
createTime: '添加时间',
}

13
src/i18n/zh/index.js Normal file
View File

@ -0,0 +1,13 @@
/*
* @Author: gtz
* @Date: 2021-03-04 16:12:46
* @LastEditors: gtz
* @LastEditTime: 2021-12-08 14:29:14
* @Description: file content
*/
import basicData from './basicData'
export default {
basicData,
}

14
src/icons/svg/中英.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -1,8 +1,8 @@
/*
* @Author: zwq
* @Date: 2022-08-22 14:57:50
* @LastEditors: zhp
* @LastEditTime: 2023-04-03 14:37:45
* @LastEditors: zwq
* @LastEditTime: 2023-05-12 13:41:20
* @Description:
*/
import Vue from 'vue'

View File

@ -1,8 +1,8 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zhp
* @LastEditTime: 2023-04-18 14:28:38
* @LastEditors: zwq
* @LastEditTime: 2023-05-12 12:41:57
* @Description:
*/
export default {
@ -103,12 +103,16 @@ export default {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id,val.data.name)
this.deleteHandle(val.data.id, val.data.name,val.data._pageIndex)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, name) {
this.$confirm(`确定对[名称=${name}]进行删除操作?`, "提示", {
deleteHandle(id, name,index) {
this.$confirm(`确定对${name?'[名称='+name+']':'[序号='+index+']'}进行删除操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",

View File

@ -1,8 +1,8 @@
/*
* @Author: zhp
* @Date: 2023-01-06 10:13:07
* @LastEditTime: 2023-02-22 16:52:30
* @LastEditors: zhp
* @LastEditTime: 2023-05-12 12:42:15
* @LastEditors: zwq
* @Description:
*/
import axios from 'axios'
@ -23,7 +23,11 @@ const http = axios.create({
*/
http.interceptors.request.use(config => {
config.headers['Accept-Language'] = Cookies.get('language') || 'zh-CN'
if (config.url === "/login") {
config.headers['token'] = ''
} else {
config.headers['token'] = Cookies.get('token') || ''
}
// 默认参数
var defaults = {}
// 防止缓存GET请求默认带_t参数

View File

@ -2,47 +2,85 @@
* @Author: zwq
* @Date: 2022-08-22 14:57:51
* @LastEditors: zwq
* @LastEditTime: 2023-01-06 09:44:17
* @LastEditTime: 2023-05-12 12:46:50
* @Description:
-->
<template>
<nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
<div class="aui-navbar__header">
<h1 class="aui-navbar__brand" @click="$router.push({ name: 'home' })">
<a class="aui-navbar__brand-lg" href="javascript:;">{{ $t('brand.lg') }}</a>
<a class="aui-navbar__brand-mini" href="javascript:;">{{ $t('brand.mini') }}</a>
<a class="aui-navbar__brand-lg" href="javascript:;">{{ $t("brand.lg") }}</a>
<a class="aui-navbar__brand-mini" href="javascript:;">{{ $t("brand.mini") }}</a>
</h1>
</div>
<div class="aui-navbar__body">
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
<el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true"><use xlink:href="#icon-outdent"></use></svg>
<svg
class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch"
aria-hidden="true"
>
<use xlink:href="#icon-outdent"></use>
</svg>
</el-menu-item>
<el-menu-item index="2" @click="refresh()">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh" aria-hidden="true"><use xlink:href="#icon-sync"></use></svg>
<svg
class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh"
aria-hidden="true"
>
<use xlink:href="#icon-sync"></use>
</svg>
</el-menu-item>
</el-menu>
<el-menu class="aui-navbar__menu" mode="horizontal">
<el-menu-item index="6" @click="$router.push({ name: 'home' })">
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-home"></use></svg>
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-home"></use>
</svg>
</el-menu-item>
<el-menu-item index="7">
<el-dropdown trigger="click" class="international" @command="handleSetLanguage">
<div>
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
<use xlink:href="#中英"></use>
</svg>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :disabled="language === 'zh-CN'" command="zh-CN">
中文
</el-dropdown-item>
<el-dropdown-item :disabled="language === 'en'" command="en">
English
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
<el-menu-item index="4" @click="fullscreenHandle()">
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-fullscreen"></use></svg>
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true">
<use xlink:href="#icon-fullscreen"></use>
</svg>
</el-menu-item>
<el-menu-item index="5" class="aui-navbar__avatar">
<el-dropdown placement="bottom" :show-timeout="0">
<span class="el-dropdown-link">
<img src="~@/assets/img/avatar.png">
<img src="~@/assets/img/avatar.png" />
<span>{{ $store.state.user.name }}</span>
<i class="el-icon-arrow-down"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="updatePasswordHandle()">
<svg class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true"><use xlink:href="#修改密码"></use></svg>
{{ $t('updatePassword.title') }}</el-dropdown-item>
<svg class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true">
<use xlink:href="#修改密码"></use>
</svg>
{{ $t("updatePassword.title") }}</el-dropdown-item
>
<el-dropdown-item @click.native="logoutHandle()">
<svg class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true"><use xlink:href="#tuichu"></use></svg>
{{ $t('logout') }}</el-dropdown-item>
<svg class="icon-svg aui-content--tabs-icon-nav" aria-hidden="true">
<use xlink:href="#tuichu"></use>
</svg>
{{ $t("logout") }}</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</el-menu-item>
@ -53,55 +91,77 @@
</nav>
</template>
<script>
import screenfull from 'screenfull'
import UpdatePassword from './main-navbar-update-password'
import { clearLoginInfo } from '@/utils'
import screenfull from "screenfull";
import UpdatePassword from "./main-navbar-update-password";
import { clearLoginInfo } from "@/utils";
import { messages } from '@/i18n'
import Cookies from "js-cookie";
export default {
inject: ['refresh'],
inject: ["refresh"],
data() {
return {
updatePasswordVisible: false,
messageTip: false
}
messageTip: false,
};
},
components: {
UpdatePassword
UpdatePassword,
},
computed: {
language() {
return Cookies.get("language");
},
},
methods: {
handleSetLanguage(val) {
Cookies.set("language", val);
document.querySelector("html").setAttribute("lang", val);
document.title = messages[val].brand.lg;
window.location.reload();
},
//
fullscreenHandle() {
if (!screenfull.enabled) {
return this.$message({
message: this.$t('fullscreen.prompt'),
type: 'warning',
duration: 500
})
message: this.$t("fullscreen.prompt"),
type: "warning",
duration: 500,
});
}
screenfull.toggle()
screenfull.toggle();
},
//
updatePasswordHandle() {
this.updatePasswordVisible = true
this.updatePasswordVisible = true;
this.$nextTick(() => {
this.$refs.updatePassword.init()
})
this.$refs.updatePassword.init();
});
},
// 退
logoutHandle() {
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('logout') }), this.$t('prompt.title'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.post('/logout').then(({ data: res }) => {
this.$confirm(
this.$t("prompt.info", { handle: this.$t("logout") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
this.$http
.post("/logout")
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
clearLoginInfo()
this.$router.push({ name: 'login' })
}).catch(() => {})
}).catch(() => {})
}
}
return this.$message.error(res.msg);
}
clearLoginInfo();
this.$router.push({ name: "login" });
})
.catch(() => {});
})
.catch(() => {});
},
},
};
</script>

View File

@ -1,5 +1,4 @@
<template>
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
<el-form-item prop="beanName" :label="$t('schedule.beanName')">
<el-input v-model="dataForm.beanName" :placeholder="$t('schedule.beanNameTips')"></el-input>
@ -17,20 +16,21 @@
<el-input v-model="dataForm.remark" :placeholder="$t('schedule.remark')"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import basicAdd from '@/mixins/basic-add'
import debounce from 'lodash/debounce'
import { cron } from 'vue-cron'
export default {
mixins: [basicAdd],
data () {
return {
visible: false,
urlOptions: {
submitURL: '/sys/schedule/',
infoURL: '/sys/schedule'
},
dataForm: {
id: '',
beanName: '',
@ -58,7 +58,8 @@ export default {
}
},
methods: {
init () {
init (id) {
this.dataForm.id = id || "";
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
@ -95,7 +96,7 @@ export default {
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
this.$emit('successSubmit')
}
})
}).catch(() => {})

View File

@ -1,71 +1,39 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-job__schedule">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item>
<el-input v-model="dataForm.beanName" :placeholder="$t('schedule.beanName')" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:schedule:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:schedule:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:schedule:pause')" type="danger" @click="pauseHandle()">{{ $t('schedule.pauseBatch') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:schedule:resume')" type="danger" @click="resumeHandle()">{{ $t('schedule.resumeBatch') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:schedule:run')" type="danger" @click="runHandle()">{{ $t('schedule.runBatch') }}</el-button>
</el-form-item>
<el-form-item>
<el-button v-if="$hasPermission('sys:schedule:log')" type="success" @click="logHandle()">{{ $t('schedule.log') }}</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="dataListLoading"
:data="dataList"
border
@selection-change="dataListSelectionChangeHandle"
@sort-change="dataListSortChangeHandle"
style="width: 100%;">
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
<el-table-column prop="beanName" :label="$t('schedule.beanName')" header-align="center" align="center"></el-table-column>
<el-table-column prop="params" :label="$t('schedule.params')" header-align="center" align="center"></el-table-column>
<el-table-column prop="cronExpression" :label="$t('schedule.cronExpression')" header-align="center" align="center"></el-table-column>
<el-table-column prop="remark" :label="$t('schedule.remark')" header-align="center" align="center"></el-table-column>
<el-table-column prop="status" :label="$t('schedule.status')" sortable="custom" header-align="center" align="center">
<template slot-scope="scope">
<el-tag v-if="scope.row.status === 1" size="small">{{ $t('schedule.status1') }}</el-tag>
<el-tag v-else size="small" type="danger">{{ $t('schedule.status0') }}</el-tag>
</template>
</el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button v-if="$hasPermission('sys:schedule:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
<el-button v-if="$hasPermission('sys:schedule:pause')" type="text" size="small" @click="pauseHandle(scope.row.id)">{{ $t('schedule.pause') }}</el-button>
<el-button v-if="$hasPermission('sys:schedule:resume')" type="text" size="small" @click="resumeHandle(scope.row.id)">{{ $t('schedule.resume') }}</el-button>
<el-button v-if="$hasPermission('sys:schedule:run')" type="text" size="small" @click="runHandle(scope.row.id)">{{ $t('schedule.run') }}</el-button>
<el-button v-if="$hasPermission('sys:schedule:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table
:table-props="tableProps"
:page="listQuery.page"
:limit="listQuery.limit"
:table-data="tableData"
>
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="200"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick"
/>
</base-table>
<pagination
:limit.sync="listQuery.limit"
:page.sync="listQuery.page"
:total="listQuery.total"
@pagination="getDataList"
/>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
>
<add-or-update ref="addOrUpdate" @successSubmit="successSubmit"></add-or-update>
</base-dialog>
<!-- 弹窗, 日志列表 -->
<log v-if="logVisible" ref="log"></log>
</div>
@ -73,124 +41,255 @@
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './schedule-add-or-update'
import Log from './schedule-log'
import basicPage from "@/mixins/basic-page";
import AddOrUpdate from "./schedule-add-or-update";
import Log from "./schedule-log";
import i18n from "@/i18n";
import sysFilter from "@/filters/sys-filter";
const tableProps = [
{
prop: "beanName",
label: i18n.t("schedule.beanName"),
},
{
prop: "params",
label: i18n.t("schedule.params"),
},
{
prop: "cronExpression",
label: i18n.t("schedule.cronExpression"),
},
{
prop: "remark",
label: i18n.t("schedule.remark"),
},
{
prop: "status",
label: i18n.t("schedule.status"),
filter: sysFilter("scheduleStatus"),
},
];
const tableBtn = [
{
type: "edit",
btnName: "编辑",
},
{
type: "pause",
btnName: "暂停",
},
{
type: "restore",
btnName: "恢复",
},
{
type: "run",
btnName: "执行",
},
{
type: "delete",
btnName: "删除",
},
];
export default {
mixins: [mixinViewModule],
mixins: [basicPage],
data() {
return {
mixinViewModuleOptions: {
getDataListURL: '/sys/schedule/page',
getDataListIsPage: true,
deleteURL: '/sys/schedule',
deleteIsBatch: true
urlOptions: {
getDataListURL: "/sys/schedule/page",
deleteURL: "/sys/schedule",
},
dataForm: {
beanName: ''
beanName: "",
},
logVisible: false
}
tableProps,
tableBtn,
addDeleteURL: true,
logVisible: false,
formConfig: [
{
type: "input",
label: i18n.t("schedule.beanName"),
placeholder: i18n.t("schedule.beanName"),
param: "beanName",
},
{
type: "button",
btnName: "查询",
name: "search",
color: "primary",
},
{
type: "button",
btnName: "新增",
name: "add",
color: "primary",
plain: true,
},
{
type: "button",
btnName: "日志",
name: "log",
color: "success",
},
],
};
},
components: {
AddOrUpdate,
Log
Log,
},
methods: {
//search-bar
buttonClick(val) {
switch (val.btnName) {
case "search":
this.listQuery.beanName = val.beanName;
this.listQuery.page = 1;
this.getDataList();
break;
case "add":
this.addOrEditTitle = "新增";
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case "log":
this.logHandle();
break;
default:
console.log(val);
}
},
btnFun(val) {
if (val.type === "pause") {
this.pauseHandle(val.data.id);
} else if (val.type === "restore") {
this.resumeHandle(val.data.id);
} else {
this.runHandle(val.data.id);
}
},
//
pauseHandle(id) {
if (!id && this.dataListSelections.length <= 0) {
return this.$message({
message: this.$t('prompt.deleteBatch'),
type: 'warning',
duration: 500
})
message: this.$t("prompt.deleteBatch"),
type: "warning",
duration: 500,
});
}
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('schedule.pause') }), this.$t('prompt.title'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.put('/sys/schedule/pause', id ? [id] : this.dataListSelections.map(item => item.id)).then(({ data: res }) => {
this.$confirm(
this.$t("prompt.info", { handle: this.$t("schedule.pause") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
this.$http
.put("/sys/schedule/pause", id ? [id] : this.dataListSelections.map((item) => item.id))
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList()
}
this.getDataList();
},
});
})
}).catch(() => {})
}).catch(() => {})
.catch(() => {});
})
.catch(() => {});
},
//
resumeHandle(id) {
if (!id && this.dataListSelections.length <= 0) {
return this.$message({
message: this.$t('prompt.deleteBatch'),
type: 'warning',
duration: 500
})
message: this.$t("prompt.deleteBatch"),
type: "warning",
duration: 500,
});
}
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('schedule.resume') }), this.$t('prompt.title'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.put('/sys/schedule/resume', id ? [id] : this.dataListSelections.map(item => item.id)).then(({ data: res }) => {
this.$confirm(
this.$t("prompt.info", { handle: this.$t("schedule.resume") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
this.$http
.put("/sys/schedule/resume", id ? [id] : this.dataListSelections.map((item) => item.id))
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList()
}
this.getDataList();
},
});
})
}).catch(() => {})
}).catch(() => {})
.catch(() => {});
})
.catch(() => {});
},
//
runHandle(id) {
if (!id && this.dataListSelections.length <= 0) {
return this.$message({
message: this.$t('prompt.deleteBatch'),
type: 'warning',
duration: 500
})
message: this.$t("prompt.deleteBatch"),
type: "warning",
duration: 500,
});
}
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('schedule.run') }), this.$t('prompt.title'), {
confirmButtonText: this.$t('confirm'),
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.put('/sys/schedule/run', id ? [id] : this.dataListSelections.map(item => item.id)).then(({ data: res }) => {
this.$confirm(
this.$t("prompt.info", { handle: this.$t("schedule.run") }),
this.$t("prompt.title"),
{
confirmButtonText: this.$t("confirm"),
cancelButtonText: this.$t("cancel"),
type: "warning",
}
)
.then(() => {
this.$http
.put("/sys/schedule/run", id ? [id] : this.dataListSelections.map((item) => item.id))
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
return this.$message.error(res.msg);
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList()
}
this.getDataList();
},
});
})
}).catch(() => {})
}).catch(() => {})
.catch(() => {});
})
.catch(() => {});
},
//
logHandle() {
this.logVisible = true
this.logVisible = true;
this.$nextTick(() => {
this.$refs.log.init()
})
}
}
}
this.$refs.log.init();
});
},
},
};
</script>

View File

@ -117,7 +117,7 @@ export default {
}).catch(() => {})
},
//
dataFormSubmitHandle: debounce(function () {
dataFormSubmit: debounce(function () {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false