-
+
{{ item.dictLabel }}{{ item.label }}
- {{ item.dictLabel }}
+ {{ item.label }}
@@ -49,4 +49,4 @@ export default {
.el-tag + .el-tag {
margin-left: 10px;
}
-
+
\ No newline at end of file
diff --git a/ruoyi-ui/src/layout/components/Settings/index.vue b/ruoyi-ui/src/layout/components/Settings/index.vue
index 0a6becac..4dff1d0c 100644
--- a/ruoyi-ui/src/layout/components/Settings/index.vue
+++ b/ruoyi-ui/src/layout/components/Settings/index.vue
@@ -162,14 +162,8 @@ export default {
this.sideTheme = val;
},
saveSetting() {
- const loading = this.$loading({
- lock: true,
- fullscreen: false,
- text: "正在保存到本地,请稍后...",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- localStorage.setItem(
+ this.$modal.loading("正在保存到本地,请稍后...");
+ this.$cache.local.set(
"layout-setting",
`{
"topNav":${this.topNav},
@@ -181,17 +175,11 @@ export default {
"theme":"${this.theme}"
}`
);
- setTimeout(loading.close(), 1000)
+ setTimeout(this.$modal.closeLoading(), 1000)
},
resetSetting() {
- this.$loading({
- lock: true,
- fullscreen: false,
- text: "正在清除设置缓存并刷新,请稍后...",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)"
- });
- localStorage.removeItem("layout-setting")
+ this.$modal.loading("正在清除设置缓存并刷新,请稍后...");
+ this.$cache.local.remove("layout-setting")
setTimeout("window.location.reload()", 1000)
}
}
diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js
index eae4cdd6..83b07910 100644
--- a/ruoyi-ui/src/main.js
+++ b/ruoyi-ui/src/main.js
@@ -11,6 +11,7 @@ import App from './App'
import store from './store'
import router from './router'
import directive from './directive' //directive
+import plugins from './plugins' // plugins
import { download } from '@/utils/request'
import './assets/icons' // icon
@@ -18,6 +19,7 @@ import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
+// 分页组件
import Pagination from "@/components/Pagination";
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
@@ -31,6 +33,8 @@ import ImageUpload from "@/components/ImageUpload"
import DictTag from '@/components/DictTag'
// 头部标签组件
import VueMeta from 'vue-meta'
+// 字典数据组件
+import DictData from '@/components/DictData'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
@@ -43,18 +47,6 @@ Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
-Vue.prototype.msgSuccess = function (msg) {
- this.$message({ showClose: true, message: msg, type: "success" });
-}
-
-Vue.prototype.msgError = function (msg) {
- this.$message({ showClose: true, message: msg, type: "error" });
-}
-
-Vue.prototype.msgInfo = function (msg) {
- this.$message.info(msg);
-}
-
// 全局组件挂载
Vue.component('DictTag', DictTag)
Vue.component('Pagination', Pagination)
@@ -64,7 +56,9 @@ Vue.component('FileUpload', FileUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.use(directive)
+Vue.use(plugins)
Vue.use(VueMeta)
+DictData.install()
/**
* If you don't want to use mock-server
diff --git a/ruoyi-ui/src/plugins/cache.js b/ruoyi-ui/src/plugins/cache.js
new file mode 100644
index 00000000..6f71b8e5
--- /dev/null
+++ b/ruoyi-ui/src/plugins/cache.js
@@ -0,0 +1,77 @@
+const sessionCache = {
+ set (key, value) {
+ if (!sessionStorage) {
+ return
+ }
+ if (key != null && value != null) {
+ sessionStorage.setItem(key, value)
+ }
+ },
+ get (key) {
+ if (!sessionStorage) {
+ return null
+ }
+ if (key == null) {
+ return null
+ }
+ return sessionStorage.getItem(key)
+ },
+ setJSON (key, jsonValue) {
+ if (jsonValue != null) {
+ this.set(key, JSON.stringify(jsonValue))
+ }
+ },
+ getJSON (key) {
+ const value = this.get(key)
+ if (value != null) {
+ return JSON.parse(value)
+ }
+ },
+ remove (key) {
+ sessionStorage.removeItem(key);
+ }
+}
+const localCache = {
+ set (key, value) {
+ if (!localStorage) {
+ return
+ }
+ if (key != null && value != null) {
+ localStorage.setItem(key, value)
+ }
+ },
+ get (key) {
+ if (!localStorage) {
+ return null
+ }
+ if (key == null) {
+ return null
+ }
+ return localStorage.getItem(key)
+ },
+ setJSON (key, jsonValue) {
+ if (jsonValue != null) {
+ this.set(key, JSON.stringify(jsonValue))
+ }
+ },
+ getJSON (key) {
+ const value = this.get(key)
+ if (value != null) {
+ return JSON.parse(value)
+ }
+ },
+ remove (key) {
+ localStorage.removeItem(key);
+ }
+}
+
+export default {
+ /**
+ * 会话级缓存
+ */
+ session: sessionCache,
+ /**
+ * 本地缓存
+ */
+ local: localCache
+}
diff --git a/ruoyi-ui/src/plugins/download.js b/ruoyi-ui/src/plugins/download.js
new file mode 100644
index 00000000..bc838fd0
--- /dev/null
+++ b/ruoyi-ui/src/plugins/download.js
@@ -0,0 +1,24 @@
+import { saveAs } from 'file-saver'
+import axios from 'axios'
+import { getToken } from '@/utils/auth'
+
+const baseURL = process.env.VUE_APP_BASE_API
+
+export default {
+ zip(url, name) {
+ var url = baseURL + url
+ axios({
+ method: 'get',
+ url: url,
+ responseType: 'blob',
+ headers: { 'Authorization': 'Bearer ' + getToken() }
+ }).then(res => {
+ const blob = new Blob([res.data], { type: 'application/zip' })
+ this.saveAs(blob, name)
+ })
+ },
+ saveAs(text, name, opts) {
+ saveAs(text, name, opts);
+ }
+}
+
diff --git a/ruoyi-ui/src/plugins/index.js b/ruoyi-ui/src/plugins/index.js
new file mode 100644
index 00000000..a138e6d6
--- /dev/null
+++ b/ruoyi-ui/src/plugins/index.js
@@ -0,0 +1,14 @@
+import cache from './cache'
+import modal from './modal'
+import download from './download'
+
+export default {
+ install(Vue) {
+ // 缓存对象
+ Vue.prototype.$cache = cache
+ // 模态框对象
+ Vue.prototype.$modal = modal
+ // 下载文件
+ Vue.prototype.$download = download
+ }
+}
diff --git a/ruoyi-ui/src/plugins/modal.js b/ruoyi-ui/src/plugins/modal.js
new file mode 100644
index 00000000..7df61a89
--- /dev/null
+++ b/ruoyi-ui/src/plugins/modal.js
@@ -0,0 +1,75 @@
+import { Message, MessageBox, Notification, Loading } from 'element-ui'
+
+let loadingInstance;
+
+export default {
+ // 消息提示
+ msg(content) {
+ Message.info(content)
+ },
+ // 错误消息
+ msgError(content) {
+ Message.error(content)
+ },
+ // 成功消息
+ msgSuccess(content) {
+ Message.success(content)
+ },
+ // 警告消息
+ msgWarning(content) {
+ Message.warning(content)
+ },
+ // 弹出提示
+ alert(content) {
+ MessageBox.alert(content, "系统提示")
+ },
+ // 错误提示
+ alertError(content) {
+ MessageBox.alert(content, "系统提示", { type: 'error' })
+ },
+ // 成功提示
+ alertSuccess(content) {
+ MessageBox.alert(content, "系统提示", { type: 'success' })
+ },
+ // 警告提示
+ alertWarning(content) {
+ MessageBox.alert(content, "系统提示", { type: 'warning' })
+ },
+ // 通知提示
+ notify(content) {
+ Notification.info(content)
+ },
+ // 错误通知
+ notifyError(content) {
+ Notification.error(content);
+ },
+ // 成功通知
+ notifySuccess(content) {
+ Notification.success(content)
+ },
+ // 警告通知
+ notifyWarning(content) {
+ Notification.warning(content)
+ },
+ // 确认窗体
+ confirm(content) {
+ return MessageBox.confirm(content, "系统提示", {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: "warning",
+ })
+ },
+ // 打开遮罩层
+ loading(content) {
+ loadingInstance = Loading.service({
+ lock: true,
+ text: content,
+ spinner: "el-icon-loading",
+ background: "rgba(0, 0, 0, 0.7)",
+ })
+ },
+ // 关闭遮罩层
+ closeLoading() {
+ loadingInstance.close();
+ }
+}
diff --git a/ruoyi-ui/src/utils/dict/Dict.js b/ruoyi-ui/src/utils/dict/Dict.js
new file mode 100644
index 00000000..22db32fe
--- /dev/null
+++ b/ruoyi-ui/src/utils/dict/Dict.js
@@ -0,0 +1,82 @@
+import Vue from 'vue'
+import { mergeRecursive } from "@/utils/ruoyi";
+import DictMeta from './DictMeta'
+import DictData from './DictData'
+
+const DEFAULT_DICT_OPTIONS = {
+ types: [],
+}
+
+/**
+ * @classdesc 字典
+ * @property {Object} label 标签对象,内部属性名为字典类型名称
+ * @property {Object} dict 字段数组,内部属性名为字典类型名称
+ * @property {Array.} _dictMetas 字典元数据数组
+ */
+export default class Dict {
+ constructor() {
+ this.owner = null
+ this.label = {}
+ this.type = {}
+ }
+
+ init(options) {
+ if (options instanceof Array) {
+ options = { types: options }
+ }
+ const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options)
+ if (opts.types === undefined) {
+ throw new Error('need dict types')
+ }
+ const ps = []
+ this._dictMetas = opts.types.map(t => DictMeta.parse(t))
+ this._dictMetas.forEach(dictMeta => {
+ const type = dictMeta.type
+ Vue.set(this.label, type, {})
+ Vue.set(this.type, type, [])
+ if (dictMeta.lazy) {
+ return
+ }
+ ps.push(loadDict(this, dictMeta))
+ })
+ return Promise.all(ps)
+ }
+
+ /**
+ * 重新加载字典
+ * @param {String} type 字典类型
+ */
+ reloadDict(type) {
+ const dictMeta = this._dictMetas.find(e => e.type === type)
+ if (dictMeta === undefined) {
+ return Promise.reject(`the dict meta of ${type} was not found`)
+ }
+ return loadDict(this, dictMeta)
+ }
+}
+
+/**
+ * 加载字典
+ * @param {Dict} dict 字典
+ * @param {DictMeta} dictMeta 字典元数据
+ * @returns {Promise}
+ */
+function loadDict(dict, dictMeta) {
+ return dictMeta.request(dictMeta)
+ .then(response => {
+ const type = dictMeta.type
+ let dicts = dictMeta.responseConverter(response, dictMeta)
+ if (!(dicts instanceof Array)) {
+ console.error('the return of responseConverter must be Array.')
+ dicts = []
+ } else if (dicts.filter(d => d instanceof DictData).length !== dicts.length) {
+ console.error('the type of elements in dicts must be DictData')
+ dicts = []
+ }
+ dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts)
+ dicts.forEach(d => {
+ Vue.set(dict.label[type], d.value, d.label)
+ })
+ return dicts
+ })
+}
diff --git a/ruoyi-ui/src/utils/dict/DictConverter.js b/ruoyi-ui/src/utils/dict/DictConverter.js
new file mode 100644
index 00000000..576ff546
--- /dev/null
+++ b/ruoyi-ui/src/utils/dict/DictConverter.js
@@ -0,0 +1,17 @@
+import DictOptions from './DictOptions'
+import DictData from './DictData'
+
+export default function(dict, dictMeta) {
+ const label = determineDictField(dict, dictMeta.labelField, ...DictOptions.DEFAULT_LABEL_FIELDS)
+ const value = determineDictField(dict, dictMeta.valueField, ...DictOptions.DEFAULT_VALUE_FIELDS)
+ return new DictData(dict[label], dict[value], dict)
+}
+
+/**
+ * 确定字典字段
+ * @param {DictData} dict
+ * @param {...String} fields
+ */
+function determineDictField(dict, ...fields) {
+ return fields.find(f => Object.prototype.hasOwnProperty.call(dict, f))
+}
diff --git a/ruoyi-ui/src/utils/dict/DictData.js b/ruoyi-ui/src/utils/dict/DictData.js
new file mode 100644
index 00000000..37a60d5c
--- /dev/null
+++ b/ruoyi-ui/src/utils/dict/DictData.js
@@ -0,0 +1,13 @@
+/**
+ * @classdesc 字典数据
+ * @property {String} label 标签
+ * @property {*} value 标签
+ * @property {Object} raw 原始数据
+ */
+export default class DictData {
+ constructor(label, value, raw) {
+ this.label = label
+ this.value = value
+ this.raw = raw
+ }
+}
diff --git a/ruoyi-ui/src/utils/dict/DictMeta.js b/ruoyi-ui/src/utils/dict/DictMeta.js
new file mode 100644
index 00000000..8ae6133e
--- /dev/null
+++ b/ruoyi-ui/src/utils/dict/DictMeta.js
@@ -0,0 +1,38 @@
+import { mergeRecursive } from "@/utils/ruoyi";
+import DictOptions from './DictOptions'
+
+/**
+ * @classdesc 字典元数据
+ * @property {String} type 类型
+ * @property {Function} request 请求
+ * @property {String} label 标签字段
+ * @property {String} value 值字段
+ */
+export default class DictMeta {
+ constructor(options) {
+ this.type = options.type
+ this.request = options.request,
+ this.responseConverter = options.responseConverter
+ this.labelField = options.labelField
+ this.valueField = options.valueField
+ this.lazy = options.lazy === true
+ }
+}
+
+
+/**
+ * 解析字典元数据
+ * @param {Object} options
+ * @returns {DictMeta}
+ */
+DictMeta.parse= function(options) {
+ let opts = null
+ if (typeof options === 'string') {
+ opts = DictOptions.metas[options] || {}
+ opts.type = options
+ } else if (typeof options === 'object') {
+ opts = options
+ }
+ opts = mergeRecursive(DictOptions.metas['*'], opts)
+ return new DictMeta(opts)
+}
diff --git a/ruoyi-ui/src/utils/dict/DictOptions.js b/ruoyi-ui/src/utils/dict/DictOptions.js
new file mode 100644
index 00000000..5e1cc41f
--- /dev/null
+++ b/ruoyi-ui/src/utils/dict/DictOptions.js
@@ -0,0 +1,51 @@
+import { mergeRecursive } from "@/utils/ruoyi";
+import dictConverter from './DictConverter'
+
+export const options = {
+ metas: {
+ '*': {
+ /**
+ * 字典请求,方法签名为function(dictMeta: DictMeta): Promise
+ */
+ request: (dictMeta) => {
+ console.log(`load dict ${dictMeta.type}`)
+ return Promise.resolve([])
+ },
+ /**
+ * 字典响应数据转换器,方法签名为function(response: Object, dictMeta: DictMeta): DictData
+ */
+ responseConverter,
+ labelField: 'label',
+ valueField: 'value',
+ },
+ },
+ /**
+ * 默认标签字段
+ */
+ DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'],
+ /**
+ * 默认值字段
+ */
+ DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
+}
+
+/**
+ * 映射字典
+ * @param {Object} response 字典数据
+ * @param {DictMeta} dictMeta 字典元数据
+ * @returns {DictData}
+ */
+function responseConverter(response, dictMeta) {
+ const dicts = response.content instanceof Array ? response.content : response
+ if (dicts === undefined) {
+ console.warn(`no dict data of "${dictMeta.type}" found in the response`)
+ return []
+ }
+ return dicts.map(d => dictConverter(d, dictMeta))
+}
+
+export function mergeOptions(src) {
+ mergeRecursive(options, src)
+}
+
+export default options
diff --git a/ruoyi-ui/src/utils/dict/index.js b/ruoyi-ui/src/utils/dict/index.js
new file mode 100644
index 00000000..66ddfef9
--- /dev/null
+++ b/ruoyi-ui/src/utils/dict/index.js
@@ -0,0 +1,33 @@
+import Dict from './Dict'
+import { mergeOptions } from './DictOptions'
+
+export default function(Vue, options) {
+ mergeOptions(options)
+ Vue.mixin({
+ data() {
+ if (this.$options.dicts === undefined || this.$options.dicts === null) {
+ return {}
+ }
+ const dict = new Dict()
+ dict.owner = this
+ return {
+ dict
+ }
+ },
+ created() {
+ if (!(this.dict instanceof Dict)) {
+ return
+ }
+ options.onCreated && options.onCreated(this.dict)
+ this.dict.init(this.$options.dicts).then(() => {
+ options.onReady && options.onReady(this.dict)
+ this.$nextTick(() => {
+ this.$emit('dictReady', this.dict)
+ if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
+ this.$options.methods.onDictReady.call(this, this.dict)
+ }
+ })
+ })
+ },
+ })
+}
diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js
index 48b36e81..6db38ba1 100644
--- a/ruoyi-ui/src/utils/request.js
+++ b/ruoyi-ui/src/utils/request.js
@@ -1,11 +1,14 @@
import axios from 'axios'
-import { Notification, MessageBox, Message } from 'element-ui'
+import { Notification, MessageBox, Message, Loading } from 'element-ui'
import store from '@/store'
import { getToken } from '@/utils/auth'
import errorCode from '@/utils/errorCode'
import { tansParams } from "@/utils/ruoyi";
+import { saveAs } from 'file-saver'
-axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
+let downloadLoadingInstance;
+
+axios.defaults.headers['Conntent-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项,表示请求URL公共部分
@@ -90,31 +93,20 @@ service.interceptors.response.use(res => {
// 通用下载方法
export function download(url, params, filename) {
+ downloadLoadingInstance = Loading.service({ text: "正在下载数据,请稍后", spinner: "el-icon-loading", background: "rgba(0, 0, 0, 0.7)", })
return service.post(url, params, {
- transformRequest: [(params) => {
- return tansParams(params)
- }],
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- },
+ transformRequest: [(params) => { return tansParams(params) }],
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
responseType: 'blob'
}).then((data) => {
const content = data
const blob = new Blob([content])
- if ('download' in document.createElement('a')) {
- const elink = document.createElement('a')
- elink.download = filename
- elink.style.display = 'none'
- elink.href = URL.createObjectURL(blob)
- document.body.appendChild(elink)
- elink.click()
- URL.revokeObjectURL(elink.href)
- document.body.removeChild(elink)
- } else {
- navigator.msSaveBlob(blob, filename)
- }
+ saveAs(blob, filename)
+ downloadLoadingInstance.close();
}).catch((r) => {
console.error(r)
+ Message.error('下载文件出现错误,请联系管理员!')
+ downloadLoadingInstance.close();
})
}
diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js
index de41e5e9..1d867d40 100644
--- a/ruoyi-ui/src/utils/ruoyi.js
+++ b/ruoyi-ui/src/utils/ruoyi.js
@@ -72,8 +72,8 @@ export function addDateRange(params, dateRange, propName) {
export function selectDictLabel(datas, value) {
var actions = [];
Object.keys(datas).some((key) => {
- if (datas[key].dictValue == ('' + value)) {
- actions.push(datas[key].dictLabel);
+ if (datas[key].value == ('' + value)) {
+ actions.push(datas[key].label);
return true;
}
})
@@ -122,6 +122,22 @@ export function praseStrEmpty(str) {
return str;
}
+// 数据合并
+export function mergeRecursive(source, target) {
+ for (var p in target) {
+ try {
+ if (target[p].constructor == Object) {
+ source[p] = mergeRecursive(source[p], target[p]);
+ } else {
+ source[p] = target[p];
+ }
+ } catch(e) {
+ source[p] = target[p];
+ }
+ }
+ return source;
+};
+
/**
* 构造树型结构数据
* @param {*} data 数据源
diff --git a/ruoyi-ui/src/utils/zipdownload.js b/ruoyi-ui/src/utils/zipdownload.js
deleted file mode 100644
index 8a1b8198..00000000
--- a/ruoyi-ui/src/utils/zipdownload.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import axios from 'axios'
-import { getToken } from '@/utils/auth'
-
-const mimeMap = {
- xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- zip: 'application/zip'
-}
-
-const baseUrl = process.env.VUE_APP_BASE_API
-export function downLoadZip(str, filename) {
- var url = baseUrl + str
- axios({
- method: 'get',
- url: url,
- responseType: 'blob',
- headers: { 'Authorization': 'Bearer ' + getToken() }
- }).then(res => {
- resolveBlob(res, mimeMap.zip)
- })
-}
-/**
- * 解析blob响应内容并下载
- * @param {*} res blob响应内容
- * @param {String} mimeType MIME类型
- */
-export function resolveBlob(res, mimeType) {
- const aLink = document.createElement('a')
- var blob = new Blob([res.data], { type: mimeType })
- // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
- var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
- var contentDisposition = decodeURI(res.headers['content-disposition'])
- var result = patt.exec(contentDisposition)
- var fileName = result[1]
- fileName = fileName.replace(/\"/g, '')
- aLink.style.display = 'none'
- aLink.href = URL.createObjectURL(blob)
- aLink.setAttribute('download', fileName) // 设置下载文件名称
- document.body.appendChild(aLink)
- aLink.click()
- URL.revokeObjectURL(aLink.href);//清除引用
- document.body.removeChild(aLink);
-}
diff --git a/ruoyi-ui/src/views/monitor/job/index.vue b/ruoyi-ui/src/views/monitor/job/index.vue
index c3c394f9..0f632347 100644
--- a/ruoyi-ui/src/views/monitor/job/index.vue
+++ b/ruoyi-ui/src/views/monitor/job/index.vue
@@ -13,20 +13,20 @@
@@ -98,7 +98,7 @@
-
+
@@ -167,10 +167,10 @@
@@ -224,10 +224,10 @@
{{dict.dictLabel}}
+ v-for="dict in dict.type.sys_job_status"
+ :key="dict.value"
+ :label="dict.value"
+ >{{dict.label}}
@@ -239,7 +239,7 @@
-
+
@@ -300,6 +300,7 @@ import Crontab from '@/components/Crontab'
export default {
components: { Crontab },
name: "Job",
+ dicts: ['sys_job_group', 'sys_job_status'],
data() {
return {
// 遮罩层
@@ -326,10 +327,6 @@ export default {
openCron: false,
// 传入的表达式
expression: "",
- // 任务组名字典
- jobGroupOptions: [],
- // 状态字典
- statusOptions: [],
// 查询参数
queryParams: {
pageNum: 1,
@@ -356,12 +353,6 @@ export default {
},
created() {
this.getList();
- this.getDicts("sys_job_group").then(response => {
- this.jobGroupOptions = response.data;
- });
- this.getDicts("sys_job_status").then(response => {
- this.statusOptions = response.data;
- });
},
methods: {
/** 查询定时任务列表 */
@@ -375,7 +366,7 @@ export default {
},
// 任务组名字典翻译
jobGroupFormat(row, column) {
- return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
+ return this.selectDictLabel(this.dict.type.sys_job_group, row.jobGroup);
},
// 取消按钮
cancel() {
@@ -431,29 +422,21 @@ export default {
// 任务状态修改
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
- this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return changeJobStatus(row.jobId, row.status);
- }).then(() => {
- this.msgSuccess(text + "成功");
- }).catch(function() {
- row.status = row.status === "0" ? "1" : "0";
- });
+ this.$modal.confirm('确认要"' + text + '""' + row.jobName + '"任务吗?').then(function() {
+ return changeJobStatus(row.jobId, row.status);
+ }).then(() => {
+ this.$modal.msgSuccess(text + "成功");
+ }).catch(function() {
+ row.status = row.status === "0" ? "1" : "0";
+ });
},
/* 立即执行一次 */
handleRun(row) {
- this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return runJob(row.jobId, row.jobGroup);
- }).then(() => {
- this.msgSuccess("执行成功");
- }).catch(() => {});
+ this.$modal.confirm('确认要立即执行一次"' + row.jobName + '"任务吗?').then(function() {
+ return runJob(row.jobId, row.jobGroup);
+ }).then(() => {
+ this.$modal.msgSuccess("执行成功");
+ }).catch(() => {});
},
/** 任务详细信息 */
handleView(row) {
@@ -498,13 +481,13 @@ export default {
if (valid) {
if (this.form.jobId != undefined) {
updateJob(this.form).then(response => {
- this.msgSuccess("修改成功");
+ this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addJob(this.form).then(response => {
- this.msgSuccess("新增成功");
+ this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
@@ -515,16 +498,12 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const jobIds = row.jobId || this.ids;
- this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function() {
- return delJob(jobIds);
- }).then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- }).catch(() => {});
+ this.$modal.confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?').then(function() {
+ return delJob(jobIds);
+ }).then(() => {
+ this.getList();
+ this.$modal.msgSuccess("删除成功");
+ }).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
diff --git a/ruoyi-ui/src/views/monitor/job/log.vue b/ruoyi-ui/src/views/monitor/job/log.vue
index e45e4feb..f2754d70 100644
--- a/ruoyi-ui/src/views/monitor/job/log.vue
+++ b/ruoyi-ui/src/views/monitor/job/log.vue
@@ -20,10 +20,10 @@
style="width: 240px"
>