Pre Merge pull request !296 from hankaibo/master
This commit is contained in:
3
ruoyi-ui/.browserslistrc
Normal file
3
ruoyi-ui/.browserslistrc
Normal file
@ -0,0 +1,3 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
@ -1,10 +1 @@
|
||||
# 忽略build目录下类型为js的文件的语法检查
|
||||
build/*.js
|
||||
# 忽略src/assets目录下文件的语法检查
|
||||
src/assets
|
||||
# 忽略public目录下文件的语法检查
|
||||
public
|
||||
# 忽略当前目录下为js的文件的语法检查
|
||||
*.js
|
||||
# 忽略当前目录下为vue的文件的语法检查
|
||||
*.vue
|
||||
vue.config.js
|
||||
|
@ -1,199 +1,21 @@
|
||||
// ESlint 检查配置
|
||||
module.exports = {
|
||||
root: true,
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint',
|
||||
sourceType: 'module'
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
node: true,
|
||||
es6: true,
|
||||
es6: true
|
||||
},
|
||||
extends: [
|
||||
'plugin:vue/essential',
|
||||
'@vue/standard'
|
||||
],
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint'
|
||||
},
|
||||
extends: ['plugin:vue/recommended', 'eslint:recommended'],
|
||||
|
||||
// add your custom rules here
|
||||
//it is base on https://github.com/vuejs/eslint-config-vue
|
||||
rules: {
|
||||
"vue/max-attributes-per-line": [2, {
|
||||
"singleline": 10,
|
||||
"multiline": {
|
||||
"max": 1,
|
||||
"allowFirstLine": false
|
||||
}
|
||||
}],
|
||||
"vue/singleline-html-element-content-newline": "off",
|
||||
"vue/multiline-html-element-content-newline":"off",
|
||||
"vue/name-property-casing": ["error", "PascalCase"],
|
||||
"vue/no-v-html": "off",
|
||||
'accessor-pairs': 2,
|
||||
'arrow-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
}],
|
||||
'block-spacing': [2, 'always'],
|
||||
'brace-style': [2, '1tbs', {
|
||||
'allowSingleLine': true
|
||||
}],
|
||||
'camelcase': [0, {
|
||||
'properties': 'always'
|
||||
}],
|
||||
'comma-dangle': [2, 'never'],
|
||||
'comma-spacing': [2, {
|
||||
'before': false,
|
||||
'after': true
|
||||
}],
|
||||
'comma-style': [2, 'last'],
|
||||
'constructor-super': 2,
|
||||
'curly': [2, 'multi-line'],
|
||||
'dot-location': [2, 'property'],
|
||||
'eol-last': 2,
|
||||
'eqeqeq': ["error", "always", {"null": "ignore"}],
|
||||
'generator-star-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
}],
|
||||
'handle-callback-err': [2, '^(err|error)$'],
|
||||
'indent': [2, 2, {
|
||||
'SwitchCase': 1
|
||||
}],
|
||||
'jsx-quotes': [2, 'prefer-single'],
|
||||
'key-spacing': [2, {
|
||||
'beforeColon': false,
|
||||
'afterColon': true
|
||||
}],
|
||||
'keyword-spacing': [2, {
|
||||
'before': true,
|
||||
'after': true
|
||||
}],
|
||||
'new-cap': [2, {
|
||||
'newIsCap': true,
|
||||
'capIsNew': false
|
||||
}],
|
||||
'new-parens': 2,
|
||||
'no-array-constructor': 2,
|
||||
'no-caller': 2,
|
||||
'no-console': 'off',
|
||||
'no-class-assign': 2,
|
||||
'no-cond-assign': 2,
|
||||
'no-const-assign': 2,
|
||||
'no-control-regex': 0,
|
||||
'no-delete-var': 2,
|
||||
'no-dupe-args': 2,
|
||||
'no-dupe-class-members': 2,
|
||||
'no-dupe-keys': 2,
|
||||
'no-duplicate-case': 2,
|
||||
'no-empty-character-class': 2,
|
||||
'no-empty-pattern': 2,
|
||||
'no-eval': 2,
|
||||
'no-ex-assign': 2,
|
||||
'no-extend-native': 2,
|
||||
'no-extra-bind': 2,
|
||||
'no-extra-boolean-cast': 2,
|
||||
'no-extra-parens': [2, 'functions'],
|
||||
'no-fallthrough': 2,
|
||||
'no-floating-decimal': 2,
|
||||
'no-func-assign': 2,
|
||||
'no-implied-eval': 2,
|
||||
'no-inner-declarations': [2, 'functions'],
|
||||
'no-invalid-regexp': 2,
|
||||
'no-irregular-whitespace': 2,
|
||||
'no-iterator': 2,
|
||||
'no-label-var': 2,
|
||||
'no-labels': [2, {
|
||||
'allowLoop': false,
|
||||
'allowSwitch': false
|
||||
}],
|
||||
'no-lone-blocks': 2,
|
||||
'no-mixed-spaces-and-tabs': 2,
|
||||
'no-multi-spaces': 2,
|
||||
'no-multi-str': 2,
|
||||
'no-multiple-empty-lines': [2, {
|
||||
'max': 1
|
||||
}],
|
||||
'no-native-reassign': 2,
|
||||
'no-negated-in-lhs': 2,
|
||||
'no-new-object': 2,
|
||||
'no-new-require': 2,
|
||||
'no-new-symbol': 2,
|
||||
'no-new-wrappers': 2,
|
||||
'no-obj-calls': 2,
|
||||
'no-octal': 2,
|
||||
'no-octal-escape': 2,
|
||||
'no-path-concat': 2,
|
||||
'no-proto': 2,
|
||||
'no-redeclare': 2,
|
||||
'no-regex-spaces': 2,
|
||||
'no-return-assign': [2, 'except-parens'],
|
||||
'no-self-assign': 2,
|
||||
'no-self-compare': 2,
|
||||
'no-sequences': 2,
|
||||
'no-shadow-restricted-names': 2,
|
||||
'no-spaced-func': 2,
|
||||
'no-sparse-arrays': 2,
|
||||
'no-this-before-super': 2,
|
||||
'no-throw-literal': 2,
|
||||
'no-trailing-spaces': 2,
|
||||
'no-undef': 2,
|
||||
'no-undef-init': 2,
|
||||
'no-unexpected-multiline': 2,
|
||||
'no-unmodified-loop-condition': 2,
|
||||
'no-unneeded-ternary': [2, {
|
||||
'defaultAssignment': false
|
||||
}],
|
||||
'no-unreachable': 2,
|
||||
'no-unsafe-finally': 2,
|
||||
'no-unused-vars': [2, {
|
||||
'vars': 'all',
|
||||
'args': 'none'
|
||||
}],
|
||||
'no-useless-call': 2,
|
||||
'no-useless-computed-key': 2,
|
||||
'no-useless-constructor': 2,
|
||||
'no-useless-escape': 0,
|
||||
'no-whitespace-before-property': 2,
|
||||
'no-with': 2,
|
||||
'one-var': [2, {
|
||||
'initialized': 'never'
|
||||
}],
|
||||
'operator-linebreak': [2, 'after', {
|
||||
'overrides': {
|
||||
'?': 'before',
|
||||
':': 'before'
|
||||
}
|
||||
}],
|
||||
'padded-blocks': [2, 'never'],
|
||||
'quotes': [2, 'single', {
|
||||
'avoidEscape': true,
|
||||
'allowTemplateLiterals': true
|
||||
}],
|
||||
'semi': [2, 'never'],
|
||||
'semi-spacing': [2, {
|
||||
'before': false,
|
||||
'after': true
|
||||
}],
|
||||
'space-before-blocks': [2, 'always'],
|
||||
'space-before-function-paren': [2, 'never'],
|
||||
'space-in-parens': [2, 'never'],
|
||||
'space-infix-ops': 2,
|
||||
'space-unary-ops': [2, {
|
||||
'words': true,
|
||||
'nonwords': false
|
||||
}],
|
||||
'spaced-comment': [2, 'always', {
|
||||
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
|
||||
}],
|
||||
'template-curly-spacing': [2, 'never'],
|
||||
'use-isnan': 2,
|
||||
'valid-typeof': 2,
|
||||
'wrap-iife': [2, 'any'],
|
||||
'yield-star-spacing': [2, 'both'],
|
||||
'yoda': [2, 'never'],
|
||||
'prefer-const': 2,
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||
'object-curly-spacing': [2, 'always', {
|
||||
objectsInObjects: false
|
||||
}],
|
||||
'array-bracket-spacing': [2, 'never']
|
||||
// 允许props修改
|
||||
'vue/no-mutating-props': 'off',
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
|
||||
}
|
||||
}
|
||||
|
22
ruoyi-ui/.gitignore
vendored
22
ruoyi-ui/.gitignore
vendored
@ -1,14 +1,17 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
**/*.log
|
||||
|
||||
tests/**/coverage/
|
||||
tests/e2e/reports
|
||||
selenium-debug.log
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
@ -17,7 +20,4 @@ selenium-debug.log
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.local
|
||||
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
*.sw?
|
||||
|
@ -1,13 +1,12 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
],
|
||||
'env': {
|
||||
'development': {
|
||||
env: {
|
||||
development: {
|
||||
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
|
||||
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
|
||||
'plugins': ['dynamic-import-node']
|
||||
plugins: ['dynamic-import-node']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [<EFBFBD><EFBFBD>Ϣ] <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD>dist<73>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
echo [信息] 打包Web工程,生成dist文件。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
|
@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [<EFBFBD><EFBFBD>Ϣ] <20><>װWeb<65><62><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD>node_modules<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
||||
echo [信息] 安装Web工程,生成node_modules文件。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
|
@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
echo.
|
||||
echo [<EFBFBD><EFBFBD>Ϣ] ʹ<><CAB9> Vue CLI <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Web <20><><EFBFBD>̡<EFBFBD>
|
||||
echo [信息] 使用 Vue CLI 命令运行 Web 工程。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "ruoyi",
|
||||
"name": "ruoyi-template",
|
||||
"version": "3.6.0",
|
||||
"description": "若依管理系统",
|
||||
"author": "若依",
|
||||
@ -9,7 +9,7 @@
|
||||
"build:prod": "vue-cli-service build",
|
||||
"build:stage": "vue-cli-service build --mode staging",
|
||||
"preview": "node build/index.js --preview",
|
||||
"lint": "eslint --ext .js,.vue src"
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
@ -64,10 +64,15 @@
|
||||
"@vue/cli-plugin-babel": "4.4.6",
|
||||
"@vue/cli-plugin-eslint": "4.4.6",
|
||||
"@vue/cli-service": "4.4.6",
|
||||
"@vue/eslint-config-standard": "^6.1.0",
|
||||
"babel-eslint": "10.1.0",
|
||||
"chalk": "4.1.0",
|
||||
"connect": "3.6.6",
|
||||
"eslint": "7.15.0",
|
||||
"eslint-plugin-import": "^2.24.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"eslint-plugin-standard": "^5.0.0",
|
||||
"eslint-plugin-vue": "7.2.0",
|
||||
"lint-staged": "10.5.3",
|
||||
"runjs": "4.4.2",
|
||||
@ -80,9 +85,5 @@
|
||||
"engines": {
|
||||
"node": ">=8.9",
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ export function changeJobStatus(jobId, status) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 定时任务立即执行一次
|
||||
export function runJob (jobId, jobGroup) {
|
||||
const data = {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/utils/request'
|
||||
import { praseStrEmpty } from "@/utils/ruoyi";
|
||||
import { praseStrEmpty } from '@/utils/ruoyi'
|
||||
|
||||
// 查询用户列表
|
||||
export function listUser (query) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 1.4 KiB |
@ -2,7 +2,7 @@
|
||||
<el-breadcrumb class="app-breadcrumb" separator="/">
|
||||
<transition-group name="breadcrumb">
|
||||
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
|
||||
<span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
|
||||
<span v-if="item.redirect==='noRedirect'||index===levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
|
||||
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
|
||||
</el-breadcrumb-item>
|
||||
</transition-group>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<template v-for="(item, index) in options">
|
||||
<template v-if="values.includes(item.dictValue)">
|
||||
<span
|
||||
v-if="item.listClass == 'default' || item.listClass == ''"
|
||||
v-if="item.listClass === 'default' || item.listClass === ''"
|
||||
:key="item.dictValue"
|
||||
:index="index"
|
||||
:class="item.cssClass"
|
||||
@ -13,7 +13,7 @@
|
||||
v-else
|
||||
:key="item.dictValue"
|
||||
:index="index"
|
||||
:type="item.listClass == 'primary' ? '' : item.listClass"
|
||||
:type="item.listClass === 'primary' ? '' : item.listClass"
|
||||
:class="item.cssClass"
|
||||
>
|
||||
{{ item.dictLabel }}
|
||||
@ -25,24 +25,24 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "DictTag",
|
||||
name: 'DictTag',
|
||||
props: {
|
||||
options: {
|
||||
type: Array,
|
||||
default: null,
|
||||
default: null
|
||||
},
|
||||
value: [String, Array],
|
||||
value: [String, Array]
|
||||
},
|
||||
computed: {
|
||||
values () {
|
||||
if (this.value) {
|
||||
return Array.isArray(this.value) ? this.value : [this.value];
|
||||
return Array.isArray(this.value) ? this.value : [this.value]
|
||||
} else {
|
||||
return [];
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-tag + .el-tag {
|
||||
|
@ -10,7 +10,7 @@
|
||||
:headers="headers"
|
||||
style="display: none"
|
||||
ref="upload"
|
||||
v-if="this.type == 'url'"
|
||||
v-if="this.type === 'url'"
|
||||
>
|
||||
</el-upload>
|
||||
<div class="editor" ref="editor" :style="styles"></div>
|
||||
@ -18,176 +18,176 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Quill from "quill";
|
||||
import "quill/dist/quill.core.css";
|
||||
import "quill/dist/quill.snow.css";
|
||||
import "quill/dist/quill.bubble.css";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import Quill from 'quill'
|
||||
import 'quill/dist/quill.core.css'
|
||||
import 'quill/dist/quill.snow.css'
|
||||
import 'quill/dist/quill.bubble.css'
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: "Editor",
|
||||
name: 'Editor',
|
||||
props: {
|
||||
/* 编辑器的内容 */
|
||||
value: {
|
||||
type: String,
|
||||
default: "",
|
||||
default: ''
|
||||
},
|
||||
/* 高度 */
|
||||
height: {
|
||||
type: Number,
|
||||
default: null,
|
||||
default: null
|
||||
},
|
||||
/* 最小高度 */
|
||||
minHeight: {
|
||||
type: Number,
|
||||
default: null,
|
||||
default: null
|
||||
},
|
||||
/* 只读 */
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
default: false
|
||||
},
|
||||
// 上传文件大小限制(MB)
|
||||
fileSize: {
|
||||
type: Number,
|
||||
default: 5,
|
||||
default: 5
|
||||
},
|
||||
/* 类型(base64格式、url格式) */
|
||||
type: {
|
||||
type: String,
|
||||
default: "url",
|
||||
default: 'url'
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken()
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
},
|
||||
Quill: null,
|
||||
currentValue: "",
|
||||
currentValue: '',
|
||||
options: {
|
||||
theme: "snow",
|
||||
theme: 'snow',
|
||||
bounds: document.body,
|
||||
debug: "warn",
|
||||
debug: 'warn',
|
||||
modules: {
|
||||
// 工具栏配置
|
||||
toolbar: [
|
||||
["bold", "italic", "underline", "strike"], // 加粗 斜体 下划线 删除线
|
||||
["blockquote", "code-block"], // 引用 代码块
|
||||
[{ list: "ordered" }, { list: "bullet" }], // 有序、无序列表
|
||||
[{ indent: "-1" }, { indent: "+1" }], // 缩进
|
||||
[{ size: ["small", false, "large", "huge"] }], // 字体大小
|
||||
['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线
|
||||
['blockquote', 'code-block'], // 引用 代码块
|
||||
[{ list: 'ordered' }, { list: 'bullet' }], // 有序、无序列表
|
||||
[{ indent: '-1' }, { indent: '+1' }], // 缩进
|
||||
[{ size: ['small', false, 'large', 'huge'] }], // 字体大小
|
||||
[{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
|
||||
[{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色
|
||||
[{ align: [] }], // 对齐方式
|
||||
["clean"], // 清除文本格式
|
||||
["link", "image", "video"] // 链接、图片、视频
|
||||
],
|
||||
['clean'], // 清除文本格式
|
||||
['link', 'image', 'video'] // 链接、图片、视频
|
||||
]
|
||||
},
|
||||
placeholder: "请输入内容",
|
||||
readOnly: this.readOnly,
|
||||
},
|
||||
};
|
||||
placeholder: '请输入内容',
|
||||
readOnly: this.readOnly
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
styles () {
|
||||
let style = {};
|
||||
const style = {}
|
||||
if (this.minHeight) {
|
||||
style.minHeight = `${this.minHeight}px`;
|
||||
style.minHeight = `${this.minHeight}px`
|
||||
}
|
||||
if (this.height) {
|
||||
style.height = `${this.height}px`;
|
||||
style.height = `${this.height}px`
|
||||
}
|
||||
return style
|
||||
}
|
||||
return style;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler (val) {
|
||||
if (val !== this.currentValue) {
|
||||
this.currentValue = val === null ? "" : val;
|
||||
this.currentValue = val === null ? '' : val
|
||||
if (this.Quill) {
|
||||
this.Quill.pasteHTML(this.currentValue);
|
||||
this.Quill.pasteHTML(this.currentValue)
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.init();
|
||||
this.init()
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.Quill = null;
|
||||
this.Quill = null
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
const editor = this.$refs.editor;
|
||||
this.Quill = new Quill(editor, this.options);
|
||||
const editor = this.$refs.editor
|
||||
this.Quill = new Quill(editor, this.options)
|
||||
// 如果设置了上传地址则自定义图片上传事件
|
||||
if (this.type == 'url') {
|
||||
let toolbar = this.Quill.getModule("toolbar");
|
||||
toolbar.addHandler("image", (value) => {
|
||||
this.uploadType = "image";
|
||||
if (this.type === 'url') {
|
||||
const toolbar = this.Quill.getModule('toolbar')
|
||||
toolbar.addHandler('image', (value) => {
|
||||
this.uploadType = 'image'
|
||||
if (value) {
|
||||
this.$refs.upload.$children[0].$refs.input.click();
|
||||
this.$refs.upload.$children[0].$refs.input.click()
|
||||
} else {
|
||||
this.quill.format("image", false);
|
||||
this.quill.format('image', false)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
this.Quill.pasteHTML(this.currentValue);
|
||||
this.Quill.on("text-change", (delta, oldDelta, source) => {
|
||||
const html = this.$refs.editor.children[0].innerHTML;
|
||||
const text = this.Quill.getText();
|
||||
const quill = this.Quill;
|
||||
this.currentValue = html;
|
||||
this.$emit("input", html);
|
||||
this.$emit("on-change", { html, text, quill });
|
||||
});
|
||||
this.Quill.on("text-change", (delta, oldDelta, source) => {
|
||||
this.$emit("on-text-change", delta, oldDelta, source);
|
||||
});
|
||||
this.Quill.on("selection-change", (range, oldRange, source) => {
|
||||
this.$emit("on-selection-change", range, oldRange, source);
|
||||
});
|
||||
this.Quill.on("editor-change", (eventName, ...args) => {
|
||||
this.$emit("on-editor-change", eventName, ...args);
|
||||
});
|
||||
this.Quill.pasteHTML(this.currentValue)
|
||||
this.Quill.on('text-change', (delta, oldDelta, source) => {
|
||||
const html = this.$refs.editor.children[0].innerHTML
|
||||
const text = this.Quill.getText()
|
||||
const quill = this.Quill
|
||||
this.currentValue = html
|
||||
this.$emit('input', html)
|
||||
this.$emit('on-change', { html, text, quill })
|
||||
})
|
||||
this.Quill.on('text-change', (delta, oldDelta, source) => {
|
||||
this.$emit('on-text-change', delta, oldDelta, source)
|
||||
})
|
||||
this.Quill.on('selection-change', (range, oldRange, source) => {
|
||||
this.$emit('on-selection-change', range, oldRange, source)
|
||||
})
|
||||
this.Quill.on('editor-change', (eventName, ...args) => {
|
||||
this.$emit('on-editor-change', eventName, ...args)
|
||||
})
|
||||
},
|
||||
// 上传前校检格式和大小
|
||||
handleBeforeUpload (file) {
|
||||
// 校检文件大小
|
||||
if (this.fileSize) {
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize
|
||||
if (!isLt) {
|
||||
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
|
||||
return false;
|
||||
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
},
|
||||
handleUploadSuccess (res, file) {
|
||||
// 获取富文本组件实例
|
||||
let quill = this.Quill;
|
||||
const quill = this.Quill
|
||||
// 如果上传成功
|
||||
if (res.code == 200) {
|
||||
if (res.code === 200) {
|
||||
// 获取光标所在位置
|
||||
let length = quill.getSelection().index;
|
||||
const length = quill.getSelection().index
|
||||
// 插入图片 res.url为服务器返回的图片地址
|
||||
quill.insertEmbed(length, "image", process.env.VUE_APP_BASE_API + res.fileName);
|
||||
quill.insertEmbed(length, 'image', process.env.VUE_APP_BASE_API + res.fileName)
|
||||
// 调整光标到最后
|
||||
quill.setSelection(length + 1);
|
||||
quill.setSelection(length + 1)
|
||||
} else {
|
||||
this.$message.error("图片插入失败");
|
||||
this.$message.error('图片插入失败')
|
||||
}
|
||||
},
|
||||
handleUploadError () {
|
||||
this.$message.error("图片插入失败");
|
||||
},
|
||||
},
|
||||
};
|
||||
this.$message.error('图片插入失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -39,27 +39,27 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: "FileUpload",
|
||||
name: 'FileUpload',
|
||||
props: {
|
||||
// 值
|
||||
value: [String, Object, Array],
|
||||
// 数量限制
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 5,
|
||||
default: 5
|
||||
},
|
||||
// 大小限制(MB)
|
||||
fileSize: {
|
||||
type: Number,
|
||||
default: 5,
|
||||
default: 5
|
||||
},
|
||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileType: {
|
||||
type: Array,
|
||||
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
||||
default: () => ['doc', 'xls', 'ppt', 'txt', 'pdf']
|
||||
},
|
||||
// 是否显示提示
|
||||
isShowTip: {
|
||||
@ -70,31 +70,31 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
},
|
||||
fileList: [],
|
||||
};
|
||||
fileList: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler (val) {
|
||||
if (val) {
|
||||
let temp = 1;
|
||||
let temp = 1
|
||||
// 首先将值转为数组
|
||||
const list = Array.isArray(val) ? val : this.value.split(',');
|
||||
const list = Array.isArray(val) ? val : this.value.split(',')
|
||||
// 然后将数组转为对象数组
|
||||
this.fileList = list.map(item => {
|
||||
if (typeof item === "string") {
|
||||
item = { name: item, url: item };
|
||||
if (typeof item === 'string') {
|
||||
item = { name: item, url: item }
|
||||
}
|
||||
item.uid = item.uid || new Date().getTime() + temp++;
|
||||
return item;
|
||||
});
|
||||
item.uid = item.uid || new Date().getTime() + temp++
|
||||
return item
|
||||
})
|
||||
} else {
|
||||
this.fileList = [];
|
||||
return [];
|
||||
this.fileList = []
|
||||
return []
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
@ -104,76 +104,76 @@ export default {
|
||||
computed: {
|
||||
// 是否显示提示
|
||||
showTip () {
|
||||
return this.isShowTip && (this.fileType || this.fileSize);
|
||||
},
|
||||
return this.isShowTip && (this.fileType || this.fileSize)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 上传前校检格式和大小
|
||||
handleBeforeUpload (file) {
|
||||
// 校检文件类型
|
||||
if (this.fileType) {
|
||||
let fileExtension = "";
|
||||
if (file.name.lastIndexOf(".") > -1) {
|
||||
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
|
||||
let fileExtension = ''
|
||||
if (file.name.lastIndexOf('.') > -1) {
|
||||
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
|
||||
}
|
||||
const isTypeOk = this.fileType.some((type) => {
|
||||
if (file.type.indexOf(type) > -1) return true;
|
||||
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
|
||||
return false;
|
||||
});
|
||||
if (file.type.indexOf(type) > -1) return true
|
||||
if (fileExtension && fileExtension.indexOf(type) > -1) return true
|
||||
return false
|
||||
})
|
||||
if (!isTypeOk) {
|
||||
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
|
||||
return false;
|
||||
this.$message.error(`文件格式不正确, 请上传${this.fileType.join('/')}格式文件!`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
// 校检文件大小
|
||||
if (this.fileSize) {
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize
|
||||
if (!isLt) {
|
||||
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
|
||||
return false;
|
||||
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
},
|
||||
// 文件个数超出
|
||||
handleExceed () {
|
||||
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
|
||||
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`)
|
||||
},
|
||||
// 上传失败
|
||||
handleUploadError(err) {
|
||||
this.$message.error("上传失败, 请重试");
|
||||
handleUploadError () {
|
||||
this.$message.error('上传失败, 请重试')
|
||||
},
|
||||
// 上传成功回调
|
||||
handleUploadSuccess (res, file) {
|
||||
this.$message.success("上传成功");
|
||||
this.fileList.push({ name: res.fileName, url: res.fileName });
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
this.$message.success('上传成功')
|
||||
this.fileList.push({ name: res.fileName, url: res.fileName })
|
||||
this.$emit('input', this.listToString(this.fileList))
|
||||
},
|
||||
// 删除文件
|
||||
handleDelete (index) {
|
||||
this.fileList.splice(index, 1);
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
this.fileList.splice(index, 1)
|
||||
this.$emit('input', this.listToString(this.fileList))
|
||||
},
|
||||
// 获取文件名称
|
||||
getFileName (name) {
|
||||
if (name.lastIndexOf("/") > -1) {
|
||||
return name.slice(name.lastIndexOf("/") + 1).toLowerCase();
|
||||
if (name.lastIndexOf('/') > -1) {
|
||||
return name.slice(name.lastIndexOf('/') + 1).toLowerCase()
|
||||
} else {
|
||||
return "";
|
||||
return ''
|
||||
}
|
||||
},
|
||||
// 对象转成指定字符串分隔
|
||||
listToString (list, separator) {
|
||||
let strs = "";
|
||||
separator = separator || ",";
|
||||
for (let i in list) {
|
||||
strs += list[i].url + separator;
|
||||
let strs = ''
|
||||
separator = separator || ','
|
||||
for (const i in list) {
|
||||
strs += list[i].url + separator
|
||||
}
|
||||
return strs !== '' ? strs.substr(0, strs.length - 1) : ''
|
||||
}
|
||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
@ -70,11 +70,11 @@ export default {
|
||||
this.show = false
|
||||
},
|
||||
change (val) {
|
||||
const path = val.path;
|
||||
const path = val.path
|
||||
if (this.ishttp(val.path)) {
|
||||
// http(s):// 路径新窗口打开
|
||||
const pindex = path.indexOf("http");
|
||||
window.open(path.substr(pindex, path.length), "_blank");
|
||||
const pindex = path.indexOf('http')
|
||||
window.open(path.substr(pindex, path.length), '_blank')
|
||||
} else {
|
||||
this.$router.push(val.path)
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -50,17 +50,17 @@ export default {
|
||||
// 图片数量限制
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 5,
|
||||
default: 5
|
||||
},
|
||||
// 大小限制(MB)
|
||||
fileSize: {
|
||||
type: Number,
|
||||
default: 5,
|
||||
default: 5
|
||||
},
|
||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileType: {
|
||||
type: Array,
|
||||
default: () => ["png", "jpg", "jpeg"],
|
||||
default: () => ['png', 'jpg', 'jpeg']
|
||||
},
|
||||
// 是否显示提示
|
||||
isShowTip: {
|
||||
@ -70,37 +70,37 @@ export default {
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
dialogImageUrl: "",
|
||||
dialogImageUrl: '',
|
||||
dialogVisible: false,
|
||||
hideUpload: false,
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", // 上传的图片服务器地址
|
||||
uploadImgUrl: process.env.VUE_APP_BASE_API + '/common/upload', // 上传的图片服务器地址
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
},
|
||||
fileList: []
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler (val) {
|
||||
if (val) {
|
||||
// 首先将值转为数组
|
||||
const list = Array.isArray(val) ? val : this.value.split(',');
|
||||
const list = Array.isArray(val) ? val : this.value.split(',')
|
||||
// 然后将数组转为对象数组
|
||||
this.fileList = list.map(item => {
|
||||
if (typeof item === "string") {
|
||||
if (typeof item === 'string') {
|
||||
if (item.indexOf(this.baseUrl) === -1) {
|
||||
item = { name: this.baseUrl + item, url: this.baseUrl + item };
|
||||
item = { name: this.baseUrl + item, url: this.baseUrl + item }
|
||||
} else {
|
||||
item = { name: item, url: item };
|
||||
item = { name: item, url: item }
|
||||
}
|
||||
}
|
||||
return item;
|
||||
});
|
||||
return item
|
||||
})
|
||||
} else {
|
||||
this.fileList = [];
|
||||
return [];
|
||||
this.fileList = []
|
||||
return []
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
@ -110,86 +110,86 @@ export default {
|
||||
computed: {
|
||||
// 是否显示提示
|
||||
showTip () {
|
||||
return this.isShowTip && (this.fileType || this.fileSize);
|
||||
},
|
||||
return this.isShowTip && (this.fileType || this.fileSize)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 删除图片
|
||||
handleRemove (file, fileList) {
|
||||
const findex = this.fileList.map(f => f.name).indexOf(file.name);
|
||||
this.fileList.splice(findex, 1);
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
const findex = this.fileList.map(f => f.name).indexOf(file.name)
|
||||
this.fileList.splice(findex, 1)
|
||||
this.$emit('input', this.listToString(this.fileList))
|
||||
},
|
||||
// 上传成功回调
|
||||
handleUploadSuccess (res) {
|
||||
this.fileList.push({ name: res.fileName, url: res.fileName });
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
this.loading.close();
|
||||
this.fileList.push({ name: res.fileName, url: res.fileName })
|
||||
this.$emit('input', this.listToString(this.fileList))
|
||||
this.loading.close()
|
||||
},
|
||||
// 上传前loading加载
|
||||
handleBeforeUpload (file) {
|
||||
let isImg = false;
|
||||
let isImg = false
|
||||
if (this.fileType.length) {
|
||||
let fileExtension = "";
|
||||
if (file.name.lastIndexOf(".") > -1) {
|
||||
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
|
||||
let fileExtension = ''
|
||||
if (file.name.lastIndexOf('.') > -1) {
|
||||
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
|
||||
}
|
||||
isImg = this.fileType.some(type => {
|
||||
if (file.type.indexOf(type) > -1) return true;
|
||||
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
|
||||
return false;
|
||||
});
|
||||
if (file.type.indexOf(type) > -1) return true
|
||||
if (fileExtension && fileExtension.indexOf(type) > -1) return true
|
||||
return false
|
||||
})
|
||||
} else {
|
||||
isImg = file.type.indexOf("image") > -1;
|
||||
isImg = file.type.indexOf('image') > -1
|
||||
}
|
||||
|
||||
if (!isImg) {
|
||||
this.$message.error(
|
||||
`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`
|
||||
);
|
||||
return false;
|
||||
`文件格式不正确, 请上传${this.fileType.join('/')}图片格式文件!`
|
||||
)
|
||||
return false
|
||||
}
|
||||
if (this.fileSize) {
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize
|
||||
if (!isLt) {
|
||||
this.$message.error(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
|
||||
return false;
|
||||
this.$message.error(`上传头像图片大小不能超过 ${this.fileSize} MB!`)
|
||||
return false
|
||||
}
|
||||
}
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
text: "上传中",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
});
|
||||
text: '上传中',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
},
|
||||
// 文件个数超出
|
||||
handleExceed () {
|
||||
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
|
||||
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`)
|
||||
},
|
||||
// 上传失败
|
||||
handleUploadError () {
|
||||
this.$message({
|
||||
type: "error",
|
||||
message: "上传失败",
|
||||
});
|
||||
this.loading.close();
|
||||
type: 'error',
|
||||
message: '上传失败'
|
||||
})
|
||||
this.loading.close()
|
||||
},
|
||||
// 预览
|
||||
handlePictureCardPreview (file) {
|
||||
this.dialogImageUrl = file.url;
|
||||
this.dialogVisible = true;
|
||||
this.dialogImageUrl = file.url
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 对象转成指定字符串分隔
|
||||
listToString (list, separator) {
|
||||
let strs = "";
|
||||
separator = separator || ",";
|
||||
for (let i in list) {
|
||||
strs += list[i].url.replace(this.baseUrl, "") + separator;
|
||||
let strs = ''
|
||||
separator = separator || ','
|
||||
for (const i in list) {
|
||||
strs += list[i].url.replace(this.baseUrl, '') + separator
|
||||
}
|
||||
return strs !== '' ? strs.substr(0, strs.length - 1) : ''
|
||||
}
|
||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
// .el-upload--picture-card 控制加号部分
|
||||
@ -207,4 +207,3 @@ export default {
|
||||
transform: translateY(0);
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -38,7 +38,7 @@ export default {
|
||||
},
|
||||
theme () {
|
||||
return this.$store.state.settings.theme
|
||||
},
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show (value) {
|
||||
|
@ -23,56 +23,56 @@
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "RightToolbar",
|
||||
name: 'RightToolbar',
|
||||
data () {
|
||||
return {
|
||||
// 显隐数据
|
||||
value: [],
|
||||
// 弹出层标题
|
||||
title: "显示/隐藏",
|
||||
title: '显示/隐藏',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
};
|
||||
open: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
showSearch: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
default: true
|
||||
},
|
||||
columns: {
|
||||
type: Array,
|
||||
},
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
created () {
|
||||
// 显隐列初始默认隐藏列
|
||||
for (let item in this.columns) {
|
||||
for (const item in this.columns) {
|
||||
if (this.columns[item].visible === false) {
|
||||
this.value.push(parseInt(item));
|
||||
this.value.push(parseInt(item))
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 搜索
|
||||
toggleSearch () {
|
||||
this.$emit("update:showSearch", !this.showSearch);
|
||||
this.$emit('update:showSearch', !this.showSearch)
|
||||
},
|
||||
// 刷新
|
||||
refresh () {
|
||||
this.$emit("queryTable");
|
||||
this.$emit('queryTable')
|
||||
},
|
||||
// 右侧列表元素变化
|
||||
dataChange (data) {
|
||||
for (var item in this.columns) {
|
||||
const key = this.columns[item].key;
|
||||
this.columns[item].visible = !data.includes(key);
|
||||
for (const item in this.columns) {
|
||||
const key = this.columns[item].key
|
||||
this.columns[item].visible = !data.includes(key)
|
||||
}
|
||||
},
|
||||
// 打开显隐列dialog
|
||||
showColumn () {
|
||||
this.open = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
this.open = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
::v-deep .el-transfer__button {
|
||||
|
@ -28,7 +28,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { constantRoutes } from "@/router";
|
||||
import { constantRoutes } from '@/router'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
@ -39,72 +39,75 @@ export default {
|
||||
isFrist: false,
|
||||
// 当前激活菜单的 index
|
||||
currentIndex: undefined
|
||||
};
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
theme () {
|
||||
return this.$store.state.settings.theme;
|
||||
return this.$store.state.settings.theme
|
||||
},
|
||||
// 顶部显示菜单
|
||||
topMenus () {
|
||||
let topMenus = [];
|
||||
const topMenus = []
|
||||
this.routers.map((menu) => {
|
||||
if (menu.hidden !== true) {
|
||||
// 兼容顶部栏一级菜单内部跳转
|
||||
if (menu.path === "/") {
|
||||
topMenus.push(menu.children[0]);
|
||||
if (menu.path === '/') {
|
||||
topMenus.push(menu.children[0])
|
||||
} else {
|
||||
topMenus.push(menu);
|
||||
topMenus.push(menu)
|
||||
}
|
||||
}
|
||||
});
|
||||
return topMenus;
|
||||
return undefined
|
||||
})
|
||||
return topMenus
|
||||
},
|
||||
// 所有的路由信息
|
||||
routers () {
|
||||
return this.$store.state.permission.topbarRouters;
|
||||
return this.$store.state.permission.topbarRouters
|
||||
},
|
||||
// 设置子路由
|
||||
childrenMenus () {
|
||||
var childrenMenus = [];
|
||||
const childrenMenus = []
|
||||
this.routers.map((router) => {
|
||||
for (var item in router.children) {
|
||||
for (const item in router.children) {
|
||||
if (router.children[item].parentPath === undefined) {
|
||||
if(router.path === "/") {
|
||||
router.children[item].path = "/redirect/" + router.children[item].path;
|
||||
if (router.path === '/') {
|
||||
router.children[item].path = '/redirect/' + router.children[item].path
|
||||
} else {
|
||||
if (!this.ishttp(router.children[item].path)) {
|
||||
router.children[item].path = router.path + "/" + router.children[item].path;
|
||||
router.children[item].path = router.path + '/' + router.children[item].path
|
||||
}
|
||||
}
|
||||
router.children[item].parentPath = router.path;
|
||||
router.children[item].parentPath = router.path
|
||||
}
|
||||
childrenMenus.push(router.children[item]);
|
||||
childrenMenus.push(router.children[item])
|
||||
}
|
||||
});
|
||||
return constantRoutes.concat(childrenMenus);
|
||||
return undefined
|
||||
})
|
||||
return constantRoutes.concat(childrenMenus)
|
||||
},
|
||||
// 默认激活的菜单
|
||||
activeMenu () {
|
||||
const path = this.$route.path;
|
||||
let activePath = this.defaultRouter();
|
||||
if (path.lastIndexOf("/") > 0) {
|
||||
const tmpPath = path.substring(1, path.length);
|
||||
activePath = "/" + tmpPath.substring(0, tmpPath.indexOf("/"));
|
||||
} else if ("/index" == path || "" == path) {
|
||||
const path = this.$route.path
|
||||
let activePath = this.defaultRouter()
|
||||
if (path.lastIndexOf('/') > 0) {
|
||||
const tmpPath = path.substring(1, path.length)
|
||||
activePath = '/' + tmpPath.substring(0, tmpPath.indexOf('/'))
|
||||
} else if (path === '/index' || path === '') {
|
||||
if (!this.isFrist) {
|
||||
this.isFrist = true;
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
this.isFrist = true
|
||||
} else {
|
||||
activePath = "index";
|
||||
activePath = 'index'
|
||||
}
|
||||
}
|
||||
var routes = this.activeRoutes(activePath);
|
||||
const routes = this.activeRoutes(activePath)
|
||||
if (routes.length === 0) {
|
||||
activePath = this.currentIndex || this.defaultRouter()
|
||||
this.activeRoutes(activePath);
|
||||
this.activeRoutes(activePath)
|
||||
}
|
||||
return activePath
|
||||
}
|
||||
return activePath;
|
||||
},
|
||||
},
|
||||
beforeMount () {
|
||||
window.addEventListener('resize', this.setVisibleNumber)
|
||||
@ -113,59 +116,61 @@ export default {
|
||||
window.removeEventListener('resize', this.setVisibleNumber)
|
||||
},
|
||||
mounted () {
|
||||
this.setVisibleNumber();
|
||||
this.setVisibleNumber()
|
||||
},
|
||||
methods: {
|
||||
// 根据宽度计算设置显示栏数
|
||||
setVisibleNumber () {
|
||||
const width = document.body.getBoundingClientRect().width / 3;
|
||||
this.visibleNumber = parseInt(width / 85);
|
||||
const width = document.body.getBoundingClientRect().width / 3
|
||||
this.visibleNumber = parseInt(width / 85)
|
||||
},
|
||||
// 默认激活的路由
|
||||
defaultRouter () {
|
||||
let router;
|
||||
let router
|
||||
Object.keys(this.routers).some((key) => {
|
||||
if (!this.routers[key].hidden) {
|
||||
router = this.routers[key].path;
|
||||
return true;
|
||||
router = this.routers[key].path
|
||||
return true
|
||||
}
|
||||
});
|
||||
return router;
|
||||
return undefined
|
||||
})
|
||||
return router
|
||||
},
|
||||
// 菜单选择事件
|
||||
handleSelect (key, keyPath) {
|
||||
this.currentIndex = key;
|
||||
this.currentIndex = key
|
||||
if (this.ishttp(key)) {
|
||||
// http(s):// 路径新窗口打开
|
||||
window.open(key, "_blank");
|
||||
} else if (key.indexOf("/redirect") !== -1) {
|
||||
window.open(key, '_blank')
|
||||
} else if (key.indexOf('/redirect') !== -1) {
|
||||
// /redirect 路径内部打开
|
||||
this.$router.push({ path: key.replace("/redirect", "") });
|
||||
this.$router.push({ path: key.replace('/redirect', '') })
|
||||
} else {
|
||||
// 显示左侧联动菜单
|
||||
this.activeRoutes(key);
|
||||
this.activeRoutes(key)
|
||||
}
|
||||
},
|
||||
// 当前激活的路由
|
||||
activeRoutes (key) {
|
||||
var routes = [];
|
||||
const routes = []
|
||||
if (this.childrenMenus && this.childrenMenus.length > 0) {
|
||||
this.childrenMenus.map((item) => {
|
||||
if (key == item.parentPath || (key == "index" && "" == item.path)) {
|
||||
routes.push(item);
|
||||
if (key === item.parentPath || (key === 'index' && item.path === '')) {
|
||||
routes.push(item)
|
||||
}
|
||||
});
|
||||
return undefined
|
||||
})
|
||||
}
|
||||
if (routes.length > 0) {
|
||||
this.$store.commit("SET_SIDEBAR_ROUTERS", routes);
|
||||
this.$store.commit('SET_SIDEBAR_ROUTERS', routes)
|
||||
}
|
||||
return routes;
|
||||
return routes
|
||||
},
|
||||
ishttp (url) {
|
||||
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -14,23 +14,23 @@ export default {
|
||||
src: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 94.5 + "px;",
|
||||
height: document.documentElement.clientHeight - 94.5 + 'px;',
|
||||
loading: true,
|
||||
url: this.src
|
||||
};
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
}, 300);
|
||||
const that = this;
|
||||
this.loading = false
|
||||
}, 300)
|
||||
const that = this
|
||||
window.onresize = function temp () {
|
||||
that.height = document.documentElement.clientHeight - 94.5 + "px;";
|
||||
};
|
||||
that.height = document.documentElement.clientHeight - 94.5 + 'px;'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -6,59 +6,58 @@
|
||||
export default {
|
||||
bind (el, binding, vnode, oldVnode) {
|
||||
const value = binding.value
|
||||
if (value == false) return
|
||||
if (value === false) return
|
||||
// 获取拖拽内容头部
|
||||
const dialogHeaderEl = el.querySelector('.el-dialog__header');
|
||||
const dragDom = el.querySelector('.el-dialog');
|
||||
dialogHeaderEl.style.cursor = 'move';
|
||||
const dialogHeaderEl = el.querySelector('.el-dialog__header')
|
||||
const dragDom = el.querySelector('.el-dialog')
|
||||
dialogHeaderEl.style.cursor = 'move'
|
||||
// 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
|
||||
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
|
||||
dragDom.style.position = 'absolute';
|
||||
dragDom.style.marginTop = 0;
|
||||
let width = dragDom.style.width;
|
||||
const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
|
||||
dragDom.style.position = 'absolute'
|
||||
dragDom.style.marginTop = 0
|
||||
let width = dragDom.style.width
|
||||
if (width.includes('%')) {
|
||||
width = +document.body.clientWidth * (+width.replace(/\%/g, '') / 100);
|
||||
width = +document.body.clientWidth * (+width.replace(/%/g, '') / 100)
|
||||
} else {
|
||||
width = +width.replace(/\px/g, '');
|
||||
width = +width.replace(/\px/g, '')
|
||||
}
|
||||
dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`;
|
||||
dragDom.style.left = `${(document.body.clientWidth - width) / 2}px`
|
||||
// 鼠标按下事件
|
||||
dialogHeaderEl.onmousedown = (e) => {
|
||||
// 鼠标按下,计算当前元素距离可视区的距离 (鼠标点击位置距离可视窗口的距离)
|
||||
const disX = e.clientX - dialogHeaderEl.offsetLeft;
|
||||
const disY = e.clientY - dialogHeaderEl.offsetTop;
|
||||
const disX = e.clientX - dialogHeaderEl.offsetLeft
|
||||
const disY = e.clientY - dialogHeaderEl.offsetTop
|
||||
|
||||
// 获取到的值带px 正则匹配替换
|
||||
let styL, styT;
|
||||
let styL, styT
|
||||
|
||||
// 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
|
||||
if (sty.left.includes('%')) {
|
||||
styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100);
|
||||
styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100);
|
||||
styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100)
|
||||
styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100)
|
||||
} else {
|
||||
styL = +sty.left.replace(/\px/g, '');
|
||||
styT = +sty.top.replace(/\px/g, '');
|
||||
styL = +sty.left.replace(/\px/g, '')
|
||||
styT = +sty.top.replace(/\px/g, '')
|
||||
};
|
||||
|
||||
// 鼠标拖拽事件
|
||||
document.onmousemove = function (e) {
|
||||
// 通过事件委托,计算移动的距离 (开始拖拽至结束拖拽的距离)
|
||||
const l = e.clientX - disX;
|
||||
const t = e.clientY - disY;
|
||||
const l = e.clientX - disX
|
||||
const t = e.clientY - disY
|
||||
|
||||
let finallyL = l + styL
|
||||
let finallyT = t + styT
|
||||
const finallyL = l + styL
|
||||
const finallyT = t + styT
|
||||
|
||||
// 移动当前元素
|
||||
dragDom.style.left = `${finallyL}px`;
|
||||
dragDom.style.top = `${finallyT}px`;
|
||||
|
||||
};
|
||||
dragDom.style.left = `${finallyL}px`
|
||||
dragDom.style.top = `${finallyT}px`
|
||||
}
|
||||
|
||||
document.onmouseup = function (e) {
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
document.onmousemove = null
|
||||
document.onmouseup = null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -13,9 +13,10 @@ const install = function(Vue) {
|
||||
}
|
||||
|
||||
if (window.Vue) {
|
||||
window['hasRole'] = hasRole
|
||||
window['hasPermi'] = hasPermi
|
||||
Vue.use(install); // eslint-disable-line
|
||||
window.hasRole = hasRole
|
||||
window.hasPermi = hasPermi
|
||||
window.dialogDrag = dialogDrag
|
||||
window.Vue.use(install)
|
||||
}
|
||||
|
||||
export default install
|
||||
|
@ -8,21 +8,21 @@ import store from '@/store'
|
||||
export default {
|
||||
inserted (el, binding, vnode) {
|
||||
const { value } = binding
|
||||
const all_permission = "*:*:*";
|
||||
const allPermission = '*:*:*'
|
||||
const permissions = store.getters && store.getters.permissions
|
||||
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const permissionFlag = value
|
||||
|
||||
const hasPermissions = permissions.some(permission => {
|
||||
return all_permission === permission || permissionFlag.includes(permission)
|
||||
return allPermission === permission || permissionFlag.includes(permission)
|
||||
})
|
||||
|
||||
if (!hasPermissions) {
|
||||
el.parentNode && el.parentNode.removeChild(el)
|
||||
}
|
||||
} else {
|
||||
throw new Error(`请设置操作权限标签值`)
|
||||
throw new Error('请设置操作权限标签值')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,21 +8,21 @@ import store from '@/store'
|
||||
export default {
|
||||
inserted (el, binding, vnode) {
|
||||
const { value } = binding
|
||||
const super_admin = "admin";
|
||||
const superAdmin = 'admin'
|
||||
const roles = store.getters && store.getters.roles
|
||||
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const roleFlag = value
|
||||
|
||||
const hasRole = roles.some(role => {
|
||||
return super_admin === role || roleFlag.includes(role)
|
||||
return superAdmin === role || roleFlag.includes(role)
|
||||
})
|
||||
|
||||
if (!hasRole) {
|
||||
el.parentNode && el.parentNode.removeChild(el)
|
||||
}
|
||||
} else {
|
||||
throw new Error(`请设置角色权限标签值"`)
|
||||
throw new Error('请设置角色权限标签值"')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {};
|
||||
return {}
|
||||
},
|
||||
render () {
|
||||
const { $route: { meta: { link } }, } = this;
|
||||
if ({ link }.link === "") {
|
||||
return "404";
|
||||
const { $route: { meta: { link } } } = this
|
||||
if ({ link }.link === '') {
|
||||
return '404'
|
||||
}
|
||||
let url = { link }.link;
|
||||
const height = document.documentElement.clientHeight - 94.5 + "px";
|
||||
const style = { height: height };
|
||||
const url = { link }.link
|
||||
const height = document.documentElement.clientHeight - 94.5 + 'px'
|
||||
const style = { height: height }
|
||||
|
||||
return (
|
||||
<div style={style}>
|
||||
@ -21,7 +21,7 @@ export default {
|
||||
scrolling="auto"
|
||||
></iframe>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -102,9 +102,9 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index';
|
||||
location.href = '/index'
|
||||
})
|
||||
}).catch(() => {});
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ export default {
|
||||
return {
|
||||
theme: this.$store.state.settings.theme,
|
||||
sideTheme: this.$store.state.settings.sideTheme
|
||||
};
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
fixedHeader: {
|
||||
@ -108,7 +108,7 @@ export default {
|
||||
value: val
|
||||
})
|
||||
if (!val) {
|
||||
this.$store.commit("SET_SIDEBAR_ROUTERS", this.$store.state.permission.defaultRoutes);
|
||||
this.$store.commit('SET_SIDEBAR_ROUTERS', this.$store.state.permission.defaultRoutes)
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -144,7 +144,7 @@ export default {
|
||||
value: val
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
themeChange (val) {
|
||||
@ -152,25 +152,25 @@ export default {
|
||||
key: 'theme',
|
||||
value: val
|
||||
})
|
||||
this.theme = val;
|
||||
this.theme = val
|
||||
},
|
||||
handleTheme (val) {
|
||||
this.$store.dispatch('settings/changeSetting', {
|
||||
key: 'sideTheme',
|
||||
value: val
|
||||
})
|
||||
this.sideTheme = val;
|
||||
this.sideTheme = val
|
||||
},
|
||||
saveSetting () {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
fullscreen: false,
|
||||
text: "正在保存到本地,请稍后...",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)"
|
||||
});
|
||||
text: '正在保存到本地,请稍后...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
localStorage.setItem(
|
||||
"layout-setting",
|
||||
'layout-setting',
|
||||
`{
|
||||
"topNav":${this.topNav},
|
||||
"tagsView":${this.tagsView},
|
||||
@ -180,19 +180,19 @@ export default {
|
||||
"sideTheme":"${this.sideTheme}",
|
||||
"theme":"${this.theme}"
|
||||
}`
|
||||
);
|
||||
)
|
||||
setTimeout(loading.close(), 1000)
|
||||
},
|
||||
resetSetting () {
|
||||
this.$loading({
|
||||
lock: true,
|
||||
fullscreen: false,
|
||||
text: "正在清除设置缓存并刷新,请稍后...",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)"
|
||||
});
|
||||
localStorage.removeItem("layout-setting")
|
||||
setTimeout("window.location.reload()", 1000)
|
||||
text: '正在清除设置缓存并刷新,请稍后...',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
localStorage.removeItem('layout-setting')
|
||||
setTimeout(window.location.reload(), 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
variables () {
|
||||
return variables;
|
||||
return variables
|
||||
},
|
||||
sideTheme () {
|
||||
return this.$store.state.settings.sideTheme
|
||||
|
@ -57,7 +57,7 @@ export default {
|
||||
methods: {
|
||||
hasOneShowingChild (children = [], parent) {
|
||||
if (!children) {
|
||||
children = [];
|
||||
children = []
|
||||
}
|
||||
const showingChildren = children.filter(item => {
|
||||
if (item.hidden) {
|
||||
|
@ -24,34 +24,34 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapState } from "vuex";
|
||||
import Logo from "./Logo";
|
||||
import SidebarItem from "./SidebarItem";
|
||||
import variables from "@/assets/styles/variables.scss";
|
||||
import { mapGetters, mapState } from 'vuex'
|
||||
import Logo from './Logo'
|
||||
import SidebarItem from './SidebarItem'
|
||||
import variables from '@/assets/styles/variables.scss'
|
||||
|
||||
export default {
|
||||
components: { SidebarItem, Logo },
|
||||
computed: {
|
||||
...mapState(["settings"]),
|
||||
...mapGetters(["sidebarRouters", "sidebar"]),
|
||||
...mapState(['settings']),
|
||||
...mapGetters(['sidebarRouters', 'sidebar']),
|
||||
activeMenu () {
|
||||
const route = this.$route;
|
||||
const { meta, path } = route;
|
||||
const route = this.$route
|
||||
const { meta, path } = route
|
||||
// if set path, the sidebar will highlight the path you set
|
||||
if (meta.activeMenu) {
|
||||
return meta.activeMenu;
|
||||
return meta.activeMenu
|
||||
}
|
||||
return path;
|
||||
return path
|
||||
},
|
||||
showLogo () {
|
||||
return this.$store.state.settings.sidebarLogo;
|
||||
return this.$store.state.settings.sidebarLogo
|
||||
},
|
||||
variables () {
|
||||
return variables;
|
||||
return variables
|
||||
},
|
||||
isCollapse () {
|
||||
return !this.sidebar.opened;
|
||||
return !this.sidebar.opened
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -50,7 +50,7 @@ export default {
|
||||
return this.$store.state.permission.routes
|
||||
},
|
||||
theme () {
|
||||
return this.$store.state.settings.theme;
|
||||
return this.$store.state.settings.theme
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@ -75,11 +75,11 @@ export default {
|
||||
return route.path === this.$route.path
|
||||
},
|
||||
activeStyle (tag) {
|
||||
if (!this.isActive(tag)) return {};
|
||||
if (!this.isActive(tag)) return {}
|
||||
return {
|
||||
"background-color": this.theme,
|
||||
"border-color": this.theme
|
||||
};
|
||||
'background-color': this.theme,
|
||||
'border-color': this.theme
|
||||
}
|
||||
},
|
||||
isAffix (tag) {
|
||||
return tag.meta && tag.meta.affix
|
||||
@ -168,7 +168,7 @@ export default {
|
||||
})
|
||||
},
|
||||
closeOthersTags () {
|
||||
this.$router.push(this.selectedTag).catch(()=>{});
|
||||
this.$router.push(this.selectedTag).catch(() => {})
|
||||
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
|
||||
this.moveToCurrentTag()
|
||||
})
|
||||
|
@ -51,7 +51,7 @@ export default {
|
||||
}
|
||||
},
|
||||
variables () {
|
||||
return variables;
|
||||
return variables
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -14,18 +14,18 @@ import directive from './directive' //directive
|
||||
|
||||
import './assets/icons' // icon
|
||||
import './permission' // permission control
|
||||
import { getDicts } from "@/api/system/dict/data";
|
||||
import { getConfigKey } from "@/api/system/config";
|
||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
|
||||
import Pagination from "@/components/Pagination";
|
||||
import { getDicts } from '@/api/system/dict/data'
|
||||
import { getConfigKey } from '@/api/system/config'
|
||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from '@/utils/ruoyi'
|
||||
import Pagination from '@/components/Pagination'
|
||||
// 自定义表格工具组件
|
||||
import RightToolbar from "@/components/RightToolbar"
|
||||
import RightToolbar from '@/components/RightToolbar'
|
||||
// 富文本组件
|
||||
import Editor from "@/components/Editor"
|
||||
import Editor from '@/components/Editor'
|
||||
// 文件上传组件
|
||||
import FileUpload from "@/components/FileUpload"
|
||||
import FileUpload from '@/components/FileUpload'
|
||||
// 图片上传组件
|
||||
import ImageUpload from "@/components/ImageUpload"
|
||||
import ImageUpload from '@/components/ImageUpload'
|
||||
// 字典标签组件
|
||||
import DictTag from '@/components/DictTag'
|
||||
// 头部标签组件
|
||||
@ -43,15 +43,15 @@ Vue.prototype.download = download
|
||||
Vue.prototype.handleTree = handleTree
|
||||
|
||||
Vue.prototype.msgSuccess = function (msg) {
|
||||
this.$message({ showClose: true, message: msg, type: "success" });
|
||||
this.$message({ showClose: true, message: msg, type: 'success' })
|
||||
}
|
||||
|
||||
Vue.prototype.msgError = function (msg) {
|
||||
this.$message({ showClose: true, message: msg, type: "error" });
|
||||
this.$message({ showClose: true, message: msg, type: 'error' })
|
||||
}
|
||||
|
||||
Vue.prototype.msgInfo = function (msg) {
|
||||
this.$message.info(msg);
|
||||
this.$message.info(msg)
|
||||
}
|
||||
|
||||
// 全局组件挂载
|
||||
@ -80,6 +80,7 @@ Vue.use(Element, {
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
// eslint-disable-next-line no-new
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
|
@ -1,11 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
/* Layout */
|
||||
import Layout from '@/layout'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
/**
|
||||
* Note: 路由配置项
|
||||
*
|
||||
|
@ -13,6 +13,6 @@ const getters = {
|
||||
permission_routes: state => state.permission.routes,
|
||||
topbarRouters: state => state.permission.topbarRouters,
|
||||
defaultRoutes: state => state.permission.defaultRoutes,
|
||||
sidebarRouters:state => state.permission.sidebarRouters,
|
||||
sidebarRouters: state => state.permission.sidebarRouters
|
||||
}
|
||||
export default getters
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { constantRoutes } from '@/router'
|
||||
import { getRouters } from '@/api/menu'
|
||||
import Layout from '@/layout/index'
|
||||
import ParentView from '@/components/ParentView';
|
||||
import ParentView from '@/components/ParentView'
|
||||
import InnerLink from '@/layout/components/InnerLink'
|
||||
|
||||
const permission = {
|
||||
@ -26,11 +26,11 @@ const permission = {
|
||||
path: 'index',
|
||||
meta: { title: '统计报表', icon: 'dashboard' }
|
||||
}]
|
||||
state.topbarRouters = routes.concat(index);
|
||||
state.topbarRouters = routes.concat(index)
|
||||
},
|
||||
SET_SIDEBAR_ROUTERS: (state, routes) => {
|
||||
state.sidebarRouters = routes
|
||||
},
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
// 生成路由
|
||||
@ -72,18 +72,18 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
||||
route.component = loadView(route.component)
|
||||
}
|
||||
}
|
||||
if (route.children != null && route.children && route.children.length) {
|
||||
if (route.children !== null && route.children && route.children.length) {
|
||||
route.children = filterAsyncRouter(route.children, route, type)
|
||||
} else {
|
||||
delete route['children']
|
||||
delete route['redirect']
|
||||
delete route.children
|
||||
delete route.redirect
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
function filterChildren (childrenMap, lastRouter = false) {
|
||||
var children = []
|
||||
let children = []
|
||||
childrenMap.forEach((el, index) => {
|
||||
if (el.children && el.children.length) {
|
||||
if (el.component === 'ParentView') {
|
||||
|
@ -17,18 +17,18 @@ const state = {
|
||||
}
|
||||
const mutations = {
|
||||
CHANGE_SETTING: (state, { key, value }) => {
|
||||
if (state.hasOwnProperty(key)) {
|
||||
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
||||
state[key] = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
// 修改布局设置
|
||||
// <EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
changeSetting ({ commit }, data) {
|
||||
commit('CHANGE_SETTING', data)
|
||||
},
|
||||
// 设置网页标题
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
setTitle ({ commit }, title) {
|
||||
state.title = title
|
||||
}
|
||||
@ -40,4 +40,3 @@ export default {
|
||||
mutations,
|
||||
actions
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ const user = {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar;
|
||||
const avatar = user.avatar === '' ? require('@/assets/images/profile.jpg') : process.env.VUE_APP_BASE_API + user.avatar
|
||||
if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
|
@ -1,6 +1,6 @@
|
||||
export default {
|
||||
'401': '认证失败,无法访问系统资源',
|
||||
'403': '当前操作没有权限',
|
||||
'404': '访问资源不存在',
|
||||
'default': '系统未知错误,请反馈给管理员'
|
||||
401: '认证失败,无法访问系统资源',
|
||||
403: '当前操作没有权限',
|
||||
404: '访问资源不存在',
|
||||
default: '系统未知错误,请反馈给管理员'
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ const layouts = {
|
||||
const tags = {
|
||||
'el-button': el => {
|
||||
const {
|
||||
tag, disabled
|
||||
disabled
|
||||
} = attrBuilder(el)
|
||||
const type = el.type ? `type="${el.type}"` : ''
|
||||
const icon = el.icon ? `icon="${el.icon}"` : ''
|
||||
@ -241,7 +241,6 @@ const tags = {
|
||||
},
|
||||
'el-rate': el => {
|
||||
const { disabled, vModel } = attrBuilder(el)
|
||||
const max = el.max ? `:max='${el.max}'` : ''
|
||||
const allowHalf = el['allow-half'] ? 'allow-half' : ''
|
||||
const showText = el['show-text'] ? 'show-text' : ''
|
||||
const showScore = el['show-score'] ? 'show-score' : ''
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { isArray } from 'util'
|
||||
import { exportDefault, titleCase } from '@/utils/index'
|
||||
import { trigger } from './config'
|
||||
|
||||
@ -13,7 +12,6 @@ const inheritAttrs = {
|
||||
dialog: 'inheritAttrs: false,'
|
||||
}
|
||||
|
||||
|
||||
export function makeUpJs (conf, type) {
|
||||
confGlobal = conf = JSON.parse(JSON.stringify(conf))
|
||||
const dataList = []
|
||||
@ -77,9 +75,10 @@ function buildAttributes(el, dataList, ruleList, optionsList, methodList, propsL
|
||||
}
|
||||
|
||||
function mixinMethod (type) {
|
||||
const list = []; const
|
||||
minxins = {
|
||||
file: confGlobal.formBtns ? {
|
||||
const list = []
|
||||
const minxins = {
|
||||
file: confGlobal.formBtns
|
||||
? ({
|
||||
submitForm: `submitForm() {
|
||||
this.$refs['${confGlobal.formRef}'].validate(valid => {
|
||||
if(!valid) return
|
||||
@ -89,7 +88,8 @@ function mixinMethod(type) {
|
||||
resetForm: `resetForm() {
|
||||
this.$refs['${confGlobal.formRef}'].resetFields()
|
||||
},`
|
||||
} : null,
|
||||
})
|
||||
: null,
|
||||
dialog: {
|
||||
onOpen: 'onOpen() {},',
|
||||
onClose: `onClose() {
|
||||
@ -133,14 +133,15 @@ function buildRules(conf, ruleList) {
|
||||
const rules = []
|
||||
if (trigger[conf.tag]) {
|
||||
if (conf.required) {
|
||||
const type = isArray(conf.defaultValue) ? 'type: \'array\',' : ''
|
||||
let message = isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder
|
||||
const type = Array.isArray(conf.defaultValue) ? 'type: \'array\',' : ''
|
||||
let message = Array.isArray(conf.defaultValue) ? `请至少选择一个${conf.vModel}` : conf.placeholder
|
||||
if (message === undefined) message = `${conf.label}不能为空`
|
||||
rules.push(`{ required: true, ${type} message: '${message}', trigger: '${trigger[conf.tag]}' }`)
|
||||
}
|
||||
if (conf.regList && isArray(conf.regList)) {
|
||||
if (conf.regList && Array.isArray(conf.regList)) {
|
||||
conf.regList.forEach(item => {
|
||||
if (item.pattern) {
|
||||
// eslint-disable-next-line no-eval
|
||||
rules.push(`{ pattern: ${eval(item.pattern)}, message: '${item.message}', trigger: '${trigger[conf.tag]}' }`)
|
||||
}
|
||||
})
|
||||
@ -151,7 +152,9 @@ function buildRules(conf, ruleList) {
|
||||
|
||||
function buildOptions (conf, optionsList) {
|
||||
if (conf.vModel === undefined) return
|
||||
if (conf.dataType === 'dynamic') { conf.options = [] }
|
||||
if (conf.dataType === 'dynamic') {
|
||||
conf.options = []
|
||||
}
|
||||
const str = `${conf.vModel}Options: ${JSON.stringify(conf.options)},`
|
||||
optionsList.push(str)
|
||||
}
|
||||
@ -167,8 +170,10 @@ function buildProps(conf, propsList) {
|
||||
}
|
||||
|
||||
function buildBeforeUpload (conf) {
|
||||
const unitNum = units[conf.sizeUnit]; let rightSizeCode = ''; let acceptCode = ''; const
|
||||
returnList = []
|
||||
const unitNum = units[conf.sizeUnit]
|
||||
let rightSizeCode = ''
|
||||
let acceptCode = ''
|
||||
const returnList = []
|
||||
if (conf.fileSize) {
|
||||
rightSizeCode = `let isRightSize = file.size / ${unitNum} < ${conf.fileSize}
|
||||
if(!isRightSize){
|
||||
|
@ -2,19 +2,19 @@ import { makeMap } from '@/utils/index'
|
||||
|
||||
// 参考https://github.com/vuejs/vue/blob/v2.6.10/src/platforms/web/server/util.js
|
||||
const isAttr = makeMap(
|
||||
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,'
|
||||
+ 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,'
|
||||
+ 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,'
|
||||
+ 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,'
|
||||
+ 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,'
|
||||
+ 'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,'
|
||||
+ 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,'
|
||||
+ 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,'
|
||||
+ 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,'
|
||||
+ 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,'
|
||||
+ 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,'
|
||||
+ 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,'
|
||||
+ 'target,title,type,usemap,value,width,wrap'
|
||||
'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
|
||||
'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
|
||||
'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
|
||||
'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
|
||||
'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
|
||||
'form,formaction,headers,height,hidden,high,href,hreflang,http-equiv,' +
|
||||
'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
|
||||
'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
|
||||
'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
|
||||
'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
|
||||
'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
|
||||
'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
|
||||
'target,title,type,usemap,value,width,wrap'
|
||||
)
|
||||
|
||||
function vModel (self, dataObject, defaultValue) {
|
||||
@ -29,7 +29,7 @@ const componentChild = {
|
||||
'el-button': {
|
||||
default (h, conf, key) {
|
||||
return conf[key]
|
||||
},
|
||||
}
|
||||
},
|
||||
'el-input': {
|
||||
prepend (h, conf, key) {
|
||||
|
@ -4,14 +4,14 @@ import { parseTime } from './ruoyi'
|
||||
* 表格时间格式化
|
||||
*/
|
||||
export function formatDate (cellValue) {
|
||||
if (cellValue == null || cellValue == "") return "";
|
||||
var date = new Date(cellValue)
|
||||
var year = date.getFullYear()
|
||||
var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
||||
var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
||||
var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
|
||||
var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
||||
var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
||||
if (cellValue === null || cellValue === '') return ''
|
||||
const date = new Date(cellValue)
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
|
||||
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
|
||||
const hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
|
||||
const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
|
||||
const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
||||
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ export function formatTime(time, option) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
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 obj = {}
|
||||
const reg = /([^?&=]+)=([^?&=]*)/g
|
||||
@ -84,7 +84,7 @@ export function getQueryObject(url) {
|
||||
export function byteLength (str) {
|
||||
// returns the byte length of an utf8 string
|
||||
let s = str.length
|
||||
for (var i = str.length - 1; i >= 0; i--) {
|
||||
for (let i = str.length - 1; i >= 0; i--) {
|
||||
const code = str.charCodeAt(i)
|
||||
if (code > 0x7f && code <= 0x7ff) s++
|
||||
else if (code > 0x7ff && code <= 0xffff) s += 2
|
||||
@ -387,4 +387,3 @@ export function camelCase(str) {
|
||||
export function isNumberStr (str) {
|
||||
return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
|
||||
}
|
||||
|
||||
|
@ -27,4 +27,3 @@ export function decrypt(txt) {
|
||||
encryptor.setPrivateKey(privateKey) // 设置私钥
|
||||
return encryptor.decrypt(txt) // 对数据进行解密
|
||||
}
|
||||
|
||||
|
@ -9,10 +9,10 @@ export function checkPermi(value) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const permissions = store.getters && store.getters.permissions
|
||||
const permissionDatas = value
|
||||
const all_permission = "*:*:*";
|
||||
const allPermission = '*:*:*'
|
||||
|
||||
const hasPermission = permissions.some(permission => {
|
||||
return all_permission === permission || permissionDatas.includes(permission)
|
||||
return allPermission === permission || permissionDatas.includes(permission)
|
||||
})
|
||||
|
||||
if (!hasPermission) {
|
||||
@ -20,7 +20,7 @@ export function checkPermi(value) {
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
console.error(`need roles! Like checkPermi="['system:user:add','system:user:edit']"`)
|
||||
console.error('need roles! Like checkPermi="[\'system:user:add\',\'system:user:edit\']"')
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -34,10 +34,10 @@ export function checkRole(value) {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const roles = store.getters && store.getters.roles
|
||||
const permissionRoles = value
|
||||
const super_admin = "admin";
|
||||
const superAdmin = 'admin'
|
||||
|
||||
const hasRole = roles.some(role => {
|
||||
return super_admin === role || permissionRoles.includes(role)
|
||||
return superAdmin === role || permissionRoles.includes(role)
|
||||
})
|
||||
|
||||
if (!hasRole) {
|
||||
@ -45,7 +45,7 @@ export function checkRole(value) {
|
||||
}
|
||||
return true
|
||||
} else {
|
||||
console.error(`need roles! Like checkRole="['admin','editor']"`)
|
||||
console.error('need roles! Like checkRole="[\'admin\',\'editor\']"')
|
||||
return false
|
||||
}
|
||||
}
|
@ -17,31 +17,31 @@ service.interceptors.request.use(config => {
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
if (getToken() && !isToken) {
|
||||
config.headers['Authorization'] = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
config.headers.Authorization = 'Bearer ' + getToken() // 让每个请求携带自定义token 请根据实际情况自行修改
|
||||
}
|
||||
// get请求映射params参数
|
||||
if (config.method === 'get' && config.params) {
|
||||
let url = config.url + '?';
|
||||
let url = config.url + '?'
|
||||
for (const propName of Object.keys(config.params)) {
|
||||
const value = config.params[propName];
|
||||
var part = encodeURIComponent(propName) + "=";
|
||||
if (value !== null && typeof(value) !== "undefined") {
|
||||
const value = config.params[propName]
|
||||
const part = encodeURIComponent(propName) + '='
|
||||
if (value !== null && typeof (value) !== 'undefined') {
|
||||
if (typeof value === 'object') {
|
||||
for (const key of Object.keys(value)) {
|
||||
if (value[key] !== null && typeof (value[key]) !== 'undefined') {
|
||||
let params = propName + '[' + key + ']';
|
||||
let subPart = encodeURIComponent(params) + '=';
|
||||
url += subPart + encodeURIComponent(value[key]) + '&';
|
||||
const params = propName + '[' + key + ']'
|
||||
const subPart = encodeURIComponent(params) + '='
|
||||
url += subPart + encodeURIComponent(value[key]) + '&'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
url += part + encodeURIComponent(value) + "&";
|
||||
url += part + encodeURIComponent(value) + '&'
|
||||
}
|
||||
}
|
||||
}
|
||||
url = url.slice(0, -1);
|
||||
config.params = {};
|
||||
config.url = url;
|
||||
url = url.slice(0, -1)
|
||||
config.params = {}
|
||||
config.url = url
|
||||
}
|
||||
return config
|
||||
}, error => {
|
||||
@ -52,9 +52,9 @@ service.interceptors.request.use(config => {
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(res => {
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
const code = res.data.code || 200
|
||||
// 获取错误信息
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
const msg = errorCode[code] || res.data.msg || errorCode.default
|
||||
if (code === 401) {
|
||||
MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
|
||||
confirmButtonText: '重新登录',
|
||||
@ -63,10 +63,10 @@ service.interceptors.response.use(res => {
|
||||
}
|
||||
).then(() => {
|
||||
store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index';
|
||||
location.href = '/index'
|
||||
})
|
||||
}).catch(() => {});
|
||||
return Promise.reject('令牌验证失败')
|
||||
}).catch(() => {})
|
||||
return Promise.reject(new Error('令牌验证失败'))
|
||||
} else if (code === 500) {
|
||||
Message({
|
||||
message: msg,
|
||||
@ -77,22 +77,20 @@ service.interceptors.response.use(res => {
|
||||
Notification.error({
|
||||
title: msg
|
||||
})
|
||||
return Promise.reject('error')
|
||||
return Promise.reject(new Error('error'))
|
||||
} else {
|
||||
return res.data
|
||||
}
|
||||
},
|
||||
error => {
|
||||
console.log('err' + error)
|
||||
let { message } = error;
|
||||
if (message == "Network Error") {
|
||||
message = "后端接口连接异常";
|
||||
}
|
||||
else if (message.includes("timeout")) {
|
||||
message = "系统接口请求超时";
|
||||
}
|
||||
else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
let { message } = error
|
||||
if (message === 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
Message({
|
||||
message: message,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
* 通用js方法封装处理
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
@ -18,7 +18,7 @@ export function parseTime(time, pattern) {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
} else if (typeof time === 'string') {
|
||||
time = time.replace(new RegExp(/-/gm), '/');
|
||||
time = time.replace(/-/gm, '/')
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
@ -34,7 +34,7 @@ export function parseTime(time, pattern) {
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
const timeStr = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
||||
@ -43,83 +43,86 @@ export function parseTime(time, pattern) {
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
return timeStr
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
export function resetForm (refName) {
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields();
|
||||
this.$refs[refName].resetFields()
|
||||
}
|
||||
}
|
||||
|
||||
// 添加日期范围
|
||||
export function addDateRange (params, dateRange, propName) {
|
||||
let search = params;
|
||||
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {};
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : [];
|
||||
const search = params
|
||||
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : []
|
||||
if (typeof (propName) === 'undefined') {
|
||||
search.params['beginTime'] = dateRange[0];
|
||||
search.params['endTime'] = dateRange[1];
|
||||
search.params.beginTime = dateRange[0]
|
||||
search.params.endTime = dateRange[1]
|
||||
} else {
|
||||
search.params['begin' + propName] = dateRange[0];
|
||||
search.params['end' + propName] = dateRange[1];
|
||||
search.params['begin' + propName] = dateRange[0]
|
||||
search.params['end' + propName] = dateRange[1]
|
||||
}
|
||||
return search;
|
||||
return search
|
||||
}
|
||||
|
||||
// 回显数据字典
|
||||
export function selectDictLabel (datas, value) {
|
||||
var actions = [];
|
||||
const actions = []
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].dictValue == ('' + value)) {
|
||||
actions.push(datas[key].dictLabel);
|
||||
return true;
|
||||
if (datas[key].dictValue === ('' + value)) {
|
||||
actions.push(datas[key].dictLabel)
|
||||
return true
|
||||
}
|
||||
return undefined
|
||||
})
|
||||
return actions.join('');
|
||||
return actions.join('')
|
||||
}
|
||||
|
||||
// 回显数据字典(字符串数组)
|
||||
export function selectDictLabels (datas, value, separator) {
|
||||
var actions = [];
|
||||
var currentSeparator = undefined === separator ? "," : separator;
|
||||
var temp = value.split(currentSeparator);
|
||||
const actions = []
|
||||
const currentSeparator = undefined === separator ? ',' : separator
|
||||
const temp = value.split(currentSeparator)
|
||||
Object.keys(value.split(currentSeparator)).some((val) => {
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].dictValue == ('' + temp[val])) {
|
||||
actions.push(datas[key].dictLabel + currentSeparator);
|
||||
if (datas[key].dictValue === ('' + temp[val])) {
|
||||
actions.push(datas[key].dictLabel + currentSeparator)
|
||||
}
|
||||
return undefined
|
||||
})
|
||||
return undefined
|
||||
})
|
||||
return actions.join('').substring(0, actions.join('').length - 1);
|
||||
return actions.join('').substring(0, actions.join('').length - 1)
|
||||
}
|
||||
|
||||
// 通用下载方法
|
||||
export function download (fileName) {
|
||||
window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
|
||||
window.location.href = baseURL + '/common/download?fileName=' + encodeURI(fileName) + '&delete=' + true
|
||||
}
|
||||
|
||||
// 字符串格式化(%s )
|
||||
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 () {
|
||||
var arg = args[i++];
|
||||
const arg = args[i++]
|
||||
if (typeof arg === 'undefined') {
|
||||
flag = false;
|
||||
return '';
|
||||
flag = false
|
||||
return ''
|
||||
}
|
||||
return arg;
|
||||
});
|
||||
return flag ? str : '';
|
||||
return arg
|
||||
})
|
||||
return flag ? str : ''
|
||||
}
|
||||
|
||||
// 转换字符串,undefined,null等转化为""
|
||||
export function praseStrEmpty (str) {
|
||||
if (!str || str == "undefined" || str == "null") {
|
||||
return "";
|
||||
if (!str || str === 'undefined' || str === 'null') {
|
||||
return ''
|
||||
}
|
||||
return str;
|
||||
return str
|
||||
}
|
||||
|
||||
/**
|
||||
@ -130,45 +133,45 @@ export function praseStrEmpty(str) {
|
||||
* @param {*} children 孩子节点字段 默认 'children'
|
||||
*/
|
||||
export function handleTree (data, id, parentId, children) {
|
||||
let config = {
|
||||
const config = {
|
||||
id: id || 'id',
|
||||
parentId: parentId || 'parentId',
|
||||
childrenList: children || 'children'
|
||||
};
|
||||
|
||||
var childrenListMap = {};
|
||||
var nodeIds = {};
|
||||
var tree = [];
|
||||
|
||||
for (let d of data) {
|
||||
let parentId = d[config.parentId];
|
||||
if (childrenListMap[parentId] == null) {
|
||||
childrenListMap[parentId] = [];
|
||||
}
|
||||
nodeIds[d[config.id]] = d;
|
||||
childrenListMap[parentId].push(d);
|
||||
}
|
||||
|
||||
for (let d of data) {
|
||||
let parentId = d[config.parentId];
|
||||
if (nodeIds[parentId] == null) {
|
||||
tree.push(d);
|
||||
const childrenListMap = {}
|
||||
const nodeIds = {}
|
||||
const tree = []
|
||||
|
||||
for (const d of data) {
|
||||
const parentId = d[config.parentId]
|
||||
if (childrenListMap[parentId] === null) {
|
||||
childrenListMap[parentId] = []
|
||||
}
|
||||
nodeIds[d[config.id]] = d
|
||||
childrenListMap[parentId].push(d)
|
||||
}
|
||||
|
||||
for (const d of data) {
|
||||
const parentId = d[config.parentId]
|
||||
if (nodeIds[parentId] === null) {
|
||||
tree.push(d)
|
||||
}
|
||||
}
|
||||
|
||||
for (let t of tree) {
|
||||
adaptToChildrenList(t);
|
||||
for (const t of tree) {
|
||||
adaptToChildrenList(t)
|
||||
}
|
||||
|
||||
function adaptToChildrenList (o) {
|
||||
if (childrenListMap[o[config.id]] !== null) {
|
||||
o[config.childrenList] = childrenListMap[o[config.id]];
|
||||
o[config.childrenList] = childrenListMap[o[config.id]]
|
||||
}
|
||||
if (o[config.childrenList]) {
|
||||
for (let c of o[config.childrenList]) {
|
||||
adaptToChildrenList(c);
|
||||
for (const c of o[config.childrenList]) {
|
||||
adaptToChildrenList(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
return tree
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ Math.easeInOutQuad = function(t, b, c, d) {
|
||||
}
|
||||
|
||||
// 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) }
|
||||
})()
|
||||
|
||||
@ -37,11 +37,11 @@ export function scrollTo(to, duration, callback) {
|
||||
const increment = 20
|
||||
let currentTime = 0
|
||||
duration = (typeof (duration) === 'undefined') ? 500 : duration
|
||||
var animateScroll = function() {
|
||||
const animateScroll = function () {
|
||||
// increment the time
|
||||
currentTime += increment
|
||||
// find the value with the quadratic in-out easing function
|
||||
var val = Math.easeInOutQuad(currentTime, start, change, duration)
|
||||
const val = Math.easeInOutQuad(currentTime, start, change, duration)
|
||||
// move the document.body
|
||||
move(val)
|
||||
// do the animation unless its over
|
||||
|
@ -11,8 +11,8 @@ export function isExternal(path) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function validUsername (str) {
|
||||
const valid_map = ['admin', 'editor']
|
||||
return valid_map.indexOf(str.trim()) >= 0
|
||||
const validMap = ['admin', 'editor']
|
||||
return validMap.indexOf(str.trim()) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,7 +56,7 @@ export function validAlphabets(str) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export function validEmail (email) {
|
||||
const reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
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)
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,12 @@ const mimeMap = {
|
||||
|
||||
const baseUrl = process.env.VUE_APP_BASE_API
|
||||
export function downLoadZip (str, filename) {
|
||||
var url = baseUrl + str
|
||||
const url = baseUrl + str
|
||||
axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
headers: { Authorization: 'Bearer ' + getToken() }
|
||||
}).then(res => {
|
||||
resolveBlob(res, mimeMap.zip)
|
||||
})
|
||||
@ -25,18 +25,18 @@ export function downLoadZip(str, filename) {
|
||||
*/
|
||||
export function resolveBlob (res, mimeType) {
|
||||
const aLink = document.createElement('a')
|
||||
var blob = new Blob([res.data], { type: mimeType })
|
||||
const blob = new Blob([res.data], { type: mimeType })
|
||||
// //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
|
||||
var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
||||
var contentDisposition = decodeURI(res.headers['content-disposition'])
|
||||
var result = patt.exec(contentDisposition)
|
||||
var fileName = result[1]
|
||||
fileName = fileName.replace(/\"/g, '')
|
||||
const patt = /filename=([^;]+\\.[^\\.;]+);*/
|
||||
const contentDisposition = decodeURI(res.headers['content-disposition'])
|
||||
const result = patt.exec(contentDisposition)
|
||||
let fileName = result[1]
|
||||
fileName = fileName.replace(/"/g, '')
|
||||
aLink.style.display = 'none'
|
||||
aLink.href = URL.createObjectURL(blob)
|
||||
aLink.setAttribute('download', fileName) // 设置下载文件名称
|
||||
document.body.appendChild(aLink)
|
||||
aLink.click()
|
||||
URL.revokeObjectURL(aLink.href);//清除引用
|
||||
document.body.removeChild(aLink);
|
||||
URL.revokeObjectURL(aLink.href)// 清除引用
|
||||
document.body.removeChild(aLink)
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import echarts from 'echarts' // echarts theme
|
||||
import resize from './mixins/resize'
|
||||
require('echarts/theme/macarons')
|
||||
|
||||
const animationDuration = 6000
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import echarts from 'echarts' // echarts theme
|
||||
import resize from './mixins/resize'
|
||||
require('echarts/theme/macarons')
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
@ -93,7 +93,8 @@ export default {
|
||||
data: ['expected', 'actual']
|
||||
},
|
||||
series: [{
|
||||
name: 'expected', itemStyle: {
|
||||
name: 'expected',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#FF005A',
|
||||
lineStyle: {
|
||||
|
@ -3,9 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import echarts from 'echarts' // echarts theme
|
||||
import resize from './mixins/resize'
|
||||
require('echarts/theme/macarons')
|
||||
|
||||
export default {
|
||||
mixins: [resize],
|
||||
|
@ -3,9 +3,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import echarts from 'echarts' // echarts theme
|
||||
import resize from './mixins/resize'
|
||||
require('echarts/theme/macarons')
|
||||
|
||||
const animationDuration = 3000
|
||||
|
||||
|
@ -601,19 +601,19 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "Index",
|
||||
name: 'Index',
|
||||
data () {
|
||||
return {
|
||||
// 版本号
|
||||
version: "3.6.0",
|
||||
};
|
||||
version: '3.6.0'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goTarget (href) {
|
||||
window.open(href, "_blank");
|
||||
},
|
||||
},
|
||||
};
|
||||
window.open(href, '_blank')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -679,4 +679,3 @@ export default {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -57,31 +57,31 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { getCodeImg } from '@/api/login'
|
||||
import Cookies from 'js-cookie'
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
name: 'Login',
|
||||
data () {
|
||||
return {
|
||||
codeUrl: "",
|
||||
cookiePassword: "",
|
||||
codeUrl: '',
|
||||
cookiePassword: '',
|
||||
loginForm: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
username: 'admin',
|
||||
password: 'admin123',
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
code: '',
|
||||
uuid: ''
|
||||
},
|
||||
loginRules: {
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
||||
{ required: true, trigger: 'blur', message: '请输入您的账号' }
|
||||
],
|
||||
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,
|
||||
// 验证码开关
|
||||
@ -89,66 +89,66 @@ export default {
|
||||
// 注册开关
|
||||
register: false,
|
||||
redirect: undefined
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler: function (route) {
|
||||
this.redirect = route.query && route.query.redirect;
|
||||
this.redirect = route.query && route.query.redirect
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getCode();
|
||||
this.getCookie();
|
||||
this.getCode()
|
||||
this.getCookie()
|
||||
},
|
||||
methods: {
|
||||
getCode () {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff
|
||||
if (this.captchaOnOff) {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.loginForm.uuid = res.uuid;
|
||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||
this.loginForm.uuid = res.uuid
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getCookie () {
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const username = Cookies.get('username')
|
||||
const password = Cookies.get('password')
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm = {
|
||||
username: username === undefined ? this.loginForm.username : username,
|
||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
};
|
||||
}
|
||||
},
|
||||
handleLogin () {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
||||
Cookies.set('username', this.loginForm.username, { expires: 30 })
|
||||
Cookies.set('password', encrypt(this.loginForm.password), { expires: 30 })
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 })
|
||||
} else {
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove('rememberMe');
|
||||
Cookies.remove('username')
|
||||
Cookies.remove('password')
|
||||
Cookies.remove('rememberMe')
|
||||
}
|
||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
||||
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||
this.$router.push({ path: this.redirect || '/' }).catch(() => {})
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.loading = false
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
this.getCode()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
|
84
ruoyi-ui/src/views/monitor/cache/index.vue
vendored
84
ruoyi-ui/src/views/monitor/cache/index.vue
vendored
@ -11,7 +11,7 @@
|
||||
<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">运行模式</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" v-if="cache.info">{{ cache.info.tcp_port }}</div></td>
|
||||
<td><div class="cell">客户端数</div></td>
|
||||
@ -29,7 +29,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<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" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td>
|
||||
<td><div class="cell">Key数量</div></td>
|
||||
@ -67,11 +67,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCache } from "@/api/monitor/cache";
|
||||
import echarts from "echarts";
|
||||
import { getCache } from '@/api/monitor/cache'
|
||||
import echarts from 'echarts'
|
||||
|
||||
export default {
|
||||
name: "Server",
|
||||
name: 'Server',
|
||||
data () {
|
||||
return {
|
||||
// 加载层信息
|
||||
@ -81,73 +81,73 @@ export default {
|
||||
// 使用内存
|
||||
usedmemory: null,
|
||||
// cache信息
|
||||
cache: [],
|
||||
};
|
||||
cache: []
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.openLoading();
|
||||
this.getList()
|
||||
this.openLoading()
|
||||
},
|
||||
methods: {
|
||||
/** 查缓存询信息 */
|
||||
getList () {
|
||||
getCache().then((response) => {
|
||||
this.cache = response.data;
|
||||
this.loading.close();
|
||||
this.cache = response.data
|
||||
this.loading.close()
|
||||
|
||||
this.commandstats = echarts.init(this.$refs.commandstats, "macarons");
|
||||
this.commandstats = echarts.init(this.$refs.commandstats, 'macarons')
|
||||
this.commandstats.setOption({
|
||||
tooltip: {
|
||||
trigger: "item",
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)",
|
||||
trigger: 'item',
|
||||
formatter: '{a} <br/>{b} : {c} ({d}%)'
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "命令",
|
||||
type: "pie",
|
||||
roseType: "radius",
|
||||
name: '命令',
|
||||
type: 'pie',
|
||||
roseType: 'radius',
|
||||
radius: [15, 95],
|
||||
center: ["50%", "38%"],
|
||||
center: ['50%', '38%'],
|
||||
data: response.data.commandStats,
|
||||
animationEasing: "cubicInOut",
|
||||
animationDuration: 1000,
|
||||
},
|
||||
],
|
||||
});
|
||||
this.usedmemory = echarts.init(this.$refs.usedmemory, "macarons");
|
||||
animationEasing: 'cubicInOut',
|
||||
animationDuration: 1000
|
||||
}
|
||||
]
|
||||
})
|
||||
this.usedmemory = echarts.init(this.$refs.usedmemory, 'macarons')
|
||||
this.usedmemory.setOption({
|
||||
tooltip: {
|
||||
formatter: "{b} <br/>{a} : " + this.cache.info.used_memory_human,
|
||||
formatter: '{b} <br/>{a} : ' + this.cache.info.used_memory_human
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "峰值",
|
||||
type: "gauge",
|
||||
name: '峰值',
|
||||
type: 'gauge',
|
||||
min: 0,
|
||||
max: 1000,
|
||||
detail: {
|
||||
formatter: this.cache.info.used_memory_human,
|
||||
formatter: this.cache.info.used_memory_human
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: parseFloat(this.cache.info.used_memory_human),
|
||||
name: "内存消耗",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
name: '内存消耗'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
},
|
||||
// 打开加载层
|
||||
openLoading () {
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
text: "拼命读取中",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
text: '拼命读取中',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -2,14 +2,14 @@
|
||||
<i-frame :src="url" />
|
||||
</template>
|
||||
<script>
|
||||
import iFrame from "@/components/iFrame/index";
|
||||
import iFrame from '@/components/iFrame/index'
|
||||
export default {
|
||||
name: "Druid",
|
||||
name: 'Druid',
|
||||
components: { iFrame },
|
||||
data () {
|
||||
return {
|
||||
url: process.env.VUE_APP_BASE_API + "/druid/login.html"
|
||||
};
|
||||
},
|
||||
};
|
||||
url: process.env.VUE_APP_BASE_API + '/druid/login.html'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -252,22 +252,22 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="任务状态:">
|
||||
<div v-if="form.status == 0">正常</div>
|
||||
<div v-else-if="form.status == 1">失败</div>
|
||||
<div v-if="form.status === 0">正常</div>
|
||||
<div v-else-if="form.status === 1">失败</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否并发:">
|
||||
<div v-if="form.concurrent == 0">允许</div>
|
||||
<div v-else-if="form.concurrent == 1">禁止</div>
|
||||
<div v-if="form.concurrent === 0">允许</div>
|
||||
<div v-else-if="form.concurrent === 1">禁止</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="执行策略:">
|
||||
<div v-if="form.misfirePolicy == 0">默认策略</div>
|
||||
<div v-else-if="form.misfirePolicy == 1">立即执行</div>
|
||||
<div v-else-if="form.misfirePolicy == 2">执行一次</div>
|
||||
<div v-else-if="form.misfirePolicy == 3">放弃执行</div>
|
||||
<div v-if="form.misfirePolicy === 0">默认策略</div>
|
||||
<div v-else-if="form.misfirePolicy === 1">立即执行</div>
|
||||
<div v-else-if="form.misfirePolicy === 2">执行一次</div>
|
||||
<div v-else-if="form.misfirePolicy === 3">放弃执行</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -280,10 +280,10 @@
|
||||
</template>
|
||||
|
||||
<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 {
|
||||
name: "Job",
|
||||
name: 'Job',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -303,7 +303,7 @@ export default {
|
||||
// 定时任务表格数据
|
||||
jobList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否显示详细弹出层
|
||||
@ -325,48 +325,48 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
jobName: [
|
||||
{ required: true, message: "任务名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '任务名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
invokeTarget: [
|
||||
{ required: true, message: "调用目标字符串不能为空", trigger: "blur" }
|
||||
{ required: true, message: '调用目标字符串不能为空', trigger: 'blur' }
|
||||
],
|
||||
cronExpression: [
|
||||
{ required: true, message: "cron执行表达式不能为空", trigger: "blur" }
|
||||
{ required: true, message: 'cron执行表达式不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_job_group").then(response => {
|
||||
this.jobGroupOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_job_status").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_job_group').then(response => {
|
||||
this.jobGroupOptions = response.data
|
||||
})
|
||||
this.getDicts('sys_job_status').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询定时任务列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listJob(this.queryParams).then(response => {
|
||||
this.jobList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.jobList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 任务组名字典翻译
|
||||
jobGroupFormat (row, column) {
|
||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup)
|
||||
},
|
||||
// 状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -378,146 +378,146 @@ export default {
|
||||
cronExpression: undefined,
|
||||
misfirePolicy: 1,
|
||||
concurrent: 1,
|
||||
status: "0"
|
||||
};
|
||||
this.resetForm("form");
|
||||
status: '0'
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.jobId);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
this.ids = selection.map(item => item.jobId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 更多操作触发
|
||||
handleCommand (command, row) {
|
||||
switch (command) {
|
||||
case "handleRun":
|
||||
this.handleRun(row);
|
||||
break;
|
||||
case "handleView":
|
||||
this.handleView(row);
|
||||
break;
|
||||
case "handleJobLog":
|
||||
this.handleJobLog(row);
|
||||
break;
|
||||
case 'handleRun':
|
||||
this.handleRun(row)
|
||||
break
|
||||
case 'handleView':
|
||||
this.handleView(row)
|
||||
break
|
||||
case 'handleJobLog':
|
||||
this.handleJobLog(row)
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
},
|
||||
// 任务状态修改
|
||||
handleStatusChange (row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const text = row.status === '0' ? '启用' : '停用'
|
||||
this.$confirm('确认要"' + text + '""' + row.jobName + '"任务吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return changeJobStatus(row.jobId, row.status);
|
||||
return changeJobStatus(row.jobId, row.status)
|
||||
}).then(() => {
|
||||
this.msgSuccess(text + "成功");
|
||||
this.msgSuccess(text + '成功')
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
row.status = row.status === '0' ? '1' : '0'
|
||||
})
|
||||
},
|
||||
/* 立即执行一次 */
|
||||
handleRun (row) {
|
||||
this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('确认要立即执行一次"' + row.jobName + '"任务吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return runJob(row.jobId, row.jobGroup);
|
||||
return runJob(row.jobId, row.jobGroup)
|
||||
}).then(() => {
|
||||
this.msgSuccess("执行成功");
|
||||
}).catch(() => {});
|
||||
this.msgSuccess('执行成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 任务详细信息 */
|
||||
handleView (row) {
|
||||
getJob(row.jobId).then(response => {
|
||||
this.form = response.data;
|
||||
this.openView = true;
|
||||
});
|
||||
this.form = response.data
|
||||
this.openView = true
|
||||
})
|
||||
},
|
||||
/** 任务日志列表查询 */
|
||||
handleJobLog (row) {
|
||||
const jobId = row.jobId || 0;
|
||||
const jobId = row.jobId || 0
|
||||
this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } })
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加任务";
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加任务'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
const jobId = row.jobId || this.ids;
|
||||
this.reset()
|
||||
const jobId = row.jobId || this.ids
|
||||
getJob(jobId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改任务";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改任务'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.jobId != undefined) {
|
||||
if (this.form.jobId !== undefined) {
|
||||
updateJob(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addJob(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const jobIds = row.jobId || this.ids;
|
||||
this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const jobIds = row.jobId || this.ids
|
||||
this.$confirm('是否确认删除定时任务编号为"' + jobIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delJob(jobIds);
|
||||
return delJob(jobIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm("是否确认导出所有定时任务数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有定时任务数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportJob(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportJob(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -160,12 +160,12 @@
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="执行状态:">
|
||||
<div v-if="form.status == 0">正常</div>
|
||||
<div v-else-if="form.status == 1">失败</div>
|
||||
<div v-if="form.status === 0">正常</div>
|
||||
<div v-else-if="form.status === 1">失败</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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-row>
|
||||
</el-form>
|
||||
@ -177,11 +177,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getJob} from "@/api/monitor/job";
|
||||
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from "@/api/monitor/jobLog";
|
||||
import { getJob } from '@/api/monitor/job'
|
||||
import { listJobLog, delJobLog, exportJobLog, cleanJobLog } from '@/api/monitor/jobLog'
|
||||
|
||||
export default {
|
||||
name: "JobLog",
|
||||
name: 'JobLog',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -216,113 +216,113 @@ export default {
|
||||
jobGroup: undefined,
|
||||
status: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const jobId = this.$route.query.jobId;
|
||||
if (jobId !== undefined && jobId != 0) {
|
||||
const jobId = this.$route.query.jobId
|
||||
if (jobId !== undefined && jobId !== 0) {
|
||||
getJob(jobId).then(response => {
|
||||
this.queryParams.jobName = response.data.jobName;
|
||||
this.queryParams.jobGroup = response.data.jobGroup;
|
||||
this.getList();
|
||||
});
|
||||
this.queryParams.jobName = response.data.jobName
|
||||
this.queryParams.jobGroup = response.data.jobGroup
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
this.getList();
|
||||
this.getList()
|
||||
}
|
||||
this.getDicts("sys_common_status").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_job_group").then(response => {
|
||||
this.jobGroupOptions = response.data;
|
||||
});
|
||||
this.getDicts('sys_common_status').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
this.getDicts('sys_job_group').then(response => {
|
||||
this.jobGroupOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询调度日志列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listJobLog(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.jobLogList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.jobLogList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
// 执行状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 任务组名字典翻译
|
||||
jobGroupFormat (row, column) {
|
||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup);
|
||||
return this.selectDictLabel(this.jobGroupOptions, row.jobGroup)
|
||||
},
|
||||
// 返回按钮
|
||||
handleClose () {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({ path: "/monitor/job" });
|
||||
this.$store.dispatch('tagsView/delView', this.$route)
|
||||
this.$router.push({ path: '/monitor/job' })
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.jobLogId);
|
||||
this.multiple = !selection.length;
|
||||
this.ids = selection.map(item => item.jobLogId)
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 详细按钮操作 */
|
||||
handleView (row) {
|
||||
this.open = true;
|
||||
this.form = row;
|
||||
this.open = true
|
||||
this.form = row
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const jobLogIds = this.ids;
|
||||
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const jobLogIds = this.ids
|
||||
this.$confirm('是否确认删除调度日志编号为"' + jobLogIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delJobLog(jobLogIds);
|
||||
return delJobLog(jobLogIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 清空按钮操作 */
|
||||
handleClean () {
|
||||
this.$confirm("是否确认清空所有调度日志数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认清空所有调度日志数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return cleanJobLog();
|
||||
return cleanJobLog()
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("清空成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('清空成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm("是否确认导出所有调度日志数据项?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有调度日志数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportJobLog(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportJobLog(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -119,10 +119,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, delLogininfor, cleanLogininfor, exportLogininfor } from "@/api/monitor/logininfor";
|
||||
import { list, delLogininfor, cleanLogininfor, exportLogininfor } from '@/api/monitor/logininfor'
|
||||
|
||||
export default {
|
||||
name: "Logininfor",
|
||||
name: 'Logininfor',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -153,40 +153,40 @@ export default {
|
||||
userName: undefined,
|
||||
status: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_common_status").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_common_status').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询登录日志列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.list = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
// 登录状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
||||
this.handleQuery();
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 多选框选中数据 */
|
||||
handleSelectionChange (selection) {
|
||||
@ -195,53 +195,52 @@ export default {
|
||||
},
|
||||
/** 排序触发事件 */
|
||||
handleSortChange (column, prop, order) {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
this.getList();
|
||||
this.queryParams.orderByColumn = column.prop
|
||||
this.queryParams.isAsc = column.order
|
||||
this.getList()
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const infoIds = row.infoId || this.ids;
|
||||
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const infoIds = row.infoId || this.ids
|
||||
this.$confirm('是否确认删除访问编号为"' + infoIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delLogininfor(infoIds);
|
||||
return delLogininfor(infoIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 清空按钮操作 */
|
||||
handleClean () {
|
||||
this.$confirm('是否确认清空所有登录日志数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认清空所有登录日志数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return cleanLogininfor();
|
||||
return cleanLogininfor()
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("清空成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('清空成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有操作日志数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有操作日志数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportLogininfor(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportLogininfor(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -65,10 +65,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, forceLogout } from "@/api/monitor/online";
|
||||
import { list, forceLogout } from '@/api/monitor/online'
|
||||
|
||||
export default {
|
||||
name: "Online",
|
||||
name: 'Online',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -84,45 +84,44 @@ export default {
|
||||
ipaddr: undefined,
|
||||
userName: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询登录日志列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
list(this.queryParams).then(response => {
|
||||
this.list = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.pageNum = 1;
|
||||
this.getList();
|
||||
this.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 强退按钮操作 */
|
||||
handleForceLogout (row) {
|
||||
this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认强退名称为"' + row.userName + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return forceLogout(row.tokenId);
|
||||
return forceLogout(row.tokenId)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("强退成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('强退成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -188,10 +188,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { list, delOperlog, cleanOperlog, exportOperlog } from "@/api/monitor/operlog";
|
||||
import { list, delOperlog, cleanOperlog, exportOperlog } from '@/api/monitor/operlog'
|
||||
|
||||
export default {
|
||||
name: "Operlog",
|
||||
name: 'Operlog',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -229,47 +229,47 @@ export default {
|
||||
businessType: undefined,
|
||||
status: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_oper_type").then(response => {
|
||||
this.typeOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_common_status").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_oper_type').then(response => {
|
||||
this.typeOptions = response.data
|
||||
})
|
||||
this.getDicts('sys_common_status').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询登录日志 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
list(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.list = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
// 操作日志状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 操作日志类型字典翻译
|
||||
typeFormat (row, column) {
|
||||
return this.selectDictLabel(this.typeOptions, row.businessType);
|
||||
return this.selectDictLabel(this.typeOptions, row.businessType)
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
|
||||
this.handleQuery();
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 多选框选中数据 */
|
||||
handleSelectionChange (selection) {
|
||||
@ -278,58 +278,57 @@ export default {
|
||||
},
|
||||
/** 排序触发事件 */
|
||||
handleSortChange (column, prop, order) {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
this.getList();
|
||||
this.queryParams.orderByColumn = column.prop
|
||||
this.queryParams.isAsc = column.order
|
||||
this.getList()
|
||||
},
|
||||
/** 详细按钮操作 */
|
||||
handleView (row) {
|
||||
this.open = true;
|
||||
this.form = row;
|
||||
this.open = true
|
||||
this.form = row
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const operIds = row.operId || this.ids;
|
||||
this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const operIds = row.operId || this.ids
|
||||
this.$confirm('是否确认删除日志编号为"' + operIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delOperlog(operIds);
|
||||
return delOperlog(operIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 清空按钮操作 */
|
||||
handleClean () {
|
||||
this.$confirm('是否确认清空所有操作日志数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认清空所有操作日志数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return cleanOperlog();
|
||||
return cleanOperlog()
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("清空成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('清空成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有操作日志数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有操作日志数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportOperlog(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportOperlog(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -153,7 +153,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<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.sysTypeName }}</div></td>
|
||||
<td><div class="cell">{{ sysFile.typeName }}</div></td>
|
||||
@ -172,39 +172,39 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getServer } from "@/api/monitor/server";
|
||||
import { getServer } from '@/api/monitor/server'
|
||||
|
||||
export default {
|
||||
name: "Server",
|
||||
name: 'Server',
|
||||
data () {
|
||||
return {
|
||||
// 加载层信息
|
||||
loading: [],
|
||||
// 服务器信息
|
||||
server: []
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.openLoading();
|
||||
this.getList()
|
||||
this.openLoading()
|
||||
},
|
||||
methods: {
|
||||
/** 查询服务器信息 */
|
||||
getList () {
|
||||
getServer().then(response => {
|
||||
this.server = response.data;
|
||||
this.loading.close();
|
||||
});
|
||||
this.server = response.data
|
||||
this.loading.close()
|
||||
})
|
||||
},
|
||||
// 打开加载层
|
||||
openLoading () {
|
||||
this.loading = this.$loading({
|
||||
lock: true,
|
||||
text: "拼命读取中",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)"
|
||||
});
|
||||
text: '拼命读取中',
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -67,81 +67,81 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg, register } from "@/api/login";
|
||||
import { getCodeImg, register } from '@/api/login'
|
||||
|
||||
export default {
|
||||
name: "Register",
|
||||
name: 'Register',
|
||||
data () {
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.registerForm.password !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
codeUrl: "",
|
||||
codeUrl: '',
|
||||
registerForm: {
|
||||
username: "",
|
||||
password: "",
|
||||
confirmPassword: "",
|
||||
code: "",
|
||||
uuid: ""
|
||||
username: '',
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
code: '',
|
||||
uuid: ''
|
||||
},
|
||||
registerRules: {
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
||||
{ required: true, trigger: 'blur', message: '请输入您的账号' },
|
||||
{ min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
||||
{ required: true, trigger: 'blur', message: '请输入您的密码' },
|
||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, trigger: "blur", message: "请再次输入您的密码" },
|
||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
||||
{ required: true, trigger: 'blur', message: '请再次输入您的密码' },
|
||||
{ required: true, validator: equalToPassword, trigger: 'blur' }
|
||||
],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
||||
},
|
||||
loading: false,
|
||||
captchaOnOff: true
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getCode();
|
||||
this.getCode()
|
||||
},
|
||||
methods: {
|
||||
getCode () {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
||||
this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff
|
||||
if (this.captchaOnOff) {
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.registerForm.uuid = res.uuid;
|
||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||
this.registerForm.uuid = res.uuid
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
handleRegister () {
|
||||
this.$refs.registerForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
register(this.registerForm).then(res => {
|
||||
const username = this.registerForm.username;
|
||||
this.$alert("<font color='red'>恭喜你,您的账号 " + username + " 注册成功!</font>", '系统提示', {
|
||||
const username = this.registerForm.username
|
||||
this.$alert("<font color='red'>恭喜你,您的账号 " + username + ' 注册成功!</font>', '系统提示', {
|
||||
dangerouslyUseHTMLString: true
|
||||
}).then(() => {
|
||||
this.$router.push("/login");
|
||||
}).catch(() => {});
|
||||
this.$router.push('/login')
|
||||
}).catch(() => {})
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
this.loading = false
|
||||
if (this.captchaOnOff) {
|
||||
this.getCode();
|
||||
this.getCode()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style rel="stylesheet/scss" lang="scss">
|
||||
|
@ -181,10 +181,10 @@
|
||||
</template>
|
||||
|
||||
<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 {
|
||||
name: "Config",
|
||||
name: 'Config',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -204,7 +204,7 @@ export default {
|
||||
// 参数表格数据
|
||||
configList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 类型数据字典
|
||||
@ -224,42 +224,42 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
configName: [
|
||||
{ required: true, message: "参数名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '参数名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
configKey: [
|
||||
{ required: true, message: "参数键名不能为空", trigger: "blur" }
|
||||
{ required: true, message: '参数键名不能为空', trigger: 'blur' }
|
||||
],
|
||||
configValue: [
|
||||
{ required: true, message: "参数键值不能为空", trigger: "blur" }
|
||||
{ required: true, message: '参数键值不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_yes_no").then(response => {
|
||||
this.typeOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_yes_no').then(response => {
|
||||
this.typeOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询参数列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listConfig(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.configList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.configList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
// 参数系统内置字典翻译
|
||||
typeFormat (row, column) {
|
||||
return this.selectDictLabel(this.typeOptions, row.configType);
|
||||
return this.selectDictLabel(this.typeOptions, row.configType)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -268,99 +268,99 @@ export default {
|
||||
configName: undefined,
|
||||
configKey: undefined,
|
||||
configValue: undefined,
|
||||
configType: "Y",
|
||||
configType: 'Y',
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加参数";
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加参数'
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.configId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const configId = row.configId || this.ids
|
||||
getConfig(configId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改参数";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改参数'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.configId != undefined) {
|
||||
if (this.form.configId !== undefined) {
|
||||
updateConfig(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addConfig(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const configIds = row.configId || this.ids;
|
||||
this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const configIds = row.configId || this.ids
|
||||
this.$confirm('是否确认删除参数编号为"' + configIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delConfig(configIds);
|
||||
return delConfig(configIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有参数数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有参数数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportConfig(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportConfig(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 刷新缓存按钮操作 */
|
||||
handleRefreshCache () {
|
||||
refreshCache().then(() => {
|
||||
this.msgSuccess("刷新成功");
|
||||
});
|
||||
this.msgSuccess('刷新成功')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -72,7 +72,7 @@
|
||||
v-hasPermi="['system:dept:add']"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.parentId != 0"
|
||||
v-if="scope.row.parentId !== 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@ -139,12 +139,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from '@/api/system/dept'
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
export default {
|
||||
name: "Dept",
|
||||
name: 'Dept',
|
||||
components: { Treeselect },
|
||||
data () {
|
||||
return {
|
||||
@ -157,7 +157,7 @@ export default {
|
||||
// 部门树选项
|
||||
deptOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 状态数据字典
|
||||
@ -172,65 +172,65 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
parentId: [
|
||||
{ required: true, message: "上级部门不能为空", trigger: "blur" }
|
||||
{ required: true, message: '上级部门不能为空', trigger: 'blur' }
|
||||
],
|
||||
deptName: [
|
||||
{ required: true, message: "部门名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '部门名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
orderNum: [
|
||||
{ required: true, message: "显示排序不能为空", trigger: "blur" }
|
||||
{ required: true, message: '显示排序不能为空', trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{
|
||||
type: "email",
|
||||
type: 'email',
|
||||
message: "'请输入正确的邮箱地址",
|
||||
trigger: ["blur", "change"]
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur"
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询部门列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listDept(this.queryParams).then(response => {
|
||||
this.deptList = this.handleTree(response.data, "deptId");
|
||||
this.loading = false;
|
||||
});
|
||||
this.deptList = this.handleTree(response.data, 'deptId')
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 转换部门数据结构 */
|
||||
normalizer (node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
delete node.children
|
||||
}
|
||||
return {
|
||||
id: node.deptId,
|
||||
label: node.deptName,
|
||||
children: node.children
|
||||
};
|
||||
}
|
||||
},
|
||||
// 字典状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -242,76 +242,76 @@ export default {
|
||||
leader: undefined,
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
status: "0"
|
||||
};
|
||||
this.resetForm("form");
|
||||
status: '0'
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd (row) {
|
||||
this.reset();
|
||||
if (row != undefined) {
|
||||
this.form.parentId = row.deptId;
|
||||
this.reset()
|
||||
if (row !== undefined) {
|
||||
this.form.parentId = row.deptId
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加部门";
|
||||
this.open = true
|
||||
this.title = '添加部门'
|
||||
listDept().then(response => {
|
||||
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||
});
|
||||
this.deptOptions = this.handleTree(response.data, 'deptId')
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
getDept(row.deptId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改部门";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改部门'
|
||||
})
|
||||
listDeptExcludeChild(row.deptId).then(response => {
|
||||
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||
});
|
||||
this.deptOptions = this.handleTree(response.data, 'deptId')
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.deptId != undefined) {
|
||||
if (this.form.deptId !== undefined) {
|
||||
updateDept(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addDept(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认删除名称为"' + row.deptName + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delDept(row.deptId);
|
||||
return delDept(row.deptId)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -88,8 +88,8 @@
|
||||
<el-table-column label="字典编码" align="center" prop="dictCode" />
|
||||
<el-table-column label="字典标签" align="center" prop="dictLabel">
|
||||
<template slot-scope="scope">
|
||||
<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>
|
||||
<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>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="字典键值" align="center" prop="dictValue" />
|
||||
@ -183,11 +183,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listData, getData, delData, addData, updateData, exportData } from "@/api/system/dict/data";
|
||||
import { listType, getType } from "@/api/system/dict/type";
|
||||
import { listData, getData, delData, addData, updateData, exportData } from '@/api/system/dict/data'
|
||||
import { listType, getType } from '@/api/system/dict/type'
|
||||
|
||||
export default {
|
||||
name: "Data",
|
||||
name: 'Data',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -207,36 +207,36 @@ export default {
|
||||
// 字典表格数据
|
||||
dataList: [],
|
||||
// 默认字典类型
|
||||
defaultDictType: "",
|
||||
defaultDictType: '',
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 数据标签回显样式
|
||||
listClassOptions: [
|
||||
{
|
||||
value: "default",
|
||||
label: "默认"
|
||||
value: 'default',
|
||||
label: '默认'
|
||||
},
|
||||
{
|
||||
value: "primary",
|
||||
label: "主要"
|
||||
value: 'primary',
|
||||
label: '主要'
|
||||
},
|
||||
{
|
||||
value: "success",
|
||||
label: "成功"
|
||||
value: 'success',
|
||||
label: '成功'
|
||||
},
|
||||
{
|
||||
value: "info",
|
||||
label: "信息"
|
||||
value: 'info',
|
||||
label: '信息'
|
||||
},
|
||||
{
|
||||
value: "warning",
|
||||
label: "警告"
|
||||
value: 'warning',
|
||||
label: '警告'
|
||||
},
|
||||
{
|
||||
value: "danger",
|
||||
label: "危险"
|
||||
value: 'danger',
|
||||
label: '危险'
|
||||
}
|
||||
],
|
||||
// 状态数据字典
|
||||
@ -256,53 +256,53 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
dictLabel: [
|
||||
{ required: true, message: "数据标签不能为空", trigger: "blur" }
|
||||
{ required: true, message: '数据标签不能为空', trigger: 'blur' }
|
||||
],
|
||||
dictValue: [
|
||||
{ required: true, message: "数据键值不能为空", trigger: "blur" }
|
||||
{ required: true, message: '数据键值不能为空', trigger: 'blur' }
|
||||
],
|
||||
dictSort: [
|
||||
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
||||
{ required: true, message: '数据顺序不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const dictId = this.$route.params && this.$route.params.dictId;
|
||||
this.getType(dictId);
|
||||
this.getTypeList();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
const dictId = this.$route.params && this.$route.params.dictId
|
||||
this.getType(dictId)
|
||||
this.getTypeList()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询字典类型详细 */
|
||||
getType (dictId) {
|
||||
getType(dictId).then(response => {
|
||||
this.queryParams.dictType = response.data.dictType;
|
||||
this.defaultDictType = response.data.dictType;
|
||||
this.getList();
|
||||
});
|
||||
this.queryParams.dictType = response.data.dictType
|
||||
this.defaultDictType = response.data.dictType
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
/** 查询字典类型列表 */
|
||||
getTypeList () {
|
||||
listType().then(response => {
|
||||
this.typeOptions = response.rows;
|
||||
});
|
||||
this.typeOptions = response.rows
|
||||
})
|
||||
},
|
||||
/** 查询字典数据列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listData(this.queryParams).then(response => {
|
||||
this.dataList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.dataList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -313,94 +313,94 @@ export default {
|
||||
cssClass: undefined,
|
||||
listClass: 'default',
|
||||
dictSort: 0,
|
||||
status: "0",
|
||||
status: '0',
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.dictType = this.defaultDictType;
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.queryParams.dictType = this.defaultDictType
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加字典数据";
|
||||
this.form.dictType = this.queryParams.dictType;
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加字典数据'
|
||||
this.form.dictType = this.queryParams.dictType
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.dictCode)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const dictCode = row.dictCode || this.ids
|
||||
getData(dictCode).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改字典数据";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改字典数据'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.dictCode != undefined) {
|
||||
if (this.form.dictCode !== undefined) {
|
||||
updateData(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addData(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const dictCodes = row.dictCode || this.ids;
|
||||
this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const dictCodes = row.dictCode || this.ids
|
||||
this.$confirm('是否确认删除字典编码为"' + dictCodes + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delData(dictCodes);
|
||||
return delData(dictCodes)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportData(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportData(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -193,10 +193,10 @@
|
||||
</template>
|
||||
|
||||
<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 {
|
||||
name: "Dict",
|
||||
name: 'Dict',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -216,7 +216,7 @@ export default {
|
||||
// 字典表格数据
|
||||
typeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 状态数据字典
|
||||
@ -236,35 +236,35 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
dictName: [
|
||||
{ required: true, message: "字典名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '字典名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
dictType: [
|
||||
{ required: true, message: "字典类型不能为空", trigger: "blur" }
|
||||
{ required: true, message: '字典类型不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询字典类型列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.typeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.typeList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -272,99 +272,99 @@ export default {
|
||||
dictId: undefined,
|
||||
dictName: undefined,
|
||||
dictType: undefined,
|
||||
status: "0",
|
||||
status: '0',
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加字典类型";
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加字典类型'
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.dictId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const dictId = row.dictId || this.ids
|
||||
getType(dictId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改字典类型";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改字典类型'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.dictId != undefined) {
|
||||
if (this.form.dictId !== undefined) {
|
||||
updateType(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addType(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const dictIds = row.dictId || this.ids;
|
||||
this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const dictIds = row.dictId || this.ids
|
||||
this.$confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delType(dictIds);
|
||||
return delType(dictIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有类型数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有类型数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportType(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportType(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 刷新缓存按钮操作 */
|
||||
handleRefreshCache () {
|
||||
refreshCache().then(() => {
|
||||
this.msgSuccess("刷新成功");
|
||||
});
|
||||
this.msgSuccess('刷新成功')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -112,7 +112,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item v-if="form.menuType != 'F'" label="菜单图标">
|
||||
<el-form-item v-if="form.menuType !== 'F'" label="菜单图标">
|
||||
<el-popover
|
||||
placement="bottom-start"
|
||||
width="460"
|
||||
@ -144,7 +144,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.menuType != 'F'">
|
||||
<el-form-item v-if="form.menuType !== 'F'">
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择是外链则路由地址需要以`http(s)://`开头" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
@ -158,7 +158,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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">
|
||||
<el-tooltip content="访问的路由地址,如:`user`,如外网地址需内链访问则以`http(s)://`开头" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
@ -168,7 +168,7 @@
|
||||
<el-input v-model="form.path" placeholder="请输入路由地址" />
|
||||
</el-form-item>
|
||||
</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">
|
||||
<span slot="label">
|
||||
<el-tooltip content="访问的组件路径,如:`system/user/index`,默认在`views`目录下" placement="top">
|
||||
@ -180,7 +180,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<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" />
|
||||
<span slot="label">
|
||||
<el-tooltip content="控制器中定义的权限字符,如:@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">
|
||||
@ -191,7 +191,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.menuType != 'F'">
|
||||
<el-form-item v-if="form.menuType !== 'F'">
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择隐藏则路由将不会出现在侧边栏,但仍然可以访问" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
@ -208,7 +208,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.menuType != 'F'">
|
||||
<el-form-item v-if="form.menuType !== 'F'">
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择停用则路由将不会出现在侧边栏,也不能被访问" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
@ -225,7 +225,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item v-if="form.menuType == 'C'">
|
||||
<el-form-item v-if="form.menuType === 'C'">
|
||||
<span slot="label">
|
||||
<el-tooltip content="选择是则会被`keep-alive`缓存,需要匹配组件的`name`和地址保持一致" placement="top">
|
||||
<i class="el-icon-question"></i>
|
||||
@ -249,13 +249,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api/system/menu";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import IconSelect from "@/components/IconSelect";
|
||||
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from '@/api/system/menu'
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
import IconSelect from '@/components/IconSelect'
|
||||
|
||||
export default {
|
||||
name: "Menu",
|
||||
name: 'Menu',
|
||||
components: { Treeselect, IconSelect },
|
||||
data () {
|
||||
return {
|
||||
@ -268,7 +268,7 @@ export default {
|
||||
// 菜单树选项
|
||||
menuOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 显示状态数据字典
|
||||
@ -285,77 +285,77 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
menuName: [
|
||||
{ required: true, message: "菜单名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '菜单名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
orderNum: [
|
||||
{ required: true, message: "菜单顺序不能为空", trigger: "blur" }
|
||||
{ required: true, message: '菜单顺序不能为空', trigger: 'blur' }
|
||||
],
|
||||
path: [
|
||||
{ required: true, message: "路由地址不能为空", trigger: "blur" }
|
||||
{ required: true, message: '路由地址不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_show_hide").then(response => {
|
||||
this.visibleOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_show_hide').then(response => {
|
||||
this.visibleOptions = response.data
|
||||
})
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 选择图标
|
||||
selected (name) {
|
||||
this.form.icon = name;
|
||||
this.form.icon = name
|
||||
},
|
||||
/** 查询菜单列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listMenu(this.queryParams).then(response => {
|
||||
this.menuList = this.handleTree(response.data, "menuId");
|
||||
this.loading = false;
|
||||
});
|
||||
this.menuList = this.handleTree(response.data, 'menuId')
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 转换菜单数据结构 */
|
||||
normalizer (node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
delete node.children
|
||||
}
|
||||
return {
|
||||
id: node.menuId,
|
||||
label: node.menuName,
|
||||
children: node.children
|
||||
};
|
||||
}
|
||||
},
|
||||
/** 查询菜单下拉树结构 */
|
||||
getTreeselect () {
|
||||
listMenu().then(response => {
|
||||
this.menuOptions = [];
|
||||
const menu = { menuId: 0, menuName: '主类目', children: [] };
|
||||
menu.children = this.handleTree(response.data, "menuId");
|
||||
this.menuOptions.push(menu);
|
||||
});
|
||||
this.menuOptions = []
|
||||
const menu = { menuId: 0, menuName: '主类目', children: [] }
|
||||
menu.children = this.handleTree(response.data, 'menuId')
|
||||
this.menuOptions.push(menu)
|
||||
})
|
||||
},
|
||||
// 显示状态字典翻译
|
||||
visibleFormat (row, column) {
|
||||
if (row.menuType == "F") {
|
||||
return "";
|
||||
if (row.menuType === 'F') {
|
||||
return ''
|
||||
}
|
||||
return this.selectDictLabel(this.visibleOptions, row.visible);
|
||||
return this.selectDictLabel(this.visibleOptions, row.visible)
|
||||
},
|
||||
// 菜单状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
if (row.menuType == "F") {
|
||||
return "";
|
||||
if (row.menuType === 'F') {
|
||||
return ''
|
||||
}
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -364,79 +364,79 @@ export default {
|
||||
parentId: 0,
|
||||
menuName: undefined,
|
||||
icon: undefined,
|
||||
menuType: "M",
|
||||
menuType: 'M',
|
||||
orderNum: undefined,
|
||||
isFrame: "1",
|
||||
isCache: "0",
|
||||
visible: "0",
|
||||
status: "0"
|
||||
};
|
||||
this.resetForm("form");
|
||||
isFrame: '1',
|
||||
isCache: '0',
|
||||
visible: '0',
|
||||
status: '0'
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd (row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null && row.menuId) {
|
||||
this.form.parentId = row.menuId;
|
||||
this.reset()
|
||||
this.getTreeselect()
|
||||
if (row !== null && row.menuId) {
|
||||
this.form.parentId = row.menuId
|
||||
} else {
|
||||
this.form.parentId = 0;
|
||||
this.form.parentId = 0
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加菜单";
|
||||
this.open = true
|
||||
this.title = '添加菜单'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
this.reset()
|
||||
this.getTreeselect()
|
||||
getMenu(row.menuId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改菜单";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改菜单'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.menuId != undefined) {
|
||||
if (this.form.menuId !== undefined) {
|
||||
updateMenu(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addMenu(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认删除名称为"' + row.menuName + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delMenu(row.menuId);
|
||||
return delMenu(row.menuId)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -176,10 +176,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
|
||||
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from '@/api/system/notice'
|
||||
|
||||
export default {
|
||||
name: "Notice",
|
||||
name: 'Notice',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -197,7 +197,7 @@ export default {
|
||||
// 公告表格数据
|
||||
noticeList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 类型数据字典
|
||||
@ -217,45 +217,45 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
noticeTitle: [
|
||||
{ required: true, message: "公告标题不能为空", trigger: "blur" }
|
||||
{ required: true, message: '公告标题不能为空', trigger: 'blur' }
|
||||
],
|
||||
noticeType: [
|
||||
{ required: true, message: "公告类型不能为空", trigger: "change" }
|
||||
{ required: true, message: '公告类型不能为空', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_notice_status").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_notice_type").then(response => {
|
||||
this.typeOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_notice_status').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
this.getDicts('sys_notice_type').then(response => {
|
||||
this.typeOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询公告列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listNotice(this.queryParams).then(response => {
|
||||
this.noticeList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.noticeList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 公告状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 公告状态字典翻译
|
||||
typeFormat (row, column) {
|
||||
return this.selectDictLabel(this.typeOptions, row.noticeType);
|
||||
return this.selectDictLabel(this.typeOptions, row.noticeType)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -264,76 +264,76 @@ export default {
|
||||
noticeTitle: undefined,
|
||||
noticeType: undefined,
|
||||
noticeContent: undefined,
|
||||
status: "0"
|
||||
};
|
||||
this.resetForm("form");
|
||||
status: '0'
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.noticeId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加公告";
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加公告'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const noticeId = row.noticeId || this.ids
|
||||
getNotice(noticeId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改公告";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改公告'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.noticeId != undefined) {
|
||||
if (this.form.noticeId !== undefined) {
|
||||
updateNotice(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addNotice(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const noticeIds = row.noticeId || this.ids
|
||||
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delNotice(noticeIds);
|
||||
return delNotice(noticeIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -156,10 +156,10 @@
|
||||
</template>
|
||||
|
||||
<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 {
|
||||
name: "Post",
|
||||
name: 'Post',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -179,7 +179,7 @@ export default {
|
||||
// 岗位表格数据
|
||||
postList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 状态数据字典
|
||||
@ -197,41 +197,41 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
postName: [
|
||||
{ required: true, message: "岗位名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '岗位名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
postCode: [
|
||||
{ required: true, message: "岗位编码不能为空", trigger: "blur" }
|
||||
{ required: true, message: '岗位编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
postSort: [
|
||||
{ required: true, message: "岗位顺序不能为空", trigger: "blur" }
|
||||
{ required: true, message: '岗位顺序不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询岗位列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listPost(this.queryParams).then(response => {
|
||||
this.postList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.postList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 岗位状态字典翻译
|
||||
statusFormat (row, column) {
|
||||
return this.selectDictLabel(this.statusOptions, row.status);
|
||||
return this.selectDictLabel(this.statusOptions, row.status)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -240,92 +240,92 @@ export default {
|
||||
postCode: undefined,
|
||||
postName: undefined,
|
||||
postSort: 0,
|
||||
status: "0",
|
||||
status: '0',
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.postId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加岗位";
|
||||
this.reset()
|
||||
this.open = true
|
||||
this.title = '添加岗位'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const postId = row.postId || this.ids
|
||||
getPost(postId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改岗位";
|
||||
});
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.title = '修改岗位'
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.postId != undefined) {
|
||||
if (this.form.postId !== undefined) {
|
||||
updatePost(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addPost(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const postIds = row.postId || this.ids;
|
||||
this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const postIds = row.postId || this.ids
|
||||
this.$confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delPost(postIds);
|
||||
return delPost(postIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有岗位数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有岗位数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportPost(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportPost(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -102,11 +102,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { allocatedUserList, authUserCancel, authUserCancelAll } from "@/api/system/role";
|
||||
import selectUser from "./selectUser";
|
||||
import { allocatedUserList, authUserCancel, authUserCancelAll } from '@/api/system/role'
|
||||
import selectUser from './selectUser'
|
||||
|
||||
export default {
|
||||
name: "AuthUser",
|
||||
name: 'AuthUser',
|
||||
components: { selectUser },
|
||||
data () {
|
||||
return {
|
||||
@ -132,43 +132,43 @@ export default {
|
||||
userName: undefined,
|
||||
phonenumber: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const roleId = this.$route.params && this.$route.params.roleId;
|
||||
const roleId = this.$route.params && this.$route.params.roleId
|
||||
if (roleId) {
|
||||
this.queryParams.roleId = roleId;
|
||||
this.getList();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.queryParams.roleId = roleId
|
||||
this.getList()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询授权用户列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
allocatedUserList(this.queryParams).then(response => {
|
||||
this.userList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
// 返回按钮
|
||||
handleClose () {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({ path: "/system/role" });
|
||||
this.$store.dispatch('tagsView/delView', this.$route)
|
||||
this.$router.push({ path: '/system/role' })
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
@ -177,37 +177,37 @@ export default {
|
||||
},
|
||||
/** 打开授权用户表弹窗 */
|
||||
openSelectUser () {
|
||||
this.$refs.select.show();
|
||||
this.$refs.select.show()
|
||||
},
|
||||
/** 取消授权按钮操作 */
|
||||
cancelAuthUser (row) {
|
||||
const roleId = this.queryParams.roleId;
|
||||
this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const roleId = this.queryParams.roleId
|
||||
this.$confirm('确认要取消该用户"' + row.userName + '"角色吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return authUserCancel({ userId: row.userId, roleId: roleId });
|
||||
return authUserCancel({ userId: row.userId, roleId: roleId })
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("取消授权成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('取消授权成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 批量取消授权按钮操作 */
|
||||
cancelAuthUserAll (row) {
|
||||
const roleId = this.queryParams.roleId;
|
||||
const userIds = this.userIds.join(",");
|
||||
this.$confirm('是否取消选中用户授权数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const roleId = this.queryParams.roleId
|
||||
const userIds = this.userIds.join(',')
|
||||
this.$confirm('是否取消选中用户授权数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
return authUserCancelAll({ roleId: roleId, userIds: userIds });
|
||||
return authUserCancelAll({ roleId: roleId, userIds: userIds })
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("取消授权成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('取消授权成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -233,7 +233,7 @@
|
||||
></el-option>
|
||||
</el-select>
|
||||
</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="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">全选/全不选</el-checkbox>
|
||||
<el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">父子联动</el-checkbox>
|
||||
@ -259,12 +259,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 deptTreeselect, roleDeptTreeselect } from "@/api/system/dept";
|
||||
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 deptTreeselect, roleDeptTreeselect } from '@/api/system/dept'
|
||||
|
||||
export default {
|
||||
name: "Role",
|
||||
name: 'Role',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -284,7 +284,7 @@ export default {
|
||||
// 角色表格数据
|
||||
roleList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否显示弹出层(数据权限)
|
||||
@ -300,24 +300,24 @@ export default {
|
||||
// 数据范围选项
|
||||
dataScopeOptions: [
|
||||
{
|
||||
value: "1",
|
||||
label: "全部数据权限"
|
||||
value: '1',
|
||||
label: '全部数据权限'
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "自定数据权限"
|
||||
value: '2',
|
||||
label: '自定数据权限'
|
||||
},
|
||||
{
|
||||
value: "3",
|
||||
label: "本部门数据权限"
|
||||
value: '3',
|
||||
label: '本部门数据权限'
|
||||
},
|
||||
{
|
||||
value: "4",
|
||||
label: "本部门及以下数据权限"
|
||||
value: '4',
|
||||
label: '本部门及以下数据权限'
|
||||
},
|
||||
{
|
||||
value: "5",
|
||||
label: "仅本人数据权限"
|
||||
value: '5',
|
||||
label: '仅本人数据权限'
|
||||
}
|
||||
],
|
||||
// 菜单列表
|
||||
@ -335,309 +335,309 @@ export default {
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
roleName: [
|
||||
{ required: true, message: "角色名称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '角色名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
roleKey: [
|
||||
{ required: true, message: "权限字符不能为空", trigger: "blur" }
|
||||
{ required: true, message: '权限字符不能为空', trigger: 'blur' }
|
||||
],
|
||||
roleSort: [
|
||||
{ required: true, message: "角色顺序不能为空", trigger: "blur" }
|
||||
{ required: true, message: '角色顺序不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getList()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询角色列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
|
||||
response => {
|
||||
this.roleList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.roleList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
/** 查询菜单树结构 */
|
||||
getMenuTreeselect () {
|
||||
menuTreeselect().then(response => {
|
||||
this.menuOptions = response.data;
|
||||
});
|
||||
this.menuOptions = response.data
|
||||
})
|
||||
},
|
||||
/** 查询部门树结构 */
|
||||
getDeptTreeselect () {
|
||||
deptTreeselect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
this.deptOptions = response.data
|
||||
})
|
||||
},
|
||||
// 所有菜单节点数据
|
||||
getMenuAllCheckedKeys () {
|
||||
// 目前被选中的菜单节点
|
||||
let checkedKeys = this.$refs.menu.getCheckedKeys();
|
||||
const checkedKeys = this.$refs.menu.getCheckedKeys()
|
||||
// 半选中的菜单节点
|
||||
let halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys();
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||
return checkedKeys;
|
||||
const halfCheckedKeys = this.$refs.menu.getHalfCheckedKeys()
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
|
||||
return checkedKeys
|
||||
},
|
||||
// 所有部门节点数据
|
||||
getDeptAllCheckedKeys () {
|
||||
// 目前被选中的部门节点
|
||||
let checkedKeys = this.$refs.dept.getCheckedKeys();
|
||||
const checkedKeys = this.$refs.dept.getCheckedKeys()
|
||||
// 半选中的部门节点
|
||||
let halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys();
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys);
|
||||
return checkedKeys;
|
||||
const halfCheckedKeys = this.$refs.dept.getHalfCheckedKeys()
|
||||
checkedKeys.unshift.apply(checkedKeys, halfCheckedKeys)
|
||||
return checkedKeys
|
||||
},
|
||||
/** 根据角色ID查询菜单树结构 */
|
||||
getRoleMenuTreeselect (roleId) {
|
||||
return roleMenuTreeselect(roleId).then(response => {
|
||||
this.menuOptions = response.menus;
|
||||
return response;
|
||||
});
|
||||
this.menuOptions = response.menus
|
||||
return response
|
||||
})
|
||||
},
|
||||
/** 根据角色ID查询部门树结构 */
|
||||
getRoleDeptTreeselect (roleId) {
|
||||
return roleDeptTreeselect(roleId).then(response => {
|
||||
this.deptOptions = response.depts;
|
||||
return response;
|
||||
});
|
||||
this.deptOptions = response.depts
|
||||
return response
|
||||
})
|
||||
},
|
||||
// 角色状态修改
|
||||
handleStatusChange (row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const text = row.status === '0' ? '启用' : '停用'
|
||||
this.$confirm('确认要"' + text + '""' + row.roleName + '"角色吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return changeRoleStatus(row.roleId, row.status);
|
||||
return changeRoleStatus(row.roleId, row.status)
|
||||
}).then(() => {
|
||||
this.msgSuccess(text + "成功");
|
||||
this.msgSuccess(text + '成功')
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
row.status = row.status === '0' ? '1' : '0'
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 取消按钮(数据权限)
|
||||
cancelDataScope () {
|
||||
this.openDataScope = false;
|
||||
this.reset();
|
||||
this.openDataScope = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
if (this.$refs.menu != undefined) {
|
||||
this.$refs.menu.setCheckedKeys([]);
|
||||
if (this.$refs.menu !== undefined) {
|
||||
this.$refs.menu.setCheckedKeys([])
|
||||
}
|
||||
this.menuExpand = false,
|
||||
this.menuNodeAll = false,
|
||||
this.deptExpand = true,
|
||||
this.deptNodeAll = false,
|
||||
this.menuExpand = false
|
||||
this.menuNodeAll = false
|
||||
this.deptExpand = true
|
||||
this.deptNodeAll = false
|
||||
this.form = {
|
||||
roleId: undefined,
|
||||
roleName: undefined,
|
||||
roleKey: undefined,
|
||||
roleSort: 0,
|
||||
status: "0",
|
||||
status: '0',
|
||||
menuIds: [],
|
||||
deptIds: [],
|
||||
menuCheckStrictly: true,
|
||||
deptCheckStrictly: true,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.roleId)
|
||||
this.single = selection.length!=1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 更多操作触发
|
||||
handleCommand (command, row) {
|
||||
switch (command) {
|
||||
case "handleDataScope":
|
||||
this.handleDataScope(row);
|
||||
break;
|
||||
case "handleAuthUser":
|
||||
this.handleAuthUser(row);
|
||||
break;
|
||||
case 'handleDataScope':
|
||||
this.handleDataScope(row)
|
||||
break
|
||||
case 'handleAuthUser':
|
||||
this.handleAuthUser(row)
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
},
|
||||
// 树权限(展开/折叠)
|
||||
handleCheckedTreeExpand (value, type) {
|
||||
if (type == 'menu') {
|
||||
let treeList = this.menuOptions;
|
||||
if (type === 'menu') {
|
||||
const treeList = this.menuOptions
|
||||
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') {
|
||||
let treeList = this.deptOptions;
|
||||
} else if (type === 'dept') {
|
||||
const treeList = this.deptOptions
|
||||
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) {
|
||||
if (type == 'menu') {
|
||||
this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []);
|
||||
} else if (type == 'dept') {
|
||||
this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []);
|
||||
if (type === 'menu') {
|
||||
this.$refs.menu.setCheckedNodes(value ? this.menuOptions : [])
|
||||
} else if (type === 'dept') {
|
||||
this.$refs.dept.setCheckedNodes(value ? this.deptOptions : [])
|
||||
}
|
||||
},
|
||||
// 树权限(父子联动)
|
||||
handleCheckedTreeConnect (value, type) {
|
||||
if (type == 'menu') {
|
||||
this.form.menuCheckStrictly = value ? true: false;
|
||||
} else if (type == 'dept') {
|
||||
this.form.deptCheckStrictly = value ? true: false;
|
||||
if (type === 'menu') {
|
||||
this.form.menuCheckStrictly = !!value
|
||||
} else if (type === 'dept') {
|
||||
this.form.deptCheckStrictly = !!value
|
||||
}
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.getMenuTreeselect();
|
||||
this.open = true;
|
||||
this.title = "添加角色";
|
||||
this.reset()
|
||||
this.getMenuTreeselect()
|
||||
this.open = true
|
||||
this.title = '添加角色'
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.reset()
|
||||
const roleId = row.roleId || this.ids
|
||||
const roleMenu = this.getRoleMenuTreeselect(roleId);
|
||||
const roleMenu = this.getRoleMenuTreeselect(roleId)
|
||||
getRole(roleId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.form = response.data
|
||||
this.open = true
|
||||
this.$nextTick(() => {
|
||||
roleMenu.then(res => {
|
||||
let checkedKeys = res.checkedKeys
|
||||
const checkedKeys = res.checkedKeys
|
||||
checkedKeys.forEach((v) => {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.menu.setChecked(v, true ,false);
|
||||
this.$refs.menu.setChecked(v, true, false)
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
this.title = "修改角色";
|
||||
});
|
||||
})
|
||||
})
|
||||
this.title = '修改角色'
|
||||
})
|
||||
},
|
||||
/** 选择角色权限范围触发 */
|
||||
dataScopeSelectChange (value) {
|
||||
if (value !== '2') {
|
||||
this.$refs.dept.setCheckedKeys([]);
|
||||
this.$refs.dept.setCheckedKeys([])
|
||||
}
|
||||
},
|
||||
/** 分配数据权限操作 */
|
||||
handleDataScope (row) {
|
||||
this.reset();
|
||||
const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId);
|
||||
this.reset()
|
||||
const roleDeptTreeselect = this.getRoleDeptTreeselect(row.roleId)
|
||||
getRole(row.roleId).then(response => {
|
||||
this.form = response.data;
|
||||
this.openDataScope = true;
|
||||
this.form = response.data
|
||||
this.openDataScope = true
|
||||
this.$nextTick(() => {
|
||||
roleDeptTreeselect.then(res => {
|
||||
this.$refs.dept.setCheckedKeys(res.checkedKeys);
|
||||
});
|
||||
});
|
||||
this.title = "分配数据权限";
|
||||
});
|
||||
this.$refs.dept.setCheckedKeys(res.checkedKeys)
|
||||
})
|
||||
})
|
||||
this.title = '分配数据权限'
|
||||
})
|
||||
},
|
||||
/** 分配用户操作 */
|
||||
handleAuthUser: function (row) {
|
||||
const roleId = row.roleId;
|
||||
this.$router.push("/system/role-auth/user/" + roleId);
|
||||
const roleId = row.roleId
|
||||
this.$router.push('/system/role-auth/user/' + roleId)
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.roleId != undefined) {
|
||||
this.form.menuIds = this.getMenuAllCheckedKeys();
|
||||
if (this.form.roleId !== undefined) {
|
||||
this.form.menuIds = this.getMenuAllCheckedKeys()
|
||||
updateRole(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
this.form.menuIds = this.getMenuAllCheckedKeys();
|
||||
this.form.menuIds = this.getMenuAllCheckedKeys()
|
||||
addRole(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 提交按钮(数据权限) */
|
||||
submitDataScope: function () {
|
||||
if (this.form.roleId != undefined) {
|
||||
this.form.deptIds = this.getDeptAllCheckedKeys();
|
||||
if (this.form.roleId !== undefined) {
|
||||
this.form.deptIds = this.getDeptAllCheckedKeys()
|
||||
dataScope(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.openDataScope = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.openDataScope = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const roleIds = row.roleId || this.ids;
|
||||
this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const roleIds = row.roleId || this.ids
|
||||
this.$confirm('是否确认删除角色编号为"' + roleIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delRole(roleIds);
|
||||
return delRole(roleIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有角色数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有角色数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportRole(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportRole(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -59,7 +59,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { unallocatedUserList, authUserSelectAll } from "@/api/system/role";
|
||||
import { unallocatedUserList, authUserSelectAll } from '@/api/system/role'
|
||||
export default {
|
||||
props: {
|
||||
// 角色编号
|
||||
@ -87,56 +87,56 @@ export default {
|
||||
userName: undefined,
|
||||
phonenumber: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 显示弹框
|
||||
show () {
|
||||
this.queryParams.roleId = this.roleId;
|
||||
this.getList();
|
||||
this.visible = true;
|
||||
this.queryParams.roleId = this.roleId
|
||||
this.getList()
|
||||
this.visible = true
|
||||
},
|
||||
clickRow (row) {
|
||||
this.$refs.table.toggleRowSelection(row);
|
||||
this.$refs.table.toggleRowSelection(row)
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.userIds = selection.map(item => item.userId);
|
||||
this.userIds = selection.map(item => item.userId)
|
||||
},
|
||||
// 查询表数据
|
||||
getList () {
|
||||
unallocatedUserList(this.queryParams).then(res => {
|
||||
this.userList = res.rows;
|
||||
this.total = res.total;
|
||||
});
|
||||
this.userList = res.rows
|
||||
this.total = res.total
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 选择授权用户操作 */
|
||||
handleSelectUser () {
|
||||
const roleId = this.queryParams.roleId;
|
||||
const userIds = this.userIds.join(",");
|
||||
const roleId = this.queryParams.roleId
|
||||
const userIds = this.userIds.join(',')
|
||||
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(res => {
|
||||
this.msgSuccess(res.msg);
|
||||
this.msgSuccess(res.msg)
|
||||
if (res.code === 200) {
|
||||
this.visible = false;
|
||||
this.$emit("ok");
|
||||
this.visible = false
|
||||
this.$emit('ok')
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -46,10 +46,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAuthRole, updateAuthRole } from "@/api/system/user";
|
||||
import { getAuthRole, updateAuthRole } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
name: "AuthRole",
|
||||
name: 'AuthRole',
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
@ -64,54 +64,54 @@ export default {
|
||||
roles: [],
|
||||
// 用户信息
|
||||
form: {}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const userId = this.$route.params && this.$route.params.userId;
|
||||
const userId = this.$route.params && this.$route.params.userId
|
||||
if (userId) {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
getAuthRole(userId).then((response) => {
|
||||
this.form = response.user;
|
||||
this.roles = response.roles;
|
||||
this.total = this.roles.length;
|
||||
this.form = response.user
|
||||
this.roles = response.roles
|
||||
this.total = this.roles.length
|
||||
this.$nextTick(() => {
|
||||
this.roles.forEach((row) => {
|
||||
if (row.flag) {
|
||||
this.$refs.table.toggleRowSelection(row);
|
||||
this.$refs.table.toggleRowSelection(row)
|
||||
}
|
||||
});
|
||||
});
|
||||
this.loading = false;
|
||||
});
|
||||
})
|
||||
})
|
||||
this.loading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 单击选中行数据 */
|
||||
clickRow (row) {
|
||||
this.$refs.table.toggleRowSelection(row);
|
||||
this.$refs.table.toggleRowSelection(row)
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.roleIds = selection.map((item) => item.roleId);
|
||||
this.roleIds = selection.map((item) => item.roleId)
|
||||
},
|
||||
// 保存选中的数据编号
|
||||
getRowKey (row) {
|
||||
return row.roleId;
|
||||
return row.roleId
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm () {
|
||||
const userId = this.form.userId;
|
||||
const roleIds = this.roleIds.join(",");
|
||||
const userId = this.form.userId
|
||||
const roleIds = this.roleIds.join(',')
|
||||
updateAuthRole({ userId: userId, roleIds: roleIds }).then((response) => {
|
||||
this.msgSuccess("授权成功");
|
||||
this.close();
|
||||
});
|
||||
this.msgSuccess('授权成功')
|
||||
this.close()
|
||||
})
|
||||
},
|
||||
/** 关闭按钮 */
|
||||
close () {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({ path: "/system/user" });
|
||||
},
|
||||
},
|
||||
};
|
||||
this.$store.dispatch('tagsView/delView', this.$route)
|
||||
this.$router.push({ path: '/system/user' })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
@ -236,12 +236,12 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
@ -280,7 +280,7 @@
|
||||
:key="item.postId"
|
||||
:label="item.postName"
|
||||
:value="item.postId"
|
||||
:disabled="item.status == 1"
|
||||
:disabled="item.status === 1"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -293,7 +293,7 @@
|
||||
:key="item.roleId"
|
||||
:label="item.roleName"
|
||||
:value="item.roleId"
|
||||
:disabled="item.status == 1"
|
||||
:disabled="item.status === 1"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@ -346,14 +346,14 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from "@/api/system/user";
|
||||
import { getToken } from "@/utils/auth";
|
||||
import { treeselect } from "@/api/system/dept";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import { listUser, getUser, delUser, addUser, updateUser, exportUser, resetUserPwd, changeUserStatus, importTemplate } from '@/api/system/user'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { treeselect } from '@/api/system/dept'
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
export default {
|
||||
name: "User",
|
||||
name: 'User',
|
||||
components: { Treeselect },
|
||||
data () {
|
||||
return {
|
||||
@ -374,7 +374,7 @@ export default {
|
||||
// 用户表格数据
|
||||
userList: null,
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
title: '',
|
||||
// 部门树选项
|
||||
deptOptions: undefined,
|
||||
// 是否显示弹出层
|
||||
@ -396,23 +396,23 @@ export default {
|
||||
// 表单参数
|
||||
form: {},
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "label"
|
||||
children: 'children',
|
||||
label: 'label'
|
||||
},
|
||||
// 用户导入参数
|
||||
upload: {
|
||||
// 是否显示弹出层(用户导入)
|
||||
open: false,
|
||||
// 弹出层标题(用户导入)
|
||||
title: "",
|
||||
title: '',
|
||||
// 是否禁用上传
|
||||
isUploading: false,
|
||||
// 是否更新已经存在的用户数据
|
||||
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: {
|
||||
@ -425,109 +425,109 @@ export default {
|
||||
},
|
||||
// 列信息
|
||||
columns: [
|
||||
{ key: 0, label: `用户编号`, visible: true },
|
||||
{ key: 1, label: `用户名称`, visible: true },
|
||||
{ key: 2, label: `用户昵称`, visible: true },
|
||||
{ key: 3, label: `部门`, visible: true },
|
||||
{ key: 4, label: `手机号码`, visible: true },
|
||||
{ key: 5, label: `状态`, visible: true },
|
||||
{ key: 6, label: `创建时间`, visible: true }
|
||||
{ key: 0, label: '用户编号', visible: true },
|
||||
{ key: 1, label: '用户名称', visible: true },
|
||||
{ key: 2, label: '用户昵称', visible: true },
|
||||
{ key: 3, label: '部门', visible: true },
|
||||
{ key: 4, label: '手机号码', visible: true },
|
||||
{ key: 5, label: '状态', visible: true },
|
||||
{ key: 6, label: '创建时间', visible: true }
|
||||
],
|
||||
// 表单校验
|
||||
rules: {
|
||||
userName: [
|
||||
{ required: true, message: "用户名称不能为空", trigger: "blur" },
|
||||
{ required: true, message: '用户名称不能为空', trigger: 'blur' },
|
||||
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||
],
|
||||
nickName: [
|
||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '用户昵称不能为空', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: "用户密码不能为空", trigger: "blur" },
|
||||
{ required: true, message: '用户密码不能为空', trigger: 'blur' },
|
||||
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{
|
||||
type: "email",
|
||||
type: 'email',
|
||||
message: "'请输入正确的邮箱地址",
|
||||
trigger: ["blur", "change"]
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
phonenumber: [
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur"
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 根据名称筛选部门树
|
||||
deptName (val) {
|
||||
this.$refs.tree.filter(val);
|
||||
this.$refs.tree.filter(val)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getTreeselect();
|
||||
this.getDicts("sys_normal_disable").then(response => {
|
||||
this.statusOptions = response.data;
|
||||
});
|
||||
this.getDicts("sys_user_sex").then(response => {
|
||||
this.sexOptions = response.data;
|
||||
});
|
||||
this.getConfigKey("sys.user.initPassword").then(response => {
|
||||
this.initPassword = response.msg;
|
||||
});
|
||||
this.getList()
|
||||
this.getTreeselect()
|
||||
this.getDicts('sys_normal_disable').then(response => {
|
||||
this.statusOptions = response.data
|
||||
})
|
||||
this.getDicts('sys_user_sex').then(response => {
|
||||
this.sexOptions = response.data
|
||||
})
|
||||
this.getConfigKey('sys.user.initPassword').then(response => {
|
||||
this.initPassword = response.msg
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
/** 查询用户列表 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listUser(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.userList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.userList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
/** 查询部门下拉树结构 */
|
||||
getTreeselect () {
|
||||
treeselect().then(response => {
|
||||
this.deptOptions = response.data;
|
||||
});
|
||||
this.deptOptions = response.data
|
||||
})
|
||||
},
|
||||
// 筛选节点
|
||||
filterNode (value, data) {
|
||||
if (!value) return true;
|
||||
return data.label.indexOf(value) !== -1;
|
||||
if (!value) return true
|
||||
return data.label.indexOf(value) !== -1
|
||||
},
|
||||
// 节点单击事件
|
||||
handleNodeClick (data) {
|
||||
this.queryParams.deptId = data.id;
|
||||
this.getList();
|
||||
this.queryParams.deptId = data.id
|
||||
this.getList()
|
||||
},
|
||||
// 用户状态修改
|
||||
handleStatusChange (row) {
|
||||
let text = row.status === "0" ? "启用" : "停用";
|
||||
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const text = row.status === '0' ? '启用' : '停用'
|
||||
this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return changeUserStatus(row.userId, row.status);
|
||||
return changeUserStatus(row.userId, row.status)
|
||||
}).then(() => {
|
||||
this.msgSuccess(text + "成功");
|
||||
this.msgSuccess(text + '成功')
|
||||
}).catch(function () {
|
||||
row.status = row.status === "0" ? "1" : "0";
|
||||
});
|
||||
row.status = row.status === '0' ? '1' : '0'
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel () {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.open = false
|
||||
this.reset()
|
||||
},
|
||||
// 表单重置
|
||||
reset () {
|
||||
@ -540,166 +540,166 @@ export default {
|
||||
phonenumber: undefined,
|
||||
email: undefined,
|
||||
sex: undefined,
|
||||
status: "0",
|
||||
status: '0',
|
||||
remark: undefined,
|
||||
postIds: [],
|
||||
roleIds: []
|
||||
};
|
||||
this.resetForm("form");
|
||||
}
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.userId);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
this.ids = selection.map(item => item.userId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
// 更多操作触发
|
||||
handleCommand (command, row) {
|
||||
switch (command) {
|
||||
case "handleResetPwd":
|
||||
this.handleResetPwd(row);
|
||||
break;
|
||||
case "handleAuthRole":
|
||||
this.handleAuthRole(row);
|
||||
break;
|
||||
case 'handleResetPwd':
|
||||
this.handleResetPwd(row)
|
||||
break
|
||||
case 'handleAuthRole':
|
||||
this.handleAuthRole(row)
|
||||
break
|
||||
default:
|
||||
break;
|
||||
break
|
||||
}
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd () {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
this.reset()
|
||||
this.getTreeselect()
|
||||
getUser().then(response => {
|
||||
this.postOptions = response.posts;
|
||||
this.roleOptions = response.roles;
|
||||
this.open = true;
|
||||
this.title = "添加用户";
|
||||
this.form.password = this.initPassword;
|
||||
});
|
||||
this.postOptions = response.posts
|
||||
this.roleOptions = response.roles
|
||||
this.open = true
|
||||
this.title = '添加用户'
|
||||
this.form.password = this.initPassword
|
||||
})
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate (row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
const userId = row.userId || this.ids;
|
||||
this.reset()
|
||||
this.getTreeselect()
|
||||
const userId = row.userId || this.ids
|
||||
getUser(userId).then(response => {
|
||||
this.form = response.data;
|
||||
this.postOptions = response.posts;
|
||||
this.roleOptions = response.roles;
|
||||
this.form.postIds = response.postIds;
|
||||
this.form.roleIds = response.roleIds;
|
||||
this.open = true;
|
||||
this.title = "修改用户";
|
||||
this.form.password = "";
|
||||
});
|
||||
this.form = response.data
|
||||
this.postOptions = response.posts
|
||||
this.roleOptions = response.roles
|
||||
this.form.postIds = response.postIds
|
||||
this.form.roleIds = response.roleIds
|
||||
this.open = true
|
||||
this.title = '修改用户'
|
||||
this.form.password = ''
|
||||
})
|
||||
},
|
||||
/** 重置密码按钮操作 */
|
||||
handleResetPwd (row) {
|
||||
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
this.$prompt('请输入"' + row.userName + '"的新密码', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
closeOnClickModal: false,
|
||||
inputPattern: /^.{5,20}$/,
|
||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
||||
inputErrorMessage: '用户密码长度必须介于 5 和 20 之间'
|
||||
}).then(({ value }) => {
|
||||
resetUserPwd(row.userId, value).then(response => {
|
||||
this.msgSuccess("修改成功,新密码是:" + value);
|
||||
});
|
||||
}).catch(() => {});
|
||||
this.msgSuccess('修改成功,新密码是:' + value)
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 分配角色操作 */
|
||||
handleAuthRole: function (row) {
|
||||
const userId = row.userId;
|
||||
this.$router.push("/system/user-auth/role/" + userId);
|
||||
const userId = row.userId
|
||||
this.$router.push('/system/user-auth/role/' + userId)
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.userId != undefined) {
|
||||
if (this.form.userId !== undefined) {
|
||||
updateUser(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
addUser(this.form).then(response => {
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
this.msgSuccess('新增成功')
|
||||
this.open = false
|
||||
this.getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const userIds = row.userId || this.ids;
|
||||
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const userIds = row.userId || this.ids
|
||||
this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delUser(userIds);
|
||||
return delUser(userIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport () {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有用户数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const queryParams = this.queryParams
|
||||
this.$confirm('是否确认导出所有用户数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportUser(queryParams);
|
||||
this.exportLoading = true
|
||||
return exportUser(queryParams)
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
this.download(response.msg)
|
||||
this.exportLoading = false
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImport () {
|
||||
this.upload.title = "用户导入";
|
||||
this.upload.open = true;
|
||||
this.upload.title = '用户导入'
|
||||
this.upload.open = true
|
||||
},
|
||||
/** 下载模板操作 */
|
||||
importTemplate () {
|
||||
importTemplate().then(response => {
|
||||
this.download(response.msg);
|
||||
});
|
||||
this.download(response.msg)
|
||||
})
|
||||
},
|
||||
// 文件上传中处理
|
||||
handleFileUploadProgress (event, file, fileList) {
|
||||
this.upload.isUploading = true;
|
||||
this.upload.isUploading = true
|
||||
},
|
||||
// 文件上传成功处理
|
||||
handleFileSuccess (response, file, fileList) {
|
||||
this.upload.open = false;
|
||||
this.upload.isUploading = false;
|
||||
this.$refs.upload.clearFiles();
|
||||
this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
||||
this.getList();
|
||||
this.upload.open = false
|
||||
this.upload.isUploading = false
|
||||
this.$refs.upload.clearFiles()
|
||||
this.$alert(response.msg, '导入结果', { dangerouslyUseHTMLString: true })
|
||||
this.getList()
|
||||
},
|
||||
// 提交上传文件
|
||||
submitFileForm () {
|
||||
this.$refs.upload.submit();
|
||||
this.$refs.upload.submit()
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -59,33 +59,33 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userAvatar from "./userAvatar";
|
||||
import userInfo from "./userInfo";
|
||||
import resetPwd from "./resetPwd";
|
||||
import { getUserProfile } from "@/api/system/user";
|
||||
import userAvatar from './userAvatar'
|
||||
import userInfo from './userInfo'
|
||||
import resetPwd from './resetPwd'
|
||||
import { getUserProfile } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
name: "Profile",
|
||||
name: 'Profile',
|
||||
components: { userAvatar, userInfo, resetPwd },
|
||||
data () {
|
||||
return {
|
||||
user: {},
|
||||
roleGroup: {},
|
||||
postGroup: {},
|
||||
activeTab: "userinfo"
|
||||
};
|
||||
activeTab: 'userinfo'
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getUser();
|
||||
this.getUser()
|
||||
},
|
||||
methods: {
|
||||
getUser () {
|
||||
getUserProfile().then(response => {
|
||||
this.user = response.data;
|
||||
this.roleGroup = response.roleGroup;
|
||||
this.postGroup = response.postGroup;
|
||||
});
|
||||
this.user = response.data
|
||||
this.roleGroup = response.roleGroup
|
||||
this.postGroup = response.postGroup
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -17,19 +17,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { updateUserPwd } from "@/api/system/user";
|
||||
import { updateUserPwd } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
const equalToPassword = (rule, value, callback) => {
|
||||
if (this.user.newPassword !== value) {
|
||||
callback(new Error("两次输入的密码不一致"));
|
||||
callback(new Error('两次输入的密码不一致'))
|
||||
} else {
|
||||
callback();
|
||||
callback()
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
test: "1test",
|
||||
test: '1test',
|
||||
user: {
|
||||
oldPassword: undefined,
|
||||
newPassword: undefined,
|
||||
@ -38,35 +38,35 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
oldPassword: [
|
||||
{ required: true, message: "旧密码不能为空", trigger: "blur" }
|
||||
{ required: true, message: '旧密码不能为空', trigger: 'blur' }
|
||||
],
|
||||
newPassword: [
|
||||
{ required: true, message: "新密码不能为空", trigger: "blur" },
|
||||
{ min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" }
|
||||
{ required: true, message: '新密码不能为空', trigger: 'blur' },
|
||||
{ min: 6, max: 20, message: '长度在 6 到 20 个字符', trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ required: true, message: "确认密码不能为空", trigger: "blur" },
|
||||
{ required: true, validator: equalToPassword, trigger: "blur" }
|
||||
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
||||
{ required: true, validator: equalToPassword, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(
|
||||
response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.msgSuccess('修改成功')
|
||||
}
|
||||
);
|
||||
)
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({ path: "/index" });
|
||||
this.$store.dispatch('tagsView/delView', this.$route)
|
||||
this.$router.push({ path: '/index' })
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -1,7 +1,9 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像" class="img-circle img-lg" /></div>
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened" @close="closeDialog()">
|
||||
<div class="user-info-head" @click="editCropper()"><img v-bind:src="options.img" title="点击上传头像"
|
||||
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-col :xs="24" :md="12" :style="{height: '350px'}">
|
||||
<vue-cropper
|
||||
@ -53,9 +55,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import store from "@/store";
|
||||
import { VueCropper } from "vue-cropper";
|
||||
import { uploadAvatar } from "@/api/system/user";
|
||||
import store from '@/store'
|
||||
import { VueCropper } from 'vue-cropper'
|
||||
import { uploadAvatar } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
components: { VueCropper },
|
||||
@ -71,7 +73,7 @@ export default {
|
||||
// 是否显示cropper
|
||||
visible: false,
|
||||
// 弹出层标题
|
||||
title: "修改头像",
|
||||
title: '修改头像',
|
||||
options: {
|
||||
img: store.getters.avatar, // 裁剪图片的地址
|
||||
autoCrop: true, // 是否默认生成截图框
|
||||
@ -80,70 +82,70 @@ export default {
|
||||
fixedBox: true // 固定截图框大小 不允许改变
|
||||
},
|
||||
previews: {}
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 编辑头像
|
||||
editCropper () {
|
||||
this.open = true;
|
||||
this.open = true
|
||||
},
|
||||
// 打开弹出层结束时的回调
|
||||
modalOpened () {
|
||||
this.visible = true;
|
||||
this.visible = true
|
||||
},
|
||||
// 覆盖默认的上传行为
|
||||
requestUpload () {
|
||||
},
|
||||
// 向左旋转
|
||||
rotateLeft () {
|
||||
this.$refs.cropper.rotateLeft();
|
||||
this.$refs.cropper.rotateLeft()
|
||||
},
|
||||
// 向右旋转
|
||||
rotateRight () {
|
||||
this.$refs.cropper.rotateRight();
|
||||
this.$refs.cropper.rotateRight()
|
||||
},
|
||||
// 图片缩放
|
||||
changeScale (num) {
|
||||
num = num || 1;
|
||||
this.$refs.cropper.changeScale(num);
|
||||
num = num || 1
|
||||
this.$refs.cropper.changeScale(num)
|
||||
},
|
||||
// 上传预处理
|
||||
beforeUpload (file) {
|
||||
if (file.type.indexOf("image/") == -1) {
|
||||
this.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");
|
||||
if (file.type.indexOf('image/') === -1) {
|
||||
this.msgError('文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。')
|
||||
} else {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
const reader = new FileReader()
|
||||
reader.readAsDataURL(file)
|
||||
reader.onload = () => {
|
||||
this.options.img = reader.result;
|
||||
};
|
||||
this.options.img = reader.result
|
||||
}
|
||||
}
|
||||
},
|
||||
// 上传图片
|
||||
uploadImg () {
|
||||
this.$refs.cropper.getCropBlob(data => {
|
||||
let formData = new FormData();
|
||||
formData.append("avatarfile", data);
|
||||
const formData = new FormData()
|
||||
formData.append('avatarfile', data)
|
||||
uploadAvatar(formData).then(response => {
|
||||
this.open = false;
|
||||
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl;
|
||||
store.commit('SET_AVATAR', this.options.img);
|
||||
this.msgSuccess("修改成功");
|
||||
this.visible = false;
|
||||
});
|
||||
});
|
||||
this.open = false
|
||||
this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl
|
||||
store.commit('SET_AVATAR', this.options.img)
|
||||
this.msgSuccess('修改成功')
|
||||
this.visible = false
|
||||
})
|
||||
})
|
||||
},
|
||||
// 实时预览
|
||||
realTime (data) {
|
||||
this.previews = data;
|
||||
this.previews = data
|
||||
},
|
||||
// 关闭窗口
|
||||
closeDialog () {
|
||||
this.options.img = store.getters.avatar
|
||||
this.visible = false;
|
||||
this.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.user-info-head {
|
||||
|
@ -23,7 +23,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { updateUserProfile } from "@/api/system/user";
|
||||
import { updateUserProfile } from '@/api/system/user'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -36,41 +36,41 @@ export default {
|
||||
// 表单校验
|
||||
rules: {
|
||||
nickName: [
|
||||
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
|
||||
{ required: true, message: '用户昵称不能为空', trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{ required: true, message: "邮箱地址不能为空", trigger: "blur" },
|
||||
{ required: true, message: '邮箱地址不能为空', trigger: 'blur' },
|
||||
{
|
||||
type: "email",
|
||||
type: 'email',
|
||||
message: "'请输入正确的邮箱地址",
|
||||
trigger: ["blur", "change"]
|
||||
trigger: ['blur', 'change']
|
||||
}
|
||||
],
|
||||
phonenumber: [
|
||||
{ required: true, message: "手机号码不能为空", trigger: "blur" },
|
||||
{ required: true, message: '手机号码不能为空', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
|
||||
message: "请输入正确的手机号码",
|
||||
trigger: "blur"
|
||||
message: '请输入正确的手机号码',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit () {
|
||||
this.$refs["form"].validate(valid => {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (valid) {
|
||||
updateUserProfile(this.user).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
});
|
||||
this.msgSuccess('修改成功')
|
||||
})
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({ path: "/index" });
|
||||
this.$store.dispatch('tagsView/delView', this.$route)
|
||||
this.$router.push({ path: '/index' })
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -572,15 +572,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { isArray } from 'util'
|
||||
import draggable from 'vuedraggable'
|
||||
import TreeNodeDialog from './TreeNodeDialog'
|
||||
import { isNumberStr } from '@/utils/index'
|
||||
import IconsDialog from './IconsDialog'
|
||||
import {
|
||||
inputComponents,
|
||||
selectComponents,
|
||||
layoutComponents
|
||||
selectComponents
|
||||
} from '@/utils/generator/config'
|
||||
|
||||
const dateTimeFormat = {
|
||||
@ -698,14 +696,14 @@ export default {
|
||||
computed: {
|
||||
documentLink () {
|
||||
return (
|
||||
this.activeData.document
|
||||
|| 'https://element.eleme.cn/#/zh-CN/component/installation'
|
||||
this.activeData.document ||
|
||||
'https://element.eleme.cn/#/zh-CN/component/installation'
|
||||
)
|
||||
},
|
||||
dateOptions () {
|
||||
if (
|
||||
this.activeData.type !== undefined
|
||||
&& this.activeData.tag === 'el-date-picker'
|
||||
this.activeData.type !== undefined &&
|
||||
this.activeData.tag === 'el-date-picker'
|
||||
) {
|
||||
if (this.activeData['start-placeholder'] === undefined) {
|
||||
return this.dateTypeOptions
|
||||
@ -794,7 +792,7 @@ export default {
|
||||
return val
|
||||
},
|
||||
onDefaultValueInput (str) {
|
||||
if (isArray(this.activeData.defaultValue)) {
|
||||
if (Array.isArray(this.activeData.defaultValue)) {
|
||||
// 数组
|
||||
this.$set(
|
||||
this.activeData,
|
||||
|
@ -115,7 +115,6 @@ export default {
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
// eslint-disable-next-line func-names
|
||||
'formData.value': function (val) {
|
||||
this.dataType = isNumberStr(val) ? 'number' : 'string'
|
||||
}
|
||||
|
@ -140,7 +140,6 @@ import draggable from 'vuedraggable'
|
||||
import { saveAs } from 'file-saver'
|
||||
import beautifier from 'js-beautify'
|
||||
import ClipboardJS from 'clipboard'
|
||||
import render from '@/utils/generator/render'
|
||||
import RightPanel from './RightPanel'
|
||||
import {
|
||||
inputComponents,
|
||||
@ -149,7 +148,7 @@ import {
|
||||
formConf
|
||||
} from '@/utils/generator/config'
|
||||
import {
|
||||
exportDefault, beautifierConf, isNumberStr, titleCase
|
||||
beautifierConf, titleCase
|
||||
} from '@/utils/index'
|
||||
import {
|
||||
makeUpHtml, vueTemplate, vueScript, cssStyle
|
||||
@ -161,14 +160,12 @@ import logo from '@/assets/logo/logo.png'
|
||||
import CodeTypeDialog from './CodeTypeDialog'
|
||||
import DraggableItem from './DraggableItem'
|
||||
|
||||
const emptyActiveData = { style: {}, autosize: {} }
|
||||
let oldActiveId
|
||||
let tempActiveData
|
||||
|
||||
export default {
|
||||
components: {
|
||||
draggable,
|
||||
render,
|
||||
RightPanel,
|
||||
CodeTypeDialog,
|
||||
DraggableItem
|
||||
@ -201,12 +198,11 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// eslint-disable-next-line func-names
|
||||
'activeData.label': function (val, oldVal) {
|
||||
if (
|
||||
this.activeData.placeholder === undefined
|
||||
|| !this.activeData.tag
|
||||
|| oldActiveId !== this.activeId
|
||||
this.activeData.placeholder === undefined ||
|
||||
!this.activeData.tag ||
|
||||
oldActiveId !== this.activeId
|
||||
) {
|
||||
return
|
||||
}
|
||||
@ -359,8 +355,8 @@ export default {
|
||||
delete this.activeData.tagIcon
|
||||
delete this.activeData.document
|
||||
Object.keys(newTag).forEach(key => {
|
||||
if (this.activeData[key] !== undefined
|
||||
&& typeof this.activeData[key] === typeof newTag[key]) {
|
||||
if (this.activeData[key] !== undefined &&
|
||||
typeof this.activeData[key] === typeof newTag[key]) {
|
||||
newTag[key] = this.activeData[key]
|
||||
}
|
||||
})
|
||||
|
@ -32,7 +32,7 @@
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "BasicInfoForm",
|
||||
name: 'BasicInfoForm',
|
||||
props: {
|
||||
info: {
|
||||
type: Object,
|
||||
@ -43,19 +43,19 @@ export default {
|
||||
return {
|
||||
rules: {
|
||||
tableName: [
|
||||
{ required: true, message: "请输入表名称", trigger: "blur" }
|
||||
{ required: true, message: '请输入表名称', trigger: 'blur' }
|
||||
],
|
||||
tableComment: [
|
||||
{ required: true, message: "请输入表描述", trigger: "blur" }
|
||||
{ required: true, message: '请输入表描述', trigger: 'blur' }
|
||||
],
|
||||
className: [
|
||||
{ required: true, message: "请输入实体类名称", trigger: "blur" }
|
||||
{ required: true, message: '请输入实体类名称', trigger: 'blur' }
|
||||
],
|
||||
functionAuthor: [
|
||||
{ required: true, message: "请输入作者", trigger: "blur" }
|
||||
{ required: true, message: '请输入作者', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -125,15 +125,15 @@
|
||||
</el-card>
|
||||
</template>
|
||||
<script>
|
||||
import { getGenTable, updateGenTable } from "@/api/tool/gen";
|
||||
import { optionselect as getDictOptionselect } from "@/api/system/dict/type";
|
||||
import { listMenu as getMenuTreeselect } from "@/api/system/menu";
|
||||
import basicInfoForm from "./basicInfoForm";
|
||||
import genInfoForm from "./genInfoForm";
|
||||
import { getGenTable, updateGenTable } from '@/api/tool/gen'
|
||||
import { optionselect as getDictOptionselect } from '@/api/system/dict/type'
|
||||
import { listMenu as getMenuTreeselect } from '@/api/system/menu'
|
||||
import basicInfoForm from './basicInfoForm'
|
||||
import genInfoForm from './genInfoForm'
|
||||
import Sortable from 'sortablejs'
|
||||
|
||||
export default {
|
||||
name: "GenEdit",
|
||||
name: 'GenEdit',
|
||||
components: {
|
||||
basicInfoForm,
|
||||
genInfoForm
|
||||
@ -141,9 +141,9 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
// 选中选项卡的 name
|
||||
activeName: "cloum",
|
||||
activeName: 'cloum',
|
||||
// 表格的高度
|
||||
tableHeight: document.documentElement.scrollHeight - 245 + "px",
|
||||
tableHeight: document.documentElement.scrollHeight - 245 + 'px',
|
||||
// 表信息
|
||||
tables: [],
|
||||
// 表列信息
|
||||
@ -154,79 +154,79 @@ export default {
|
||||
menus: [],
|
||||
// 表详细信息
|
||||
info: {}
|
||||
};
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const tableId = this.$route.params && this.$route.params.tableId;
|
||||
const tableId = this.$route.params && this.$route.params.tableId
|
||||
if (tableId) {
|
||||
// 获取表详细信息
|
||||
getGenTable(tableId).then(res => {
|
||||
this.cloumns = res.data.rows;
|
||||
this.info = res.data.info;
|
||||
this.tables = res.data.tables;
|
||||
});
|
||||
this.cloumns = res.data.rows
|
||||
this.info = res.data.info
|
||||
this.tables = res.data.tables
|
||||
})
|
||||
/** 查询字典下拉列表 */
|
||||
getDictOptionselect().then(response => {
|
||||
this.dictOptions = response.data;
|
||||
});
|
||||
this.dictOptions = response.data
|
||||
})
|
||||
/** 查询菜单下拉列表 */
|
||||
getMenuTreeselect().then(response => {
|
||||
this.menus = this.handleTree(response.data, "menuId");
|
||||
});
|
||||
this.menus = this.handleTree(response.data, 'menuId')
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 提交按钮 */
|
||||
submitForm () {
|
||||
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm;
|
||||
const genForm = this.$refs.genInfo.$refs.genInfoForm;
|
||||
const basicForm = this.$refs.basicInfo.$refs.basicInfoForm
|
||||
const genForm = this.$refs.genInfo.$refs.genInfoForm
|
||||
Promise.all([basicForm, genForm].map(this.getFormPromise)).then(res => {
|
||||
const validateResult = res.every(item => !!item);
|
||||
const validateResult = res.every(item => !!item)
|
||||
if (validateResult) {
|
||||
const genTable = Object.assign({}, basicForm.model, genForm.model);
|
||||
genTable.columns = this.cloumns;
|
||||
const genTable = Object.assign({}, basicForm.model, genForm.model)
|
||||
genTable.columns = this.cloumns
|
||||
genTable.params = {
|
||||
treeCode: genTable.treeCode,
|
||||
treeName: genTable.treeName,
|
||||
treeParentCode: genTable.treeParentCode,
|
||||
parentMenuId: genTable.parentMenuId
|
||||
};
|
||||
}
|
||||
updateGenTable(genTable).then(res => {
|
||||
this.msgSuccess(res.msg);
|
||||
this.msgSuccess(res.msg)
|
||||
if (res.code === 200) {
|
||||
this.close();
|
||||
this.close()
|
||||
}
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.msgError("表单校验未通过,请重新检查提交内容");
|
||||
this.msgError('表单校验未通过,请重新检查提交内容')
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
getFormPromise (form) {
|
||||
return new Promise(resolve => {
|
||||
form.validate(res => {
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
resolve(res)
|
||||
})
|
||||
})
|
||||
},
|
||||
/** 关闭按钮 */
|
||||
close () {
|
||||
this.$store.dispatch("tagsView/delView", this.$route);
|
||||
this.$router.push({ path: "/tool/gen", query: { t: Date.now()}})
|
||||
this.$store.dispatch('tagsView/delView', this.$route)
|
||||
this.$router.push({ path: '/tool/gen', query: { t: Date.now() } })
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
const el = this.$refs.dragTable.$el.querySelectorAll(".el-table__body-wrapper > table > tbody")[0];
|
||||
const sortable = Sortable.create(el, {
|
||||
handle: ".allowDrag",
|
||||
const el = this.$refs.dragTable.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
|
||||
Sortable.create(el, {
|
||||
handle: '.allowDrag',
|
||||
onEnd: evt => {
|
||||
const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0];
|
||||
this.cloumns.splice(evt.newIndex, 0, targetRow);
|
||||
for (let index in this.cloumns) {
|
||||
this.cloumns[index].sort = parseInt(index) + 1;
|
||||
const targetRow = this.cloumns.splice(evt.oldIndex, 1)[0]
|
||||
this.cloumns.splice(evt.newIndex, 0, targetRow)
|
||||
for (const index in this.cloumns) {
|
||||
this.cloumns[index].sort = parseInt(index) + 1
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -92,7 +92,7 @@
|
||||
</el-form-item>
|
||||
</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">
|
||||
<span slot="label">
|
||||
自定义路径
|
||||
@ -115,7 +115,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-show="info.tplCategory == 'tree'">
|
||||
<el-row v-show="info.tplCategory === 'tree'">
|
||||
<h4 class="form-header">其他信息</h4>
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
@ -172,7 +172,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-show="info.tplCategory == 'sub'">
|
||||
<el-row v-show="info.tplCategory === 'sub'">
|
||||
<h4 class="form-header">关联信息</h4>
|
||||
<el-col :span="12">
|
||||
<el-form-item>
|
||||
@ -214,11 +214,11 @@
|
||||
</el-form>
|
||||
</template>
|
||||
<script>
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
import Treeselect from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
export default {
|
||||
name: "BasicInfoForm",
|
||||
name: 'BasicInfoForm',
|
||||
components: { Treeselect },
|
||||
props: {
|
||||
info: {
|
||||
@ -231,70 +231,73 @@ export default {
|
||||
},
|
||||
menus: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
subColumns: [],
|
||||
rules: {
|
||||
tplCategory: [
|
||||
{ required: true, message: "请选择生成模板", trigger: "blur" }
|
||||
{ required: true, message: '请选择生成模板', trigger: 'blur' }
|
||||
],
|
||||
packageName: [
|
||||
{ required: true, message: "请输入生成包路径", trigger: "blur" }
|
||||
{ required: true, message: '请输入生成包路径', trigger: 'blur' }
|
||||
],
|
||||
moduleName: [
|
||||
{ required: true, message: "请输入生成模块名", trigger: "blur" }
|
||||
{ required: true, message: '请输入生成模块名', trigger: 'blur' }
|
||||
],
|
||||
businessName: [
|
||||
{ required: true, message: "请输入生成业务名", trigger: "blur" }
|
||||
{ required: true, message: '请输入生成业务名', trigger: 'blur' }
|
||||
],
|
||||
functionName: [
|
||||
{ required: true, message: "请输入生成功能名", trigger: "blur" }
|
||||
],
|
||||
{ required: true, message: '请输入生成功能名', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
created () {
|
||||
},
|
||||
watch: {
|
||||
'info.subTableName': function (val) {
|
||||
this.setSubTableColumns(val);
|
||||
this.setSubTableColumns(val)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 转换菜单数据结构 */
|
||||
normalizer (node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
delete node.children
|
||||
}
|
||||
return {
|
||||
id: node.menuId,
|
||||
label: node.menuName,
|
||||
children: node.children
|
||||
};
|
||||
}
|
||||
},
|
||||
/** 选择子表名触发 */
|
||||
subSelectChange (value) {
|
||||
this.info.subTableFkName = '';
|
||||
this.info.subTableFkName = ''
|
||||
},
|
||||
/** 选择生成模板触发 */
|
||||
tplSelectChange (value) {
|
||||
if (value !== 'sub') {
|
||||
this.info.subTableName = '';
|
||||
this.info.subTableFkName = '';
|
||||
this.info.subTableName = ''
|
||||
this.info.subTableFkName = ''
|
||||
}
|
||||
},
|
||||
/** 设置关联外键 */
|
||||
setSubTableColumns (value) {
|
||||
for (var item in this.tables) {
|
||||
const name = this.tables[item].tableName;
|
||||
for (const item in this.tables) {
|
||||
const name = this.tables[item].tableName
|
||||
if (value === name) {
|
||||
this.subColumns = this.tables[item].columns;
|
||||
break;
|
||||
this.subColumns = this.tables[item].columns
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -49,7 +49,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDbTable, importTable } from "@/api/tool/gen";
|
||||
import { listDbTable, importTable } from '@/api/tool/gen'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
@ -68,50 +68,50 @@ export default {
|
||||
tableName: undefined,
|
||||
tableComment: undefined
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 显示弹框
|
||||
show () {
|
||||
this.getList();
|
||||
this.visible = true;
|
||||
this.getList()
|
||||
this.visible = true
|
||||
},
|
||||
clickRow (row) {
|
||||
this.$refs.table.toggleRowSelection(row);
|
||||
this.$refs.table.toggleRowSelection(row)
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.tables = selection.map(item => item.tableName);
|
||||
this.tables = selection.map(item => item.tableName)
|
||||
},
|
||||
// 查询表数据
|
||||
getList () {
|
||||
listDbTable(this.queryParams).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.dbTableList = res.rows;
|
||||
this.total = res.total;
|
||||
this.dbTableList = res.rows
|
||||
this.total = res.total
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
handleImportTable () {
|
||||
importTable({ tables: this.tables.join(",") }).then(res => {
|
||||
this.msgSuccess(res.msg);
|
||||
importTable({ tables: this.tables.join(',') }).then(res => {
|
||||
this.msgSuccess(res.msg)
|
||||
if (res.code === 200) {
|
||||
this.visible = false;
|
||||
this.$emit("ok");
|
||||
this.visible = false
|
||||
this.$emit('ok')
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -178,27 +178,27 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTable, previewTable, delTable, genCode, synchDb } from "@/api/tool/gen";
|
||||
import importTable from "./importTable";
|
||||
import { downLoadZip } from "@/utils/zipdownload";
|
||||
import hljs from "highlight.js/lib/highlight";
|
||||
import "highlight.js/styles/github-gist.css";
|
||||
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
|
||||
hljs.registerLanguage("xml", 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("javascript", require("highlight.js/lib/languages/javascript"));
|
||||
hljs.registerLanguage("sql", require("highlight.js/lib/languages/sql"));
|
||||
import { listTable, previewTable, delTable, genCode, synchDb } from '@/api/tool/gen'
|
||||
import importTable from './importTable'
|
||||
import { downLoadZip } from '@/utils/zipdownload'
|
||||
import hljs from 'highlight.js/lib/highlight'
|
||||
import 'highlight.js/styles/github-gist.css'
|
||||
hljs.registerLanguage('java', require('highlight.js/lib/languages/java'))
|
||||
hljs.registerLanguage('xml', 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('javascript', require('highlight.js/lib/languages/javascript'))
|
||||
hljs.registerLanguage('sql', require('highlight.js/lib/languages/sql'))
|
||||
|
||||
export default {
|
||||
name: "Gen",
|
||||
name: 'Gen',
|
||||
components: { importTable },
|
||||
data () {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 唯一标识符
|
||||
uniqueId: "",
|
||||
uniqueId: '',
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 选中表数组
|
||||
@ -214,7 +214,7 @@ export default {
|
||||
// 表数据
|
||||
tableList: [],
|
||||
// 日期范围
|
||||
dateRange: "",
|
||||
dateRange: '',
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@ -225,116 +225,116 @@ export default {
|
||||
// 预览参数
|
||||
preview: {
|
||||
open: false,
|
||||
title: "代码预览",
|
||||
title: '代码预览',
|
||||
data: {},
|
||||
activeName: "domain.java"
|
||||
activeName: 'domain.java'
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
created () {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
activated () {
|
||||
const time = this.$route.query.t;
|
||||
if (time != null && time != this.uniqueId) {
|
||||
this.uniqueId = time;
|
||||
this.resetQuery();
|
||||
const time = this.$route.query.t
|
||||
if (time !== null && time !== this.uniqueId) {
|
||||
this.uniqueId = time
|
||||
this.resetQuery()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 查询表集合 */
|
||||
getList () {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
listTable(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
|
||||
this.tableList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
this.tableList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery () {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 生成代码操作 */
|
||||
handleGenTable (row) {
|
||||
const tableNames = row.tableName || this.tableNames;
|
||||
if (tableNames == "") {
|
||||
this.msgError("请选择要生成的数据");
|
||||
return;
|
||||
const tableNames = row.tableName || this.tableNames
|
||||
if (tableNames === '') {
|
||||
this.msgError('请选择要生成的数据')
|
||||
return
|
||||
}
|
||||
if(row.genType === "1") {
|
||||
if (row.genType === '1') {
|
||||
genCode(row.tableName).then(response => {
|
||||
this.msgSuccess("成功生成到自定义路径:" + row.genPath);
|
||||
});
|
||||
this.msgSuccess('成功生成到自定义路径:' + row.genPath)
|
||||
})
|
||||
} else {
|
||||
downLoadZip("/tool/gen/batchGenCode?tables=" + tableNames, "ruoyi");
|
||||
downLoadZip('/tool/gen/batchGenCode?tables=' + tableNames, 'ruoyi')
|
||||
}
|
||||
},
|
||||
/** 同步数据库操作 */
|
||||
handleSynchDb (row) {
|
||||
const tableName = row.tableName;
|
||||
this.$confirm('确认要强制同步"' + tableName + '"表结构吗?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const tableName = row.tableName
|
||||
this.$confirm('确认要强制同步"' + tableName + '"表结构吗?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return synchDb(tableName);
|
||||
return synchDb(tableName)
|
||||
}).then(() => {
|
||||
this.msgSuccess("同步成功");
|
||||
}).catch(() => {});
|
||||
this.msgSuccess('同步成功')
|
||||
}).catch(() => {})
|
||||
},
|
||||
/** 打开导入表弹窗 */
|
||||
openImportTable () {
|
||||
this.$refs.import.show();
|
||||
this.$refs.import.show()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery () {
|
||||
this.dateRange = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.dateRange = []
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
/** 预览按钮 */
|
||||
handlePreview (row) {
|
||||
previewTable(row.tableId).then(response => {
|
||||
this.preview.data = response.data;
|
||||
this.preview.open = true;
|
||||
});
|
||||
this.preview.data = response.data
|
||||
this.preview.open = true
|
||||
})
|
||||
},
|
||||
/** 高亮显示 */
|
||||
highlightedCode (code, key) {
|
||||
const vmName = key.substring(key.lastIndexOf("/") + 1, key.indexOf(".vm"));
|
||||
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
|
||||
const result = hljs.highlight(language, code || "", true);
|
||||
return result.value || ' ';
|
||||
const vmName = key.substring(key.lastIndexOf('/') + 1, key.indexOf('.vm'))
|
||||
const language = vmName.substring(vmName.indexOf('.') + 1, vmName.length)
|
||||
const result = hljs.highlight(language, code || '', true)
|
||||
return result.value || ' '
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange (selection) {
|
||||
this.ids = selection.map(item => item.tableId);
|
||||
this.tableNames = selection.map(item => item.tableName);
|
||||
this.single = selection.length != 1;
|
||||
this.multiple = !selection.length;
|
||||
this.ids = selection.map(item => item.tableId)
|
||||
this.tableNames = selection.map(item => item.tableName)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleEditTable (row) {
|
||||
const tableId = row.tableId || this.ids[0];
|
||||
this.$router.push("/tool/gen-edit/index/" + tableId);
|
||||
const tableId = row.tableId || this.ids[0]
|
||||
this.$router.push('/tool/gen-edit/index/' + tableId)
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete (row) {
|
||||
const tableIds = row.tableId || this.ids;
|
||||
this.$confirm('是否确认删除表编号为"' + tableIds + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
const tableIds = row.tableId || this.ids
|
||||
this.$confirm('是否确认删除表编号为"' + tableIds + '"的数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
return delTable(tableIds);
|
||||
return delTable(tableIds)
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
this.getList()
|
||||
this.msgSuccess('删除成功')
|
||||
}).catch(() => {})
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -2,14 +2,14 @@
|
||||
<i-frame :src="url" />
|
||||
</template>
|
||||
<script>
|
||||
import iFrame from "@/components/iFrame/index";
|
||||
import iFrame from '@/components/iFrame/index'
|
||||
export default {
|
||||
name: "Swagger",
|
||||
name: 'Swagger',
|
||||
components: { iFrame },
|
||||
data () {
|
||||
return {
|
||||
url: process.env.VUE_APP_BASE_API + "/swagger-ui/index.html"
|
||||
};
|
||||
},
|
||||
};
|
||||
url: process.env.VUE_APP_BASE_API + '/swagger-ui/index.html'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -16,7 +16,7 @@ module.exports = {
|
||||
// 部署生产环境和开发环境下的URL。
|
||||
// 默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上
|
||||
// 例如 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)
|
||||
outputDir: 'dist',
|
||||
// 用于放置生成的静态资源 (js、css、img、fonts) 的;(项目打包之后,静态资源会放在这个文件夹下)
|
||||
|
Reference in New Issue
Block a user