chore: 基于vue-cli的standard代码规范格式化代码

This commit is contained in:
hankaibo 2021-08-18 14:51:51 +08:00
parent 5c155f5f11
commit 2211400ecc
171 changed files with 19195 additions and 19380 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的文件的语法检查 vue.config.js
build/*.js
# 忽略src/assets目录下文件的语法检查
src/assets
# 忽略public目录下文件的语法检查
public
# 忽略当前目录下为js的文件的语法检查
*.js
# 忽略当前目录下为vue的文件的语法检查
*.vue

View File

@ -1,199 +1,21 @@
// ESlint 检查配置
module.exports = { module.exports = {
root: true, root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module'
},
env: { env: {
browser: true, browser: true,
node: 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: { rules: {
"vue/max-attributes-per-line": [2, { // 允许props修改
"singleline": 10, 'vue/no-mutating-props': 'off',
"multiline": { 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
"max": 1, 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
"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']
} }
} }

22
ruoyi-ui/.gitignore vendored
View File

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

View File

@ -1,13 +1,12 @@
module.exports = { module.exports = {
presets: [ presets: [
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
'@vue/cli-plugin-babel/preset' '@vue/cli-plugin-babel/preset'
], ],
'env': { env: {
'development': { development: {
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require(). // 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. // 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 off
echo. echo.
echo [信息] 打包Web工程生成dist文件。 echo [信息] 打包Web工程生成dist文件。
echo. echo.
%~d0 %~d0

View File

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

View File

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

View File

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

View File

@ -65,7 +65,6 @@ export function changeJobStatus(jobId, status) {
}) })
} }
// 定时任务立即执行一次 // 定时任务立即执行一次
export function runJob (jobId, jobGroup) { export function runJob (jobId, jobGroup) {
const data = { const data = {

View File

@ -1,5 +1,5 @@
import request from '@/utils/request' import request from '@/utils/request'
import { praseStrEmpty } from "@/utils/ruoyi"; import { praseStrEmpty } from '@/utils/ruoyi'
// 查询用户列表 // 查询用户列表
export function listUser (query) { export function listUser (query) {

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="/"> <el-breadcrumb class="app-breadcrumb" separator="/">
<transition-group name="breadcrumb"> <transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path"> <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> <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
</el-breadcrumb-item> </el-breadcrumb-item>
</transition-group> </transition-group>

View File

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

View File

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

View File

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

View File

@ -70,11 +70,11 @@ export default {
this.show = false this.show = false
}, },
change (val) { change (val) {
const path = val.path; const path = val.path
if (this.ishttp(val.path)) { if (this.ishttp(val.path)) {
// http(s):// // http(s)://
const pindex = path.indexOf("http"); const pindex = path.indexOf('http')
window.open(path.substr(pindex, path.length), "_blank"); window.open(path.substr(pindex, path.length), '_blank')
} else { } else {
this.$router.push(val.path) this.$router.push(val.path)
} }

View File

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

View File

@ -38,7 +38,7 @@ export default {
}, },
theme () { theme () {
return this.$store.state.settings.theme return this.$store.state.settings.theme
}, }
}, },
watch: { watch: {
show (value) { show (value) {

View File

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

View File

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

View File

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

View File

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

View File

@ -9,10 +9,10 @@ const install = function(Vue) {
} }
if (window.Vue) { if (window.Vue) {
window['hasRole'] = hasRole window.hasRole = hasRole
window['hasPermi'] = hasPermi window.hasPermi = hasPermi
window['dialogDrag'] = dialogDrag window.dialogDrag = dialogDrag
Vue.use(install); // eslint-disable-line window.Vue.use(install)
} }
export default install export default install

View File

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

View File

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

View File

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

View File

@ -102,9 +102,9 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.href = '/index'; location.href = '/index'
}) })
}).catch(() => {}); }).catch(() => {})
} }
} }
} }

View File

@ -84,7 +84,7 @@ export default {
return { return {
theme: this.$store.state.settings.theme, theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme sideTheme: this.$store.state.settings.sideTheme
}; }
}, },
computed: { computed: {
fixedHeader: { fixedHeader: {
@ -108,7 +108,7 @@ export default {
value: val value: val
}) })
if (!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)
} }
} }
}, },
@ -144,7 +144,7 @@ export default {
value: val value: val
}) })
} }
}, }
}, },
methods: { methods: {
themeChange (val) { themeChange (val) {
@ -152,25 +152,25 @@ export default {
key: 'theme', key: 'theme',
value: val value: val
}) })
this.theme = val; this.theme = val
}, },
handleTheme (val) { handleTheme (val) {
this.$store.dispatch('settings/changeSetting', { this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme', key: 'sideTheme',
value: val value: val
}) })
this.sideTheme = val; this.sideTheme = val
}, },
saveSetting () { saveSetting () {
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
fullscreen: false, fullscreen: false,
text: "正在保存到本地,请稍后...", text: '正在保存到本地,请稍后...',
spinner: "el-icon-loading", spinner: 'el-icon-loading',
background: "rgba(0, 0, 0, 0.7)" background: 'rgba(0, 0, 0, 0.7)'
}); })
localStorage.setItem( localStorage.setItem(
"layout-setting", 'layout-setting',
`{ `{
"topNav":${this.topNav}, "topNav":${this.topNav},
"tagsView":${this.tagsView}, "tagsView":${this.tagsView},
@ -180,19 +180,19 @@ export default {
"sideTheme":"${this.sideTheme}", "sideTheme":"${this.sideTheme}",
"theme":"${this.theme}" "theme":"${this.theme}"
}` }`
); )
setTimeout(loading.close(), 1000) setTimeout(loading.close(), 1000)
}, },
resetSetting () { resetSetting () {
this.$loading({ this.$loading({
lock: true, lock: true,
fullscreen: false, fullscreen: false,
text: "正在清除设置缓存并刷新,请稍后...", text: '正在清除设置缓存并刷新,请稍后...',
spinner: "el-icon-loading", spinner: 'el-icon-loading',
background: "rgba(0, 0, 0, 0.7)" background: 'rgba(0, 0, 0, 0.7)'
}); })
localStorage.removeItem("layout-setting") localStorage.removeItem('layout-setting')
setTimeout("window.location.reload()", 1000) setTimeout(window.location.reload(), 1000)
} }
} }
} }

View File

@ -27,7 +27,7 @@ export default {
}, },
computed: { computed: {
variables () { variables () {
return variables; return variables
}, },
sideTheme () { sideTheme () {
return this.$store.state.settings.sideTheme return this.$store.state.settings.sideTheme

View File

@ -57,7 +57,7 @@ export default {
methods: { methods: {
hasOneShowingChild (children = [], parent) { hasOneShowingChild (children = [], parent) {
if (!children) { if (!children) {
children = []; children = []
} }
const showingChildren = children.filter(item => { const showingChildren = children.filter(item => {
if (item.hidden) { if (item.hidden) {

View File

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

View File

@ -50,7 +50,7 @@ export default {
return this.$store.state.permission.routes return this.$store.state.permission.routes
}, },
theme () { theme () {
return this.$store.state.settings.theme; return this.$store.state.settings.theme
} }
}, },
watch: { watch: {
@ -75,11 +75,11 @@ export default {
return route.path === this.$route.path return route.path === this.$route.path
}, },
activeStyle (tag) { activeStyle (tag) {
if (!this.isActive(tag)) return {}; if (!this.isActive(tag)) return {}
return { return {
"background-color": this.theme, 'background-color': this.theme,
"border-color": this.theme 'border-color': this.theme
}; }
}, },
isAffix (tag) { isAffix (tag) {
return tag.meta && tag.meta.affix return tag.meta && tag.meta.affix
@ -168,7 +168,7 @@ export default {
}) })
}, },
closeOthersTags () { closeOthersTags () {
this.$router.push(this.selectedTag).catch(()=>{}); this.$router.push(this.selectedTag).catch(() => {})
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => { this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag() this.moveToCurrentTag()
}) })

View File

@ -52,7 +52,7 @@ export default {
} }
}, },
variables () { variables () {
return variables; return variables
} }
}, },
methods: { methods: {

View File

@ -14,18 +14,18 @@ import directive from './directive' //directive
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
import { getDicts } from "@/api/system/dict/data"; import { getDicts } from '@/api/system/dict/data'
import { getConfigKey } from "@/api/system/config"; import { getConfigKey } from '@/api/system/config'
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi"; import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from '@/utils/ruoyi'
import Pagination from "@/components/Pagination"; 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' import DictTag from '@/components/DictTag'
// 头部标签组件 // 头部标签组件
@ -43,15 +43,15 @@ Vue.prototype.download = download
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
Vue.prototype.msgSuccess = function (msg) { 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) { 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) { Vue.prototype.msgInfo = function (msg) {
this.$message.info(msg); this.$message.info(msg)
} }
// 全局组件挂载 // 全局组件挂载
@ -80,6 +80,7 @@ Vue.use(Element, {
Vue.config.productionTip = false Vue.config.productionTip = false
// eslint-disable-next-line no-new
new Vue({ new Vue({
el: '#app', el: '#app',
router, router,

View File

@ -1,11 +1,11 @@
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
Vue.use(Router)
/* Layout */ /* Layout */
import Layout from '@/layout' import Layout from '@/layout'
Vue.use(Router)
/** /**
* Note: 路由配置项 * Note: 路由配置项
* *

View File

@ -13,6 +13,6 @@ const getters = {
permission_routes: state => state.permission.routes, permission_routes: state => state.permission.routes,
topbarRouters: state => state.permission.topbarRouters, topbarRouters: state => state.permission.topbarRouters,
defaultRoutes: state => state.permission.defaultRoutes, defaultRoutes: state => state.permission.defaultRoutes,
sidebarRouters:state => state.permission.sidebarRouters, sidebarRouters: state => state.permission.sidebarRouters
} }
export default getters export default getters

View File

@ -1,7 +1,7 @@
import { constantRoutes } from '@/router' import { constantRoutes } from '@/router'
import { getRouters } from '@/api/menu' import { getRouters } from '@/api/menu'
import Layout from '@/layout/index' import Layout from '@/layout/index'
import ParentView from '@/components/ParentView'; import ParentView from '@/components/ParentView'
import InnerLink from '@/layout/components/InnerLink' import InnerLink from '@/layout/components/InnerLink'
const permission = { const permission = {
@ -26,11 +26,11 @@ const permission = {
path: '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) => { SET_SIDEBAR_ROUTERS: (state, routes) => {
state.sidebarRouters = routes state.sidebarRouters = routes
}, }
}, },
actions: { actions: {
// 生成路由 // 生成路由
@ -72,18 +72,18 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
route.component = loadView(route.component) 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) route.children = filterAsyncRouter(route.children, route, type)
} else { } else {
delete route['children'] delete route.children
delete route['redirect'] delete route.redirect
} }
return true return true
}) })
} }
function filterChildren (childrenMap, lastRouter = false) { function filterChildren (childrenMap, lastRouter = false) {
var children = [] let children = []
childrenMap.forEach((el, index) => { childrenMap.forEach((el, index) => {
if (el.children && el.children.length) { if (el.children && el.children.length) {
if (el.component === 'ParentView') { if (el.component === 'ParentView') {

View File

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

View File

@ -51,7 +51,7 @@ const user = {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo().then(res => { getInfo().then(res => {
const user = res.user 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是否是一个非空数组 if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
commit('SET_ROLES', res.roles) commit('SET_ROLES', res.roles)
commit('SET_PERMISSIONS', res.permissions) commit('SET_PERMISSIONS', res.permissions)

View File

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

View File

@ -109,7 +109,7 @@ const layouts = {
const tags = { const tags = {
'el-button': el => { 'el-button': el => {
const { const {
tag, disabled disabled
} = attrBuilder(el) } = attrBuilder(el)
const type = el.type ? `type="${el.type}"` : '' const type = el.type ? `type="${el.type}"` : ''
const icon = el.icon ? `icon="${el.icon}"` : '' const icon = el.icon ? `icon="${el.icon}"` : ''
@ -241,7 +241,6 @@ const tags = {
}, },
'el-rate': el => { 'el-rate': el => {
const { disabled, vModel } = attrBuilder(el) const { disabled, vModel } = attrBuilder(el)
const max = el.max ? `:max='${el.max}'` : ''
const allowHalf = el['allow-half'] ? 'allow-half' : '' const allowHalf = el['allow-half'] ? 'allow-half' : ''
const showText = el['show-text'] ? 'show-text' : '' const showText = el['show-text'] ? 'show-text' : ''
const showScore = el['show-score'] ? 'show-score' : '' const showScore = el['show-score'] ? 'show-score' : ''

View File

@ -1,4 +1,3 @@
import { isArray } from 'util'
import { exportDefault, titleCase } from '@/utils/index' import { exportDefault, titleCase } from '@/utils/index'
import { trigger } from './config' import { trigger } from './config'
@ -13,7 +12,6 @@ const inheritAttrs = {
dialog: 'inheritAttrs: false,' dialog: 'inheritAttrs: false,'
} }
export function makeUpJs (conf, type) { export function makeUpJs (conf, type) {
confGlobal = conf = JSON.parse(JSON.stringify(conf)) confGlobal = conf = JSON.parse(JSON.stringify(conf))
const dataList = [] const dataList = []
@ -77,9 +75,10 @@ function buildAttributes(el, dataList, ruleList, optionsList, methodList, propsL
} }
function mixinMethod (type) { function mixinMethod (type) {
const list = []; const const list = []
minxins = { const minxins = {
file: confGlobal.formBtns ? { file: confGlobal.formBtns
? ({
submitForm: `submitForm() { submitForm: `submitForm() {
this.$refs['${confGlobal.formRef}'].validate(valid => { this.$refs['${confGlobal.formRef}'].validate(valid => {
if(!valid) return if(!valid) return
@ -89,7 +88,8 @@ function mixinMethod(type) {
resetForm: `resetForm() { resetForm: `resetForm() {
this.$refs['${confGlobal.formRef}'].resetFields() this.$refs['${confGlobal.formRef}'].resetFields()
},` },`
} : null, })
: null,
dialog: { dialog: {
onOpen: 'onOpen() {},', onOpen: 'onOpen() {},',
onClose: `onClose() { onClose: `onClose() {
@ -133,14 +133,15 @@ function buildRules(conf, ruleList) {
const rules = [] const rules = []
if (trigger[conf.tag]) { if (trigger[conf.tag]) {
if (conf.required) { if (conf.required) {
const type = isArray(conf.defaultValue) ? 'type: \'array\',' : '' const type = Array.isArray(conf.defaultValue) ? 'type: \'array\',' : ''
let message = isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder let message = Array.isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder
if (message === undefined) message = `${conf.label}不能为空` if (message === undefined) message = `${conf.label}不能为空`
rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`) 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 => { conf.regList.forEach(item => {
if (item.pattern) { if (item.pattern) {
// eslint-disable-next-line no-eval
rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`) rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`)
} }
}) })
@ -151,7 +152,9 @@ function buildRules(conf, ruleList) {
function buildOptions (conf, optionsList) { function buildOptions (conf, optionsList) {
if (conf.vModel === undefined) return 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)},` const str = `${conf.vModel}Options: ${JSON.stringify(conf.options)},`
optionsList.push(str) optionsList.push(str)
} }
@ -167,8 +170,10 @@ function buildProps(conf, propsList) {
} }
function buildBeforeUpload (conf) { function buildBeforeUpload (conf) {
const unitNum = units[conf.sizeUnit]; let rightSizeCode = ''; let acceptCode = ''; const const unitNum = units[conf.sizeUnit]
returnList = [] let rightSizeCode = ''
let acceptCode = ''
const returnList = []
if (conf.fileSize) { if (conf.fileSize) {
rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${conf.fileSize} rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${conf.fileSize}
if(!isRightSize){ if(!isRightSize){

View File

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

View File

@ -4,14 +4,14 @@ import { parseTime } from './ruoyi'
* 表格时间格式化 * 表格时间格式化
*/ */
export function formatDate (cellValue) { export function formatDate (cellValue) {
if (cellValue == null || cellValue == "") return ""; if (cellValue === null || cellValue === '') return ''
var date = new Date(cellValue) const date = new Date(cellValue)
var year = date.getFullYear() const year = date.getFullYear()
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() const hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
} }
@ -63,7 +63,7 @@ export function formatTime(time, option) {
* @returns {Object} * @returns {Object}
*/ */
export function getQueryObject (url) { export function getQueryObject (url) {
url = url == null ? window.location.href : url url = url === null ? window.location.href : url
const search = url.substring(url.lastIndexOf('?') + 1) const search = url.substring(url.lastIndexOf('?') + 1)
const obj = {} const obj = {}
const reg = /([^?&=]+)=([^?&=]*)/g const reg = /([^?&=]+)=([^?&=]*)/g
@ -84,7 +84,7 @@ export function getQueryObject(url) {
export function byteLength (str) { export function byteLength (str) {
// returns the byte length of an utf8 string // returns the byte length of an utf8 string
let s = str.length 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) const code = str.charCodeAt(i)
if (code > 0x7f && code <= 0x7ff) s++ if (code > 0x7f && code <= 0x7ff) s++
else if (code > 0x7ff && code <= 0xffff) s += 2 else if (code > 0x7ff && code <= 0xffff) s += 2
@ -387,4 +387,3 @@ export function camelCase(str) {
export function isNumberStr (str) { export function isNumberStr (str) {
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
} }

View File

@ -27,4 +27,3 @@ export function decrypt(txt) {
encryptor.setPrivateKey(privateKey) // 设置私钥 encryptor.setPrivateKey(privateKey) // 设置私钥
return encryptor.decrypt(txt) // 对数据进行解密 return encryptor.decrypt(txt) // 对数据进行解密
} }

View File

@ -9,10 +9,10 @@ export function checkPermi(value) {
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
const permissions = store.getters && store.getters.permissions const permissions = store.getters && store.getters.permissions
const permissionDatas = value const permissionDatas = value
const all_permission = "*:*:*"; const allPermission = '*:*:*'
const hasPermission = permissions.some(permission => { const hasPermission = permissions.some(permission => {
return all_permission === permission || permissionDatas.includes(permission) return allPermission === permission || permissionDatas.includes(permission)
}) })
if (!hasPermission) { if (!hasPermission) {
@ -20,7 +20,7 @@ export function checkPermi(value) {
} }
return true return true
} else { } 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 return false
} }
} }
@ -34,10 +34,10 @@ export function checkRole(value) {
if (value && value instanceof Array && value.length > 0) { if (value && value instanceof Array && value.length > 0) {
const roles = store.getters && store.getters.roles const roles = store.getters && store.getters.roles
const permissionRoles = value const permissionRoles = value
const super_admin = "admin"; const superAdmin = 'admin'
const hasRole = roles.some(role => { const hasRole = roles.some(role => {
return super_admin === role || permissionRoles.includes(role) return superAdmin === role || permissionRoles.includes(role)
}) })
if (!hasRole) { if (!hasRole) {
@ -45,7 +45,7 @@ export function checkRole(value) {
} }
return true return true
} else { } else {
console.error(`need roles! Like checkRole="['admin','editor']"`) console.error('need roles! Like checkRole="[\'admin\',\'editor\']"')
return false return false
} }
} }

View File

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

View File

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

View File

@ -8,7 +8,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
} }
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts // requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
var requestAnimFrame = (function() { const requestAnimFrame = (function () {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60) } return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60) }
})() })()
@ -37,11 +37,11 @@ export function scrollTo(to, duration, callback) {
const increment = 20 const increment = 20
let currentTime = 0 let currentTime = 0
duration = (typeof (duration) === 'undefined') ? 500 : duration duration = (typeof (duration) === 'undefined') ? 500 : duration
var animateScroll = function() { const animateScroll = function () {
// increment the time // increment the time
currentTime += increment currentTime += increment
// find the value with the quadratic in-out easing function // 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 the document.body
move(val) move(val)
// do the animation unless its over // do the animation unless its over

View File

@ -11,8 +11,8 @@ export function isExternal(path) {
* @returns {Boolean} * @returns {Boolean}
*/ */
export function validUsername (str) { export function validUsername (str) {
const valid_map = ['admin', 'editor'] const validMap = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0 return validMap.indexOf(str.trim()) >= 0
} }
/** /**
@ -56,7 +56,7 @@ export function validAlphabets(str) {
* @returns {Boolean} * @returns {Boolean}
*/ */
export function validEmail (email) { 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,}))$/ 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) return reg.test(email)
} }

