Pre Merge pull request !296 from hankaibo/master

This commit is contained in:
hankaibo 2021-08-23 04:51:26 +00:00 committed by Gitee
commit 2ace46d42b
171 changed files with 19194 additions and 19378 deletions

3
ruoyi-ui/.browserslistrc Normal file
View File

@ -0,0 +1,3 @@
> 1%
last 2 versions
not dead

View File

@ -1,10 +1 @@
# 忽略build目录下类型为js的文件的语法检查
build/*.js
# 忽略src/assets目录下文件的语法检查
src/assets
# 忽略public目录下文件的语法检查
public
# 忽略当前目录下为js的文件的语法检查
*.js
# 忽略当前目录下为vue的文件的语法检查
*.vue
vue.config.js

View File

@ -1,199 +1,21 @@
// ESlint 检查配置
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: {
browser: true,
node: true,
es6: true,
es6: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
rules: {
"vue/max-attributes-per-line": [2, {
"singleline": 10,
"multiline": {
"max": 1,
"allowFirstLine": false
}
}],
"vue/singleline-html-element-content-newline": "off",
"vue/multiline-html-element-content-newline":"off",
"vue/name-property-casing": ["error", "PascalCase"],
"vue/no-v-html": "off",
'accessor-pairs': 2,
'arrow-spacing': [2, {
'before': true,
'after': true
}],
'block-spacing': [2, 'always'],
'brace-style': [2, '1tbs', {
'allowSingleLine': true
}],
'camelcase': [0, {
'properties': 'always'
}],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false,
'after': true
}],
'comma-style': [2, 'last'],
'constructor-super': 2,
'curly': [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
'eqeqeq': ["error", "always", {"null": "ignore"}],
'generator-star-spacing': [2, {
'before': true,
'after': true
}],
'handle-callback-err': [2, '^(err|error)$'],
'indent': [2, 2, {
'SwitchCase': 1
}],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [2, {
'beforeColon': false,
'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 0,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [2, {
'allowLoop': false,
'allowSwitch': false
}],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [2, {
'defaultAssignment': false
}],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [2, {
'vars': 'all',
'args': 'none'
}],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [2, {
'initialized': 'never'
}],
'operator-linebreak': [2, 'after', {
'overrides': {
'?': 'before',
':': 'before'
}
}],
'padded-blocks': [2, 'never'],
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always', {
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
}],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],
'array-bracket-spacing': [2, 'never']
// 允许props修改
'vue/no-mutating-props': 'off',
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}

22
ruoyi-ui/.gitignore vendored
View File

@ -1,14 +1,17 @@
.DS_Store
node_modules/
dist/
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
**/*.log
tests/**/coverage/
tests/e2e/reports
selenium-debug.log
pnpm-debug.log*
# Editor directories and files
.idea
@ -17,7 +20,4 @@ selenium-debug.log
*.ntvs*
*.njsproj
*.sln
*.local
package-lock.json
yarn.lock
*.sw?

View File

