首次 #1
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
||||
}
|
||||
}],
|
||||
"stage-2"
|
||||
],
|
||||
"plugins": ["transform-vue-jsx", "transform-runtime"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
@@ -0,0 +1,14 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
/dist/
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
@@ -0,0 +1,10 @@
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = {
|
||||
"plugins": {
|
||||
"postcss-import": {},
|
||||
"postcss-url": {},
|
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 lidonghui
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,3 +1,209 @@
|
||||
# Arbitrate-Frontend
|
||||
# vue搭建后台管理界面模版(PC端)
|
||||
------------------------
|
||||
|
||||
<img src="./static/gif.gif" width="100%" height="519px"/>
|
||||
|
||||
|
||||
#### 技术栈
|
||||
vue2 + vuex + vue-router + webpack + ES6/7 + axios + elementUI + 阿里图标iconfont
|
||||
|
||||
#### 项目预览
|
||||
[http://nmgwap.gitee.io/vueproject/#/login](http://nmgwap.gitee.io/vueproject/#/login)
|
||||
|
||||
|
||||
#### 说明
|
||||
|
||||
> 本项目主要用于熟悉如何用 vue2 架构一个后端管理平台项目
|
||||
|
||||
> 为了方便后期修改使用,模拟数据在页面中,具体修改看下面【强调】
|
||||
|
||||
> 如果对您有帮助,您可以点右上角 "Star" 支持一下 谢谢! ^_^
|
||||
|
||||
> 或者您可以 "follow" 一下,我会不断开源更多的有趣的项目
|
||||
|
||||
> 开发环境 w7 Chrome 61
|
||||
|
||||
> 如有问题请直接在 Issues 中提,或者您发现问题并有非常好的解决方案,欢迎 PR 👍
|
||||
|
||||
|
||||
#### 目录结构
|
||||
------------------------
|
||||
|
||||
```bash
|
||||
├── /build/ # 项目构建(webpack)相关配置
|
||||
├── /config/ # 项目开发环境配置
|
||||
├── /src/ # 源码目录
|
||||
│ ├── /api/ # 请求
|
||||
│ ├── /assets/ # 组件静态资源(图片)
|
||||
│ ├── /components/ # 公共组件
|
||||
| ├── /api/ # 请求接口
|
||||
│ ├── /router/ # 路由配置
|
||||
│ ├── /vuex/ # vuex状态管理
|
||||
│ ├── /views/ # 路由组件(页面维度)
|
||||
│ ├── /config/ # 接口配置文件(请求地址)
|
||||
│ ├── App.vue # 组件入口
|
||||
│ └── main.js # 程序入口
|
||||
├── /static/ # 非组件静态资源
|
||||
├── .babelrc # ES6语法编译配置
|
||||
├── .editorconfig # 定义代码格式
|
||||
├── .eslintignore # ES6规范忽略文件
|
||||
├── .eslintrc.js # ES6语法规范配置
|
||||
├── .gitignore # git忽略文件
|
||||
├── index.html # 页面入口
|
||||
├── package.json # 项目依赖
|
||||
└── README.md # 项目文档
|
||||
```
|
||||
|
||||
#### 强调
|
||||
|
||||
项目请求已经改为假数据,例如:
|
||||
``` bash
|
||||
// 模拟数据开始
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 12,
|
||||
data: [
|
||||
{
|
||||
addUser: '1',
|
||||
editUser: '1',
|
||||
addTime: null,
|
||||
editTime: 1527411068000,
|
||||
userId: 1,
|
||||
systemNo: 'pmd',
|
||||
userName: 'root',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '超级管理员',
|
||||
userSex: '女',
|
||||
userMobile: '138123456789',
|
||||
userEmail: '111@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.userData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// 获取用户列表
|
||||
// userList(parameter).then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.userData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
```
|
||||
把模拟数据开始到结束注释掉,下面解除注释即可,
|
||||
接口地址需要修改config/index.js文件 dev
|
||||
``` bash
|
||||
proxyTable: {
|
||||
'/api': {
|
||||
target: 'http://xxx.xxx.xxx.xxx:xxx', // 你请求的第三方接口
|
||||
changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
|
||||
pathRewrite: { // 路径重写,
|
||||
'^/api': '/api' // 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
```
|
||||
#### 完成功能
|
||||
- [x] 登录 -- 完成
|
||||
- [x] 路由拦截 -- 完成
|
||||
- [x] 商品管理(增加、编辑、搜索、删除) -- 完成
|
||||
- [x] 角色管理(增加、编辑、搜索、删除、权限管理) -- 完成
|
||||
- [x] 交易订单(增加、编辑、搜索、删除) -- 完成
|
||||
- [x] 用户管理(增加、编辑、搜索、删除、数据权限、刷新缓存) -- 完成
|
||||
- [x] 支付配置(增加、编辑、搜索、删除) -- 完成
|
||||
- [x] 系统环境变量(增加、编辑、搜索、删除) -- 完成
|
||||
- [x] 权限管理(增加、编辑、搜索、删除、配置权限) -- 完成
|
||||
- [x] 菜单管理(增加、编辑、搜索、删除) -- 完成
|
||||
- [x] 公司管理(增加、编辑、搜索、删除) -- 完成
|
||||
|
||||
|
||||
#### 部分截图
|
||||
------------------------
|
||||
|
||||
商品管理
|
||||

|
||||
|
||||
角色管理
|
||||

|
||||
|
||||
交易订单
|
||||

|
||||
|
||||
编辑
|
||||

|
||||
|
||||
用户管理
|
||||

|
||||
|
||||
支付配置
|
||||

|
||||
|
||||
展开与压缩
|
||||

|
||||
|
||||
|
||||
#### 运行项目
|
||||
------------------------
|
||||
|
||||
``` bash
|
||||
# install dependencies
|
||||
npm install
|
||||
|
||||
# serve with hot reload at localhost:8080
|
||||
npm run dev
|
||||
|
||||
# build for production with minification
|
||||
npm run build
|
||||
|
||||
# build for production and view the bundle analyzer report
|
||||
npm run build --report
|
||||
|
||||
# run unit tests
|
||||
npm run unit
|
||||
|
||||
# run e2e tests
|
||||
npm run e2e
|
||||
|
||||
# run all tests
|
||||
npm test
|
||||
|
||||
|
||||
```
|
||||
|
||||
#### 项目源码地址:
|
||||
------------------------
|
||||
|
||||
码云地址:https://gitee.com/ldhblog/vue-element.git
|
||||
github地址:https://github.com/nmgwap/vue-ManagementPlatform.git
|
||||
|
||||
|
||||
#### 微信公众号
|
||||
------------------------
|
||||
|
||||
<img src="/static/wx.jpg" width = "270" height = "270"/>
|
||||
|
||||
|
||||
|
||||
应用层PC端前端服务
|
||||
@@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
require('./check-versions')()
|
||||
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
const ora = require('ora')
|
||||
const rm = require('rimraf')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const webpackConfig = require('./webpack.prod.conf')
|
||||
|
||||
const spinner = ora('building for production...')
|
||||
spinner.start()
|
||||
|
||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||
if (err) throw err
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
spinner.stop()
|
||||
if (err) throw err
|
||||
process.stdout.write(stats.toString({
|
||||
colors: true,
|
||||
modules: false,
|
||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||
chunks: false,
|
||||
chunkModules: false
|
||||
}) + '\n\n')
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.log(chalk.red(' Build failed with errors.\n'))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(chalk.cyan(' Build complete.\n'))
|
||||
console.log(chalk.yellow(
|
||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||
' Opening index.html over file:// won\'t work.\n'
|
||||
))
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const chalk = require('chalk')
|
||||
const semver = require('semver')
|
||||
const packageConfig = require('../package.json')
|
||||
const shell = require('shelljs')
|
||||
|
||||
function exec (cmd) {
|
||||
return require('child_process').execSync(cmd).toString().trim()
|
||||
}
|
||||
|
||||
const versionRequirements = [
|
||||
{
|
||||
name: 'node',
|
||||
currentVersion: semver.clean(process.version),
|
||||
versionRequirement: packageConfig.engines.node
|
||||
}
|
||||
]
|
||||
|
||||
if (shell.which('npm')) {
|
||||
versionRequirements.push({
|
||||
name: 'npm',
|
||||
currentVersion: exec('npm --version'),
|
||||
versionRequirement: packageConfig.engines.npm
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
const warnings = []
|
||||
|
||||
for (let i = 0; i < versionRequirements.length; i++) {
|
||||
const mod = versionRequirements[i]
|
||||
|
||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||
warnings.push(mod.name + ': ' +
|
||||
chalk.red(mod.currentVersion) + ' should be ' +
|
||||
chalk.green(mod.versionRequirement)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (warnings.length) {
|
||||
console.log('')
|
||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||
console.log()
|
||||
|
||||
for (let i = 0; i < warnings.length; i++) {
|
||||
const warning = warnings[i]
|
||||
console.log(' ' + warning)
|
||||
}
|
||||
|
||||
console.log()
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const config = require('../config')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const packageConfig = require('../package.json')
|
||||
|
||||
exports.assetsPath = function(_path) {
|
||||
const assetsSubDirectory = process.env.NODE_ENV === 'production' ?
|
||||
config.build.assetsSubDirectory :
|
||||
config.dev.assetsSubDirectory
|
||||
|
||||
return path.posix.join(assetsSubDirectory, _path)
|
||||
}
|
||||
|
||||
exports.cssLoaders = function(options) {
|
||||
options = options || {}
|
||||
|
||||
const cssLoader = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
const postcssLoader = {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
// generate loader string to be used with extract text plugin
|
||||
function generateLoaders(loader, loaderOptions) {
|
||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
|
||||
|
||||
if (loader) {
|
||||
loaders.push({
|
||||
loader: loader + '-loader',
|
||||
options: Object.assign({}, loaderOptions, {
|
||||
sourceMap: options.sourceMap
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Extract CSS when that option is specified
|
||||
// (which is the case during production build)
|
||||
if (options.extract) {
|
||||
return ExtractTextPlugin.extract({
|
||||
use: loaders,
|
||||
publicPath: '../../',
|
||||
fallback: 'vue-style-loader'
|
||||
})
|
||||
} else {
|
||||
return ['vue-style-loader'].concat(loaders)
|
||||
}
|
||||
}
|
||||
|
||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||
return {
|
||||
css: generateLoaders(),
|
||||
postcss: generateLoaders(),
|
||||
less: generateLoaders('less'),
|
||||
sass: generateLoaders('sass', { indentedSyntax: true }),
|
||||
scss: generateLoaders('sass'),
|
||||
stylus: generateLoaders('stylus'),
|
||||
styl: generateLoaders('stylus')
|
||||
}
|
||||
}
|
||||
|
||||
// Generate loaders for standalone style files (outside of .vue)
|
||||
exports.styleLoaders = function(options) {
|
||||
const output = []
|
||||
const loaders = exports.cssLoaders(options)
|
||||
|
||||
for (const extension in loaders) {
|
||||
const loader = loaders[extension]
|
||||
output.push({
|
||||
test: new RegExp('\\.' + extension + '$'),
|
||||
use: loader
|
||||
})
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
exports.createNotifierCallback = () => {
|
||||
const notifier = require('node-notifier')
|
||||
|
||||
return (severity, errors) => {
|
||||
if (severity !== 'error') return
|
||||
|
||||
const error = errors[0]
|
||||
const filename = error.file && error.file.split('!').pop()
|
||||
|
||||
notifier.notify({
|
||||
title: packageConfig.name,
|
||||
message: severity + ': ' + error.name,
|
||||
subtitle: filename || '',
|
||||
icon: path.join(__dirname, 'logo.png')
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
const sourceMapEnabled = isProduction
|
||||
? config.build.productionSourceMap
|
||||
: config.dev.cssSourceMap
|
||||
|
||||
module.exports = {
|
||||
loaders: utils.cssLoaders({
|
||||
sourceMap: sourceMapEnabled,
|
||||
extract: isProduction
|
||||
}),
|
||||
cssSourceMap: sourceMapEnabled,
|
||||
cacheBusting: config.dev.cacheBusting,
|
||||
transformToRequire: {
|
||||
video: ['src', 'poster'],
|
||||
source: 'src',
|
||||
img: 'src',
|
||||
image: 'xlink:href'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, '../'),
|
||||
entry: {
|
||||
app: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: '[name].js',
|
||||
publicPath: process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsPublicPath
|
||||
: config.dev.assetsPublicPath
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: {
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'@': resolve('src'),
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: vueLoaderConfig
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
node: {
|
||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||
// source contains it (although only uses it if it's native).
|
||||
setImmediate: false,
|
||||
// prevent webpack from injecting mocks to Node native modules
|
||||
// that does not make sense for the client
|
||||
dgram: 'empty',
|
||||
fs: 'empty',
|
||||
net: 'empty',
|
||||
tls: 'empty',
|
||||
child_process: 'empty'
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||
const portfinder = require('portfinder')
|
||||
|
||||
const HOST = process.env.HOST
|
||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||
|
||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
||||
},
|
||||
// cheap-module-eval-source-map is faster for development
|
||||
devtool: config.dev.devtool,
|
||||
|
||||
// these devServer options should be customized in /config/index.js
|
||||
devServer: {
|
||||
clientLogLevel: 'warning',
|
||||
historyApiFallback: {
|
||||
rewrites: [
|
||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
||||
],
|
||||
},
|
||||
hot: true,
|
||||
contentBase: false, // since we use CopyWebpackPlugin.
|
||||
compress: true,
|
||||
host: HOST || config.dev.host,
|
||||
port: PORT || config.dev.port,
|
||||
open: config.dev.autoOpenBrowser,
|
||||
overlay: config.dev.errorOverlay ? { warnings: false, errors: true } : false,
|
||||
publicPath: config.dev.assetsPublicPath,
|
||||
proxy: config.dev.proxyTable,
|
||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||
watchOptions: {
|
||||
poll: config.dev.poll,
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': require('../config/dev.env')
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
// https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: 'index.html',
|
||||
inject: true,
|
||||
favicon: './favicon.ico'
|
||||
}),
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.dev.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}])
|
||||
]
|
||||
})
|
||||
|
||||
module.exports = new Promise((resolve, reject) => {
|
||||
portfinder.basePort = process.env.PORT || config.dev.port
|
||||
portfinder.getPort((err, port) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
// publish the new Port, necessary for e2e tests
|
||||
process.env.PORT = port
|
||||
// add port to devServer config
|
||||
devWebpackConfig.devServer.port = port
|
||||
|
||||
// Add FriendlyErrorsPlugin
|
||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
||||
},
|
||||
onErrors: config.dev.notifyOnErrors ?
|
||||
utils.createNotifierCallback() : undefined
|
||||
}))
|
||||
|
||||
resolve(devWebpackConfig)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,145 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const env = require('../config/prod.env')
|
||||
|
||||
const webpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
extract: true,
|
||||
usePostCSS: true
|
||||
})
|
||||
},
|
||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||
},
|
||||
plugins: [
|
||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': env
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
},
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
parallel: true
|
||||
}),
|
||||
// extract css into its own file
|
||||
new ExtractTextPlugin({
|
||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||
allChunks: true,
|
||||
}),
|
||||
// Compress extracted CSS. We are using this plugin so that possible
|
||||
// duplicated CSS from different components can be deduped.
|
||||
new OptimizeCSSPlugin({
|
||||
cssProcessorOptions: config.build.productionSourceMap
|
||||
? { safe: true, map: { inline: false } }
|
||||
: { safe: true }
|
||||
}),
|
||||
// generate dist index.html with correct asset hash for caching.
|
||||
// you can customize output by editing /index.html
|
||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: config.build.index,
|
||||
template: 'index.html',
|
||||
inject: true,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true
|
||||
// more options:
|
||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||
},
|
||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||
chunksSortMode: 'dependency'
|
||||
}),
|
||||
// keep module.id stable when vendor modules does not change
|
||||
new webpack.HashedModuleIdsPlugin(),
|
||||
// enable scope hoisting
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks (module) {
|
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return (
|
||||
module.resource &&
|
||||
/\.js$/.test(module.resource) &&
|
||||
module.resource.indexOf(
|
||||
path.join(__dirname, '../node_modules')
|
||||
) === 0
|
||||
)
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
}),
|
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'app',
|
||||
async: 'vendor-async',
|
||||
children: true,
|
||||
minChunks: 3
|
||||
}),
|
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.build.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
if (config.build.productionGzip) {
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new CompressionWebpackPlugin({
|
||||
asset: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: new RegExp(
|
||||
'\\.(' +
|
||||
config.build.productionGzipExtensions.join('|') +
|
||||
')$'
|
||||
),
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (config.build.bundleAnalyzerReport) {
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
||||
@@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
})
|
||||
@@ -0,0 +1,77 @@
|
||||
'use strict'
|
||||
// Template version: 1.3.1
|
||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
||||
|
||||
const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
dev: {
|
||||
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {
|
||||
'/api': {
|
||||
target: 'http://xxx.xxx.xxx.xxx:xxx', // 你请求的第三方接口
|
||||
changeOrigin: true, // 在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
|
||||
pathRewrite: { // 路径重写,
|
||||
'^/api': '/api' // 替换target中的请求地址,也就是说以后你在请求http://api.jisuapi.com/XXXXX这个地址的时候直接写成/api即可。
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: true,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
|
||||
// If you have problems debugging vue-files in devtools,
|
||||
// set this to false - it *may* help
|
||||
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
||||
cacheBusting: true,
|
||||
|
||||
cssSourceMap: true
|
||||
},
|
||||
|
||||
build: {
|
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../dist/index.html'),
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: './',
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
*/
|
||||
|
||||
productionSourceMap: true,
|
||||
// https://webpack.js.org/configuration/devtool/#production
|
||||
devtool: '#source-map',
|
||||
|
||||
// Gzip off by default as many popular static hosts such as
|
||||
// Surge or Netlify already gzip all static assets for you.
|
||||
// Before setting to `true`, make sure to:
|
||||
// npm install --save-dev compression-webpack-plugin
|
||||
productionGzip: false,
|
||||
productionGzipExtensions: ['js', 'css'],
|
||||
|
||||
// Run the build command with an extra argument to
|
||||
// View the bundle analyzer report after build finishes:
|
||||
// `npm run build --report`
|
||||
// Set to `true` or `false` to always turn it on or off
|
||||
bundleAnalyzerReport: process.env.npm_config_report
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"'
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"editor.tabSize": 2,
|
||||
"files.associations": {
|
||||
"*.vue": "vue"
|
||||
},
|
||||
"eslint.autoFixOnSave": true,
|
||||
"eslint.options": {
|
||||
"extensions": [
|
||||
".js",
|
||||
".vue"
|
||||
]
|
||||
},
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"vue",
|
||||
"vue-html"
|
||||
],
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/bower_components": true,
|
||||
"**/dist": true
|
||||
},
|
||||
"emmet.syntaxProfiles": {
|
||||
"javascript": "jsx",
|
||||
"vue": "html",
|
||||
"vue-html": "html"
|
||||
},
|
||||
"git.confirmSync": false,
|
||||
"window.zoomLevel": 0,
|
||||
"vsicons.projectDetection.autoReload": true,
|
||||
"typescript.check.tscVersion": false,
|
||||
"editor.renderWhitespace": "boundary",
|
||||
"editor.cursorBlinking": "smooth",
|
||||
"workbench.colorTheme": "Solarized Light",
|
||||
"workbench.iconTheme": "vscode-great-icons",
|
||||
"editor.minimap.enabled": true,
|
||||
"editor.minimap.renderCharacters": false,
|
||||
"tslint.autoFixOnSave": true,
|
||||
"editor.fontFamily": "'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'",
|
||||
"beautify.tabSize": 2,
|
||||
"window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
|
||||
"typescript.extension.sortImports.maxNamedImportsInSingleLine": 5,
|
||||
"typescript.extension.sortImports.omitSemicolon": true,
|
||||
"editor.codeLens": true,
|
||||
"editor.snippetSuggestions": "top",
|
||||
"react-native-storybooks.port": 6006
|
||||
}
|
||||
|
After Width: | Height: | Size: 946 B |
@@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<!-- 页面增加icon图标 -->
|
||||
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" rel="external nofollow" />
|
||||
<title>后端管理平台</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- built files will be auto injected -->
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "vue-ele-project",
|
||||
"version": "1.0.0",
|
||||
"description": "vue-ele-project",
|
||||
"author": "lidonghui",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
||||
"start": "npm run dev",
|
||||
"build": "node build/build.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"echarts": "^4.2.0-rc.2",
|
||||
"element-ui": "^2.3.2",
|
||||
"http-proxy-middleware": "^0.18.0",
|
||||
"js-md5": "^0.7.3",
|
||||
"vue": "^2.5.2",
|
||||
"vue-router": "^3.0.1",
|
||||
"vuex": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^7.1.2",
|
||||
"axios": "^0.18.0",
|
||||
"babel-core": "^6.22.1",
|
||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
||||
"babel-loader": "^7.1.1",
|
||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
||||
"babel-plugin-transform-runtime": "^6.22.0",
|
||||
"babel-plugin-transform-vue-jsx": "^3.5.0",
|
||||
"babel-preset-env": "^1.3.2",
|
||||
"babel-preset-stage-2": "^6.22.0",
|
||||
"chalk": "^2.0.1",
|
||||
"copy-webpack-plugin": "^4.0.1",
|
||||
"css-loader": "^0.28.0",
|
||||
"extract-text-webpack-plugin": "^3.0.0",
|
||||
"file-loader": "^1.1.4",
|
||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
||||
"html-webpack-plugin": "^2.30.1",
|
||||
"node-notifier": "^5.1.2",
|
||||
"optimize-css-assets-webpack-plugin": "^3.2.0",
|
||||
"ora": "^1.2.0",
|
||||
"portfinder": "^1.0.13",
|
||||
"postcss-import": "^11.0.0",
|
||||
"postcss-loader": "^2.0.8",
|
||||
"postcss-url": "^7.2.1",
|
||||
"rimraf": "^2.6.0",
|
||||
"semver": "^5.3.0",
|
||||
"shelljs": "^0.7.6",
|
||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
||||
"url-loader": "^0.5.8",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-style-loader": "^3.0.1",
|
||||
"vue-template-compiler": "^2.5.2",
|
||||
"webpack": "^3.6.0",
|
||||
"webpack-bundle-analyzer": "^2.9.0",
|
||||
"webpack-dev-server": "^2.9.1",
|
||||
"webpack-merge": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not ie <= 8"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel="shortcut icon" type=image/x-icon href=./favicon.ico rel="external nofollow"><title>后端管理平台</title><link href=./static/css/app.f7de60d9ec9c07c112d0b94c59208a0e.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.e37fbe972401a2962be8.js></script><script type=text/javascript src=./static/js/app.656e0752769862c0c376.js></script></body></html>
|
||||
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 79 KiB |
@@ -0,0 +1,2 @@
|
||||
!function(r){var n=window.webpackJsonp;window.webpackJsonp=function(e,u,c){for(var f,i,p,a=0,l=[];a<e.length;a++)i=e[a],o[i]&&l.push(o[i][0]),o[i]=0;for(f in u)Object.prototype.hasOwnProperty.call(u,f)&&(r[f]=u[f]);for(n&&n(e,u,c);l.length;)l.shift()();if(c)for(a=0;a<c.length;a++)p=t(t.s=c[a]);return p};var e={},o={2:0};function t(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return r[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=r,t.c=e,t.d=function(r,n,e){t.o(r,n)||Object.defineProperty(r,n,{configurable:!1,enumerable:!0,get:e})},t.n=function(r){var n=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(n,"a",n),n},t.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},t.p="./",t.oe=function(r){throw console.error(r),r}}([]);
|
||||
//# sourceMappingURL=manifest.3ad1d5771e9b13dbdad2.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["webpack:///webpack/bootstrap 2339051ff345deb5e9a9"],"names":["parentJsonpFunction","window","chunkIds","moreModules","executeModules","moduleId","chunkId","result","i","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","call","modules","shift","__webpack_require__","s","installedModules","2","exports","module","l","m","c","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","p","oe","err","console","error"],"mappings":"aACA,IAAAA,EAAAC,OAAA,aACAA,OAAA,sBAAAC,EAAAC,EAAAC,GAIA,IADA,IAAAC,EAAAC,EAAAC,EAAAC,EAAA,EAAAC,KACQD,EAAAN,EAAAQ,OAAoBF,IAC5BF,EAAAJ,EAAAM,GACAG,EAAAL,IACAG,EAAAG,KAAAD,EAAAL,GAAA,IAEAK,EAAAL,GAAA,EAEA,IAAAD,KAAAF,EACAU,OAAAC,UAAAC,eAAAC,KAAAb,EAAAE,KACAY,EAAAZ,GAAAF,EAAAE,IAIA,IADAL,KAAAE,EAAAC,EAAAC,GACAK,EAAAC,QACAD,EAAAS,OAAAT,GAEA,GAAAL,EACA,IAAAI,EAAA,EAAYA,EAAAJ,EAAAM,OAA2BF,IACvCD,EAAAY,IAAAC,EAAAhB,EAAAI,IAGA,OAAAD,GAIA,IAAAc,KAGAV,GACAW,EAAA,GAIA,SAAAH,EAAAd,GAGA,GAAAgB,EAAAhB,GACA,OAAAgB,EAAAhB,GAAAkB,QAGA,IAAAC,EAAAH,EAAAhB,IACAG,EAAAH,EACAoB,GAAA,EACAF,YAUA,OANAN,EAAAZ,GAAAW,KAAAQ,EAAAD,QAAAC,IAAAD,QAAAJ,GAGAK,EAAAC,GAAA,EAGAD,EAAAD,QAKAJ,EAAAO,EAAAT,EAGAE,EAAAQ,EAAAN,EAGAF,EAAAS,EAAA,SAAAL,EAAAM,EAAAC,GACAX,EAAAY,EAAAR,EAAAM,IACAhB,OAAAmB,eAAAT,EAAAM,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMAX,EAAAiB,EAAA,SAAAZ,GACA,IAAAM,EAAAN,KAAAa,WACA,WAA2B,OAAAb,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAL,EAAAS,EAAAE,EAAA,IAAAA,GACAA,GAIAX,EAAAY,EAAA,SAAAO,EAAAC,GAAsD,OAAA1B,OAAAC,UAAAC,eAAAC,KAAAsB,EAAAC,IAGtDpB,EAAAqB,EAAA,KAGArB,EAAAsB,GAAA,SAAAC,GAA8D,MAApBC,QAAAC,MAAAF,GAAoBA","file":"static/js/manifest.3ad1d5771e9b13dbdad2.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId]) {\n \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n \t\t\t}\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t\t}\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n \t\twhile(resolves.length) {\n \t\t\tresolves.shift()();\n \t\t}\n \t\tif(executeModules) {\n \t\t\tfor(i=0; i < executeModules.length; i++) {\n \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n \t\t\t}\n \t\t}\n \t\treturn result;\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// objects to store loaded and loading chunks\n \tvar installedChunks = {\n \t\t2: 0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"./\";\n\n \t// on error function for async loading\n \t__webpack_require__.oe = function(err) { console.error(err); throw err; };\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 2339051ff345deb5e9a9"],"sourceRoot":""}
|
||||
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 61 KiB |
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "App"
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html,
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
#app {
|
||||
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
color: #2c3e50;
|
||||
widows: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,58 @@
|
||||
import axios from 'axios';
|
||||
|
||||
// 登录请求方法
|
||||
const loginreq = (method, url, params) => {
|
||||
return axios({
|
||||
method: method,
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
data: params,
|
||||
traditional: true,
|
||||
transformRequest: [
|
||||
function(data) {
|
||||
let ret = ''
|
||||
for (let it in data) {
|
||||
ret +=
|
||||
encodeURIComponent(it) +
|
||||
'=' +
|
||||
encodeURIComponent(data[it]) +
|
||||
'&'
|
||||
}
|
||||
return ret
|
||||
}
|
||||
]
|
||||
}).then(res => res.data);
|
||||
};
|
||||
// 通用公用方法
|
||||
const req = (method, url, params) => {
|
||||
return axios({
|
||||
method: method,
|
||||
url: url,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
data: params,
|
||||
traditional: true,
|
||||
transformRequest: [
|
||||
function(data) {
|
||||
let ret = ''
|
||||
for (let it in data) {
|
||||
ret +=
|
||||
encodeURIComponent(it) +
|
||||
'=' +
|
||||
encodeURIComponent(data[it]) +
|
||||
'&'
|
||||
}
|
||||
return ret
|
||||
}
|
||||
]
|
||||
}).then(res => res.data);
|
||||
};
|
||||
|
||||
export {
|
||||
loginreq,
|
||||
req
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import axios from 'axios';
|
||||
import { req } from './axiosFun';
|
||||
|
||||
/**
|
||||
* 商品管理
|
||||
**/
|
||||
// 商品管理-获取商品管理列表
|
||||
export const GoodsList = (params) => { return req("post", "/api/Goods/list", params) };
|
||||
// 商品管理-保存商品管理
|
||||
export const GoodsSave = (params) => { return req("post", "/api/Goods/save", params) };
|
||||
// 商品管理-删除商品管理
|
||||
export const GoodsDelete = (params) => { return axios.delete("/api/Goods/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 机器信息管理
|
||||
**/
|
||||
// 机器信息管理-获取机器信息管理列表
|
||||
export const MachineList = (params) => { return req("post", "/api/Machine/list", params) };
|
||||
// 机器信息管理-保存机器信息管理
|
||||
export const MachineSave = (params) => { return req("post", "/api/Machine/save", params) };
|
||||
// 机器信息管理-删除机器信息管理
|
||||
export const MachineDelete = (params) => { return axios.delete("/api/Machine/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 货道信息管理
|
||||
**/
|
||||
// 货道信息管理-获取获取货道信息管理列表
|
||||
export const MachineAisleList = (params) => { return req("post", "/api/MachineAisle/list", params) };
|
||||
// 货道信息管理-删除货道信息管理
|
||||
export const MachineAisleDelete = (params) => { return axios.delete("/api/MachineAisle/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 货道信息管理-保存货道信息管理
|
||||
export const MachineAisleRsave = (params) => { return req("post", "/api/MachineAisle/save", params) };
|
||||
@@ -0,0 +1,32 @@
|
||||
import axios from 'axios';
|
||||
import { req } from './axiosFun';
|
||||
|
||||
/**
|
||||
* 支付配置信息
|
||||
**/
|
||||
// 支付配置信息-获取支付配置信息列表
|
||||
export const MachineConfigList = (params) => { return req("post", "/api/MachineConfig/list", params) };
|
||||
// 支付配置信息-保存支付配置信息
|
||||
export const MachineConfigSave = (params) => { return req("post", "/api/MachineConfig/save", params) };
|
||||
// 支付配置信息-删除支付配置信息
|
||||
export const MachineConfigDelete = (params) => { return axios.delete("/api/MachineConfig/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 支付配置
|
||||
**/
|
||||
// 支付配置-获取支付配置列表
|
||||
export const ConfigList = (params) => { return req("post", "/api/Config/list", params) };
|
||||
// 支付配置-保存支付配置
|
||||
export const ConfigSave = (params) => { return req("post", "/api/Config/save", params) };
|
||||
// 支付配置-删除支付配置
|
||||
export const ConfigDelete = (params) => { return axios.delete("/api/Config/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 订单管理-交易订单
|
||||
**/
|
||||
// 交易订单-获取交易订单列表
|
||||
export const OrderList = (params) => { return req("post", "/api/Order/list", params) };
|
||||
// 交易订单-s删除交易订单
|
||||
export const OrderDelete = (params) => { return axios.delete("/api/Order/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 交易订单-交易订单退款
|
||||
export const OrderRefund = (params) => { return req("post", "/api/Order/refund", params) };
|
||||
@@ -0,0 +1,97 @@
|
||||
import axios from 'axios';
|
||||
import { loginreq, req } from './axiosFun';
|
||||
|
||||
// 登录接口
|
||||
export const login = (params) => { return loginreq("post", "/api/login", params) };
|
||||
// 获取用户菜单
|
||||
export const menu = (params) => { return axios.get("/api/menu?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 退出接口
|
||||
export const loginout = () => { return axios.delete("/api/login?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 用户管理
|
||||
**/
|
||||
// 用户管理-获取用户列表
|
||||
export const userList = (params) => { return req("post", "/api/User/list", params) };
|
||||
// 用户管理-保存(添加编辑)
|
||||
export const userSave = (params) => { return req("post", "/api/User/save", params) };
|
||||
// 用户管理-删除用户
|
||||
export const userDelete = (params) => { return axios.delete("/api/User/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 用户管理-重置密码
|
||||
export const userPwd = (params) => { return req("post", "/api/User/pwd", params) };
|
||||
// 用户管理-修改状态
|
||||
export const userLock = (params) => { return axios.get("/api/User/lock?userId=" + params.userId + "&lock=" + params.lock + "&token=" + localStorage.getItem('logintoken')) };
|
||||
// 用户管理-数据权限
|
||||
export const UserDeptTree = (params) => { return axios.get("/api/UserDept/tree/" + params + "?token=" + localStorage.getItem('logintoken')) };
|
||||
// 用户管理-数据权限保存
|
||||
export const UserDeptSave = (params) => { return req("post", "/api/UserDept/save", params) };
|
||||
// 用户管理-获取部门设置
|
||||
export const UserDeptdeptTree = (params) => { return axios.get("/api/UserDept/deptTree/" + params + "?token=" + localStorage.getItem('logintoken')) };
|
||||
// 用户管理-保存部门设置
|
||||
export const UserChangeDept = (params) => { return req("post", "/api/User/change/dept", params) };
|
||||
// 用户管理-用户下线
|
||||
export const userExpireToken = (params) => { return req("get", "/api/User/expireToken/" + params, {}) };
|
||||
// 用户管理-刷新缓存
|
||||
export const userFlashCache = (params) => { return req("get", "/api/User/flashCache/" + params, {}) };
|
||||
|
||||
/**
|
||||
* 菜单管理
|
||||
**/
|
||||
// 菜单管理-获取菜单Module/list
|
||||
export const ModuleList = () => { return req("post", "/api/Module/list") };
|
||||
// 菜单管理-根据菜单获取数据
|
||||
export const ModuleGet = (params) => { return axios.get("/api/Module/get/" + params + "?token=" + localStorage.getItem('logintoken')) };
|
||||
// 菜单管理-获取父级菜单Module/nodes
|
||||
export const ModuleNodes = (params) => { return req("post", "/api/Module/nodes", params) };
|
||||
// 菜单管理-修改菜单
|
||||
export const ModuleSave = (params) => { return req("post", "/api/Module/save", params) };
|
||||
// 菜单管理-删除菜单
|
||||
export const ModuleDelete = (params) => { return axios.delete("/api/Module/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 角色管理
|
||||
**/
|
||||
// 角色管理-获取角色列表
|
||||
export const roleList = (params) => { return req("post", "/api/Role/list", params) };
|
||||
// 角色管理-保存(添加编辑)
|
||||
export const roleSave = (params) => { return req("post", "/api/Role/save", params) };
|
||||
// 角色管理-删除角色
|
||||
export const roleDelete = (params) => { return axios.delete("/api/Role/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 角色管理-菜单权限(获取)
|
||||
export const RoleRightTree = (params) => { return axios.get("/api/RoleRight/tree/" + params + "?token=" + localStorage.getItem('logintoken')) };
|
||||
// 角色管理-菜单权限(保存)
|
||||
export const RoleRightSave = (params) => { return req("post", "/api/RoleRight/save", params) };
|
||||
|
||||
/**
|
||||
* 公司管理
|
||||
**/
|
||||
// 公司管理-获取公司列表
|
||||
export const deptList = (params) => { return req("post", "/api/Dept/list", params) };
|
||||
// 公司管理-保存(添加编辑)
|
||||
export const deptSave = (params) => { return req("post", "/api/Dept/save", params) };
|
||||
// 公司管理-删除公司
|
||||
export const deptDelete = (params) => { return axios.get("/api/Dept/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 系统环境变量
|
||||
**/
|
||||
// 系统环境变量-获取系统环境变量列表
|
||||
export const variableList = (params) => { return req("post", "/api/Variable/list", params) };
|
||||
// 系统环境变量-保存(添加编辑)
|
||||
export const variableSave = (params) => { return req("post", "/api/Variable/save", params) };
|
||||
// 系统环境变量-删除系统环境变量
|
||||
export const variableDelete = (params) => { return axios.delete("/api/Variable/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
|
||||
/**
|
||||
* 权限管理
|
||||
**/
|
||||
// 权限管理-获取权限列表
|
||||
export const permissionList = (params) => { return req("post", "/api/Permission/list", params) };
|
||||
// 权限管理-保存权限
|
||||
export const ermissionSave = (params) => { return req("post", "/api/Permission/save", params) };
|
||||
// 权限管理-删除权限
|
||||
export const ermissionDelete = (params) => { return axios.delete("/api/Permission/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 权限管理-获取权限
|
||||
export const roleDropDown = () => { return axios.get("/api/Role/dropDown/all?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
|
||||
// 权限管理-配置权限
|
||||
export const RolePermission = (params) => { return req("post", "/api/RolePermission/save", params) };
|
||||
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 196 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 300 B |
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* 分页组件
|
||||
*/
|
||||
<template>
|
||||
<el-pagination class="page-box" @size-change="handleSizeChange" @current-change="handleCurrentChange" background :current-page="childMsg.currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="childMsg.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="childMsg.total">
|
||||
</el-pagination>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'Pagination',
|
||||
props: ['childMsg'],
|
||||
data() {
|
||||
return {
|
||||
pageparm: {
|
||||
currentPage: this.childMsg.currentPage,
|
||||
pageSize: this.childMsg.pageSize
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
handleSizeChange(val) {
|
||||
/**
|
||||
* 子传父
|
||||
* 参数1 父元素方法
|
||||
* 参数2 数据
|
||||
*/
|
||||
this.pageparm.pageSize = val
|
||||
this.$emit('callFather', this.pageparm)
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
/**
|
||||
* 子传父
|
||||
* 参数1 父元素方法
|
||||
* 参数2 数据
|
||||
*/
|
||||
this.pageparm.currentPage = val
|
||||
this.$emit('callFather', this.pageparm)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page-box {
|
||||
margin: 10px auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 404
|
||||
*/
|
||||
<template>
|
||||
<div class="page-404">
|
||||
<h1>404!</h1>
|
||||
<h2>Sorry, page not found</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page-404 {
|
||||
text-align: center;
|
||||
}
|
||||
.page-404 h1 {
|
||||
font-size: 98px;
|
||||
font-weight: 700;
|
||||
line-height: 150px;
|
||||
text-shadow: rgba(61, 61, 61, 0.3) 1px 1px, rgba(61, 61, 61, 0.2) 2px 2px,
|
||||
rgba(61, 61, 61, 0.3) 3px 3px;
|
||||
}
|
||||
.page-404 h2 {
|
||||
line-height: 30px;
|
||||
font-size: 30px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,226 @@
|
||||
/**
|
||||
* 左边菜单
|
||||
*/
|
||||
<template>
|
||||
<el-menu default-active="2" :collapse="collapsed" collapse-transition router :default-active="$route.path" unique-opened class="el-menu-vertical-demo" background-color="#334157" text-color="#fff" active-text-color="#ffd04b">
|
||||
<div class="logobox">
|
||||
<img class="logoimg" src="../assets/img/logo.png" alt="">
|
||||
</div>
|
||||
<el-submenu v-for="menu in allmenu" :key="menu.menuid" :index="menu.menuname">
|
||||
<template slot="title">
|
||||
<i class="iconfont" :class="menu.icon"></i>
|
||||
<span>{{menu.menuname}}</span>
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<el-menu-item v-for="chmenu in menu.menus" :index="'/'+chmenu.url" :key="chmenu.menuid">
|
||||
<i class="iconfont" :class="chmenu.icon"></i>
|
||||
<span>{{chmenu.menuname}}</span>
|
||||
</el-menu-item>
|
||||
</el-menu-item-group>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</template>
|
||||
<script>
|
||||
import { menu } from '../api/userMG'
|
||||
export default {
|
||||
name: 'leftnav',
|
||||
data() {
|
||||
return {
|
||||
collapsed: false,
|
||||
allmenu: []
|
||||
}
|
||||
},
|
||||
// 创建完毕状态(里面是操作)
|
||||
created() {
|
||||
// 获取图形验证码
|
||||
let res = {
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
menuid: 1,
|
||||
icon: 'li-icon-xiangmuguanli',
|
||||
menuname: '基础管理',
|
||||
hasThird: null,
|
||||
url: null,
|
||||
menus: [
|
||||
{
|
||||
menuid: 2,
|
||||
icon: 'icon-cat-skuQuery',
|
||||
menuname: '商品管理',
|
||||
hasThird: 'N',
|
||||
url: 'goods/Goods',
|
||||
menus: null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
menuid: 33,
|
||||
icon: 'li-icon-dingdanguanli',
|
||||
menuname: '订单管理',
|
||||
hasThird: null,
|
||||
url: null,
|
||||
menus: [
|
||||
{
|
||||
menuid: 34,
|
||||
icon: 'icon-order-manage',
|
||||
menuname: '交易订单',
|
||||
hasThird: 'N',
|
||||
url: 'pay/Order',
|
||||
menus: null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
menuid: 71,
|
||||
icon: 'li-icon-xitongguanli',
|
||||
menuname: '系统管理',
|
||||
hasThird: null,
|
||||
url: null,
|
||||
menus: [
|
||||
{
|
||||
menuid: 72,
|
||||
icon: 'icon-cus-manage',
|
||||
menuname: '用户管理',
|
||||
hasThird: 'N',
|
||||
url: 'system/user',
|
||||
menus: null
|
||||
},
|
||||
{
|
||||
menuid: 174,
|
||||
icon: 'icon-cms-manage',
|
||||
menuname: '菜单管理',
|
||||
hasThird: 'N',
|
||||
url: 'system/Module',
|
||||
menus: null
|
||||
},
|
||||
{
|
||||
menuid: 73,
|
||||
icon: 'icon-news-manage',
|
||||
menuname: '角色管理',
|
||||
hasThird: 'N',
|
||||
url: 'system/Role',
|
||||
menus: null
|
||||
},
|
||||
{
|
||||
menuid: 74,
|
||||
icon: 'icon-cs-manage',
|
||||
menuname: '公司管理',
|
||||
hasThird: 'N',
|
||||
url: 'system/Dept',
|
||||
menus: null
|
||||
},
|
||||
{
|
||||
menuid: 75,
|
||||
icon: 'icon-promotion-manage',
|
||||
menuname: '系统环境变量',
|
||||
hasThird: 'N',
|
||||
url: 'system/Variable',
|
||||
menus: null
|
||||
},
|
||||
{
|
||||
menuid: 76,
|
||||
icon: 'icon-cms-manage',
|
||||
menuname: '权限管理',
|
||||
hasThird: 'N',
|
||||
url: 'system/Permission',
|
||||
menus: null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
menuid: 128,
|
||||
icon: 'li-icon-shangchengxitongtubiaozitihuayuanwenjian91',
|
||||
menuname: '支付管理',
|
||||
hasThird: null,
|
||||
url: null,
|
||||
menus: [
|
||||
{
|
||||
menuid: 129,
|
||||
icon: 'icon-provider-manage',
|
||||
menuname: '支付配置信息',
|
||||
hasThird: 'N',
|
||||
url: 'machine/MachineConfig',
|
||||
menus: null
|
||||
},
|
||||
{
|
||||
menuid: 175,
|
||||
icon: 'icon-provider-manage',
|
||||
menuname: '支付配置',
|
||||
hasThird: 'N',
|
||||
url: 'pay/Config',
|
||||
menus: null
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
menuid: 150,
|
||||
icon: 'li-icon-shangchengxitongtubiaozitihuayuanwenjian91',
|
||||
menuname: '图表',
|
||||
hasThird: null,
|
||||
url: null,
|
||||
menus: [
|
||||
{
|
||||
menuid: 159,
|
||||
icon: 'icon-provider-manage',
|
||||
menuname: '数据可视化',
|
||||
hasThird: 'N',
|
||||
url: 'charts/statistics',
|
||||
menus: null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
msg: 'success'
|
||||
}
|
||||
this.allmenu = res.data
|
||||
|
||||
// menu(localStorage.getItem('logintoken'))
|
||||
// .then(res => {
|
||||
// console.log(JSON.stringify(res))
|
||||
// if (res.success) {
|
||||
// this.allmenu = res.data
|
||||
// } else {
|
||||
// this.$message.error(res.msg)
|
||||
// return false
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
// 监听
|
||||
this.$root.Bus.$on('toggle', value => {
|
||||
this.collapsed = !value
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
||||
width: 240px;
|
||||
min-height: 400px;
|
||||
}
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
||||
border: none;
|
||||
text-align: left;
|
||||
}
|
||||
.el-menu-item-group__title {
|
||||
padding: 0px;
|
||||
}
|
||||
.el-menu-bg {
|
||||
background-color: #1f2d3d !important;
|
||||
}
|
||||
.el-menu {
|
||||
border: none;
|
||||
}
|
||||
.logobox {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
color: #9d9d9d;
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
padding: 20px 0px;
|
||||
}
|
||||
.logoimg {
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* 头部菜单
|
||||
*/
|
||||
<template>
|
||||
<el-menu class="el-menu-demo" mode="horizontal" background-color="#334157" text-color="#fff" active-text-color="#fff">
|
||||
<el-button class="buttonimg">
|
||||
<img class="showimg" :src="collapsed?imgsq:imgshow" @click="toggle(collapsed)">
|
||||
</el-button>
|
||||
<el-submenu index="2" class="submenu">
|
||||
<!-- <template slot="title">{{user.userRealName}}</template> -->
|
||||
<template slot="title">超级管理员</template>
|
||||
<el-menu-item index="2-1">设置</el-menu-item>
|
||||
<el-menu-item @click="content()" index="2-2">个人中心</el-menu-item>
|
||||
<el-menu-item @click="exit()" index="2-3">退出</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
</template>
|
||||
<script>
|
||||
import { loginout } from '../api/userMG'
|
||||
export default {
|
||||
name: 'navcon',
|
||||
data() {
|
||||
return {
|
||||
collapsed: true,
|
||||
imgshow: require('../assets/img/show.png'),
|
||||
imgsq: require('../assets/img/sq.png'),
|
||||
user: {}
|
||||
}
|
||||
},
|
||||
// 创建完毕状态(里面是操作)
|
||||
created() {
|
||||
this.user = JSON.parse(localStorage.getItem('userdata'))
|
||||
},
|
||||
methods: {
|
||||
// 退出登录
|
||||
exit() {
|
||||
this.$confirm('退出登录, 是否继续?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.$store.commit('logout', 'false')
|
||||
this.$router.push({ path: '/login' })
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '已退出登录!'
|
||||
})
|
||||
}, 1000)
|
||||
// loginout()
|
||||
// .then(res => {
|
||||
// if (res.success) {
|
||||
// //如果请求成功就让他2秒跳转路由
|
||||
// setTimeout(() => {
|
||||
// this.$store.commit('logout', 'false')
|
||||
// this.$router.push({ path: '/login' })
|
||||
// this.$message({
|
||||
// type: 'success',
|
||||
// message: '已退出登录!'
|
||||
// })
|
||||
// }, 1000)
|
||||
// } else {
|
||||
// this.$message.error(res.msg)
|
||||
// this.logining = false
|
||||
// return false
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// // 获取图形验证码
|
||||
// this.getcode()
|
||||
// this.logining = false
|
||||
// this.$message.error('退出失败,请稍后再试!')
|
||||
// })
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 切换显示
|
||||
toggle(showtype) {
|
||||
this.collapsed = !showtype
|
||||
this.$root.Bus.$emit('toggle', this.collapsed)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-menu-vertical-demo:not(.el-menu--collapse) {
|
||||
border: none;
|
||||
}
|
||||
.submenu {
|
||||
float: right;
|
||||
}
|
||||
.buttonimg {
|
||||
height: 60px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
.showimg {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 17px;
|
||||
left: 17px;
|
||||
}
|
||||
.showimg:active {
|
||||
border: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 模版
|
||||
**/
|
||||
|
||||
<template>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 导入组件
|
||||
import headerComponent from "./head.vue";
|
||||
// 导出模块
|
||||
export default {
|
||||
// 模块名字
|
||||
name: "template",
|
||||
// 模块数据
|
||||
data() {
|
||||
//数据
|
||||
return {};
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
headerComponent
|
||||
},
|
||||
// 监听指定值,只有指定值变化,才会触发
|
||||
watch: {},
|
||||
// 里面的函数只有调用才会执行(实时计算)里面是定义的方法
|
||||
methods: {
|
||||
addFun() {},
|
||||
submitFun() {}
|
||||
},
|
||||
// 创建前状态(里面是操作)
|
||||
beforeCreate() {},
|
||||
// 创建完毕状态(里面是操作)
|
||||
created() {},
|
||||
// 挂载前状态(里面是操作)
|
||||
beforeMount() {},
|
||||
// 挂载结束状态(里面是操作)
|
||||
mounted() {},
|
||||
// 更新前状态(里面是操作)
|
||||
beforeUpdate() {},
|
||||
// 更新完成状态(里面是操作)
|
||||
updated() {},
|
||||
// 销毁前状态(里面是操作)
|
||||
beforeDestroy() {},
|
||||
// 销毁完成状态(里面是操作)
|
||||
destroyed() {}
|
||||
};
|
||||
</script>
|
||||
// scoped 样式只在本组件使用
|
||||
<style scoped>
|
||||
/**
|
||||
* 导入css样式组件
|
||||
* @import "../assets/css/components/index.css";
|
||||
*/
|
||||
</style>
|
||||
@@ -0,0 +1,82 @@
|
||||
// The Vue build version to load with the `import` command
|
||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
||||
import Vue from 'vue';
|
||||
// 引入element UI
|
||||
import ElementUI from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
import App from './App';
|
||||
// 引入路由
|
||||
import router from './router';
|
||||
// 引入状态管理
|
||||
import store from './vuex/store';
|
||||
// 引入icon
|
||||
import './assets/icon/iconfont.css'
|
||||
//
|
||||
|
||||
// 引入echarts
|
||||
import echarts from 'echarts'
|
||||
Vue.prototype.$echarts = echarts
|
||||
|
||||
import axios from 'axios';
|
||||
Vue.prototype.$axios = axios;
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
// 使用element UI
|
||||
Vue.use(ElementUI);
|
||||
// 过滤器
|
||||
import * as custom from './utils/util'
|
||||
|
||||
Object.keys(custom).forEach(key => {
|
||||
Vue.filter(key, custom[key])
|
||||
})
|
||||
|
||||
// 路由拦截器
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.matched.length != 0) {
|
||||
if (to.meta.requireAuth) { // 判断该路由是否需要登录权限
|
||||
if (Boolean(localStorage.getItem("userInfo"))) { // 通过vuex state获取当前的user是否存在
|
||||
next();
|
||||
} else {
|
||||
next({
|
||||
path: '/login',
|
||||
query: { redirect: to.fullPath } // 将跳转的路由path作为参数,登录成功后跳转到该路由
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (Boolean(localStorage.getItem("userInfo"))) { // 判断是否登录
|
||||
if (to.path != "/" && to.path != "/login") { //判断是否要跳到登录界面
|
||||
next();
|
||||
} else {
|
||||
/**
|
||||
* 防刷新,如果登录,修改路由跳转到登录页面,修改路由为登录后的首页
|
||||
*/
|
||||
next({
|
||||
path: '/goods/Goods'
|
||||
})
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
next({
|
||||
path: '/login',
|
||||
query: { redirect: to.fullPath } // 将跳转的路由path作为参数,登录成功后跳转到该路由
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store, //使用store vuex状态管理
|
||||
components: { App },
|
||||
template: '<App/>',
|
||||
data: {
|
||||
// 空的实例放到根组件下,所有的子组件都能调用
|
||||
Bus: new Vue()
|
||||
}
|
||||
|
||||
})
|
||||
@@ -0,0 +1,179 @@
|
||||
// 导入组件
|
||||
import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
// 登录
|
||||
import login from '@/views/login';
|
||||
// 首页
|
||||
import index from '@/views/index';
|
||||
/**
|
||||
* 基础菜单
|
||||
*/
|
||||
// 商品管理
|
||||
import Goods from '@/views/goods/Goods';
|
||||
// 机器信息管理
|
||||
import Machine from '@/views/machine/Machine';
|
||||
// 货道信息管理
|
||||
import MachineAisle from '@/views/machine/MachineAisle';
|
||||
/**
|
||||
* 订单管理
|
||||
*/
|
||||
// 交易订单
|
||||
import Order from '@/views/pay/Order';
|
||||
/**
|
||||
* 系统管理
|
||||
*/
|
||||
// 用户管理
|
||||
import user from '@/views/system/user';
|
||||
// 菜单管理
|
||||
import Module from '@/views/system/Module';
|
||||
// 角色管理
|
||||
import Role from '@/views/system/Role';
|
||||
// 公司管理
|
||||
import Dept from '@/views/system/Dept';
|
||||
// 系统环境变量
|
||||
import Variable from '@/views/system/Variable';
|
||||
// 权限管理
|
||||
import Permission from '@/views/system/Permission';
|
||||
/**
|
||||
* 支付管理
|
||||
*/
|
||||
// 支付配置信息
|
||||
import MachineConfig from '@/views/machine/MachineConfig';
|
||||
// 支付配置
|
||||
import Config from '@/views/pay/Config';
|
||||
/**
|
||||
* 数据监控
|
||||
*/
|
||||
// 监控查询
|
||||
import druidLogin from '@/views/druid/login';
|
||||
|
||||
// 图表界面
|
||||
import statistics from '@/views/charts/statistics';
|
||||
|
||||
// 启用路由
|
||||
Vue.use(Router);
|
||||
|
||||
// 导出路由
|
||||
export default new Router({
|
||||
routes: [{
|
||||
path: '/',
|
||||
name: '',
|
||||
component: login,
|
||||
hidden: true,
|
||||
meta: {
|
||||
requireAuth: false
|
||||
}
|
||||
}, {
|
||||
path: '/login',
|
||||
name: '登录',
|
||||
component: login,
|
||||
hidden: true,
|
||||
meta: {
|
||||
requireAuth: false
|
||||
}
|
||||
}, {
|
||||
path: '/index',
|
||||
name: '首页',
|
||||
component: index,
|
||||
iconCls: 'el-icon-tickets',
|
||||
children: [{
|
||||
path: '/goods/Goods',
|
||||
name: '商品管理',
|
||||
component: Goods,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/machine/Machine',
|
||||
name: '机器信息管理',
|
||||
component: Machine,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/machine/MachineAisle',
|
||||
name: '货道信息管理',
|
||||
component: MachineAisle,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/pay/Order',
|
||||
name: '交易订单',
|
||||
component: Order,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/system/user',
|
||||
name: '用户管理',
|
||||
component: user,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/system/Module',
|
||||
name: '菜单管理',
|
||||
component: Module,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/system/Role',
|
||||
name: '角色管理',
|
||||
component: Role,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/system/Dept',
|
||||
name: '公司管理',
|
||||
component: Dept,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/system/Variable',
|
||||
name: '系统环境变量',
|
||||
component: Variable,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/system/Permission',
|
||||
name: '权限管理',
|
||||
component: Permission,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/machine/MachineConfig',
|
||||
name: '支付配置信息',
|
||||
component: MachineConfig,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/pay/Config',
|
||||
name: '支付配置',
|
||||
component: Config,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/druid/login',
|
||||
name: '监控查询',
|
||||
component: druidLogin,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}, {
|
||||
path: '/charts/statistics',
|
||||
name: '数据可视化',
|
||||
component: statistics,
|
||||
meta: {
|
||||
requireAuth: true
|
||||
}
|
||||
}]
|
||||
}]
|
||||
})
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 时间戳
|
||||
* @param {*} timestamp 时间戳
|
||||
*/
|
||||
const timestampToTime = (timestamp) => {
|
||||
let date = new Date(timestamp) //时间戳为10位需*1000,时间戳为13位的话不需乘1000
|
||||
let Y = date.getFullYear() + '-'
|
||||
let M =
|
||||
(date.getMonth() + 1 < 10 ?
|
||||
'0' + (date.getMonth() + 1) :
|
||||
date.getMonth() + 1) + '-'
|
||||
let D =
|
||||
(date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
|
||||
let h =
|
||||
(date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
|
||||
let m =
|
||||
(date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) +
|
||||
':'
|
||||
let s =
|
||||
date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
|
||||
return Y + M + D + h + m + s
|
||||
};
|
||||
/**
|
||||
* 存储localStorage
|
||||
*/
|
||||
const setStore = (name, content) => {
|
||||
if (!name) return;
|
||||
if (typeof content !== 'string') {
|
||||
content = JSON.stringify(content);
|
||||
}
|
||||
window.localStorage.setItem(name, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取localStorage
|
||||
*/
|
||||
const getStore = name => {
|
||||
if (!name) return;
|
||||
return window.localStorage.getItem(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除localStorage
|
||||
*/
|
||||
const removeStore = name => {
|
||||
if (!name) return;
|
||||
window.localStorage.removeItem(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置cookie
|
||||
**/
|
||||
function setCookie(name, value, day) {
|
||||
let date = new Date();
|
||||
date.setDate(date.getDate() + day);
|
||||
document.cookie = name + '=' + value + ';expires=' + date;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取cookie
|
||||
**/
|
||||
function getCookie(name) {
|
||||
let reg = RegExp(name + '=([^;]+)');
|
||||
let arr = document.cookie.match(reg);
|
||||
if (arr) {
|
||||
return arr[1];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除cookie
|
||||
**/
|
||||
function delCookie(name) {
|
||||
setCookie(name, null, -1);
|
||||
};
|
||||
|
||||
/**
|
||||
* 导出
|
||||
**/
|
||||
export {
|
||||
timestampToTime,
|
||||
setStore,
|
||||
getStore,
|
||||
removeStore,
|
||||
setCookie,
|
||||
getCookie,
|
||||
delCookie
|
||||
}
|
||||
@@ -0,0 +1,565 @@
|
||||
/**
|
||||
* 图表界面
|
||||
*/
|
||||
<template>
|
||||
<!-- 组件主盒子 -->
|
||||
<div class="stbox">
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>数据可视化</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索,切换 -->
|
||||
<el-row :gutter="23">
|
||||
<el-col :span="18">
|
||||
<div class="stbgc">
|
||||
<el-row :gutter="23">
|
||||
<el-col :span="7">
|
||||
<el-input size="small" v-model="machineNo" placeholder="请输入所属公司"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-input size="small" v-model="machineNo" placeholder="请输入资产编号"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-input size="small" v-model="machineNo" placeholder="请输入"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="3" class="stsearch">
|
||||
<el-button size="small" type="primary">搜索</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<div class="stbgc">
|
||||
<el-row>
|
||||
<el-col :span="8" class="text-c">
|
||||
<el-radio v-model="type" label="day">日</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="8" class="text-c">
|
||||
<el-radio v-model="type" label="month">月</el-radio>
|
||||
</el-col>
|
||||
<el-col :span="8" class="text-c">
|
||||
<el-radio v-model="type" label="years">年</el-radio>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 统计图 -->
|
||||
<el-row :gutter="23">
|
||||
<el-col :span="8" class="text-c">
|
||||
<div class="st-gbox">
|
||||
<div class="cavasbox" ref="SCEchart"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8" class="text-c">
|
||||
<div class="st-gbox">
|
||||
<div class="cavasbox" ref="SUMEchart"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="8" class="text-c">
|
||||
<div class="st-gbox">
|
||||
<div class="cavasbox" ref="ClickEchart"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- 统计图 -->
|
||||
<div>
|
||||
<el-row :gutter="23">
|
||||
<el-col :span="12" class="text-c">
|
||||
<div class="paybox">
|
||||
<div class="cavasbox" ref="payEchart"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" class="text-c">
|
||||
<div class="paybox">
|
||||
<div class="cavasbox" ref="payNumEchart"></div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script type="text/ecmascript-6">
|
||||
import Chart from 'echarts'
|
||||
export default {
|
||||
name: "welcome",
|
||||
data() {
|
||||
return {
|
||||
machineNo: '',
|
||||
type: 'day',
|
||||
// 销售总笔数
|
||||
SCEoption: {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b}月 : {c}"
|
||||
},
|
||||
legend: {
|
||||
data: [{
|
||||
name: '销售总笔数',
|
||||
icon: 'rect'
|
||||
}],
|
||||
top: 1,
|
||||
left: 1,
|
||||
itemGap: 10,
|
||||
itemWidth: 12,
|
||||
itemHeight: 12,
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
color: "#323232"
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
right: 10,
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
borderWidth: 1
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#999999",
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 14,
|
||||
height: 70,
|
||||
interval: 0,
|
||||
textStyle: {
|
||||
fontSize: 10,
|
||||
color: "#999999"
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#999999",
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 14,
|
||||
textStyle: {
|
||||
fontSize: 10,
|
||||
color: "#999999"
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '销售总笔数',
|
||||
type: 'bar',
|
||||
barGap: 0,
|
||||
data: [50000, 70000, 80000, 40000, 50000, 30000, 40000, 60000, 50000, 40000, 60000, 40000],
|
||||
barWidth: 10,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: new Chart.graphic.LinearGradient(
|
||||
0, 0, 0, 1,
|
||||
[
|
||||
{ offset: 0, color: '#83bff6' },
|
||||
{ offset: 0.5, color: '#188df0' },
|
||||
{ offset: 1, color: '#188df0' }
|
||||
]
|
||||
)
|
||||
},
|
||||
emphasis: {
|
||||
color: new Chart.graphic.LinearGradient(
|
||||
0, 0, 0, 1,
|
||||
[
|
||||
{ offset: 0, color: '#2378f7' },
|
||||
{ offset: 0.7, color: '#2378f7' },
|
||||
{ offset: 1, color: '#83bff6' }
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
}]
|
||||
},
|
||||
// 销售总金额
|
||||
SUMoption: {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b}月 : {c}"
|
||||
},
|
||||
legend: {
|
||||
data: [{
|
||||
name: '销售总金额',
|
||||
icon: 'rect'
|
||||
}],
|
||||
top: 1,
|
||||
left: 1,
|
||||
itemGap: 10,
|
||||
itemWidth: 12,
|
||||
itemHeight: 12,
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
color: "#323232"
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
right: 10,
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
borderWidth: 1
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#999999",
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 14,
|
||||
height: 70,
|
||||
interval: 0,
|
||||
textStyle: {
|
||||
fontSize: 10,
|
||||
color: "#999999"
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#999999",
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 14,
|
||||
textStyle: {
|
||||
fontSize: 10,
|
||||
color: "#999999"
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '销售总金额',
|
||||
// type: 'bar',
|
||||
type: 'line',
|
||||
barGap: 0,
|
||||
data: [50000, 70000, 80000, 40000, 50000, 30000, 40000, 60000, 50000, 40000, 60000, 40000],
|
||||
barWidth: 10,
|
||||
itemStyle: {
|
||||
color: "#108ff9"
|
||||
}
|
||||
}]
|
||||
},
|
||||
// 总点击量
|
||||
Clickoption: {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b}月 : {c}"
|
||||
},
|
||||
legend: {
|
||||
data: [{
|
||||
name: '总点击量',
|
||||
icon: 'rect'
|
||||
}],
|
||||
top: 1,
|
||||
left: 1,
|
||||
itemGap: 10,
|
||||
itemWidth: 12,
|
||||
itemHeight: 12,
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
color: "#323232"
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: 50,
|
||||
right: 10,
|
||||
top: 30,
|
||||
bottom: 30,
|
||||
borderWidth: 1
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#999999",
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 14,
|
||||
height: 70,
|
||||
interval: 0,
|
||||
textStyle: {
|
||||
fontSize: 10,
|
||||
color: "#999999"
|
||||
}
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#999999",
|
||||
width: 1
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
margin: 14,
|
||||
textStyle: {
|
||||
fontSize: 10,
|
||||
color: "#999999"
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [{
|
||||
name: '总点击量',
|
||||
type: 'bar',
|
||||
barGap: 0,
|
||||
data: [50000, 10000, 80000, 30000, 50000, 60000, 40000, 80000, 50000, 20000, 60000, 40000],
|
||||
barWidth: 10,
|
||||
itemStyle: {
|
||||
color: "#48cefd"
|
||||
}
|
||||
}]
|
||||
},
|
||||
// 支付方式统计
|
||||
payoption: {
|
||||
backgroundColor: '#2c343c',
|
||||
title: {
|
||||
text: '支付方式统计(金额)',
|
||||
left: 10,
|
||||
top: 5,
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
color: '#ccc'
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||
},
|
||||
|
||||
visualMap: {
|
||||
show: false,
|
||||
min: 80,
|
||||
max: 600,
|
||||
inRange: {
|
||||
colorLightness: [0, 1]
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '支付方式统计(金额)',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['50%', '50%'],
|
||||
data: [
|
||||
{ value: 335, name: '支付宝' },
|
||||
{ value: 310, name: '银商二维码' },
|
||||
{ value: 274, name: '会员' },
|
||||
{ value: 235, name: '微信支付' },
|
||||
{ value: 100, name: 'Pos通' }
|
||||
].sort(function (a, b) { return a.value - b.value; }),
|
||||
roseType: 'radius',
|
||||
label: {
|
||||
normal: {
|
||||
textStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.3)'
|
||||
}
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
normal: {
|
||||
lineStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.3)'
|
||||
},
|
||||
smooth: 0.2,
|
||||
length: 10,
|
||||
length2: 20
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#c23531',
|
||||
shadowBlur: 200,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
},
|
||||
|
||||
animationType: 'scale',
|
||||
animationEasing: 'elasticOut',
|
||||
animationDelay: function (idx) {
|
||||
return Math.random() * 200;
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
payNumoption: {
|
||||
backgroundColor: '#2c343c',
|
||||
title: {
|
||||
text: '支付方式统计(笔数)',
|
||||
left: 10,
|
||||
top: 5,
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
color: '#ccc'
|
||||
}
|
||||
},
|
||||
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: "{a} <br/>{b} : {c} ({d}%)"
|
||||
},
|
||||
|
||||
visualMap: {
|
||||
show: false,
|
||||
min: 80,
|
||||
max: 600,
|
||||
inRange: {
|
||||
colorLightness: [0, 1]
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '支付方式统计(笔数)',
|
||||
type: 'pie',
|
||||
radius: '55%',
|
||||
center: ['50%', '50%'],
|
||||
data: [
|
||||
{ value: 335, name: '支付宝' },
|
||||
{ value: 310, name: '银商二维码' },
|
||||
{ value: 274, name: '会员' },
|
||||
{ value: 235, name: '微信支付' },
|
||||
{ value: 100, name: 'Pos通' }
|
||||
].sort(function (a, b) { return a.value - b.value; }),
|
||||
roseType: 'radius',
|
||||
label: {
|
||||
normal: {
|
||||
textStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.3)'
|
||||
}
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
normal: {
|
||||
lineStyle: {
|
||||
color: 'rgba(255, 255, 255, 0.3)'
|
||||
},
|
||||
smooth: 0.2,
|
||||
length: 10,
|
||||
length2: 20
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#c23531',
|
||||
shadowBlur: 200,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
},
|
||||
|
||||
animationType: 'scale',
|
||||
animationEasing: 'elasticOut',
|
||||
animationDelay: function (idx) {
|
||||
return Math.random() * 200;
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
// 导入组件
|
||||
components: {
|
||||
// 点聚合组件
|
||||
},
|
||||
// 创建完毕状态(里面是操作)
|
||||
created() { },
|
||||
// 挂载结束状态(里面是操作)
|
||||
mounted() {
|
||||
this.getSCE()
|
||||
this.getSUM()
|
||||
this.getClick()
|
||||
this.getpay()
|
||||
this.getpayNum()
|
||||
},
|
||||
// 里面的函数只有调用才会执行
|
||||
methods: {
|
||||
// 交易总笔数
|
||||
getSCE() {
|
||||
this.chart = Chart.init(this.$refs.SCEchart)
|
||||
this.chart.setOption(this.SCEoption)
|
||||
},
|
||||
// 交易总金额
|
||||
getSUM() {
|
||||
this.chart = Chart.init(this.$refs.SUMEchart)
|
||||
this.chart.setOption(this.SUMoption)
|
||||
},
|
||||
// 总点击量
|
||||
getClick() {
|
||||
this.chart = Chart.init(this.$refs.ClickEchart)
|
||||
this.chart.setOption(this.Clickoption)
|
||||
},
|
||||
// 支付方式统计
|
||||
getpay() {
|
||||
this.chart = Chart.init(this.$refs.payEchart)
|
||||
this.chart.setOption(this.payoption)
|
||||
},
|
||||
// 支付方式统计
|
||||
getpayNum() {
|
||||
this.chart = Chart.init(this.$refs.payNumEchart)
|
||||
this.chart.setOption(this.payNumoption)
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.stbox {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.stbgc {
|
||||
background-color: #fff;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
border-radius: 5px;
|
||||
padding: 0px 16px;
|
||||
}
|
||||
.stsearch {
|
||||
text-align: center;
|
||||
}
|
||||
.text-c {
|
||||
text-align: center;
|
||||
}
|
||||
.st-gbox {
|
||||
background-color: #fff;
|
||||
margin-top: 20px;
|
||||
border-radius: 5px;
|
||||
height: 30vh;
|
||||
box-sizing: border-box;
|
||||
padding: 10px;
|
||||
}
|
||||
.cavasbox {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.paybox {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
border-radius: 5px;
|
||||
margin-top: 20px;
|
||||
height: 32vh;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 数据监控 监控查询
|
||||
*/
|
||||
<template>
|
||||
<div>数据监控 监控查询</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
/**
|
||||
* 基础菜单 商品管理
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>商品管理</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.deptName" placeholder="输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.deptNo" placeholder="输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="deptName" label="部门名称" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="deptNo" label="部门代码" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editTime" label="修改时间" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editUser" label="修改人" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click="closeDialog">
|
||||
<el-form label-width="120px" :model="editForm" :rules="rules" ref="editForm">
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input size="small" v-model="editForm.deptName" auto-complete="off" placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门代码" prop="deptNo">
|
||||
<el-input size="small" v-model="editForm.deptNo" auto-complete="off" placeholder="请输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="closeDialog">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { deptList, deptSave, deptDelete } from '../../api/userMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '添加',
|
||||
editForm: {
|
||||
deptId: '',
|
||||
deptName: '',
|
||||
deptNo: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
deptName: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
],
|
||||
deptNo: [{ required: true, message: '请输入部门代码', trigger: 'blur' }]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
varLable: '',
|
||||
varName: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除部门
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取公司列表
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据开始
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 5,
|
||||
data: [
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1521062371000,
|
||||
editTime: 1526700200000,
|
||||
deptId: 2,
|
||||
deptName: 'XX分公司',
|
||||
deptNo: '1',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1521063247000,
|
||||
editTime: 1526652291000,
|
||||
deptId: 3,
|
||||
deptName: '上海测试',
|
||||
deptNo: '02',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526349555000,
|
||||
editTime: 1526349565000,
|
||||
deptId: 12,
|
||||
deptName: '1',
|
||||
deptNo: '11',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526373178000,
|
||||
editTime: 1526373178000,
|
||||
deptId: 13,
|
||||
deptName: '5',
|
||||
deptNo: '5',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526453107000,
|
||||
editTime: 1526453107000,
|
||||
deptId: 17,
|
||||
deptName: 'v',
|
||||
deptNo: 'v',
|
||||
parentId: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// deptList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.deptId = row.deptId
|
||||
this.editForm.deptName = row.deptName
|
||||
this.editForm.deptNo = row.deptNo
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.deptId = ''
|
||||
this.editForm.deptName = ''
|
||||
this.editForm.deptNo = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
deptSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('公司保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除公司
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deptDelete(row.deptId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('公司删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog() {
|
||||
this.editFormVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<!-- <el-container class="index-con">
|
||||
<el-header class="index-header">
|
||||
<navcon></navcon>
|
||||
</el-header>
|
||||
<el-container class="index-con">
|
||||
<el-aside :class="showclass">
|
||||
<leftnav></leftnav>
|
||||
</el-aside>
|
||||
<el-container class="main-con">
|
||||
<el-main clss="index-main">
|
||||
<router-view></router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</el-container> -->
|
||||
|
||||
<el-container class="index-con">
|
||||
<el-aside :class="showclass">
|
||||
<leftnav></leftnav>
|
||||
</el-aside>
|
||||
<el-container class="main-con">
|
||||
<el-header class="index-header">
|
||||
<navcon></navcon>
|
||||
</el-header>
|
||||
<el-main clss="index-main">
|
||||
<router-view></router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
<script>
|
||||
// 导入组件
|
||||
import navcon from '../components/navcon.vue'
|
||||
import leftnav from '../components/leftnav.vue'
|
||||
export default {
|
||||
name: 'index',
|
||||
data() {
|
||||
return {
|
||||
showclass: 'asideshow',
|
||||
showtype: false
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
navcon,
|
||||
leftnav
|
||||
},
|
||||
methods: {},
|
||||
created() {
|
||||
// 监听
|
||||
this.$root.Bus.$on('toggle', value => {
|
||||
if (value) {
|
||||
this.showclass = 'asideshow'
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
this.showclass = 'aside'
|
||||
}, 300)
|
||||
}
|
||||
})
|
||||
},
|
||||
beforeUpdate() {},
|
||||
// 挂载前状态(里面是操作)
|
||||
beforeMount() {
|
||||
// 弹出登录成功
|
||||
this.$message({
|
||||
message: '登录成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style >
|
||||
.index-con {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.aside {
|
||||
width: 64px !important;
|
||||
height: 100%;
|
||||
background-color: #334157;
|
||||
margin: 0px;
|
||||
}
|
||||
.asideshow {
|
||||
width: 240px !important;
|
||||
height: 100%;
|
||||
background-color: #334157;
|
||||
margin: 0px;
|
||||
}
|
||||
.index-header,
|
||||
.index-main {
|
||||
padding: 0px;
|
||||
border-left: 2px solid #333;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 基础菜单 机器信息管理
|
||||
*/
|
||||
<template>
|
||||
<div>基础菜单 机器信息管理</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 基础菜单 货道信息管理
|
||||
*/
|
||||
<template>
|
||||
<div>基础菜单 货道信息管理</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,401 @@
|
||||
/**
|
||||
* 支付管理 支付配置信息
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>支付配置信息</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.machineNo" placeholder="输入终端号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="machineNo" label="终端号" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="payType" label="支付方式" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="configName" label="显示名称" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="payOpen" label="状态" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editTime" label="修改时间" width="200">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editUser" label="修改人" width="150">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click="closeDialog">
|
||||
<el-form label-width="120px" :model="editForm" :rules="rules" ref="editForm">
|
||||
<el-form-item label="终端号" prop="machineNo">
|
||||
<el-input size="small" v-model="editForm.machineNo" auto-complete="off" placeholder="请输入终端号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付方式" prop="payType">
|
||||
<el-select size="small" v-model="editForm.payType" placeholder="请选择" class="userRole">
|
||||
<el-option v-for="type in payType" :label="type.key" :value="type.value" :key="type.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="配置序号" prop="configId">
|
||||
<el-input size="small" v-model="editForm.configId" auto-complete="off" placeholder="请输入配置序号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="显示名称" prop="configName">
|
||||
<el-input size="small" v-model="editForm.configName" auto-complete="off" placeholder="请输入显示名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="payOpen">
|
||||
<el-select size="small" v-model="editForm.payOpen" placeholder="请选择" class="userRole">
|
||||
<el-option label="正常" value="T"></el-option>
|
||||
<el-option label="禁用" value="N"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="closeDialog">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
MachineConfigList,
|
||||
MachineConfigSave,
|
||||
MachineConfigDelete
|
||||
} from '../../api/payMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '添加',
|
||||
payType: [
|
||||
{ key: '现金', value: 1 },
|
||||
{ key: '支付宝', value: 2 },
|
||||
{ key: '微信', value: 3 },
|
||||
{ key: 'POS通', value: 4 },
|
||||
{ key: '闪付', value: 5 },
|
||||
{ key: 'POS通C扫B', value: 6 },
|
||||
{ key: '银联二维码', value: 8 },
|
||||
{ key: '会员余额支付', value: 9 }
|
||||
],
|
||||
editForm: {
|
||||
tcId: '',
|
||||
machineNo: '',
|
||||
payType: '',
|
||||
configId: '',
|
||||
configName: '',
|
||||
payOpen: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
machineNo: [
|
||||
{ required: true, message: '请输入终端号', trigger: 'blur' }
|
||||
],
|
||||
payType: [
|
||||
{ required: true, message: '请选择支付方式', trigger: 'blur' }
|
||||
],
|
||||
configId: [
|
||||
{ required: true, message: '请输入配置序号', trigger: 'blur' }
|
||||
],
|
||||
configName: [
|
||||
{ required: true, message: '请输入显示名称', trigger: 'blur' }
|
||||
],
|
||||
payOpen: [{ required: true, message: '请选择状态', trigger: 'blur' }]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
varLable: '',
|
||||
varName: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除部门
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取公司列表
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 5,
|
||||
data: [
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: 1524046759000,
|
||||
tcId: 1,
|
||||
deptId: 1,
|
||||
machineNo: '564565656666',
|
||||
payType: 3,
|
||||
payOpen: 'T',
|
||||
configId: 63,
|
||||
configName: '微信',
|
||||
posNo: '098'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
tcId: 2,
|
||||
deptId: 1,
|
||||
machineNo: '66666666',
|
||||
payType: 2,
|
||||
payOpen: 'T',
|
||||
configId: 64,
|
||||
configName: '支付宝',
|
||||
posNo: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
tcId: 3,
|
||||
deptId: 1,
|
||||
machineNo: '93066545645546500791',
|
||||
payType: 6,
|
||||
payOpen: 'T',
|
||||
configId: 67,
|
||||
configName: '银商微信、支付宝',
|
||||
posNo: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
tcId: 4,
|
||||
deptId: 1,
|
||||
machineNo: '65545656565',
|
||||
payType: 6,
|
||||
payOpen: 'T',
|
||||
configId: 67,
|
||||
configName: '银商微信、支付宝',
|
||||
posNo: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1527409037000,
|
||||
editTime: 1527409037000,
|
||||
tcId: 6,
|
||||
deptId: 1,
|
||||
machineNo: '565654545454545',
|
||||
payType: 6,
|
||||
payOpen: 'T',
|
||||
configId: 96,
|
||||
configName: '微信',
|
||||
posNo: null
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// MachineConfigList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.tcId = row.tcId
|
||||
this.editForm.machineNo = row.machineNo
|
||||
this.editForm.configId = row.configId
|
||||
this.editForm.payType = row.payType
|
||||
this.editForm.configName = row.configName
|
||||
this.editForm.payOpen = row.payOpen
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.tcId = ''
|
||||
this.editForm.machineNo = ''
|
||||
this.editForm.payType = ''
|
||||
this.editForm.configId = ''
|
||||
this.editForm.configName = ''
|
||||
this.editForm.payOpen = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
MachineConfigSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('支付配置信息保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除公司
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
MachineConfigDelete(row.deptId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('支付配置信息删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog() {
|
||||
this.editFormVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,610 @@
|
||||
/**
|
||||
* 支付管理 支付配置
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>支付配置</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.name" placeholder="输入名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select size="small" v-model="formInline.payType" placeholder="请选择">
|
||||
<el-option v-for="type in payType" :label="type.key" :value="type.value" :key="type.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.partner" placeholder="输入商户号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="index" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="name" label="名称" width="200" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="payType" label="支付类型" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="partner" label="商户号" width="100" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="subMchId" label="微信子商户" width="140" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="appid" label="应用ID" width="100" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="signType" label="加密类型" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="partnerKey" label="商户签名密钥" width="180" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="notifyUrl" label="通知回调" width="140" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="sellerUserId" label="支付宝卖家" width="150" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="certPath" label="微信证书路径" width="150" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click="closeDialog('editForm')">
|
||||
<el-form label-width="120px" :model="editForm" :rules="rules" ref="editForm">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input size="small" v-model="editForm.name" auto-complete="off" placeholder="请输入名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付类型" prop="payType">
|
||||
<el-select size="small" v-model="editForm.payType" placeholder="请选择" class="userRole">
|
||||
<el-option v-for="type in payType" :label="type.key" :value="type.value" :key="type.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户号" prop="partner">
|
||||
<el-input size="small" v-model="editForm.partner" auto-complete="off" placeholder="请输入商户号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信子商户" prop="subMchId">
|
||||
<el-input size="small" v-model="editForm.subMchId" auto-complete="off" placeholder="请输入微信子商户"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="应用ID" prop="appid">
|
||||
<el-input size="small" v-model="editForm.appid" auto-complete="off" placeholder="请输入应用ID"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="通知回调" prop="notifyUrl">
|
||||
<el-input size="small" v-model="editForm.notifyUrl" auto-complete="off" placeholder="请输入通知回调"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="加密类型" prop="signType">
|
||||
<el-input size="small" v-model="editForm.signType" auto-complete="off" placeholder="请输入加密类型"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户签名密钥" prop="partnerKey">
|
||||
<el-input size="small" v-model="editForm.partnerKey" auto-complete="off" placeholder="请输入商户签名密钥"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付宝卖家" prop="sellerUserId">
|
||||
<el-input size="small" v-model="editForm.sellerUserId" auto-complete="off" placeholder="请输入支付宝卖家"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信证书路径" prop="certPath">
|
||||
<el-input size="small" v-model="editForm.certPath" auto-complete="off" placeholder="请输入微信证书路径"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="微信证书密码" prop="certPassword">
|
||||
<el-input size="small" v-model="editForm.certPassword" auto-complete="off" placeholder="请输入微信证书密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付宝私钥" prop="rsaKey">
|
||||
<el-input size="small" v-model="editForm.rsaKey" auto-complete="off" placeholder="请输入支付宝私钥"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="closeDialog('editForm')">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ConfigList, ConfigSave, ConfigDelete } from '../../api/payMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '添加',
|
||||
payType: [
|
||||
{ key: '请选择', value: 0 },
|
||||
{ key: '现金', value: 1 },
|
||||
{ key: '支付宝', value: 2 },
|
||||
{ key: '微信', value: 3 },
|
||||
{ key: 'POS通', value: 4 },
|
||||
{ key: '闪付', value: 5 },
|
||||
{ key: 'POS通C扫B', value: 6 },
|
||||
{ key: '银联二维码', value: 8 },
|
||||
{ key: '会员余额支付', value: 9 }
|
||||
],
|
||||
editForm: {
|
||||
id: '',
|
||||
name: '',
|
||||
payType: 1,
|
||||
partner: '',
|
||||
subMchId: '',
|
||||
appid: '',
|
||||
notifyUrl: '',
|
||||
signType: '',
|
||||
partnerKey: '',
|
||||
sellerUserId: '',
|
||||
certPath: '',
|
||||
certPassword: '',
|
||||
rsaKey: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
payType: [
|
||||
{ required: true, message: '请选择支付方式', trigger: 'blur' }
|
||||
],
|
||||
partner: [{ required: true, message: '请输入商户号', trigger: 'blur' }],
|
||||
subMchId: [
|
||||
{ required: true, message: '请输入微信子商户号', trigger: 'blur' }
|
||||
],
|
||||
appid: [{ required: true, message: '请输入应用ID', trigger: 'blur' }],
|
||||
notifyUrl: [
|
||||
{ required: true, message: '请输入通知回调', trigger: 'blur' }
|
||||
],
|
||||
signType: [
|
||||
{ required: true, message: '请输入加密类型', trigger: 'blur' }
|
||||
],
|
||||
partnerKey: [
|
||||
{ required: true, message: '请输入商户签名密钥', trigger: 'blur' }
|
||||
],
|
||||
sellerUserId: [
|
||||
{ required: true, message: '请输入支付宝卖家', trigger: 'blur' }
|
||||
],
|
||||
certPath: [
|
||||
{ required: true, message: '请输入微信证书路径', trigger: 'blur' }
|
||||
],
|
||||
certPassword: [
|
||||
{ required: true, message: '请输入微信证书密码', trigger: 'blur' }
|
||||
],
|
||||
rsaKey: [
|
||||
{ required: true, message: '请输入支付宝私钥', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
name: '',
|
||||
payType: 0,
|
||||
partner: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除部门
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取公司列表
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 207,
|
||||
data: [
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 1,
|
||||
name: '支付宝2.0',
|
||||
payType: 1,
|
||||
partner: '2015122801047567',
|
||||
subMchId: '',
|
||||
appid: '2015122801047567',
|
||||
notifyUrl: 'r/pay/alipay/notify',
|
||||
signType: 'RSA',
|
||||
partnerKey: '==',
|
||||
sellerUserId: '2088121360144859',
|
||||
certPath: '',
|
||||
certPassword: '',
|
||||
rsaKey: '',
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 2,
|
||||
name: 'zzzzzz',
|
||||
payType: 2,
|
||||
partner: '1250856201',
|
||||
subMchId: null,
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl: null,
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1250856201.p12',
|
||||
certPassword: '1250856201',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 3,
|
||||
name: ' 待删除',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1273729701',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl: '/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: '',
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 5,
|
||||
name: '微信301',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1341564201',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl: 'er/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/---0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 6,
|
||||
name: '微信301',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1284797101',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl:
|
||||
'http://180.166.211.210:8114/machine-pay-consumer/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/--provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 7,
|
||||
name: '微信301',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1277531101',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl:
|
||||
'http://180.166.211.210:8114/machine-pay-consumer/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 8,
|
||||
name: '微信301',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1276485301',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl:
|
||||
'http://180.166.211.210:8114/machine-pay-consumer/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 9,
|
||||
name: '微信',
|
||||
payType: 2,
|
||||
partner: '1347158201',
|
||||
subMchId: '1351034701',
|
||||
appid: 'wx83a7489c10c9c952',
|
||||
notifyUrl: '',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: 'f174607ba704632b6cad2df8b04650d6',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1347158201.p12',
|
||||
certPassword: '1347158201',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 10,
|
||||
name: '-微信301',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1357984702',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl:
|
||||
'http://180.166.211.210:8114/machine-pay-consumer/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: null,
|
||||
editTime: null,
|
||||
id: 11,
|
||||
name: '-微信301',
|
||||
payType: 2,
|
||||
partner: '1271942301',
|
||||
subMchId: '1357972202',
|
||||
appid: 'wx3ef7713adf0a97b8',
|
||||
notifyUrl:
|
||||
'http://180.166.211.210:8114/machine-pay-consumer/pay/wx/notify',
|
||||
signType: 'NATIVE',
|
||||
partnerKey: '2e3cdaf5aa051c16563c0b8916184d5d',
|
||||
sellerUserId: null,
|
||||
certPath:
|
||||
'/usr/local/tomcat_provider/webapps/machine-service-provider-0.0.1-SNAPSHOT/conf/apiclient_cert_1271942301.p12',
|
||||
certPassword: '1271942301',
|
||||
rsaKey: null,
|
||||
deptId: null
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// ConfigList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.id = row.id
|
||||
this.editForm.name = row.name
|
||||
this.editForm.payType = row.payType
|
||||
this.editForm.partner = row.partner
|
||||
this.editForm.subMchId = row.subMchId
|
||||
this.editForm.appid = row.appid
|
||||
this.editForm.notifyUrl = row.notifyUrl
|
||||
this.editForm.signType = row.signType
|
||||
this.editForm.partnerKey = row.partnerKey
|
||||
this.editForm.sellerUserId = row.sellerUserId
|
||||
this.editForm.certPath = row.certPath
|
||||
this.editForm.certPassword = row.certPassword
|
||||
this.editForm.rsaKey = row.rsaKey
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.id = ''
|
||||
this.editForm.name = ''
|
||||
this.editForm.payType = ''
|
||||
this.editForm.partner = ''
|
||||
this.editForm.subMchId = ''
|
||||
this.editForm.appid = ''
|
||||
this.editForm.notifyUrl = ''
|
||||
this.editForm.signType = ''
|
||||
this.editForm.partnerKey = ''
|
||||
this.editForm.sellerUserId = ''
|
||||
this.editForm.certPath = ''
|
||||
this.editForm.certPassword = ''
|
||||
this.editForm.rsaKey = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
ConfigSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('支付配置信息保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除公司
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
ConfigDelete(row.deptId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('支付配置信息删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog(formName) {
|
||||
this.editFormVisible = false
|
||||
this.$refs[formName].resetFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,631 @@
|
||||
/**
|
||||
* 订单管理 交易订单
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>交易订单</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.machineNo" placeholder="输入终端编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input size="small" v-model="formInline.orderNo" placeholder="输入订单号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input size="small" v-model="formInline.transId" placeholder="输入交易单号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select size="small" v-model="formInline.payType" placeholder="请选择">
|
||||
<el-option v-for="type in payType" :label="type.key" :value="type.value" :key="type.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select size="small" v-model="formInline.orderStatus" placeholder="请选择">
|
||||
<el-option v-for="type in payway" :label="type.key" :value="type.value" :key="type.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="index" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="machineNo" label="终端编号" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="orderNo" label="订单号" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="transId" label="交易单号" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="payType" label="支付方式" width="140" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="transType" label="交易类型" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="goodsPrice" label="商品价格" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="payAmount" label="支付金额" width="180" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="goodsName" label="商品名称" width="140" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="orderStatus" label="订单状态" width="120" show-overflow-tooltip>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="addTime" label="创建时间" width="180" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.addTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">预览</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">退款</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="50%" @click="closeDialog('editForm')">
|
||||
<el-form label-width="120px" :model="editForm" ref="editForm">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公司编号">
|
||||
<el-input size="small" v-model="editForm.deptId" auto-complete="off" placeholder="请输入名称" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单号">
|
||||
<el-input size="small" v-model="editForm.orderNo" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付方式">
|
||||
<el-input size="small" v-model="editForm.payType" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易类型">
|
||||
<el-input size="small" v-model="editForm.transType" auto-complete="off" placeholder="请输入微信子商户" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品编号">
|
||||
<el-input size="small" v-model="editForm.goodsNo" auto-complete="off" placeholder="请输入应用ID" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="支付金额">
|
||||
<el-input size="small" v-model="editForm.payAmount" auto-complete="off" placeholder="请输入通知回调" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="货道号">
|
||||
<el-input size="small" v-model="editForm.aisleNo" auto-complete="off" placeholder="请输入加密类型" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="买家标识">
|
||||
<el-input size="small" v-model="editForm.openId" auto-complete="off" placeholder="请输入商户签名密钥" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="子商户号">
|
||||
<el-input size="small" v-model="editForm.subMchId" auto-complete="off" placeholder="请输入支付宝卖家" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公司名称">
|
||||
<el-input size="small" v-model="editForm.deptName" auto-complete="off" placeholder="请输入名称" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="交易单号">
|
||||
<el-input size="small" v-model="editForm.transId" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="子支付方式">
|
||||
<el-input size="small" v-model="editForm.subPayType" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="终端编号">
|
||||
<el-input size="small" v-model="editForm.machineNo" auto-complete="off" placeholder="请输入微信子商户" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品价格">
|
||||
<el-input size="small" v-model="editForm.goodsPrice" auto-complete="off" placeholder="请输入应用ID" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品名称">
|
||||
<el-input size="small" v-model="editForm.goodsName" auto-complete="off" placeholder="请输入通知回调" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单状态">
|
||||
<el-input size="small" v-model="editForm.orderStatus" auto-complete="off" placeholder="请输入加密类型" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="商户号">
|
||||
<el-input size="small" v-model="editForm.mchId" auto-complete="off" placeholder="请输入商户签名密钥" disabled></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="编辑用户">
|
||||
<el-input size="small" v-model="editForm.editUser" auto-complete="off" placeholder="请输入支付宝卖家" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="备注">
|
||||
<el-input size="small" v-model="editForm.remark" auto-complete="off" placeholder="请输入微信证书路径" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { OrderList, OrderRefund, OrderDelete } from '../../api/payMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '预览',
|
||||
payType: [
|
||||
{ key: '请选择', value: 0 },
|
||||
{ key: '现金', value: 1 },
|
||||
{ key: '支付宝', value: 2 },
|
||||
{ key: '微信', value: 3 },
|
||||
{ key: 'POS通', value: 4 },
|
||||
{ key: '闪付', value: 5 },
|
||||
{ key: 'POS通C扫B', value: 6 },
|
||||
{ key: '银联二维码', value: 8 },
|
||||
{ key: '会员余额支付', value: 9 }
|
||||
],
|
||||
payway: [
|
||||
{ key: '请选择', value: 0 },
|
||||
{ key: '初始化', value: 1 },
|
||||
{ key: '已支付', value: 2 },
|
||||
{ key: '出货成功', value: 3 },
|
||||
{ key: '出货失败', value: 4 },
|
||||
{ key: '订单超时', value: 5 },
|
||||
{ key: '退款初始化', value: 11 },
|
||||
{ key: '退款进行中', value: 12 },
|
||||
{ key: '退款成功', value: 13 },
|
||||
{ key: '退款失败', value: 14 },
|
||||
{ key: '订单处理中', value: 10 }
|
||||
],
|
||||
editForm: {
|
||||
id: '',
|
||||
name: '',
|
||||
payType: 1,
|
||||
partner: '',
|
||||
subMchId: '',
|
||||
appid: '',
|
||||
notifyUrl: '',
|
||||
signType: '',
|
||||
partnerKey: '',
|
||||
sellerUserId: '',
|
||||
certPath: '',
|
||||
certPassword: '',
|
||||
rsaKey: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
machineNo: '',
|
||||
orderNo: '',
|
||||
transId: '',
|
||||
payType: 0,
|
||||
orderStatus: 0,
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除部门
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取公司列表
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据开始
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 23,
|
||||
data: [
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526380193000,
|
||||
editTime: 1526380193000,
|
||||
orderId: 109,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: 'xxxx',
|
||||
transId: 'xxxx',
|
||||
payType: 6,
|
||||
subPayType: 'WXPay',
|
||||
transType: '退款',
|
||||
machineNo: '111111',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: -0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 14,
|
||||
openId: null,
|
||||
mchId: '111111111111111',
|
||||
subMchId: null,
|
||||
remark: '不允许从此IP发起交易: 101.81.251.226'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526380176000,
|
||||
editTime: 1526380176000,
|
||||
orderId: 108,
|
||||
deptId: 1,
|
||||
deptName: 'xxxxxx',
|
||||
orderNo: 'xxxx',
|
||||
transId: 'xxxxx',
|
||||
payType: 6,
|
||||
subPayType: 'WXPay',
|
||||
transType: '退款',
|
||||
machineNo: 'J1AX904002',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: -0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 14,
|
||||
openId: null,
|
||||
mchId: '898310154990338',
|
||||
subMchId: null,
|
||||
remark: '不允许从此IP发起交易: 101.81.251.226'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1524921444000,
|
||||
editTime: 1524894094000,
|
||||
orderId: 107,
|
||||
deptId: 1,
|
||||
deptName: 'xxxxxx',
|
||||
orderNo: 'J1AX90400220180428101723945',
|
||||
transId: '4200000137201804287543647891',
|
||||
payType: 6,
|
||||
subPayType: 'WXPay',
|
||||
transType: '消费',
|
||||
machineNo: 'J1AX904002',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 7,
|
||||
openId: null,
|
||||
mchId: '898310154990338',
|
||||
subMchId: null,
|
||||
remark: '无法找到指定的账单'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1521307596000,
|
||||
editTime: 1524641207000,
|
||||
orderId: 20,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: '9300079120180318142634440',
|
||||
transId: null,
|
||||
payType: 0,
|
||||
subPayType: '0',
|
||||
transType: '消费',
|
||||
machineNo: '111111111111111',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 7,
|
||||
openId: null,
|
||||
mchId: null,
|
||||
subMchId: null,
|
||||
remark: '1111111111111111111111'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520195909000,
|
||||
editTime: 1520195909000,
|
||||
orderId: 19,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: '9300079120180305183828606',
|
||||
transId: null,
|
||||
payType: 0,
|
||||
subPayType: '0',
|
||||
transType: '消费',
|
||||
machineNo: '93000791',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 1,
|
||||
openId: null,
|
||||
mchId: null,
|
||||
subMchId: null,
|
||||
remark: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520035180000,
|
||||
editTime: 1520035180000,
|
||||
orderId: 18,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: '4200000056201803031934477774',
|
||||
transId: '9300079120180303170851281',
|
||||
payType: 6,
|
||||
subPayType: 'WXPay',
|
||||
transType: '退款',
|
||||
machineNo: '222222222222222222',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 8,
|
||||
openId: null,
|
||||
mchId: '898310154990338',
|
||||
subMchId: null,
|
||||
remark: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520020261000,
|
||||
editTime: 1520185478000,
|
||||
orderId: 17,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: '9300079120180303175059985',
|
||||
transId: '4200000072201803031887274444',
|
||||
payType: 6,
|
||||
subPayType: 'WXPay',
|
||||
transType: '消费',
|
||||
machineNo: '93000791',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 7,
|
||||
openId: null,
|
||||
mchId: '898310154990338',
|
||||
subMchId: null,
|
||||
remark: '不允许从此IP发起交易: 116.247.119.165'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520019911000,
|
||||
editTime: 1520020075000,
|
||||
orderId: 16,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: '9300079120180303174511778',
|
||||
transId: '4200000055201803031949877221',
|
||||
payType: 6,
|
||||
subPayType: 'WXPay',
|
||||
transType: '消费',
|
||||
machineNo: '93000791',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 1,
|
||||
openId: null,
|
||||
mchId: '898310154990338',
|
||||
subMchId: null,
|
||||
remark: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520019776000,
|
||||
editTime: 1520019776000,
|
||||
orderId: 15,
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
orderNo: '9300079120180303174256156',
|
||||
transId: null,
|
||||
payType: 0,
|
||||
subPayType: '0',
|
||||
transType: '消费',
|
||||
machineNo: '93000791',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 1,
|
||||
openId: null,
|
||||
mchId: null,
|
||||
subMchId: null,
|
||||
remark: null
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520019729000,
|
||||
editTime: 1520019729000,
|
||||
orderId: 14,
|
||||
deptId: 1,
|
||||
deptName: '上海XX',
|
||||
orderNo: '9300079120180303174208429',
|
||||
transId: null,
|
||||
payType: 0,
|
||||
subPayType: '0',
|
||||
transType: '消费',
|
||||
machineNo: '93000791',
|
||||
goodsNo: '123456',
|
||||
goodsPrice: 0.01,
|
||||
payAmount: 0.01,
|
||||
goodsName: '可乐',
|
||||
aisleNo: null,
|
||||
orderStatus: 1,
|
||||
openId: null,
|
||||
mchId: null,
|
||||
subMchId: null,
|
||||
remark: null
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
|
||||
// OrderList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
this.editForm = row
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
ConfigSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('支付配置信息保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除公司
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
ConfigDelete(row.deptId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('支付配置信息删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog(formName) {
|
||||
this.editFormVisible = false
|
||||
this.$refs[formName].resetFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,332 @@
|
||||
/**
|
||||
* 系统管理 公司管理
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>公司管理</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.deptName" placeholder="输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.deptNo" placeholder="输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="deptName" label="部门名称" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="deptNo" label="部门代码" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editTime" label="修改时间" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editUser" label="修改人" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click="closeDialog">
|
||||
<el-form label-width="120px" :model="editForm" :rules="rules" ref="editForm">
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input size="small" v-model="editForm.deptName" auto-complete="off" placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门代码" prop="deptNo">
|
||||
<el-input size="small" v-model="editForm.deptNo" auto-complete="off" placeholder="请输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="closeDialog">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { deptList, deptSave, deptDelete } from '../../api/userMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '添加',
|
||||
editForm: {
|
||||
deptId: '',
|
||||
deptName: '',
|
||||
deptNo: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
deptName: [
|
||||
{ required: true, message: '请输入部门名称', trigger: 'blur' }
|
||||
],
|
||||
deptNo: [{ required: true, message: '请输入部门代码', trigger: 'blur' }]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
varLable: '',
|
||||
varName: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除部门
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取公司列表
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 5,
|
||||
data: [
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1521062371000,
|
||||
editTime: 1526700200000,
|
||||
deptId: 2,
|
||||
deptName: '上海分公司',
|
||||
deptNo: '1',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1521063247000,
|
||||
editTime: 1526652291000,
|
||||
deptId: 3,
|
||||
deptName: '上海测试',
|
||||
deptNo: '02',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526349555000,
|
||||
editTime: 1526349565000,
|
||||
deptId: 12,
|
||||
deptName: '1',
|
||||
deptNo: '11',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526373178000,
|
||||
editTime: 1526373178000,
|
||||
deptId: 13,
|
||||
deptName: '5',
|
||||
deptNo: '5',
|
||||
parentId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526453107000,
|
||||
editTime: 1526453107000,
|
||||
deptId: 17,
|
||||
deptName: 'v',
|
||||
deptNo: 'v',
|
||||
parentId: 1
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// deptList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.deptId = row.deptId
|
||||
this.editForm.deptName = row.deptName
|
||||
this.editForm.deptNo = row.deptNo
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.deptId = ''
|
||||
this.editForm.deptName = ''
|
||||
this.editForm.deptNo = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
deptSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('公司保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除公司
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
deptDelete(row.deptId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '公司已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('公司删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog() {
|
||||
this.editFormVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
/**
|
||||
* 系统管理 菜单管理
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>菜单管理</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 主体内容 -->
|
||||
<el-row>
|
||||
<!-- title -->
|
||||
<div class="modt-box">用户管理</div>
|
||||
<el-col :span="4"> </el-col>
|
||||
<el-col :span="6">
|
||||
<div class="mod-btnbox">
|
||||
<el-button size="small" type="primary">全部展开</el-button>
|
||||
<el-button size="small" type="primary">全部压缩</el-button>
|
||||
</div>
|
||||
<el-tree class="treeclass" ref="tree" :data="treeData" default-expand-all="" :props="defaultProps" @node-click="nodeclick" @check-change="handleClick" check-strictly node-key="id" show-checkbox></el-tree>
|
||||
</el-col>
|
||||
<el-col :span="18">
|
||||
<div class="mod-btnbox">
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="addModule">添加</el-button>
|
||||
</div>
|
||||
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
|
||||
<el-form-item label="父级菜单" prop="parentId">
|
||||
<el-select size="small" v-model="form.parentId" placeholder="请选择" class="selectw">
|
||||
<el-option v-for="parm in fmenu" :key="parm.id" :label="parm.name" :value="parm.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单名称" prop="moduleName">
|
||||
<el-input size="small" v-model="form.moduleName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="图标" prop="moduleIcon">
|
||||
<el-input size="small" v-model="form.moduleIcon"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="URL" prop="moduleUrl">
|
||||
<el-input size="small" v-model="form.moduleUrl"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="顺序" prop="moduleOrder">
|
||||
<el-input size="small" v-model="form.moduleOrder"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" @click="saveModule('form')">保存</el-button>
|
||||
<el-button size="small" type="primary" v-show="showdelete" @click="deleteModule">删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
ModuleList,
|
||||
ModuleGet,
|
||||
ModuleNodes,
|
||||
ModuleSave,
|
||||
ModuleDelete
|
||||
} from '../../api/userMG'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
showdelete: false,
|
||||
treeData: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
form: {
|
||||
addUser: '',
|
||||
editUser: '',
|
||||
addTime: '',
|
||||
editTime: '',
|
||||
moduleId: '',
|
||||
parentId: '',
|
||||
moduleLevel: '',
|
||||
systemNo: '',
|
||||
isLeaf: '',
|
||||
fullIndex: '',
|
||||
moduleIcon: '',
|
||||
moduleOrder: '',
|
||||
moduleName: '',
|
||||
moduleNotes: '',
|
||||
moduleUrl: ''
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
parentId: [
|
||||
{ required: true, message: '请选择父级菜单', trigger: 'blur' }
|
||||
],
|
||||
moduleName: [
|
||||
{ required: true, message: '请输入菜单名称', trigger: 'blur' }
|
||||
],
|
||||
moduleIcon: [
|
||||
{ required: true, message: '请输入菜单图标', trigger: 'blur' }
|
||||
],
|
||||
moduleUrl: [{ required: true, message: '请输入URL', trigger: 'blur' }],
|
||||
moduleOrder: [
|
||||
{ required: true, message: '请输入菜单顺序', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
fmenu: []
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
|
||||
created() {
|
||||
this.getdata()
|
||||
this.getmenu()
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取数据
|
||||
getdata() {
|
||||
ModuleList()
|
||||
.then(res => {
|
||||
this.treeData = [
|
||||
{
|
||||
id: 1,
|
||||
pId: 0,
|
||||
name: '平台顶级',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
pId: 1,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
pId: 1,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 12,
|
||||
pId: 1,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
pId: 1,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 17,
|
||||
pId: 1,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
pId: 2,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
pId: 2,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
pId: 2,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
pId: 2,
|
||||
name: '一层',
|
||||
open: true,
|
||||
checked: false
|
||||
}
|
||||
]
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('菜单管理列表失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 添加
|
||||
addModule() {
|
||||
this.showdelete = false
|
||||
this.form.addUser = ''
|
||||
this.form.editUser = ''
|
||||
this.form.addTime = ''
|
||||
this.form.editTime = ''
|
||||
this.form.moduleId = ''
|
||||
this.form.parentId = ''
|
||||
this.form.moduleLevel = ''
|
||||
this.form.systemNo = ''
|
||||
this.form.isLeaf = ''
|
||||
this.form.fullIndex = ''
|
||||
this.form.moduleIcon = ''
|
||||
this.form.moduleOrder = ''
|
||||
this.form.moduleName = ''
|
||||
this.form.moduleNotes = ''
|
||||
this.form.moduleUrl = ''
|
||||
},
|
||||
// 获取父级菜单
|
||||
getmenu() {
|
||||
let parm = {
|
||||
page: '1',
|
||||
limit: '10'
|
||||
}
|
||||
ModuleNodes(parm)
|
||||
.then(res => {
|
||||
this.fmenu = res.data
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('父级菜单列表获取失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 复选变单选
|
||||
handleClick(data, checked, node) {
|
||||
if (checked) {
|
||||
this.$refs.tree.setCheckedNodes([])
|
||||
this.$refs.tree.setCheckedNodes([data])
|
||||
this.showdelete = true
|
||||
} else {
|
||||
}
|
||||
},
|
||||
// 点击节点
|
||||
nodeclick(arr, node, self) {
|
||||
ModuleGet(arr.id)
|
||||
.then(res => {
|
||||
console.log(JSON.stringify(res))
|
||||
this.form = res.data.data
|
||||
this.$refs.tree.setCheckedNodes([])
|
||||
this.$refs.tree.setCheckedNodes([arr])
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('用户管理获取失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 保存菜单
|
||||
saveModule(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
ModuleSave(this.form)
|
||||
.then(res => {
|
||||
this.getdata()
|
||||
this.getmenu()
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error('菜单管理列表保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除菜单
|
||||
deleteModule() {
|
||||
ModuleDelete(this.form.moduleId)
|
||||
.then(res => {
|
||||
this.getdata()
|
||||
this.getmenu()
|
||||
this.$message.error('菜单管理列表删除成功!')
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error('菜单管理列表删除失败,请稍后再试!')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.user-search {
|
||||
margin-top: 20px !important;
|
||||
}
|
||||
.user-search td {
|
||||
margin-top: 20px !important;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
.el-table__expanded-cell {
|
||||
padding: 0px !important;
|
||||
margin: 0px !important;
|
||||
}
|
||||
.modt-box {
|
||||
width: 100%;
|
||||
height: 60px;
|
||||
line-height: 60px;
|
||||
background-color: #f0f2f5;
|
||||
text-align: center;
|
||||
color: #334157;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 24px;
|
||||
}
|
||||
.mod-btnbox {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.treeclass {
|
||||
border: 1px solid #f3f3f3;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.selectw {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,465 @@
|
||||
/**
|
||||
* 系统管理 权限管理
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>权限管理</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.permissionName" placeholder="输入权限名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.permission" placeholder="输入权限CODE"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色:">
|
||||
<el-select size="small" v-model="formInline.roleId" placeholder="请选择">
|
||||
<el-option selected label="请选择" value="0"></el-option>
|
||||
<el-option v-for="parm in userparm" :key="parm.roleId" :label="parm.roleName" :value="parm.roleId"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="RolePermission()">配置权限</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" @selection-change="selectChange" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="permissionName" label="权限名称" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="permission" label="权限CODE" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editTime" label="修改时间" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editUser" label="修改人" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click="closeDialog">
|
||||
<el-form label-width="120px" :model="editForm" :rules="rules" ref="editForm">
|
||||
<el-form-item label="权限名称" prop="permissionName">
|
||||
<el-input size="small" v-model="editForm.permissionName" auto-complete="off" placeholder="权限名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="权限CODE" prop="permission">
|
||||
<el-input size="small" v-model="editForm.permission" auto-complete="off" placeholder="权限CODE"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="closeDialog">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
permissionList,
|
||||
ermissionSave,
|
||||
ermissionDelete,
|
||||
roleDropDown,
|
||||
RolePermission
|
||||
} from '../../api/userMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '添加',
|
||||
editForm: {
|
||||
permissionId: '',
|
||||
permissionName: '',
|
||||
permission: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
permissionName: [
|
||||
{ required: true, message: '请输入权限名称', trigger: 'blur' }
|
||||
],
|
||||
permission: [
|
||||
{ required: true, message: '请输入权限CODE', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
permissionName: '',
|
||||
permission: '',
|
||||
roleId: '0',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 选择数据
|
||||
selectdata: [],
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
watch: {},
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
this.getAccsee()
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
|
||||
methods: {
|
||||
// 获取数据方法
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 0,
|
||||
data: [
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1519728609000,
|
||||
editTime: 1522585700000,
|
||||
permissionId: 1,
|
||||
permissionName: '用户-列表',
|
||||
permission: 'system:User:list',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1519728667000,
|
||||
editTime: 1522585706000,
|
||||
permissionId: 3,
|
||||
permissionName: '用户-修改',
|
||||
permission: 'system:User:save',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1519728669000,
|
||||
editTime: 1522256096000,
|
||||
permissionId: 4,
|
||||
permissionName: '用户-删除',
|
||||
permission: 'system:User:delete',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1520249365000,
|
||||
editTime: 1522256085000,
|
||||
permissionId: 5,
|
||||
permissionName: '系统管理:角色:列表',
|
||||
permission: 'system:Role:list',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1520249588000,
|
||||
editTime: 1520249588000,
|
||||
permissionId: 7,
|
||||
permissionName: 'system:Role:save',
|
||||
permission: 'system:Role:save',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1520249588000,
|
||||
editTime: 1520249588000,
|
||||
permissionId: 8,
|
||||
permissionName: 'system:Role:delete',
|
||||
permission: 'system:Role:delete',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1520251014000,
|
||||
editTime: 1520251014000,
|
||||
permissionId: 9,
|
||||
permissionName: 'system:Variable:列表',
|
||||
permission: 'system:Variable:list',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1520251014000,
|
||||
editTime: 1520251014000,
|
||||
permissionId: 11,
|
||||
permissionName: 'system:Variable:修改',
|
||||
permission: 'system:Variable:save',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1520251014000,
|
||||
editTime: 1520251014000,
|
||||
permissionId: 12,
|
||||
permissionName: 'system:Variable:删除',
|
||||
permission: 'system:Variable:delete',
|
||||
lay_CHECKED: false,
|
||||
LAY_CHECKED: false
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// 获取权限列表
|
||||
// permissionList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('权限管理列表获取失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 获取权限
|
||||
getAccsee() {
|
||||
roleDropDown()
|
||||
.then(res => {
|
||||
if (res.success == false) {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
} else {
|
||||
this.userparm = res.data
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.$message.error('权限获取失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
// 深拷贝并赋值
|
||||
//this.editForm = Object.assign({}, row)
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.permissionId = row.permissionId
|
||||
this.editForm.permissionName = row.permissionName
|
||||
this.editForm.permission = row.permission
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.permissionId = ''
|
||||
this.editForm.permissionName = ''
|
||||
this.editForm.permission = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
ermissionSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '权限管理保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('权限管理保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除权限
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
ermissionDelete(row.permissionId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '权限管理已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('权限管理删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 选择复选框事件
|
||||
selectChange(val) {
|
||||
this.selectdata = val
|
||||
},
|
||||
// 配置权限
|
||||
RolePermission() {
|
||||
let parms = {
|
||||
roleId: '',
|
||||
permissionIds: ''
|
||||
}
|
||||
if (this.formInline.roleId == '0') {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '请选择角色'
|
||||
})
|
||||
return false
|
||||
}
|
||||
parms.roleId = this.formInline.roleId
|
||||
let len = this.selectdata
|
||||
let ids = []
|
||||
if (len != 0) {
|
||||
for (let i = 0; i < len.length; i++) {
|
||||
ids.push(len[i].permissionId)
|
||||
}
|
||||
}
|
||||
parms.permissionIds = ids.join(',')
|
||||
RolePermission(parms)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '配置权限成功!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('配置权限失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog() {
|
||||
this.editFormVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,500 @@
|
||||
/**
|
||||
* 系统管理 角色管理
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>角色管理</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.roleName" placeholder="输入角色名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.roleNo" placeholder="输入角色代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="roleName" label="角色名称" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="roleNo" label="角色代码" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editTime" label="修改时间" width="300">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editUser" label="修改人" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
<el-button size="mini" type="success" @click="menuAccess(scope.$index, scope.row)">菜单权限</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click='closeDialog("edit")'>
|
||||
<el-form label-width="120px" :model="editForm" ref="editForm" :rules="rules">
|
||||
<el-form-item label="系统编码" prop="systemNo">
|
||||
<el-input size="small" v-model="editForm.systemNo" auto-complete="off" placeholder="请输入系统编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色名称" prop="roleName">
|
||||
<el-input size="small" v-model="editForm.roleName" auto-complete="off" placeholder="请输入角色名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色代码" prop="roleNo">
|
||||
<el-input size="small" v-model="editForm.roleNo" auto-complete="off" placeholder="请输入角色代码"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click='closeDialog("edit")'>取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 菜单权限 -->
|
||||
<el-dialog title="菜单权限" :visible.sync="menuAccessshow" width="30%" @click='closeDialog("perm")'>
|
||||
<el-tree ref="tree" default-expand-all="" :data="RoleRight" :props="RoleRightProps" :default-checked-keys="checkmenu" node-key="id" show-checkbox>
|
||||
</el-tree>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click='closeDialog("perm")'>取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="menuPermSave">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
roleList,
|
||||
roleSave,
|
||||
roleDelete,
|
||||
rolePwd,
|
||||
RoleRightTree,
|
||||
RoleRightSave
|
||||
} from '../../api/userMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
menuAccessshow: false, //控制数据权限显示与隐藏
|
||||
title: '添加',
|
||||
editForm: {
|
||||
roleId: '',
|
||||
systemNo: '',
|
||||
roleNo: '',
|
||||
roleName: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules 表单验证
|
||||
rules: {
|
||||
systemNo: [
|
||||
{ required: true, message: '请输入系统编码', trigger: 'blur' }
|
||||
],
|
||||
roleNo: [
|
||||
{ required: true, message: '请输入角色代码', trigger: 'blur' }
|
||||
],
|
||||
roleName: [
|
||||
{ required: true, message: '请输入角色名称', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
varLable: '',
|
||||
varName: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 数据权限
|
||||
RoleRight: [],
|
||||
RoleRightProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
// 选中
|
||||
checkmenu: [],
|
||||
//参数role
|
||||
saveroleId: '',
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
watch: {},
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
|
||||
methods: {
|
||||
// 获取角色列表
|
||||
getdata(parameter) {
|
||||
// 模拟数据
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 6,
|
||||
data: [
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1519182004000,
|
||||
editTime: 1520288426000,
|
||||
roleId: 1,
|
||||
systemNo: 'pmd',
|
||||
roleNo: 'Administrator',
|
||||
roleName: '超级管理员'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1521111376000,
|
||||
editTime: 1520678191000,
|
||||
roleId: 2,
|
||||
systemNo: 'order',
|
||||
roleNo: 'admin',
|
||||
roleName: '公司管理员'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1520678221000,
|
||||
editTime: 1520678221000,
|
||||
roleId: 95,
|
||||
systemNo: 'pm',
|
||||
roleNo: 'common',
|
||||
roleName: '普通用户'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526349853000,
|
||||
editTime: 1526349853000,
|
||||
roleId: 96,
|
||||
systemNo: '1',
|
||||
roleNo: '1',
|
||||
roleName: '1'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526349942000,
|
||||
editTime: 1526437443000,
|
||||
roleId: 97,
|
||||
systemNo: '2',
|
||||
roleNo: '2',
|
||||
roleName: '2'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526652148000,
|
||||
editTime: 1526652148000,
|
||||
roleId: 101,
|
||||
systemNo: 'test',
|
||||
roleNo: 'demo',
|
||||
roleName: '演示角色'
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// roleList(parameter)
|
||||
// .then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('获取角色列表失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.roleId = row.roleId
|
||||
this.editForm.systemNo = row.systemNo
|
||||
this.editForm.roleNo = row.roleNo
|
||||
this.editForm.roleName = row.roleName
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.roleId = ''
|
||||
this.editForm.systemNo = ''
|
||||
this.editForm.roleNo = ''
|
||||
this.editForm.roleName = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
roleSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '角色保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('角色保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除角色
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
roleDelete(row.roleId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '角色已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('角色删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 数据权限
|
||||
menuAccess: function(index, row) {
|
||||
this.menuAccessshow = true
|
||||
this.saveroleId = row.roleId
|
||||
RoleRightTree(row.roleId)
|
||||
.then(res => {
|
||||
if (res.data.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '获取权限成功'
|
||||
})
|
||||
this.changemenu(res.data.data)
|
||||
this.RoleRight = this.changeArr(res.data.data)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.data.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('获取权限失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 选中菜单
|
||||
changemenu(arr) {
|
||||
let change = []
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i].checked) {
|
||||
change.push(arr[i].id)
|
||||
}
|
||||
}
|
||||
this.checkmenu = change
|
||||
},
|
||||
// tree 递归
|
||||
changeArr(list) {
|
||||
var temptree = [],
|
||||
tree = [],
|
||||
items = []
|
||||
for (var i in list) {
|
||||
if (!temptree[list[i].id]) {
|
||||
var trow = {
|
||||
id: list[i].id,
|
||||
pId: list[i].pId,
|
||||
name: list[i].name,
|
||||
open: list[i].open,
|
||||
checked: list[i].checked,
|
||||
children: []
|
||||
}
|
||||
temptree[list[i].id] = trow
|
||||
items.push(trow)
|
||||
}
|
||||
if (list[i].uid > 0) {
|
||||
temptree[list[i].id]['children'].push({
|
||||
id: list[i].id,
|
||||
pId: list[i].pId,
|
||||
name: list[i].name,
|
||||
open: list[i].open,
|
||||
checked: list[i].checked,
|
||||
children: []
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
for (var j in items) {
|
||||
if (temptree[items[j].pId]) {
|
||||
temptree[items[j].pId]['children'].push(temptree[items[j].id])
|
||||
} else {
|
||||
tree.push(temptree[items[j].id])
|
||||
}
|
||||
}
|
||||
temptree = null
|
||||
items = null
|
||||
return tree
|
||||
},
|
||||
// 菜单权限-保存
|
||||
menuPermSave() {
|
||||
let parm = {
|
||||
roleId: this.saveroleId,
|
||||
moduleIds: ''
|
||||
}
|
||||
let node = this.$refs.tree.getCheckedNodes()
|
||||
let moduleIds = []
|
||||
if (node.length != 0) {
|
||||
for (let i = 0; i < node.length; i++) {
|
||||
moduleIds.push(node[i].id)
|
||||
}
|
||||
parm.moduleIds = JSON.stringify(moduleIds)
|
||||
}
|
||||
RoleRightSave(parm)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '权限保存成功'
|
||||
})
|
||||
this.menuAccessshow = false
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('权限保存失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog(dialog) {
|
||||
if (dialog == 'edit') {
|
||||
this.editFormVisible = false
|
||||
} else if (dialog == 'perm') {
|
||||
this.menuAccessshow = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
/**
|
||||
* 系统管理 系统环境变量
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>系统环境变量</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
|
||||
<el-form-item label="搜索:">
|
||||
<el-input size="small" v-model="formInline.varLable" placeholder="输入变量描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.varName" placeholder="输入变量名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="60">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="varLable" label="变量描述" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="varName" label="变量名称" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="varValue" label="变量名称" width="300">
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editTime" label="修改时间" width="200">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column sortable prop="editUser" label="修改人" width="200">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog title="修改" :visible.sync="editFormVisible" width="30%" @click="closeDialog">
|
||||
<el-form label-width="120px" :model="editForm" :rules="rules" ref="editForm">
|
||||
<el-form-item label="变量描述" prop="varLable">
|
||||
<el-input size="small" v-model="editForm.varLable" auto-complete="off" placeholder="变量描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="变量名称" prop="varName">
|
||||
<el-input size="small" v-model="editForm.varName" auto-complete="off" placeholder="变量名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="变量名称" prop="varValue">
|
||||
<el-input size="small" v-model="editForm.varValue" auto-complete="off" placeholder="变量名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="closeDialog">取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { variableList, variableSave, variableDelete } from '../../api/userMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
title: '添加',
|
||||
editForm: {
|
||||
varId: '',
|
||||
varLable: '',
|
||||
varName: '',
|
||||
varValue: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// rules表单验证
|
||||
rules: {
|
||||
varLable: [
|
||||
{ required: true, message: '请输入变量描述', trigger: 'blur' }
|
||||
],
|
||||
varName: [
|
||||
{ required: true, message: '请输入变量名称', trigger: 'blur' }
|
||||
],
|
||||
varValue: [
|
||||
{ required: true, message: '请输入变量名称', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
varLable: '',
|
||||
varName: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 删除
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
userparm: [], //搜索权限
|
||||
listData: [], //用户数据
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
|
||||
watch: {},
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
|
||||
methods: {
|
||||
// 获取数据方法
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 6,
|
||||
data: [
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1519385529000,
|
||||
editTime: 1520619747000,
|
||||
varId: 190,
|
||||
deptId: 1,
|
||||
varLable: '支付访问域名',
|
||||
varName: 'domainName',
|
||||
varValue: 'http://127.0.0.1:8080/iot-service-pay'
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1519451541000,
|
||||
editTime: 1519451547000,
|
||||
varId: 191,
|
||||
deptId: 1,
|
||||
varLable: '商品图片地址',
|
||||
varName: 'productImgURL',
|
||||
varValue: 'http://ymwlw.com/pic'
|
||||
},
|
||||
{
|
||||
addUser: 'root',
|
||||
editUser: 'root',
|
||||
addTime: 1519452658000,
|
||||
editTime: 1519452661000,
|
||||
varId: 192,
|
||||
deptId: 1,
|
||||
varLable: '手机支付广告地址',
|
||||
varName: 'groupDomain',
|
||||
varValue: 'http://ymwlwl.com'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1519879624000,
|
||||
editTime: 1519879628000,
|
||||
varId: 193,
|
||||
deptId: 1,
|
||||
varLable: '下单接口测试模式',
|
||||
varName: 'envType',
|
||||
varValue: 'false'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526374014000,
|
||||
editTime: 1526374031000,
|
||||
varId: 198,
|
||||
deptId: null,
|
||||
varLable: 'sgh',
|
||||
varName: 'jhjj',
|
||||
varValue: 'jhjhgs'
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526453243000,
|
||||
editTime: 1526453243000,
|
||||
varId: 199,
|
||||
deptId: null,
|
||||
varLable: 'v',
|
||||
varName: 'v',
|
||||
varValue: 'v'
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.listData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// variableList(parameter)
|
||||
// .then(res => {
|
||||
// console.log(JSON.stringify(res))
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.listData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
// .catch(err => {
|
||||
// this.loading = false
|
||||
// this.$message.error('菜单加载失败,请稍后再试!')
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改'
|
||||
this.editForm.varId = row.varId
|
||||
this.editForm.varLable = row.varLable
|
||||
this.editForm.varName = row.varName
|
||||
this.editForm.varValue = row.varValue
|
||||
} else {
|
||||
this.title = '添加'
|
||||
this.editForm.varId = ''
|
||||
this.editForm.varLable = ''
|
||||
this.editForm.varName = ''
|
||||
this.editForm.varValue = ''
|
||||
}
|
||||
},
|
||||
// 编辑、增加页面保存方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
variableSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '系统环境变量保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('系统环境变量保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除权限
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
variableDelete(row.varId)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '系统环境变量已删除'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('系统环境变量删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog() {
|
||||
this.editFormVisible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,907 @@
|
||||
/**
|
||||
* 系统管理 用户管理
|
||||
*/
|
||||
<template>
|
||||
<div>
|
||||
<!-- 面包屑导航 -->
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>用户管理</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索筛选 -->
|
||||
<el-form :inline="true" :model="formInline" class="user-search">
|
||||
<el-form-item label="搜索:">
|
||||
<el-select size="small" v-model="formInline.isLock" placeholder="请选择">
|
||||
<el-option label="全部" value=""></el-option>
|
||||
<el-option label="正常" value="N"></el-option>
|
||||
<el-option label="已锁定" value="Y"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.userName" placeholder="输入用户名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="">
|
||||
<el-input size="small" v-model="formInline.userMobile" placeholder="输入手机号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
|
||||
<el-button size="small" type="primary" icon="el-icon-plus" @click="handleEdit()">添加</el-button>
|
||||
<el-button size="small" type="primary" @click="handleunit()">部门设置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!--列表-->
|
||||
<el-table size="small" @selection-change="selectChange" :data="userData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
|
||||
<el-table-column align="center" type="selection" width="50">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="deptName" label="公司" width="120">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="userName" label="用户名" width="120">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="userRealName" label="姓名" width="120">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="userMobile" label="手机号" width="120">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="userSex" label="性别" min-width="50">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="userEmail" label="邮件" min-width="120">
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="editTime" label="修改时间" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<div>{{scope.row.editTime|timestampToTime}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" sortable prop="isLock" label="状态" min-width="50">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.isLock=='N'?nshow:fshow" active-color="#13ce66" inactive-color="#ff4949" @change="editType(scope.$index, scope.row)">
|
||||
</el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="300">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除</el-button>
|
||||
<el-button size="mini" type="success" @click="resetpwd(scope.$index, scope.row)">重置密码</el-button>
|
||||
<el-button size="mini" type="success" @click="dataAccess(scope.$index, scope.row)">数据权限</el-button>
|
||||
<el-button size="mini" type="success" @click="offlineUser(scope.$index, scope.row)">下线</el-button>
|
||||
<el-button size="mini" type="success" @click="refreshCache(scope.$index, scope.row)">刷新缓存</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页组件 -->
|
||||
<Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
|
||||
<!-- 编辑界面 -->
|
||||
<el-dialog :title="title" :visible.sync="editFormVisible" width="30%" @click='closeDialog("edit")'>
|
||||
<el-form label-width="80px" ref="editForm" :model="editForm" :rules="rules">
|
||||
<el-form-item label="用户名" prop="userName">
|
||||
<el-input size="small" v-model="editForm.userName" auto-complete="off" placeholder="请输入用户名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="userRealName">
|
||||
<el-input size="small" v-model="editForm.userRealName" auto-complete="off" placeholder="请输入姓名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色" prop="roleId">
|
||||
<el-select size="small" v-model="editForm.roleId" placeholder="请选择" class="userRole">
|
||||
<el-option label="公司管理员" value="1"></el-option>
|
||||
<el-option label="普通用户" value="2"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="userMobile">
|
||||
<el-input size="small" v-model="editForm.userMobile" placeholder="请输入手机号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="邮件" prop="userEmail">
|
||||
<el-input size="small" v-model="editForm.userEmail" placeholder="请输入邮箱地址"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="userSex">
|
||||
<el-radio v-model="editForm.userSex" label="男">男</el-radio>
|
||||
<el-radio v-model="editForm.userSex" label="女">女</el-radio>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click='closeDialog("edit")'>取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="submitForm('editForm')">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 数据权限 -->
|
||||
<el-dialog title="数据权限" :visible.sync="dataAccessshow" width="30%" @click='closeDialog("perm")'>
|
||||
<el-tree ref="tree" default-expand-all="" :data="UserDept" :props="defaultProps" :default-checked-keys="checkmenu" node-key="id" show-checkbox>
|
||||
</el-tree>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click='closeDialog("perm")'>取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="menuPermSave">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<!-- 所属单位 -->
|
||||
<el-dialog title="所属单位" :visible.sync="unitAccessshow" width="30%" @click='closeDialog("unit")'>
|
||||
<el-tree ref="tree" default-expand-all="" :data="UserDept" :props="defaultProps" @check-change="handleClick" :default-checked-keys="checkmenu" node-key="id" show-checkbox check-strictly>
|
||||
</el-tree>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click='closeDialog("unit")'>取消</el-button>
|
||||
<el-button size="small" type="primary" :loading="loading" class="title" @click="unitPermSave">保存</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 导入请求方法
|
||||
import {
|
||||
userList,
|
||||
userSave,
|
||||
userDelete,
|
||||
userPwd,
|
||||
userExpireToken,
|
||||
userFlashCache,
|
||||
userLock,
|
||||
UserDeptTree,
|
||||
UserDeptSave,
|
||||
UserDeptdeptTree,
|
||||
UserChangeDept
|
||||
} from '../../api/userMG'
|
||||
import Pagination from '../../components/Pagination'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
nshow: true, //switch开启
|
||||
fshow: false, //switch关闭
|
||||
loading: false, //是显示加载
|
||||
title: '添加用户',
|
||||
editFormVisible: false, //控制编辑页面显示与隐藏
|
||||
dataAccessshow: false, //控制数据权限显示与隐藏
|
||||
unitAccessshow: false, //控制所属单位隐藏与显示
|
||||
// 编辑与添加
|
||||
editForm: {
|
||||
userId: '',
|
||||
userName: '',
|
||||
userRealName: '',
|
||||
roleId: '',
|
||||
userMobile: '',
|
||||
userEmail: '',
|
||||
userSex: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 部门参数
|
||||
unitparm: {
|
||||
userIds: '',
|
||||
deptId: '',
|
||||
deptName: ''
|
||||
},
|
||||
// 选择数据
|
||||
selectdata: [],
|
||||
// rules表单验证
|
||||
rules: {
|
||||
userName: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' }
|
||||
],
|
||||
userRealName: [
|
||||
{ required: true, message: '请输入姓名', trigger: 'blur' }
|
||||
],
|
||||
roleId: [{ required: true, message: '请选择角色', trigger: 'blur' }],
|
||||
userMobile: [
|
||||
{ required: true, message: '请输入手机号', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^1(3\d|47|5((?!4)\d)|7(0|1|[6-8])|8\d)\d{8,8}$/,
|
||||
required: true,
|
||||
message: '请输入正确的手机号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
userEmail: [
|
||||
{ required: true, message: '请输入邮箱', trigger: 'blur' },
|
||||
{
|
||||
pattern: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/,
|
||||
required: true,
|
||||
message: '请输入正确的邮箱',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
userSex: [{ required: true, message: '请选择性别', trigger: 'blur' }]
|
||||
},
|
||||
// 删除用户
|
||||
seletedata: {
|
||||
ids: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 重置密码
|
||||
resetpsd: {
|
||||
userId: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 用户下线
|
||||
offline: {
|
||||
token: localStorage.getItem('logintoken')
|
||||
},
|
||||
// 请求数据参数
|
||||
formInline: {
|
||||
page: 1,
|
||||
limit: 10,
|
||||
deptId: '',
|
||||
userName: '',
|
||||
userMobile: '',
|
||||
isLock: ''
|
||||
},
|
||||
//用户数据
|
||||
userData: [],
|
||||
// 数据权限
|
||||
UserDept: [],
|
||||
defaultProps: {
|
||||
children: 'children',
|
||||
label: 'name'
|
||||
},
|
||||
// 选中
|
||||
checkmenu: [],
|
||||
//参数role
|
||||
saveroleId: '',
|
||||
// 分页参数
|
||||
pageparm: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 10
|
||||
}
|
||||
}
|
||||
},
|
||||
// 注册组件
|
||||
components: {
|
||||
Pagination
|
||||
},
|
||||
|
||||
/**
|
||||
* 数据发生改变
|
||||
*/
|
||||
watch: {},
|
||||
|
||||
/**
|
||||
* 创建完毕
|
||||
*/
|
||||
created() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
|
||||
/**
|
||||
* 里面的方法只有被调用才会执行
|
||||
*/
|
||||
methods: {
|
||||
// 获取数据方法
|
||||
getdata(parameter) {
|
||||
this.loading = true
|
||||
// 模拟数据开始
|
||||
let res = {
|
||||
code: 0,
|
||||
msg: null,
|
||||
count: 12,
|
||||
data: [
|
||||
{
|
||||
addUser: '1',
|
||||
editUser: '1',
|
||||
addTime: null,
|
||||
editTime: 1527411068000,
|
||||
userId: 1,
|
||||
systemNo: 'pmd',
|
||||
userName: 'root',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '超级管理员',
|
||||
userSex: '女',
|
||||
userMobile: '138123456789',
|
||||
userEmail: '111@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 1
|
||||
},
|
||||
{
|
||||
addUser: '1',
|
||||
editUser: '1',
|
||||
addTime: null,
|
||||
editTime: 1527410579000,
|
||||
userId: 3,
|
||||
systemNo: 'mc',
|
||||
userName: 'zengzhuo',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '系统管理员',
|
||||
userSex: 'M',
|
||||
userMobile: '18616988966',
|
||||
userEmail: '222@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 2,
|
||||
deptName: 'xxxx',
|
||||
roleId: 101
|
||||
},
|
||||
{
|
||||
addUser: '1',
|
||||
editUser: '4',
|
||||
addTime: null,
|
||||
editTime: 1527411586000,
|
||||
userId: 4,
|
||||
systemNo: 'ec',
|
||||
userName: 'admin',
|
||||
userPassword: '59ba8b7dda9ff79186311a5a9fa155ca',
|
||||
userRealName: '超级管理员',
|
||||
userSex: '女',
|
||||
userMobile: '138123456789',
|
||||
userEmail: 'huangxuekun@founder.com',
|
||||
isLock: 'N',
|
||||
deptId: 2,
|
||||
deptName: 'xxxx',
|
||||
roleId: 3
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526275128000,
|
||||
editTime: 1526284402000,
|
||||
userId: 28,
|
||||
systemNo: null,
|
||||
userName: 'eee111',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '123111',
|
||||
userSex: '男',
|
||||
userMobile: '12354342345',
|
||||
userEmail: '111232@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 4,
|
||||
deptName: 'zxxxxx',
|
||||
roleId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526284533000,
|
||||
editTime: 1526284533000,
|
||||
userId: 37,
|
||||
systemNo: null,
|
||||
userName: 'ces',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: 'sesfg',
|
||||
userSex: '男',
|
||||
userMobile: '12312312312',
|
||||
userEmail: '122111111',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526285228000,
|
||||
editTime: 1526285228000,
|
||||
userId: 43,
|
||||
systemNo: null,
|
||||
userName: '22',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '22',
|
||||
userSex: '男',
|
||||
userMobile: '222',
|
||||
userEmail: '222',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526448593000,
|
||||
editTime: 1526448593000,
|
||||
userId: 58,
|
||||
systemNo: null,
|
||||
userName: '1',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '1',
|
||||
userSex: '女',
|
||||
userMobile: '13607118810',
|
||||
userEmail: '1@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526452698000,
|
||||
editTime: 1526520341000,
|
||||
userId: 60,
|
||||
systemNo: null,
|
||||
userName: '222222222',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '222222222222',
|
||||
userSex: '男',
|
||||
userMobile: '13607118810',
|
||||
userEmail: '111@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 1
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526452731000,
|
||||
editTime: 1526452731000,
|
||||
userId: 61,
|
||||
systemNo: null,
|
||||
userName: '33333333333333',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '4444444444444444444',
|
||||
userSex: '女',
|
||||
userMobile: '13607118810',
|
||||
userEmail: 'qqq@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 1,
|
||||
deptName: 'xxxx',
|
||||
roleId: 2
|
||||
},
|
||||
{
|
||||
addUser: null,
|
||||
editUser: null,
|
||||
addTime: 1526452756000,
|
||||
editTime: 1527128981000,
|
||||
userId: 62,
|
||||
systemNo: null,
|
||||
userName: '211111111',
|
||||
userPassword: 'e10adc3949ba59abbe56e057f20f883e',
|
||||
userRealName: '21111111111',
|
||||
userSex: '男',
|
||||
userMobile: '13601478451',
|
||||
userEmail: '222222@qq.com',
|
||||
isLock: 'N',
|
||||
deptId: 17,
|
||||
deptName: 'v',
|
||||
roleId: 2
|
||||
}
|
||||
]
|
||||
}
|
||||
this.loading = false
|
||||
this.userData = res.data
|
||||
// 分页赋值
|
||||
this.pageparm.currentPage = this.formInline.page
|
||||
this.pageparm.pageSize = this.formInline.limit
|
||||
this.pageparm.total = res.count
|
||||
// 模拟数据结束
|
||||
|
||||
/***
|
||||
* 调用接口,注释上面模拟数据 取消下面注释
|
||||
*/
|
||||
// 获取用户列表
|
||||
// userList(parameter).then(res => {
|
||||
// this.loading = false
|
||||
// if (res.success == false) {
|
||||
// this.$message({
|
||||
// type: 'info',
|
||||
// message: res.msg
|
||||
// })
|
||||
// } else {
|
||||
// this.userData = res.data
|
||||
// // 分页赋值
|
||||
// this.pageparm.currentPage = this.formInline.page
|
||||
// this.pageparm.pageSize = this.formInline.limit
|
||||
// this.pageparm.total = res.count
|
||||
// }
|
||||
// })
|
||||
},
|
||||
// 分页插件事件
|
||||
callFather(parm) {
|
||||
this.formInline.page = parm.currentPage
|
||||
this.formInline.limit = parm.pageSize
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
//搜索事件
|
||||
search() {
|
||||
this.getdata(this.formInline)
|
||||
},
|
||||
// 修改type
|
||||
editType: function(index, row) {
|
||||
this.loading = true
|
||||
let parm = {
|
||||
lock: '',
|
||||
userId: '',
|
||||
token: localStorage.getItem('logintoken')
|
||||
}
|
||||
parm.userId = row.userId
|
||||
let lock = row.isLock
|
||||
if (lock == 'N') {
|
||||
parm.lock = 'Y'
|
||||
} else {
|
||||
parm.lock = 'N'
|
||||
}
|
||||
// 修改状态
|
||||
userLock(parm).then(res => {
|
||||
this.loading = false
|
||||
if (res.success == false) {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '状态修改成功'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
}
|
||||
})
|
||||
},
|
||||
//显示编辑界面
|
||||
handleEdit: function(index, row) {
|
||||
this.editFormVisible = true
|
||||
if (row != undefined && row != 'undefined') {
|
||||
this.title = '修改用户'
|
||||
this.editForm.userId = row.userId
|
||||
this.editForm.userName = row.userName
|
||||
this.editForm.userRealName = row.userRealName
|
||||
this.editForm.roleId = row.roleId
|
||||
this.editForm.userMobile = row.userMobile
|
||||
this.editForm.userEmail = row.userEmail
|
||||
this.editForm.userSex = row.userSex
|
||||
} else {
|
||||
this.title = '添加用户'
|
||||
this.editForm.userId = ''
|
||||
this.editForm.userName = ''
|
||||
this.editForm.userRealName = ''
|
||||
this.editForm.roleId = ''
|
||||
this.editForm.userMobile = ''
|
||||
this.editForm.userEmail = ''
|
||||
this.editForm.userSex = ''
|
||||
}
|
||||
},
|
||||
// 编辑、添加提交方法
|
||||
submitForm(editData) {
|
||||
this.$refs[editData].validate(valid => {
|
||||
if (valid) {
|
||||
// 请求方法
|
||||
userSave(this.editForm)
|
||||
.then(res => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.getdata(this.formInline)
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '数据保存成功!'
|
||||
})
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.editFormVisible = false
|
||||
this.loading = false
|
||||
this.$message.error('保存失败,请稍后再试!')
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 显示部门设置
|
||||
handleunit: function(index, row) {
|
||||
this.unitAccessshow = true
|
||||
let parms = 0
|
||||
UserDeptdeptTree(parms)
|
||||
.then(res => {
|
||||
if (res.data.success) {
|
||||
this.UserDept = this.changeArr(res.data.data)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('配置权限失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
handleClick(data, checked, node) {
|
||||
if (checked) {
|
||||
this.$refs.tree.setCheckedNodes([])
|
||||
this.$refs.tree.setCheckedNodes([data])
|
||||
this.unitparm.deptId = data.id
|
||||
this.unitparm.deptName = data.name
|
||||
//交叉点击节点
|
||||
} else {
|
||||
}
|
||||
},
|
||||
// 保存部门
|
||||
unitPermSave() {
|
||||
let len = this.selectdata
|
||||
let ids = []
|
||||
if (len != 0) {
|
||||
for (let i = 0; i < len.length; i++) {
|
||||
ids.push(len[i].userId)
|
||||
}
|
||||
}
|
||||
this.unitparm.userIds = ids.join(',')
|
||||
UserChangeDept(this.unitparm)
|
||||
.then(res => {
|
||||
this.unitAccessshow = false
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '部门设置成功!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('部门设置失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 选择复选框事件
|
||||
selectChange(val) {
|
||||
this.selectdata = val
|
||||
},
|
||||
// 关闭编辑、增加弹出框
|
||||
closeDialog(dialog) {
|
||||
if (dialog == 'edit') {
|
||||
this.editFormVisible = false
|
||||
} else if (dialog == 'perm') {
|
||||
this.dataAccessshow = false
|
||||
} else if (dialog == 'unit') {
|
||||
this.unitAccessshow = false
|
||||
}
|
||||
},
|
||||
// 删除用户
|
||||
deleteUser(index, row) {
|
||||
this.$confirm('确定要删除吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
// 删除
|
||||
userDelete(row.id)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '数据已删除!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('数据删除失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除!'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 重置密码
|
||||
resetpwd(index, row) {
|
||||
this.resetpsd.userId = row.userId
|
||||
this.$confirm('确定要重置密码吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
userPwd(this.resetpsd)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '重置密码成功!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('重置密码失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '取消重置密码!'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 数据权限
|
||||
dataAccess: function(index, row) {
|
||||
this.dataAccessshow = true
|
||||
this.saveroleId = row.userId
|
||||
UserDeptTree(row.userId)
|
||||
.then(res => {
|
||||
if (res.data.success) {
|
||||
this.checkmenu = this.changemenu(res.data.data)
|
||||
this.UserDept = this.changeArr(res.data.data)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.data.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('获取权限失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
//数据格式化
|
||||
changeArr(data) {
|
||||
var pos = {}
|
||||
var tree = []
|
||||
var i = 0
|
||||
while (data.length != 0) {
|
||||
if (data[i].pId == 0) {
|
||||
tree.push({
|
||||
id: data[i].id,
|
||||
name: data[i].name,
|
||||
pId: data[i].pId,
|
||||
open: data[i].open,
|
||||
checked: data[i].checked,
|
||||
children: []
|
||||
})
|
||||
pos[data[i].id] = [tree.length - 1]
|
||||
data.splice(i, 1)
|
||||
i--
|
||||
} else {
|
||||
var posArr = pos[data[i].pId]
|
||||
if (posArr != undefined) {
|
||||
var obj = tree[posArr[0]]
|
||||
for (var j = 1; j < posArr.length; j++) {
|
||||
obj = obj.children[posArr[j]]
|
||||
}
|
||||
|
||||
obj.children.push({
|
||||
id: data[i].id,
|
||||
name: data[i].name,
|
||||
pId: data[i].pId,
|
||||
open: data[i].open,
|
||||
checked: data[i].checked,
|
||||
children: []
|
||||
})
|
||||
pos[data[i].id] = posArr.concat([obj.children.length - 1])
|
||||
data.splice(i, 1)
|
||||
i--
|
||||
}
|
||||
}
|
||||
i++
|
||||
if (i > data.length - 1) {
|
||||
i = 0
|
||||
}
|
||||
}
|
||||
return tree
|
||||
},
|
||||
// 选中菜单
|
||||
changemenu(arr) {
|
||||
let change = []
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (arr[i].checked) {
|
||||
change.push(arr[i].id)
|
||||
}
|
||||
}
|
||||
return change
|
||||
},
|
||||
// 菜单权限-保存
|
||||
menuPermSave() {
|
||||
let parm = {
|
||||
userId: this.saveroleId,
|
||||
deptIds: ''
|
||||
}
|
||||
let node = this.$refs.tree.getCheckedNodes()
|
||||
let moduleIds = []
|
||||
if (node.length != 0) {
|
||||
for (let i = 0; i < node.length; i++) {
|
||||
moduleIds.push(node[i].id)
|
||||
}
|
||||
parm.deptIds = JSON.stringify(moduleIds)
|
||||
}
|
||||
UserDeptSave(parm)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '权限保存成功'
|
||||
})
|
||||
this.dataAccessshow = false
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('权限保存失败,请稍后再试!')
|
||||
})
|
||||
},
|
||||
// 下线用户
|
||||
offlineUser(index, row) {
|
||||
this.$confirm('确定要让' + row.userName + '用户下线吗?', '信息', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
userExpireToken(row.userName)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '用户' + row.userName + '强制下线成功!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('用户下线失败,请稍后再试!')
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消'
|
||||
})
|
||||
})
|
||||
},
|
||||
// 刷新缓存
|
||||
refreshCache(index, row) {
|
||||
userFlashCache(row.userName)
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '刷新成功!'
|
||||
})
|
||||
this.getdata(this.formInline)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: res.msg
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
this.loading = false
|
||||
this.$message.error('刷新失败,请稍后再试!')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.user-search {
|
||||
margin-top: 20px;
|
||||
}
|
||||
.userRole {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
|
||||
Vue.use(Vuex);
|
||||
// 登录验证
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
user: false
|
||||
},
|
||||
mutations: {
|
||||
// 登录
|
||||
login(state, user) {
|
||||
state.user = user;
|
||||
localStorage.setItem("userInfo", user);
|
||||
},
|
||||
// 退出
|
||||
logout(state, user) {
|
||||
state.user = "";
|
||||
localStorage.setItem("userInfo", "");
|
||||
}
|
||||
}
|
||||
})
|
||||
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 87 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 61 KiB |