请上传
大小不超过 {{ fileSize }}MB
格式为 {{ fileType.join("/") }}
@@ -27,12 +14,12 @@
-
+
{{ getFileName(file.name) }}
- 删除
+ 删除
@@ -40,27 +27,27 @@
diff --git a/src/components/IconSelect/requireIcons.js b/src/components/IconSelect/requireIcons.js
index 99e5c54..7630b0f 100644
--- a/src/components/IconSelect/requireIcons.js
+++ b/src/components/IconSelect/requireIcons.js
@@ -1,11 +1,10 @@
+const req = require.context('../../assets/icons/svg', false, /\.svg$/);
+const requireAll = (requireContext) => requireContext.keys();
-const req = require.context('../../assets/icons/svg', false, /\.svg$/)
-const requireAll = requireContext => requireContext.keys()
+const re = /\.\/(.*)\.svg/;
-const re = /\.\/(.*)\.svg/
+const icons = requireAll(req).map((i) => {
+ return i.match(re)[1];
+});
-const icons = requireAll(req).map(i => {
- return i.match(re)[1]
-})
-
-export default icons
+export default icons;
diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue
index 3c770c7..2efce46 100644
--- a/src/components/ImagePreview/index.vue
+++ b/src/components/ImagePreview/index.vue
@@ -1,33 +1,28 @@
-
+
-
+
diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue
index b57a15e..198f3b5 100644
--- a/src/components/ImageUpload/index.vue
+++ b/src/components/ImageUpload/index.vue
@@ -1,49 +1,25 @@
-
-
+
+
-
+
-
+
请上传
大小不超过 {{ fileSize }}MB
格式为 {{ fileType.join("/") }}
的文件
-
-
+
+
diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue
index 1714e1f..f91428e 100644
--- a/src/components/ThemePicker/index.vue
+++ b/src/components/ThemePicker/index.vue
@@ -1,158 +1,153 @@
-
+
diff --git a/src/layout/components/Sidebar/FixiOSBug.js b/src/layout/components/Sidebar/FixiOSBug.js
index 6823726..2554996 100644
--- a/src/layout/components/Sidebar/FixiOSBug.js
+++ b/src/layout/components/Sidebar/FixiOSBug.js
@@ -1,25 +1,25 @@
export default {
computed: {
device() {
- return this.$store.state.app.device
+ return this.$store.state.app.device;
}
},
mounted() {
// In order to fix the click on menu on the ios device will trigger the mouseleave bug
- this.fixBugIniOS()
+ this.fixBugIniOS();
},
methods: {
fixBugIniOS() {
- const $subMenu = this.$refs.subMenu
+ const $subMenu = this.$refs.subMenu;
if ($subMenu) {
- const handleMouseleave = $subMenu.handleMouseleave
+ const handleMouseleave = $subMenu.handleMouseleave;
$subMenu.handleMouseleave = (e) => {
if (this.device === 'mobile') {
- return
+ return;
}
- handleMouseleave(e)
- }
+ handleMouseleave(e);
+ };
}
}
}
-}
+};
diff --git a/src/layout/components/Sidebar/Item.vue b/src/layout/components/Sidebar/Item.vue
index be3285d..8d1e9e7 100644
--- a/src/layout/components/Sidebar/Item.vue
+++ b/src/layout/components/Sidebar/Item.vue
@@ -1,3 +1,4 @@
+
diff --git a/src/layout/components/Sidebar/Link.vue b/src/layout/components/Sidebar/Link.vue
index 8b0bc93..604b63a 100644
--- a/src/layout/components/Sidebar/Link.vue
+++ b/src/layout/components/Sidebar/Link.vue
@@ -5,7 +5,7 @@
diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue
index 4853fbb..0102d7f 100644
--- a/src/layout/components/Sidebar/SidebarItem.vue
+++ b/src/layout/components/Sidebar/SidebarItem.vue
@@ -12,24 +12,17 @@
-
+
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index 51d0839..861ff6f 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -1,57 +1,43 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/layout/components/TagsView/ScrollPane.vue b/src/layout/components/TagsView/ScrollPane.vue
index bb753a1..cdd7a8f 100644
--- a/src/layout/components/TagsView/ScrollPane.vue
+++ b/src/layout/components/TagsView/ScrollPane.vue
@@ -5,75 +5,75 @@
diff --git a/src/layout/mixin/ResizeHandler.js b/src/layout/mixin/ResizeHandler.js
index e8d0df8..653234f 100644
--- a/src/layout/mixin/ResizeHandler.js
+++ b/src/layout/mixin/ResizeHandler.js
@@ -1,45 +1,45 @@
-import store from '@/store'
+import store from '@/store';
-const { body } = document
-const WIDTH = 992 // refer to Bootstrap's responsive design
+const { body } = document;
+const WIDTH = 992; // refer to Bootstrap's responsive design
export default {
watch: {
$route(route) {
if (this.device === 'mobile' && this.sidebar.opened) {
- store.dispatch('app/closeSideBar', { withoutAnimation: false })
+ store.dispatch('app/closeSideBar', { withoutAnimation: false });
}
}
},
beforeMount() {
- window.addEventListener('resize', this.$_resizeHandler)
+ window.addEventListener('resize', this.$_resizeHandler);
},
beforeDestroy() {
- window.removeEventListener('resize', this.$_resizeHandler)
+ window.removeEventListener('resize', this.$_resizeHandler);
},
mounted() {
- const isMobile = this.$_isMobile()
+ const isMobile = this.$_isMobile();
if (isMobile) {
- store.dispatch('app/toggleDevice', 'mobile')
- store.dispatch('app/closeSideBar', { withoutAnimation: true })
+ store.dispatch('app/toggleDevice', 'mobile');
+ store.dispatch('app/closeSideBar', { withoutAnimation: true });
}
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_isMobile() {
- const rect = body.getBoundingClientRect()
- return rect.width - 1 < WIDTH
+ const rect = body.getBoundingClientRect();
+ return rect.width - 1 < WIDTH;
},
$_resizeHandler() {
if (!document.hidden) {
- const isMobile = this.$_isMobile()
- store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')
+ const isMobile = this.$_isMobile();
+ store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop');
if (isMobile) {
- store.dispatch('app/closeSideBar', { withoutAnimation: true })
+ store.dispatch('app/closeSideBar', { withoutAnimation: true });
}
}
}
}
-}
+};
diff --git a/src/main.js b/src/main.js
index ca0b1b1..ad6da66 100644
--- a/src/main.js
+++ b/src/main.js
@@ -19,38 +19,9 @@ import './global';
import './assets/icons'; // icon
import './permission'; // permission control
-import {
- download
-} from '@/utils/request'
-import {
- getDicts
-} from "@/api/system/dict/data";
-import {
- getConfigKey
-} from "@/api/system/config";
-import {
- parseTime,
- resetForm,
- addDateRange,
- selectDictLabel,
- selectDictLabels,
- handleTree
-} from "@/utils/ruoyi";
-
// 头部标签组件
import VueMeta from 'vue-meta';
-// 全局方法挂载
-Vue.prototype.getDicts = getDicts
-Vue.prototype.getConfigKey = getConfigKey
-Vue.prototype.parseTime = parseTime
-Vue.prototype.resetForm = resetForm
-Vue.prototype.addDateRange = addDateRange
-Vue.prototype.selectDictLabel = selectDictLabel
-Vue.prototype.selectDictLabels = selectDictLabels
-Vue.prototype.download = download
-Vue.prototype.handleTree = handleTree
-
import Mixin from './mixins/Mixin';
Vue.mixin(Mixin);
diff --git a/src/plugins/cache.js b/src/plugins/cache.js
index 6b5c00b..719dbb1 100644
--- a/src/plugins/cache.js
+++ b/src/plugins/cache.js
@@ -1,69 +1,69 @@
const sessionCache = {
- set (key, value) {
+ set(key, value) {
if (!sessionStorage) {
- return
+ return;
}
if (key != null && value != null) {
- sessionStorage.setItem(key, value)
+ sessionStorage.setItem(key, value);
}
},
- get (key) {
+ get(key) {
if (!sessionStorage) {
- return null
+ return null;
}
if (key == null) {
- return null
+ return null;
}
- return sessionStorage.getItem(key)
+ return sessionStorage.getItem(key);
},
- setJSON (key, jsonValue) {
+ setJSON(key, jsonValue) {
if (jsonValue != null) {
- this.set(key, JSON.stringify(jsonValue))
+ this.set(key, JSON.stringify(jsonValue));
}
},
- getJSON (key) {
- const value = this.get(key)
+ getJSON(key) {
+ const value = this.get(key);
if (value != null) {
- return JSON.parse(value)
+ return JSON.parse(value);
}
},
- remove (key) {
+ remove(key) {
sessionStorage.removeItem(key);
}
-}
+};
const localCache = {
- set (key, value) {
+ set(key, value) {
if (!localStorage) {
- return
+ return;
}
if (key != null && value != null) {
- localStorage.setItem(key, value)
+ localStorage.setItem(key, value);
}
},
- get (key) {
+ get(key) {
if (!localStorage) {
- return null
+ return null;
}
if (key == null) {
- return null
+ return null;
}
- return localStorage.getItem(key)
+ return localStorage.getItem(key);
},
- setJSON (key, jsonValue) {
+ setJSON(key, jsonValue) {
if (jsonValue != null) {
- this.set(key, JSON.stringify(jsonValue))
+ this.set(key, JSON.stringify(jsonValue));
}
},
- getJSON (key) {
- const value = this.get(key)
+ getJSON(key) {
+ const value = this.get(key);
if (value != null) {
- return JSON.parse(value)
+ return JSON.parse(value);
}
},
- remove (key) {
+ remove(key) {
localStorage.removeItem(key);
}
-}
+};
export default {
/**
@@ -74,4 +74,4 @@ export default {
* 本地缓存
*/
local: localCache
-}
+};
diff --git a/src/plugins/modal.js b/src/plugins/modal.js
index b37ca14..a3a1663 100644
--- a/src/plugins/modal.js
+++ b/src/plugins/modal.js
@@ -1,43 +1,43 @@
-import { Message, MessageBox, Notification, Loading } from 'element-ui'
+import { Message, MessageBox, Notification, Loading } from 'element-ui';
let loadingInstance;
export default {
// 消息提示
msg(content) {
- Message.info(content)
+ Message.info(content);
},
// 错误消息
msgError(content) {
- Message.error(content)
+ Message.error(content);
},
// 成功消息
msgSuccess(content) {
- Message.success(content)
+ Message.success(content);
},
// 警告消息
msgWarning(content) {
- Message.warning(content)
+ Message.warning(content);
},
// 弹出提示
alert(content) {
- MessageBox.alert(content, "系统提示")
+ MessageBox.alert(content, '系统提示');
},
// 错误提示
alertError(content) {
- MessageBox.alert(content, "系统提示", { type: 'error' })
+ MessageBox.alert(content, '系统提示', { type: 'error' });
},
// 成功提示
alertSuccess(content) {
- MessageBox.alert(content, "系统提示", { type: 'success' })
+ MessageBox.alert(content, '系统提示', { type: 'success' });
},
// 警告提示
alertWarning(content) {
- MessageBox.alert(content, "系统提示", { type: 'warning' })
+ MessageBox.alert(content, '系统提示', { type: 'warning' });
},
// 通知提示
notify(content) {
- Notification.info(content)
+ Notification.info(content);
},
// 错误通知
notifyError(content) {
@@ -45,39 +45,39 @@ export default {
},
// 成功通知
notifySuccess(content) {
- Notification.success(content)
+ Notification.success(content);
},
// 警告通知
notifyWarning(content) {
- Notification.warning(content)
+ Notification.warning(content);
},
// 确认窗体
confirm(content) {
- return MessageBox.confirm(content, "系统提示", {
+ return MessageBox.confirm(content, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
- type: "warning",
- })
+ type: 'warning'
+ });
},
// 提交内容
prompt(content) {
- return MessageBox.prompt(content, "系统提示", {
+ return MessageBox.prompt(content, '系统提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
- type: "warning",
- })
+ type: 'warning'
+ });
},
// 打开遮罩层
loading(content) {
loadingInstance = Loading.service({
lock: true,
text: content,
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- })
+ spinner: 'el-icon-loading',
+ background: 'rgba(0, 0, 0, 0.7)'
+ });
},
// 关闭遮罩层
closeLoading() {
loadingInstance.close();
}
-}
+};
diff --git a/src/plugins/tab.js b/src/plugins/tab.js
index cade9f7..728a8b1 100644
--- a/src/plugins/tab.js
+++ b/src/plugins/tab.js
@@ -1,4 +1,4 @@
-import store from '@/store'
+import store from '@/store';
import router from '@/router';
export default {
@@ -15,16 +15,16 @@ export default {
});
}
return store.dispatch('tagsView/delCachedView', obj).then(() => {
- const { path, query } = obj
+ const { path, query } = obj;
router.replace({
path: '/redirect' + path,
query: query
- })
- })
+ });
+ });
},
// 关闭当前tab页签,打开新页签
closeOpenPage(obj) {
- store.dispatch("tagsView/delView", router.currentRoute);
+ store.dispatch('tagsView/delView', router.currentRoute);
if (obj !== undefined) {
return router.push(obj);
}
@@ -56,7 +56,12 @@ export default {
},
// 添加tab页签
openPage(title, url, params) {
- var obj = { path: url, meta: { title: title } }
+ var obj = {
+ path: url,
+ meta: {
+ title: title
+ }
+ };
store.dispatch('tagsView/addView', obj);
return router.push({ path: url, query: params });
},
@@ -64,4 +69,4 @@ export default {
updatePage(obj) {
return store.dispatch('tagsView/updateVisitedView', obj);
}
-}
+};
diff --git a/src/router/index.js b/src/router/index.js
index e3d15f0..4a90961 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -29,14 +29,17 @@ import Layout from '@/layout';
*/
// 公共路由
-export const constantRoutes = [{
+export const constantRoutes = [
+ {
path: '/redirect',
component: Layout,
hidden: true,
- children: [{
- path: '/redirect/:path(.*)',
- component: () => import('@/views/redirect')
- }]
+ children: [
+ {
+ path: '/redirect/:path(.*)',
+ component: () => import('@/views/redirect')
+ }
+ ]
},
{
path: '/login',
@@ -62,16 +65,18 @@ export const constantRoutes = [{
path: '',
component: Layout,
redirect: 'index',
- children: [{
- path: 'index',
- component: () => import('@/views/index'),
- name: 'Index',
- meta: {
- title: '首页',
- icon: 'dashboard',
- affix: true
+ children: [
+ {
+ path: 'index',
+ component: () => import('@/views/index'),
+ name: 'Index',
+ meta: {
+ title: '首页',
+ icon: 'dashboard',
+ affix: true
+ }
}
- }]
+ ]
},
// {
// path: '/demo',
@@ -106,78 +111,89 @@ export const constantRoutes = [{
component: Layout,
hidden: true,
redirect: 'noredirect',
- children: [{
- path: 'profile',
- component: () => import('@/views/system/user/profile/index'),
- name: 'Profile',
- meta: {
- title: '个人中心',
- icon: 'user'
+ children: [
+ {
+ path: 'profile',
+ component: () => import('@/views/system/user/profile/index'),
+ name: 'Profile',
+ meta: {
+ title: '个人中心',
+ icon: 'user'
+ }
}
- }]
+ ]
}
];
// 动态路由,基于用户权限动态去加载
-export const dynamicRoutes = [{
+export const dynamicRoutes = [
+ {
path: '/system/user-auth',
component: Layout,
hidden: true,
permissions: ['system:user:edit'],
- children: [{
- path: 'role/:userId(\\d+)',
- component: () => import('@/views/system/user/authRole'),
- name: 'AuthRole',
- meta: {
- title: '分配角色',
- activeMenu: '/system/user'
+ children: [
+ {
+ path: 'role/:userId(\\d+)',
+ component: () => import('@/views/system/user/authRole'),
+ name: 'AuthRole',
+ meta: {
+ title: '分配角色',
+ activeMenu: '/system/user'
+ }
}
- }]
+ ]
},
{
path: '/system/role-auth',
component: Layout,
hidden: true,
permissions: ['system:role:edit'],
- children: [{
- path: 'user/:roleId(\\d+)',
- component: () => import('@/views/system/role/authUser'),
- name: 'AuthUser',
- meta: {
- title: '分配用户',
- activeMenu: '/system/role'
+ children: [
+ {
+ path: 'user/:roleId(\\d+)',
+ component: () => import('@/views/system/role/authUser'),
+ name: 'AuthUser',
+ meta: {
+ title: '分配用户',
+ activeMenu: '/system/role'
+ }
}
- }]
+ ]
},
{
path: '/system/dict-data',
component: Layout,
hidden: true,
permissions: ['system:dict:list'],
- children: [{
- path: 'index/:dictId(\\d+)',
- component: () => import('@/views/system/dict/data'),
- name: 'Data',
- meta: {
- title: '字典数据',
- activeMenu: '/system/dict'
+ children: [
+ {
+ path: 'index/:dictId(\\d+)',
+ component: () => import('@/views/system/dict/data'),
+ name: 'Data',
+ meta: {
+ title: '字典数据',
+ activeMenu: '/system/dict'
+ }
}
- }]
+ ]
},
{
path: '/monitor/job-log',
component: Layout,
hidden: true,
permissions: ['monitor:job:list'],
- children: [{
- path: 'index',
- component: () => import('@/views/monitor/job/log'),
- name: 'JobLog',
- meta: {
- title: '调度日志',
- activeMenu: '/monitor/job'
+ children: [
+ {
+ path: 'index',
+ component: () => import('@/views/monitor/job/log'),
+ name: 'JobLog',
+ meta: {
+ title: '调度日志',
+ activeMenu: '/monitor/job'
+ }
}
- }]
+ ]
}
];
diff --git a/src/settings.js b/src/settings.js
index 6a0b09f..d5cd23e 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -41,4 +41,4 @@ module.exports = {
* If you want to also use it in dev, you can pass ['production', 'development']
*/
errorLog: 'production'
-}
+};
diff --git a/src/store/modules/app.js b/src/store/modules/app.js
index 3e22d1c..6bd7bb3 100644
--- a/src/store/modules/app.js
+++ b/src/store/modules/app.js
@@ -1,4 +1,4 @@
-import Cookies from 'js-cookie'
+import Cookies from 'js-cookie';
const state = {
sidebar: {
@@ -8,59 +8,59 @@ const state = {
},
device: 'desktop',
size: Cookies.get('size') || 'medium'
-}
+};
const mutations = {
- TOGGLE_SIDEBAR: state => {
+ TOGGLE_SIDEBAR: (state) => {
if (state.sidebar.hide) {
return false;
}
- state.sidebar.opened = !state.sidebar.opened
- state.sidebar.withoutAnimation = false
+ state.sidebar.opened = !state.sidebar.opened;
+ state.sidebar.withoutAnimation = false;
if (state.sidebar.opened) {
- Cookies.set('sidebarStatus', 1)
+ Cookies.set('sidebarStatus', 1);
} else {
- Cookies.set('sidebarStatus', 0)
+ Cookies.set('sidebarStatus', 0);
}
},
CLOSE_SIDEBAR: (state, withoutAnimation) => {
- Cookies.set('sidebarStatus', 0)
- state.sidebar.opened = false
- state.sidebar.withoutAnimation = withoutAnimation
+ Cookies.set('sidebarStatus', 0);
+ state.sidebar.opened = false;
+ state.sidebar.withoutAnimation = withoutAnimation;
},
TOGGLE_DEVICE: (state, device) => {
- state.device = device
+ state.device = device;
},
SET_SIZE: (state, size) => {
- state.size = size
- Cookies.set('size', size)
+ state.size = size;
+ Cookies.set('size', size);
},
SET_SIDEBAR_HIDE: (state, status) => {
- state.sidebar.hide = status
+ state.sidebar.hide = status;
}
-}
+};
const actions = {
toggleSideBar({ commit }) {
- commit('TOGGLE_SIDEBAR')
+ commit('TOGGLE_SIDEBAR');
},
closeSideBar({ commit }, { withoutAnimation }) {
- commit('CLOSE_SIDEBAR', withoutAnimation)
+ commit('CLOSE_SIDEBAR', withoutAnimation);
},
toggleDevice({ commit }, device) {
- commit('TOGGLE_DEVICE', device)
+ commit('TOGGLE_DEVICE', device);
},
setSize({ commit }, size) {
- commit('SET_SIZE', size)
+ commit('SET_SIZE', size);
},
toggleSideBarHide({ commit }, status) {
- commit('SET_SIDEBAR_HIDE', status)
+ commit('SET_SIDEBAR_HIDE', status);
}
-}
+};
export default {
namespaced: true,
state,
mutations,
actions
-}
+};
diff --git a/src/store/modules/dict.js b/src/store/modules/dict.js
index f95bead..5ce76c1 100644
--- a/src/store/modules/dict.js
+++ b/src/store/modules/dict.js
@@ -1,50 +1,50 @@
const state = {
- dict: new Array()
-}
+ dict: []
+};
const mutations = {
SET_DICT: (state, { key, value }) => {
- if (key !== null && key !== "") {
+ if (key !== null && key !== '') {
state.dict.push({
key: key,
value: value
- })
+ });
}
},
REMOVE_DICT: (state, key) => {
try {
for (let i = 0; i < state.dict.length; i++) {
- if (state.dict[i].key == key) {
- state.dict.splice(i, i)
- return true
+ if (state.dict[i].key === key) {
+ state.dict.splice(i, i);
+ return true;
}
}
} catch (e) {
+ console.log(e);
}
},
CLEAN_DICT: (state) => {
- state.dict = new Array()
+ state.dict = [];
}
-}
+};
const actions = {
// 设置字典
setDict({ commit }, data) {
- commit('SET_DICT', data)
+ commit('SET_DICT', data);
},
// 删除字典
removeDict({ commit }, key) {
- commit('REMOVE_DICT', key)
+ commit('REMOVE_DICT', key);
},
// 清空字典
cleanDict({ commit }) {
- commit('CLEAN_DICT')
+ commit('CLEAN_DICT');
}
-}
+};
export default {
namespaced: true,
state,
mutations,
actions
-}
-
+};
diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js
index 2455a1e..9b5b25c 100644
--- a/src/store/modules/settings.js
+++ b/src/store/modules/settings.js
@@ -1,8 +1,8 @@
-import defaultSettings from '@/settings'
+import defaultSettings from '@/settings';
-const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
+const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings;
-const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
+const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || '';
const state = {
title: '',
theme: storageSetting.theme || '#409EFF',
@@ -13,30 +13,30 @@ const state = {
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle
-}
+};
const mutations = {
CHANGE_SETTING: (state, { key, value }) => {
+ // eslint-disable-next-line no-prototype-builtins
if (state.hasOwnProperty(key)) {
- state[key] = value
+ state[key] = value;
}
}
-}
+};
const actions = {
// 修改布局设置
changeSetting({ commit }, data) {
- commit('CHANGE_SETTING', data)
+ commit('CHANGE_SETTING', data);
},
// 设置网页标题
setTitle({ commit }, title) {
- state.title = title
+ state.title = title;
}
-}
+};
export default {
namespaced: true,
state,
mutations,
actions
-}
-
+};
diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js
index 5fc011c..23b6497 100644
--- a/src/store/modules/tagsView.js
+++ b/src/store/modules/tagsView.js
@@ -2,227 +2,227 @@ const state = {
visitedViews: [],
cachedViews: [],
iframeViews: []
-}
+};
const mutations = {
ADD_IFRAME_VIEW: (state, view) => {
- if (state.iframeViews.some(v => v.path === view.path)) return
+ if (state.iframeViews.some((v) => v.path === view.path)) return;
state.iframeViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
- )
+ );
},
ADD_VISITED_VIEW: (state, view) => {
- if (state.visitedViews.some(v => v.path === view.path)) return
+ if (state.visitedViews.some((v) => v.path === view.path)) return;
state.visitedViews.push(
Object.assign({}, view, {
title: view.meta.title || 'no-name'
})
- )
+ );
},
ADD_CACHED_VIEW: (state, view) => {
- if (state.cachedViews.includes(view.name)) return
+ if (state.cachedViews.includes(view.name)) return;
if (view.meta && !view.meta.noCache) {
- state.cachedViews.push(view.name)
+ state.cachedViews.push(view.name);
}
},
DEL_VISITED_VIEW: (state, view) => {
for (const [i, v] of state.visitedViews.entries()) {
if (v.path === view.path) {
- state.visitedViews.splice(i, 1)
- break
+ state.visitedViews.splice(i, 1);
+ break;
}
}
- state.iframeViews = state.iframeViews.filter(item => item.path !== view.path)
+ state.iframeViews = state.iframeViews.filter((item) => item.path !== view.path);
},
DEL_IFRAME_VIEW: (state, view) => {
- state.iframeViews = state.iframeViews.filter(item => item.path !== view.path)
+ state.iframeViews = state.iframeViews.filter((item) => item.path !== view.path);
},
DEL_CACHED_VIEW: (state, view) => {
- const index = state.cachedViews.indexOf(view.name)
- index > -1 && state.cachedViews.splice(index, 1)
+ const index = state.cachedViews.indexOf(view.name);
+ index > -1 && state.cachedViews.splice(index, 1);
},
DEL_OTHERS_VISITED_VIEWS: (state, view) => {
- state.visitedViews = state.visitedViews.filter(v => {
- return v.meta.affix || v.path === view.path
- })
- state.iframeViews = state.iframeViews.filter(item => item.path === view.path)
+ state.visitedViews = state.visitedViews.filter((v) => {
+ return v.meta.affix || v.path === view.path;
+ });
+ state.iframeViews = state.iframeViews.filter((item) => item.path === view.path);
},
DEL_OTHERS_CACHED_VIEWS: (state, view) => {
- const index = state.cachedViews.indexOf(view.name)
+ const index = state.cachedViews.indexOf(view.name);
if (index > -1) {
- state.cachedViews = state.cachedViews.slice(index, index + 1)
+ state.cachedViews = state.cachedViews.slice(index, index + 1);
} else {
- state.cachedViews = []
+ state.cachedViews = [];
}
},
- DEL_ALL_VISITED_VIEWS: state => {
+ DEL_ALL_VISITED_VIEWS: (state) => {
// keep affix tags
- const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
- state.visitedViews = affixTags
- state.iframeViews = []
+ const affixTags = state.visitedViews.filter((tag) => tag.meta.affix);
+ state.visitedViews = affixTags;
+ state.iframeViews = [];
},
- DEL_ALL_CACHED_VIEWS: state => {
- state.cachedViews = []
+ DEL_ALL_CACHED_VIEWS: (state) => {
+ state.cachedViews = [];
},
UPDATE_VISITED_VIEW: (state, view) => {
for (let v of state.visitedViews) {
if (v.path === view.path) {
- v = Object.assign(v, view)
- break
+ v = Object.assign(v, view);
+ break;
}
}
},
DEL_RIGHT_VIEWS: (state, view) => {
- const index = state.visitedViews.findIndex(v => v.path === view.path)
+ const index = state.visitedViews.findIndex((v) => v.path === view.path);
if (index === -1) {
- return
+ return;
}
state.visitedViews = state.visitedViews.filter((item, idx) => {
if (idx <= index || (item.meta && item.meta.affix)) {
- return true
+ return true;
}
- const i = state.cachedViews.indexOf(item.name)
+ const i = state.cachedViews.indexOf(item.name);
if (i > -1) {
- state.cachedViews.splice(i, 1)
+ state.cachedViews.splice(i, 1);
}
- if(item.meta.link) {
- const fi = state.iframeViews.findIndex(v => v.path === item.path)
- state.iframeViews.splice(fi, 1)
+ if (item.meta.link) {
+ const fi = state.iframeViews.findIndex((v) => v.path === item.path);
+ state.iframeViews.splice(fi, 1);
}
- return false
- })
+ return false;
+ });
},
DEL_LEFT_VIEWS: (state, view) => {
- const index = state.visitedViews.findIndex(v => v.path === view.path)
+ const index = state.visitedViews.findIndex((v) => v.path === view.path);
if (index === -1) {
- return
+ return;
}
state.visitedViews = state.visitedViews.filter((item, idx) => {
if (idx >= index || (item.meta && item.meta.affix)) {
- return true
+ return true;
}
- const i = state.cachedViews.indexOf(item.name)
+ const i = state.cachedViews.indexOf(item.name);
if (i > -1) {
- state.cachedViews.splice(i, 1)
+ state.cachedViews.splice(i, 1);
}
- if(item.meta.link) {
- const fi = state.iframeViews.findIndex(v => v.path === item.path)
- state.iframeViews.splice(fi, 1)
+ if (item.meta.link) {
+ const fi = state.iframeViews.findIndex((v) => v.path === item.path);
+ state.iframeViews.splice(fi, 1);
}
- return false
- })
+ return false;
+ });
}
-}
+};
const actions = {
addView({ dispatch }, view) {
- dispatch('addVisitedView', view)
- dispatch('addCachedView', view)
+ dispatch('addVisitedView', view);
+ dispatch('addCachedView', view);
},
addIframeView({ commit }, view) {
- commit('ADD_IFRAME_VIEW', view)
+ commit('ADD_IFRAME_VIEW', view);
},
addVisitedView({ commit }, view) {
- commit('ADD_VISITED_VIEW', view)
+ commit('ADD_VISITED_VIEW', view);
},
addCachedView({ commit }, view) {
- commit('ADD_CACHED_VIEW', view)
+ commit('ADD_CACHED_VIEW', view);
},
delView({ dispatch, state }, view) {
- return new Promise(resolve => {
- dispatch('delVisitedView', view)
- dispatch('delCachedView', view)
+ return new Promise((resolve) => {
+ dispatch('delVisitedView', view);
+ dispatch('delCachedView', view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews]
- })
- })
+ });
+ });
},
delVisitedView({ commit, state }, view) {
- return new Promise(resolve => {
- commit('DEL_VISITED_VIEW', view)
- resolve([...state.visitedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_VISITED_VIEW', view);
+ resolve([...state.visitedViews]);
+ });
},
delIframeView({ commit, state }, view) {
- return new Promise(resolve => {
- commit('DEL_IFRAME_VIEW', view)
- resolve([...state.iframeViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_IFRAME_VIEW', view);
+ resolve([...state.iframeViews]);
+ });
},
delCachedView({ commit, state }, view) {
- return new Promise(resolve => {
- commit('DEL_CACHED_VIEW', view)
- resolve([...state.cachedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_CACHED_VIEW', view);
+ resolve([...state.cachedViews]);
+ });
},
delOthersViews({ dispatch, state }, view) {
- return new Promise(resolve => {
- dispatch('delOthersVisitedViews', view)
- dispatch('delOthersCachedViews', view)
+ return new Promise((resolve) => {
+ dispatch('delOthersVisitedViews', view);
+ dispatch('delOthersCachedViews', view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews]
- })
- })
+ });
+ });
},
delOthersVisitedViews({ commit, state }, view) {
- return new Promise(resolve => {
- commit('DEL_OTHERS_VISITED_VIEWS', view)
- resolve([...state.visitedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_OTHERS_VISITED_VIEWS', view);
+ resolve([...state.visitedViews]);
+ });
},
delOthersCachedViews({ commit, state }, view) {
- return new Promise(resolve => {
- commit('DEL_OTHERS_CACHED_VIEWS', view)
- resolve([...state.cachedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_OTHERS_CACHED_VIEWS', view);
+ resolve([...state.cachedViews]);
+ });
},
delAllViews({ dispatch, state }, view) {
- return new Promise(resolve => {
- dispatch('delAllVisitedViews', view)
- dispatch('delAllCachedViews', view)
+ return new Promise((resolve) => {
+ dispatch('delAllVisitedViews', view);
+ dispatch('delAllCachedViews', view);
resolve({
visitedViews: [...state.visitedViews],
cachedViews: [...state.cachedViews]
- })
- })
+ });
+ });
},
delAllVisitedViews({ commit, state }) {
- return new Promise(resolve => {
- commit('DEL_ALL_VISITED_VIEWS')
- resolve([...state.visitedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_ALL_VISITED_VIEWS');
+ resolve([...state.visitedViews]);
+ });
},
delAllCachedViews({ commit, state }) {
- return new Promise(resolve => {
- commit('DEL_ALL_CACHED_VIEWS')
- resolve([...state.cachedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_ALL_CACHED_VIEWS');
+ resolve([...state.cachedViews]);
+ });
},
updateVisitedView({ commit }, view) {
- commit('UPDATE_VISITED_VIEW', view)
+ commit('UPDATE_VISITED_VIEW', view);
},
delRightTags({ commit }, view) {
- return new Promise(resolve => {
- commit('DEL_RIGHT_VIEWS', view)
- resolve([...state.visitedViews])
- })
+ return new Promise((resolve) => {
+ commit('DEL_RIGHT_VIEWS', view);
+ resolve([...state.visitedViews]);
+ });
},
delLeftTags({ commit }, view) {
- return new Promise(resolve => {
- commit('DEL_LEFT_VIEWS', view)
- resolve([...state.visitedViews])
- })
- },
-}
+ return new Promise((resolve) => {
+ commit('DEL_LEFT_VIEWS', view);
+ resolve([...state.visitedViews]);
+ });
+ }
+};
export default {
namespaced: true,
state,
mutations,
actions
-}
+};
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index ab0a6fe..83f6b01 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,5 +1,5 @@
-import { login, logout, getInfo } from '@/api/login'
-import { getToken, setToken, removeToken } from '@/utils/auth'
+import { login, logout, getInfo } from '@/api/login';
+import { getToken, setToken, removeToken } from '@/utils/auth';
const user = {
state: {
@@ -12,85 +12,93 @@ const user = {
mutations: {
SET_TOKEN: (state, token) => {
- state.token = token
+ state.token = token;
},
SET_NAME: (state, name) => {
- state.name = name
+ state.name = name;
},
SET_AVATAR: (state, avatar) => {
- state.avatar = avatar
+ state.avatar = avatar;
},
SET_ROLES: (state, roles) => {
- state.roles = roles
+ state.roles = roles;
},
SET_PERMISSIONS: (state, permissions) => {
- state.permissions = permissions
+ state.permissions = permissions;
}
},
actions: {
// 登录
Login({ commit }, userInfo) {
- const username = userInfo.username.trim()
- const password = userInfo.password
- const code = userInfo.code
- const uuid = userInfo.uuid
+ const username = userInfo.username.trim();
+ const password = userInfo.password;
+ const code = userInfo.code;
+ const uuid = userInfo.uuid;
return new Promise((resolve, reject) => {
- login(username, password, code, uuid).then(res => {
- setToken(res.token)
- commit('SET_TOKEN', res.token)
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
+ login(username, password, code, uuid)
+ .then((res) => {
+ setToken(res.token);
+ commit('SET_TOKEN', res.token);
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {
- getInfo().then(res => {
- const user = res.user
- const avatar = (user.avatar == "" || user.avatar == null) ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
- if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
- commit('SET_ROLES', res.roles)
- commit('SET_PERMISSIONS', res.permissions)
- } else {
- commit('SET_ROLES', ['ROLE_DEFAULT'])
- }
- commit('SET_NAME', user.userName)
- commit('SET_AVATAR', avatar)
- resolve(res)
- }).catch(error => {
- reject(error)
- })
- })
+ getInfo()
+ .then((res) => {
+ const user = res.user;
+ const avatar =
+ user.avatar === '' || user.avatar == null ? require('@/assets/images/profile.jpg') : process.env.VUE_APP_BASE_API + user.avatar;
+ if (res.roles && res.roles.length > 0) {
+ // 验证返回的roles是否是一个非空数组
+ commit('SET_ROLES', res.roles);
+ commit('SET_PERMISSIONS', res.permissions);
+ } else {
+ commit('SET_ROLES', ['ROLE_DEFAULT']);
+ }
+ commit('SET_NAME', user.userName);
+ commit('SET_AVATAR', avatar);
+ resolve(res);
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
// 退出系统
LogOut({ commit, state }) {
return new Promise((resolve, reject) => {
- logout(state.token).then(() => {
- commit('SET_TOKEN', '')
- commit('SET_ROLES', [])
- commit('SET_PERMISSIONS', [])
- removeToken()
- resolve()
- }).catch(error => {
- reject(error)
- })
- })
+ logout(state.token)
+ .then(() => {
+ commit('SET_TOKEN', '');
+ commit('SET_ROLES', []);
+ commit('SET_PERMISSIONS', []);
+ removeToken();
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
},
// 前端 登出
FedLogOut({ commit }) {
- return new Promise(resolve => {
- commit('SET_TOKEN', '')
- removeToken()
- resolve()
- })
+ return new Promise((resolve) => {
+ commit('SET_TOKEN', '');
+ removeToken();
+ resolve();
+ });
}
}
-}
+};
-export default user
+export default user;
diff --git a/src/utils/dict/Dict.js b/src/utils/dict/Dict.js
index 104bd6e..66bf179 100644
--- a/src/utils/dict/Dict.js
+++ b/src/utils/dict/Dict.js
@@ -1,11 +1,11 @@
-import Vue from 'vue'
-import { mergeRecursive } from "@/utils/ruoyi";
-import DictMeta from './DictMeta'
-import DictData from './DictData'
+import Vue from 'vue';
+import { mergeRecursive } from '@/utils/ruoyi';
+import DictMeta from './DictMeta';
+import DictData from './DictData';
const DEFAULT_DICT_OPTIONS = {
- types: [],
-}
+ types: []
+};
/**
* @classdesc 字典
@@ -15,31 +15,31 @@ const DEFAULT_DICT_OPTIONS = {
*/
export default class Dict {
constructor() {
- this.owner = null
- this.label = {}
- this.type = {}
+ this.owner = null;
+ this.label = {};
+ this.type = {};
}
init(options) {
if (options instanceof Array) {
- options = { types: options }
+ options = { types: options };
}
- const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options)
+ const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options);
if (opts.types === undefined) {
- throw new Error('need dict types')
+ 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, [])
+ 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
+ return;
}
- ps.push(loadDict(this, dictMeta))
- })
- return Promise.all(ps)
+ ps.push(loadDict(this, dictMeta));
+ });
+ return Promise.all(ps);
}
/**
@@ -47,11 +47,11 @@ export default class Dict {
* @param {String} type 字典类型
*/
reloadDict(type) {
- const dictMeta = this._dictMetas.find(e => e.type === 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 Promise.reject(`the dict meta of ${type} was not found`);
}
- return loadDict(this, dictMeta)
+ return loadDict(this, dictMeta);
}
}
@@ -62,21 +62,20 @@ export default class Dict {
* @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
- })
+ 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/src/utils/dict/DictConverter.js b/src/utils/dict/DictConverter.js
index 0cf5df8..ea1f235 100644
--- a/src/utils/dict/DictConverter.js
+++ b/src/utils/dict/DictConverter.js
@@ -1,10 +1,10 @@
-import DictOptions from './DictOptions'
-import DictData from './DictData'
+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)
+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);
}
/**
@@ -13,5 +13,5 @@ export default function(dict, dictMeta) {
* @param {...String} fields
*/
function determineDictField(dict, ...fields) {
- return fields.find(f => Object.prototype.hasOwnProperty.call(dict, f))
+ return fields.find((f) => Object.prototype.hasOwnProperty.call(dict, f));
}
diff --git a/src/utils/dict/DictData.js b/src/utils/dict/DictData.js
index afc763e..81ee6f0 100644
--- a/src/utils/dict/DictData.js
+++ b/src/utils/dict/DictData.js
@@ -6,8 +6,8 @@
*/
export default class DictData {
constructor(label, value, raw) {
- this.label = label
- this.value = value
- this.raw = raw
+ this.label = label;
+ this.value = value;
+ this.raw = raw;
}
}
diff --git a/src/utils/dict/DictMeta.js b/src/utils/dict/DictMeta.js
index 9779daa..30dd8b6 100644
--- a/src/utils/dict/DictMeta.js
+++ b/src/utils/dict/DictMeta.js
@@ -1,5 +1,5 @@
-import { mergeRecursive } from "@/utils/ruoyi";
-import DictOptions from './DictOptions'
+import { mergeRecursive } from '@/utils/ruoyi';
+import DictOptions from './DictOptions';
/**
* @classdesc 字典元数据
@@ -10,29 +10,28 @@ import DictOptions from './DictOptions'
*/
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
+ 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
+DictMeta.parse = function (options) {
+ let opts = null;
if (typeof options === 'string') {
- opts = DictOptions.metas[options] || {}
- opts.type = options
+ opts = DictOptions.metas[options] || {};
+ opts.type = options;
} else if (typeof options === 'object') {
- opts = options
+ opts = options;
}
- opts = mergeRecursive(DictOptions.metas['*'], opts)
- return new DictMeta(opts)
-}
+ opts = mergeRecursive(DictOptions.metas['*'], opts);
+ return new DictMeta(opts);
+};
diff --git a/src/utils/dict/DictOptions.js b/src/utils/dict/DictOptions.js
index 338a94e..5a92da5 100644
--- a/src/utils/dict/DictOptions.js
+++ b/src/utils/dict/DictOptions.js
@@ -1,5 +1,5 @@
-import { mergeRecursive } from "@/utils/ruoyi";
-import dictConverter from './DictConverter'
+import { mergeRecursive } from '@/utils/ruoyi';
+import dictConverter from './DictConverter';
export const options = {
metas: {
@@ -8,16 +8,16 @@ export const options = {
* 字典请求,方法签名为function(dictMeta: DictMeta): Promise
*/
request: (dictMeta) => {
- console.log(`load dict ${dictMeta.type}`)
- return Promise.resolve([])
+ console.log(`load dict ${dictMeta.type}`);
+ return Promise.resolve([]);
},
/**
* 字典响应数据转换器,方法签名为function(response: Object, dictMeta: DictMeta): DictData
*/
responseConverter,
labelField: 'label',
- valueField: 'value',
- },
+ valueField: 'value'
+ }
},
/**
* 默认标签字段
@@ -26,8 +26,8 @@ export const options = {
/**
* 默认值字段
*/
- DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
-}
+ DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key']
+};
/**
* 映射字典
@@ -36,16 +36,16 @@ export const options = {
* @returns {DictData}
*/
function responseConverter(response, dictMeta) {
- const dicts = response.content instanceof Array ? response.content : response
+ 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 []
+ console.warn(`no dict data of "${dictMeta.type}" found in the response`);
+ return [];
}
- return dicts.map(d => dictConverter(d, dictMeta))
+ return dicts.map((d) => dictConverter(d, dictMeta));
}
export function mergeOptions(src) {
- mergeRecursive(options, src)
+ mergeRecursive(options, src);
}
-export default options
+export default options;
diff --git a/src/utils/dict/index.js b/src/utils/dict/index.js
index 215eb9e..60d4c7e 100644
--- a/src/utils/dict/index.js
+++ b/src/utils/dict/index.js
@@ -1,33 +1,33 @@
-import Dict from './Dict'
-import { mergeOptions } from './DictOptions'
+import Dict from './Dict';
+import { mergeOptions } from './DictOptions';
-export default function(Vue, options) {
- mergeOptions(options)
+export default function (Vue, options) {
+ mergeOptions(options);
Vue.mixin({
data() {
if (this.$options === undefined || this.$options.dicts === undefined || this.$options.dicts === null) {
- return {}
+ return {};
}
- const dict = new Dict()
- dict.owner = this
+ const dict = new Dict();
+ dict.owner = this;
return {
dict
- }
+ };
},
created() {
if (!(this.dict instanceof Dict)) {
- return
+ return;
}
- options.onCreated && options.onCreated(this.dict)
+ options.onCreated && options.onCreated(this.dict);
this.dict.init(this.$options.dicts).then(() => {
- options.onReady && options.onReady(this.dict)
+ options.onReady && options.onReady(this.dict);
this.$nextTick(() => {
- this.$emit('dictReady', this.dict)
+ this.$emit('dictReady', this.dict);
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
- this.$options.methods.onDictReady.call(this, this.dict)
+ this.$options.methods.onDictReady.call(this, this.dict);
}
- })
- })
- },
- })
+ });
+ });
+ }
+ });
}
diff --git a/src/utils/errorCode.js b/src/utils/errorCode.js
index d2111ee..81aff2c 100644
--- a/src/utils/errorCode.js
+++ b/src/utils/errorCode.js
@@ -1,6 +1,6 @@
export default {
- '401': '认证失败,无法访问系统资源',
- '403': '当前操作没有权限',
- '404': '访问资源不存在',
- 'default': '系统未知错误,请反馈给管理员'
-}
+ 401: '认证失败,无法访问系统资源',
+ 403: '当前操作没有权限',
+ 404: '访问资源不存在',
+ default: '系统未知错误,请反馈给管理员'
+};
diff --git a/src/utils/index.js b/src/utils/index.js
index b800f65..f11453a 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -4,7 +4,7 @@ import { parseTime } from './ruoyi';
* 表格时间格式化
*/
export function formatDate(cellValue) {
- if (cellValue == null || cellValue == '') return '';
+ if (cellValue == null || cellValue === '') return '';
var date = new Date(cellValue);
var year = date.getFullYear();
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
diff --git a/src/utils/jsencrypt.js b/src/utils/jsencrypt.js
index 78d9523..1c0574b 100644
--- a/src/utils/jsencrypt.js
+++ b/src/utils/jsencrypt.js
@@ -1,30 +1,30 @@
-import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
+import JSEncrypt from 'jsencrypt/bin/jsencrypt.min';
// 密钥对生成 http://web.chacuo.net/netrsakeypair
-const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' +
- 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
+const publicKey =
+ 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdH\n' + 'nzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ==';
-const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' +
+const privateKey =
+ 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY\n' +
'7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKN\n' +
'PuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gA\n' +
'kM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWow\n' +
'cSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99Ecv\n' +
'DQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthh\n' +
'YhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3\n' +
- 'UP8iWi1Qw0Y='
+ 'UP8iWi1Qw0Y=';
// 加密
export function encrypt(txt) {
- const encryptor = new JSEncrypt()
- encryptor.setPublicKey(publicKey) // 设置公钥
- return encryptor.encrypt(txt) // 对数据进行加密
+ const encryptor = new JSEncrypt();
+ encryptor.setPublicKey(publicKey); // 设置公钥
+ return encryptor.encrypt(txt); // 对数据进行加密
}
// 解密
export function decrypt(txt) {
- const encryptor = new JSEncrypt()
- encryptor.setPrivateKey(privateKey) // 设置私钥
- return encryptor.decrypt(txt) // 对数据进行解密
+ const encryptor = new JSEncrypt();
+ encryptor.setPrivateKey(privateKey); // 设置私钥
+ return encryptor.decrypt(txt); // 对数据进行解密
}
-
diff --git a/src/utils/request.js b/src/utils/request.js
index 9f63805..182d17d 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -10,7 +10,7 @@ import { successCode } from '@/global/global';
let downloadLoadingInstance;
// 是否显示重新登录
-export let isRelogin = { show: false };
+export const isRelogin = { show: false };
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
// 创建axios实例
diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js
index fc5815d..3362a81 100644
--- a/src/utils/ruoyi.js
+++ b/src/utils/ruoyi.js
@@ -78,7 +78,7 @@ export function selectDictLabel(datas, value) {
}
var actions = [];
Object.keys(datas).some((key) => {
- if (datas[key].value == '' + value) {
+ if (datas[key].value === '' + value) {
actions.push(datas[key].label);
return true;
}
@@ -100,7 +100,7 @@ export function selectDictLabels(datas, value, separator) {
Object.keys(value.split(currentSeparator)).some((val) => {
var match = false;
Object.keys(datas).some((key) => {
- if (datas[key].value == '' + temp[val]) {
+ if (datas[key].value === '' + temp[val]) {
actions.push(datas[key].label + currentSeparator);
match = true;
}
@@ -130,7 +130,7 @@ export function sprintf(str) {
// 转换字符串,undefined,null等转化为""
export function parseStrEmpty(str) {
- if (!str || str == 'undefined' || str == 'null') {
+ if (!str || str === 'undefined' || str === 'null') {
return '';
}
return str;
@@ -140,7 +140,7 @@ export function parseStrEmpty(str) {
export function mergeRecursive(source, target) {
for (var p in target) {
try {
- if (target[p].constructor == Object) {
+ if (target[p].constructor === Object) {
source[p] = mergeRecursive(source[p], target[p]);
} else {
source[p] = target[p];
@@ -241,15 +241,14 @@ export async function blobValidate(data) {
}
}
-
export function isNullOrEmpty(val) {
if (val === null || val === undefined) {
- return true
+ return true;
} else if (val === {} || Object.keys(val).length === 0) {
- return true
+ return true;
} else if (val.length === 0) {
- return true
+ return true;
} else {
- return false
+ return false;
}
}
diff --git a/src/utils/scroll-to.js b/src/utils/scroll-to.js
index c5d8e04..a908ce1 100644
--- a/src/utils/scroll-to.js
+++ b/src/utils/scroll-to.js
@@ -1,29 +1,36 @@
-Math.easeInOutQuad = function(t, b, c, d) {
- t /= d / 2
+Math.easeInOutQuad = function (t, b, c, d) {
+ t /= d / 2;
if (t < 1) {
- return c / 2 * t * t + b
+ return (c / 2) * t * t + b;
}
- t--
- return -c / 2 * (t * (t - 2) - 1) + b
-}
+ t--;
+ return (-c / 2) * (t * (t - 2) - 1) + b;
+};
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
-var requestAnimFrame = (function() {
- return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
-})()
+var requestAnimFrame = (function () {
+ return (
+ window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ function (callback) {
+ window.setTimeout(callback, 1000 / 60);
+ }
+ );
+})();
/**
* Because it's so fucking difficult to detect the scrolling element, just move them all
* @param {number} amount
*/
function move(amount) {
- document.documentElement.scrollTop = amount
- document.body.parentNode.scrollTop = amount
- document.body.scrollTop = amount
+ document.documentElement.scrollTop = amount;
+ document.body.parentNode.scrollTop = amount;
+ document.body.scrollTop = amount;
}
function position() {
- return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
+ return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop;
}
/**
@@ -32,27 +39,27 @@ function position() {
* @param {Function} callback
*/
export function scrollTo(to, duration, callback) {
- const start = position()
- const change = to - start
- const increment = 20
- let currentTime = 0
- duration = (typeof (duration) === 'undefined') ? 500 : duration
- var animateScroll = function() {
+ const start = position();
+ const change = to - start;
+ const increment = 20;
+ let currentTime = 0;
+ duration = typeof duration === 'undefined' ? 500 : duration;
+ var animateScroll = function () {
// increment the time
- currentTime += increment
+ currentTime += increment;
// find the value with the quadratic in-out easing function
- var val = Math.easeInOutQuad(currentTime, start, change, duration)
+ var val = Math.easeInOutQuad(currentTime, start, change, duration);
// move the document.body
- move(val)
+ move(val);
// do the animation unless its over
if (currentTime < duration) {
- requestAnimFrame(animateScroll)
+ requestAnimFrame(animateScroll);
} else {
- if (callback && typeof (callback) === 'function') {
+ if (callback && typeof callback === 'function') {
// the animation is done so lets callback
- callback()
+ callback();
}
}
- }
- animateScroll()
+ };
+ animateScroll();
}
diff --git a/src/utils/storage.js b/src/utils/storage.js
index 384236f..628015e 100644
--- a/src/utils/storage.js
+++ b/src/utils/storage.js
@@ -1,8 +1,3 @@
-/**
- * @Author: Lei Ding
- * @Date: 2021/9/8
- */
-
import Vue from 'vue';
/**
diff --git a/src/views/components/icons/element-icons.js b/src/views/components/icons/element-icons.js
index 9ea4d63..a19a159 100644
--- a/src/views/components/icons/element-icons.js
+++ b/src/views/components/icons/element-icons.js
@@ -1,3 +1,284 @@
-const elementIcons = ['platform-eleme', 'eleme', 'delete-solid', 'delete', 's-tools', 'setting', 'user-solid', 'user', 'phone', 'phone-outline', 'more', 'more-outline', 'star-on', 'star-off', 's-goods', 'goods', 'warning', 'warning-outline', 'question', 'info', 'remove', 'circle-plus', 'success', 'error', 'zoom-in', 'zoom-out', 'remove-outline', 'circle-plus-outline', 'circle-check', 'circle-close', 's-help', 'help', 'minus', 'plus', 'check', 'close', 'picture', 'picture-outline', 'picture-outline-round', 'upload', 'upload2', 'download', 'camera-solid', 'camera', 'video-camera-solid', 'video-camera', 'message-solid', 'bell', 's-cooperation', 's-order', 's-platform', 's-fold', 's-unfold', 's-operation', 's-promotion', 's-home', 's-release', 's-ticket', 's-management', 's-open', 's-shop', 's-marketing', 's-flag', 's-comment', 's-finance', 's-claim', 's-custom', 's-opportunity', 's-data', 's-check', 's-grid', 'menu', 'share', 'd-caret', 'caret-left', 'caret-right', 'caret-bottom', 'caret-top', 'bottom-left', 'bottom-right', 'back', 'right', 'bottom', 'top', 'top-left', 'top-right', 'arrow-left', 'arrow-right', 'arrow-down', 'arrow-up', 'd-arrow-left', 'd-arrow-right', 'video-pause', 'video-play', 'refresh', 'refresh-right', 'refresh-left', 'finished', 'sort', 'sort-up', 'sort-down', 'rank', 'loading', 'view', 'c-scale-to-original', 'date', 'edit', 'edit-outline', 'folder', 'folder-opened', 'folder-add', 'folder-remove', 'folder-delete', 'folder-checked', 'tickets', 'document-remove', 'document-delete', 'document-copy', 'document-checked', 'document', 'document-add', 'printer', 'paperclip', 'takeaway-box', 'search', 'monitor', 'attract', 'mobile', 'scissors', 'umbrella', 'headset', 'brush', 'mouse', 'coordinate', 'magic-stick', 'reading', 'data-line', 'data-board', 'pie-chart', 'data-analysis', 'collection-tag', 'film', 'suitcase', 'suitcase-1', 'receiving', 'collection', 'files', 'notebook-1', 'notebook-2', 'toilet-paper', 'office-building', 'school', 'table-lamp', 'house', 'no-smoking', 'smoking', 'shopping-cart-full', 'shopping-cart-1', 'shopping-cart-2', 'shopping-bag-1', 'shopping-bag-2', 'sold-out', 'sell', 'present', 'box', 'bank-card', 'money', 'coin', 'wallet', 'discount', 'price-tag', 'news', 'guide', 'male', 'female', 'thumb', 'cpu', 'link', 'connection', 'open', 'turn-off', 'set-up', 'chat-round', 'chat-line-round', 'chat-square', 'chat-dot-round', 'chat-dot-square', 'chat-line-square', 'message', 'postcard', 'position', 'turn-off-microphone', 'microphone', 'close-notification', 'bangzhu', 'time', 'odometer', 'crop', 'aim', 'switch-button', 'full-screen', 'copy-document', 'mic', 'stopwatch', 'medal-1', 'medal', 'trophy', 'trophy-1', 'first-aid-kit', 'discover', 'place', 'location', 'location-outline', 'location-information', 'add-location', 'delete-location', 'map-location', 'alarm-clock', 'timer', 'watch-1', 'watch', 'lock', 'unlock', 'key', 'service', 'mobile-phone', 'bicycle', 'truck', 'ship', 'basketball', 'football', 'soccer', 'baseball', 'wind-power', 'light-rain', 'lightning', 'heavy-rain', 'sunrise', 'sunrise-1', 'sunset', 'sunny', 'cloudy', 'partly-cloudy', 'cloudy-and-sunny', 'moon', 'moon-night', 'dish', 'dish-1', 'food', 'chicken', 'fork-spoon', 'knife-fork', 'burger', 'tableware', 'sugar', 'dessert', 'ice-cream', 'hot-water', 'water-cup', 'coffee-cup', 'cold-drink', 'goblet', 'goblet-full', 'goblet-square', 'goblet-square-full', 'refrigerator', 'grape', 'watermelon', 'cherry', 'apple', 'pear', 'orange', 'coffee', 'ice-tea', 'ice-drink', 'milk-tea', 'potato-strips', 'lollipop', 'ice-cream-square', 'ice-cream-round']
+const elementIcons = [
+ 'platform-eleme',
+ 'eleme',
+ 'delete-solid',
+ 'delete',
+ 's-tools',
+ 'setting',
+ 'user-solid',
+ 'user',
+ 'phone',
+ 'phone-outline',
+ 'more',
+ 'more-outline',
+ 'star-on',
+ 'star-off',
+ 's-goods',
+ 'goods',
+ 'warning',
+ 'warning-outline',
+ 'question',
+ 'info',
+ 'remove',
+ 'circle-plus',
+ 'success',
+ 'error',
+ 'zoom-in',
+ 'zoom-out',
+ 'remove-outline',
+ 'circle-plus-outline',
+ 'circle-check',
+ 'circle-close',
+ 's-help',
+ 'help',
+ 'minus',
+ 'plus',
+ 'check',
+ 'close',
+ 'picture',
+ 'picture-outline',
+ 'picture-outline-round',
+ 'upload',
+ 'upload2',
+ 'download',
+ 'camera-solid',
+ 'camera',
+ 'video-camera-solid',
+ 'video-camera',
+ 'message-solid',
+ 'bell',
+ 's-cooperation',
+ 's-order',
+ 's-platform',
+ 's-fold',
+ 's-unfold',
+ 's-operation',
+ 's-promotion',
+ 's-home',
+ 's-release',
+ 's-ticket',
+ 's-management',
+ 's-open',
+ 's-shop',
+ 's-marketing',
+ 's-flag',
+ 's-comment',
+ 's-finance',
+ 's-claim',
+ 's-custom',
+ 's-opportunity',
+ 's-data',
+ 's-check',
+ 's-grid',
+ 'menu',
+ 'share',
+ 'd-caret',
+ 'caret-left',
+ 'caret-right',
+ 'caret-bottom',
+ 'caret-top',
+ 'bottom-left',
+ 'bottom-right',
+ 'back',
+ 'right',
+ 'bottom',
+ 'top',
+ 'top-left',
+ 'top-right',
+ 'arrow-left',
+ 'arrow-right',
+ 'arrow-down',
+ 'arrow-up',
+ 'd-arrow-left',
+ 'd-arrow-right',
+ 'video-pause',
+ 'video-play',
+ 'refresh',
+ 'refresh-right',
+ 'refresh-left',
+ 'finished',
+ 'sort',
+ 'sort-up',
+ 'sort-down',
+ 'rank',
+ 'loading',
+ 'view',
+ 'c-scale-to-original',
+ 'date',
+ 'edit',
+ 'edit-outline',
+ 'folder',
+ 'folder-opened',
+ 'folder-add',
+ 'folder-remove',
+ 'folder-delete',
+ 'folder-checked',
+ 'tickets',
+ 'document-remove',
+ 'document-delete',
+ 'document-copy',
+ 'document-checked',
+ 'document',
+ 'document-add',
+ 'printer',
+ 'paperclip',
+ 'takeaway-box',
+ 'search',
+ 'monitor',
+ 'attract',
+ 'mobile',
+ 'scissors',
+ 'umbrella',
+ 'headset',
+ 'brush',
+ 'mouse',
+ 'coordinate',
+ 'magic-stick',
+ 'reading',
+ 'data-line',
+ 'data-board',
+ 'pie-chart',
+ 'data-analysis',
+ 'collection-tag',
+ 'film',
+ 'suitcase',
+ 'suitcase-1',
+ 'receiving',
+ 'collection',
+ 'files',
+ 'notebook-1',
+ 'notebook-2',
+ 'toilet-paper',
+ 'office-building',
+ 'school',
+ 'table-lamp',
+ 'house',
+ 'no-smoking',
+ 'smoking',
+ 'shopping-cart-full',
+ 'shopping-cart-1',
+ 'shopping-cart-2',
+ 'shopping-bag-1',
+ 'shopping-bag-2',
+ 'sold-out',
+ 'sell',
+ 'present',
+ 'box',
+ 'bank-card',
+ 'money',
+ 'coin',
+ 'wallet',
+ 'discount',
+ 'price-tag',
+ 'news',
+ 'guide',
+ 'male',
+ 'female',
+ 'thumb',
+ 'cpu',
+ 'link',
+ 'connection',
+ 'open',
+ 'turn-off',
+ 'set-up',
+ 'chat-round',
+ 'chat-line-round',
+ 'chat-square',
+ 'chat-dot-round',
+ 'chat-dot-square',
+ 'chat-line-square',
+ 'message',
+ 'postcard',
+ 'position',
+ 'turn-off-microphone',
+ 'microphone',
+ 'close-notification',
+ 'bangzhu',
+ 'time',
+ 'odometer',
+ 'crop',
+ 'aim',
+ 'switch-button',
+ 'full-screen',
+ 'copy-document',
+ 'mic',
+ 'stopwatch',
+ 'medal-1',
+ 'medal',
+ 'trophy',
+ 'trophy-1',
+ 'first-aid-kit',
+ 'discover',
+ 'place',
+ 'location',
+ 'location-outline',
+ 'location-information',
+ 'add-location',
+ 'delete-location',
+ 'map-location',
+ 'alarm-clock',
+ 'timer',
+ 'watch-1',
+ 'watch',
+ 'lock',
+ 'unlock',
+ 'key',
+ 'service',
+ 'mobile-phone',
+ 'bicycle',
+ 'truck',
+ 'ship',
+ 'basketball',
+ 'football',
+ 'soccer',
+ 'baseball',
+ 'wind-power',
+ 'light-rain',
+ 'lightning',
+ 'heavy-rain',
+ 'sunrise',
+ 'sunrise-1',
+ 'sunset',
+ 'sunny',
+ 'cloudy',
+ 'partly-cloudy',
+ 'cloudy-and-sunny',
+ 'moon',
+ 'moon-night',
+ 'dish',
+ 'dish-1',
+ 'food',
+ 'chicken',
+ 'fork-spoon',
+ 'knife-fork',
+ 'burger',
+ 'tableware',
+ 'sugar',
+ 'dessert',
+ 'ice-cream',
+ 'hot-water',
+ 'water-cup',
+ 'coffee-cup',
+ 'cold-drink',
+ 'goblet',
+ 'goblet-full',
+ 'goblet-square',
+ 'goblet-square-full',
+ 'refrigerator',
+ 'grape',
+ 'watermelon',
+ 'cherry',
+ 'apple',
+ 'pear',
+ 'orange',
+ 'coffee',
+ 'ice-tea',
+ 'ice-drink',
+ 'milk-tea',
+ 'potato-strips',
+ 'lollipop',
+ 'ice-cream-square',
+ 'ice-cream-round'
+];
-export default elementIcons
+export default elementIcons;
diff --git a/src/views/components/icons/index.vue b/src/views/components/icons/index.vue
index d3c9a71..69a47ab 100644
--- a/src/views/components/icons/index.vue
+++ b/src/views/components/icons/index.vue
@@ -36,8 +36,8 @@
diff --git a/src/views/error/404.vue b/src/views/error/404.vue
index 96f075c..56f972b 100644
--- a/src/views/error/404.vue
+++ b/src/views/error/404.vue
@@ -26,20 +26,19 @@
diff --git a/src/views/finance/finance/index.vue b/src/views/finance/finance/index.vue
new file mode 100644
index 0000000..e69de29
diff --git a/src/views/index_v1.vue b/src/views/index_v1.vue
index d2d2ec6..f9b5dec 100644
--- a/src/views/index_v1.vue
+++ b/src/views/index_v1.vue
@@ -25,16 +25,15 @@
-
diff --git a/src/views/sch/school.vue b/src/views/sch/school.vue
index e2ae7f1..eeb8afd 100644
--- a/src/views/sch/school.vue
+++ b/src/views/sch/school.vue
@@ -9,7 +9,7 @@