View File

@ -8,12 +8,12 @@ const mimeMap = {
const baseUrl = process.env.VUE_APP_BASE_API const baseUrl = process.env.VUE_APP_BASE_API
export function downLoadZip (str, filename) { export function downLoadZip (str, filename) {
var url = baseUrl + str const url = baseUrl + str
axios({ axios({
method: 'get', method: 'get',
url: url, url: url,
responseType: 'blob', responseType: 'blob',
headers: { 'Authorization': 'Bearer ' + getToken() } headers: { Authorization: 'Bearer ' + getToken() }
}).then(res => { }).then(res => {
resolveBlob(res, mimeMap.zip) resolveBlob(res, mimeMap.zip)
}) })
@ -25,18 +25,18 @@ export function downLoadZip(str, filename) {
*/ */
export function resolveBlob (res, mimeType) { export function resolveBlob (res, mimeType) {
const aLink = document.createElement('a') 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") 设置的文件名; // //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*') const patt = /filename=([^;]+\\.[^\\.;]+);*/
var contentDisposition = decodeURI(res.headers['content-disposition']) const contentDisposition = decodeURI(res.headers['content-disposition'])
var result = patt.exec(contentDisposition) const result = patt.exec(contentDisposition)
var fileName = result[1] let fileName = result[1]
fileName = fileName.replace(/\"/g, '') fileName = fileName.replace(/"/g, '')
aLink.style.display = 'none' aLink.style.display = 'none'
aLink.href = URL.createObjectURL(blob) aLink.href = URL.createObjectURL(blob)
aLink.setAttribute('download', fileName) // 设置下载文件名称 aLink.setAttribute('download', fileName) // 设置下载文件名称
document.body.appendChild(aLink) document.body.appendChild(aLink)
aLink.click() aLink.click()
URL.revokeObjectURL(aLink.href);//清除引用 URL.revokeObjectURL(aLink.href)// 清除引用
document.body.removeChild(aLink); document.body.removeChild(aLink)
} }

View File

@ -3,9 +3,9 @@
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts' // echarts theme
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize' import resize from './mixins/resize'
require('echarts/theme/macarons')
const animationDuration = 6000 const animationDuration = 6000

View File

@ -3,9 +3,9 @@
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts' // echarts theme
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize' import resize from './mixins/resize'
require('echarts/theme/macarons')
export default { export default {
mixins: [resize], mixins: [resize],
@ -93,7 +93,8 @@ export default {
data: ['expected', 'actual'] data: ['expected', 'actual']
}, },
series: [{ series: [{
name: 'expected', itemStyle: { name: 'expected',
itemStyle: {
normal: { normal: {
color: '#FF005A', color: '#FF005A',
lineStyle: { lineStyle: {

View File

@ -3,9 +3,9 @@
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts' // echarts theme
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize' import resize from './mixins/resize'
require('echarts/theme/macarons')
export default { export default {
mixins: [resize], mixins: [resize],

View File

@ -3,9 +3,9 @@
</template> </template>
<script> <script>
import echarts from 'echarts' import echarts from 'echarts' // echarts theme
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize' import resize from './mixins/resize'
require('echarts/theme/macarons')
const animationDuration = 3000 const animationDuration = 3000

View File

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

View File

@ -25,7 +25,6 @@
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</template> </template>

View File

@ -57,31 +57,31 @@
</template> </template>
<script> <script>
import { getCodeImg } from "@/api/login"; import { getCodeImg } from '@/api/login'
import Cookies from "js-cookie"; import Cookies from 'js-cookie'
import { encrypt, decrypt } from '@/utils/jsencrypt' import { encrypt, decrypt } from '@/utils/jsencrypt'
export default { export default {
name: "Login", name: 'Login',
data () { data () {
return { return {
codeUrl: "", codeUrl: '',
cookiePassword: "", cookiePassword: '',
loginForm: { loginForm: {
username: "admin", username: 'admin',
password: "admin123", password: 'admin123',
rememberMe: false, rememberMe: false,
code: "", code: '',
uuid: "" uuid: ''
}, },
loginRules: { loginRules: {
username: [ username: [
{ required: true, trigger: "blur", message: "请输入您的账号" } { required: true, trigger: 'blur', message: '请输入您的账号' }
], ],
password: [ password: [
{ required: true, trigger: "blur", message: "请输入您的密码" } { required: true, trigger: 'blur', message: '请输入您的密码' }
], ],
code: [{ required: true, trigger: "change", message: "请输入验证码" }] code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
}, },
loading: false, loading: false,
// //
@ -89,66 +89,66 @@ export default {
// //
register: false, register: false,
redirect: undefined redirect: undefined
}; }
}, },
watch: { watch: {
$route: { $route: {
handler: function (route) { handler: function (route) {
this.redirect = route.query && route.query.redirect; this.redirect = route.query && route.query.redirect
}, },
immediate: true immediate: true
} }
}, },
created () { created () {
this.getCode(); this.getCode()
this.getCookie(); this.getCookie()
}, },
methods: { methods: {
getCode () { getCode () {
getCodeImg().then(res => { getCodeImg().then(res => {
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff; this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff
if (this.captchaOnOff) { if (this.captchaOnOff) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = 'data:image/gif;base64,' + res.img
this.loginForm.uuid = res.uuid; this.loginForm.uuid = res.uuid
} }
}); })
}, },
getCookie () { getCookie () {
const username = Cookies.get("username"); const username = Cookies.get('username')
const password = Cookies.get("password"); const password = Cookies.get('password')
const rememberMe = Cookies.get('rememberMe') const rememberMe = Cookies.get('rememberMe')
this.loginForm = { this.loginForm = {
username: username === undefined ? this.loginForm.username : username, username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password), password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe) rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
}; }
}, },
handleLogin () { handleLogin () {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
this.loading = true; this.loading = true
if (this.loginForm.rememberMe) { if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 }); Cookies.set('username', this.loginForm.username, { expires: 30 })
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 }); Cookies.set('password', encrypt(this.loginForm.password), { expires: 30 })
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 }); Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 })
} else { } else {
Cookies.remove("username"); Cookies.remove('username')
Cookies.remove("password"); Cookies.remove('password')
Cookies.remove('rememberMe'); Cookies.remove('rememberMe')
} }
this.$store.dispatch("Login", this.loginForm).then(() => { this.$store.dispatch('Login', this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); this.$router.push({ path: this.redirect || '/' }).catch(() => {})
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false
if (this.captchaOnOff) { if (this.captchaOnOff) {
this.getCode(); this.getCode()
} }
}); })
}
})
} }
});
} }
} }
};
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">

View File