@ -1,13 +1,12 @@
module.exports = {
presets: [
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
'@vue/cli-plugin-babel/preset'
],
'env': {
'development': {
env: {
development: {
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
'plugins': ['dynamic-import-node']
plugins: ['dynamic-import-node']
}
}
}

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 打包Web工程生成dist文件。
echo [信息] 打包Web工程生成dist文件。
echo.
%~d0

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 安装Web工程生成node_modules文件。
echo [信息] 安装Web工程生成node_modules文件。
echo.
%~d0

View File

@ -1,6 +1,6 @@
@echo off
echo.
echo [信息] 使用 Vue CLI 命令运行 Web 工程。
echo [信息] 使用 Vue CLI 命令运行 Web 工程。
echo.
%~d0

View File

@ -1,5 +1,5 @@
{
"name": "ruoyi",
"name": "ruoyi-template",
"version": "3.6.0",
"description": "若依管理系统",
"author": "若依",
@ -9,7 +9,7 @@
"build:prod": "vue-cli-service build",
"build:stage": "vue-cli-service build --mode staging",
"preview": "node build/index.js --preview",
"lint": "eslint --ext .js,.vue src"
"lint": "vue-cli-service lint"
},
"husky": {
"hooks": {
@ -64,10 +64,15 @@
"@vue/cli-plugin-babel": "4.4.6",
"@vue/cli-plugin-eslint": "4.4.6",
"@vue/cli-service": "4.4.6",
"@vue/eslint-config-standard": "^6.1.0",
"babel-eslint": "10.1.0",
"chalk": "4.1.0",
"connect": "3.6.6",
"eslint": "7.15.0",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "7.2.0",
"lint-staged": "10.5.3",
"runjs": "4.4.2",
@ -80,9 +85,5 @@
"engines": {
"node": ">=8.9",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
}

View File

@ -7,7 +7,7 @@
<script>
export default {
name: 'App',
metaInfo() {
metaInfo () {
return {
title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
titleTemplate: title => {

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 登录方法
export function login(username, password, code, uuid) {
export function login (username, password, code, uuid) {
const data = {
username,
password,
@ -16,7 +16,7 @@ export function login(username, password, code, uuid) {
}
// 注册方法
export function register(data) {
export function register (data) {
return request({
url: '/register',
headers: {
@ -28,7 +28,7 @@ export function register(data) {
}
// 获取用户详细信息
export function getInfo() {
export function getInfo () {
return request({
url: '/getInfo',
method: 'get'
@ -36,7 +36,7 @@ export function getInfo() {
}
// 退出方法
export function logout() {
export function logout () {
return request({
url: '/logout',
method: 'post'
@ -44,7 +44,7 @@ export function logout() {
}
// 获取验证码
export function getCodeImg() {
export function getCodeImg () {
return request({
url: '/captchaImage',
method: 'get'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询缓存详细
export function getCache() {
export function getCache () {
return request({
url: '/monitor/cache',
method: 'get'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询定时任务调度列表
export function listJob(query) {
export function listJob (query) {
return request({
url: '/monitor/job/list',
method: 'get',
@ -10,7 +10,7 @@ export function listJob(query) {
}
// 查询定时任务调度详细
export function getJob(jobId) {
export function getJob (jobId) {
return request({
url: '/monitor/job/' + jobId,
method: 'get'
@ -18,7 +18,7 @@ export function getJob(jobId) {
}
// 新增定时任务调度
export function addJob(data) {
export function addJob (data) {
return request({
url: '/monitor/job',
method: 'post',
@ -27,7 +27,7 @@ export function addJob(data) {
}
// 修改定时任务调度
export function updateJob(data) {
export function updateJob (data) {
return request({
url: '/monitor/job',
method: 'put',
@ -36,7 +36,7 @@ export function updateJob(data) {
}
// 删除定时任务调度
export function delJob(jobId) {
export function delJob (jobId) {
return request({
url: '/monitor/job/' + jobId,
method: 'delete'
@ -44,7 +44,7 @@ export function delJob(jobId) {
}
// 导出定时任务调度
export function exportJob(query) {
export function exportJob (query) {
return request({
url: '/monitor/job/export',
method: 'get',
@ -53,7 +53,7 @@ export function exportJob(query) {
}
// 任务状态修改
export function changeJobStatus(jobId, status) {
export function changeJobStatus (jobId, status) {
const data = {
jobId,
status
@ -65,9 +65,8 @@ export function changeJobStatus(jobId, status) {
})
}
// 定时任务立即执行一次
export function runJob(jobId, jobGroup) {
export function runJob (jobId, jobGroup) {
const data = {
jobId,
jobGroup

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询调度日志列表
export function listJobLog(query) {
export function listJobLog (query) {
return request({
url: '/monitor/jobLog/list',
method: 'get',
@ -10,7 +10,7 @@ export function listJobLog(query) {
}
// 删除调度日志
export function delJobLog(jobLogId) {
export function delJobLog (jobLogId) {
return request({
url: '/monitor/jobLog/' + jobLogId,
method: 'delete'
@ -18,7 +18,7 @@ export function delJobLog(jobLogId) {
}
// 清空调度日志
export function cleanJobLog() {
export function cleanJobLog () {
return request({
url: '/monitor/jobLog/clean',
method: 'delete'
@ -26,7 +26,7 @@ export function cleanJobLog() {
}
// 导出调度日志
export function exportJobLog(query) {
export function exportJobLog (query) {
return request({
url: '/monitor/jobLog/export',
method: 'get',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询登录日志列表
export function list(query) {
export function list (query) {
return request({
url: '/monitor/logininfor/list',
method: 'get',
@ -10,7 +10,7 @@ export function list(query) {
}
// 删除登录日志
export function delLogininfor(infoId) {
export function delLogininfor (infoId) {
return request({
url: '/monitor/logininfor/' + infoId,
method: 'delete'
@ -18,7 +18,7 @@ export function delLogininfor(infoId) {
}
// 清空登录日志
export function cleanLogininfor() {
export function cleanLogininfor () {
return request({
url: '/monitor/logininfor/clean',
method: 'delete'
@ -26,7 +26,7 @@ export function cleanLogininfor() {
}
// 导出登录日志
export function exportLogininfor(query) {
export function exportLogininfor (query) {
return request({
url: '/monitor/logininfor/export',
method: 'get',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询在线用户列表
export function list(query) {
export function list (query) {
return request({
url: '/monitor/online/list',
method: 'get',
@ -10,7 +10,7 @@ export function list(query) {
}
// 强退用户
export function forceLogout(tokenId) {
export function forceLogout (tokenId) {
return request({
url: '/monitor/online/' + tokenId,
method: 'delete'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询操作日志列表
export function list(query) {
export function list (query) {
return request({
url: '/monitor/operlog/list',
method: 'get',
@ -10,7 +10,7 @@ export function list(query) {
}
// 删除操作日志
export function delOperlog(operId) {
export function delOperlog (operId) {
return request({
url: '/monitor/operlog/' + operId,
method: 'delete'
@ -18,7 +18,7 @@ export function delOperlog(operId) {
}
// 清空操作日志
export function cleanOperlog() {
export function cleanOperlog () {
return request({
url: '/monitor/operlog/clean',
method: 'delete'
@ -26,7 +26,7 @@ export function cleanOperlog() {
}
// 导出操作日志
export function exportOperlog(query) {
export function exportOperlog (query) {
return request({
url: '/monitor/operlog/export',
method: 'get',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询服务器详细
export function getServer() {
export function getServer () {
return request({
url: '/monitor/server',
method: 'get'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询参数列表
export function listConfig(query) {
export function listConfig (query) {
return request({
url: '/system/config/list',
method: 'get',
@ -10,7 +10,7 @@ export function listConfig(query) {
}
// 查询参数详细
export function getConfig(configId) {
export function getConfig (configId) {
return request({
url: '/system/config/' + configId,
method: 'get'
@ -18,7 +18,7 @@ export function getConfig(configId) {
}
// 根据参数键名查询参数值
export function getConfigKey(configKey) {
export function getConfigKey (configKey) {
return request({
url: '/system/config/configKey/' + configKey,
method: 'get'
@ -26,7 +26,7 @@ export function getConfigKey(configKey) {
}
// 新增参数配置
export function addConfig(data) {
export function addConfig (data) {
return request({
url: '/system/config',
method: 'post',
@ -35,7 +35,7 @@ export function addConfig(data) {
}
// 修改参数配置
export function updateConfig(data) {
export function updateConfig (data) {
return request({
url: '/system/config',
method: 'put',
@ -44,7 +44,7 @@ export function updateConfig(data) {
}
// 删除参数配置
export function delConfig(configId) {
export function delConfig (configId) {
return request({
url: '/system/config/' + configId,
method: 'delete'
@ -52,7 +52,7 @@ export function delConfig(configId) {
}
// 刷新参数缓存
export function refreshCache() {
export function refreshCache () {
return request({
url: '/system/config/refreshCache',
method: 'delete'
@ -60,7 +60,7 @@ export function refreshCache() {
}
// 导出参数
export function exportConfig(query) {
export function exportConfig (query) {
return request({
url: '/system/config/export',
method: 'get',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询部门列表
export function listDept(query) {
export function listDept (query) {
return request({
url: '/system/dept/list',
method: 'get',
@ -10,7 +10,7 @@ export function listDept(query) {
}
// 查询部门列表(排除节点)
export function listDeptExcludeChild(deptId) {
export function listDeptExcludeChild (deptId) {
return request({
url: '/system/dept/list/exclude/' + deptId,
method: 'get'
@ -18,7 +18,7 @@ export function listDeptExcludeChild(deptId) {
}
// 查询部门详细
export function getDept(deptId) {
export function getDept (deptId) {
return request({
url: '/system/dept/' + deptId,
method: 'get'
@ -26,7 +26,7 @@ export function getDept(deptId) {
}
// 查询部门下拉树结构
export function treeselect() {
export function treeselect () {
return request({
url: '/system/dept/treeselect',
method: 'get'
@ -34,7 +34,7 @@ export function treeselect() {
}
// 根据角色ID查询部门树结构
export function roleDeptTreeselect(roleId) {
export function roleDeptTreeselect (roleId) {
return request({
url: '/system/dept/roleDeptTreeselect/' + roleId,
method: 'get'
@ -42,7 +42,7 @@ export function roleDeptTreeselect(roleId) {
}
// 新增部门
export function addDept(data) {
export function addDept (data) {
return request({
url: '/system/dept',
method: 'post',
@ -51,7 +51,7 @@ export function addDept(data) {
}
// 修改部门
export function updateDept(data) {
export function updateDept (data) {
return request({
url: '/system/dept',
method: 'put',
@ -60,7 +60,7 @@ export function updateDept(data) {
}
// 删除部门
export function delDept(deptId) {
export function delDept (deptId) {
return request({
url: '/system/dept/' + deptId,
method: 'delete'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询字典数据列表
export function listData(query) {
export function listData (query) {
return request({
url: '/system/dict/data/list',
method: 'get',
@ -10,7 +10,7 @@ export function listData(query) {
}
// 查询字典数据详细
export function getData(dictCode) {
export function getData (dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
method: 'get'
@ -18,7 +18,7 @@ export function getData(dictCode) {
}
// 根据字典类型查询字典数据信息
export function getDicts(dictType) {
export function getDicts (dictType) {
return request({
url: '/system/dict/data/type/' + dictType,
method: 'get'
@ -26,7 +26,7 @@ export function getDicts(dictType) {
}
// 新增字典数据
export function addData(data) {
export function addData (data) {
return request({
url: '/system/dict/data',
method: 'post',
@ -35,7 +35,7 @@ export function addData(data) {
}
// 修改字典数据
export function updateData(data) {
export function updateData (data) {
return request({
url: '/system/dict/data',
method: 'put',
@ -44,7 +44,7 @@ export function updateData(data) {
}
// 删除字典数据
export function delData(dictCode) {
export function delData (dictCode) {
return request({
url: '/system/dict/data/' + dictCode,
method: 'delete'
@ -52,7 +52,7 @@ export function delData(dictCode) {
}
// 导出字典数据
export function exportData(query) {
export function exportData (query) {
return request({
url: '/system/dict/data/export',
method: 'get',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询字典类型列表
export function listType(query) {
export function listType (query) {
return request({
url: '/system/dict/type/list',
method: 'get',
@ -10,7 +10,7 @@ export function listType(query) {
}
// 查询字典类型详细
export function getType(dictId) {
export function getType (dictId) {
return request({
url: '/system/dict/type/' + dictId,
method: 'get'
@ -18,7 +18,7 @@ export function getType(dictId) {
}
// 新增字典类型
export function addType(data) {
export function addType (data) {
return request({
url: '/system/dict/type',
method: 'post',
@ -27,7 +27,7 @@ export function addType(data) {
}
// 修改字典类型
export function updateType(data) {
export function updateType (data) {
return request({
url: '/system/dict/type',
method: 'put',
@ -36,7 +36,7 @@ export function updateType(data) {
}
// 删除字典类型
export function delType(dictId) {
export function delType (dictId) {
return request({
url: '/system/dict/type/' + dictId,
method: 'delete'
@ -44,7 +44,7 @@ export function delType(dictId) {
}
// 刷新字典缓存
export function refreshCache() {
export function refreshCache () {
return request({
url: '/system/dict/type/refreshCache',
method: 'delete'
@ -52,7 +52,7 @@ export function refreshCache() {
}
// 导出字典类型
export function exportType(query) {
export function exportType (query) {
return request({
url: '/system/dict/type/export',
method: 'get',
@ -61,7 +61,7 @@ export function exportType(query) {
}
// 获取字典选择框列表
export function optionselect() {
export function optionselect () {
return request({
url: '/system/dict/type/optionselect',
method: 'get'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询菜单列表
export function listMenu(query) {
export function listMenu (query) {
return request({
url: '/system/menu/list',
method: 'get',
@ -10,7 +10,7 @@ export function listMenu(query) {
}
// 查询菜单详细
export function getMenu(menuId) {
export function getMenu (menuId) {
return request({
url: '/system/menu/' + menuId,
method: 'get'
@ -18,7 +18,7 @@ export function getMenu(menuId) {
}
// 查询菜单下拉树结构
export function treeselect() {
export function treeselect () {
return request({
url: '/system/menu/treeselect',
method: 'get'
@ -26,7 +26,7 @@ export function treeselect() {
}
// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
export function roleMenuTreeselect (roleId) {
return request({
url: '/system/menu/roleMenuTreeselect/' + roleId,
method: 'get'
@ -34,7 +34,7 @@ export function roleMenuTreeselect(roleId) {
}
// 新增菜单
export function addMenu(data) {
export function addMenu (data) {
return request({
url: '/system/menu',
method: 'post',
@ -43,7 +43,7 @@ export function addMenu(data) {
}
// 修改菜单
export function updateMenu(data) {
export function updateMenu (data) {
return request({
url: '/system/menu',
method: 'put',
@ -52,7 +52,7 @@ export function updateMenu(data) {
}
// 删除菜单
export function delMenu(menuId) {
export function delMenu (menuId) {
return request({
url: '/system/menu/' + menuId,
method: 'delete'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询公告列表
export function listNotice(query) {
export function listNotice (query) {
return request({
url: '/system/notice/list',
method: 'get',
@ -10,7 +10,7 @@ export function listNotice(query) {
}
// 查询公告详细
export function getNotice(noticeId) {
export function getNotice (noticeId) {
return request({
url: '/system/notice/' + noticeId,
method: 'get'
@ -18,7 +18,7 @@ export function getNotice(noticeId) {
}
// 新增公告
export function addNotice(data) {
export function addNotice (data) {
return request({
url: '/system/notice',
method: 'post',
@ -27,7 +27,7 @@ export function addNotice(data) {
}
// 修改公告
export function updateNotice(data) {
export function updateNotice (data) {
return request({
url: '/system/notice',
method: 'put',
@ -36,7 +36,7 @@ export function updateNotice(data) {
}
// 删除公告
export function delNotice(noticeId) {
export function delNotice (noticeId) {
return request({
url: '/system/notice/' + noticeId,
method: 'delete'

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
export function listPost (query) {
return request({
url: '/system/post/list',
method: 'get',
@ -10,7 +10,7 @@ export function listPost(query) {
}
// 查询岗位详细
export function getPost(postId) {
export function getPost (postId) {
return request({
url: '/system/post/' + postId,
method: 'get'
@ -18,7 +18,7 @@ export function getPost(postId) {
}
// 新增岗位
export function addPost(data) {
export function addPost (data) {
return request({
url: '/system/post',
method: 'post',
@ -27,7 +27,7 @@ export function addPost(data) {
}
// 修改岗位
export function updatePost(data) {
export function updatePost (data) {
return request({
url: '/system/post',
method: 'put',
@ -36,7 +36,7 @@ export function updatePost(data) {
}
// 删除岗位
export function delPost(postId) {
export function delPost (postId) {
return request({
url: '/system/post/' + postId,
method: 'delete'
@ -44,7 +44,7 @@ export function delPost(postId) {
}
// 导出岗位
export function exportPost(query) {
export function exportPost (query) {
return request({
url: '/system/post/export',
method: 'get',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询角色列表
export function listRole(query) {
export function listRole (query) {
return request({
url: '/system/role/list',
method: 'get',
@ -10,7 +10,7 @@ export function listRole(query) {
}
// 查询角色详细
export function getRole(roleId) {
export function getRole (roleId) {
return request({
url: '/system/role/' + roleId,
method: 'get'
@ -18,7 +18,7 @@ export function getRole(roleId) {
}
// 新增角色
export function addRole(data) {
export function addRole (data) {
return request({
url: '/system/role',
method: 'post',
@ -27,7 +27,7 @@ export function addRole(data) {
}
// 修改角色
export function updateRole(data) {
export function updateRole (data) {
return request({
url: '/system/role',
method: 'put',
@ -36,7 +36,7 @@ export function updateRole(data) {
}
// 角色数据权限
export function dataScope(data) {
export function dataScope (data) {
return request({
url: '/system/role/dataScope',
method: 'put',
@ -45,7 +45,7 @@ export function dataScope(data) {
}
// 角色状态修改
export function changeRoleStatus(roleId, status) {
export function changeRoleStatus (roleId, status) {
const data = {
roleId,
status
@ -58,7 +58,7 @@ export function changeRoleStatus(roleId, status) {
}
// 删除角色
export function delRole(roleId) {
export function delRole (roleId) {
return request({
url: '/system/role/' + roleId,
method: 'delete'
@ -66,7 +66,7 @@ export function delRole(roleId) {
}
// 导出角色
export function exportRole(query) {
export function exportRole (query) {
return request({
url: '/system/role/export',
method: 'get',
@ -75,7 +75,7 @@ export function exportRole(query) {
}
// 查询角色已授权用户列表
export function allocatedUserList(query) {
export function allocatedUserList (query) {
return request({
url: '/system/role/authUser/allocatedList',
method: 'get',
@ -84,7 +84,7 @@ export function allocatedUserList(query) {
}
// 查询角色未授权用户列表
export function unallocatedUserList(query) {
export function unallocatedUserList (query) {
return request({
url: '/system/role/authUser/unallocatedList',
method: 'get',
@ -93,7 +93,7 @@ export function unallocatedUserList(query) {
}
// 取消用户授权角色
export function authUserCancel(data) {
export function authUserCancel (data) {
return request({
url: '/system/role/authUser/cancel',
method: 'put',
@ -102,7 +102,7 @@ export function authUserCancel(data) {
}
// 批量取消用户授权角色
export function authUserCancelAll(data) {
export function authUserCancelAll (data) {
return request({
url: '/system/role/authUser/cancelAll',
method: 'put',
@ -111,7 +111,7 @@ export function authUserCancelAll(data) {
}
// 授权用户选择
export function authUserSelectAll(data) {
export function authUserSelectAll (data) {
return request({
url: '/system/role/authUser/selectAll',
method: 'put',

View File

@ -1,8 +1,8 @@
import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi";
import { praseStrEmpty } from '@/utils/ruoyi'
// 查询用户列表
export function listUser(query) {
export function listUser (query) {
return request({
url: '/system/user/list',
method: 'get',
@ -11,7 +11,7 @@ export function listUser(query) {
}
// 查询用户详细
export function getUser(userId) {
export function getUser (userId) {
return request({
url: '/system/user/' + praseStrEmpty(userId),
method: 'get'
@ -19,7 +19,7 @@ export function getUser(userId) {
}
// 新增用户
export function addUser(data) {
export function addUser (data) {
return request({
url: '/system/user',
method: 'post',
@ -28,7 +28,7 @@ export function addUser(data) {
}
// 修改用户
export function updateUser(data) {
export function updateUser (data) {
return request({
url: '/system/user',
method: 'put',
@ -37,7 +37,7 @@ export function updateUser(data) {
}
// 删除用户
export function delUser(userId) {
export function delUser (userId) {
return request({
url: '/system/user/' + userId,
method: 'delete'
@ -45,7 +45,7 @@ export function delUser(userId) {
}
// 导出用户
export function exportUser(query) {
export function exportUser (query) {
return request({
url: '/system/user/export',
method: 'get',
@ -54,7 +54,7 @@ export function exportUser(query) {
}
// 用户密码重置
export function resetUserPwd(userId, password) {
export function resetUserPwd (userId, password) {
const data = {
userId,
password
@ -67,7 +67,7 @@ export function resetUserPwd(userId, password) {
}
// 用户状态修改
export function changeUserStatus(userId, status) {
export function changeUserStatus (userId, status) {
const data = {
userId,
status
@ -80,7 +80,7 @@ export function changeUserStatus(userId, status) {
}
// 查询用户个人信息
export function getUserProfile() {
export function getUserProfile () {
return request({
url: '/system/user/profile',
method: 'get'
@ -88,7 +88,7 @@ export function getUserProfile() {
}
// 修改用户个人信息
export function updateUserProfile(data) {
export function updateUserProfile (data) {
return request({
url: '/system/user/profile',
method: 'put',
@ -97,7 +97,7 @@ export function updateUserProfile(data) {
}
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
export function updateUserPwd (oldPassword, newPassword) {
const data = {
oldPassword,
newPassword
@ -110,7 +110,7 @@ export function updateUserPwd(oldPassword, newPassword) {
}
// 用户头像上传
export function uploadAvatar(data) {
export function uploadAvatar (data) {
return request({
url: '/system/user/profile/avatar',
method: 'post',
@ -119,7 +119,7 @@ export function uploadAvatar(data) {
}
// 下载用户导入模板
export function importTemplate() {
export function importTemplate () {
return request({
url: '/system/user/importTemplate',
method: 'get'
@ -127,7 +127,7 @@ export function importTemplate() {
}
// 查询授权角色
export function getAuthRole(userId) {
export function getAuthRole (userId) {
return request({
url: '/system/user/authRole/' + userId,
method: 'get'
@ -135,7 +135,7 @@ export function getAuthRole(userId) {
}
// 保存授权角色
export function updateAuthRole(data) {
export function updateAuthRole (data) {
return request({
url: '/system/user/authRole',
method: 'put',

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询生成表数据
export function listTable(query) {
export function listTable (query) {
return request({
url: '/tool/gen/list',
method: 'get',
@ -9,7 +9,7 @@ export function listTable(query) {
})
}
// 查询db数据库列表
export function listDbTable(query) {
export function listDbTable (query) {
return request({
url: '/tool/gen/db/list',
method: 'get',
@ -18,7 +18,7 @@ export function listDbTable(query) {
}
// 查询表详细信息
export function getGenTable(tableId) {
export function getGenTable (tableId) {
return request({
url: '/tool/gen/' + tableId,
method: 'get'
@ -26,7 +26,7 @@ export function getGenTable(tableId) {
}
// 修改代码生成信息
export function updateGenTable(data) {
export function updateGenTable (data) {
return request({
url: '/tool/gen',
method: 'put',
@ -35,7 +35,7 @@ export function updateGenTable(data) {
}
// 导入表
export function importTable(data) {
export function importTable (data) {
return request({
url: '/tool/gen/importTable',
method: 'post',
@ -44,7 +44,7 @@ export function importTable(data) {
}
// 预览生成代码
export function previewTable(tableId) {
export function previewTable (tableId) {
return request({
url: '/tool/gen/preview/' + tableId,
method: 'get'
@ -52,7 +52,7 @@ export function previewTable(tableId) {
}
// 删除表数据
export function delTable(tableId) {
export function delTable (tableId) {
return request({
url: '/tool/gen/' + tableId,
method: 'delete'
@ -60,7 +60,7 @@ export function delTable(tableId) {
}
// 生成代码(自定义路径)
export function genCode(tableName) {
export function genCode (tableName) {
return request({
url: '/tool/gen/genCode/' + tableName,
method: 'get'
@ -68,7 +68,7 @@ export function genCode(tableName) {
}
// 同步数据库
export function synchDb(tableName) {
export function synchDb (tableName) {
return request({
url: '/tool/gen/synchDb/' + tableName,
method: 'get'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -2,7 +2,7 @@
<el-breadcrumb class="app-breadcrumb" separator="/">
<transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
<span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
<span v-if="item.redirect==='noRedirect'||index===levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
</el-breadcrumb-item>
</transition-group>
@ -11,13 +11,13 @@
<script>
export default {
data() {
data () {
return {
levelList: null
}
},
watch: {
$route(route) {
$route (route) {
// if you go to the redirect page, do not update the breadcrumbs
if (route.path.startsWith('/redirect/')) {
return
@ -25,29 +25,29 @@ export default {
this.getBreadcrumb()
}
},
created() {
created () {
this.getBreadcrumb()
},
methods: {
getBreadcrumb() {
getBreadcrumb () {
// only show routes with meta.title
let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
const first = matched[0]
if (!this.isDashboard(first)) {
matched = [{ path: '/index', meta: { title: '首页' }}].concat(matched)
matched = [{ path: '/index', meta: { title: '首页' } }].concat(matched)
}
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
},
isDashboard(route) {
isDashboard (route) {
const name = route && route.name
if (!name) {
return false
}
return name.trim() === 'Index'
},
handleLink(item) {
handleLink (item) {
const { redirect, path } = item
if (redirect) {
this.$router.push(redirect)

View File

@ -3,7 +3,7 @@
<template v-for="(item, index) in options">
<template v-if="values.includes(item.dictValue)">
<span
v-if="item.listClass == 'default' || item.listClass == ''"
v-if="item.listClass === 'default' || item.listClass === ''"
:key="item.dictValue"
:index="index"
:class="item.cssClass"
@ -13,7 +13,7 @@
v-else
:key="item.dictValue"
:index="index"
:type="item.listClass == 'primary' ? '' : item.listClass"
:type="item.listClass === 'primary' ? '' : item.listClass"
:class="item.cssClass"
>
{{ item.dictLabel }}
@ -25,24 +25,24 @@
<script>
export default {
name: "DictTag",
name: 'DictTag',
props: {
options: {
type: Array,
default: null,
default: null
},
value: [String, Array],
value: [String, Array]
},
computed: {
values() {
values () {
if (this.value) {
return Array.isArray(this.value) ? this.value : [this.value];
return Array.isArray(this.value) ? this.value : [this.value]
} else {
return [];
return []
}
},
},
};
}
}
}
</script>
<style scoped>
.el-tag + .el-tag {

View File

@ -10,7 +10,7 @@
:headers="headers"
style="display: none"
ref="upload"
v-if="this.type == 'url'"
v-if="this.type === 'url'"
>
</el-upload>
<div class="editor" ref="editor" :style="styles"></div>
@ -18,176 +18,176 @@
</template>
<script>
import Quill from "quill";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
import { getToken } from "@/utils/auth";
import Quill from 'quill'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
import { getToken } from '@/utils/auth'
export default {
name: "Editor",
name: 'Editor',
props: {
/* 编辑器的内容 */
value: {
type: String,
default: "",
default: ''
},
/* 高度 */
height: {
type: Number,
default: null,
default: null
},
/* 最小高度 */
minHeight: {
type: Number,
default: null,
default: null
},
/* 只读 */
readOnly: {
type: Boolean,
default: false,
default: false
},
// (MB)
fileSize: {
type: Number,
default: 5,
default: 5
},
/* 类型base64格式、url格式 */
type: {
type: String,
default: "url",
default: 'url'
}
},
data() {
data () {
return {
uploadUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
uploadUrl: process.env.VUE_APP_BASE_API + '/common/upload', //
headers: {
Authorization: "Bearer " + getToken()
Authorization: 'Bearer ' + getToken()
},
Quill: null,
currentValue: "",
currentValue: '',
options: {
theme: "snow",
theme: 'snow',
bounds: document.body,
debug: "warn",
debug: 'warn',
modules: {
//
toolbar: [
["bold", "italic", "underline", "strike"], // 线 线
["blockquote", "code-block"], //
[{ list: "ordered" }, { list: "bullet" }], //
[{ indent: "-1" }, { indent: "+1" }], //
[{ size: ["small", false, "large", "huge"] }], //
['bold', 'italic', 'underline', 'strike'], // 线 线
['blockquote', 'code-block'], //
[{ list: 'ordered' }, { list: 'bullet' }], //
[{ indent: '-1' }, { indent: '+1' }], //
[{ size: ['small', false, 'large', 'huge'] }], //
[{ header: [1, 2, 3, 4, 5, 6, false] }], //
[{ color: [] }, { background: [] }], //
[{ align: [] }], //
["clean"], //
["link", "image", "video"] //
],
['clean'], //
['link', 'image', 'video'] //
]
},
placeholder: "请输入内容",
readOnly: this.readOnly,
},
};
placeholder: '请输入内容',
readOnly: this.readOnly
}
}
},
computed: {
styles() {
let style = {};
styles () {
const style = {}
if (this.minHeight) {
style.minHeight = `${this.minHeight}px`;
style.minHeight = `${this.minHeight}px`
}
if (this.height) {
style.height = `${this.height}px`;
style.height = `${this.height}px`
}
return style
}
return style;
},
},
watch: {
value: {
handler(val) {
handler (val) {
if (val !== this.currentValue) {
this.currentValue = val === null ? "" : val;
this.currentValue = val === null ? '' : val
if (this.Quill) {
this.Quill.pasteHTML(this.currentValue);
this.Quill.pasteHTML(this.currentValue)
}
}
},
immediate: true,
immediate: true
}
},
mounted () {
this.init()
},
mounted() {
this.init();
},
beforeDestroy() {
this.Quill = null;
beforeDestroy () {
this.Quill = null
},
methods: {
init() {
const editor = this.$refs.editor;
this.Quill = new Quill(editor, this.options);
init () {
const editor = this.$refs.editor
this.Quill = new Quill(editor, this.options)
//
if (this.type == 'url') {
let toolbar = this.Quill.getModule("toolbar");
toolbar.addHandler("image", (value) => {
this.uploadType = "image";
if (this.type === 'url') {
const toolbar = this.Quill.getModule('toolbar')
toolbar.addHandler('image', (value) => {
this.uploadType = 'image'
if (value) {
this.$refs.upload.$children[0].$refs.input.click();
this.$refs.upload.$children[0].$refs.input.click()
} else {
this.quill.format("image", false);
this.quill.format('image', false)
}
});
})
}
this.Quill.pasteHTML(this.currentValue);
this.Quill.on("text-change", (delta, oldDelta, source) => {
const html = this.$refs.editor.children[0].innerHTML;
const text = this.Quill.getText();
const quill = this.Quill;
this.currentValue = html;
this.$emit("input", html);
this.$emit("on-change", { html, text, quill });
});
this.Quill.on("text-change", (delta, oldDelta, source) => {
this.$emit("on-text-change", delta, oldDelta, source);
});
this.Quill.on("selection-change", (range, oldRange, source) => {
this.$emit("on-selection-change", range, oldRange, source);
});
this.Quill.on("editor-change", (eventName, ...args) => {
this.$emit("on-editor-change", eventName, ...args);
});
this.Quill.pasteHTML(this.currentValue)
this.Quill.on('text-change', (delta, oldDelta, source) => {
const html = this.$refs.editor.children[0].innerHTML
const text = this.Quill.getText()
const quill = this.Quill
this.currentValue = html
this.$emit('input', html)
this.$emit('on-change', { html, text, quill })
})
this.Quill.on('text-change', (delta, oldDelta, source) => {
this.$emit('on-text-change', delta, oldDelta, source)
})
this.Quill.on('selection-change', (range, oldRange, source) => {
this.$emit('on-selection-change', range, oldRange, source)
})
this.Quill.on('editor-change', (eventName, ...args) => {
this.$emit('on-editor-change', eventName, ...args)
})
},
//
handleBeforeUpload(file) {
handleBeforeUpload (file) {
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`)
return false
}
}
return true;
return true
},
handleUploadSuccess(res, file) {
handleUploadSuccess (res, file) {
//
let quill = this.Quill;
const quill = this.Quill
//
if (res.code == 200) {
if (res.code === 200) {
//
let length = quill.getSelection().index;
const length = quill.getSelection().index
// res.url
quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName);
quill.insertEmbed(length, 'image', process.env.VUE_APP_BASE_API + res.fileName)
//
quill.setSelection(length + 1);
quill.setSelection(length + 1)
} else {
this.$message.error("图片插入失败");
this.$message.error('图片插入失败')
}
},
handleUploadError() {
this.$message.error("图片插入失败");
},
},
};
handleUploadError () {
this.$message.error('图片插入失败')
}
}
}
</script>
<style>

View File

@ -39,27 +39,27 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { getToken } from '@/utils/auth'
export default {
name: "FileUpload",
name: 'FileUpload',
props: {
//
value: [String, Object, Array],
//
limit: {
type: Number,
default: 5,
default: 5
},
// (MB)
fileSize: {
type: Number,
default: 5,
default: 5
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
default: () => ['doc', 'xls', 'ppt', 'txt', 'pdf']
},
//
isShowTip: {
@ -67,34 +67,34 @@ export default {
default: true
}
},
data() {
data () {
return {
baseUrl: process.env.VUE_APP_BASE_API,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', //
headers: {
Authorization: "Bearer " + getToken(),
Authorization: 'Bearer ' + getToken()
},
fileList: [],
};
fileList: []
}
},
watch: {
value: {
handler(val) {
handler (val) {
if (val) {
let temp = 1;
let temp = 1
//
const list = Array.isArray(val) ? val : this.value.split(',');
const list = Array.isArray(val) ? val : this.value.split(',')
//
this.fileList = list.map(item => {
if (typeof item === "string") {
item = { name: item, url: item };
if (typeof item === 'string') {
item = { name: item, url: item }
}
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
item.uid = item.uid || new Date().getTime() + temp++
return item
})
} else {
this.fileList = [];
return [];
this.fileList = []
return []
}
},
deep: true,
@ -103,77 +103,77 @@ export default {
},
computed: {
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
showTip () {
return this.isShowTip && (this.fileType || this.fileSize)
}
},
methods: {
//
handleBeforeUpload(file) {
handleBeforeUpload (file) {
//
if (this.fileType) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
let fileExtension = ''
if (file.name.lastIndexOf('.') > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
}
const isTypeOk = this.fileType.some((type) => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (file.type.indexOf(type) > -1) return true
if (fileExtension && fileExtension.indexOf(type) > -1) return true
return false
})
if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
return false;
this.$message.error(`文件格式不正确, 请上传${this.fileType.join('/')}格式文件!`)
return false
}
}
//
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`)
return false
}
}
return true;
return true
},
//
handleExceed() {
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
handleExceed () {
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`)
},
//
handleUploadError(err) {
this.$message.error("上传失败, 请重试");
handleUploadError () {
this.$message.error('上传失败, 请重试')
},
//
handleUploadSuccess(res, file) {
this.$message.success("上传成功");
this.fileList.push({ name: res.fileName, url: res.fileName });
this.$emit("input", this.listToString(this.fileList));
handleUploadSuccess (res, file) {
this.$message.success('上传成功')
this.fileList.push({ name: res.fileName, url: res.fileName })
this.$emit('input', this.listToString(this.fileList))
},
//
handleDelete(index) {
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
handleDelete (index) {
this.fileList.splice(index, 1)
this.$emit('input', this.listToString(this.fileList))
},
//
getFileName(name) {
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
getFileName (name) {
if (name.lastIndexOf('/') > -1) {
return name.slice(name.lastIndexOf('/') + 1).toLowerCase()
} else {
return "";
return ''
}
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
for (let i in list) {
strs += list[i].url + separator;
listToString (list, separator) {
let strs = ''
separator = separator || ','
for (const i in list) {
strs += list[i].url + separator
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';
return strs !== '' ? strs.substr(0, strs.length - 1) : ''
}
}
};
}
</script>
<style scoped lang="scss">

View File

@ -23,7 +23,7 @@ export default {
}
},
methods: {
toggleClick() {
toggleClick () {
this.$emit('toggleClick')
}
}

View File

@ -25,7 +25,7 @@ import path from 'path'
export default {
name: 'HeaderSearch',
data() {
data () {
return {
search: '',
options: [],
@ -35,18 +35,18 @@ export default {
}
},
computed: {
routes() {
routes () {
return this.$store.getters.permission_routes
}
},
watch: {
routes() {
routes () {
this.searchPool = this.generateRoutes(this.routes)
},
searchPool(list) {
searchPool (list) {
this.initFuse(list)
},
show(value) {
show (value) {
if (value) {
document.body.addEventListener('click', this.close)
} else {
@ -54,27 +54,27 @@ export default {
}
}
},
mounted() {
mounted () {
this.searchPool = this.generateRoutes(this.routes)
},
methods: {
click() {
click () {
this.show = !this.show
if (this.show) {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
}
},
close() {
close () {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
this.options = []
this.show = false
},
change(val) {
const path = val.path;
if(this.ishttp(val.path)) {
change (val) {
const path = val.path
if (this.ishttp(val.path)) {
// http(s)://
const pindex = path.indexOf("http");
window.open(path.substr(pindex, path.length), "_blank");
const pindex = path.indexOf('http')
window.open(path.substr(pindex, path.length), '_blank')
} else {
this.$router.push(val.path)
}
@ -84,7 +84,7 @@ export default {
this.show = false
})
},
initFuse(list) {
initFuse (list) {
this.fuse = new Fuse(list, {
shouldSort: true,
threshold: 0.4,
@ -103,7 +103,7 @@ export default {
},
// Filter out the routes that can be displayed in the sidebar
// And generate the internationalized title
generateRoutes(routes, basePath = '/', prefixTitle = []) {
generateRoutes (routes, basePath = '/', prefixTitle = []) {
let res = []
for (const router of routes) {
@ -135,14 +135,14 @@ export default {
}
return res
},
querySearch(query) {
querySearch (query) {
if (query !== '') {
this.options = this.fuse.search(query)
} else {
this.options = []
}
},
ishttp(url) {
ishttp (url) {
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
}
}

View File

@ -17,24 +17,24 @@
import icons from './requireIcons'
export default {
name: 'IconSelect',
data() {
data () {
return {
name: '',
iconList: icons
}
},
methods: {
filterIcons() {
filterIcons () {
this.iconList = icons
if (this.name) {
this.iconList = this.iconList.filter(item => item.includes(this.name))
}
},
selectedIcon(name) {
selectedIcon (name) {
this.$emit('selected', name)
document.body.click()
},
reset() {
reset () {
this.name = ''
this.iconList = icons
}

View File

@ -42,7 +42,7 @@
</template>
<script>
import { getToken } from "@/utils/auth";
import { getToken } from '@/utils/auth'
export default {
props: {
@ -50,17 +50,17 @@ export default {
//
limit: {
type: Number,
default: 5,
default: 5
},
// (MB)
fileSize: {
type: Number,
default: 5,
default: 5
},
// , ['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["png", "jpg", "jpeg"],
default: () => ['png', 'jpg', 'jpeg']
},
//
isShowTip: {
@ -68,39 +68,39 @@ export default {
default: true
}
},
data() {
data () {
return {
dialogImageUrl: "",
dialogImageUrl: '',
dialogVisible: false,
hideUpload: false,
baseUrl: process.env.VUE_APP_BASE_API,
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
uploadImgUrl: process.env.VUE_APP_BASE_API + '/common/upload', //
headers: {
Authorization: "Bearer " + getToken(),
Authorization: 'Bearer ' + getToken()
},
fileList: []
};
}
},
watch: {
value: {
handler(val) {
handler (val) {
if (val) {
//
const list = Array.isArray(val) ? val : this.value.split(',');
const list = Array.isArray(val) ? val : this.value.split(',')
//
this.fileList = list.map(item => {
if (typeof item === "string") {
if (typeof item === 'string') {
if (item.indexOf(this.baseUrl) === -1) {
item = { name: this.baseUrl + item, url: this.baseUrl + item };
item = { name: this.baseUrl + item, url: this.baseUrl + item }
} else {
item = { name: item, url: item };
item = { name: item, url: item }
}
}
return item;
});
return item
})
} else {
this.fileList = [];
return [];
this.fileList = []
return []
}
},
deep: true,
@ -109,87 +109,87 @@ export default {
},
computed: {
//
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
showTip () {
return this.isShowTip && (this.fileType || this.fileSize)
}
},
methods: {
//
handleRemove(file, fileList) {
const findex = this.fileList.map(f => f.name).indexOf(file.name);
this.fileList.splice(findex, 1);
this.$emit("input", this.listToString(this.fileList));
handleRemove (file, fileList) {
const findex = this.fileList.map(f => f.name).indexOf(file.name)
this.fileList.splice(findex, 1)
this.$emit('input', this.listToString(this.fileList))
},
//
handleUploadSuccess(res) {
this.fileList.push({ name: res.fileName, url: res.fileName });
this.$emit("input", this.listToString(this.fileList));
this.loading.close();
handleUploadSuccess (res) {
this.fileList.push({ name: res.fileName, url: res.fileName })
this.$emit('input', this.listToString(this.fileList))
this.loading.close()
},
// loading
handleBeforeUpload(file) {
let isImg = false;
handleBeforeUpload (file) {
let isImg = false
if (this.fileType.length) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
let fileExtension = ''
if (file.name.lastIndexOf('.') > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
}
isImg = this.fileType.some(type => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
if (file.type.indexOf(type) > -1) return true
if (fileExtension && fileExtension.indexOf(type) > -1) return true
return false
})
} else {
isImg = file.type.indexOf("image") > -1;
isImg = file.type.indexOf('image') > -1
}
if (!isImg) {
this.$message.error(
`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`
);
return false;
`文件格式不正确, 请上传${this.fileType.join('/')}图片格式文件!`
)
return false
}
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$message.error(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
return false;
this.$message.error(`上传头像图片大小不能超过 ${this.fileSize} MB!`)
return false
}
}
this.loading = this.$loading({
lock: true,
text: "上传中",
background: "rgba(0, 0, 0, 0.7)",
});
text: '上传中',
background: 'rgba(0, 0, 0, 0.7)'
})
},
//
handleExceed() {
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
handleExceed () {
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`)
},
//
handleUploadError() {
handleUploadError () {
this.$message({
type: "error",
message: "上传失败",
});
this.loading.close();
type: 'error',
message: '上传失败'
})
this.loading.close()
},
//
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
handlePictureCardPreview (file) {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
//
listToString(list, separator) {
let strs = "";
separator = separator || ",";
for (let i in list) {
strs += list[i].url.replace(this.baseUrl, "") + separator;
listToString (list, separator) {
let strs = ''
separator = separator || ','
for (const i in list) {
strs += list[i].url.replace(this.baseUrl, '') + separator
}
return strs != '' ? strs.substr(0, strs.length - 1) : '';
return strs !== '' ? strs.substr(0, strs.length - 1) : ''
}
}
};
}
</script>
<style scoped lang="scss">
// .el-upload--picture-card
@ -207,4 +207,3 @@ export default {
transform: translateY(0);
}
</style>

View File

@ -35,7 +35,7 @@ export default {
},
pageSizes: {
type: Array,
default() {
default () {
return [10, 20, 30, 50]
}
},
@ -63,30 +63,30 @@ export default {
},
computed: {
currentPage: {
get() {
get () {
return this.page
},
set(val) {
set (val) {
this.$emit('update:page', val)
}
},
pageSize: {
get() {
get () {
return this.limit
},
set(val) {
set (val) {
this.$emit('update:limit', val)
}
}
},
methods: {
handleSizeChange(val) {
handleSizeChange (val) {
this.$emit('pagination', { page: this.currentPage, limit: val })
if (this.autoScroll) {
scrollTo(0, 800)
}
},
handleCurrentChange(val) {
handleCurrentChange (val) {
this.$emit('pagination', { page: val, limit: this.pageSize })
if (this.autoScroll) {
scrollTo(0, 800)

View File

@ -26,22 +26,22 @@ export default {
},
computed: {
show: {
get() {
get () {
return this.$store.state.settings.showSettings
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
})
}
},
theme() {
theme () {
return this.$store.state.settings.theme
},
}
},
watch: {
show(value) {
show (value) {
if (value && !this.clickNotClose) {
this.addEventClick()
}
@ -52,26 +52,26 @@ export default {
}
}
},
mounted() {
mounted () {
this.insertToBody()
this.addEventClick()
},
beforeDestroy() {
beforeDestroy () {
const elx = this.$refs.rightPanel
elx.remove()
},
methods: {
addEventClick() {
addEventClick () {
window.addEventListener('click', this.closeSidebar)
},
closeSidebar(evt) {
closeSidebar (evt) {
const parent = evt.target.closest('.rightPanel')
if (!parent) {
this.show = false
window.removeEventListener('click', this.closeSidebar)
}
},
insertToBody() {
insertToBody () {
const elx = this.$refs.rightPanel
const body = document.querySelector('body')
body.insertBefore(elx, body.firstChild)

View File

@ -23,56 +23,56 @@
</template>
<script>
export default {
name: "RightToolbar",
data() {
name: 'RightToolbar',
data () {
return {
//
value: [],
//
title: "显示/隐藏",
title: '显示/隐藏',
//
open: false,
};
open: false
}
},
props: {
showSearch: {
type: Boolean,
default: true,
default: true
},
columns: {
type: Array,
type: Array
}
},
},
created() {
created () {
//
for (let item in this.columns) {
for (const item in this.columns) {
if (this.columns[item].visible === false) {
this.value.push(parseInt(item));
this.value.push(parseInt(item))
}
}
},
methods: {
//
toggleSearch() {
this.$emit("update:showSearch", !this.showSearch);
toggleSearch () {
this.$emit('update:showSearch', !this.showSearch)
},
//
refresh() {
this.$emit("queryTable");
refresh () {
this.$emit('queryTable')
},
//
dataChange(data) {
for (var item in this.columns) {
const key = this.columns[item].key;
this.columns[item].visible = !data.includes(key);
dataChange (data) {
for (const item in this.columns) {
const key = this.columns[item].key
this.columns[item].visible = !data.includes(key)
}
},
// dialog
showColumn() {
this.open = true;
},
},
};
showColumn () {
this.open = true
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-transfer__button {

View File

@ -7,13 +7,13 @@
<script>
export default {
name: 'RuoYiDoc',
data() {
data () {
return {
url: 'http://doc.ruoyi.vip/ruoyi-vue'
}
},
methods: {
goto() {
goto () {
window.open(this.url)
}
}

View File

@ -7,13 +7,13 @@
<script>
export default {
name: 'RuoYiGit',
data() {
data () {
return {
url: 'https://gitee.com/y_project/RuoYi-Vue'
}
},
methods: {
goto() {
goto () {
window.open(this.url)
}
}

View File

@ -9,34 +9,34 @@ import screenfull from 'screenfull'
export default {
name: 'Screenfull',
data() {
data () {
return {
isFullscreen: false
}
},
mounted() {
mounted () {
this.init()
},
beforeDestroy() {
beforeDestroy () {
this.destroy()
},
methods: {
click() {
click () {
if (!screenfull.isEnabled) {
this.$message({ message: '你的浏览器不支持全屏', type: 'warning' })
return false
}
screenfull.toggle()
},
change() {
change () {
this.isFullscreen = screenfull.isFullscreen
},
init() {
init () {
if (screenfull.isEnabled) {
screenfull.on('change', this.change)
}
},
destroy() {
destroy () {
if (screenfull.isEnabled) {
screenfull.off('change', this.change)
}

View File

@ -14,7 +14,7 @@
<script>
export default {
data() {
data () {
return {
sizeOptions: [
{ label: 'Default', value: 'default' },
@ -25,12 +25,12 @@ export default {
}
},
computed: {
size() {
size () {
return this.$store.getters.size
}
},
methods: {
handleSetSize(size) {
handleSetSize (size) {
this.$ELEMENT.size = size
this.$store.dispatch('app/setSize', size)
this.refreshView()
@ -39,7 +39,7 @@ export default {
type: 'success'
})
},
refreshView() {
refreshView () {
// In order to make the cached page re-rendered
this.$store.dispatch('tagsView/delAllCachedViews', this.$route)

View File

@ -21,20 +21,20 @@ export default {
}
},
computed: {
isExternal() {
isExternal () {
return isExternal(this.iconClass)
},
iconName() {
iconName () {
return `#icon-${this.iconClass}`
},
svgClass() {
svgClass () {
if (this.className) {
return 'svg-icon ' + this.className
} else {
return 'svg-icon'
}
},
styleExternalIcon() {
styleExternalIcon () {
return {
mask: `url(${this.iconClass}) no-repeat 50% 50%`,
'-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`

View File

@ -12,25 +12,25 @@ const version = require('element-ui/package.json').version // element-ui version
const ORIGINAL_THEME = '#409EFF' // default color
export default {
data() {
data () {
return {
chalk: '', // content of theme-chalk css
theme: ''
}
},
computed: {
defaultTheme() {
defaultTheme () {
return this.$store.state.settings.theme
}
},
watch: {
defaultTheme: {
handler: function(val, oldVal) {
handler: function (val, oldVal) {
this.theme = val
},
immediate: true
},
async theme(val) {
async theme (val) {
const oldVal = this.chalk ? this.theme : ORIGINAL_THEME
if (typeof val !== 'string') return
const themeCluster = this.getThemeCluster(val.replace('#', ''))
@ -86,7 +86,7 @@ export default {
},
methods: {
updateStyle(style, oldCluster, newCluster) {
updateStyle (style, oldCluster, newCluster) {
let newStyle = style
oldCluster.forEach((color, index) => {
newStyle = newStyle.replace(new RegExp(color, 'ig'), newCluster[index])
@ -94,7 +94,7 @@ export default {
return newStyle
},
getCSSString(url, variable) {
getCSSString (url, variable) {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
@ -108,7 +108,7 @@ export default {
})
},
getThemeCluster(theme) {
getThemeCluster (theme) {
const tintColor = (color, tint) => {
let red = parseInt(color.slice(0, 2), 16)
let green = parseInt(color.slice(2, 4), 16)

View File

@ -28,10 +28,10 @@
</template>
<script>
import { constantRoutes } from "@/router";
import { constantRoutes } from '@/router'
export default {
data() {
data () {
return {
//
visibleNumber: 5,
@ -39,133 +39,138 @@ export default {
isFrist: false,
// index
currentIndex: undefined
};
}
},
computed: {
theme() {
return this.$store.state.settings.theme;
theme () {
return this.$store.state.settings.theme
},
//
topMenus() {
let topMenus = [];
topMenus () {
const topMenus = []
this.routers.map((menu) => {
if (menu.hidden !== true) {
//
if (menu.path === "/") {
topMenus.push(menu.children[0]);
if (menu.path === '/') {
topMenus.push(menu.children[0])
} else {
topMenus.push(menu);
topMenus.push(menu)
}
}
});
return topMenus;
return undefined
})
return topMenus
},
//
routers() {
return this.$store.state.permission.topbarRouters;
routers () {
return this.$store.state.permission.topbarRouters
},
//
childrenMenus() {
var childrenMenus = [];
childrenMenus () {
const childrenMenus = []
this.routers.map((router) => {
for (var item in router.children) {
for (const item in router.children) {
if (router.children[item].parentPath === undefined) {
if(router.path === "/") {
router.children[item].path = "/redirect/" + router.children[item].path;
if (router.path === '/') {
router.children[item].path = '/redirect/' + router.children[item].path
} else {
if(!this.ishttp(router.children[item].path)) {
router.children[item].path = router.path + "/" + router.children[item].path;
if (!this.ishttp(router.children[item].path)) {
router.children[item].path = router.path + '/' + router.children[item].path
}
}
router.children[item].parentPath = router.path;
router.children[item].parentPath = router.path
}
childrenMenus.push(router.children[item]);
childrenMenus.push(router.children[item])
}
});
return constantRoutes.concat(childrenMenus);
return undefined
})
return constantRoutes.concat(childrenMenus)
},
//
activeMenu() {
const path = this.$route.path;
let activePath = this.defaultRouter();
if (path.lastIndexOf("/") > 0) {
const tmpPath = path.substring(1, path.length);
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
} else if ("/index" == path || "" == path) {
activeMenu () {
const path = this.$route.path
let activePath = this.defaultRouter()
if (path.lastIndexOf('/') > 0) {
const tmpPath = path.substring(1, path.length)
activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/'))
} else if (path === '/index' || path === '') {
if (!this.isFrist) {
this.isFrist = true;
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.isFrist = true
} else {
activePath = "index";
activePath = 'index'
}
}
var routes = this.activeRoutes(activePath);
const routes = this.activeRoutes(activePath)
if (routes.length === 0) {
activePath = this.currentIndex || this.defaultRouter()
this.activeRoutes(activePath);
this.activeRoutes(activePath)
}
return activePath
}
return activePath;
},
},
beforeMount() {
beforeMount () {
window.addEventListener('resize', this.setVisibleNumber)
},
beforeDestroy() {
beforeDestroy () {
window.removeEventListener('resize', this.setVisibleNumber)
},
mounted() {
this.setVisibleNumber();
mounted () {
this.setVisibleNumber()
},
methods: {
//
setVisibleNumber() {
const width = document.body.getBoundingClientRect().width / 3;
this.visibleNumber = parseInt(width / 85);
setVisibleNumber () {
const width = document.body.getBoundingClientRect().width / 3
this.visibleNumber = parseInt(width / 85)
},
//
defaultRouter() {
let router;
defaultRouter () {
let router
Object.keys(this.routers).some((key) => {
if (!this.routers[key].hidden) {
router = this.routers[key].path;
return true;
router = this.routers[key].path
return true
}
});
return router;
return undefined
})
return router
},
//
handleSelect(key, keyPath) {
this.currentIndex = key;
handleSelect (key, keyPath) {
this.currentIndex = key
if (this.ishttp(key)) {
// http(s)://
window.open(key, "_blank");
} else if (key.indexOf("/redirect") !== -1) {
window.open(key, '_blank')
} else if (key.indexOf('/redirect') !== -1) {
// /redirect
this.$router.push({ path: key.replace("/redirect", "") });
this.$router.push({ path: key.replace('/redirect', '') })
} else {
//
this.activeRoutes(key);
this.activeRoutes(key)
}
},
//
activeRoutes(key) {
var routes = [];
activeRoutes (key) {
const routes = []
if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => {
if (key == item.parentPath || (key == "index" && "" == item.path)) {
routes.push(item);
if (key === item.parentPath || (key === 'index' && item.path === '')) {
routes.push(item)
}
});
return undefined
})
}
if(routes.length > 0) {
this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
if (routes.length > 0) {
this.$store.commit('SET_SIDEBAR_ROUTERS', routes)
}
return routes;
return routes
},
ishttp(url) {
ishttp (url) {
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
}
},
};
}
}
</script>
<style lang="scss">

View File

@ -14,23 +14,23 @@ export default {
src: {
type: String,
required: true
}
},
},
data() {
data () {
return {
height: document.documentElement.clientHeight - 94.5 + "px;",
height: document.documentElement.clientHeight - 94.5 + 'px;',
loading: true,
url: this.src
};
}
},
mounted: function () {
setTimeout(() => {
this.loading = false;
}, 300);
const that = this;
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 94.5 + "px;";
};
this.loading = false
}, 300)
const that = this
window.onresize = function temp () {
that.height = document.documentElement.clientHeight - 94.5 + 'px;'
}
};
}
}
</script>

View File

@ -4,61 +4,60 @@
*/
export default {
bind(el, binding, vnode, oldVnode) {
bind (el, binding, vnode, oldVnode) {
const value = binding.value
if (value == false) return
if (value === false) return
// 获取拖拽内容头部
const dialogHeaderEl = el.querySelector('.el-dialog__header');
const dragDom = el.querySelector('.el-dialog');
dialogHeaderEl.style.cursor = 'move';
const dialogHeaderEl = el.querySelector('.el-dialog__header')
const dragDom = el.querySelector('.el-dialog')
dialogHeaderEl.style.cursor = 'move'
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
dragDom.style.position = 'absolute';
dragDom.style.marginTop = 0;
let width = dragDom.style.width;
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
dragDom.style.position = 'absolute'
dragDom.style.marginTop = 0
let width = dragDom.style.width
if (width.includes('%')) {
width = +document.body.clientWidth * (+width.replace(/\%/g, '') / 100);
width = +document.body.clientWidth * (+width.replace(/%/g, '') / 100)
} else {
width = +width.replace(/\px/g, '');
width = +width.replace(/\px/g, '')
}
dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`;
dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`
// 鼠标按下事件
dialogHeaderEl.onmousedown = (e) => {
// 鼠标按下,计算当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离)
const disX = e.clientX - dialogHeaderEl.offsetLeft;
const disY = e.clientY - dialogHeaderEl.offsetTop;
const disX = e.clientX - dialogHeaderEl.offsetLeft
const disY = e.clientY - dialogHeaderEl.offsetTop
// 获取到的值带px 正则匹配替换
let styL, styT;
let styL, styT
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
if (sty.left.includes('%')) {
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100)
styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100)
} else {
styL = +sty.left.replace(/\px/g, '');
styT = +sty.top.replace(/\px/g, '');
styL = +sty.left.replace(/\px/g, '')
styT = +sty.top.replace(/\px/g, '')
};
// 鼠标拖拽事件
document.onmousemove = function (e) {
// 通过事件委托,计算移动的距离 (开始拖拽至结束拖拽的距离)
const l = e.clientX - disX;
const t = e.clientY - disY;
const l = e.clientX - disX
const t = e.clientY - disY
let finallyL = l + styL
let finallyT = t + styT
const finallyL = l + styL
const finallyT = t + styT
// 移动当前元素
dragDom.style.left = `${finallyL}px`;
dragDom.style.top = `${finallyT}px`;
};
dragDom.style.left = `${finallyL}px`
dragDom.style.top = `${finallyT}px`
}
document.onmouseup = function (e) {
document.onmousemove = null;
document.onmouseup = null;
};
document.onmousemove = null
document.onmouseup = null
}
}
};
}
}

View File

@ -4,7 +4,7 @@ import dialogDrag from './dialog/drag'
import dialogDragWidth from './dialog/dragWidth'
import dialogDragHeight from './dialog/dragHeight'
const install = function(Vue) {
const install = function (Vue) {
Vue.directive('hasRole', hasRole)
Vue.directive('hasPermi', hasPermi)
Vue.directive('dialogDrag', dialogDrag)
@ -13,9 +13,10 @@ const install = function(Vue) {
}
if (window.Vue) {
window['hasRole'] = hasRole
window['hasPermi'] = hasPermi
Vue.use(install); // eslint-disable-line
window.hasRole = hasRole
window.hasPermi = hasPermi
window.dialogDrag = dialogDrag
window.Vue.use(install)
}
export default install

View File

@ -1,4 +1,4 @@
/**
/**
* v-hasPermi 操作权限处理
* Copyright (c) 2019 ruoyi
*/
@ -6,23 +6,23 @@
import store from '@/store'
export default {
inserted(el, binding, vnode) {
inserted (el, binding, vnode) {
const { value } = binding
const all_permission = "*:*:*";
const allPermission = '*:*:*'
const permissions = store.getters && store.getters.permissions
if (value && value instanceof Array && value.length > 0) {
const permissionFlag = value
const hasPermissions = permissions.some(permission => {
return all_permission === permission || permissionFlag.includes(permission)
return allPermission === permission || permissionFlag.includes(permission)
})
if (!hasPermissions) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置操作权限标签值`)
throw new Error('请设置操作权限标签值')
}
}
}

View File

@ -1,4 +1,4 @@
/**
/**
* v-hasRole 角色权限处理
* Copyright (c) 2019 ruoyi
*/
@ -6,23 +6,23 @@
import store from '@/store'
export default {
inserted(el, binding, vnode) {
inserted (el, binding, vnode) {
const { value } = binding
const super_admin = "admin";
const superAdmin = 'admin'
const roles = store.getters && store.getters.roles
if (value && value instanceof Array && value.length > 0) {
const roleFlag = value
const hasRole = roles.some(role => {
return super_admin === role || roleFlag.includes(role)
return superAdmin === role || roleFlag.includes(role)
})
if (!hasRole) {
el.parentNode && el.parentNode.removeChild(el)
}
} else {
throw new Error(`请设置角色权限标签值"`)
throw new Error('请设置角色权限标签值"')
}
}
}

View File

@ -12,10 +12,10 @@
export default {
name: 'AppMain',
computed: {
cachedViews() {
cachedViews () {
return this.$store.state.tagsView.cachedViews
},
key() {
key () {
return this.$route.path
}
}

View File

@ -1,16 +1,16 @@
<script>
export default {
data() {
return {};
data () {
return {}
},
render() {
const { $route: { meta: { link } }, } = this;
if ({ link }.link === "") {
return "404";
render () {
const { $route: { meta: { link } } } = this
if ({ link }.link === '') {
return '404'
}
let url = { link }.link;
const height = document.documentElement.clientHeight - 94.5 + "px";
const style = { height: height };
const url = { link }.link
const height = document.documentElement.clientHeight - 94.5 + 'px'
const style = { height: height }
return (
<div style={style}>
@ -21,7 +21,7 @@ export default {
scrolling="auto"
></iframe>
</div>
);
},
};
)
}
}
</script>

View File

@ -75,10 +75,10 @@ export default {
'device'
]),
setting: {
get() {
get () {
return this.$store.state.settings.showSettings
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'showSettings',
value: val
@ -86,25 +86,25 @@ export default {
}
},
topNav: {
get() {
get () {
return this.$store.state.settings.topNav
}
}
},
methods: {
toggleSideBar() {
toggleSideBar () {
this.$store.dispatch('app/toggleSideBar')
},
async logout() {
async logout () {
this.$confirm('确定注销并退出系统吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index';
location.href = '/index'
})
}).catch(() => {});
}).catch(() => {})
}
}
}

View File

@ -80,18 +80,18 @@ import ThemePicker from '@/components/ThemePicker'
export default {
components: { ThemePicker },
data() {
data () {
return {
theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme
};
}
},
computed: {
fixedHeader: {
get() {
get () {
return this.$store.state.settings.fixedHeader
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'fixedHeader',
value: val
@ -99,24 +99,24 @@ export default {
}
},
topNav: {
get() {
get () {
return this.$store.state.settings.topNav
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'topNav',
value: val
})
if (!val) {
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes);
this.$store.commit('SET_SIDEBAR_ROUTERS', this.$store.state.permission.defaultRoutes)
}
}
},
tagsView: {
get() {
get () {
return this.$store.state.settings.tagsView
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'tagsView',
value: val
@ -124,10 +124,10 @@ export default {
}
},
sidebarLogo: {
get() {
get () {
return this.$store.state.settings.sidebarLogo
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'sidebarLogo',
value: val
@ -135,42 +135,42 @@ export default {
}
},
dynamicTitle: {
get() {
get () {
return this.$store.state.settings.dynamicTitle
},
set(val) {
set (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'dynamicTitle',
value: val
})
}
},
}
},
methods: {
themeChange(val) {
themeChange (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'theme',
value: val
})
this.theme = val;
this.theme = val
},
handleTheme(val) {
handleTheme (val) {
this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme',
value: val
})
this.sideTheme = val;
this.sideTheme = val
},
saveSetting() {
saveSetting () {
const loading = this.$loading({
lock: true,
fullscreen: false,
text: "正在保存到本地,请稍后...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
text: '正在保存到本地,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
localStorage.setItem(
"layout-setting",
'layout-setting',
`{
"topNav":${this.topNav},
"tagsView":${this.tagsView},
@ -180,19 +180,19 @@ export default {
"sideTheme":"${this.sideTheme}",
"theme":"${this.theme}"
}`
);
)
setTimeout(loading.close(), 1000)
},
resetSetting() {
resetSetting () {
this.$loading({
lock: true,
fullscreen: false,
text: "正在清除设置缓存并刷新,请稍后...",
spinner: "el-icon-loading",
background: "rgba(0, 0, 0, 0.7)"
});
localStorage.removeItem("layout-setting")
setTimeout("window.location.reload()", 1000)
text: '正在清除设置缓存并刷新,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
localStorage.removeItem('layout-setting')
setTimeout(window.location.reload(), 1000)
}
}
}

View File

@ -1,15 +1,15 @@
export default {
computed: {
device() {
device () {
return this.$store.state.app.device
}
},
mounted() {
mounted () {
// In order to fix the click on menu on the ios device will trigger the mouseleave bug
this.fixBugIniOS()
},
methods: {
fixBugIniOS() {
fixBugIniOS () {
const $subMenu = this.$refs.subMenu
if ($subMenu) {
const handleMouseleave = $subMenu.handleMouseleave

View File

@ -12,7 +12,7 @@ export default {
default: ''
}
},
render(h, context) {
render (h, context) {
const { icon, title } = context.props
const vnodes = []

View File

@ -15,10 +15,10 @@ export default {
}
},
computed: {
isExternal() {
isExternal () {
return isExternal(this.to)
},
type() {
type () {
if (this.isExternal) {
return 'a'
}
@ -26,7 +26,7 @@ export default {
}
},
methods: {
linkProps(to) {
linkProps (to) {
if (this.isExternal) {
return {
href: to,

View File

@ -26,14 +26,14 @@ export default {
}
},
computed: {
variables() {
return variables;
variables () {
return variables
},
sideTheme() {
sideTheme () {
return this.$store.state.settings.sideTheme
}
},
data() {
data () {
return {
title: '若依管理系统',
logo: logoImg

View File

@ -50,14 +50,14 @@ export default {
default: ''
}
},
data() {
data () {
this.onlyOneChild = null
return {}
},
methods: {
hasOneShowingChild(children = [], parent) {
hasOneShowingChild (children = [], parent) {
if (!children) {
children = [];
children = []
}
const showingChildren = children.filter(item => {
if (item.hidden) {
@ -76,13 +76,13 @@ export default {
// Show parent if there are no child router to display
if (showingChildren.length === 0) {
this.onlyOneChild = { ... parent, path: '', noShowingChildren: true }
this.onlyOneChild = { ...parent, path: '', noShowingChildren: true }
return true
}
return false
},
resolvePath(routePath) {
resolvePath (routePath) {
if (isExternal(routePath)) {
return routePath
}

View File

@ -24,34 +24,34 @@
</template>
<script>
import { mapGetters, mapState } from "vuex";
import Logo from "./Logo";
import SidebarItem from "./SidebarItem";
import variables from "@/assets/styles/variables.scss";
import { mapGetters, mapState } from 'vuex'
import Logo from './Logo'
import SidebarItem from './SidebarItem'
import variables from '@/assets/styles/variables.scss'
export default {
components: { SidebarItem, Logo },
computed: {
...mapState(["settings"]),
...mapGetters(["sidebarRouters", "sidebar"]),
activeMenu() {
const route = this.$route;
const { meta, path } = route;
...mapState(['settings']),
...mapGetters(['sidebarRouters', 'sidebar']),
activeMenu () {
const route = this.$route
const { meta, path } = route
// if set path, the sidebar will highlight the path you set
if (meta.activeMenu) {
return meta.activeMenu;
return meta.activeMenu
}
return path;
return path
},
showLogo() {
return this.$store.state.settings.sidebarLogo;
showLogo () {
return this.$store.state.settings.sidebarLogo
},
variables() {
return variables;
variables () {
return variables
},
isCollapse() {
return !this.sidebar.opened;
isCollapse () {
return !this.sidebar.opened
}
}
};
}
</script>

View File

@ -9,32 +9,32 @@ const tagAndTagSpacing = 4 // tagAndTagSpacing
export default {
name: 'ScrollPane',
data() {
data () {
return {
left: 0
}
},
computed: {
scrollWrapper() {
scrollWrapper () {
return this.$refs.scrollContainer.$refs.wrap
}
},
mounted() {
mounted () {
this.scrollWrapper.addEventListener('scroll', this.emitScroll, true)
},
beforeDestroy() {
beforeDestroy () {
this.scrollWrapper.removeEventListener('scroll', this.emitScroll)
},
methods: {
handleScroll(e) {
handleScroll (e) {
const eventDelta = e.wheelDelta || -e.deltaY * 40
const $scrollWrapper = this.scrollWrapper
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
},
emitScroll() {
emitScroll () {
this.$emit('scroll')
},
moveToTarget(currentTag) {
moveToTarget (currentTag) {
const $container = this.$refs.scrollContainer.$el
const $containerWidth = $container.offsetWidth
const $scrollWrapper = this.scrollWrapper

View File

@ -33,7 +33,7 @@ import path from 'path'
export default {
components: { ScrollPane },
data() {
data () {
return {
visible: false,
top: 0,
@ -43,22 +43,22 @@ export default {
}
},
computed: {
visitedViews() {
visitedViews () {
return this.$store.state.tagsView.visitedViews
},
routes() {
routes () {
return this.$store.state.permission.routes
},
theme() {
return this.$store.state.settings.theme;
theme () {
return this.$store.state.settings.theme
}
},
watch: {
$route() {
$route () {
this.addTags()
this.moveToCurrentTag()
},
visible(value) {
visible (value) {
if (value) {
document.body.addEventListener('click', this.closeMenu)
} else {
@ -66,32 +66,32 @@ export default {
}
}
},
mounted() {
mounted () {
this.initTags()
this.addTags()
},
methods: {
isActive(route) {
isActive (route) {
return route.path === this.$route.path
},
activeStyle(tag) {
if (!this.isActive(tag)) return {};
activeStyle (tag) {
if (!this.isActive(tag)) return {}
return {
"background-color": this.theme,
"border-color": this.theme
};
'background-color': this.theme,
'border-color': this.theme
}
},
isAffix(tag) {
isAffix (tag) {
return tag.meta && tag.meta.affix
},
isLastView() {
isLastView () {
try {
return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
} catch (err) {
return false
}
},
filterAffixTags(routes, basePath = '/') {
filterAffixTags (routes, basePath = '/') {
let tags = []
routes.forEach(route => {
if (route.meta && route.meta.affix) {
@ -112,7 +112,7 @@ export default {
})
return tags
},
initTags() {
initTags () {
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
for (const tag of affixTags) {
// Must have tag name
@ -121,14 +121,14 @@ export default {
}
}
},
addTags() {
addTags () {
const { name } = this.$route
if (name) {
this.$store.dispatch('tagsView/addView', this.$route)
}
return false
},
moveToCurrentTag() {
moveToCurrentTag () {
const tags = this.$refs.tag
this.$nextTick(() => {
for (const tag of tags) {
@ -143,7 +143,7 @@ export default {
}
})
},
refreshSelectedTag(view) {
refreshSelectedTag (view) {
this.$store.dispatch('tagsView/delCachedView', view).then(() => {
const { fullPath } = view
this.$nextTick(() => {
@ -153,27 +153,27 @@ export default {
})
})
},
closeSelectedTag(view) {
closeSelectedTag (view) {
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
if (this.isActive(view)) {
this.toLastView(visitedViews, view)
}
})
},
closeRightTags() {
closeRightTags () {
this.$store.dispatch('tagsView/delRightTags', this.selectedTag).then(visitedViews => {
if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
this.toLastView(visitedViews)
}
})
},
closeOthersTags() {
this.$router.push(this.selectedTag).catch(()=>{});
closeOthersTags () {
this.$router.push(this.selectedTag).catch(() => {})
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag()
})
},
closeAllTags(view) {
closeAllTags (view) {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
if (this.affixTags.some(tag => tag.path === this.$route.path)) {
return
@ -181,7 +181,7 @@ export default {
this.toLastView(visitedViews, view)
})
},
toLastView(visitedViews, view) {
toLastView (visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
this.$router.push(latestView.fullPath)
@ -196,7 +196,7 @@ export default {
}
}
},
openMenu(tag, e) {
openMenu (tag, e) {
const menuMinWidth = 105
const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
const offsetWidth = this.$el.offsetWidth // container width
@ -213,10 +213,10 @@ export default {
this.visible = true
this.selectedTag = tag
},
closeMenu() {
closeMenu () {
this.visible = false
},
handleScroll() {
handleScroll () {
this.closeMenu()
}
}

View File

@ -42,7 +42,7 @@ export default {
needTagsView: state => state.settings.tagsView,
fixedHeader: state => state.settings.fixedHeader
}),
classObj() {
classObj () {
return {
hideSidebar: !this.sidebar.opened,
openSidebar: this.sidebar.opened,
@ -50,8 +50,8 @@ export default {
mobile: this.device === 'mobile'
}
},
variables() {
return variables;
variables () {
return variables
}
},
methods: {

View File

@ -5,19 +5,19 @@ const WIDTH = 992 // refer to Bootstrap's responsive design
export default {
watch: {
$route(route) {
$route (route) {
if (this.device === 'mobile' && this.sidebar.opened) {
store.dispatch('app/closeSideBar', { withoutAnimation: false })
}
}
},
beforeMount() {
beforeMount () {
window.addEventListener('resize', this.$_resizeHandler)
},
beforeDestroy() {
beforeDestroy () {
window.removeEventListener('resize', this.$_resizeHandler)
},
mounted() {
mounted () {
const isMobile = this.$_isMobile()
if (isMobile) {
store.dispatch('app/toggleDevice', 'mobile')
@ -27,11 +27,11 @@ export default {
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_isMobile() {
$_isMobile () {
const rect = body.getBoundingClientRect()
return rect.width - 1 < WIDTH
},
$_resizeHandler() {
$_resizeHandler () {
if (!document.hidden) {
const isMobile = this.$_isMobile()
store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')

View File

@ -10,22 +10,22 @@ import '@/assets/styles/ruoyi.scss' // ruoyi css
import App from './App'
import store from './store'
import router from './router'
import directive from './directive' //directive
import directive from './directive' // directive
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
import Pagination from "@/components/Pagination";
import { getDicts } from '@/api/system/dict/data'
import { getConfigKey } from '@/api/system/config'
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from '@/utils/ruoyi'
import Pagination from '@/components/Pagination'
// 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar"
import RightToolbar from '@/components/RightToolbar'
// 富文本组件
import Editor from "@/components/Editor"
import Editor from '@/components/Editor'
// 文件上传组件
import FileUpload from "@/components/FileUpload"
import FileUpload from '@/components/FileUpload'
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"
import ImageUpload from '@/components/ImageUpload'
// 字典标签组件
import DictTag from '@/components/DictTag'
// 头部标签组件
@ -43,15 +43,15 @@ Vue.prototype.download = download
Vue.prototype.handleTree = handleTree
Vue.prototype.msgSuccess = function (msg) {
this.$message({ showClose: true, message: msg, type: "success" });
this.$message({ showClose: true, message: msg, type: 'success' })
}
Vue.prototype.msgError = function (msg) {
this.$message({ showClose: true, message: msg, type: "error" });
this.$message({ showClose: true, message: msg, type: 'error' })
}
Vue.prototype.msgInfo = function (msg) {
this.$message.info(msg);
this.$message.info(msg)
}
// 全局组件挂载
@ -80,6 +80,7 @@ Vue.use(Element, {
Vue.config.productionTip = false
// eslint-disable-next-line no-new
new Vue({
el: '#app',
router,

View File

@ -13,7 +13,7 @@ router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/
/* has token */
if (to.path === '/login') {
next({ path: '/' })
NProgress.done()

View File

@ -1,11 +1,11 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
/* Layout */
import Layout from '@/layout'
Vue.use(Router)
/**
* Note: 路由配置项
*
@ -94,7 +94,7 @@ export const constantRoutes = [
path: 'role/:userId(\\d+)',
component: (resolve) => require(['@/views/system/user/authRole'], resolve),
name: 'AuthRole',
meta: { title: '分配角色', activeMenu: '/system/user'}
meta: { title: '分配角色', activeMenu: '/system/user' }
}
]
},
@ -107,7 +107,7 @@ export const constantRoutes = [
path: 'user/:roleId(\\d+)',
component: (resolve) => require(['@/views/system/role/authUser'], resolve),
name: 'AuthUser',
meta: { title: '分配用户', activeMenu: '/system/role'}
meta: { title: '分配用户', activeMenu: '/system/role' }
}
]
},
@ -120,7 +120,7 @@ export const constantRoutes = [
path: 'index/:dictId(\\d+)',
component: (resolve) => require(['@/views/system/dict/data'], resolve),
name: 'Data',
meta: { title: '字典数据', activeMenu: '/system/dict'}
meta: { title: '字典数据', activeMenu: '/system/dict' }
}
]
},
@ -133,7 +133,7 @@ export const constantRoutes = [
path: 'index',
component: (resolve) => require(['@/views/monitor/job/log'], resolve),
name: 'JobLog',
meta: { title: '调度日志', activeMenu: '/monitor/job'}
meta: { title: '调度日志', activeMenu: '/monitor/job' }
}
]
},
@ -146,7 +146,7 @@ export const constantRoutes = [
path: 'index/:tableId(\\d+)',
component: (resolve) => require(['@/views/tool/gen/editTable'], resolve),
name: 'GenEdit',
meta: { title: '修改生成配置', activeMenu: '/tool/gen'}
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
}
]
}

View File

@ -11,8 +11,8 @@ const getters = {
roles: state => state.user.roles,
permissions: state => state.user.permissions,
permission_routes: state => state.permission.routes,
topbarRouters:state => state.permission.topbarRouters,
defaultRoutes:state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters,
topbarRouters: state => state.permission.topbarRouters,
defaultRoutes: state => state.permission.defaultRoutes,
sidebarRouters: state => state.permission.sidebarRouters
}
export default getters

View File

@ -34,16 +34,16 @@ const mutations = {
}
const actions = {
toggleSideBar({ commit }) {
toggleSideBar ({ commit }) {
commit('TOGGLE_SIDEBAR')
},
closeSideBar({ commit }, { withoutAnimation }) {
closeSideBar ({ commit }, { withoutAnimation }) {
commit('CLOSE_SIDEBAR', withoutAnimation)
},
toggleDevice({ commit }, device) {
toggleDevice ({ commit }, device) {
commit('TOGGLE_DEVICE', device)
},
setSize({ commit }, size) {
setSize ({ commit }, size) {
commit('SET_SIZE', size)
}
}

View File

@ -1,7 +1,7 @@
import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu'
import Layout from '@/layout/index'
import ParentView from '@/components/ParentView';
import ParentView from '@/components/ParentView'
import InnerLink from '@/layout/components/InnerLink'
const permission = {
@ -24,17 +24,17 @@ const permission = {
// 顶部导航菜单默认添加统计报表栏指向首页
const index = [{
path: 'index',
meta: { title: '统计报表', icon: 'dashboard'}
meta: { title: '统计报表', icon: 'dashboard' }
}]
state.topbarRouters = routes.concat(index);
state.topbarRouters = routes.concat(index)
},
SET_SIDEBAR_ROUTERS: (state, routes) => {
state.sidebarRouters = routes
},
}
},
actions: {
// 生成路由
GenerateRoutes({ commit }) {
GenerateRoutes ({ commit }) {
return new Promise(resolve => {
// 向后端请求路由数据
getRouters().then(res => {
@ -55,7 +55,7 @@ const permission = {
}
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
function filterAsyncRouter (asyncRouterMap, lastRouter = false, type = false) {
return asyncRouterMap.filter(route => {
if (type && route.children) {
route.children = filterChildren(route.children)
@ -72,18 +72,18 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
route.component = loadView(route.component)
}
}
if (route.children != null && route.children && route.children.length) {
if (route.children !== null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, route, type)
} else {
delete route['children']
delete route['redirect']
delete route.children
delete route.redirect
}
return true
})
}
function filterChildren(childrenMap, lastRouter = false) {
var children = []
function filterChildren (childrenMap, lastRouter = false) {
let children = []
childrenMap.forEach((el, index) => {
if (el.children && el.children.length) {
if (el.component === 'ParentView') {

View File

@ -17,19 +17,19 @@ const state = {
}
const mutations = {
CHANGE_SETTING: (state, { key, value }) => {
if (state.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(state, key)) {
state[key] = value
}
}
}
const actions = {
// 修改布局设置
changeSetting({ commit }, data) {
// <EFBFBD>޸IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
changeSetting ({ commit }, data) {
commit('CHANGE_SETTING', data)
},
// 设置网页标题
setTitle({ commit }, title) {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
setTitle ({ commit }, title) {
state.title = title
}
}
@ -40,4 +40,3 @@ export default {
mutations,
actions
}

View File

@ -83,18 +83,18 @@ const mutations = {
}
const actions = {
addView({ dispatch }, view) {
addView ({ dispatch }, view) {
dispatch('addVisitedView', view)
dispatch('addCachedView', view)
},
addVisitedView({ commit }, view) {
addVisitedView ({ commit }, view) {
commit('ADD_VISITED_VIEW', view)
},
addCachedView({ commit }, view) {
addCachedView ({ commit }, view) {
commit('ADD_CACHED_VIEW', view)
},
delView({ dispatch, state }, view) {
delView ({ dispatch, state }, view) {
return new Promise(resolve => {
dispatch('delVisitedView', view)
dispatch('delCachedView', view)
@ -104,20 +104,20 @@ const actions = {
})
})
},
delVisitedView({ commit, state }, view) {
delVisitedView ({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_VISITED_VIEW', view)
resolve([...state.visitedViews])
})
},
delCachedView({ commit, state }, view) {
delCachedView ({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_CACHED_VIEW', view)
resolve([...state.cachedViews])
})
},
delOthersViews({ dispatch, state }, view) {
delOthersViews ({ dispatch, state }, view) {
return new Promise(resolve => {
dispatch('delOthersVisitedViews', view)
dispatch('delOthersCachedViews', view)
@ -127,20 +127,20 @@ const actions = {
})
})
},
delOthersVisitedViews({ commit, state }, view) {
delOthersVisitedViews ({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_OTHERS_VISITED_VIEWS', view)
resolve([...state.visitedViews])
})
},
delOthersCachedViews({ commit, state }, view) {
delOthersCachedViews ({ commit, state }, view) {
return new Promise(resolve => {
commit('DEL_OTHERS_CACHED_VIEWS', view)
resolve([...state.cachedViews])
})
},
delAllViews({ dispatch, state }, view) {
delAllViews ({ dispatch, state }, view) {
return new Promise(resolve => {
dispatch('delAllVisitedViews', view)
dispatch('delAllCachedViews', view)
@ -150,24 +150,24 @@ const actions = {
})
})
},
delAllVisitedViews({ commit, state }) {
delAllVisitedViews ({ commit, state }) {
return new Promise(resolve => {
commit('DEL_ALL_VISITED_VIEWS')
resolve([...state.visitedViews])
})
},
delAllCachedViews({ commit, state }) {
delAllCachedViews ({ commit, state }) {
return new Promise(resolve => {
commit('DEL_ALL_CACHED_VIEWS')
resolve([...state.cachedViews])
})
},
updateVisitedView({ commit }, view) {
updateVisitedView ({ commit }, view) {
commit('UPDATE_VISITED_VIEW', view)
},
delRightTags({ commit }, view) {
delRightTags ({ commit }, view) {
return new Promise(resolve => {
commit('DEL_RIGHT_VIEWS', view)
resolve([...state.visitedViews])

View File

@ -30,7 +30,7 @@ const user = {
actions: {
// 登录
Login({ commit }, userInfo) {
Login ({ commit }, userInfo) {
const username = userInfo.username.trim()
const password = userInfo.password
const code = userInfo.code
@ -47,11 +47,11 @@ const user = {
},
// 获取用户信息
GetInfo({ commit, state }) {
GetInfo ({ commit, state }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
const user = res.user
const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
const avatar = user.avatar === '' ? 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)
@ -68,7 +68,7 @@ const user = {
},
// 退出系统
LogOut({ commit, state }) {
LogOut ({ commit, state }) {
return new Promise((resolve, reject) => {
logout(state.token).then(() => {
commit('SET_TOKEN', '')
@ -83,7 +83,7 @@ const user = {
},
// 前端 登出
FedLogOut({ commit }) {
FedLogOut ({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
removeToken()

View File

@ -2,14 +2,14 @@ import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'
export function getToken() {
export function getToken () {
return Cookies.get(TokenKey)
}
export function setToken(token) {
export function setToken (token) {
return Cookies.set(TokenKey, token)
}
export function removeToken() {
export function removeToken () {
return Cookies.remove(TokenKey)
}

View File

@ -1,6 +1,6 @@
export default {
'401': '认证失败,无法访问系统资源',
'403': '当前操作没有权限',
'404': '访问资源不存在',
'default': '系统未知错误,请反馈给管理员'
401: '认证失败,无法访问系统资源',
403: '当前操作没有权限',
404: '访问资源不存在',
default: '系统未知错误,请反馈给管理员'
}

View File

@ -3,7 +3,7 @@ const styles = {
'el-upload': '.el-upload__tip{line-height: 1.2;}'
}
function addCss(cssList, el) {
function addCss (cssList, el) {
const css = styles[el.tag]
css && cssList.indexOf(css) === -1 && cssList.push(css)
if (el.children) {
@ -11,7 +11,7 @@ function addCss(cssList, el) {
}
}
export function makeUpCss(conf) {
export function makeUpCss (conf) {
const cssList = []
conf.fields.forEach(el => addCss(cssList, el))
return cssList.join('\n')

View File

@ -4,7 +4,7 @@ import { trigger } from './config'
let confGlobal
let someSpanIsNot24
export function dialogWrapper(str) {
export function dialogWrapper (str) {
return `<el-dialog v-bind="$attrs" v-on="$listeners" @open="onOpen" @close="onClose" title="Dialog Titile">
${str}
<div slot="footer">
@ -14,7 +14,7 @@ export function dialogWrapper(str) {
</el-dialog>`
}
export function vueTemplate(str) {
export function vueTemplate (str) {
return `<template>
<div>
${str}
@ -22,19 +22,19 @@ export function vueTemplate(str) {
</template>`
}
export function vueScript(str) {
export function vueScript (str) {
return `<script>
${str}
</script>`
}
export function cssStyle(cssStr) {
export function cssStyle (cssStr) {
return `<style>
${cssStr}
</style>`
}
function buildFormTemplate(conf, child, type) {
function buildFormTemplate (conf, child, type) {
let labelPosition = ''
if (conf.labelPosition !== 'right') {
labelPosition = `label-position="${conf.labelPosition}"`
@ -52,7 +52,7 @@ function buildFormTemplate(conf, child, type) {
return str
}
function buildFromBtns(conf, type) {
function buildFromBtns (conf, type) {
let str = ''
if (conf.formBtns && type === 'file') {
str = `<el-form-item size="large">
@ -69,7 +69,7 @@ function buildFromBtns(conf, type) {
}
// span不为24的用el-col包裹
function colWrapper(element, str) {
function colWrapper (element, str) {
if (someSpanIsNot24 || element.span !== 24) {
return `<el-col :span="${element.span}">
${str}
@ -79,7 +79,7 @@ function colWrapper(element, str) {
}
const layouts = {
colFormItem(element) {
colFormItem (element) {
let labelWidth = ''
if (element.labelWidth && element.labelWidth !== confGlobal.labelWidth) {
labelWidth = `label-width="${element.labelWidth}px"`
@ -92,7 +92,7 @@ const layouts = {
str = colWrapper(element, str)
return str
},
rowFormItem(element) {
rowFormItem (element) {
const type = element.type === 'default' ? '' : `type="${element.type}"`
const justify = element.type === 'default' ? '' : `justify="${element.justify}"`
const align = element.type === 'default' ? '' : `align="${element.align}"`
@ -109,7 +109,7 @@ const layouts = {
const tags = {
'el-button': el => {
const {
tag, disabled
disabled
} = attrBuilder(el)
const type = el.type ? `type="${el.type}"` : ''
const icon = el.icon ? `icon="${el.icon}"` : ''
@ -241,7 +241,6 @@ const tags = {
},
'el-rate': el => {
const { disabled, vModel } = attrBuilder(el)
const max = el.max ? `:max='${el.max}'` : ''
const allowHalf = el['allow-half'] ? 'allow-half' : ''
const showText = el['show-text'] ? 'show-text' : ''
const showScore = el['show-score'] ? 'show-score' : ''
@ -274,7 +273,7 @@ const tags = {
}
}
function attrBuilder(el) {
function attrBuilder (el) {
return {
vModel: `v-model="${confGlobal.formModel}.${el.vModel}"`,
clearable: el.clearable ? 'clearable' : '',
@ -285,7 +284,7 @@ function attrBuilder(el) {
}
// el-buttin 子级
function buildElButtonChild(conf) {
function buildElButtonChild (conf) {
const children = []
if (conf.default) {
children.push(conf.default)
@ -294,7 +293,7 @@ function buildElButtonChild(conf) {
}
// el-input innerHTML
function buildElInputChild(conf) {
function buildElInputChild (conf) {
const children = []
if (conf.prepend) {
children.push(`<template slot="prepend">${conf.prepend}</template>`)
@ -305,7 +304,7 @@ function buildElInputChild(conf) {
return children.join('\n')
}
function buildElSelectChild(conf) {
function buildElSelectChild (conf) {
const children = []
if (conf.options && conf.options.length) {
children.push(`<el-option v-for="(item, index) in ${conf.vModel}Options" :key="index" :label="item.label" :value="item.value" :disabled="item.disabled"></el-option>`)
@ -313,7 +312,7 @@ function buildElSelectChild(conf) {
return children.join('\n')
}
function buildElRadioGroupChild(conf) {
function buildElRadioGroupChild (conf) {
const children = []
if (conf.options && conf.options.length) {
const tag = conf.optionType === 'button' ? 'el-radio-button' : 'el-radio'
@ -323,7 +322,7 @@ function buildElRadioGroupChild(conf) {
return children.join('\n')
}
function buildElCheckboxGroupChild(conf) {
function buildElCheckboxGroupChild (conf) {
const children = []
if (conf.options && conf.options.length) {
const tag = conf.optionType === 'button' ? 'el-checkbox-button' : 'el-checkbox'
@ -333,7 +332,7 @@ function buildElCheckboxGroupChild(conf) {
return children.join('\n')
}
function buildElUploadChild(conf) {
function buildElUploadChild (conf) {
const list = []
if (conf['list-type'] === 'picture-card') list.push('<i class="el-icon-plus"></i>')
else list.push(`<el-button size="small" type="primary" icon="el-icon-upload">${conf.buttonText}</el-button>`)
@ -341,7 +340,7 @@ function buildElUploadChild(conf) {
return list.join('\n')
}
export function makeUpHtml(conf, type) {
export function makeUpHtml (conf, type) {
const htmlList = []
confGlobal = conf
someSpanIsNot24 = conf.fields.some(item => item.span !== 24)

View File

@ -1,4 +1,3 @@
import { isArray } from 'util'
import { exportDefault, titleCase } from '@/utils/index'
import { trigger } from './config'
@ -13,8 +12,7 @@ const inheritAttrs = {
dialog: 'inheritAttrs: false,'
}
export function makeUpJs(conf, type) {
export function makeUpJs (conf, type) {
confGlobal = conf = JSON.parse(JSON.stringify(conf))
const dataList = []
const ruleList = []
@ -41,7 +39,7 @@ export function makeUpJs(conf, type) {
return script
}
function buildAttributes(el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) {
function buildAttributes (el, dataList, ruleList, optionsList, methodList, propsList, uploadVarList) {
buildData(el, dataList)
buildRules(el, ruleList)
@ -76,10 +74,11 @@ function buildAttributes(el, dataList, ruleList, optionsList, methodList, propsL
}
}
function mixinMethod(type) {
const list = []; const
minxins = {
file: confGlobal.formBtns ? {
function mixinMethod (type) {
const list = []
const minxins = {
file: confGlobal.formBtns
? ({
submitForm: `submitForm() {
this.$refs['${confGlobal.formRef}'].validate(valid => {
if(!valid) return
@ -89,7 +88,8 @@ function mixinMethod(type) {
resetForm: `resetForm() {
this.$refs['${confGlobal.formRef}'].resetFields()
},`
} : null,
})
: null,
dialog: {
onOpen: 'onOpen() {},',
onClose: `onClose() {
@ -117,7 +117,7 @@ function mixinMethod(type) {
return list
}
function buildData(conf, dataList) {
function buildData (conf, dataList) {
if (conf.vModel === undefined) return
let defaultValue
if (typeof (conf.defaultValue) === 'string' && !conf.multiple) {
@ -128,19 +128,20 @@ function buildData(conf, dataList) {
dataList.push(`${conf.vModel}: ${defaultValue},`)
}
function buildRules(conf, ruleList) {
function buildRules (conf, ruleList) {
if (conf.vModel === undefined) return
const rules = []
if (trigger[conf.tag]) {
if (conf.required) {
const type = isArray(conf.defaultValue) ? 'type: \'array\',' : ''
let message = isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder
const type = Array.isArray(conf.defaultValue) ? 'type: \'array\',' : ''
let message = Array.isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder
if (message === undefined) message = `${conf.label}不能为空`
rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`)
}
if (conf.regList && isArray(conf.regList)) {
if (conf.regList && Array.isArray(conf.regList)) {
conf.regList.forEach(item => {
if (item.pattern) {
// eslint-disable-next-line no-eval
rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`)
}
})
@ -149,14 +150,16 @@ function buildRules(conf, ruleList) {
}
}
function buildOptions(conf, optionsList) {
function buildOptions (conf, optionsList) {
if (conf.vModel === undefined) return
if (conf.dataType === 'dynamic') { conf.options = [] }
if (conf.dataType === 'dynamic') {
conf.options = []
}
const str = `${conf.vModel}Options: ${JSON.stringify(conf.options)},`
optionsList.push(str)
}
function buildProps(conf, propsList) {
function buildProps (conf, propsList) {
if (conf.dataType === 'dynamic') {
conf.valueKey !== 'value' && (conf.props.props.value = conf.valueKey)
conf.labelKey !== 'label' && (conf.props.props.label = conf.labelKey)
@ -166,9 +169,11 @@ function buildProps(conf, propsList) {
propsList.push(str)
}
function buildBeforeUpload(conf) {
const unitNum = units[conf.sizeUnit]; let rightSizeCode = ''; let acceptCode = ''; const
returnList = []
function buildBeforeUpload (conf) {
const unitNum = units[conf.sizeUnit]
let rightSizeCode = ''
let acceptCode = ''
const returnList = []
if (conf.fileSize) {
rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${conf.fileSize}
if(!isRightSize){
@ -191,14 +196,14 @@ function buildBeforeUpload(conf) {
return returnList.length ? str : ''
}
function buildSubmitUpload(conf) {
function buildSubmitUpload (conf) {
const str = `submitUpload() {
this.$refs['${conf.vModel}'].submit()
},`
return str
}
function buildOptionMethod(methodName, model, methodList) {
function buildOptionMethod (methodName, model, methodList) {
const str = `${methodName}() {
// TODO 发起请求获取数据
this.${model}
@ -206,7 +211,7 @@ function buildOptionMethod(methodName, model, methodList) {
methodList.push(str)
}
function buildexport(conf, type, data, rules, selectOptions, uploadVar, props, methods) {
function buildexport (conf, type, data, rules, selectOptions, uploadVar, props, methods) {
const str = `${exportDefault}{
${inheritAttrs[type]}
components: {},

View File

@ -2,22 +2,22 @@ import { makeMap } from '@/utils/index'
// 参考https://github.com/vuejs/vue/blob/v2.6.10/src/platforms/web/server/util.js
const isAttr = makeMap(
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,'
+ 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,'
+ 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,'
+ 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,'
+ 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,'
+ 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,'
+ 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,'
+ 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,'
+ 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,'
+ 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,'
+ 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,'
+ 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,'
+ 'target,title,type,usemap,value,width,wrap'
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' +
'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
'target,title,type,usemap,value,width,wrap'
)
function vModel(self, dataObject, defaultValue) {
function vModel (self, dataObject, defaultValue) {
dataObject.props.value = defaultValue
dataObject.on.input = val => {
@ -27,20 +27,20 @@ function vModel(self, dataObject, defaultValue) {
const componentChild = {
'el-button': {
default(h, conf, key) {
default (h, conf, key) {
return conf[key]
},
}
},
'el-input': {
prepend(h, conf, key) {
prepend (h, conf, key) {
return <template slot="prepend">{conf[key]}</template>
},
append(h, conf, key) {
append (h, conf, key) {
return <template slot="append">{conf[key]}</template>
}
},
'el-select': {
options(h, conf, key) {
options (h, conf, key) {
const list = []
conf.options.forEach(item => {
list.push(<el-option label={item.label} value={item.value} disabled={item.disabled}></el-option>)
@ -49,7 +49,7 @@ const componentChild = {
}
},
'el-radio-group': {
options(h, conf, key) {
options (h, conf, key) {
const list = []
conf.options.forEach(item => {
if (conf.optionType === 'button') list.push(<el-radio-button label={item.value}>{item.label}</el-radio-button>)
@ -59,7 +59,7 @@ const componentChild = {
}
},
'el-checkbox-group': {
options(h, conf, key) {
options (h, conf, key) {
const list = []
conf.options.forEach(item => {
if (conf.optionType === 'button') {
@ -88,7 +88,7 @@ const componentChild = {
}
export default {
render(h) {
render (h) {
const dataObject = {
attrs: {},
props: {},

View File

@ -3,15 +3,15 @@ import { parseTime } from './ruoyi'
/**
* 表格时间格式化
*/
export function formatDate(cellValue) {
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
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
export function formatDate (cellValue) {
if (cellValue === null || cellValue === '') return ''
const date = new Date(cellValue)
const year = date.getFullYear()
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
const hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
}
@ -20,7 +20,7 @@ export function formatDate(cellValue) {
* @param {string} option
* @returns {string}
*/
export function formatTime(time, option) {
export function formatTime (time, option) {
if (('' + time).length === 10) {
time = parseInt(time) * 1000
} else {
@ -62,8 +62,8 @@ export function formatTime(time, option) {
* @param {string} url
* @returns {Object}
*/
export function getQueryObject(url) {
url = url == null ? window.location.href : url
export function getQueryObject (url) {
url = url === null ? window.location.href : url
const search = url.substring(url.lastIndexOf('?') + 1)
const obj = {}
const reg = /([^?&=]+)=([^?&=]*)/g
@ -81,10 +81,10 @@ export function getQueryObject(url) {
* @param {string} input value
* @returns {number} output value
*/
export function byteLength(str) {
export function byteLength (str) {
// returns the byte length of an utf8 string
let s = str.length
for (var i = str.length - 1; i >= 0; i--) {
for (let i = str.length - 1; i >= 0; i--) {
const code = str.charCodeAt(i)
if (code > 0x7f && code <= 0x7ff) s++
else if (code > 0x7ff && code <= 0xffff) s += 2
@ -97,7 +97,7 @@ export function byteLength(str) {
* @param {Array} actual
* @returns {Array}
*/
export function cleanArray(actual) {
export function cleanArray (actual) {
const newArray = []
for (let i = 0; i < actual.length; i++) {
if (actual[i]) {
@ -111,7 +111,7 @@ export function cleanArray(actual) {
* @param {Object} json
* @returns {Array}
*/
export function param(json) {
export function param (json) {
if (!json) return ''
return cleanArray(
Object.keys(json).map(key => {
@ -125,7 +125,7 @@ export function param(json) {
* @param {string} url
* @returns {Object}
*/
export function param2Obj(url) {
export function param2Obj (url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) {
return {}
@ -147,7 +147,7 @@ export function param2Obj(url) {
* @param {string} val
* @returns {string}
*/
export function html2Text(val) {
export function html2Text (val) {
const div = document.createElement('div')
div.innerHTML = val
return div.textContent || div.innerText
@ -159,7 +159,7 @@ export function html2Text(val) {
* @param {(Object|Array)} source
* @returns {Object}
*/
export function objectMerge(target, source) {
export function objectMerge (target, source) {
if (typeof target !== 'object') {
target = {}
}
@ -181,7 +181,7 @@ export function objectMerge(target, source) {
* @param {HTMLElement} element
* @param {string} className
*/
export function toggleClass(element, className) {
export function toggleClass (element, className) {
if (!element || !className) {
return
}
@ -201,7 +201,7 @@ export function toggleClass(element, className) {
* @param {string} type
* @returns {Date}
*/
export function getTime(type) {
export function getTime (type) {
if (type === 'start') {
return new Date().getTime() - 3600 * 1000 * 24 * 90
} else {
@ -215,10 +215,10 @@ export function getTime(type) {
* @param {boolean} immediate
* @return {*}
*/
export function debounce(func, wait, immediate) {
export function debounce (func, wait, immediate) {
let timeout, args, context, timestamp, result
const later = function() {
const later = function () {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
@ -235,7 +235,7 @@ export function debounce(func, wait, immediate) {
}
}
return function(...args) {
return function (...args) {
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
@ -257,7 +257,7 @@ export function debounce(func, wait, immediate) {
* @param {Object} source
* @returns {Object}
*/
export function deepClone(source) {
export function deepClone (source) {
if (!source && typeof source !== 'object') {
throw new Error('error arguments', 'deepClone')
}
@ -276,14 +276,14 @@ export function deepClone(source) {
* @param {Array} arr
* @returns {Array}
*/
export function uniqueArr(arr) {
export function uniqueArr (arr) {
return Array.from(new Set(arr))
}
/**
* @returns {string}
*/
export function createUniqueString() {
export function createUniqueString () {
const timestamp = +new Date() + ''
const randomNum = parseInt((1 + Math.random()) * 65536) + ''
return (+(randomNum + timestamp)).toString(32)
@ -295,7 +295,7 @@ export function createUniqueString() {
* @param {string} cls
* @returns {boolean}
*/
export function hasClass(ele, cls) {
export function hasClass (ele, cls) {
return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'))
}
@ -304,7 +304,7 @@ export function hasClass(ele, cls) {
* @param {HTMLElement} elm
* @param {string} cls
*/
export function addClass(ele, cls) {
export function addClass (ele, cls) {
if (!hasClass(ele, cls)) ele.className += ' ' + cls
}
@ -313,14 +313,14 @@ export function addClass(ele, cls) {
* @param {HTMLElement} elm
* @param {string} cls
*/
export function removeClass(ele, cls) {
export function removeClass (ele, cls) {
if (hasClass(ele, cls)) {
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)')
ele.className = ele.className.replace(reg, ' ')
}
}
export function makeMap(str, expectsLowerCase) {
export function makeMap (str, expectsLowerCase) {
const map = Object.create(null)
const list = str.split(',')
for (let i = 0; i < list.length; i++) {
@ -375,16 +375,15 @@ export const beautifierConf = {
}
// 首字母大小
export function titleCase(str) {
export function titleCase (str) {
return str.replace(/( |^)[a-z]/g, L => L.toUpperCase())
}
// 下划转驼峰
export function camelCase(str) {
export function camelCase (str) {
return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase())
}
export function isNumberStr(str) {
export function isNumberStr (str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
}

View File

@ -15,16 +15,15 @@ const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYour
'UP8iWi1Qw0Y='
// 加密
export function encrypt(txt) {
export function encrypt (txt) {
const encryptor = new JSEncrypt()
encryptor.setPublicKey(publicKey) // 设置公钥
return encryptor.encrypt(txt) // 对数据进行加密
}
// 解密
export function decrypt(txt) {
export function decrypt (txt) {
const encryptor = new JSEncrypt()
encryptor.setPrivateKey(privateKey) // 设置私钥
return encryptor.decrypt(txt) // 对数据进行解密
}

View File

@ -5,14 +5,14 @@ import store from '@/store'
* @param {Array} value 校验值
* @returns {Boolean}
*/
export function checkPermi(value) {
export function checkPermi (value) {
if (value && value instanceof Array && value.length > 0) {
const permissions = store.getters && store.getters.permissions
const permissionDatas = value
const all_permission = "*:*:*";
const allPermission = '*:*:*'
const hasPermission = permissions.some(permission => {
return all_permission === permission || permissionDatas.includes(permission)
return allPermission === permission || permissionDatas.includes(permission)
})
if (!hasPermission) {
@ -20,7 +20,7 @@ export function checkPermi(value) {
}
return true
} else {
console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
console.error('need roles! Like checkPermi="[\'system:user:add\',\'system:user:edit\']"')
return false
}
}
@ -30,14 +30,14 @@ export function checkPermi(value) {
* @param {Array} value 校验值
* @returns {Boolean}
*/
export function checkRole(value) {
export function checkRole (value) {
if (value && value instanceof Array && value.length > 0) {
const roles = store.getters && store.getters.roles
const permissionRoles = value
const super_admin = "admin";
const superAdmin = 'admin'
const hasRole = roles.some(role => {
return super_admin === role || permissionRoles.includes(role)
return superAdmin === role || permissionRoles.includes(role)
})
if (!hasRole) {
@ -45,7 +45,7 @@ export function checkRole(value) {
}
return true
} else {
console.error(`need roles! Like checkRole="['admin','editor']"`)
console.error('need roles! Like checkRole="[\'admin\',\'editor\']"')
return false
}
}

View File

@ -17,31 +17,31 @@ service.interceptors.request.use(config => {
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
config.headers.Authorization = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
}
// get请求映射params参数
if (config.method === 'get' && config.params) {
let url = config.url + '?';
let url = config.url + '?'
for (const propName of Object.keys(config.params)) {
const value = config.params[propName];
var part = encodeURIComponent(propName) + "=";
if (value !== null && typeof(value) !== "undefined") {
const value = config.params[propName]
const part = encodeURIComponent(propName) + '='
if (value !== null && typeof (value) !== 'undefined') {
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
if (value[key] !== null && typeof (value[key]) !== 'undefined') {
let params = propName + '[' + key + ']';
let subPart = encodeURIComponent(params) + '=';
url += subPart + encodeURIComponent(value[key]) + '&';
const params = propName + '[' + key + ']'
const subPart = encodeURIComponent(params) + '='
url += subPart + encodeURIComponent(value[key]) + '&'
}
}
} else {
url += part + encodeURIComponent(value) + "&";
url += part + encodeURIComponent(value) + '&'
}
}
}
url = url.slice(0, -1);
config.params = {};
config.url = url;
url = url.slice(0, -1)
config.params = {}
config.url = url
}
return config
}, error => {
@ -52,9 +52,9 @@ service.interceptors.request.use(config => {
// 响应拦截器
service.interceptors.response.use(res => {
// 未设置状态码则默认成功状态
const code = res.data.code || 200;
const code = res.data.code || 200
// 获取错误信息
const msg = errorCode[code] || res.data.msg || errorCode['default']
const msg = errorCode[code] || res.data.msg || errorCode.default
if (code === 401) {
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
confirmButtonText: '重新登录',
@ -63,10 +63,10 @@ service.interceptors.response.use(res => {
}
).then(() => {
store.dispatch('LogOut').then(() => {
location.href = '/index';
location.href = '/index'
})
}).catch(() => {});
return Promise.reject('令牌验证失败')
}).catch(() => {})
return Promise.reject(new Error('令牌验证失败'))
} else if (code === 500) {
Message({
message: msg,
@ -77,22 +77,20 @@ service.interceptors.response.use(res => {
Notification.error({
title: msg
})
return Promise.reject('error')
return Promise.reject(new Error('error'))
} else {
return res.data
}
},
error => {
},
error => {
console.log('err' + error)
let { message } = error;
if (message == "Network Error") {
message = "后端接口连接异常";
}
else if (message.includes("timeout")) {
message = "系统接口请求超时";
}
else if (message.includes("Request failed with status code")) {
message = "系统接口" + message.substr(message.length - 3) + "异常";
let { message } = error
if (message === 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
Message({
message: message,
@ -100,7 +98,7 @@ service.interceptors.response.use(res => {
duration: 5 * 1000
})
return Promise.reject(error)
}
}
)
export default service

View File

@ -1,4 +1,4 @@
/**
/**
* 通用js方法封装处理
* Copyright (c) 2019 ruoyi
*/
@ -6,7 +6,7 @@
const baseURL = process.env.VUE_APP_BASE_API
// 日期格式化
export function parseTime(time, pattern) {
export function parseTime (time, pattern) {
if (arguments.length === 0 || !time) {
return null
}
@ -18,7 +18,7 @@ export function parseTime(time, pattern) {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/');
time = time.replace(/-/gm, '/')
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
@ -34,7 +34,7 @@ export function parseTime(time, pattern) {
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
const timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
@ -43,83 +43,86 @@ export function parseTime(time, pattern) {
}
return value || 0
})
return time_str
return timeStr
}
// 表单重置
export function resetForm(refName) {
export function resetForm (refName) {
if (this.$refs[refName]) {
this.$refs[refName].resetFields();
this.$refs[refName].resetFields()
}
}
// 添加日期范围
export function addDateRange(params, dateRange, propName) {
let search = params;
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
dateRange = Array.isArray(dateRange) ? dateRange : [];
export function addDateRange (params, dateRange, propName) {
const search = params
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}
dateRange = Array.isArray(dateRange) ? dateRange : []
if (typeof (propName) === 'undefined') {
search.params['beginTime'] = dateRange[0];
search.params['endTime'] = dateRange[1];
search.params.beginTime = dateRange[0]
search.params.endTime = dateRange[1]
} else {
search.params['begin' + propName] = dateRange[0];
search.params['end' + propName] = dateRange[1];
search.params['begin' + propName] = dateRange[0]
search.params['end' + propName] = dateRange[1]
}
return search;
return search
}
// 回显数据字典
export function selectDictLabel(datas, value) {
var actions = [];
export function selectDictLabel (datas, value) {
const actions = []
Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + value)) {
actions.push(datas[key].dictLabel);
return true;
if (datas[key].dictValue === ('' + value)) {
actions.push(datas[key].dictLabel)
return true
}
return undefined
})
return actions.join('');
return actions.join('')
}
// 回显数据字典(字符串数组)
export function selectDictLabels(datas, value, separator) {
var actions = [];
var currentSeparator = undefined === separator ? "," : separator;
var temp = value.split(currentSeparator);
export function selectDictLabels (datas, value, separator) {
const actions = []
const currentSeparator = undefined === separator ? ',' : separator
const temp = value.split(currentSeparator)
Object.keys(value.split(currentSeparator)).some((val) => {
Object.keys(datas).some((key) => {
if (datas[key].dictValue == ('' + temp[val])) {
actions.push(datas[key].dictLabel + currentSeparator);
if (datas[key].dictValue === ('' + temp[val])) {
actions.push(datas[key].dictLabel + currentSeparator)
}
return undefined
})
return undefined
})
return actions.join('').substring(0, actions.join('').length - 1);
return actions.join('').substring(0, actions.join('').length - 1)
}
// 通用下载方法
export function download(fileName) {
window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
export function download (fileName) {
window.location.href = baseURL + '/common/download?fileName=' + encodeURI(fileName) + '&delete=' + true
}
// 字符串格式化(%s )
export function sprintf(str) {
var args = arguments, flag = true, i = 1;
export function sprintf (str) {
const args = arguments; let flag = true; let i = 1
str = str.replace(/%s/g, function () {
var arg = args[i++];
const arg = args[i++]
if (typeof arg === 'undefined') {
flag = false;
return '';
flag = false
return ''
}
return arg;
});
return flag ? str : '';
return arg
})
return flag ? str : ''
}
// 转换字符串undefined,null等转化为""
export function praseStrEmpty(str) {
if (!str || str == "undefined" || str == "null") {
return "";
export function praseStrEmpty (str) {
if (!str || str === 'undefined' || str === 'null') {
return ''
}
return str;
return str
}
/**
@ -129,46 +132,46 @@ export function praseStrEmpty(str) {
* @param {*} parentId 父节点字段 默认 'parentId'
* @param {*} children 孩子节点字段 默认 'children'
*/
export function handleTree(data, id, parentId, children) {
let config = {
export function handleTree (data, id, parentId, children) {
const config = {
id: id || 'id',
parentId: parentId || 'parentId',
childrenList: children || 'children'
};
var childrenListMap = {};
var nodeIds = {};
var tree = [];
for (let d of data) {
let parentId = d[config.parentId];
if (childrenListMap[parentId] == null) {
childrenListMap[parentId] = [];
}
nodeIds[d[config.id]] = d;
childrenListMap[parentId].push(d);
}
for (let d of data) {
let parentId = d[config.parentId];
if (nodeIds[parentId] == null) {
tree.push(d);
const childrenListMap = {}
const nodeIds = {}
const tree = []
for (const d of data) {
const parentId = d[config.parentId]
if (childrenListMap[parentId] === null) {
childrenListMap[parentId] = []
}
nodeIds[d[config.id]] = d
childrenListMap[parentId].push(d)
}
for (const d of data) {
const parentId = d[config.parentId]
if (nodeIds[parentId] === null) {
tree.push(d)
}
}
for (let t of tree) {
adaptToChildrenList(t);
for (const t of tree) {
adaptToChildrenList(t)
}
function adaptToChildrenList(o) {
function adaptToChildrenList (o) {
if (childrenListMap[o[config.id]] !== null) {
o[config.childrenList] = childrenListMap[o[config.id]];
o[config.childrenList] = childrenListMap[o[config.id]]
}
if (o[config.childrenList]) {
for (let c of o[config.childrenList]) {
adaptToChildrenList(c);
for (const c of o[config.childrenList]) {
adaptToChildrenList(c)
}
}
}
return tree;
return tree
}

View File

@ -1,4 +1,4 @@
Math.easeInOutQuad = function(t, b, c, d) {
Math.easeInOutQuad = function (t, b, c, d) {
t /= d / 2
if (t < 1) {
return c / 2 * t * t + b
@ -8,21 +8,21 @@ Math.easeInOutQuad = function(t, b, c, d) {
}
// 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) }
const 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) {
function move (amount) {
document.documentElement.scrollTop = amount
document.body.parentNode.scrollTop = amount
document.body.scrollTop = amount
}
function position() {
function position () {
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
}
@ -31,17 +31,17 @@ function position() {
* @param {number} duration
* @param {Function} callback
*/
export function scrollTo(to, duration, 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 animateScroll = function () {
// increment the time
currentTime += increment
// find the value with the quadratic in-out easing function
var val = Math.easeInOutQuad(currentTime, start, change, duration)
const val = Math.easeInOutQuad(currentTime, start, change, duration)
// move the document.body
move(val)
// do the animation unless its over

View File

@ -2,7 +2,7 @@
* @param {string} path
* @returns {Boolean}
*/
export function isExternal(path) {
export function isExternal (path) {
return /^(https?:|mailto:|tel:)/.test(path)
}
@ -10,16 +10,16 @@ export function isExternal(path) {
* @param {string} str
* @returns {Boolean}
*/
export function validUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
export function validUsername (str) {
const validMap = ['admin', 'editor']
return validMap.indexOf(str.trim()) >= 0
}
/**
* @param {string} url
* @returns {Boolean}
*/
export function validURL(url) {
export function validURL (url) {
const reg = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return reg.test(url)
}
@ -28,7 +28,7 @@ export function validURL(url) {
* @param {string} str
* @returns {Boolean}
*/
export function validLowerCase(str) {
export function validLowerCase (str) {
const reg = /^[a-z]+$/
return reg.test(str)
}
@ -37,7 +37,7 @@ export function validLowerCase(str) {
* @param {string} str
* @returns {Boolean}
*/
export function validUpperCase(str) {
export function validUpperCase (str) {
const reg = /^[A-Z]+$/
return reg.test(str)
}
@ -46,7 +46,7 @@ export function validUpperCase(str) {
* @param {string} str
* @returns {Boolean}
*/
export function validAlphabets(str) {
export function validAlphabets (str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
@ -55,8 +55,8 @@ export function validAlphabets(str) {
* @param {string} email
* @returns {Boolean}
*/
export function validEmail(email) {
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
export function validEmail (email) {
const reg = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return reg.test(email)
}
@ -64,7 +64,7 @@ export function validEmail(email) {
* @param {string} str
* @returns {Boolean}
*/
export function isString(str) {
export function isString (str) {
if (typeof str === 'string' || str instanceof String) {
return true
}
@ -75,7 +75,7 @@ export function isString(str) {
* @param {Array} arg
* @returns {Boolean}
*/
export function isArray(arg) {
export function isArray (arg) {
if (typeof Array.isArray === 'undefined') {
return Object.prototype.toString.call(arg) === '[object Array]'
}

View File

@ -7,13 +7,13 @@ const mimeMap = {
}
const baseUrl = process.env.VUE_APP_BASE_API
export function downLoadZip(str, filename) {
var url = baseUrl + str
export function downLoadZip (str, filename) {
const url = baseUrl + str
axios({
method: 'get',
url: url,
responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() }
headers: { Authorization: 'Bearer ' + getToken() }
}).then(res => {
resolveBlob(res, mimeMap.zip)
})
@ -23,20 +23,20 @@ export function downLoadZip(str, filename) {
* @param {*} res blob响应内容
* @param {String} mimeType MIME类型
*/
export function resolveBlob(res, mimeType) {
export function resolveBlob (res, mimeType) {
const aLink = document.createElement('a')
var blob = new Blob([res.data], { type: mimeType })
const 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, '')
const patt = /filename=([^;]+\\.[^\\.;]+);*/
const contentDisposition = decodeURI(res.headers['content-disposition'])
const result = patt.exec(contentDisposition)
let 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);
URL.revokeObjectURL(aLink.href)// 清除引用
document.body.removeChild(aLink)
}

View File

@ -41,17 +41,17 @@ import elementIcons from './element-icons'
export default {
name: 'Icons',
data() {
data () {
return {
svgIcons,
elementIcons
}
},
methods: {
generateIconCode(symbol) {
generateIconCode (symbol) {
return `<svg-icon icon-class="${symbol}" />`
},
generateElementIconCode(symbol) {
generateElementIconCode (symbol) {
return `<i class="el-icon-${symbol}" />`
}
}

View File

@ -3,9 +3,9 @@
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import echarts from 'echarts' // echarts theme
import resize from './mixins/resize'
require('echarts/theme/macarons')
const animationDuration = 6000
@ -25,17 +25,17 @@ export default {
default: '300px'
}
},
data() {
data () {
return {
chart: null
}
},
mounted() {
mounted () {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
beforeDestroy () {
if (!this.chart) {
return
}
@ -43,7 +43,7 @@ export default {
this.chart = null
},
methods: {
initChart() {
initChart () {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({

View File

@ -3,9 +3,9 @@
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import echarts from 'echarts' // echarts theme
import resize from './mixins/resize'
require('echarts/theme/macarons')
export default {
mixins: [resize],
@ -31,7 +31,7 @@ export default {
required: true
}
},
data() {
data () {
return {
chart: null
}
@ -39,17 +39,17 @@ export default {
watch: {
chartData: {
deep: true,
handler(val) {
handler (val) {
this.setOptions(val)
}
}
},
mounted() {
mounted () {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
beforeDestroy () {
if (!this.chart) {
return
}
@ -57,11 +57,11 @@ export default {
this.chart = null
},
methods: {
initChart() {
initChart () {
this.chart = echarts.init(this.$el, 'macarons')
this.setOptions(this.chartData)
},
setOptions({ expectedData, actualData } = {}) {
setOptions ({ expectedData, actualData } = {}) {
this.chart.setOption({
xAxis: {
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
@ -93,7 +93,8 @@ export default {
data: ['expected', 'actual']
},
series: [{
name: 'expected', itemStyle: {
name: 'expected',
itemStyle: {
normal: {
color: '#FF005A',
lineStyle: {

View File

@ -63,7 +63,7 @@ export default {
CountTo
},
methods: {
handleSetLineChartData(type) {
handleSetLineChartData (type) {
this.$emit('handleSetLineChartData', type)
}
}

View File

@ -3,9 +3,9 @@
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import echarts from 'echarts' // echarts theme
import resize from './mixins/resize'
require('echarts/theme/macarons')
export default {
mixins: [resize],
@ -23,17 +23,17 @@ export default {
default: '300px'
}
},
data() {
data () {
return {
chart: null
}
},
mounted() {
mounted () {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
beforeDestroy () {
if (!this.chart) {
return
}
@ -41,7 +41,7 @@ export default {
this.chart = null
},
methods: {
initChart() {
initChart () {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({

View File

@ -3,9 +3,9 @@
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import echarts from 'echarts' // echarts theme
import resize from './mixins/resize'
require('echarts/theme/macarons')
const animationDuration = 3000
@ -25,17 +25,17 @@ export default {
default: '300px'
}
},
data() {
data () {
return {
chart: null
}
},
mounted() {
mounted () {
this.$nextTick(() => {
this.initChart()
})
},
beforeDestroy() {
beforeDestroy () {
if (!this.chart) {
return
}
@ -43,7 +43,7 @@ export default {
this.chart = null
},
methods: {
initChart() {
initChart () {
this.chart = echarts.init(this.$el, 'macarons')
this.chart.setOption({

View File

@ -1,16 +1,16 @@
import { debounce } from '@/utils'
export default {
data() {
data () {
return {
$_sidebarElm: null,
$_resizeHandler: null
}
},
mounted() {
mounted () {
this.initListener()
},
activated() {
activated () {
if (!this.$_resizeHandler) {
// avoid duplication init
this.initListener()
@ -19,21 +19,21 @@ export default {
// when keep-alive chart activated, auto resize
this.resize()
},
beforeDestroy() {
beforeDestroy () {
this.destroyListener()
},
deactivated() {
deactivated () {
this.destroyListener()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_sidebarResizeHandler(e) {
$_sidebarResizeHandler (e) {
if (e.propertyName === 'width') {
this.$_resizeHandler()
}
},
initListener() {
initListener () {
this.$_resizeHandler = debounce(() => {
this.resize()
}, 100)
@ -42,13 +42,13 @@ export default {
this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
},
destroyListener() {
destroyListener () {
window.removeEventListener('resize', this.$_resizeHandler)
this.$_resizeHandler = null
this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
},
resize() {
resize () {
const { chart } = this
chart && chart.resize()
}

View File

@ -30,13 +30,13 @@ import errGif from '@/assets/401_images/401.gif'
export default {
name: 'Page401',
data() {
data () {
return {
errGif: errGif + '?' + +new Date()
}
},
methods: {
back() {
back () {
if (this.$route.query.noGoBack) {
this.$router.push({ path: '/' })
} else {

View File

@ -30,7 +30,7 @@
export default {
name: 'Page404',
computed: {
message() {
message () {
return '找不到网页!'
}
}

View File

@ -601,19 +601,19 @@
<script>
export default {
name: "Index",
data() {
name: 'Index',
data () {
return {
//
version: "3.6.0",
};
version: '3.6.0'
}
},
methods: {
goTarget(href) {
window.open(href, "_blank");
},
},
};
goTarget (href) {
window.open(href, '_blank')
}
}
}
</script>
<style scoped lang="scss">
@ -679,4 +679,3 @@ export default {
}
}
</style>

View File

@ -25,7 +25,6 @@
</el-col>
</el-row>
</div>
</template>
@ -64,13 +63,13 @@ export default {
PieChart,
BarChart
},
data() {
data () {
return {
lineChartData: lineChartData.newVisitis
}
},
methods: {
handleSetLineChartData(type) {
handleSetLineChartData (type) {
this.lineChartData = lineChartData[type]
}
}

Some files were not shown because too many files have changed in this diff Show More