@ -11,7 +11,7 @@
<td><div class="cell">Redis版本</div></td> <td><div class="cell">Redis版本</div></td>
<td><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td> <td><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td>
<td><div class="cell">运行模式</div></td> <td><div class="cell">运行模式</div></td>
<td><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "单机" : "集群" }}</div></td> <td><div class="cell" v-if="cache.info">{{ cache.info.redis_mode === "standalone" ? "单机" : "集群" }}</div></td>
<td><div class="cell">端口</div></td> <td><div class="cell">端口</div></td>
<td><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td> <td><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td>
<td><div class="cell">客户端数</div></td> <td><div class="cell">客户端数</div></td>
@ -29,7 +29,7 @@
</tr> </tr>
<tr> <tr>
<td><div class="cell">AOF是否开启</div></td> <td><div class="cell">AOF是否开启</div></td>
<td><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "否" : "是" }}</div></td> <td><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled === "0" ? "否" : "是" }}</div></td>
<td><div class="cell">RDB是否成功</div></td> <td><div class="cell">RDB是否成功</div></td>
<td><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td> <td><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td>
<td><div class="cell">Key数量</div></td> <td><div class="cell">Key数量</div></td>
@ -67,11 +67,11 @@
</template> </template>
<script> <script>
import { getCache } from "@/api/monitor/cache"; import { getCache } from '@/api/monitor/cache'
import echarts from "echarts"; import echarts from 'echarts'
export default { export default {
name: "Server", name: 'Server',
data () { data () {
return { return {
// //
@ -81,73 +81,73 @@ export default {
// 使 // 使
usedmemory: null, usedmemory: null,
// cache // cache
cache: [], cache: []
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.openLoading(); this.openLoading()
}, },
methods: { methods: {
/** 查缓存询信息 */ /** 查缓存询信息 */
getList () { getList () {
getCache().then((response) => { getCache().then((response) => {
this.cache = response.data; this.cache = response.data
this.loading.close(); this.loading.close()
this.commandstats = echarts.init(this.$refs.commandstats, "macarons"); this.commandstats = echarts.init(this.$refs.commandstats, 'macarons')
this.commandstats.setOption({ this.commandstats.setOption({
tooltip: { tooltip: {
trigger: "item", trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)", formatter: '{a} <br/>{b} : {c} ({d}%)'
}, },
series: [ series: [
{ {
name: "命令", name: '命令',
type: "pie", type: 'pie',
roseType: "radius", roseType: 'radius',
radius: [15, 95], radius: [15, 95],
center: ["50%", "38%"], center: ['50%', '38%'],
data: response.data.commandStats, data: response.data.commandStats,
animationEasing: "cubicInOut", animationEasing: 'cubicInOut',
animationDuration: 1000, animationDuration: 1000
}, }
], ]
}); })
this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons"); this.usedmemory = echarts.init(this.$refs.usedmemory, 'macarons')
this.usedmemory.setOption({ this.usedmemory.setOption({
tooltip: { tooltip: {
formatter: "{b} <br/>{a} : " + this.cache.info.used_memory_human, formatter: '{b} <br/>{a} : ' + this.cache.info.used_memory_human
}, },
series: [ series: [
{ {
name: "峰值", name: '峰值',
type: "gauge", type: 'gauge',
min: 0, min: 0,
max: 1000, max: 1000,
detail: { detail: {
formatter: this.cache.info.used_memory_human, formatter: this.cache.info.used_memory_human
}, },
data: [ data: [
{ {
value: parseFloat(this.cache.info.used_memory_human), value: parseFloat(this.cache.info.used_memory_human),
name: "内存消耗", name: '内存消耗'
}, }
], ]
}, }
], ]
}); })
}); })
}, },
// //
openLoading () { openLoading () {
this.loading = this.$loading({ this.loading = this.$loading({
lock: true, lock: true,
text: "拼命读取中", text: '拼命读取中',
spinner: "el-icon-loading", spinner: 'el-icon-loading',
background: "rgba(0, 0, 0, 0.7)", background: 'rgba(0, 0, 0, 0.7)'
}); })
}, }
}, }
}; }
</script> </script>

View File

@ -2,14 +2,14 @@
<i-frame :src="url" /> <i-frame :src="url" />
</template> </template>
<script> <script>
import iFrame from "@/components/iFrame/index"; import iFrame from '@/components/iFrame/index'
export default { export default {
name: "Druid", name: 'Druid',
components: { iFrame }, components: { iFrame },
data () { data () {
return { return {
url: process.env.VUE_APP_BASE_API + "/druid/login.html" url: process.env.VUE_APP_BASE_API + '/druid/login.html'
}; }
}, }
}; }
</script> </script>

View File

@ -252,22 +252,22 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="任务状态:"> <el-form-item label="任务状态:">
<div v-if="form.status == 0">正常</div> <div v-if="form.status === 0">正常</div>
<div v-else-if="form.status == 1">失败</div> <div v-else-if="form.status === 1">失败</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否并发:"> <el-form-item label="是否并发:">
<div v-if="form.concurrent == 0">允许</div> <div v-if="form.concurrent === 0">允许</div>
<div v-else-if="form.concurrent == 1">禁止</div> <div v-else-if="form.concurrent === 1">禁止</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="执行策略:"> <el-form-item label="执行策略:">
<div v-if="form.misfirePolicy == 0">默认策略</div> <div v-if="form.misfirePolicy === 0">默认策略</div>
<div v-else-if="form.misfirePolicy == 1">立即执行</div> <div v-else-if="form.misfirePolicy === 1">立即执行</div>
<div v-else-if="form.misfirePolicy == 2">执行一次</div> <div v-else-if="form.misfirePolicy === 2">执行一次</div>
<div v-else-if="form.misfirePolicy == 3">放弃执行</div> <div v-else-if="form.misfirePolicy === 3">放弃执行</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -280,10 +280,10 @@
</template> </template>
<script> <script>
import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from '@/api/monitor/job'
export default { export default {
name: "Job", name: 'Job',
data () { data () {
return { return {
// //
@ -303,7 +303,7 @@ export default {
// //
jobList: [], jobList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -325,48 +325,48 @@ export default {
// //
rules: { rules: {
jobName: [ jobName: [
{ required: true, message: "任务名称不能为空", trigger: "blur" } { required: true, message: '任务名称不能为空', trigger: 'blur' }
], ],
invokeTarget: [ invokeTarget: [
{ required: true, message: "调用目标字符串不能为空", trigger: "blur" } { required: true, message: '调用目标字符串不能为空', trigger: 'blur' }
], ],
cronExpression: [ cronExpression: [
{ required: true, message: "cron执行表达式不能为空", trigger: "blur" } { required: true, message: 'cron执行表达式不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_job_group").then(response => { this.getDicts('sys_job_group').then(response => {
this.jobGroupOptions = response.data; this.jobGroupOptions = response.data
}); })
this.getDicts("sys_job_status").then(response => { this.getDicts('sys_job_status').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询定时任务列表 */ /** 查询定时任务列表 */
getList () { getList () {
this.loading = true; this.loading = true
listJob(this.queryParams).then(response => { listJob(this.queryParams).then(response => {
this.jobList = response.rows; this.jobList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
jobGroupFormat (row, column) { jobGroupFormat (row, column) {
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); return this.selectDictLabel(this.jobGroupOptions, row.jobGroup)
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -378,146 +378,146 @@ export default {
cronExpression: undefined, cronExpression: undefined,
misfirePolicy: 1, misfirePolicy: 1,
concurrent: 1, concurrent: 1,
status: "0" status: '0'
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.jobId); this.ids = selection.map(item => item.jobId)
this.single = selection.length != 1; this.single = selection.length !== 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
// //
handleCommand (command, row) { handleCommand (command, row) {
switch (command) { switch (command) {
case "handleRun": case 'handleRun':
this.handleRun(row); this.handleRun(row)
break; break
case "handleView": case 'handleView':
this.handleView(row); this.handleView(row)
break; break
case "handleJobLog": case 'handleJobLog':
this.handleJobLog(row); this.handleJobLog(row)
break; break
default: default:
break; break
} }
}, },
// //
handleStatusChange (row) { handleStatusChange (row) {
let text = row.status === "0" ? "启用" : "停用"; const text = row.status === '0' ? '启用' : '停用'
this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", { this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return changeJobStatus(row.jobId, row.status); return changeJobStatus(row.jobId, row.status)
}).then(() => { }).then(() => {
this.msgSuccess(text + "成功"); this.msgSuccess(text + '成功')
}).catch(function () { }).catch(function () {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === '0' ? '1' : '0'
}); })
}, },
/* 立即执行一次 */ /* 立即执行一次 */
handleRun (row) { handleRun (row) {
this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", { this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return runJob(row.jobId, row.jobGroup); return runJob(row.jobId, row.jobGroup)
}).then(() => { }).then(() => {
this.msgSuccess("执行成功"); this.msgSuccess('执行成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 任务详细信息 */ /** 任务详细信息 */
handleView (row) { handleView (row) {
getJob(row.jobId).then(response => { getJob(row.jobId).then(response => {
this.form = response.data; this.form = response.data
this.openView = true; this.openView = true
}); })
}, },
/** 任务日志列表查询 */ /** 任务日志列表查询 */
handleJobLog (row) { handleJobLog (row) {
const jobId = row.jobId || 0; const jobId = row.jobId || 0
this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } }) this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } })
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加任务"; this.title = '添加任务'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const jobId = row.jobId || this.ids; const jobId = row.jobId || this.ids
getJob(jobId).then(response => { getJob(jobId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改任务"; this.title = '修改任务'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.jobId != undefined) { if (this.form.jobId !== undefined) {
updateJob(this.form).then(response => { updateJob(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addJob(this.form).then(response => { addJob(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const jobIds = row.jobId || this.ids; const jobIds = row.jobId || this.ids
this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", { this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delJob(jobIds); return delJob(jobIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm("是否确认导出所有定时任务数据项?", "警告", { this.$confirm('是否确认导出所有定时任务数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportJob(queryParams); return exportJob(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -160,12 +160,12 @@
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="执行状态:"> <el-form-item label="执行状态:">
<div v-if="form.status == 0">正常</div> <div v-if="form.status === 0">正常</div>
<div v-else-if="form.status == 1">失败</div> <div v-else-if="form.status === 1">失败</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="异常信息:" v-if="form.status == 1">{{ form.exceptionInfo }}</el-form-item> <el-form-item label="异常信息:" v-if="form.status === 1">{{ form.exceptionInfo }}</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -177,11 +177,11 @@
</template> </template>
<script> <script>
import { getJob} from "@/api/monitor/job"; import { getJob } from '@/api/monitor/job'
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog"; import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from '@/api/monitor/jobLog'
export default { export default {
name: "JobLog", name: 'JobLog',
data () { data () {
return { return {
// //
@ -216,113 +216,113 @@ export default {
jobGroup: undefined, jobGroup: undefined,
status: undefined status: undefined
} }
}; }
}, },
created () { created () {
const jobId = this.$route.query.jobId; const jobId = this.$route.query.jobId
if (jobId !== undefined && jobId != 0) { if (jobId !== undefined && jobId !== 0) {
getJob(jobId).then(response => { getJob(jobId).then(response => {
this.queryParams.jobName = response.data.jobName; this.queryParams.jobName = response.data.jobName
this.queryParams.jobGroup = response.data.jobGroup; this.queryParams.jobGroup = response.data.jobGroup
this.getList(); this.getList()
}); })
} else { } else {
this.getList(); this.getList()
} }
this.getDicts("sys_common_status").then(response => { this.getDicts('sys_common_status').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
this.getDicts("sys_job_group").then(response => { this.getDicts('sys_job_group').then(response => {
this.jobGroupOptions = response.data; this.jobGroupOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询调度日志列表 */ /** 查询调度日志列表 */
getList () { getList () {
this.loading = true; this.loading = true
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.jobLogList = response.rows; this.jobLogList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
jobGroupFormat (row, column) { jobGroupFormat (row, column) {
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); return this.selectDictLabel(this.jobGroupOptions, row.jobGroup)
}, },
// //
handleClose () { handleClose () {
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push({ path: "/monitor/job" }); this.$router.push({ path: '/monitor/job' })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.jobLogId); this.ids = selection.map(item => item.jobLogId)
this.multiple = !selection.length; this.multiple = !selection.length
}, },
/** 详细按钮操作 */ /** 详细按钮操作 */
handleView (row) { handleView (row) {
this.open = true; this.open = true
this.form = row; this.form = row
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const jobLogIds = this.ids; const jobLogIds = this.ids
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", { this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delJobLog(jobLogIds); return delJobLog(jobLogIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean () { handleClean () {
this.$confirm("是否确认清空所有调度日志数据项?", "警告", { this.$confirm('是否确认清空所有调度日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return cleanJobLog(); return cleanJobLog()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("清空成功"); this.msgSuccess('清空成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm("是否确认导出所有调度日志数据项?", "警告", { this.$confirm('是否确认导出所有调度日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportJobLog(queryParams); return exportJobLog(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -119,10 +119,10 @@
</template> </template>
<script> <script>
import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor"; import { list, delLogininfor, cleanLogininfor, exportLogininfor } from '@/api/monitor/logininfor'
export default { export default {
name: "Logininfor", name: 'Logininfor',
data () { data () {
return { return {
// //
@ -153,40 +153,40 @@ export default {
userName: undefined, userName: undefined,
status: undefined status: undefined
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_common_status").then(response => { this.getDicts('sys_common_status').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询登录日志列表 */ /** 查询登录日志列表 */
getList () { getList () {
this.loading = true; this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.rows; this.list = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
this.handleQuery(); this.handleQuery()
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange (selection) { handleSelectionChange (selection) {
@ -195,53 +195,52 @@ export default {
}, },
/** 排序触发事件 */ /** 排序触发事件 */
handleSortChange (column, prop, order) { handleSortChange (column, prop, order) {
this.queryParams.orderByColumn = column.prop; this.queryParams.orderByColumn = column.prop
this.queryParams.isAsc = column.order; this.queryParams.isAsc = column.order
this.getList(); this.getList()
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const infoIds = row.infoId || this.ids; const infoIds = row.infoId || this.ids
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", { this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delLogininfor(infoIds); return delLogininfor(infoIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean () { handleClean () {
this.$confirm('是否确认清空所有登录日志数据项?', "警告", { this.$confirm('是否确认清空所有登录日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return cleanLogininfor(); return cleanLogininfor()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("清空成功"); this.msgSuccess('清空成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志数据项?', "警告", { this.$confirm('是否确认导出所有操作日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportLogininfor(queryParams); return exportLogininfor(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -65,10 +65,10 @@
</template> </template>
<script> <script>
import { list, forceLogout } from "@/api/monitor/online"; import { list, forceLogout } from '@/api/monitor/online'
export default { export default {
name: "Online", name: 'Online',
data () { data () {
return { return {
// //
@ -84,45 +84,44 @@ export default {
ipaddr: undefined, ipaddr: undefined,
userName: undefined userName: undefined
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
}, },
methods: { methods: {
/** 查询登录日志列表 */ /** 查询登录日志列表 */
getList () { getList () {
this.loading = true; this.loading = true
list(this.queryParams).then(response => { list(this.queryParams).then(response => {
this.list = response.rows; this.list = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.pageNum = 1; this.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 强退按钮操作 */ /** 强退按钮操作 */
handleForceLogout (row) { handleForceLogout (row) {
this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", { this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return forceLogout(row.tokenId); return forceLogout(row.tokenId)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("强退成功"); this.msgSuccess('强退成功')
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -188,10 +188,10 @@
</template> </template>
<script> <script>
import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog"; import { list, delOperlog, cleanOperlog, exportOperlog } from '@/api/monitor/operlog'
export default { export default {
name: "Operlog", name: 'Operlog',
data () { data () {
return { return {
// //
@ -229,47 +229,47 @@ export default {
businessType: undefined, businessType: undefined,
status: undefined status: undefined
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_oper_type").then(response => { this.getDicts('sys_oper_type').then(response => {
this.typeOptions = response.data; this.typeOptions = response.data
}); })
this.getDicts("sys_common_status").then(response => { this.getDicts('sys_common_status').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询登录日志 */ /** 查询登录日志 */
getList () { getList () {
this.loading = true; this.loading = true
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => { list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.rows; this.list = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
typeFormat (row, column) { typeFormat (row, column) {
return this.selectDictLabel(this.typeOptions, row.businessType); return this.selectDictLabel(this.typeOptions, row.businessType)
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order) this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
this.handleQuery(); this.handleQuery()
}, },
/** 多选框选中数据 */ /** 多选框选中数据 */
handleSelectionChange (selection) { handleSelectionChange (selection) {
@ -278,58 +278,57 @@ export default {
}, },
/** 排序触发事件 */ /** 排序触发事件 */
handleSortChange (column, prop, order) { handleSortChange (column, prop, order) {
this.queryParams.orderByColumn = column.prop; this.queryParams.orderByColumn = column.prop
this.queryParams.isAsc = column.order; this.queryParams.isAsc = column.order
this.getList(); this.getList()
}, },
/** 详细按钮操作 */ /** 详细按钮操作 */
handleView (row) { handleView (row) {
this.open = true; this.open = true
this.form = row; this.form = row
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const operIds = row.operId || this.ids; const operIds = row.operId || this.ids
this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', "警告", { this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delOperlog(operIds); return delOperlog(operIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 清空按钮操作 */ /** 清空按钮操作 */
handleClean () { handleClean () {
this.$confirm('是否确认清空所有操作日志数据项?', "警告", { this.$confirm('是否确认清空所有操作日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return cleanOperlog(); return cleanOperlog()
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("清空成功"); this.msgSuccess('清空成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有操作日志数据项?', "警告", { this.$confirm('是否确认导出所有操作日志数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportOperlog(queryParams); return exportOperlog(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -153,7 +153,7 @@
</tr> </tr>
</thead> </thead>
<tbody v-if="server.sysFiles"> <tbody v-if="server.sysFiles">
<tr v-for="sysFile in server.sysFiles"> <tr v-for="sysFile in server.sysFiles" v-bind:key="sysFile.name">
<td><div class="cell">{{ sysFile.dirName }}</div></td> <td><div class="cell">{{ sysFile.dirName }}</div></td>
<td><div class="cell">{{ sysFile.sysTypeName }}</div></td> <td><div class="cell">{{ sysFile.sysTypeName }}</div></td>
<td><div class="cell">{{ sysFile.typeName }}</div></td> <td><div class="cell">{{ sysFile.typeName }}</div></td>
@ -172,39 +172,39 @@
</template> </template>
<script> <script>
import { getServer } from "@/api/monitor/server"; import { getServer } from '@/api/monitor/server'
export default { export default {
name: "Server", name: 'Server',
data () { data () {
return { return {
// //
loading: [], loading: [],
// //
server: [] server: []
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.openLoading(); this.openLoading()
}, },
methods: { methods: {
/** 查询服务器信息 */ /** 查询服务器信息 */
getList () { getList () {
getServer().then(response => { getServer().then(response => {
this.server = response.data; this.server = response.data
this.loading.close(); this.loading.close()
}); })
}, },
// //
openLoading () { openLoading () {
this.loading = this.$loading({ this.loading = this.$loading({
lock: true, lock: true,
text: "拼命读取中", text: '拼命读取中',
spinner: "el-icon-loading", spinner: 'el-icon-loading',
background: "rgba(0, 0, 0, 0.7)" background: 'rgba(0, 0, 0, 0.7)'
}); })
}
} }
} }
};
</script> </script>

View File

@ -67,81 +67,81 @@
</template> </template>
<script> <script>
import { getCodeImg, register } from "@/api/login"; import { getCodeImg, register } from '@/api/login'
export default { export default {
name: "Register", name: 'Register',
data () { data () {
const equalToPassword = (rule, value, callback) => { const equalToPassword = (rule, value, callback) => {
if (this.registerForm.password !== value) { if (this.registerForm.password !== value) {
callback(new Error("两次输入的密码不一致")); callback(new Error('两次输入的密码不一致'))
} else { } else {
callback(); callback()
}
} }
};
return { return {
codeUrl: "", codeUrl: '',
registerForm: { registerForm: {
username: "", username: '',
password: "", password: '',
confirmPassword: "", confirmPassword: '',
code: "", code: '',
uuid: "" uuid: ''
}, },
registerRules: { registerRules: {
username: [ username: [
{ required: true, trigger: "blur", message: "请输入您的账号" }, { required: true, trigger: 'blur', message: '请输入您的账号' },
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' } { min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
], ],
password: [ password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }, { required: true, trigger: 'blur', message: '请输入您的密码' },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' } { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
], ],
confirmPassword: [ confirmPassword: [
{ required: true, trigger: "blur", message: "请再次输入您的密码" }, { required: true, trigger: 'blur', message: '请再次输入您的密码' },
{ required: true, validator: equalToPassword, trigger: "blur" } { required: true, validator: equalToPassword, trigger: 'blur' }
], ],
code: [{ required: true, trigger: "change", message: "请输入验证码" }] code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
}, },
loading: false, loading: false,
captchaOnOff: true captchaOnOff: true
}; }
}, },
created () { created () {
this.getCode(); this.getCode()
}, },
methods: { methods: {
getCode () { getCode () {
getCodeImg().then(res => { getCodeImg().then(res => {
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff; this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff
if (this.captchaOnOff) { if (this.captchaOnOff) {
this.codeUrl = "data:image/gif;base64," + res.img; this.codeUrl = 'data:image/gif;base64,' + res.img
this.registerForm.uuid = res.uuid; this.registerForm.uuid = res.uuid
} }
}); })
}, },
handleRegister () { handleRegister () {
this.$refs.registerForm.validate(valid => { this.$refs.registerForm.validate(valid => {
if (valid) { if (valid) {
this.loading = true; this.loading = true
register(this.registerForm).then(res => { register(this.registerForm).then(res => {
const username = this.registerForm.username; const username = this.registerForm.username
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', { this.$alert("<font color='red'>恭喜你,您的账号 " + username + ' 注册成功!</font>', '系统提示', {
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true
}).then(() => { }).then(() => {
this.$router.push("/login"); this.$router.push('/login')
}).catch(() => {}); }).catch(() => {})
}).catch(() => { }).catch(() => {
this.loading = false; this.loading = false
if (this.captchaOnOff) { if (this.captchaOnOff) {
this.getCode(); this.getCode()
}
})
} }
}) })
} }
});
} }
} }
};
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">

View File

@ -181,10 +181,10 @@
</template> </template>
<script> <script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from "@/api/system/config"; import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, refreshCache } from '@/api/system/config'
export default { export default {
name: "Config", name: 'Config',
data () { data () {
return { return {
// //
@ -204,7 +204,7 @@ export default {
// //
configList: [], configList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -224,42 +224,42 @@ export default {
// //
rules: { rules: {
configName: [ configName: [
{ required: true, message: "参数名称不能为空", trigger: "blur" } { required: true, message: '参数名称不能为空', trigger: 'blur' }
], ],
configKey: [ configKey: [
{ required: true, message: "参数键名不能为空", trigger: "blur" } { required: true, message: '参数键名不能为空', trigger: 'blur' }
], ],
configValue: [ configValue: [
{ required: true, message: "参数键值不能为空", trigger: "blur" } { required: true, message: '参数键值不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_yes_no").then(response => { this.getDicts('sys_yes_no').then(response => {
this.typeOptions = response.data; this.typeOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询参数列表 */ /** 查询参数列表 */
getList () { getList () {
this.loading = true; this.loading = true
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.configList = response.rows; this.configList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
typeFormat (row, column) { typeFormat (row, column) {
return this.selectDictLabel(this.typeOptions, row.configType); return this.selectDictLabel(this.typeOptions, row.configType)
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -268,99 +268,99 @@ export default {
configName: undefined, configName: undefined,
configKey: undefined, configKey: undefined,
configValue: undefined, configValue: undefined,
configType: "Y", configType: 'Y',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加参数"; this.title = '添加参数'
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.configId) this.ids = selection.map(item => item.configId)
this.single = selection.length!=1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const configId = row.configId || this.ids const configId = row.configId || this.ids
getConfig(configId).then(response => { getConfig(configId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改参数"; this.title = '修改参数'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.configId != undefined) { if (this.form.configId !== undefined) {
updateConfig(this.form).then(response => { updateConfig(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addConfig(this.form).then(response => { addConfig(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const configIds = row.configId || this.ids; const configIds = row.configId || this.ids
this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', "警告", { this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delConfig(configIds); return delConfig(configIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有参数数据项?', "警告", { this.$confirm('是否确认导出所有参数数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportConfig(queryParams); return exportConfig(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache () { handleRefreshCache () {
refreshCache().then(() => { refreshCache().then(() => {
this.msgSuccess("刷新成功"); this.msgSuccess('刷新成功')
}); })
}
} }
} }
};
</script> </script>

View File

@ -72,7 +72,7 @@
v-hasPermi="['system:dept:add']" v-hasPermi="['system:dept:add']"
>新增</el-button> >新增</el-button>
<el-button <el-button
v-if="scope.row.parentId != 0" v-if="scope.row.parentId !== 0"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@ -139,12 +139,12 @@
</template> </template>
<script> <script>
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept"; import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from '@/api/system/dept'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from '@riophae/vue-treeselect'
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default { export default {
name: "Dept", name: 'Dept',
components: { Treeselect }, components: { Treeselect },
data () { data () {
return { return {
@ -157,7 +157,7 @@ export default {
// //
deptOptions: [], deptOptions: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -172,65 +172,65 @@ export default {
// //
rules: { rules: {
parentId: [ parentId: [
{ required: true, message: "上级部门不能为空", trigger: "blur" } { required: true, message: '上级部门不能为空', trigger: 'blur' }
], ],
deptName: [ deptName: [
{ required: true, message: "部门名称不能为空", trigger: "blur" } { required: true, message: '部门名称不能为空', trigger: 'blur' }
], ],
orderNum: [ orderNum: [
{ required: true, message: "显示排序不能为空", trigger: "blur" } { required: true, message: '显示排序不能为空', trigger: 'blur' }
], ],
email: [ email: [
{ {
type: "email", type: 'email',
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"] trigger: ['blur', 'change']
} }
], ],
phone: [ phone: [
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: '请输入正确的手机号码',
trigger: "blur" trigger: 'blur'
} }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询部门列表 */ /** 查询部门列表 */
getList () { getList () {
this.loading = true; this.loading = true
listDept(this.queryParams).then(response => { listDept(this.queryParams).then(response => {
this.deptList = this.handleTree(response.data, "deptId"); this.deptList = this.handleTree(response.data, 'deptId')
this.loading = false; this.loading = false
}); })
}, },
/** 转换部门数据结构 */ /** 转换部门数据结构 */
normalizer (node) { normalizer (node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.deptId, id: node.deptId,
label: node.deptName, label: node.deptName,
children: node.children children: node.children
}; }
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -242,76 +242,76 @@ export default {
leader: undefined, leader: undefined,
phone: undefined, phone: undefined,
email: undefined, email: undefined,
status: "0" status: '0'
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd (row) { handleAdd (row) {
this.reset(); this.reset()
if (row != undefined) { if (row !== undefined) {
this.form.parentId = row.deptId; this.form.parentId = row.deptId
} }
this.open = true; this.open = true
this.title = "添加部门"; this.title = '添加部门'
listDept().then(response => { listDept().then(response => {
this.deptOptions = this.handleTree(response.data, "deptId"); this.deptOptions = this.handleTree(response.data, 'deptId')
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
getDept(row.deptId).then(response => { getDept(row.deptId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改部门"; this.title = '修改部门'
}); })
listDeptExcludeChild(row.deptId).then(response => { listDeptExcludeChild(row.deptId).then(response => {
this.deptOptions = this.handleTree(response.data, "deptId"); this.deptOptions = this.handleTree(response.data, 'deptId')
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.deptId != undefined) { if (this.form.deptId !== undefined) {
updateDept(this.form).then(response => { updateDept(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addDept(this.form).then(response => { addDept(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", { this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delDept(row.deptId); return delDept(row.deptId)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -88,8 +88,8 @@
<el-table-column label="字典编码" align="center" prop="dictCode" /> <el-table-column label="字典编码" align="center" prop="dictCode" />
<el-table-column label="字典标签" align="center" prop="dictLabel"> <el-table-column label="字典标签" align="center" prop="dictLabel">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.listClass == '' || scope.row.listClass == 'default'">{{scope.row.dictLabel}}</span> <span v-if="scope.row.listClass === '' || scope.row.listClass === 'default'">{{scope.row.dictLabel}}</span>
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag> <el-tag v-else :type="scope.row.listClass === 'primary' ? '' : scope.row.listClass">{{scope.row.dictLabel}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="字典键值" align="center" prop="dictValue" /> <el-table-column label="字典键值" align="center" prop="dictValue" />
@ -183,11 +183,11 @@
</template> </template>
<script> <script>
import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data"; import { listData, getData, delData, addData, updateData, exportData } from '@/api/system/dict/data'
import { listType, getType } from "@/api/system/dict/type"; import { listType, getType } from '@/api/system/dict/type'
export default { export default {
name: "Data", name: 'Data',
data () { data () {
return { return {
// //
@ -207,36 +207,36 @@ export default {
// //
dataList: [], dataList: [],
// //
defaultDictType: "", defaultDictType: '',
// //
title: "", title: '',
// //
open: false, open: false,
// //
listClassOptions: [ listClassOptions: [
{ {
value: "default", value: 'default',
label: "默认" label: '默认'
}, },
{ {
value: "primary", value: 'primary',
label: "主要" label: '主要'
}, },
{ {
value: "success", value: 'success',
label: "成功" label: '成功'
}, },
{ {
value: "info", value: 'info',
label: "信息" label: '信息'
}, },
{ {
value: "warning", value: 'warning',
label: "警告" label: '警告'
}, },
{ {
value: "danger", value: 'danger',
label: "危险" label: '危险'
} }
], ],
// //
@ -256,53 +256,53 @@ export default {
// //
rules: { rules: {
dictLabel: [ dictLabel: [
{ required: true, message: "数据标签不能为空", trigger: "blur" } { required: true, message: '数据标签不能为空', trigger: 'blur' }
], ],
dictValue: [ dictValue: [
{ required: true, message: "数据键值不能为空", trigger: "blur" } { required: true, message: '数据键值不能为空', trigger: 'blur' }
], ],
dictSort: [ dictSort: [
{ required: true, message: "数据顺序不能为空", trigger: "blur" } { required: true, message: '数据顺序不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
const dictId = this.$route.params && this.$route.params.dictId; const dictId = this.$route.params && this.$route.params.dictId
this.getType(dictId); this.getType(dictId)
this.getTypeList(); this.getTypeList()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询字典类型详细 */ /** 查询字典类型详细 */
getType (dictId) { getType (dictId) {
getType(dictId).then(response => { getType(dictId).then(response => {
this.queryParams.dictType = response.data.dictType; this.queryParams.dictType = response.data.dictType
this.defaultDictType = response.data.dictType; this.defaultDictType = response.data.dictType
this.getList(); this.getList()
}); })
}, },
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getTypeList () { getTypeList () {
listType().then(response => { listType().then(response => {
this.typeOptions = response.rows; this.typeOptions = response.rows
}); })
}, },
/** 查询字典数据列表 */ /** 查询字典数据列表 */
getList () { getList () {
this.loading = true; this.loading = true
listData(this.queryParams).then(response => { listData(this.queryParams).then(response => {
this.dataList = response.rows; this.dataList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -313,94 +313,94 @@ export default {
cssClass: undefined, cssClass: undefined,
listClass: 'default', listClass: 'default',
dictSort: 0, dictSort: 0,
status: "0", status: '0',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.queryParams.dictType = this.defaultDictType; this.queryParams.dictType = this.defaultDictType
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加字典数据"; this.title = '添加字典数据'
this.form.dictType = this.queryParams.dictType; this.form.dictType = this.queryParams.dictType
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.dictCode) this.ids = selection.map(item => item.dictCode)
this.single = selection.length!=1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const dictCode = row.dictCode || this.ids const dictCode = row.dictCode || this.ids
getData(dictCode).then(response => { getData(dictCode).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改字典数据"; this.title = '修改字典数据'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.dictCode != undefined) { if (this.form.dictCode !== undefined) {
updateData(this.form).then(response => { updateData(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addData(this.form).then(response => { addData(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const dictCodes = row.dictCode || this.ids; const dictCodes = row.dictCode || this.ids
this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", { this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delData(dictCodes); return delData(dictCodes)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有数据项?', "警告", { this.$confirm('是否确认导出所有数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportData(queryParams); return exportData(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -193,10 +193,10 @@
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, exportType, refreshCache } from "@/api/system/dict/type"; import { listType, getType, delType, addType, updateType, exportType, refreshCache } from '@/api/system/dict/type'
export default { export default {
name: "Dict", name: 'Dict',
data () { data () {
return { return {
// //
@ -216,7 +216,7 @@ export default {
// //
typeList: [], typeList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -236,35 +236,35 @@ export default {
// //
rules: { rules: {
dictName: [ dictName: [
{ required: true, message: "字典名称不能为空", trigger: "blur" } { required: true, message: '字典名称不能为空', trigger: 'blur' }
], ],
dictType: [ dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" } { required: true, message: '字典类型不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList () { getList () {
this.loading = true; this.loading = true
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.typeList = response.rows; this.typeList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -272,99 +272,99 @@ export default {
dictId: undefined, dictId: undefined,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: "0", status: '0',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加字典类型"; this.title = '添加字典类型'
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.dictId) this.ids = selection.map(item => item.dictId)
this.single = selection.length!=1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const dictId = row.dictId || this.ids const dictId = row.dictId || this.ids
getType(dictId).then(response => { getType(dictId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改字典类型"; this.title = '修改字典类型'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.dictId != undefined) { if (this.form.dictId !== undefined) {
updateType(this.form).then(response => { updateType(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addType(this.form).then(response => { addType(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const dictIds = row.dictId || this.ids; const dictIds = row.dictId || this.ids
this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', "警告", { this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delType(dictIds); return delType(dictIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有类型数据项?', "警告", { this.$confirm('是否确认导出所有类型数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportType(queryParams); return exportType(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache () { handleRefreshCache () {
refreshCache().then(() => { refreshCache().then(() => {
this.msgSuccess("刷新成功"); this.msgSuccess('刷新成功')
}); })
}
} }
} }
};
</script> </script>

View File

@ -112,7 +112,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item v-if="form.menuType != 'F'" label="菜单图标"> <el-form-item v-if="form.menuType !== 'F'" label="菜单图标">
<el-popover <el-popover
placement="bottom-start" placement="bottom-start"
width="460" width="460"
@ -144,7 +144,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'"> <el-form-item v-if="form.menuType !== 'F'">
<span slot="label"> <span slot="label">
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top"> <el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
<i class="el-icon-question"></i> <i class="el-icon-question"></i>
@ -158,7 +158,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'" prop="path"> <el-form-item v-if="form.menuType !== 'F'" prop="path">
<span slot="label"> <span slot="label">
<el-tooltip content="访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头" placement="top"> <el-tooltip content="访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头" placement="top">
<i class="el-icon-question"></i> <i class="el-icon-question"></i>
@ -168,7 +168,7 @@
<el-input v-model="form.path" placeholder="请输入路由地址" /> <el-input v-model="form.path" placeholder="请输入路由地址" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="form.menuType == 'C'"> <el-col :span="12" v-if="form.menuType === 'C'">
<el-form-item prop="component"> <el-form-item prop="component">
<span slot="label"> <span slot="label">
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top"> <el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
@ -180,7 +180,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'M'"> <el-form-item v-if="form.menuType !== 'M'">
<el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" /> <el-input v-model="form.perms" placeholder="请输入权限标识" maxlength="100" />
<span slot="label"> <span slot="label">
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top"> <el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
@ -191,7 +191,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'"> <el-form-item v-if="form.menuType !== 'F'">
<span slot="label"> <span slot="label">
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top"> <el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
<i class="el-icon-question"></i> <i class="el-icon-question"></i>
@ -208,7 +208,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType != 'F'"> <el-form-item v-if="form.menuType !== 'F'">
<span slot="label"> <span slot="label">
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top"> <el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
<i class="el-icon-question"></i> <i class="el-icon-question"></i>
@ -225,7 +225,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.menuType == 'C'"> <el-form-item v-if="form.menuType === 'C'">
<span slot="label"> <span slot="label">
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top"> <el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
<i class="el-icon-question"></i> <i class="el-icon-question"></i>
@ -249,13 +249,13 @@
</template> </template>
<script> <script>
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu"; import { listMenu, getMenu, delMenu, addMenu, updateMenu } from '@/api/system/menu'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from '@riophae/vue-treeselect'
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import IconSelect from "@/components/IconSelect"; import IconSelect from '@/components/IconSelect'
export default { export default {
name: "Menu", name: 'Menu',
components: { Treeselect, IconSelect }, components: { Treeselect, IconSelect },
data () { data () {
return { return {
@ -268,7 +268,7 @@ export default {
// //
menuOptions: [], menuOptions: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -285,77 +285,77 @@ export default {
// //
rules: { rules: {
menuName: [ menuName: [
{ required: true, message: "菜单名称不能为空", trigger: "blur" } { required: true, message: '菜单名称不能为空', trigger: 'blur' }
], ],
orderNum: [ orderNum: [
{ required: true, message: "菜单顺序不能为空", trigger: "blur" } { required: true, message: '菜单顺序不能为空', trigger: 'blur' }
], ],
path: [ path: [
{ required: true, message: "路由地址不能为空", trigger: "blur" } { required: true, message: '路由地址不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_show_hide").then(response => { this.getDicts('sys_show_hide').then(response => {
this.visibleOptions = response.data; this.visibleOptions = response.data
}); })
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
// //
selected (name) { selected (name) {
this.form.icon = name; this.form.icon = name
}, },
/** 查询菜单列表 */ /** 查询菜单列表 */
getList () { getList () {
this.loading = true; this.loading = true
listMenu(this.queryParams).then(response => { listMenu(this.queryParams).then(response => {
this.menuList = this.handleTree(response.data, "menuId"); this.menuList = this.handleTree(response.data, 'menuId')
this.loading = false; this.loading = false
}); })
}, },
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
normalizer (node) { normalizer (node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.menuId, id: node.menuId,
label: node.menuName, label: node.menuName,
children: node.children children: node.children
}; }
}, },
/** 查询菜单下拉树结构 */ /** 查询菜单下拉树结构 */
getTreeselect () { getTreeselect () {
listMenu().then(response => { listMenu().then(response => {
this.menuOptions = []; this.menuOptions = []
const menu = { menuId: 0, menuName: '主类目', children: [] }; const menu = { menuId: 0, menuName: '主类目', children: [] }
menu.children = this.handleTree(response.data, "menuId"); menu.children = this.handleTree(response.data, 'menuId')
this.menuOptions.push(menu); this.menuOptions.push(menu)
}); })
}, },
// //
visibleFormat (row, column) { visibleFormat (row, column) {
if (row.menuType == "F") { if (row.menuType === 'F') {
return ""; return ''
} }
return this.selectDictLabel(this.visibleOptions, row.visible); return this.selectDictLabel(this.visibleOptions, row.visible)
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
if (row.menuType == "F") { if (row.menuType === 'F') {
return ""; return ''
} }
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -364,79 +364,79 @@ export default {
parentId: 0, parentId: 0,
menuName: undefined, menuName: undefined,
icon: undefined, icon: undefined,
menuType: "M", menuType: 'M',
orderNum: undefined, orderNum: undefined,
isFrame: "1", isFrame: '1',
isCache: "0", isCache: '0',
visible: "0", visible: '0',
status: "0" status: '0'
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd (row) { handleAdd (row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
if (row != null && row.menuId) { if (row !== null && row.menuId) {
this.form.parentId = row.menuId; this.form.parentId = row.menuId
} else { } else {
this.form.parentId = 0; this.form.parentId = 0
} }
this.open = true; this.open = true
this.title = "添加菜单"; this.title = '添加菜单'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
getMenu(row.menuId).then(response => { getMenu(row.menuId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改菜单"; this.title = '修改菜单'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.menuId != undefined) { if (this.form.menuId !== undefined) {
updateMenu(this.form).then(response => { updateMenu(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addMenu(this.form).then(response => { addMenu(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', "警告", { this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delMenu(row.menuId); return delMenu(row.menuId)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -176,10 +176,10 @@
</template> </template>
<script> <script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"; import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice'
export default { export default {
name: "Notice", name: 'Notice',
data () { data () {
return { return {
// //
@ -197,7 +197,7 @@ export default {
// //
noticeList: [], noticeList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -217,45 +217,45 @@ export default {
// //
rules: { rules: {
noticeTitle: [ noticeTitle: [
{ required: true, message: "公告标题不能为空", trigger: "blur" } { required: true, message: '公告标题不能为空', trigger: 'blur' }
], ],
noticeType: [ noticeType: [
{ required: true, message: "公告类型不能为空", trigger: "change" } { required: true, message: '公告类型不能为空', trigger: 'change' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_notice_status").then(response => { this.getDicts('sys_notice_status').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
this.getDicts("sys_notice_type").then(response => { this.getDicts('sys_notice_type').then(response => {
this.typeOptions = response.data; this.typeOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询公告列表 */ /** 查询公告列表 */
getList () { getList () {
this.loading = true; this.loading = true
listNotice(this.queryParams).then(response => { listNotice(this.queryParams).then(response => {
this.noticeList = response.rows; this.noticeList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
typeFormat (row, column) { typeFormat (row, column) {
return this.selectDictLabel(this.typeOptions, row.noticeType); return this.selectDictLabel(this.typeOptions, row.noticeType)
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -264,76 +264,76 @@ export default {
noticeTitle: undefined, noticeTitle: undefined,
noticeType: undefined, noticeType: undefined,
noticeContent: undefined, noticeContent: undefined,
status: "0" status: '0'
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.noticeId) this.ids = selection.map(item => item.noticeId)
this.single = selection.length!=1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加公告"; this.title = '添加公告'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const noticeId = row.noticeId || this.ids const noticeId = row.noticeId || this.ids
getNotice(noticeId).then(response => { getNotice(noticeId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改公告"; this.title = '修改公告'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.noticeId != undefined) { if (this.form.noticeId !== undefined) {
updateNotice(this.form).then(response => { updateNotice(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addNotice(this.form).then(response => { addNotice(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const noticeIds = row.noticeId || this.ids const noticeIds = row.noticeId || this.ids
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", { this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delNotice(noticeIds); return delNotice(noticeIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -156,10 +156,10 @@
</template> </template>
<script> <script>
import { listPost, getPost, delPost, addPost, updatePost, exportPost } from "@/api/system/post"; import { listPost, getPost, delPost, addPost, updatePost, exportPost } from '@/api/system/post'
export default { export default {
name: "Post", name: 'Post',
data () { data () {
return { return {
// //
@ -179,7 +179,7 @@ export default {
// //
postList: [], postList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -197,41 +197,41 @@ export default {
// //
rules: { rules: {
postName: [ postName: [
{ required: true, message: "岗位名称不能为空", trigger: "blur" } { required: true, message: '岗位名称不能为空', trigger: 'blur' }
], ],
postCode: [ postCode: [
{ required: true, message: "岗位编码不能为空", trigger: "blur" } { required: true, message: '岗位编码不能为空', trigger: 'blur' }
], ],
postSort: [ postSort: [
{ required: true, message: "岗位顺序不能为空", trigger: "blur" } { required: true, message: '岗位顺序不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询岗位列表 */ /** 查询岗位列表 */
getList () { getList () {
this.loading = true; this.loading = true
listPost(this.queryParams).then(response => { listPost(this.queryParams).then(response => {
this.postList = response.rows; this.postList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
}); })
}, },
// //
statusFormat (row, column) { statusFormat (row, column) {
return this.selectDictLabel(this.statusOptions, row.status); return this.selectDictLabel(this.statusOptions, row.status)
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -240,92 +240,92 @@ export default {
postCode: undefined, postCode: undefined,
postName: undefined, postName: undefined,
postSort: 0, postSort: 0,
status: "0", status: '0',
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.postId) this.ids = selection.map(item => item.postId)
this.single = selection.length!=1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.open = true; this.open = true
this.title = "添加岗位"; this.title = '添加岗位'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const postId = row.postId || this.ids const postId = row.postId || this.ids
getPost(postId).then(response => { getPost(postId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.title = "修改岗位"; this.title = '修改岗位'
}); })
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.postId != undefined) { if (this.form.postId !== undefined) {
updatePost(this.form).then(response => { updatePost(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addPost(this.form).then(response => { addPost(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const postIds = row.postId || this.ids; const postIds = row.postId || this.ids
this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", { this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delPost(postIds); return delPost(postIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有岗位数据项?', "警告", { this.$confirm('是否确认导出所有岗位数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportPost(queryParams); return exportPost(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -102,11 +102,11 @@
</template> </template>
<script> <script>
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role"; import { allocatedUserList, authUserCancel, authUserCancelAll } from '@/api/system/role'
import selectUser from "./selectUser"; import selectUser from './selectUser'
export default { export default {
name: "AuthUser", name: 'AuthUser',
components: { selectUser }, components: { selectUser },
data () { data () {
return { return {
@ -132,43 +132,43 @@ export default {
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined
} }
}; }
}, },
created () { created () {
const roleId = this.$route.params && this.$route.params.roleId; const roleId = this.$route.params && this.$route.params.roleId
if (roleId) { if (roleId) {
this.queryParams.roleId = roleId; this.queryParams.roleId = roleId
this.getList(); this.getList()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
} }
}, },
methods: { methods: {
/** 查询授权用户列表 */ /** 查询授权用户列表 */
getList () { getList () {
this.loading = true; this.loading = true
allocatedUserList(this.queryParams).then(response => { allocatedUserList(this.queryParams).then(response => {
this.userList = response.rows; this.userList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
// //
handleClose () { handleClose () {
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push({ path: "/system/role" }); this.$router.push({ path: '/system/role' })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
@ -177,37 +177,37 @@ export default {
}, },
/** 打开授权用户表弹窗 */ /** 打开授权用户表弹窗 */
openSelectUser () { openSelectUser () {
this.$refs.select.show(); this.$refs.select.show()
}, },
/** 取消授权按钮操作 */ /** 取消授权按钮操作 */
cancelAuthUser (row) { cancelAuthUser (row) {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId
this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', "警告", { this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return authUserCancel({ userId: row.userId, roleId: roleId }); return authUserCancel({ userId: row.userId, roleId: roleId })
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("取消授权成功"); this.msgSuccess('取消授权成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 批量取消授权按钮操作 */ /** 批量取消授权按钮操作 */
cancelAuthUserAll (row) { cancelAuthUserAll (row) {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId
const userIds = this.userIds.join(","); const userIds = this.userIds.join(',')
this.$confirm('是否取消选中用户授权数据项?', "警告", { this.$confirm('是否取消选中用户授权数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
return authUserCancelAll({ roleId: roleId, userIds: userIds }); return authUserCancelAll({ roleId: roleId, userIds: userIds })
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("取消授权成功"); this.msgSuccess('取消授权成功')
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -233,7 +233,7 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="数据权限" v-show="form.dataScope == 2"> <el-form-item label="数据权限" v-show="form.dataScope === 2">
<el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox> <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">展开/折叠</el-checkbox>
<el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox> <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox>
<el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox> <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox>
@ -259,12 +259,12 @@
</template> </template>
<script> <script>
import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from "@/api/system/role"; import { listRole, getRole, delRole, addRole, updateRole, exportRole, dataScope, changeRoleStatus } from '@/api/system/role'
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; import { treeselect as menuTreeselect, roleMenuTreeselect } from '@/api/system/menu'
import { treeselect as deptTreeselect, roleDeptTreeselect } from "@/api/system/dept"; import { treeselect as deptTreeselect, roleDeptTreeselect } from '@/api/system/dept'
export default { export default {
name: "Role", name: 'Role',
data () { data () {
return { return {
// //
@ -284,7 +284,7 @@ export default {
// //
roleList: [], roleList: [],
// //
title: "", title: '',
// //
open: false, open: false,
// //
@ -300,24 +300,24 @@ export default {
// //
dataScopeOptions: [ dataScopeOptions: [
{ {
value: "1", value: '1',
label: "全部数据权限" label: '全部数据权限'
}, },
{ {
value: "2", value: '2',
label: "自定数据权限" label: '自定数据权限'
}, },
{ {
value: "3", value: '3',
label: "本部门数据权限" label: '本部门数据权限'
}, },
{ {
value: "4", value: '4',
label: "本部门及以下数据权限" label: '本部门及以下数据权限'
}, },
{ {
value: "5", value: '5',
label: "仅本人数据权限" label: '仅本人数据权限'
} }
], ],
// //
@ -335,309 +335,309 @@ export default {
// //
form: {}, form: {},
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label" label: 'label'
}, },
// //
rules: { rules: {
roleName: [ roleName: [
{ required: true, message: "角色名称不能为空", trigger: "blur" } { required: true, message: '角色名称不能为空', trigger: 'blur' }
], ],
roleKey: [ roleKey: [
{ required: true, message: "权限字符不能为空", trigger: "blur" } { required: true, message: '权限字符不能为空', trigger: 'blur' }
], ],
roleSort: [ roleSort: [
{ required: true, message: "角色顺序不能为空", trigger: "blur" } { required: true, message: '角色顺序不能为空', trigger: 'blur' }
] ]
} }
}; }
}, },
created () { created () {
this.getList(); this.getList()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
/** 查询角色列表 */ /** 查询角色列表 */
getList () { getList () {
this.loading = true; this.loading = true
listRole(this.addDateRange(this.queryParams, this.dateRange)).then( listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
response => { response => {
this.roleList = response.rows; this.roleList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 查询菜单树结构 */ /** 查询菜单树结构 */
getMenuTreeselect () { getMenuTreeselect () {
menuTreeselect().then(response => { menuTreeselect().then(response => {
this.menuOptions = response.data; this.menuOptions = response.data
}); })
}, },
/** 查询部门树结构 */ /** 查询部门树结构 */
getDeptTreeselect () { getDeptTreeselect () {
deptTreeselect().then(response => { deptTreeselect().then(response => {
this.deptOptions = response.data; this.deptOptions = response.data
}); })
}, },
// //
getMenuAllCheckedKeys () { getMenuAllCheckedKeys () {
// //
let checkedKeys = this.$refs.menu.getCheckedKeys(); const checkedKeys = this.$refs.menu.getCheckedKeys()
// //
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys(); const halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys; return checkedKeys
}, },
// //
getDeptAllCheckedKeys () { getDeptAllCheckedKeys () {
// //
let checkedKeys = this.$refs.dept.getCheckedKeys(); const checkedKeys = this.$refs.dept.getCheckedKeys()
// //
let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys(); const halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys()
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys); checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
return checkedKeys; return checkedKeys
}, },
/** 根据角色ID查询菜单树结构 */ /** 根据角色ID查询菜单树结构 */
getRoleMenuTreeselect (roleId) { getRoleMenuTreeselect (roleId) {
return roleMenuTreeselect(roleId).then(response => { return roleMenuTreeselect(roleId).then(response => {
this.menuOptions = response.menus; this.menuOptions = response.menus
return response; return response
}); })
}, },
/** 根据角色ID查询部门树结构 */ /** 根据角色ID查询部门树结构 */
getRoleDeptTreeselect (roleId) { getRoleDeptTreeselect (roleId) {
return roleDeptTreeselect(roleId).then(response => { return roleDeptTreeselect(roleId).then(response => {
this.deptOptions = response.depts; this.deptOptions = response.depts
return response; return response
}); })
}, },
// //
handleStatusChange (row) { handleStatusChange (row) {
let text = row.status === "0" ? "启用" : "停用"; const text = row.status === '0' ? '启用' : '停用'
this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', "警告", { this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return changeRoleStatus(row.roleId, row.status); return changeRoleStatus(row.roleId, row.status)
}).then(() => { }).then(() => {
this.msgSuccess(text + "成功"); this.msgSuccess(text + '成功')
}).catch(function () { }).catch(function () {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === '0' ? '1' : '0'
}); })
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
cancelDataScope () { cancelDataScope () {
this.openDataScope = false; this.openDataScope = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
if (this.$refs.menu != undefined) { if (this.$refs.menu !== undefined) {
this.$refs.menu.setCheckedKeys([]); this.$refs.menu.setCheckedKeys([])
} }
this.menuExpand = false, this.menuExpand = false
this.menuNodeAll = false, this.menuNodeAll = false
this.deptExpand = true, this.deptExpand = true
this.deptNodeAll = false, this.deptNodeAll = false
this.form = { this.form = {
roleId: undefined, roleId: undefined,
roleName: undefined, roleName: undefined,
roleKey: undefined, roleKey: undefined,
roleSort: 0, roleSort: 0,
status: "0", status: '0',
menuIds: [], menuIds: [],
deptIds: [], deptIds: [],
menuCheckStrictly: true, menuCheckStrictly: true,
deptCheckStrictly: true, deptCheckStrictly: true,
remark: undefined remark: undefined
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.roleId) this.ids = selection.map(item => item.roleId)
this.single = selection.length!=1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
// //
handleCommand (command, row) { handleCommand (command, row) {
switch (command) { switch (command) {
case "handleDataScope": case 'handleDataScope':
this.handleDataScope(row); this.handleDataScope(row)
break; break
case "handleAuthUser": case 'handleAuthUser':
this.handleAuthUser(row); this.handleAuthUser(row)
break; break
default: default:
break; break
} }
}, },
// / // /
handleCheckedTreeExpand (value, type) { handleCheckedTreeExpand (value, type) {
if (type == 'menu') { if (type === 'menu') {
let treeList = this.menuOptions; const treeList = this.menuOptions
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value; this.$refs.menu.store.nodesMap[treeList[i].id].expanded = value
} }
} else if (type == 'dept') { } else if (type === 'dept') {
let treeList = this.deptOptions; const treeList = this.deptOptions
for (let i = 0; i < treeList.length; i++) { for (let i = 0; i < treeList.length; i++) {
this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value; this.$refs.dept.store.nodesMap[treeList[i].id].expanded = value
} }
} }
}, },
// / // /
handleCheckedTreeNodeAll (value, type) { handleCheckedTreeNodeAll (value, type) {
if (type == 'menu') { if (type === 'menu') {
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []); this.$refs.menu.setCheckedNodes(value ? this.menuOptions : [])
} else if (type == 'dept') { } else if (type === 'dept') {
this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []); this.$refs.dept.setCheckedNodes(value ? this.deptOptions : [])
} }
}, },
// //
handleCheckedTreeConnect (value, type) { handleCheckedTreeConnect (value, type) {
if (type == 'menu') { if (type === 'menu') {
this.form.menuCheckStrictly = value ? true: false; this.form.menuCheckStrictly = !!value
} else if (type == 'dept') { } else if (type === 'dept') {
this.form.deptCheckStrictly = value ? true: false; this.form.deptCheckStrictly = !!value
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.getMenuTreeselect(); this.getMenuTreeselect()
this.open = true; this.open = true
this.title = "添加角色"; this.title = '添加角色'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
const roleId = row.roleId || this.ids const roleId = row.roleId || this.ids
const roleMenu = this.getRoleMenuTreeselect(roleId); const roleMenu = this.getRoleMenuTreeselect(roleId)
getRole(roleId).then(response => { getRole(roleId).then(response => {
this.form = response.data; this.form = response.data
this.open = true; this.open = true
this.$nextTick(() => { this.$nextTick(() => {
roleMenu.then(res => { roleMenu.then(res => {
let checkedKeys = res.checkedKeys const checkedKeys = res.checkedKeys
checkedKeys.forEach((v) => { checkedKeys.forEach((v) => {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.menu.setChecked(v, true ,false); this.$refs.menu.setChecked(v, true, false)
}) })
}) })
}); })
}); })
this.title = "修改角色"; this.title = '修改角色'
}); })
}, },
/** 选择角色权限范围触发 */ /** 选择角色权限范围触发 */
dataScopeSelectChange (value) { dataScopeSelectChange (value) {
if (value !== '2') { if (value !== '2') {
this.$refs.dept.setCheckedKeys([]); this.$refs.dept.setCheckedKeys([])
} }
}, },
/** 分配数据权限操作 */ /** 分配数据权限操作 */
handleDataScope (row) { handleDataScope (row) {
this.reset(); this.reset()
const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId); const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId)
getRole(row.roleId).then(response => { getRole(row.roleId).then(response => {
this.form = response.data; this.form = response.data
this.openDataScope = true; this.openDataScope = true
this.$nextTick(() => { this.$nextTick(() => {
roleDeptTreeselect.then(res => { roleDeptTreeselect.then(res => {
this.$refs.dept.setCheckedKeys(res.checkedKeys); this.$refs.dept.setCheckedKeys(res.checkedKeys)
}); })
}); })
this.title = "分配数据权限"; this.title = '分配数据权限'
}); })
}, },
/** 分配用户操作 */ /** 分配用户操作 */
handleAuthUser: function (row) { handleAuthUser: function (row) {
const roleId = row.roleId; const roleId = row.roleId
this.$router.push("/system/role-auth/user/" + roleId); this.$router.push('/system/role-auth/user/' + roleId)
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.roleId != undefined) { if (this.form.roleId !== undefined) {
this.form.menuIds = this.getMenuAllCheckedKeys(); this.form.menuIds = this.getMenuAllCheckedKeys()
updateRole(this.form).then(response => { updateRole(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
this.form.menuIds = this.getMenuAllCheckedKeys(); this.form.menuIds = this.getMenuAllCheckedKeys()
addRole(this.form).then(response => { addRole(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 提交按钮(数据权限) */ /** 提交按钮(数据权限) */
submitDataScope: function () { submitDataScope: function () {
if (this.form.roleId != undefined) { if (this.form.roleId !== undefined) {
this.form.deptIds = this.getDeptAllCheckedKeys(); this.form.deptIds = this.getDeptAllCheckedKeys()
dataScope(this.form).then(response => { dataScope(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.openDataScope = false; this.openDataScope = false
this.getList(); this.getList()
}); })
} }
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const roleIds = row.roleId || this.ids; const roleIds = row.roleId || this.ids
this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', "警告", { this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delRole(roleIds); return delRole(roleIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有角色数据项?', "警告", { this.$confirm('是否确认导出所有角色数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportRole(queryParams); return exportRole(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -59,7 +59,7 @@
</template> </template>
<script> <script>
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role"; import { unallocatedUserList, authUserSelectAll } from '@/api/system/role'
export default { export default {
props: { props: {
// //
@ -87,56 +87,56 @@ export default {
userName: undefined, userName: undefined,
phonenumber: undefined phonenumber: undefined
} }
}; }
}, },
created () { created () {
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
}, },
methods: { methods: {
// //
show () { show () {
this.queryParams.roleId = this.roleId; this.queryParams.roleId = this.roleId
this.getList(); this.getList()
this.visible = true; this.visible = true
}, },
clickRow (row) { clickRow (row) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.userIds = selection.map(item => item.userId); this.userIds = selection.map(item => item.userId)
}, },
// //
getList () { getList () {
unallocatedUserList(this.queryParams).then(res => { unallocatedUserList(this.queryParams).then(res => {
this.userList = res.rows; this.userList = res.rows
this.total = res.total; this.total = res.total
}); })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 选择授权用户操作 */ /** 选择授权用户操作 */
handleSelectUser () { handleSelectUser () {
const roleId = this.queryParams.roleId; const roleId = this.queryParams.roleId
const userIds = this.userIds.join(","); const userIds = this.userIds.join(',')
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => { authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
this.msgSuccess(res.msg); this.msgSuccess(res.msg)
if (res.code === 200) { if (res.code === 200) {
this.visible = false; this.visible = false
this.$emit("ok"); this.$emit('ok')
}
})
} }
});
} }
} }
};
</script> </script>

View File

@ -46,10 +46,10 @@
</template> </template>
<script> <script>
import { getAuthRole, updateAuthRole } from "@/api/system/user"; import { getAuthRole, updateAuthRole } from '@/api/system/user'
export default { export default {
name: "AuthRole", name: 'AuthRole',
data () { data () {
return { return {
// //
@ -64,54 +64,54 @@ export default {
roles: [], roles: [],
// //
form: {} form: {}
}; }
}, },
created () { created () {
const userId = this.$route.params && this.$route.params.userId; const userId = this.$route.params && this.$route.params.userId
if (userId) { if (userId) {
this.loading = true; this.loading = true
getAuthRole(userId).then((response) => { getAuthRole(userId).then((response) => {
this.form = response.user; this.form = response.user
this.roles = response.roles; this.roles = response.roles
this.total = this.roles.length; this.total = this.roles.length
this.$nextTick(() => { this.$nextTick(() => {
this.roles.forEach((row) => { this.roles.forEach((row) => {
if (row.flag) { if (row.flag) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
} }
}); })
}); })
this.loading = false; this.loading = false
}); })
} }
}, },
methods: { methods: {
/** 单击选中行数据 */ /** 单击选中行数据 */
clickRow (row) { clickRow (row) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.roleIds = selection.map((item) => item.roleId); this.roleIds = selection.map((item) => item.roleId)
}, },
// //
getRowKey (row) { getRowKey (row) {
return row.roleId; return row.roleId
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm () { submitForm () {
const userId = this.form.userId; const userId = this.form.userId
const roleIds = this.roleIds.join(","); const roleIds = this.roleIds.join(',')
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => { updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
this.msgSuccess("授权成功"); this.msgSuccess('授权成功')
this.close(); this.close()
}); })
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close () { close () {
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push({ path: "/system/user" }); this.$router.push({ path: '/system/user' })
}, }
}, }
}; }
</script> </script>

View File

@ -236,12 +236,12 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName"> <el-form-item v-if="form.userId === undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" /> <el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password"> <el-form-item v-if="form.userId === undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/> <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -280,7 +280,7 @@
:key="item.postId" :key="item.postId"
:label="item.postName" :label="item.postName"
:value="item.postId" :value="item.postId"
:disabled="item.status == 1" :disabled="item.status === 1"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -293,7 +293,7 @@
:key="item.roleId" :key="item.roleId"
:label="item.roleName" :label="item.roleName"
:value="item.roleId" :value="item.roleId"
:disabled="item.status == 1" :disabled="item.status === 1"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -346,14 +346,14 @@
</template> </template>
<script> <script>
import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user"; import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from '@/api/system/user'
import { getToken } from "@/utils/auth"; import { getToken } from '@/utils/auth'
import { treeselect } from "@/api/system/dept"; import { treeselect } from '@/api/system/dept'
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from '@riophae/vue-treeselect'
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default { export default {
name: "User", name: 'User',
components: { Treeselect }, components: { Treeselect },
data () { data () {
return { return {
@ -374,7 +374,7 @@ export default {
// //
userList: null, userList: null,
// //
title: "", title: '',
// //
deptOptions: undefined, deptOptions: undefined,
// //
@ -396,23 +396,23 @@ export default {
// //
form: {}, form: {},
defaultProps: { defaultProps: {
children: "children", children: 'children',
label: "label" label: 'label'
}, },
// //
upload: { upload: {
// //
open: false, open: false,
// //
title: "", title: '',
// //
isUploading: false, isUploading: false,
// //
updateSupport: 0, updateSupport: 0,
// //
headers: { Authorization: "Bearer " + getToken() }, headers: { Authorization: 'Bearer ' + getToken() },
// //
url: process.env.VUE_APP_BASE_API + "/system/user/importData" url: process.env.VUE_APP_BASE_API + '/system/user/importData'
}, },
// //
queryParams: { queryParams: {
@ -425,109 +425,109 @@ export default {
}, },
// //
columns: [ columns: [
{ key: 0, label: `用户编号`, visible: true }, { key: 0, label: '用户编号', visible: true },
{ key: 1, label: `用户名称`, visible: true }, { key: 1, label: '用户名称', visible: true },
{ key: 2, label: `用户昵称`, visible: true }, { key: 2, label: '用户昵称', visible: true },
{ key: 3, label: `部门`, visible: true }, { key: 3, label: '部门', visible: true },
{ key: 4, label: `手机号码`, visible: true }, { key: 4, label: '手机号码', visible: true },
{ key: 5, label: `状态`, visible: true }, { key: 5, label: '状态', visible: true },
{ key: 6, label: `创建时间`, visible: true } { key: 6, label: '创建时间', visible: true }
], ],
// //
rules: { rules: {
userName: [ userName: [
{ required: true, message: "用户名称不能为空", trigger: "blur" }, { required: true, message: '用户名称不能为空', trigger: 'blur' },
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' } { min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
], ],
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: '用户昵称不能为空', trigger: 'blur' }
], ],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" }, { required: true, message: '用户密码不能为空', trigger: 'blur' },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' } { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
], ],
email: [ email: [
{ {
type: "email", type: 'email',
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"] trigger: ['blur', 'change']
} }
], ],
phonenumber: [ phonenumber: [
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: '请输入正确的手机号码',
trigger: "blur" trigger: 'blur'
} }
] ]
} }
}; }
}, },
watch: { watch: {
// //
deptName (val) { deptName (val) {
this.$refs.tree.filter(val); this.$refs.tree.filter(val)
} }
}, },
created () { created () {
this.getList(); this.getList()
this.getTreeselect(); this.getTreeselect()
this.getDicts("sys_normal_disable").then(response => { this.getDicts('sys_normal_disable').then(response => {
this.statusOptions = response.data; this.statusOptions = response.data
}); })
this.getDicts("sys_user_sex").then(response => { this.getDicts('sys_user_sex').then(response => {
this.sexOptions = response.data; this.sexOptions = response.data
}); })
this.getConfigKey("sys.user.initPassword").then(response => { this.getConfigKey('sys.user.initPassword').then(response => {
this.initPassword = response.msg; this.initPassword = response.msg
}); })
}, },
methods: { methods: {
/** 查询用户列表 */ /** 查询用户列表 */
getList () { getList () {
this.loading = true; this.loading = true
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows; this.userList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getTreeselect () { getTreeselect () {
treeselect().then(response => { treeselect().then(response => {
this.deptOptions = response.data; this.deptOptions = response.data
}); })
}, },
// //
filterNode (value, data) { filterNode (value, data) {
if (!value) return true; if (!value) return true
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1
}, },
// //
handleNodeClick (data) { handleNodeClick (data) {
this.queryParams.deptId = data.id; this.queryParams.deptId = data.id
this.getList(); this.getList()
}, },
// //
handleStatusChange (row) { handleStatusChange (row) {
let text = row.status === "0" ? "启用" : "停用"; const text = row.status === '0' ? '启用' : '停用'
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", { this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return changeUserStatus(row.userId, row.status); return changeUserStatus(row.userId, row.status)
}).then(() => { }).then(() => {
this.msgSuccess(text + "成功"); this.msgSuccess(text + '成功')
}).catch(function () { }).catch(function () {
row.status = row.status === "0" ? "1" : "0"; row.status = row.status === '0' ? '1' : '0'
}); })
}, },
// //
cancel () { cancel () {
this.open = false; this.open = false
this.reset(); this.reset()
}, },
// //
reset () { reset () {
@ -540,166 +540,166 @@ export default {
phonenumber: undefined, phonenumber: undefined,
email: undefined, email: undefined,
sex: undefined, sex: undefined,
status: "0", status: '0',
remark: undefined, remark: undefined,
postIds: [], postIds: [],
roleIds: [] roleIds: []
}; }
this.resetForm("form"); this.resetForm('form')
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.userId); this.ids = selection.map(item => item.userId)
this.single = selection.length != 1; this.single = selection.length !== 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
// //
handleCommand (command, row) { handleCommand (command, row) {
switch (command) { switch (command) {
case "handleResetPwd": case 'handleResetPwd':
this.handleResetPwd(row); this.handleResetPwd(row)
break; break
case "handleAuthRole": case 'handleAuthRole':
this.handleAuthRole(row); this.handleAuthRole(row)
break; break
default: default:
break; break
} }
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd () { handleAdd () {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
getUser().then(response => { getUser().then(response => {
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.open = true; this.open = true
this.title = "添加用户"; this.title = '添加用户'
this.form.password = this.initPassword; this.form.password = this.initPassword
}); })
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate (row) { handleUpdate (row) {
this.reset(); this.reset()
this.getTreeselect(); this.getTreeselect()
const userId = row.userId || this.ids; const userId = row.userId || this.ids
getUser(userId).then(response => { getUser(userId).then(response => {
this.form = response.data; this.form = response.data
this.postOptions = response.posts; this.postOptions = response.posts
this.roleOptions = response.roles; this.roleOptions = response.roles
this.form.postIds = response.postIds; this.form.postIds = response.postIds
this.form.roleIds = response.roleIds; this.form.roleIds = response.roleIds
this.open = true; this.open = true
this.title = "修改用户"; this.title = '修改用户'
this.form.password = ""; this.form.password = ''
}); })
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd (row) { handleResetPwd (row) {
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", { this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
closeOnClickModal: false, closeOnClickModal: false,
inputPattern: /^.{5,20}$/, inputPattern: /^.{5,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", inputErrorMessage: '用户密码长度必须介于 5 和 20 之间'
}).then(({ value }) => { }).then(({ value }) => {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
this.msgSuccess("修改成功,新密码是:" + value); this.msgSuccess('修改成功,新密码是:' + value)
}); })
}).catch(() => {}); }).catch(() => {})
}, },
/** 分配角色操作 */ /** 分配角色操作 */
handleAuthRole: function (row) { handleAuthRole: function (row) {
const userId = row.userId; const userId = row.userId
this.$router.push("/system/user-auth/role/" + userId); this.$router.push('/system/user-auth/role/' + userId)
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
if (this.form.userId != undefined) { if (this.form.userId !== undefined) {
updateUser(this.form).then(response => { updateUser(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} else { } else {
addUser(this.form).then(response => { addUser(this.form).then(response => {
this.msgSuccess("新增成功"); this.msgSuccess('新增成功')
this.open = false; this.open = false
this.getList(); this.getList()
}); })
} }
} }
}); })
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const userIds = row.userId || this.ids; const userIds = row.userId || this.ids
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", { this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delUser(userIds); return delUser(userIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport () { handleExport () {
const queryParams = this.queryParams; const queryParams = this.queryParams
this.$confirm('是否确认导出所有用户数据项?', "警告", { this.$confirm('是否确认导出所有用户数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(() => { }).then(() => {
this.exportLoading = true; this.exportLoading = true
return exportUser(queryParams); return exportUser(queryParams)
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg)
this.exportLoading = false; this.exportLoading = false
}).catch(() => {}); }).catch(() => {})
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImport () { handleImport () {
this.upload.title = "用户导入"; this.upload.title = '用户导入'
this.upload.open = true; this.upload.open = true
}, },
/** 下载模板操作 */ /** 下载模板操作 */
importTemplate () { importTemplate () {
importTemplate().then(response => { importTemplate().then(response => {
this.download(response.msg); this.download(response.msg)
}); })
}, },
// //
handleFileUploadProgress (event, file, fileList) { handleFileUploadProgress (event, file, fileList) {
this.upload.isUploading = true; this.upload.isUploading = true
}, },
// //
handleFileSuccess (response, file, fileList) { handleFileSuccess (response, file, fileList) {
this.upload.open = false; this.upload.open = false
this.upload.isUploading = false; this.upload.isUploading = false
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles()
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true }); this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
this.getList(); this.getList()
}, },
// //
submitFileForm () { submitFileForm () {
this.$refs.upload.submit(); this.$refs.upload.submit()
}
} }
} }
};
</script> </script>

View File

@ -59,33 +59,33 @@
</template> </template>
<script> <script>
import userAvatar from "./userAvatar"; import userAvatar from './userAvatar'
import userInfo from "./userInfo"; import userInfo from './userInfo'
import resetPwd from "./resetPwd"; import resetPwd from './resetPwd'
import { getUserProfile } from "@/api/system/user"; import { getUserProfile } from '@/api/system/user'
export default { export default {
name: "Profile", name: 'Profile',
components: { userAvatar, userInfo, resetPwd }, components: { userAvatar, userInfo, resetPwd },
data () { data () {
return { return {
user: {}, user: {},
roleGroup: {}, roleGroup: {},
postGroup: {}, postGroup: {},
activeTab: "userinfo" activeTab: 'userinfo'
}; }
}, },
created () { created () {
this.getUser(); this.getUser()
}, },
methods: { methods: {
getUser () { getUser () {
getUserProfile().then(response => { getUserProfile().then(response => {
this.user = response.data; this.user = response.data
this.roleGroup = response.roleGroup; this.roleGroup = response.roleGroup
this.postGroup = response.postGroup; this.postGroup = response.postGroup
}); })
}
} }
} }
};
</script> </script>

View File

@ -17,19 +17,19 @@
</template> </template>
<script> <script>
import { updateUserPwd } from "@/api/system/user"; import { updateUserPwd } from '@/api/system/user'
export default { export default {
data () { data () {
const equalToPassword = (rule, value, callback) => { const equalToPassword = (rule, value, callback) => {
if (this.user.newPassword !== value) { if (this.user.newPassword !== value) {
callback(new Error("两次输入的密码不一致")); callback(new Error('两次输入的密码不一致'))
} else { } else {
callback(); callback()
}
} }
};
return { return {
test: "1test", test: '1test',
user: { user: {
oldPassword: undefined, oldPassword: undefined,
newPassword: undefined, newPassword: undefined,
@ -38,35 +38,35 @@ export default {
// //
rules: { rules: {
oldPassword: [ oldPassword: [
{ required: true, message: "旧密码不能为空", trigger: "blur" } { required: true, message: '旧密码不能为空', trigger: 'blur' }
], ],
newPassword: [ newPassword: [
{ required: true, message: "新密码不能为空", trigger: "blur" }, { required: true, message: '新密码不能为空', trigger: 'blur' },
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" } { min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
], ],
confirmPassword: [ confirmPassword: [
{ required: true, message: "确认密码不能为空", trigger: "blur" }, { required: true, message: '确认密码不能为空', trigger: 'blur' },
{ required: true, validator: equalToPassword, trigger: "blur" } { required: true, validator: equalToPassword, trigger: 'blur' }
] ]
} }
}; }
}, },
methods: { methods: {
submit () { submit () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
updateUserPwd(this.user.oldPassword, this.user.newPassword).then( updateUserPwd(this.user.oldPassword, this.user.newPassword).then(
response => { response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
} }
); )
} }
}); })
}, },
close () { close () {
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push({ path: "/index" }); this.$router.push({ path: '/index' })
}
} }
} }
};
</script> </script>

View File

@ -1,7 +1,9 @@
<template> <template>
<div> <div>
<div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div> <div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像"
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog()"> class="img-circle img-lg"/></div>
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened"
@close="closeDialog()">
<el-row> <el-row>
<el-col :xs="24" :md="12" :style="{height: '350px'}"> <el-col :xs="24" :md="12" :style="{height: '350px'}">
<vue-cropper <vue-cropper
@ -53,9 +55,9 @@
</template> </template>
<script> <script>
import store from "@/store"; import store from '@/store'
import { VueCropper } from "vue-cropper"; import { VueCropper } from 'vue-cropper'
import { uploadAvatar } from "@/api/system/user"; import { uploadAvatar } from '@/api/system/user'
export default { export default {
components: { VueCropper }, components: { VueCropper },
@ -71,7 +73,7 @@ export default {
// cropper // cropper
visible: false, visible: false,
// //
title: "修改头像", title: '修改头像',
options: { options: {
img: store.getters.avatar, // img: store.getters.avatar, //
autoCrop: true, // autoCrop: true, //
@ -80,70 +82,70 @@ export default {
fixedBox: true // fixedBox: true //
}, },
previews: {} previews: {}
}; }
}, },
methods: { methods: {
// //
editCropper () { editCropper () {
this.open = true; this.open = true
}, },
// //
modalOpened () { modalOpened () {
this.visible = true; this.visible = true
}, },
// //
requestUpload () { requestUpload () {
}, },
// //
rotateLeft () { rotateLeft () {
this.$refs.cropper.rotateLeft(); this.$refs.cropper.rotateLeft()
}, },
// //
rotateRight () { rotateRight () {
this.$refs.cropper.rotateRight(); this.$refs.cropper.rotateRight()
}, },
// //
changeScale (num) { changeScale (num) {
num = num || 1; num = num || 1
this.$refs.cropper.changeScale(num); this.$refs.cropper.changeScale(num)
}, },
// //
beforeUpload (file) { beforeUpload (file) {
if (file.type.indexOf("image/") == -1) { if (file.type.indexOf('image/') === -1) {
this.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。"); this.msgError('文件格式错误,请上传图片类型,如JPGPNG后缀的文件。')
} else { } else {
const reader = new FileReader(); const reader = new FileReader()
reader.readAsDataURL(file); reader.readAsDataURL(file)
reader.onload = () => { reader.onload = () => {
this.options.img = reader.result; this.options.img = reader.result
}; }
} }
}, },
// //
uploadImg () { uploadImg () {
this.$refs.cropper.getCropBlob(data => { this.$refs.cropper.getCropBlob(data => {
let formData = new FormData(); const formData = new FormData()
formData.append("avatarfile", data); formData.append('avatarfile', data)
uploadAvatar(formData).then(response => { uploadAvatar(formData).then(response => {
this.open = false; this.open = false
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl; this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl
store.commit('SET_AVATAR', this.options.img); store.commit('SET_AVATAR', this.options.img)
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
this.visible = false; this.visible = false
}); })
}); })
}, },
// //
realTime (data) { realTime (data) {
this.previews = data; this.previews = data
}, },
// //
closeDialog () { closeDialog () {
this.options.img = store.getters.avatar this.options.img = store.getters.avatar
this.visible = false; this.visible = false
}
} }
} }
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.user-info-head { .user-info-head {

View File

@ -23,7 +23,7 @@
</template> </template>
<script> <script>
import { updateUserProfile } from "@/api/system/user"; import { updateUserProfile } from '@/api/system/user'
export default { export default {
props: { props: {
@ -36,41 +36,41 @@ export default {
// //
rules: { rules: {
nickName: [ nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: '用户昵称不能为空', trigger: 'blur' }
], ],
email: [ email: [
{ required: true, message: "邮箱地址不能为空", trigger: "blur" }, { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
{ {
type: "email", type: 'email',
message: "'请输入正确的邮箱地址", message: "'请输入正确的邮箱地址",
trigger: ["blur", "change"] trigger: ['blur', 'change']
} }
], ],
phonenumber: [ phonenumber: [
{ required: true, message: "手机号码不能为空", trigger: "blur" }, { required: true, message: '手机号码不能为空', trigger: 'blur' },
{ {
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码", message: '请输入正确的手机号码',
trigger: "blur" trigger: 'blur'
} }
] ]
} }
}; }
}, },
methods: { methods: {
submit () { submit () {
this.$refs["form"].validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
updateUserProfile(this.user).then(response => { updateUserProfile(this.user).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess('修改成功')
}); })
} }
}); })
}, },
close () { close () {
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push({ path: "/index" }); this.$router.push({ path: '/index' })
}
} }
} }
};
</script> </script>

View File

@ -572,15 +572,13 @@
</template> </template>
<script> <script>
import { isArray } from 'util'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import TreeNodeDialog from './TreeNodeDialog' import TreeNodeDialog from './TreeNodeDialog'
import { isNumberStr } from '@/utils/index' import { isNumberStr } from '@/utils/index'
import IconsDialog from './IconsDialog' import IconsDialog from './IconsDialog'
import { import {
inputComponents, inputComponents,
selectComponents, selectComponents
layoutComponents
} from '@/utils/generator/config' } from '@/utils/generator/config'
const dateTimeFormat = { const dateTimeFormat = {
@ -698,14 +696,14 @@ export default {
computed: { computed: {
documentLink () { documentLink () {
return ( return (
this.activeData.document this.activeData.document ||
|| 'https://element.eleme.cn/#/zh-CN/component/installation' 'https://element.eleme.cn/#/zh-CN/component/installation'
) )
}, },
dateOptions () { dateOptions () {
if ( if (
this.activeData.type !== undefined this.activeData.type !== undefined &&
&& this.activeData.tag === 'el-date-picker' this.activeData.tag === 'el-date-picker'
) { ) {
if (this.activeData['start-placeholder'] === undefined) { if (this.activeData['start-placeholder'] === undefined) {
return this.dateTypeOptions return this.dateTypeOptions
@ -794,7 +792,7 @@ export default {
return val return val
}, },
onDefaultValueInput (str) { onDefaultValueInput (str) {
if (isArray(this.activeData.defaultValue)) { if (Array.isArray(this.activeData.defaultValue)) {
// //
this.$set( this.$set(
this.activeData, this.activeData,

View File

@ -115,7 +115,6 @@ export default {
}, },
computed: {}, computed: {},
watch: { watch: {
// eslint-disable-next-line func-names
'formData.value': function (val) { 'formData.value': function (val) {
this.dataType = isNumberStr(val) ? 'number' : 'string' this.dataType = isNumberStr(val) ? 'number' : 'string'
} }

View File

@ -140,7 +140,6 @@ import draggable from 'vuedraggable'
import { saveAs } from 'file-saver' import { saveAs } from 'file-saver'
import beautifier from 'js-beautify' import beautifier from 'js-beautify'
import ClipboardJS from 'clipboard' import ClipboardJS from 'clipboard'
import render from '@/utils/generator/render'
import RightPanel from './RightPanel' import RightPanel from './RightPanel'
import { import {
inputComponents, inputComponents,
@ -149,7 +148,7 @@ import {
formConf formConf
} from '@/utils/generator/config' } from '@/utils/generator/config'
import { import {
exportDefault, beautifierConf, isNumberStr, titleCase beautifierConf, titleCase
} from '@/utils/index' } from '@/utils/index'
import { import {
makeUpHtml, vueTemplate, vueScript, cssStyle makeUpHtml, vueTemplate, vueScript, cssStyle
@ -161,14 +160,12 @@ import logo from '@/assets/logo/logo.png'
import CodeTypeDialog from './CodeTypeDialog' import CodeTypeDialog from './CodeTypeDialog'
import DraggableItem from './DraggableItem' import DraggableItem from './DraggableItem'
const emptyActiveData = { style: {}, autosize: {} }
let oldActiveId let oldActiveId
let tempActiveData let tempActiveData
export default { export default {
components: { components: {
draggable, draggable,
render,
RightPanel, RightPanel,
CodeTypeDialog, CodeTypeDialog,
DraggableItem DraggableItem
@ -201,12 +198,11 @@ export default {
} }
}, },
watch: { watch: {
// eslint-disable-next-line func-names
'activeData.label': function (val, oldVal) { 'activeData.label': function (val, oldVal) {
if ( if (
this.activeData.placeholder === undefined this.activeData.placeholder === undefined ||
|| !this.activeData.tag !this.activeData.tag ||
|| oldActiveId !== this.activeId oldActiveId !== this.activeId
) { ) {
return return
} }
@ -359,8 +355,8 @@ export default {
delete this.activeData.tagIcon delete this.activeData.tagIcon
delete this.activeData.document delete this.activeData.document
Object.keys(newTag).forEach(key => { Object.keys(newTag).forEach(key => {
if (this.activeData[key] !== undefined if (this.activeData[key] !== undefined &&
&& typeof this.activeData[key] === typeof newTag[key]) { typeof this.activeData[key] === typeof newTag[key]) {
newTag[key] = this.activeData[key] newTag[key] = this.activeData[key]
} }
}) })

View File

@ -32,7 +32,7 @@
</template> </template>
<script> <script>
export default { export default {
name: "BasicInfoForm", name: 'BasicInfoForm',
props: { props: {
info: { info: {
type: Object, type: Object,
@ -43,19 +43,19 @@ export default {
return { return {
rules: { rules: {
tableName: [ tableName: [
{ required: true, message: "请输入表名称", trigger: "blur" } { required: true, message: '请输入表名称', trigger: 'blur' }
], ],
tableComment: [ tableComment: [
{ required: true, message: "请输入表描述", trigger: "blur" } { required: true, message: '请输入表描述', trigger: 'blur' }
], ],
className: [ className: [
{ required: true, message: "请输入实体类名称", trigger: "blur" } { required: true, message: '请输入实体类名称', trigger: 'blur' }
], ],
functionAuthor: [ functionAuthor: [
{ required: true, message: "请输入作者", trigger: "blur" } { required: true, message: '请输入作者', trigger: 'blur' }
] ]
} }
};
} }
}; }
}
</script> </script>

View File

@ -125,15 +125,15 @@
</el-card> </el-card>
</template> </template>
<script> <script>
import { getGenTable, updateGenTable } from "@/api/tool/gen"; import { getGenTable, updateGenTable } from '@/api/tool/gen'
import { optionselect as getDictOptionselect } from "@/api/system/dict/type"; import { optionselect as getDictOptionselect } from '@/api/system/dict/type'
import { listMenu as getMenuTreeselect } from "@/api/system/menu"; import { listMenu as getMenuTreeselect } from '@/api/system/menu'
import basicInfoForm from "./basicInfoForm"; import basicInfoForm from './basicInfoForm'
import genInfoForm from "./genInfoForm"; import genInfoForm from './genInfoForm'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
export default { export default {
name: "GenEdit", name: 'GenEdit',
components: { components: {
basicInfoForm, basicInfoForm,
genInfoForm genInfoForm
@ -141,9 +141,9 @@ export default {
data () { data () {
return { return {
// name // name
activeName: "cloum", activeName: 'cloum',
// //
tableHeight: document.documentElement.scrollHeight - 245 + "px", tableHeight: document.documentElement.scrollHeight - 245 + 'px',
// //
tables: [], tables: [],
// //
@ -154,79 +154,79 @@ export default {
menus: [], menus: [],
// //
info: {} info: {}
}; }
}, },
created () { created () {
const tableId = this.$route.params && this.$route.params.tableId; const tableId = this.$route.params && this.$route.params.tableId
if (tableId) { if (tableId) {
// //
getGenTable(tableId).then(res => { getGenTable(tableId).then(res => {
this.cloumns = res.data.rows; this.cloumns = res.data.rows
this.info = res.data.info; this.info = res.data.info
this.tables = res.data.tables; this.tables = res.data.tables
}); })
/** 查询字典下拉列表 */ /** 查询字典下拉列表 */
getDictOptionselect().then(response => { getDictOptionselect().then(response => {
this.dictOptions = response.data; this.dictOptions = response.data
}); })
/** 查询菜单下拉列表 */ /** 查询菜单下拉列表 */
getMenuTreeselect().then(response => { getMenuTreeselect().then(response => {
this.menus = this.handleTree(response.data, "menuId"); this.menus = this.handleTree(response.data, 'menuId')
}); })
} }
}, },
methods: { methods: {
/** 提交按钮 */ /** 提交按钮 */
submitForm () { submitForm () {
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm; const basicForm = this.$refs.basicInfo.$refs.basicInfoForm
const genForm = this.$refs.genInfo.$refs.genInfoForm; const genForm = this.$refs.genInfo.$refs.genInfoForm
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => { Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
const validateResult = res.every(item => !!item); const validateResult = res.every(item => !!item)
if (validateResult) { if (validateResult) {
const genTable = Object.assign({}, basicForm.model, genForm.model); const genTable = Object.assign({}, basicForm.model, genForm.model)
genTable.columns = this.cloumns; genTable.columns = this.cloumns
genTable.params = { genTable.params = {
treeCode: genTable.treeCode, treeCode: genTable.treeCode,
treeName: genTable.treeName, treeName: genTable.treeName,
treeParentCode: genTable.treeParentCode, treeParentCode: genTable.treeParentCode,
parentMenuId: genTable.parentMenuId parentMenuId: genTable.parentMenuId
}; }
updateGenTable(genTable).then(res => { updateGenTable(genTable).then(res => {
this.msgSuccess(res.msg); this.msgSuccess(res.msg)
if (res.code === 200) { if (res.code === 200) {
this.close(); this.close()
} }
}); })
} else { } else {
this.msgError("表单校验未通过,请重新检查提交内容"); this.msgError('表单校验未通过,请重新检查提交内容')
} }
}); })
}, },
getFormPromise (form) { getFormPromise (form) {
return new Promise(resolve => { return new Promise(resolve => {
form.validate(res => { form.validate(res => {
resolve(res); resolve(res)
}); })
}); })
}, },
/** 关闭按钮 */ /** 关闭按钮 */
close () { close () {
this.$store.dispatch("tagsView/delView", this.$route); this.$store.dispatch('tagsView/delView', this.$route)
this.$router.push({ path: "/tool/gen", query: { t: Date.now()}}) this.$router.push({ path: '/tool/gen', query: { t: Date.now() } })
} }
}, },
mounted () { mounted () {
const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0]; const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
const sortable = Sortable.create(el, { Sortable.create(el, {
handle: ".allowDrag", handle: '.allowDrag',
onEnd: evt => { onEnd: evt => {
const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0]; const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0]
this.cloumns.splice(evt.newIndex, 0, targetRow); this.cloumns.splice(evt.newIndex, 0, targetRow)
for (let index in this.cloumns) { for (const index in this.cloumns) {
this.cloumns[index].sort = parseInt(index) + 1; this.cloumns[index].sort = parseInt(index) + 1
} }
} }
}); })
}
} }
};
</script> </script>

View File

@ -92,7 +92,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24" v-if="info.genType == '1'"> <el-col :span="24" v-if="info.genType === '1'">
<el-form-item prop="genPath"> <el-form-item prop="genPath">
<span slot="label"> <span slot="label">
自定义路径 自定义路径
@ -115,7 +115,7 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="info.tplCategory == 'tree'"> <el-row v-show="info.tplCategory === 'tree'">
<h4 class="form-header">其他信息</h4> <h4 class="form-header">其他信息</h4>
<el-col :span="12"> <el-col :span="12">
<el-form-item> <el-form-item>
@ -172,7 +172,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-show="info.tplCategory == 'sub'"> <el-row v-show="info.tplCategory === 'sub'">
<h4 class="form-header">关联信息</h4> <h4 class="form-header">关联信息</h4>
<el-col :span="12"> <el-col :span="12">
<el-form-item> <el-form-item>
@ -214,11 +214,11 @@
</el-form> </el-form>
</template> </template>
<script> <script>
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from '@riophae/vue-treeselect'
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default { export default {
name: "BasicInfoForm", name: 'BasicInfoForm',
components: { Treeselect }, components: { Treeselect },
props: { props: {
info: { info: {
@ -231,70 +231,73 @@ export default {
}, },
menus: { menus: {
type: Array, type: Array,
default: [] default: () => {
}, return []
}
}
}, },
data () { data () {
return { return {
subColumns: [], subColumns: [],
rules: { rules: {
tplCategory: [ tplCategory: [
{ required: true, message: "请选择生成模板", trigger: "blur" } { required: true, message: '请选择生成模板', trigger: 'blur' }
], ],
packageName: [ packageName: [
{ required: true, message: "请输入生成包路径", trigger: "blur" } { required: true, message: '请输入生成包路径', trigger: 'blur' }
], ],
moduleName: [ moduleName: [
{ required: true, message: "请输入生成模块名", trigger: "blur" } { required: true, message: '请输入生成模块名', trigger: 'blur' }
], ],
businessName: [ businessName: [
{ required: true, message: "请输入生成业务名", trigger: "blur" } { required: true, message: '请输入生成业务名', trigger: 'blur' }
], ],
functionName: [ functionName: [
{ required: true, message: "请输入生成功能名", trigger: "blur" } { required: true, message: '请输入生成功能名', trigger: 'blur' }
], ]
}
} }
};
}, },
created() {}, created () {
},
watch: { watch: {
'info.subTableName': function (val) { 'info.subTableName': function (val) {
this.setSubTableColumns(val); this.setSubTableColumns(val)
} }
}, },
methods: { methods: {
/** 转换菜单数据结构 */ /** 转换菜单数据结构 */
normalizer (node) { normalizer (node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children
} }
return { return {
id: node.menuId, id: node.menuId,
label: node.menuName, label: node.menuName,
children: node.children children: node.children
}; }
}, },
/** 选择子表名触发 */ /** 选择子表名触发 */
subSelectChange (value) { subSelectChange (value) {
this.info.subTableFkName = ''; this.info.subTableFkName = ''
}, },
/** 选择生成模板触发 */ /** 选择生成模板触发 */
tplSelectChange (value) { tplSelectChange (value) {
if (value !== 'sub') { if (value !== 'sub') {
this.info.subTableName = ''; this.info.subTableName = ''
this.info.subTableFkName = ''; this.info.subTableFkName = ''
} }
}, },
/** 设置关联外键 */ /** 设置关联外键 */
setSubTableColumns (value) { setSubTableColumns (value) {
for (var item in this.tables) { for (const item in this.tables) {
const name = this.tables[item].tableName; const name = this.tables[item].tableName
if (value === name) { if (value === name) {
this.subColumns = this.tables[item].columns; this.subColumns = this.tables[item].columns
break; break
}
} }
} }
} }
} }
};
</script> </script>

View File

@ -49,7 +49,7 @@
</template> </template>
<script> <script>
import { listDbTable, importTable } from "@/api/tool/gen"; import { listDbTable, importTable } from '@/api/tool/gen'
export default { export default {
data () { data () {
return { return {
@ -68,50 +68,50 @@ export default {
tableName: undefined, tableName: undefined,
tableComment: undefined tableComment: undefined
} }
}; }
}, },
methods: { methods: {
// //
show () { show () {
this.getList(); this.getList()
this.visible = true; this.visible = true
}, },
clickRow (row) { clickRow (row) {
this.$refs.table.toggleRowSelection(row); this.$refs.table.toggleRowSelection(row)
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.tables = selection.map(item => item.tableName); this.tables = selection.map(item => item.tableName)
}, },
// //
getList () { getList () {
listDbTable(this.queryParams).then(res => { listDbTable(this.queryParams).then(res => {
if (res.code === 200) { if (res.code === 200) {
this.dbTableList = res.rows; this.dbTableList = res.rows
this.total = res.total; this.total = res.total
} }
}); })
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */
handleImportTable () { handleImportTable () {
importTable({ tables: this.tables.join(",") }).then(res => { importTable({ tables: this.tables.join(',') }).then(res => {
this.msgSuccess(res.msg); this.msgSuccess(res.msg)
if (res.code === 200) { if (res.code === 200) {
this.visible = false; this.visible = false
this.$emit("ok"); this.$emit('ok')
}
})
} }
});
} }
} }
};
</script> </script>

View File

@ -178,27 +178,27 @@
</template> </template>
<script> <script>
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen"; import { listTable, previewTable, delTable, genCode, synchDb } from '@/api/tool/gen'
import importTable from "./importTable"; import importTable from './importTable'
import { downLoadZip } from "@/utils/zipdownload"; import { downLoadZip } from '@/utils/zipdownload'
import hljs from "highlight.js/lib/highlight"; import hljs from 'highlight.js/lib/highlight'
import "highlight.js/styles/github-gist.css"; import 'highlight.js/styles/github-gist.css'
hljs.registerLanguage("java", require("highlight.js/lib/languages/java")); hljs.registerLanguage('java', require('highlight.js/lib/languages/java'))
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml")); hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'))
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml")); hljs.registerLanguage('html', require('highlight.js/lib/languages/xml'))
hljs.registerLanguage("vue", require("highlight.js/lib/languages/xml")); hljs.registerLanguage('vue', require('highlight.js/lib/languages/xml'))
hljs.registerLanguage("javascript", require("highlight.js/lib/languages/javascript")); hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript'))
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql")); hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql'))
export default { export default {
name: "Gen", name: 'Gen',
components: { importTable }, components: { importTable },
data () { data () {
return { return {
// //
loading: true, loading: true,
// //
uniqueId: "", uniqueId: '',
// //
ids: [], ids: [],
// //
@ -214,7 +214,7 @@ export default {
// //
tableList: [], tableList: [],
// //
dateRange: "", dateRange: '',
// //
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -225,116 +225,116 @@ export default {
// //
preview: { preview: {
open: false, open: false,
title: "代码预览", title: '代码预览',
data: {}, data: {},
activeName: "domain.java" activeName: 'domain.java'
}
} }
};
}, },
created () { created () {
this.getList(); this.getList()
}, },
activated () { activated () {
const time = this.$route.query.t; const time = this.$route.query.t
if (time != null && time != this.uniqueId) { if (time !== null && time !== this.uniqueId) {
this.uniqueId = time; this.uniqueId = time
this.resetQuery(); this.resetQuery()
} }
}, },
methods: { methods: {
/** 查询表集合 */ /** 查询表集合 */
getList () { getList () {
this.loading = true; this.loading = true
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.tableList = response.rows; this.tableList = response.rows
this.total = response.total; this.total = response.total
this.loading = false; this.loading = false
} }
); )
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery () { handleQuery () {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1
this.getList(); this.getList()
}, },
/** 生成代码操作 */ /** 生成代码操作 */
handleGenTable (row) { handleGenTable (row) {
const tableNames = row.tableName || this.tableNames; const tableNames = row.tableName || this.tableNames
if (tableNames == "") { if (tableNames === '') {
this.msgError("请选择要生成的数据"); this.msgError('请选择要生成的数据')
return; return
} }
if(row.genType === "1") { if (row.genType === '1') {
genCode(row.tableName).then(response => { genCode(row.tableName).then(response => {
this.msgSuccess("成功生成到自定义路径:" + row.genPath); this.msgSuccess('成功生成到自定义路径:' + row.genPath)
}); })
} else { } else {
downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi"); downLoadZip('/tool/gen/batchGenCode?tables=' + tableNames, 'ruoyi')
} }
}, },
/** 同步数据库操作 */ /** 同步数据库操作 */
handleSynchDb (row) { handleSynchDb (row) {
const tableName = row.tableName; const tableName = row.tableName
this.$confirm('确认要强制同步"' + tableName + '"表结构吗?', "警告", { this.$confirm('确认要强制同步"' + tableName + '"表结构吗?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return synchDb(tableName); return synchDb(tableName)
}).then(() => { }).then(() => {
this.msgSuccess("同步成功"); this.msgSuccess('同步成功')
}).catch(() => {}); }).catch(() => {})
}, },
/** 打开导入表弹窗 */ /** 打开导入表弹窗 */
openImportTable () { openImportTable () {
this.$refs.import.show(); this.$refs.import.show()
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery () { resetQuery () {
this.dateRange = []; this.dateRange = []
this.resetForm("queryForm"); this.resetForm('queryForm')
this.handleQuery(); this.handleQuery()
}, },
/** 预览按钮 */ /** 预览按钮 */
handlePreview (row) { handlePreview (row) {
previewTable(row.tableId).then(response => { previewTable(row.tableId).then(response => {
this.preview.data = response.data; this.preview.data = response.data
this.preview.open = true; this.preview.open = true
}); })
}, },
/** 高亮显示 */ /** 高亮显示 */
highlightedCode (code, key) { highlightedCode (code, key) {
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm")); const vmName = key.substring(key.lastIndexOf('/') + 1, key.indexOf('.vm'))
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length); const language = vmName.substring(vmName.indexOf('.') + 1, vmName.length)
const result = hljs.highlight(language, code || "", true); const result = hljs.highlight(language, code || '', true)
return result.value || '&nbsp;'; return result.value || '&nbsp;'
}, },
// //
handleSelectionChange (selection) { handleSelectionChange (selection) {
this.ids = selection.map(item => item.tableId); this.ids = selection.map(item => item.tableId)
this.tableNames = selection.map(item => item.tableName); this.tableNames = selection.map(item => item.tableName)
this.single = selection.length != 1; this.single = selection.length !== 1
this.multiple = !selection.length; this.multiple = !selection.length
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleEditTable (row) { handleEditTable (row) {
const tableId = row.tableId || this.ids[0]; const tableId = row.tableId || this.ids[0]
this.$router.push("/tool/gen-edit/index/" + tableId); this.$router.push('/tool/gen-edit/index/' + tableId)
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete (row) { handleDelete (row) {
const tableIds = row.tableId || this.ids; const tableIds = row.tableId || this.ids
this.$confirm('是否确认删除表编号为"' + tableIds + '"的数据项?', "警告", { this.$confirm('是否确认删除表编号为"' + tableIds + '"的数据项?', '警告', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning" type: 'warning'
}).then(function () { }).then(function () {
return delTable(tableIds); return delTable(tableIds)
}).then(() => { }).then(() => {
this.getList(); this.getList()
this.msgSuccess("删除成功"); this.msgSuccess('删除成功')
}).catch(() => {}); }).catch(() => {})
}
} }
} }
};
</script> </script>

View File

@ -2,14 +2,14 @@
<i-frame :src="url" /> <i-frame :src="url" />
</template> </template>
<script> <script>
import iFrame from "@/components/iFrame/index"; import iFrame from '@/components/iFrame/index'
export default { export default {
name: "Swagger", name: 'Swagger',
components: { iFrame }, components: { iFrame },
data () { data () {
return { return {
url: process.env.VUE_APP_BASE_API + "/swagger-ui/index.html" url: process.env.VUE_APP_BASE_API + '/swagger-ui/index.html'
}; }
}, }
}; }
</script> </script>

View File

@ -16,7 +16,7 @@ module.exports = {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下Vue CLI 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。
publicPath: process.env.NODE_ENV === "production" ? "/" : "/", publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
// 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist // 在npm run build 或 yarn build 时 生成文件的目录名称要和baseUrl的生产环境路径一致默认dist
outputDir: 'dist', outputDir: 'dist',
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下) // 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)