Commit 10753c5a by cwq0219

合并

2 parents 014bcf9e f61b334b
Showing 109 changed files with 555 additions and 538 deletions
...@@ -3,12 +3,8 @@ ...@@ -3,12 +3,8 @@
# 页面 title 前缀 # 页面 title 前缀
VUE_APP_TITLE=tFIMS VUE_APP_TITLE=tFIMS
# 网络请求开发地址
# VUE_APP_API=http://192.168.3.191:8944/router
# 网络请求mock测试地址
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 网络请求公用地址 # 网络请求公用地址
VUE_APP_API=http://tfims.test.glsx.com.cn/router VUE_APP_API=http://tfims.test.glsx.com.cn/router
# 仓库地址 # 仓库地址
VUE_APP_REPO=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS VUE_APP_REPO=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
...@@ -18,4 +14,6 @@ VUE_APP_I18N_FALLBACK_LOCALE=en ...@@ -18,4 +14,6 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_MAIN_COLOR=#3D6FE4
\ No newline at end of file \ No newline at end of file
VUE_APP_MAIN_COLOR=#3D6FE4
VUE_APP_STORAGE_PREFIX=tfims
\ No newline at end of file \ No newline at end of file
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
# 页面 title 前缀 # 页面 title 前缀
VUE_APP_TITLE=TFims Dev VUE_APP_TITLE=TFims Dev
# 网络请求开发地址
VUE_APP_API=http://192.168.3.191:8944/router
\ No newline at end of file \ No newline at end of file
module.exports = { module.exports = {
root: true, root: true,
parserOptions: {
parser: 'babel-eslint'
},
env: { env: {
node: true browser: true
}, },
'extends': [ extends: [
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevent
// ion consider switching to `plugin:vue/strongly-recommended` or
// `plugin:vue/recommended` for stricter rules.
'plugin:vue/essential', 'plugin:vue/essential',
'@vue/standard' // https://github.com/standard/standard/blob/master/docs/RULES-en.md
'standard'
], ],
rules: { // required to lint *.vue files
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', plugins: ['vue'],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' globals: {
NODE_ENV: false,
_:false,
echarts:false
}, },
parserOptions: { rules: {
parser: 'babel-eslint' // allow async-await
'generator-star-spacing': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// 添加,分号必须
// semi: ['error', 'always'],
'semi': [2, 'never'],
'semi-spacing': [2, {
'before': false,
'after': true
}],
'no-unexpected-multiline': 'off',
'space-before-function-paren': ['error', 'never'],
quotes: [
'error',
'single',
{
avoidEscape: true
}
]
} }
} };
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ var app = express() ...@@ -3,7 +3,7 @@ var app = express()
app.use(express.static('./dist')) app.use(express.static('./dist'))
app.get('/', function (req, res) { app.get('/', function(req, res) {
res.send('Hello Vue') res.send('Hello Vue')
}) })
......
import request from './request' import request from './request'
const path = 'fims.device.' const path = 'fims.device.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi(data) {
data.method = `${path}edit` data.method = `${path}edit`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
...@@ -22,12 +22,12 @@ function removeApi (data) { ...@@ -22,12 +22,12 @@ function removeApi (data) {
// return request(data, 'post', noSignAttr) // return request(data, 'post', noSignAttr)
// } // }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
function isExistApi (data) { function isExistApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
......
...@@ -2,17 +2,17 @@ import request from './request' ...@@ -2,17 +2,17 @@ import request from './request'
const path = 'fims.maintains.' const path = 'fims.maintains.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}delete` data.method = `${path}delete`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
......
...@@ -2,27 +2,27 @@ import request from './request' ...@@ -2,27 +2,27 @@ import request from './request'
const path = 'fims.order.' const path = 'fims.order.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}search` data.method = `${path}search`
return request(data) return request(data)
} }
function detailApi (data) { function detailApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}delete` data.method = `${path}delete`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
function downloadApi (data) { function downloadApi(data) {
data.method = `${path}download` data.method = `${path}download`
return request(data) return request(data)
} }
......
...@@ -2,7 +2,7 @@ import request from './request' ...@@ -2,7 +2,7 @@ import request from './request'
const path = 'fims.material.' const path = 'fims.material.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
......
import request from './request' import request from './request'
import RequestMethods from './request.methods'
const path = 'fims.' const path = 'fims.'
export function searchReportLog (data) { export function searchReportLog(data) {
data.method = `${path}reportlog.search` data.method = `${path}reportlog.search`
return request(data) return request(data)
} }
export function searchDepot (data) { export function searchDepot(data) {
data.method = `fims.configuration.from.conftype` data.method = 'fims.configuration.from.conftype'
return request(data) return request(data)
} }
...@@ -2,12 +2,12 @@ import request from './request' ...@@ -2,12 +2,12 @@ import request from './request'
const path = 'fims.reportlog.' const path = 'fims.reportlog.'
function getLogsApi (data) { function getLogsApi(data) {
data.method = `${path}search` data.method = `${path}search`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
......
...@@ -6,21 +6,21 @@ const methods = { ...@@ -6,21 +6,21 @@ const methods = {
Edit: `${path}edit` Edit: `${path}edit`
} }
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi(data) {
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
function isExistApi (data) { function isExistApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
......
...@@ -2,25 +2,25 @@ ...@@ -2,25 +2,25 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:55 * @Date: 2019-08-26 18:02:55
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-10 17:10:53 * @Last Modified time: 2019-09-11 19:09:21
*/ */
import request from './request' import request from './request'
import RequestMethods from './request.methods' import RequestMethods from './request.methods'
// 用户相关 // 用户相关
const user_path = 'fims.user.' const USER_PATH = 'fims.user.'
// 角色相关 // 角色相关
const role_path = 'fims.role.' const ROLE_PATH = 'fims.role.'
export const LOGIN_URL = `${user_path}login` export const LOGIN_URL = `${USER_PATH}login`
export const Reg_URL = `${user_path}register` export const REG_URL = `${USER_PATH}register`
export const Role_LIST_URL = `${role_path}list` export const ROLE_LIST_URL = `${ROLE_PATH}list`
/** /**
* 用户登录 * 用户登录
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function AccountLogin (data) { export function AccountLogin(data) {
data.method = LOGIN_URL data.method = LOGIN_URL
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST)
} }
...@@ -29,8 +29,8 @@ export function AccountLogin (data) { ...@@ -29,8 +29,8 @@ export function AccountLogin (data) {
* 注册 * 注册
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function Reg (data = {}) { export function Reg(data = {}) {
data.method = Reg_URL data.method = REG_URL
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -38,8 +38,8 @@ export function Reg (data = {}) { ...@@ -38,8 +38,8 @@ export function Reg (data = {}) {
* 修改密码 * 修改密码
* @param {*} data * @param {*} data
*/ */
export function ModifyPassword (data) { export function ModifyPassword(data) {
data.method = `${user_path}password.modify` data.method = `${USER_PATH}password.modify`
return request(data, RequestMethods.POST) return request(data, RequestMethods.POST)
} }
...@@ -47,8 +47,8 @@ export function ModifyPassword (data) { ...@@ -47,8 +47,8 @@ export function ModifyPassword (data) {
* 获取用户列表 * 获取用户列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function UserList (data = {}) { export function UserList(data = {}) {
data.method = `${user_path}search` data.method = `${USER_PATH}search`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -56,8 +56,8 @@ export function UserList (data = {}) { ...@@ -56,8 +56,8 @@ export function UserList (data = {}) {
* 重置密码 * 重置密码
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function PassWordReset (data = {}) { export function PassWordReset(data = {}) {
data.method = `${user_path}password.reset` data.method = `${USER_PATH}password.reset`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -65,8 +65,8 @@ export function PassWordReset (data = {}) { ...@@ -65,8 +65,8 @@ export function PassWordReset (data = {}) {
* 帐户编辑 * 帐户编辑
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function AccountModify (data = {}) { export function AccountModify(data = {}) {
data.method = `${user_path}modify` data.method = `${USER_PATH}modify`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -74,8 +74,8 @@ export function AccountModify (data = {}) { ...@@ -74,8 +74,8 @@ export function AccountModify (data = {}) {
* 帐户延期 * 帐户延期
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function AccountIncrease (data = {}) { export function AccountIncrease(data = {}) {
data.method = `${user_path}validity.increase` data.method = `${USER_PATH}validity.increase`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -83,8 +83,8 @@ export function AccountIncrease (data = {}) { ...@@ -83,8 +83,8 @@ export function AccountIncrease (data = {}) {
* 帐户禁用 * 帐户禁用
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function AccountForbidden (data = {}) { export function AccountForbidden(data = {}) {
data.method = `${user_path}forbidden` data.method = `${USER_PATH}forbidden`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -92,8 +92,8 @@ export function AccountForbidden (data = {}) { ...@@ -92,8 +92,8 @@ export function AccountForbidden (data = {}) {
* 帐户激活 * 帐户激活
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function AccountActived (data = {}) { export function AccountActived(data = {}) {
data.method = `${user_path}actived` data.method = `${USER_PATH}actived`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -101,8 +101,8 @@ export function AccountActived (data = {}) { ...@@ -101,8 +101,8 @@ export function AccountActived (data = {}) {
* 帐户审核 * 帐户审核
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function AccountValidate (data = {}) { export function AccountValidate(data = {}) {
data.method = `${user_path}check` data.method = `${USER_PATH}check`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -110,8 +110,8 @@ export function AccountValidate (data = {}) { ...@@ -110,8 +110,8 @@ export function AccountValidate (data = {}) {
* 获取登录日志 * 获取登录日志
* @param {} data * @param {} data
*/ */
export function getLoginlogs (data) { export function getLoginlogs(data) {
data.method = `${user_path}search.loginlog` data.method = `${USER_PATH}search.loginlog`
return request(data) return request(data)
} }
...@@ -119,8 +119,8 @@ export function getLoginlogs (data) { ...@@ -119,8 +119,8 @@ export function getLoginlogs (data) {
* 获取角色权限资源列表 * 获取角色权限资源列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function RoleAuthData (data = {}) { export function RoleAuthData(data = {}) {
data.method = `${role_path}authority.data` data.method = `${ROLE_PATH}authority.data`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -128,8 +128,8 @@ export function RoleAuthData (data = {}) { ...@@ -128,8 +128,8 @@ export function RoleAuthData (data = {}) {
* 创建角色 * 创建角色
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function RoleReg (data = {}) { export function RoleReg(data = {}) {
data.method = `${role_path}register` data.method = `${ROLE_PATH}register`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -137,8 +137,8 @@ export function RoleReg (data = {}) { ...@@ -137,8 +137,8 @@ export function RoleReg (data = {}) {
* 权限修改 * 权限修改
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function RoleModify (data = {}) { export function RoleModify(data = {}) {
data.method = `${role_path}modify` data.method = `${ROLE_PATH}modify`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -146,8 +146,8 @@ export function RoleModify (data = {}) { ...@@ -146,8 +146,8 @@ export function RoleModify (data = {}) {
* 权限列表 * 权限列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function RoleList (data = {}) { export function RoleList(data = {}) {
data.method = Role_LIST_URL data.method = ROLE_LIST_URL
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -155,7 +155,7 @@ export function RoleList (data = {}) { ...@@ -155,7 +155,7 @@ export function RoleList (data = {}) {
* 角色详情 * 角色详情
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function RoleDetail (data = {}) { export function RoleDetail(data = {}) {
data.method = `${role_path}detail` data.method = `${ROLE_PATH}detail`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:55 * @Date: 2019-08-26 18:02:55
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-05 18:01:21 * @Last Modified time: 2019-09-11 19:09:15
*/ */
import request from './request' import request from './request'
import RequestMethods from './request.methods' import RequestMethods from './request.methods'
export const BaseDataURL = 'fims.configuration.from.conftype' export const BASE_DATA_URL = 'fims.configuration.from.conftype'
// 基础数据 // 基础数据
const path = 'fims.base.' const path = 'fims.base.'
...@@ -16,7 +16,7 @@ const path = 'fims.base.' ...@@ -16,7 +16,7 @@ const path = 'fims.base.'
* 获取站点列表 * 获取站点列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function StationList (data = {}) { export function StationList(data = {}) {
data.method = `${path}station` data.method = `${path}station`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -24,7 +24,7 @@ export function StationList (data = {}) { ...@@ -24,7 +24,7 @@ export function StationList (data = {}) {
* 获取公司列表 * 获取公司列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function CompanyList (data = {}) { export function CompanyList(data = {}) {
data.method = `${path}company` data.method = `${path}company`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -32,7 +32,7 @@ export function CompanyList (data = {}) { ...@@ -32,7 +32,7 @@ export function CompanyList (data = {}) {
* 获取部门列表 * 获取部门列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function DepartList (data = {}) { export function DepartList(data = {}) {
data.method = `${path}depart` data.method = `${path}depart`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -41,8 +41,8 @@ export function DepartList (data = {}) { ...@@ -41,8 +41,8 @@ export function DepartList (data = {}) {
* 获取角色列表 * 获取角色列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function FetchRoleList (data = {}) { export function FetchRoleList(data = {}) {
data.method = `fims.role.list` data.method = 'fims.role.list'
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -50,7 +50,7 @@ export function FetchRoleList (data = {}) { ...@@ -50,7 +50,7 @@ export function FetchRoleList (data = {}) {
* 获取职务列表 * 获取职务列表
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function PostList (data = {}) { export function PostList(data = {}) {
data.method = `${path}post` data.method = `${path}post`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
...@@ -59,7 +59,7 @@ export function PostList (data = {}) { ...@@ -59,7 +59,7 @@ export function PostList (data = {}) {
* 获取基础数据 * 获取基础数据
* @param {*} data 参数 * @param {*} data 参数
*/ */
export function BaseDataApi (data = {}) { export function BaseDataApi(data = {}) {
data.method = BaseDataURL data.method = BASE_DATA_URL
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
import request from './request' import request from './request'
const path = 'fims.system.' const path = 'fims.system.'
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function reportApi (data) { function reportApi(data) {
data.method = `${path}report` data.method = `${path}report`
return request(data) return request(data)
} }
function exportApi (data) { function exportApi(data) {
data.method = `${path}export` data.method = `${path}export`
return request(data) return request(data)
} }
......
...@@ -6,22 +6,22 @@ const methods = { ...@@ -6,22 +6,22 @@ const methods = {
Edit: `${path}edit` Edit: `${path}edit`
} }
function getListApi (data) { function getListApi(data) {
data.method = `${path}list` data.method = `${path}list`
return request(data) return request(data)
} }
function editApi (data) { function editApi(data) {
// data.method = `${path}edit` // data.method = `${path}edit`
return request(data) return request(data)
} }
function removeApi (data) { function removeApi(data) {
data.method = `${path}remove` data.method = `${path}remove`
return request(data) return request(data)
} }
function isExistApi (data) { function isExistApi(data) {
data.method = `${path}detail` data.method = `${path}detail`
return request(data) return request(data)
} }
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 19:06:01 * @Date: 2019-09-01 19:06:01
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-10 10:32:06 * @Last Modified time: 2019-09-11 19:09:01
*/ */
import { LOGIN_URL, REG_URL, Role_LIST_URL } from '@/api/sys.account' import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
import { BaseDataURL } from '@/api/sys.base' import { BASE_DATA_URL } from '@/api/sys.base'
export const TYPE_NAME = 'confType' export const TYPE_NAME = 'confType'
/** /**
...@@ -40,8 +40,8 @@ export const RegistType = { ...@@ -40,8 +40,8 @@ export const RegistType = {
export const LogExternals = [ export const LogExternals = [
LOGIN_URL, // 登录 LOGIN_URL, // 登录
REG_URL, // 注册 REG_URL, // 注册
BaseDataURL, // 基础数据 BASE_DATA_URL, // 基础数据
Role_LIST_URL // 角色列表 ROLE_LIST_URL // 角色列表
] ]
/** /**
* 登录来源 * 登录来源
......
...@@ -2,19 +2,19 @@ import Vue from 'vue' ...@@ -2,19 +2,19 @@ import Vue from 'vue'
export default new Vue({ export default new Vue({
methods: { methods: {
warningTips (message) { warningTips(message) {
this.$notify({ this.$notify({
type: 'warning', type: 'warning',
title: message title: message
}) })
}, },
okTips (message) { okTips(message) {
this.$notify({ this.$notify({
type: 'success', type: 'success',
title: message || '操作成功' title: message || '操作成功'
}) })
}, },
errorTips (message) { errorTips(message) {
this.$notify({ this.$notify({
type: 'error', type: 'error',
title: message || '操作失败' title: message || '操作失败'
......
...@@ -21,11 +21,11 @@ export default { ...@@ -21,11 +21,11 @@ export default {
mixins: [ mixins: [
scroll scroll
], ],
mounted () { mounted() {
// 增加滚动事件监听 // 增加滚动事件监听
this.addScrollListener() this.addScrollListener()
}, },
beforeDestroy () { beforeDestroy() {
// 移除滚动事件监听 // 移除滚动事件监听
this.removeScrollListener() this.removeScrollListener()
} }
......
...@@ -15,14 +15,13 @@ ...@@ -15,14 +15,13 @@
<script> <script>
import scroll from './mixins/normal' import scroll from './mixins/normal'
import { mapState } from 'vuex'
export default { export default {
name: 'd2-container-full', name: 'd2-container-full',
mixins: [scroll], mixins: [scroll],
components: { components: {
d2HeaderSwitch: () => import('./d2-header-switch.vue') d2HeaderSwitch: () => import('./d2-header-switch.vue')
}, },
data () { data() {
return { return {
oHeaderStyle: { oHeaderStyle: {
padding: '20px 20px 0 20px' padding: '20px 20px 0 20px'
...@@ -30,15 +29,15 @@ export default { ...@@ -30,15 +29,15 @@ export default {
} }
}, },
computed: { computed: {
active () { active() {
return this.$store.state.d2admin.tsearch.active return this.$store.state.d2admin.tsearch.active
} }
}, },
mounted () { mounted() {
// 增加滚动事件监听 // 增加滚动事件监听
this.addScrollListener() this.addScrollListener()
}, },
beforeDestroy () { beforeDestroy() {
// 移除滚动事件监听 // 移除滚动事件监听
this.removeScrollListener() this.removeScrollListener()
} }
......
...@@ -19,11 +19,11 @@ export default { ...@@ -19,11 +19,11 @@ export default {
mixins: [ mixins: [
scroll scroll
], ],
mounted () { mounted() {
// 增加滚动事件监听 // 增加滚动事件监听
this.addScrollListener() this.addScrollListener()
}, },
beforeDestroy () { beforeDestroy() {
// 移除滚动事件监听 // 移除滚动事件监听
this.removeScrollListener() this.removeScrollListener()
} }
......
...@@ -11,24 +11,24 @@ ...@@ -11,24 +11,24 @@
<script> <script>
import { mapMutations } from 'vuex' import { mapMutations } from 'vuex'
export default { export default {
data () { data() {
return { return {
isActive: false, isActive: false,
path: '' path: ''
} }
}, },
computed: { computed: {
show () { show() {
return true return true
} }
}, },
mounted () { mounted() {
setTimeout(() => this.isActive = true, 0) setTimeout(() => (this.isActive = true), 0)
}, },
methods: { methods: {
...mapMutations('d2admin/tsearch', ['toggle']), ...mapMutations('d2admin/tsearch', ['toggle']),
// 点击按钮的时候跳转到源代码 // 点击按钮的时候跳转到源代码
handleClick () { handleClick() {
this.toggle() this.toggle()
} }
} }
......
...@@ -9,28 +9,27 @@ ...@@ -9,28 +9,27 @@
</template> </template>
<script> <script>
import { last, get } from 'lodash'
export default { export default {
data () { data() {
return { return {
isActive: false, isActive: false,
path: '' path: ''
} }
}, },
computed: { computed: {
show () { show() {
return process.env.VUE_APP_BUILD_MODE === 'TRAVIS' || process.env.NODE_ENV === 'development' return process.env.VUE_APP_BUILD_MODE === 'TRAVIS' || process.env.NODE_ENV === 'development'
} }
}, },
watch: { watch: {
$route: { $route: {
handler (to) { handler(to) {
this.path = _.get(_.last(to.matched), 'components.default.__source') this.path = _.get(_.last(to.matched), 'components.default.__source')
}, },
immediate: true immediate: true
} }
}, },
mounted () { mounted() {
// 一秒后显示按钮 // 一秒后显示按钮
setTimeout(() => { setTimeout(() => {
this.isActive = true this.isActive = true
...@@ -38,7 +37,7 @@ export default { ...@@ -38,7 +37,7 @@ export default {
}, },
methods: { methods: {
// 点击按钮的时候跳转到源代码 // 点击按钮的时候跳转到源代码
handleClick () { handleClick() {
this.$open(`${process.env.VUE_APP_REPO}/blob/master/${this.path}`) this.$open(`${process.env.VUE_APP_REPO}/blob/master/${this.path}`)
} }
} }
......
...@@ -8,19 +8,19 @@ export default { ...@@ -8,19 +8,19 @@ export default {
default: () => ({}) default: () => ({})
} }
}, },
data () { data() {
return { return {
BS: null BS: null
} }
}, },
mounted () { mounted() {
this.scrollInit() this.scrollInit()
}, },
beforeDestroy () { beforeDestroy() {
this.scrollDestroy() this.scrollDestroy()
}, },
methods: { methods: {
scrollInit () { scrollInit() {
// 初始化 bs // 初始化 bs
this.BS = new BScroll(this.$refs.wrapper, Object.assign({ this.BS = new BScroll(this.$refs.wrapper, Object.assign({
mouseWheel: true, mouseWheel: true,
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
y: -y y: -y
})) }))
}, },
scrollDestroy () { scrollDestroy() {
// https://github.com/d2-projects/d2-admin/issues/75 // https://github.com/d2-projects/d2-admin/issues/75
try { try {
this.BS.destroy() this.BS.destroy()
...@@ -46,11 +46,11 @@ export default { ...@@ -46,11 +46,11 @@ export default {
} }
}, },
// 外部调用的方法 返回顶部 // 外部调用的方法 返回顶部
scrollToTop () { scrollToTop() {
if (this.BS) this.BS.scrollTo(0, 0, 300) if (this.BS) this.BS.scrollTo(0, 0, 300)
}, },
// 手动发出滚动事件 // 手动发出滚动事件
scroll () { scroll() {
if (this.BS) { if (this.BS) {
this.$emit('scroll', { this.$emit('scroll', {
x: -this.BS.x, x: -this.BS.x,
......
// 提供滚动方面的功能 // 提供滚动方面的功能
// 非滚动优化模式通用 // 非滚动优化模式通用
import { throttle } from 'lodash'
// 生成滚动事件的 handler // 生成滚动事件的 handler
function handleMaker (wait) { function handleMaker(wait) {
return _.throttle(e => { return _.throttle(e => {
this.$emit('scroll', { this.$emit('scroll', {
x: e.target.scrollLeft, x: e.target.scrollLeft,
...@@ -22,13 +20,13 @@ export default { ...@@ -22,13 +20,13 @@ export default {
default: 10 default: 10
} }
}, },
data () { data() {
return { return {
handleScroll: null handleScroll: null
} }
}, },
watch: { watch: {
scrollDelay (val) { scrollDelay(val) {
// 移除旧的监听 // 移除旧的监听
this.removeScrollListener() this.removeScrollListener()
// 生成新的 handle 方法 // 生成新的 handle 方法
...@@ -39,7 +37,7 @@ export default { ...@@ -39,7 +37,7 @@ export default {
}, },
methods: { methods: {
// 增加滚动事件监听 // 增加滚动事件监听
addScrollListener () { addScrollListener() {
if (typeof this.handleScroll !== 'function') { if (typeof this.handleScroll !== 'function') {
// mounted 生命周期内调用这个方法的时候会进入这里的判断 // mounted 生命周期内调用这个方法的时候会进入这里的判断
this.handleScroll = handleMaker.call(this, this.scrollDelay) this.handleScroll = handleMaker.call(this, this.scrollDelay)
...@@ -48,11 +46,11 @@ export default { ...@@ -48,11 +46,11 @@ export default {
this.$refs.body.addEventListener('scroll', this.handleScroll) this.$refs.body.addEventListener('scroll', this.handleScroll)
}, },
// 移除滚动事件监听 // 移除滚动事件监听
removeScrollListener () { removeScrollListener() {
this.$refs.body.removeEventListener('scroll', this.handleScroll) this.$refs.body.removeEventListener('scroll', this.handleScroll)
}, },
// 外部调用的方法 返回顶部 // 外部调用的方法 返回顶部
scrollToTop () { scrollToTop() {
const smoothscroll = () => { const smoothscroll = () => {
const body = this.$refs.body const body = this.$refs.body
const currentScroll = body.scrollTop const currentScroll = body.scrollTop
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
}, },
computed: { computed: {
// 始终返回渲染组件 // 始终返回渲染组件
component () { component() {
if (this.type === 'card' && !this.betterScroll) return d2ContainerCard if (this.type === 'card' && !this.betterScroll) return d2ContainerCard
if (this.type === 'card' && this.betterScroll) return d2ContainerCardBs if (this.type === 'card' && this.betterScroll) return d2ContainerCardBs
if (this.type === 'ghost' && !this.betterScroll) return d2ContainerGhost if (this.type === 'ghost' && !this.betterScroll) return d2ContainerGhost
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
} }
} }
}, },
render (h) { render(h) {
const slots = [ this.$slots.default ] const slots = [ this.$slots.default ]
if (this.$slots.header) slots.push(h('template', { slot: 'header' }, [ this.$slots.header ])) if (this.$slots.header) slots.push(h('template', { slot: 'header' }, [ this.$slots.header ]))
if (this.$slots.footer) slots.push(h('template', { slot: 'footer' }, [ this.$slots.footer ])) if (this.$slots.footer) slots.push(h('template', { slot: 'footer' }, [ this.$slots.footer ]))
...@@ -57,14 +57,14 @@ export default { ...@@ -57,14 +57,14 @@ export default {
}, },
methods: { methods: {
// 返回顶部 // 返回顶部
scrollToTop () { scrollToTop() {
this.$refs.component.scrollToTop() this.$refs.component.scrollToTop()
// 如果开启了 better scroll 还需要手动触发一遍 scroll 事件 // 如果开启了 better scroll 还需要手动触发一遍 scroll 事件
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) this.$refs.component.scroll() if (bs) this.$refs.component.scroll()
}, },
// 用法同原生方法 scrollBy // 用法同原生方法 scrollBy
scrollBy (x = 0, y = 0, time = 300) { scrollBy(x = 0, y = 0, time = 300) {
if (this.betterScroll) { if (this.betterScroll) {
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) { if (bs) {
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ export default {
} }
}, },
// 用法同原生方法 scrollTo // 用法同原生方法 scrollTo
scrollTo (x = 0, y = 0, time = 300) { scrollTo(x = 0, y = 0, time = 300) {
if (this.betterScroll) { if (this.betterScroll) {
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) { if (bs) {
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
} }
}, },
// 用法同原生方法 scrollTop // 用法同原生方法 scrollTop
scrollTop (top = 0, time = 300) { scrollTop(top = 0, time = 300) {
if (this.betterScroll) { if (this.betterScroll) {
const bs = this.$refs.component.BS const bs = this.$refs.component.BS
if (bs) { if (bs) {
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
} }
}, },
computed: { computed: {
icon () { icon() {
return `#d2-${this.name}` return `#d2-${this.name}`
} }
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
export default { export default {
name: 'focus', name: 'focus',
inserted: function (el) { inserted: function(el) {
el.querySelector('input').focus() el.querySelector('input').focus()
} }
} }
...@@ -4,7 +4,7 @@ import util from '@/libs/util' ...@@ -4,7 +4,7 @@ import util from '@/libs/util'
Vue.use(VueI18n) Vue.use(VueI18n)
function loadLocaleMessages () { function loadLocaleMessages() {
const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i) const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
const messages = {} const messages = {}
locales.keys().forEach(key => { locales.keys().forEach(key => {
......
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
} }
}, },
methods: { methods: {
rowClick (event) { rowClick(event) {
let target = event.target let target = event.target
while (!target.dataset.value) { while (!target.dataset.value) {
target = target.parentNode target = target.parentNode
......
...@@ -26,18 +26,18 @@ export default { ...@@ -26,18 +26,18 @@ export default {
}, },
computed: { computed: {
flag: { flag: {
get () { get() {
if (this.visible) { if (this.visible) {
// 注册全局监听事件 [ 目前只考虑鼠标解除触发 ] // 注册全局监听事件 [ 目前只考虑鼠标解除触发 ]
window.addEventListener('mousedown', this.watchContextmenu) window.addEventListener('mousedown', this.watchContextmenu)
} }
return this.visible return this.visible
}, },
set (newVal) { set(newVal) {
this.$emit('update:visible', newVal) this.$emit('update:visible', newVal)
} }
}, },
style () { style() {
return { return {
left: this.x + 'px', left: this.x + 'px',
top: this.y + 'px', top: this.y + 'px',
...@@ -46,12 +46,12 @@ export default { ...@@ -46,12 +46,12 @@ export default {
} }
}, },
methods: { methods: {
watchContextmenu (event) { watchContextmenu(event) {
if (!this.$el.contains(event.target) || event.button !== 0) this.flag = false if (!this.$el.contains(event.target) || event.button !== 0) this.flag = false
window.removeEventListener('mousedown', this.watchContextmenu) window.removeEventListener('mousedown', this.watchContextmenu)
} }
}, },
mounted () { mounted() {
// 将菜单放置到body下 // 将菜单放置到body下
document.querySelector('body').appendChild(this.$el) document.querySelector('body').appendChild(this.$el)
} }
......
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
} }
}, },
methods: { methods: {
click () { click() {
this.onClick && this.onClick() this.onClick && this.onClick()
} }
} }
......
...@@ -12,7 +12,7 @@ import { mapState, mapActions } from 'vuex' ...@@ -12,7 +12,7 @@ import { mapState, mapActions } from 'vuex'
export default { export default {
name: 'd2-header-color', name: 'd2-header-color',
data () { data() {
return { return {
predefine: [ predefine: [
'#FF0000', '#008000', '#0000FF' '#FF0000', '#008000', '#0000FF'
...@@ -26,11 +26,11 @@ export default { ...@@ -26,11 +26,11 @@ export default {
}) })
}, },
watch: { watch: {
value (value) { value(value) {
this.set(value) this.set(value)
} }
}, },
mounted () { mounted() {
this.predefine = [...this.predefine, ...this.listTheme.map(theme => theme.color)] this.predefine = [...this.predefine, ...this.listTheme.map(theme => theme.color)]
}, },
methods: { methods: {
......
...@@ -7,20 +7,20 @@ import dayjs from 'dayjs' ...@@ -7,20 +7,20 @@ import dayjs from 'dayjs'
const sFormat = 'YYYY年MM月DD日' const sFormat = 'YYYY年MM月DD日'
export default { export default {
name: 'd2-header-datetime', name: 'd2-header-datetime',
data () { data() {
return { return {
timeInterval: null, timeInterval: null,
time: dayjs().format(sFormat) time: dayjs().format(sFormat)
} }
}, },
mounted () { mounted() {
// this.timeInterval = setInterval(() => this.refreshTime(), 1000); // this.timeInterval = setInterval(() => this.refreshTime(), 1000);
}, },
beforeDestroy () { beforeDestroy() {
clearInterval(this.timeInterval) clearInterval(this.timeInterval)
}, },
methods: { methods: {
refreshTime () { refreshTime() {
this.time = dayjs().format(sFormat) this.time = dayjs().format(sFormat)
} }
} }
......
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
<script> <script>
export default { export default {
methods: { methods: {
onChangeLocale (command) { onChangeLocale(command) {
this.$i18n.locale = command this.$i18n.locale = command
let message = `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]` let message = `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`
if (!['TRAVIS', 'NETLIFY'].includes(process.env.VUE_APP_BUILD_MODE)) { if (!['TRAVIS', 'NETLIFY'].includes(process.env.VUE_APP_BUILD_MODE)) {
message = [ message = [
`当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`, `当前语言:${this.$t('_name')} [ ${this.$i18n.locale} ]`,
`仅提供切换功能,没有配置具体的语言数据 `, '仅提供切换功能,没有配置具体的语言数据 ',
`文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>` '文档参考:<a class="el-link el-link--primary is-underline" target="_blank" href="https://doc.d2admin.fairyever.com/zh/sys-locales/">《国际化 | D2Admin》</a>'
].join('<br/>') ].join('<br/>')
} }
this.$notify({ this.$notify({
......
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
logLength: 'log/length', logLength: 'log/length',
logLengthError: 'log/lengthError' logLengthError: 'log/lengthError'
}), }),
tooltipContent () { tooltipContent() {
return this.logLength === 0 return this.logLength === 0
? '没有日志或异常' ? '没有日志或异常'
: `${this.logLength} 条日志${this.logLengthError > 0 : `${this.logLength} 条日志${this.logLengthError > 0
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
...mapMutations('d2admin/log', [ ...mapMutations('d2admin/log', [
'clean' 'clean'
]), ]),
handleClick () { handleClick() {
this.$router.push({ this.$router.push({
name: 'log' name: 'log'
}) })
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<script> <script>
export default { export default {
methods: { methods: {
handleClick () { handleClick() {
this.$emit('click') this.$emit('click')
} }
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import { mapState, mapMutations, mapActions } from 'vuex' import { mapState, mapMutations, mapActions } from 'vuex'
export default { export default {
name: 'd2-header-size', name: 'd2-header-size',
data () { data() {
return { return {
options: [ options: [
{ label: '大', value: 'default' }, { label: '大', value: 'default' },
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
...mapActions({ ...mapActions({
sizeSet: 'd2admin/size/set' sizeSet: 'd2admin/size/set'
}), }),
handleChange (value) { handleChange(value) {
this.sizeSet(value) this.sizeSet(value)
// this.$notify({ // this.$notify({
// title: '提示', // title: '提示',
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
// type: 'success' // type: 'success'
// }) // })
}, },
iconName (name) { iconName(name) {
return name === this.value ? 'dot-circle-o' : 'circle-o' return name === this.value ? 'dot-circle-o' : 'circle-o'
} }
} }
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
name: 'd2-theme-list', name: 'd2-theme-list',
data () { data() {
return { return {
table: { table: {
showHeader: false, showHeader: false,
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
'set' 'set'
]), ]),
...mapActions('d2admin/color', { setColor: 'set' }), ...mapActions('d2admin/color', { setColor: 'set' }),
handleSelectTheme (row) { handleSelectTheme(row) {
const { name, color } = row const { name, color } = row
this.set(name) this.set(name)
this.setColor(color) this.setColor(color)
......
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
components: { components: {
'd2-theme-list': themeList 'd2-theme-list': themeList
}, },
data () { data() {
return { return {
dialogVisible: false dialogVisible: false
} }
......
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
components: { components: {
PersonalPanel PersonalPanel
}, },
mounted () { mounted() {
this.$event.$on('e-password-dialog', res => (this.passVisible = res)) this.$event.$on('e-password-dialog', res => (this.passVisible = res))
}, },
computed: { computed: {
......
// 创建 el-menu-item // 创建 el-menu-item
export function elMenuItem (createElement, menu) { export function elMenuItem(createElement, menu) {
return createElement('el-menu-item', { props: { index: menu.path } }, [ return createElement('el-menu-item', { props: { index: menu.path } }, [
...menu.icon ? [ ...menu.icon ? [
createElement('i', { attrs: { class: `el-icon-${menu.icon}` } }) createElement('i', { attrs: { class: `el-icon-${menu.icon}` } })
...@@ -15,7 +15,7 @@ export function elMenuItem (createElement, menu) { ...@@ -15,7 +15,7 @@ export function elMenuItem (createElement, menu) {
} }
// 创建 el-submenu // 创建 el-submenu
export function elSubmenu (createElement, menu) { export function elSubmenu(createElement, menu) {
return createElement('el-submenu', { props: { index: menu.path } }, [ return createElement('el-submenu', { props: { index: menu.path } }, [
...menu.icon ? [ ...menu.icon ? [
createElement('i', { slot: 'title', attrs: { class: `el-icon-${menu.icon}` } }) createElement('i', { slot: 'title', attrs: { class: `el-icon-${menu.icon}` } })
......
import { throttle } from 'lodash'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import menuMixin from '../mixin/menu' import menuMixin from '../mixin/menu'
import { elMenuItem, elSubmenu } from '../libs/util.menu' import { elMenuItem, elSubmenu } from '../libs/util.menu'
...@@ -8,7 +7,7 @@ export default { ...@@ -8,7 +7,7 @@ export default {
mixins: [ mixins: [
menuMixin menuMixin
], ],
render (createElement) { render(createElement) {
return createElement('div', { return createElement('div', {
attrs: { flex: 'cross:center' }, attrs: { flex: 'cross:center' },
class: { 'd2-theme-header-menu': true, 'is-scrollable': this.isScroll }, class: { 'd2-theme-header-menu': true, 'is-scrollable': this.isScroll },
...@@ -50,7 +49,7 @@ export default { ...@@ -50,7 +49,7 @@ export default {
'header' 'header'
]) ])
}, },
data () { data() {
return { return {
active: '', active: '',
isScroll: false, isScroll: false,
...@@ -62,14 +61,14 @@ export default { ...@@ -62,14 +61,14 @@ export default {
}, },
watch: { watch: {
'$route.matched': { '$route.matched': {
handler (val) { handler(val) {
this.active = val[val.length - 1].path this.active = val[val.length - 1].path
}, },
immediate: true immediate: true
} }
}, },
methods: { methods: {
scroll (direction) { scroll(direction) {
if (direction === 'left') { if (direction === 'left') {
// 向右滚动 // 向右滚动
this.currentTranslateX = 0 this.currentTranslateX = 0
...@@ -82,7 +81,7 @@ export default { ...@@ -82,7 +81,7 @@ export default {
} }
} }
}, },
checkScroll () { checkScroll() {
let contentWidth = this.$refs.content.clientWidth let contentWidth = this.$refs.content.clientWidth
let scrollWidth = this.$refs.scroll.clientWidth let scrollWidth = this.$refs.scroll.clientWidth
if (this.isScroll) { if (this.isScroll) {
...@@ -117,7 +116,7 @@ export default { ...@@ -117,7 +116,7 @@ export default {
} }
} }
}, },
mounted () { mounted() {
// 初始化判断 // 初始化判断
// 默认判断父元素和子元素的大小,以确定初始情况是否显示滚动 // 默认判断父元素和子元素的大小,以确定初始情况是否显示滚动
window.addEventListener('load', this.checkScroll) window.addEventListener('load', this.checkScroll)
...@@ -125,7 +124,7 @@ export default { ...@@ -125,7 +124,7 @@ export default {
this.throttledCheckScroll = _.throttle(this.checkScroll, 300) this.throttledCheckScroll = _.throttle(this.checkScroll, 300)
window.addEventListener('resize', this.throttledCheckScroll) window.addEventListener('resize', this.throttledCheckScroll)
}, },
beforeDestroy () { beforeDestroy() {
// 取消监听 // 取消监听
window.removeEventListener('resize', this.throttledCheckScroll) window.removeEventListener('resize', this.throttledCheckScroll)
window.removeEventListener('load', this.checkScroll) window.removeEventListener('load', this.checkScroll)
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
mixins: [ mixins: [
menuMixin menuMixin
], ],
render (createElement) { render(createElement) {
return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } }, [ return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } }, [
createElement('el-menu', { createElement('el-menu', {
props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active }, props: { collapse: this.asideCollapse, uniqueOpened: true, defaultActive: this.active },
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
] : [] ] : []
]) ])
}, },
data () { data() {
return { return {
active: '', active: '',
asideHeight: 300, asideHeight: 300,
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
}, },
watch: { watch: {
// 折叠和展开菜单的时候销毁 better scroll // 折叠和展开菜单的时候销毁 better scroll
asideCollapse (val) { asideCollapse(val) {
this.scrollDestroy() this.scrollDestroy()
setTimeout(() => { setTimeout(() => {
this.scrollInit() this.scrollInit()
...@@ -46,20 +46,20 @@ export default { ...@@ -46,20 +46,20 @@ export default {
}, },
// 监听路由 控制侧边栏激活状态 // 监听路由 控制侧边栏激活状态
'$route.fullPath': { '$route.fullPath': {
handler (value) { handler(value) {
this.active = value this.active = value
}, },
immediate: true immediate: true
} }
}, },
mounted () { mounted() {
this.scrollInit() this.scrollInit()
}, },
beforeDestroy () { beforeDestroy() {
this.scrollDestroy() this.scrollDestroy()
}, },
methods: { methods: {
scrollInit () { scrollInit() {
this.BS = new BScroll(this.$el, { this.BS = new BScroll(this.$el, {
mouseWheel: true, mouseWheel: true,
click: true click: true
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
// } // }
}) })
}, },
scrollDestroy () { scrollDestroy() {
// https://github.com/d2-projects/d2-admin/issues/75 // https://github.com/d2-projects/d2-admin/issues/75
try { try {
this.BS.destroy() this.BS.destroy()
......
...@@ -2,7 +2,7 @@ import util from '@/libs/util.js' ...@@ -2,7 +2,7 @@ import util from '@/libs/util.js'
export default { export default {
methods: { methods: {
handleMenuSelect (index, indexPath) { handleMenuSelect(index, indexPath) {
if (/^d2-menu-empty-\d+$/.test(index) || index === undefined) { if (/^d2-menu-empty-\d+$/.test(index) || index === undefined) {
this.$message.warning('临时菜单') this.$message.warning('临时菜单')
} else if (/^https:\/\/|http:\/\//.test(index)) { } else if (/^https:\/\/|http:\/\//.test(index)) {
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
components: { components: {
'd2-panel-search-item': () => import('./components/panel-search-item/index.vue') 'd2-panel-search-item': () => import('./components/panel-search-item/index.vue')
}, },
data () { data() {
return { return {
searchText: '', searchText: '',
results: [] results: []
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
'pool' 'pool'
]), ]),
// 这份数据是展示在搜索面板下面的 // 这份数据是展示在搜索面板下面的
resultsList () { resultsList() {
return (this.results.length === 0 && this.searchText === '') ? this.pool.map(e => ({ return (this.results.length === 0 && this.searchText === '') ? this.pool.map(e => ({
value: e.fullTitle, value: e.fullTitle,
...e ...e
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
/** /**
* @description 过滤选项 这个方法在每次输入框的值发生变化时会触发 * @description 过滤选项 这个方法在每次输入框的值发生变化时会触发
*/ */
querySearch (queryString, callback) { querySearch(queryString, callback) {
var pool = this.pool var pool = this.pool
const results = this.query(queryString ? pool : [], queryString) const results = this.query(queryString ? pool : [], queryString)
this.results = results this.results = results
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
* @param {Object} pool 需要过滤的数据 * @param {Object} pool 需要过滤的数据
* @param {String} queryString 查询字符串 * @param {String} queryString 查询字符串
*/ */
query (pool, queryString) { query(pool, queryString) {
return new Fuse(pool, { return new Fuse(pool, {
shouldSort: true, shouldSort: true,
tokenize: true, tokenize: true,
...@@ -120,7 +120,7 @@ export default { ...@@ -120,7 +120,7 @@ export default {
/** /**
* @description 聚焦输入框 * @description 聚焦输入框
*/ */
focus () { focus() {
this.input = '' this.input = ''
setTimeout(() => { setTimeout(() => {
if (this.$refs.input) { if (this.$refs.input) {
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
/** /**
* @description 接收用户在列表中选择项目的事件 * @description 接收用户在列表中选择项目的事件
*/ */
handleResultsGroupItemClick (path) { handleResultsGroupItemClick(path) {
// 如果用户选择的就是当前页面 就直接关闭搜索面板 // 如果用户选择的就是当前页面 就直接关闭搜索面板
if (path === this.$route.path) { if (path === this.$route.path) {
this.handleEsc() this.handleEsc()
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
/** /**
* @description 接收用户在下拉菜单中选中事件 * @description 接收用户在下拉菜单中选中事件
*/ */
handleSelect ({ path }) { handleSelect({ path }) {
// 如果用户选择的就是当前页面 就直接关闭搜索面板 // 如果用户选择的就是当前页面 就直接关闭搜索面板
if (path === this.$route.path) { if (path === this.$route.path) {
this.handleEsc() this.handleEsc()
...@@ -160,7 +160,7 @@ export default { ...@@ -160,7 +160,7 @@ export default {
/** /**
* @augments 关闭输入框的下拉菜单 * @augments 关闭输入框的下拉菜单
*/ */
closeSuggestion () { closeSuggestion() {
if (this.$refs.input.activated) { if (this.$refs.input.activated) {
this.$refs.input.suggestions = [] this.$refs.input.suggestions = []
this.$refs.input.activated = false this.$refs.input.activated = false
...@@ -169,13 +169,13 @@ export default { ...@@ -169,13 +169,13 @@ export default {
/** /**
* @augments 接收用户点击空白区域的关闭 * @augments 接收用户点击空白区域的关闭
*/ */
handlePanelClick () { handlePanelClick() {
this.handleEsc() this.handleEsc()
}, },
/** /**
* @augments 接收用户触发的关闭 * @augments 接收用户触发的关闭
*/ */
handleEsc () { handleEsc() {
this.closeSuggestion() this.closeSuggestion()
this.$nextTick(() => { this.$nextTick(() => {
this.$emit('close') this.$emit('close')
......
...@@ -59,23 +59,23 @@ export default { ...@@ -59,23 +59,23 @@ export default {
computed: { computed: {
...mapState('d2admin/user', ['info']) ...mapState('d2admin/user', ['info'])
}, },
data () { data() {
return { return {
personalVisible: false, personalVisible: false,
passwordVisible: false passwordVisible: false
} }
}, },
mounted () { mounted() {
this.$event.$on('e-ps-close', is2Login => { this.$event.$on('e-ps-close', is2Login => {
this.passwordVisible = false this.passwordVisible = false
if (!is2Login) return if (!is2Login) return
this.$message(`修改密码成功,2秒后退回登录页`) this.$message('修改密码成功,2秒后退回登录页')
setTimeout(async () => { setTimeout(async() => {
await this.logout() await this.logout()
this.$router.push('/login') this.$router.push('/login')
}, 2000) }, 2000)
}) })
this.$event.$on('e-pd-close', () => this.personalVisible = false) this.$event.$on('e-pd-close', () => (this.personalVisible = false))
}, },
components: { components: {
personalDialog: () => import('./personalDialog'), personalDialog: () => import('./personalDialog'),
...@@ -86,14 +86,14 @@ export default { ...@@ -86,14 +86,14 @@ export default {
/** /**
* @description 登出 * @description 登出
*/ */
logOut () { logOut() {
this.$store.commit('d2admin/gray/set', true) this.$store.commit('d2admin/gray/set', true)
MessageBox.confirm('确定要注销当前用户吗', '注销用户', { MessageBox.confirm('确定要注销当前用户吗', '注销用户', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(async () => { .then(async() => {
await this.$store.commit('d2admin/gray/set', false) await this.$store.commit('d2admin/gray/set', false)
// await this.$store.dispatch('d2admin/user/set', {}) // await this.$store.dispatch('d2admin/user/set', {})
await this.logout() await this.logout()
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
// }) // })
}) })
}, },
clear () { clear() {
this.$store.commit('d2admin/gray/set', true) this.$store.commit('d2admin/gray/set', true)
MessageBox.confirm( MessageBox.confirm(
'清空本地缓存将重置所有个性化设置并退出到登录界面', '清空本地缓存将重置所有个性化设置并退出到登录界面',
...@@ -117,7 +117,7 @@ export default { ...@@ -117,7 +117,7 @@ export default {
type: 'warning' type: 'warning'
} }
) )
.then(async () => { .then(async() => {
await this.$store.commit('d2admin/gray/set', false) await this.$store.commit('d2admin/gray/set', false)
localStorage.clear() localStorage.clear()
window.location.reload() window.location.reload()
...@@ -129,15 +129,16 @@ export default { ...@@ -129,15 +129,16 @@ export default {
// }) // })
}) })
}, },
comfirm (text, title, cancleText) { comfirm(text, title, cancleText) {
return new Promise((reject, resolve) => { // eslint-disable-next-line promise/param-names
return new Promise((resolve, reject) => {
this.$store.commit('d2admin/gray/set', true) this.$store.commit('d2admin/gray/set', true)
MessageBox.confirm(text, title, { MessageBox.confirm(text, title, {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(async () => { .then(async() => {
await this.$store.commit('d2admin/gray/set', false) await this.$store.commit('d2admin/gray/set', false)
resolve(true) resolve(true)
}) })
...@@ -146,15 +147,15 @@ export default { ...@@ -146,15 +147,15 @@ export default {
Message({ Message({
message: cancleText message: cancleText
}) })
reject() reject(new Error('错误'))
}) })
}) })
}, },
// 打开个人信息弹出框 // 打开个人信息弹出框
openPersonalDialog: function () { openPersonalDialog: function() {
this.personalVisible = true this.personalVisible = true
}, },
openPasswordDialog: function () { openPasswordDialog: function() {
this.passwordVisible = true this.passwordVisible = true
} }
} }
......
...@@ -35,7 +35,7 @@ import { ModifyPassword } from '@api/sys.account' ...@@ -35,7 +35,7 @@ import { ModifyPassword } from '@api/sys.account'
export default { export default {
name: 'PasswordDialog', name: 'PasswordDialog',
components: {}, components: {},
data () { data() {
return { return {
rules: Object.freeze({ rules: Object.freeze({
oldPassword: [ oldPassword: [
...@@ -81,13 +81,13 @@ export default { ...@@ -81,13 +81,13 @@ export default {
user: Object user: Object
}, },
computed: { computed: {
info () { info() {
return this.user return this.user
} }
}, },
methods: { methods: {
// 修改密码 // 修改密码
submit () { submit() {
this.$refs.passwordForm.validate(async valid => { this.$refs.passwordForm.validate(async valid => {
if (valid) { if (valid) {
const { userId, oldPassword, newPassword } = this.info const { userId, oldPassword, newPassword } = this.info
...@@ -101,10 +101,10 @@ export default { ...@@ -101,10 +101,10 @@ export default {
} }
}) })
}, },
handleClose () { handleClose() {
this.emit(false) this.emit(false)
}, },
emit (is2Login) { emit(is2Login) {
this.$event.$emit('e-ps-close', is2Login) this.$event.$emit('e-ps-close', is2Login)
this.$refs.passwordForm.validateField() this.$refs.passwordForm.validateField()
} }
......
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
user: Object user: Object
}, },
methods: { methods: {
handleClose () { handleClose() {
this.$event.$emit('e-pd-close') this.$event.$emit('e-pd-close')
} }
} }
......
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
D2Contextmenu: () => import('../contextmenu'), D2Contextmenu: () => import('../contextmenu'),
D2ContextmenuList: () => import('../contextmenu/components/contentmenuList') D2ContextmenuList: () => import('../contextmenu/components/contentmenuList')
}, },
data () { data() {
return { return {
contextmenuFlag: false, contextmenuFlag: false,
contentmenuX: 0, contentmenuX: 0,
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
/** /**
* @description 右键菜单功能点击 * @description 右键菜单功能点击
*/ */
handleContextmenu (event) { handleContextmenu(event) {
let target = event.target let target = event.target
// 解决 https://github.com/d2-projects/d2-admin/issues/54 // 解决 https://github.com/d2-projects/d2-admin/issues/54
let flag = false let flag = false
...@@ -120,13 +120,13 @@ export default { ...@@ -120,13 +120,13 @@ export default {
/** /**
* @description 右键菜单的row-click事件 * @description 右键菜单的row-click事件
*/ */
contextmenuClick (command) { contextmenuClick(command) {
this.handleControlItemClick(command, this.tagName) this.handleControlItemClick(command, this.tagName)
}, },
/** /**
* @description 接收点击关闭控制上选项的事件 * @description 接收点击关闭控制上选项的事件
*/ */
handleControlItemClick (command, tagName = null) { handleControlItemClick(command, tagName = null) {
if (tagName) { if (tagName) {
this.contextmenuFlag = false this.contextmenuFlag = false
} }
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
/** /**
* @description 接收点击 tab 标签的事件 * @description 接收点击 tab 标签的事件
*/ */
handleClick (tab, event) { handleClick(tab, event) {
// 找到点击的页面在 tag 列表里是哪个 // 找到点击的页面在 tag 列表里是哪个
const page = this.opened.find(page => page.fullPath === tab.name) const page = this.opened.find(page => page.fullPath === tab.name)
const { name, params, query } = page const { name, params, query } = page
...@@ -165,7 +165,7 @@ export default { ...@@ -165,7 +165,7 @@ export default {
/** /**
* @description 点击 tab 上的删除按钮触发这里 首页的删除按钮已经隐藏 因此这里不用判断是 index * @description 点击 tab 上的删除按钮触发这里 首页的删除按钮已经隐藏 因此这里不用判断是 index
*/ */
handleTabsEdit (tagName, action) { handleTabsEdit(tagName, action) {
if (action === 'remove') { if (action === 'remove') {
this.close({ this.close({
tagName tagName
......
...@@ -86,12 +86,12 @@ import d2MenuSide from './components/menu-side' ...@@ -86,12 +86,12 @@ import d2MenuSide from './components/menu-side'
import d2MenuHeader from './components/menu-header' import d2MenuHeader from './components/menu-header'
import d2Tabs from './components/tabs' import d2Tabs from './components/tabs'
import d2HeaderFullscreen from './components/header-fullscreen' import d2HeaderFullscreen from './components/header-fullscreen'
import d2HeaderLocales from './components/header-locales' // import d2HeaderLocales from './components/header-locales'
import d2HeaderSearch from './components/header-search' import d2HeaderSearch from './components/header-search'
import d2HeaderSize from './components/header-size' // import d2HeaderSize from './components/header-size'
import d2HeaderTheme from './components/header-theme' import d2HeaderTheme from './components/header-theme'
import d2HeaderUser from './components/header-user' import d2HeaderUser from './components/header-user'
import d2HeaderLog from './components/header-log' // import d2HeaderLog from './components/header-log'
import d2HeaderColor from './components/header-color' import d2HeaderColor from './components/header-color'
import hamburger from './components/hamburger' import hamburger from './components/hamburger'
import d2HeaderDatetime from './components/header-datetime' import d2HeaderDatetime from './components/header-datetime'
...@@ -107,17 +107,17 @@ export default { ...@@ -107,17 +107,17 @@ export default {
d2MenuHeader, d2MenuHeader,
d2Tabs, d2Tabs,
d2HeaderFullscreen, d2HeaderFullscreen,
d2HeaderLocales, // d2HeaderLocales,
d2HeaderSearch, d2HeaderSearch,
d2HeaderSize, // d2HeaderSize,
d2HeaderTheme, d2HeaderTheme,
d2HeaderUser, d2HeaderUser,
d2HeaderLog, // d2HeaderLog,
d2HeaderColor, d2HeaderColor,
hamburger, hamburger,
d2HeaderDatetime d2HeaderDatetime
}, },
data () { data() {
return { return {
// [侧边栏宽度] 正常状态 // [侧边栏宽度] 正常状态
asideWidth: '200px', asideWidth: '200px',
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
asideWidthCollapse: '65px' asideWidthCollapse: '65px'
} }
}, },
mounted () { mounted() {
}, },
computed: { computed: {
...mapState('d2admin', { ...mapState('d2admin', {
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
/** /**
* @description 最外层容器的背景图片样式 * @description 最外层容器的背景图片样式
*/ */
styleLayoutMainGroup () { styleLayoutMainGroup() {
return { return {
...this.themeActiveSetting.backgroundImage ? { ...this.themeActiveSetting.backgroundImage ? {
backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')` backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`
...@@ -155,7 +155,7 @@ export default { ...@@ -155,7 +155,7 @@ export default {
/** /**
* 接收点击切换侧边栏的按钮 * 接收点击切换侧边栏的按钮
*/ */
handleToggleAside () { handleToggleAside() {
this.asideCollapseToggle() this.asideCollapseToggle()
} }
} }
......
...@@ -6,7 +6,7 @@ export default { ...@@ -6,7 +6,7 @@ export default {
components: { components: {
'd2-panel-search': () => import('../components/panel-search') 'd2-panel-search': () => import('../components/panel-search')
}, },
mounted () { mounted() {
// 绑定搜索功能快捷键 [ 打开 ] // 绑定搜索功能快捷键 [ 打开 ]
hotkeys(this.searchHotkey.open, event => { hotkeys(this.searchHotkey.open, event => {
event.preventDefault() event.preventDefault()
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
this.searchPanelClose() this.searchPanelClose()
}) })
}, },
beforeDestroy () { beforeDestroy() {
hotkeys.unbind(this.searchHotkey.open) hotkeys.unbind(this.searchHotkey.open)
hotkeys.unbind(this.searchHotkey.close) hotkeys.unbind(this.searchHotkey.close)
}, },
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
/** /**
* 接收点击搜索按钮 * 接收点击搜索按钮
*/ */
handleSearchClick () { handleSearchClick() {
this.searchToggle() this.searchToggle()
if (this.searchActive) { if (this.searchActive) {
setTimeout(() => { setTimeout(() => {
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
}, 500) }, 500)
} }
}, },
searchPanelOpen () { searchPanelOpen() {
if (!this.searchActive) { if (!this.searchActive) {
this.searchSet(true) this.searchSet(true)
setTimeout(() => { setTimeout(() => {
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
} }
}, },
// 关闭搜索面板 // 关闭搜索面板
searchPanelClose () { searchPanelClose() {
if (this.searchActive) { if (this.searchActive) {
this.searchSet(false) this.searchSet(false)
} }
......
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const cookies = {} const cookies = {}
const COOKIE_NAME_PREFIX = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-`
/** /**
* @description 存储 cookie 值 * @description 存储 cookie 值
* @param {String} name cookie name * @param {String} name cookie name
* @param {String} value cookie value * @param {String} value cookie value
* @param {Object} setting cookie setting * @param {Object} setting cookie setting
*/ */
cookies.set = function (name = 'default', value = '', cookieSetting = {}) { cookies.set = function(name = 'default', value = '', cookieSetting = {}) {
let currentCookieSetting = { let currentCookieSetting = {
expires: 1 expires: 1
} }
Object.assign(currentCookieSetting, cookieSetting) Object.assign(currentCookieSetting, cookieSetting)
Cookies.set(`tfims-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting) Cookies.set(`${COOKIE_NAME_PREFIX}${name}`, value, currentCookieSetting)
} }
/** /**
* @description 拿到 cookie 值 * @description 拿到 cookie 值
* @param {String} name cookie name * @param {String} name cookie name
*/ */
cookies.get = function (name = 'default') { cookies.get = function(name = 'default') {
return Cookies.get(`tfims-${process.env.VUE_APP_VERSION}-${name}`) return Cookies.get(`${COOKIE_NAME_PREFIX}${name}`)
} }
/** /**
* @description 拿到 cookie 全部的值 * @description 拿到 cookie 全部的值
*/ */
cookies.getAll = function () { cookies.getAll = function() {
return Cookies.get() return Cookies.get()
} }
...@@ -35,8 +35,8 @@ cookies.getAll = function () { ...@@ -35,8 +35,8 @@ cookies.getAll = function () {
* @description 删除 cookie * @description 删除 cookie
* @param {String} name cookie name * @param {String} name cookie name
*/ */
cookies.remove = function (name = 'default') { cookies.remove = function(name = 'default') {
return Cookies.remove(`tfims-${process.env.VUE_APP_VERSION}-${name}`) return Cookies.remove(`${COOKIE_NAME_PREFIX}${name}`)
} }
export default cookies export default cookies
import low from 'lowdb' import low from 'lowdb'
import LocalStorage from 'lowdb/adapters/LocalStorage' import LocalStorage from 'lowdb/adapters/LocalStorage'
import util from '@/libs/util' import util from '@/libs/util'
import { cloneDeep } from 'lodash'
const adapter = new LocalStorage(`tfims-${process.env.VUE_APP_VERSION}`, { const adapter = new LocalStorage(`${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}`, {
serialize: (data) => escape(JSON.stringify(data)), serialize: (data) => escape(JSON.stringify(data)),
deserialize: (data) => JSON.parse(unescape(data)) deserialize: (data) => JSON.parse(unescape(data))
}) })
...@@ -27,7 +26,7 @@ export default db ...@@ -27,7 +26,7 @@ export default db
* @param {Object} payload defaultValue {*} 初始化默认值 * @param {Object} payload defaultValue {*} 初始化默认值
* @returns {String} 可以直接使用的路径 * @returns {String} 可以直接使用的路径
*/ */
export function pathInit ({ export function pathInit({
dbName = 'database', dbName = 'database',
path = '', path = '',
user = true, user = true,
...@@ -53,7 +52,7 @@ export function pathInit ({ ...@@ -53,7 +52,7 @@ export function pathInit ({
* @param {Object} payload value {*} 需要存储的值 * @param {Object} payload value {*} 需要存储的值
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
export function dbSet ({ export function dbSet({
dbName = 'database', dbName = 'database',
path = '', path = '',
value = '', value = '',
...@@ -74,7 +73,7 @@ export function dbSet ({ ...@@ -74,7 +73,7 @@ export function dbSet ({
* @param {Object} payload defaultValue {*} 取值失败的默认值 * @param {Object} payload defaultValue {*} 取值失败的默认值
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
export function dbGet ({ export function dbGet({
dbName = 'database', dbName = 'database',
path = '', path = '',
defaultValue = '', defaultValue = '',
...@@ -94,7 +93,7 @@ export function dbGet ({ ...@@ -94,7 +93,7 @@ export function dbGet ({
* @description 获取存储数据库对象 * @description 获取存储数据库对象
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
export function database ({ export function database({
dbName = 'database', dbName = 'database',
path = '', path = '',
user = false, user = false,
......
...@@ -13,7 +13,7 @@ const util = { ...@@ -13,7 +13,7 @@ const util = {
* @description 更新标题 * @description 更新标题
* @param {String} title 标题 * @param {String} title 标题
*/ */
util.title = function (titleText) { util.title = function(titleText) {
const processTitle = process.env.VUE_APP_TITLE const processTitle = process.env.VUE_APP_TITLE
window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}` window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ''}`
} }
...@@ -22,7 +22,7 @@ util.title = function (titleText) { ...@@ -22,7 +22,7 @@ util.title = function (titleText) {
* @description 打开新页面 * @description 打开新页面
* @param {String} url 地址 * @param {String} url 地址
*/ */
util.open = function (url, target) { util.open = function(url, target) {
var a = document.createElement('a') var a = document.createElement('a')
a.setAttribute('href', url) a.setAttribute('href', url)
a.setAttribute('target', target || '_blank') a.setAttribute('target', target || '_blank')
...@@ -62,7 +62,7 @@ util.deepClone = (obj) => { ...@@ -62,7 +62,7 @@ util.deepClone = (obj) => {
* @param {Function} condition 回调函数,必须返回谓词,判断是否找到了。会传入(item, index, level)三个参数 * @param {Function} condition 回调函数,必须返回谓词,判断是否找到了。会传入(item, index, level)三个参数
* @param {String} children 子数组的key * @param {String} children 子数组的key
*/ */
util.deepFind = function (menus, id) { util.deepFind = function(menus, id) {
const cloneMenus = util.deepClone(menus) const cloneMenus = util.deepClone(menus)
for (let menu of cloneMenus) { for (let menu of cloneMenus) {
if (menu.id === id) { if (menu.id === id) {
...@@ -110,7 +110,7 @@ util.colorToRgb = (sColor, alpha) => { ...@@ -110,7 +110,7 @@ util.colorToRgb = (sColor, alpha) => {
* 重置form * 重置form
* 用法: util.resetForm.call(this,'formName') * 用法: util.resetForm.call(this,'formName')
*/ */
util.resetForm = function (formName) { util.resetForm = function(formName) {
this.$nextTick(() => { this.$nextTick(() => {
for (var key in this[formName]) { for (var key in this[formName]) {
if (this[formName].hasOwnProperty(key)) { if (this[formName].hasOwnProperty(key)) {
......
...@@ -4,7 +4,7 @@ const log = {} ...@@ -4,7 +4,7 @@ const log = {}
* @description 返回这个样式的颜色值 * @description 返回这个样式的颜色值
* @param {String} type 样式名称 [ primary | success | warning | danger | text ] * @param {String} type 样式名称 [ primary | success | warning | danger | text ]
*/ */
function typeColor (type = 'default') { function typeColor(type = 'default') {
let color = '' let color = ''
switch (type) { switch (type) {
case 'default': color = '#35495E'; break case 'default': color = '#35495E'; break
...@@ -23,7 +23,7 @@ function typeColor (type = 'default') { ...@@ -23,7 +23,7 @@ function typeColor (type = 'default') {
* @param {String} info info text * @param {String} info info text
* @param {String} type style * @param {String} type style
*/ */
log.capsule = function (title, info, type = 'primary') { log.capsule = function(title, info, type = 'primary') {
console.log( console.log(
`%c ${title} %c ${info} %c`, `%c ${title} %c ${info} %c`,
'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;', 'background:#35495E; padding: 1px; border-radius: 3px 0 0 3px; color: #fff;',
...@@ -35,7 +35,7 @@ log.capsule = function (title, info, type = 'primary') { ...@@ -35,7 +35,7 @@ log.capsule = function (title, info, type = 'primary') {
/** /**
* @description 打印彩色文字 * @description 打印彩色文字
*/ */
log.colorful = function (textArr) { log.colorful = function(textArr) {
console.log( console.log(
`%c${textArr.map(t => t.text || '').join('%c')}`, `%c${textArr.map(t => t.text || '').join('%c')}`,
...textArr.map(t => `color: ${typeColor(t.type)};`) ...textArr.map(t => `color: ${typeColor(t.type)};`)
...@@ -45,35 +45,35 @@ log.colorful = function (textArr) { ...@@ -45,35 +45,35 @@ log.colorful = function (textArr) {
/** /**
* @description 打印 default 样式的文字 * @description 打印 default 样式的文字
*/ */
log.default = function (text) { log.default = function(text) {
log.colorful([{ text }]) log.colorful([{ text }])
} }
/** /**
* @description 打印 primary 样式的文字 * @description 打印 primary 样式的文字
*/ */
log.primary = function (text) { log.primary = function(text) {
log.colorful([{ text, type: 'primary' }]) log.colorful([{ text, type: 'primary' }])
} }
/** /**
* @description 打印 success 样式的文字 * @description 打印 success 样式的文字
*/ */
log.success = function (text) { log.success = function(text) {
log.colorful([{ text, type: 'success' }]) log.colorful([{ text, type: 'success' }])
} }
/** /**
* @description 打印 warning 样式的文字 * @description 打印 warning 样式的文字
*/ */
log.warning = function (text) { log.warning = function(text) {
log.colorful([{ text, type: 'warning' }]) log.colorful([{ text, type: 'warning' }])
} }
/** /**
* @description 打印 danger 样式的文字 * @description 打印 danger 样式的文字
*/ */
log.danger = function (text) { log.danger = function(text) {
log.colorful([{ text, type: 'danger' }]) log.colorful([{ text, type: 'danger' }])
} }
......
...@@ -2,21 +2,20 @@ ...@@ -2,21 +2,20 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-27 19:16:26 * @Date: 2019-08-27 19:16:26
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-10 09:20:37 * @Last Modified time: 2019-09-11 19:08:21
*/ */
import { cloneDeep } from 'lodash'
const permision = {} const permision = {}
/** /**
* 打包如有与按钮 * 打包如有与按钮
* resources 所有资源集合 * resources 所有资源集合
* idsInPermision 返回的权限id集合 * idsInPermision 返回的权限id集合
*/ */
permision.packRoutesBtns = function (resources, idsInPermision) { permision.packRoutesBtns = function(resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) { if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误') throw new Error('参数错误')
} }
let __aRouteInPermision = [] const __aRouteInPermision = []
let __oBtnInPermision = {} const __oBtnInPermision = {}
let __objResource = null let __objResource = null
let __obj = null let __obj = null
idsInPermision.forEach(obj => { idsInPermision.forEach(obj => {
...@@ -48,12 +47,12 @@ permision.packRoutesBtns = function (resources, idsInPermision) { ...@@ -48,12 +47,12 @@ permision.packRoutesBtns = function (resources, idsInPermision) {
* resources 所有资源集合 * resources 所有资源集合
* idsInPermision 返回的权限id集合 * idsInPermision 返回的权限id集合
*/ */
permision.packAsideMenus = function (resources, idsInPermision) { permision.packAsideMenus = function(resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) { if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误') throw new Error('参数错误')
} }
let __aMenusInPermision = [] const __aMenusInPermision = []
let __aSub = [] const __aSub = []
/** /**
* 第一次循环 分出一级菜单与所有子菜单 * 第一次循环 分出一级菜单与所有子菜单
*/ */
...@@ -88,13 +87,13 @@ permision.packAsideMenus = function (resources, idsInPermision) { ...@@ -88,13 +87,13 @@ permision.packAsideMenus = function (resources, idsInPermision) {
* resources 所有资源集合 * resources 所有资源集合
* idsInPermision 返回的权限id集合 * idsInPermision 返回的权限id集合
*/ */
permision.packMenusBtns = function (resources) { permision.packMenusBtns = function(resources) {
if (!resources) { if (!resources) {
throw new Error('参数错误') throw new Error('参数错误')
} }
let __aParent = [] const __aParent = []
let __aSub = [] const __aSub = []
let __aAll = [] const __aAll = []
/** /**
* 第一次循环 分出一级菜单与所有子菜单 * 第一次循环 分出一级菜单与所有子菜单
*/ */
...@@ -135,7 +134,7 @@ permision.packMenusBtns = function (resources) { ...@@ -135,7 +134,7 @@ permision.packMenusBtns = function (resources) {
/** /**
* 格式化菜单 封装成系统所需格式 * 格式化菜单 封装成系统所需格式
*/ */
permision.format2Menu = function (oMenu) { permision.format2Menu = function(oMenu) {
if (!oMenu) return null if (!oMenu) return null
const { icon, path, meta } = oMenu const { icon, path, meta } = oMenu
const { title, authId, parentId } = meta const { title, authId, parentId } = meta
...@@ -150,7 +149,7 @@ permision.format2Menu = function (oMenu) { ...@@ -150,7 +149,7 @@ permision.format2Menu = function (oMenu) {
/** /**
* 格式化菜单 封装成系统所需格式 * 格式化菜单 封装成系统所需格式
*/ */
permision.format2ResourceMenu = function (oMenu) { permision.format2ResourceMenu = function(oMenu) {
if (!oMenu) return null if (!oMenu) return null
const { icon, meta, auth } = oMenu const { icon, meta, auth } = oMenu
const { title, authId, parentId } = meta const { title, authId, parentId } = meta
...@@ -165,7 +164,7 @@ permision.format2ResourceMenu = function (oMenu) { ...@@ -165,7 +164,7 @@ permision.format2ResourceMenu = function (oMenu) {
/** /**
* 扁平化 routes (@/router/routes) * 扁平化 routes (@/router/routes)
*/ */
permision.flatten = function (arr) { permision.flatten = function(arr) {
return arr.reduce((result, item) => { return arr.reduce((result, item) => {
item.authId = item.authId || item.meta.authId item.authId = item.authId || item.meta.authId
item.parentId = item.parentId || item.meta.parentId item.parentId = item.parentId || item.meta.parentId
......
...@@ -38,7 +38,7 @@ new Vue({ ...@@ -38,7 +38,7 @@ new Vue({
// 初始化菜单搜索功能 // 初始化菜单搜索功能
// this.$store.commit('d2admin/search/init', menuHeader) // this.$store.commit('d2admin/search/init', menuHeader)
// }, // },
mounted () { mounted() {
// Vue.config.devtools = true // Vue.config.devtools = true
// 展示系统信息 // 展示系统信息
this.$store.commit('d2admin/releases/versionShow') this.$store.commit('d2admin/releases/versionShow')
......
...@@ -8,7 +8,7 @@ export default [ ...@@ -8,7 +8,7 @@ export default [
{ {
path: '/api/login', path: '/api/login',
method: 'post', method: 'post',
handle ({ body }) { handle({ body }) {
const user = userDB.find(e => e.username === body.username && e.password === body.password) const user = userDB.find(e => e.username === body.username && e.password === body.password)
if (user) { if (user) {
return { return {
......
export default function (Mock) { export default function(Mock) {
// http://cnine.me/note/FrontEnd/mock-lose-cookies-dbg.html // http://cnine.me/note/FrontEnd/mock-lose-cookies-dbg.html
Mock.XHR.prototype.__send = Mock.XHR.prototype.send Mock.XHR.prototype.__send = Mock.XHR.prototype.send
Mock.XHR.prototype.send = function () { Mock.XHR.prototype.send = function() {
if (this.custom.xhr) this.custom.xhr.withCredentials = this.withCredentials || false if (this.custom.xhr) this.custom.xhr.withCredentials = this.withCredentials || false
this.__send.apply(this, arguments) this.__send.apply(this, arguments)
} }
......
...@@ -12,14 +12,14 @@ import qs from 'qs' ...@@ -12,14 +12,14 @@ import qs from 'qs'
axios.defaults.withCredentials = true axios.defaults.withCredentials = true
const expiresMinute = 60 // 过期时间(分钟) const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误 // 创建一个错误
function errorCreate (msg) { function errorCreate(msg) {
const error = new Error(msg) const error = new Error(msg)
errorLog(error) errorLog(error)
throw error throw error
} }
// 记录和显示错误 // 记录和显示错误
function errorLog (error) { function errorLog(error) {
// 添加到日志 // 添加到日志
store.dispatch('d2admin/log/push', { store.dispatch('d2admin/log/push', {
message: '数据请求异常', message: '数据请求异常',
...@@ -51,7 +51,7 @@ const service = axios.create({ ...@@ -51,7 +51,7 @@ const service = axios.create({
// 请求拦截器 // 请求拦截器
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
config.transformRequest = [function (data) { config.transformRequest = [function(data) {
return qs.stringify(data) return qs.stringify(data)
}] }]
return new Promise(async resolve => { return new Promise(async resolve => {
......
...@@ -19,7 +19,7 @@ import pluginLog from '@/plugin/log' ...@@ -19,7 +19,7 @@ import pluginLog from '@/plugin/log'
import pluginOpen from '@/plugin/open' import pluginOpen from '@/plugin/open'
export default { export default {
async install (Vue, options) { async install(Vue, options) {
// 设置为 false 以阻止 vue 在启动时生成生产提示 // 设置为 false 以阻止 vue 在启动时生成生产提示
// https://cn.vuejs.org/v2/api/#productionTip // https://cn.vuejs.org/v2/api/#productionTip
Vue.config.productionTip = false Vue.config.productionTip = false
......
...@@ -2,8 +2,8 @@ import store from '@/store' ...@@ -2,8 +2,8 @@ import store from '@/store'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
install (Vue, options) { install(Vue, options) {
Vue.config.errorHandler = function (error, instance, info) { Vue.config.errorHandler = function(error, instance, info) {
Vue.nextTick(() => { Vue.nextTick(() => {
// store 追加 log // store 追加 log
store.dispatch('d2admin/log/push', { store.dispatch('d2admin/log/push', {
......
...@@ -2,11 +2,11 @@ import store from '@/store' ...@@ -2,11 +2,11 @@ import store from '@/store'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
install (Vue, options) { install(Vue, options) {
// 快速打印 log // 快速打印 log
Vue.prototype.$log = { Vue.prototype.$log = {
...util.log, ...util.log,
push (data) { push(data) {
if (typeof data === 'string') { if (typeof data === 'string') {
// 如果传递来的数据是字符串 // 如果传递来的数据是字符串
// 赋值给 message 字段 // 赋值给 message 字段
......
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
install (Vue, options) { install(Vue, options) {
Vue.prototype.$open = util.open Vue.prototype.$open = util.open
} }
} }
...@@ -13,7 +13,7 @@ import util from '@/libs/util.js' ...@@ -13,7 +13,7 @@ import util from '@/libs/util.js'
import routes from './routes' import routes from './routes'
const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin const originalPush = VueRouter.prototype.push // 解决连续点击路由异常问题 limin
VueRouter.prototype.push = function push (location) { VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err) return originalPush.call(this, location) && originalPush.call(this, location).catch(err => err)
} }
Vue.use(VueRouter) Vue.use(VueRouter)
...@@ -27,7 +27,7 @@ const router = new VueRouter({ ...@@ -27,7 +27,7 @@ const router = new VueRouter({
* 路由拦截 * 路由拦截
* 权限验证 * 权限验证
*/ */
router.beforeEach(async (to, from, next) => { router.beforeEach(async(to, from, next) => {
const source = store.state.d2admin.auth.source const source = store.state.d2admin.auth.source
// 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 // 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
await store.dispatch('d2admin/page/isLoaded') await store.dispatch('d2admin/page/isLoaded')
......
import util from '@/libs/util.js' import util from '@/libs/util.js'
import { cloneDeep } from 'lodash'
import { AccountLogin } from '@api/sys.account' import { AccountLogin } from '@api/sys.account'
import { SUPPER_ADMIN } from '@/common/constants' import { SUPPER_ADMIN } from '@/common/constants'
import { localRoutes } from '@/router/routes' import { localRoutes } from '@/router/routes'
...@@ -13,11 +12,11 @@ export default { ...@@ -13,11 +12,11 @@ export default {
* @param {Object} payload password {String} 密码 * @param {Object} payload password {String} 密码
* @param {Object} payload route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式 * @param {Object} payload route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
*/ */
login ({ dispatch, commit }, p) { login({ dispatch, commit }, p) {
// console.log(router.addRoutes); // console.log(router.addRoutes);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 开始请求登录接口 // 开始请求登录接口
AccountLogin(p).then(async (data = {}) => { AccountLogin(p).then(async(data = {}) => {
// 设置 cookie 一定要存 uuid 和 token 两个 cookie // 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 整个系统依赖这两个数据进行校验和存储 // 整个系统依赖这两个数据进行校验和存储
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复 // uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
...@@ -49,7 +48,7 @@ export default { ...@@ -49,7 +48,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload confirm {Boolean} 是否需要确认 * @param {Object} payload confirm {Boolean} 是否需要确认
*/ */
logout ({ commit, dispatch }, { confirm = false } = {}) { logout({ commit, dispatch }, { confirm = false } = {}) {
/** /**
* @description 注销 * @description 注销
*/ */
...@@ -68,7 +67,7 @@ export default { ...@@ -68,7 +67,7 @@ export default {
* @description 用户登录后从持久化数据加载一系列的设置 * @description 用户登录后从持久化数据加载一系列的设置
* @param {Object} context * @param {Object} context
*/ */
load ({ dispatch }) { load({ dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// DB -> store 加载用户名 // DB -> store 加载用户名
await dispatch('d2admin/user/load', null, { root: true }) await dispatch('d2admin/user/load', null, { root: true })
......
...@@ -20,40 +20,40 @@ export default { ...@@ -20,40 +20,40 @@ export default {
* @description 返回当前登录用户权限资源 * @description 返回当前登录用户权限资源
* @param {Object} state state * @param {Object} state state
*/ */
source (state, dispatch) { source(state, dispatch) {
return state.source return state.source
}, },
/** /**
* @description 返回当前页面meta * @description 返回当前页面meta
* @param {Object} state state * @param {Object} state state
*/ */
meta (state, dispatch) { meta(state, dispatch) {
return state.meta return state.meta
}, },
/** /**
* @description 当前角色拥有的所有按钮 * @description 当前角色拥有的所有按钮
* @param {Object} state state * @param {Object} state state
*/ */
btns (state, dispatch) { btns(state, dispatch) {
return state.btns return state.btns
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
curBtns (state) { curBtns(state) {
return state.btns[state.meta.authId] return state.btns[state.meta.authId]
}, },
/** /**
* 返回当前页面的btn * 返回当前页面的btn
* @param {*} state * @param {*} state
*/ */
btnIdAll (state) { btnIdAll(state) {
return state.btnIdAll return state.btnIdAll
} }
}, },
actions: { actions: {
save2db ({ state, dispatch }) { save2db({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 设置数据 // 设置数据
dispatch('d2admin/db/set', { dispatch('d2admin/db/set', {
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
* @description 保存当前角色权限资源 * @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源 * @param {obj} source 需要保存的权限资源
*/ */
set ({ state, commit, dispatch }, source) { set({ state, commit, dispatch }, source) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 检查这个主题在主题列表里是否存在 // 检查这个主题在主题列表里是否存在
state.source = source state.source = source
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
* @description 保存当前角色权限资源 * @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源 * @param {obj} source 需要保存的权限资源
*/ */
setCurrentPageMeta ({ state, commit, dispatch }, meta) { setCurrentPageMeta({ state, commit, dispatch }, meta) {
return new Promise(async resolve => { return new Promise(async resolve => {
state.meta = meta state.meta = meta
// end // end
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
* @description 从持久化数据加载资源数据 * @description 从持久化数据加载资源数据
* @param {Object} context * @param {Object} context
*/ */
load ({ state, commit, dispatch }) { load({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
if (!state.source) { if (!state.source) {
state.source = await dispatch('d2admin/db/get', { state.source = await dispatch('d2admin/db/get', {
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
* 过滤并初始化路由与左侧菜单栏 * 过滤并初始化路由与左侧菜单栏
* @param {*} param0 * @param {*} param0
*/ */
init ({ state, commit, dispatch }) { init({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
try { try {
// 获取权限资源点 // 获取权限资源点
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 17:56:57 * @Date: 2019-09-01 17:56:57
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-09 20:34:18 * @Last Modified time: 2019-09-11 19:07:58
*/ */
import { FetchRoleList, BaseDataApi } from '@/api/sys.base' import { FetchRoleList, BaseDataApi } from '@/api/sys.base'
...@@ -33,14 +33,14 @@ export default { ...@@ -33,14 +33,14 @@ export default {
* 每次登录会强制 初始化 * 每次登录会强制 初始化
* @param {*} param0 * @param {*} param0
*/ */
init ({ state, dispatch, commit }) { init({ state, dispatch, commit }) {
return new Promise(async resolve => { return new Promise(async resolve => {
Promise.all([ Promise.all([
FetchRoleList(), FetchRoleList(),
BaseDataApi({ [TYPE_NAME]: ConfigType.STATION }), BaseDataApi({ [TYPE_NAME]: ConfigType.STATION }),
BaseDataApi({ [TYPE_NAME]: ConfigType.POST }), BaseDataApi({ [TYPE_NAME]: ConfigType.POST }),
BaseDataApi({ [TYPE_NAME]: ConfigType.SUBSYS }) BaseDataApi({ [TYPE_NAME]: ConfigType.SUBSYS })
]).then(async ([role, station, post, subsys] = res) => { ]).then(async([role, station, post, subsys]) => {
state.role = role.roles state.role = role.roles
state.station = station.confes state.station = station.confes
state.subsys = subsys.confes state.subsys = subsys.confes
...@@ -57,7 +57,7 @@ export default { ...@@ -57,7 +57,7 @@ export default {
* @param {*} param0 * @param {*} param0
* @param {*} name 名称 state 中的任意一个 强烈建议 使用 @/common/constants/BaseData 中的常量 便于灵活修改 * @param {*} name 名称 state 中的任意一个 强烈建议 使用 @/common/constants/BaseData 中的常量 便于灵活修改
*/ */
get ({ state, dispatch }, name) { get({ state, dispatch }, name) {
return new Promise(async resolve => { return new Promise(async resolve => {
let __data = state[name] let __data = state[name]
if (__data) { if (__data) {
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
resolve(__data) resolve(__data)
}) })
}, },
set ({ state, dispatch }, { name, value }) { set({ state, dispatch }, { name, value }) {
return new Promise(async resolve => { return new Promise(async resolve => {
state[name] = value state[name] = value
await dispatch('save2db', { name, value }) await dispatch('save2db', { name, value })
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
* 内存 -> 前端持久化数据库 -> 后台接口 * 内存 -> 前端持久化数据库 -> 后台接口
* @param {*} param0 * @param {*} param0
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
if (state.role.length === 0) { if (state.role.length === 0) {
state = await dispatch('getFromdb', 'base') || await dispatch('init') state = await dispatch('getFromdb', 'base') || await dispatch('init')
...@@ -95,7 +95,7 @@ export default { ...@@ -95,7 +95,7 @@ export default {
* @param {*} param0 * @param {*} param0
* @param {*} path 数据 路径 * @param {*} path 数据 路径
*/ */
getFromdb ({ dispatch }, path) { getFromdb({ dispatch }, path) {
return new Promise(async resolve => { return new Promise(async resolve => {
const value = await dispatch('d2admin/db/get', { const value = await dispatch('d2admin/db/get', {
dbName: 'database', dbName: 'database',
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
* @param {*} param0 * @param {*} param0
* @param {*} param1 value 需要持久化的数据 path 需要持久化的数据路径 * @param {*} param1 value 需要持久化的数据 path 需要持久化的数据路径
*/ */
save2db ({ dispatch }, { value, name }) { save2db({ dispatch }, { value, name }) {
return new Promise(async resolve => { return new Promise(async resolve => {
await dispatch('d2admin/db/set', { await dispatch('d2admin/db/set', {
dbName: 'database', dbName: 'database',
...@@ -127,7 +127,7 @@ export default { ...@@ -127,7 +127,7 @@ export default {
* @param {*} param0 * @param {*} param0
* @param {*} name @/common/constants/BaseData 中的常量 * @param {*} name @/common/constants/BaseData 中的常量
*/ */
getFromAjax ({ state, dispatch, commit }, name) { getFromAjax({ state, dispatch, commit }, name) {
return new Promise(async resolve => { return new Promise(async resolve => {
const value = await map[name]({ [TYPE_NAME]: Object.values(BaseData).find(data => data.KEY === name).TYPE }) const value = await map[name]({ [TYPE_NAME]: Object.values(BaseData).find(data => data.KEY === name).TYPE })
resolve(value) resolve(value)
......
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
* @description 返回当前颜色值 * @description 返回当前颜色值
* @param {Object} state state * @param {Object} state state
*/ */
color (state, dispatch) { color(state, dispatch) {
return state.value return state.value
} }
}, },
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {String} color 尺寸 * @param {String} color 尺寸
*/ */
set ({ state, dispatch, commit }, color) { set({ state, dispatch, commit }, color) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 记录上个值 // 记录上个值
const old = state.value const old = state.value
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
* @description 从持久化数据读取颜色设置 * @description 从持久化数据读取颜色设置
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch, commit }) { load({ state, dispatch, commit }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 记录上个值 // 记录上个值
const old = state.value const old = state.value
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
resolve() resolve()
}) })
}, },
loadFromDB ({ state, dispatch, commit }) { loadFromDB({ state, dispatch, commit }) {
return new Promise(async resolve => { return new Promise(async resolve => {
const color = await dispatch('d2admin/db/get', { const color = await dispatch('d2admin/db/get', {
dbName: 'sys', dbName: 'sys',
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
* @param {Object} payload oldColor {String} 旧的颜色 * @param {Object} payload oldColor {String} 旧的颜色
* @param {Object} payload newColor {String} 新颜色 * @param {Object} payload newColor {String} 新颜色
*/ */
apply (state, { oldColor, newColor }) { apply(state, { oldColor, newColor }) {
var options = { var options = {
oldColors: [...forElementUI.getElementUISeries(oldColor)], oldColors: [...forElementUI.getElementUISeries(oldColor)],
newColors: [...forElementUI.getElementUISeries(newColor)] newColors: [...forElementUI.getElementUISeries(newColor)]
......
import router from '@/router' import router from '@/router'
import { cloneDeep } from 'lodash'
import { database as getDatabase, dbGet, dbSet } from '@/libs/util.db' import { database as getDatabase, dbGet, dbSet } from '@/libs/util.db'
export default { export default {
...@@ -14,7 +13,7 @@ export default { ...@@ -14,7 +13,7 @@ export default {
* @param {Object} payload value {*} 需要存储的值 * @param {Object} payload value {*} 需要存储的值
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
set (context, { set(context, {
dbName = 'database', dbName = 'database',
path = '', path = '',
value = '', value = '',
...@@ -31,7 +30,7 @@ export default { ...@@ -31,7 +30,7 @@ export default {
* @param {Object} payload defaultValue {*} 取值失败的默认值 * @param {Object} payload defaultValue {*} 取值失败的默认值
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
get (context, { get(context, {
dbName = 'database', dbName = 'database',
path = '', path = '',
defaultValue = '', defaultValue = '',
...@@ -44,7 +43,7 @@ export default { ...@@ -44,7 +43,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
database (context, { database(context, {
user = false user = false
} = {}) { } = {}) {
return getDatabase({ return getDatabase({
...@@ -57,7 +56,7 @@ export default { ...@@ -57,7 +56,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
databaseClear (context, { databaseClear(context, {
user = false user = false
} = {}) { } = {}) {
return getDatabase({ return getDatabase({
...@@ -72,7 +71,7 @@ export default { ...@@ -72,7 +71,7 @@ export default {
* @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ]
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
databasePage (context, { databasePage(context, {
basis = 'fullPath', basis = 'fullPath',
user = false user = false
} = {}) { } = {}) {
...@@ -88,7 +87,7 @@ export default { ...@@ -88,7 +87,7 @@ export default {
* @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ]
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
databasePageClear (context, { databasePageClear(context, {
basis = 'fullPath', basis = 'fullPath',
user = false user = false
} = {}) { } = {}) {
...@@ -106,7 +105,7 @@ export default { ...@@ -106,7 +105,7 @@ export default {
* @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ]
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
pageSet (context, { pageSet(context, {
instance, instance,
basis = 'fullPath', basis = 'fullPath',
user = false user = false
...@@ -125,7 +124,7 @@ export default { ...@@ -125,7 +124,7 @@ export default {
* @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ]
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
pageGet (context, { pageGet(context, {
instance, instance,
basis = 'fullPath', basis = 'fullPath',
user = false user = false
...@@ -142,7 +141,7 @@ export default { ...@@ -142,7 +141,7 @@ export default {
* @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ] * @param {Object} payload basis {String} 页面区分依据 [ name | path | fullPath ]
* @param {Object} payload user {Boolean} 是否区分用户 * @param {Object} payload user {Boolean} 是否区分用户
*/ */
pageClear (context, { pageClear(context, {
basis = 'fullPath', basis = 'fullPath',
user = false user = false
}) { }) {
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
* @description 初始化监听 * @description 初始化监听
* @param {Object} context * @param {Object} context
*/ */
listen ({ commit }) { listen({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
if (screenfull.enabled) { if (screenfull.enabled) {
screenfull.on('change', () => { screenfull.on('change', () => {
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
* @description 切换全屏 * @description 切换全屏
* @param {Object} context * @param {Object} context
*/ */
toggle ({ commit }) { toggle({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
if (screenfull.isFullscreen) { if (screenfull.isFullscreen) {
screenfull.exit() screenfull.exit()
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
} }
} }
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
* @description 切换灰度状态 * @description 切换灰度状态
* @param {Object} state state * @param {Object} state state
*/ */
toggle (state) { toggle(state) {
state.active = !state.active state.active = !state.active
}, },
/** /**
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
} }
} }
......
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { get } from 'lodash'
import util from '@/libs/util.js' import util from '@/libs/util.js'
export default { export default {
...@@ -18,14 +17,14 @@ export default { ...@@ -18,14 +17,14 @@ export default {
* @description 返回现存 log (all) 的条数 * @description 返回现存 log (all) 的条数
* @param {*} state vuex state * @param {*} state vuex state
*/ */
length (state) { length(state) {
return state.log.length return state.log.length
}, },
/** /**
* @description 返回现存 log (error) 的条数 * @description 返回现存 log (error) 的条数
* @param {*} state vuex state * @param {*} state vuex state
*/ */
lengthError (state) { lengthError(state) {
return state.log.filter(log => log.type === 'danger').length return state.log.filter(log => log.type === 'danger').length
} }
}, },
...@@ -37,7 +36,7 @@ export default { ...@@ -37,7 +36,7 @@ export default {
* @param {String} param type {String} 类型 * @param {String} param type {String} 类型
* @param {Object} payload meta {Object} 附带的信息 * @param {Object} payload meta {Object} 附带的信息
*/ */
push ({ rootState, commit }, { message, type = 'info', meta }) { push({ rootState, commit }, { message, type = 'info', meta }) {
commit('push', { commit('push', {
message, message,
type, type,
...@@ -63,14 +62,14 @@ export default { ...@@ -63,14 +62,14 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Object} log data * @param {Object} log data
*/ */
push (state, log) { push(state, log) {
state.log.push(log) state.log.push(log)
}, },
/** /**
* @description 清空日志 * @description 清空日志
* @param {Object} state state * @param {Object} state state
*/ */
clean (state) { clean(state) {
// store 赋值 // store 赋值
state.log = [] state.log = []
} }
......
import { uniqueId } from 'lodash'
// 设置文件 // 设置文件
import setting from '@/setting.js' import setting from '@/setting.js'
...@@ -7,7 +6,7 @@ import setting from '@/setting.js' ...@@ -7,7 +6,7 @@ import setting from '@/setting.js'
* https://github.com/d2-projects/d2-admin/issues/209 * https://github.com/d2-projects/d2-admin/issues/209
* @param {Array} menu 原始的菜单数据 * @param {Array} menu 原始的菜单数据
*/ */
function supplementMenuPath (menu) { function supplementMenuPath(menu) {
return menu.map(e => ({ return menu.map(e => ({
...e, ...e,
path: e.path || _.uniqueId('d2-menu-empty-'), path: e.path || _.uniqueId('d2-menu-empty-'),
...@@ -33,7 +32,7 @@ export default { ...@@ -33,7 +32,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Boolean} collapse is collapse * @param {Boolean} collapse is collapse
*/ */
asideCollapseSet ({ state, dispatch }, collapse) { asideCollapseSet({ state, dispatch }, collapse) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.asideCollapse = collapse state.asideCollapse = collapse
...@@ -52,7 +51,7 @@ export default { ...@@ -52,7 +51,7 @@ export default {
* 切换侧边栏展开和收缩 * 切换侧边栏展开和收缩
* @param {Object} context * @param {Object} context
*/ */
asideCollapseToggle ({ state, dispatch }) { asideCollapseToggle({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.asideCollapse = !state.asideCollapse state.asideCollapse = !state.asideCollapse
...@@ -71,7 +70,7 @@ export default { ...@@ -71,7 +70,7 @@ export default {
* 从持久化数据读取侧边栏展开或者收缩 * 从持久化数据读取侧边栏展开或者收缩
* @param {Object} context * @param {Object} context
*/ */
asideCollapseLoad ({ state, dispatch }) { asideCollapseLoad({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.asideCollapse = await dispatch('d2admin/db/get', { state.asideCollapse = await dispatch('d2admin/db/get', {
...@@ -91,7 +90,7 @@ export default { ...@@ -91,7 +90,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Array} menu menu setting * @param {Array} menu menu setting
*/ */
headerSet (state, menu) { headerSet(state, menu) {
// store 赋值 // store 赋值
state.header = supplementMenuPath(menu) state.header = supplementMenuPath(menu)
}, },
...@@ -100,7 +99,7 @@ export default { ...@@ -100,7 +99,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Array} menu menu setting * @param {Array} menu menu setting
*/ */
asideSet (state, menu) { asideSet(state, menu) {
// store 赋值 // store 赋值
state.aside = supplementMenuPath(menu) state.aside = supplementMenuPath(menu)
} }
......
import { get } from 'lodash'
import router from '@/router' import router from '@/router'
// import setting from '@/setting.js' // import setting from '@/setting.js'
import home from '@/router/routes' import home from '@/router/routes'
...@@ -25,7 +24,7 @@ export default { ...@@ -25,7 +24,7 @@ export default {
* @description 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 * @description 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
* @param {Object} context * @param {Object} context
*/ */
isLoaded ({ state }) { isLoaded({ state }) {
if (state.value) return Promise.resolve() if (state.value) return Promise.resolve()
return new Promise(resolve => { return new Promise(resolve => {
const timer = setInterval(() => { const timer = setInterval(() => {
...@@ -40,7 +39,7 @@ export default { ...@@ -40,7 +39,7 @@ export default {
* @description 从持久化数据载入标签页列表 * @description 从持久化数据载入标签页列表
* @param {Object} context * @param {Object} context
*/ */
openedLoad ({ state, commit, dispatch }) { openedLoad({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
const value = await dispatch('d2admin/db/get', { const value = await dispatch('d2admin/db/get', {
...@@ -84,7 +83,7 @@ export default { ...@@ -84,7 +83,7 @@ export default {
* 将 opened 属性赋值并持久化 在这之前请先确保已经更新了 state.opened * 将 opened 属性赋值并持久化 在这之前请先确保已经更新了 state.opened
* @param {Object} context * @param {Object} context
*/ */
opend2db ({ state, dispatch }) { opend2db({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 设置数据 // 设置数据
dispatch('d2admin/db/set', { dispatch('d2admin/db/set', {
...@@ -103,10 +102,10 @@ export default { ...@@ -103,10 +102,10 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload { index, params, query, fullPath } 路由信息 * @param {Object} payload { index, params, query, fullPath } 路由信息
*/ */
openedUpdate ({ state, commit, dispatch }, { index, params, query, fullPath }) { openedUpdate({ state, commit, dispatch }, { index, params, query, fullPath }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 更新页面列表某一项 // 更新页面列表某一项
let page = state.opened[index] const page = state.opened[index]
page.params = params || page.params page.params = params || page.params
page.query = query || page.query page.query = query || page.query
page.fullPath = fullPath || page.fullPath page.fullPath = fullPath || page.fullPath
...@@ -123,10 +122,10 @@ export default { ...@@ -123,10 +122,10 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload new tag info * @param {Object} payload new tag info
*/ */
add ({ state, commit, dispatch }, { tag, params, query, fullPath }) { add({ state, commit, dispatch }, { tag, params, query, fullPath }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 设置新的 tag 在新打开一个以前没打开过的页面时使用 // 设置新的 tag 在新打开一个以前没打开过的页面时使用
let newTag = tag const newTag = tag
newTag.params = params || newTag.params newTag.params = params || newTag.params
newTag.query = query || newTag.query newTag.query = query || newTag.query
newTag.fullPath = fullPath || newTag.fullPath newTag.fullPath = fullPath || newTag.fullPath
...@@ -148,10 +147,10 @@ export default { ...@@ -148,10 +147,10 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath } 路由信息 * @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath } 路由信息
*/ */
open ({ state, commit, dispatch }, { name, params, query, fullPath }) { open({ state, commit, dispatch }, { name, params, query, fullPath }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 已经打开的页面 // 已经打开的页面
let opened = state.opened const opened = state.opened
// 判断此页面是否已经打开 并且记录位置 // 判断此页面是否已经打开 并且记录位置
let pageOpendIndex = 0 let pageOpendIndex = 0
const pageOpend = opened.find((page, index) => { const pageOpend = opened.find((page, index) => {
...@@ -169,7 +168,7 @@ export default { ...@@ -169,7 +168,7 @@ export default {
}) })
} else { } else {
// 页面以前没有打开过 // 页面以前没有打开过
let page = state.pool.find(t => t.name === name) const page = state.pool.find(t => t.name === name)
// 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示 // 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示
if (page) { if (page) {
await dispatch('add', { await dispatch('add', {
...@@ -191,7 +190,7 @@ export default { ...@@ -191,7 +190,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload { tagName: 要关闭的标签名字 } * @param {Object} payload { tagName: 要关闭的标签名字 }
*/ */
close ({ state, commit, dispatch }, { tagName }) { close({ state, commit, dispatch }, { tagName }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 下个新的页面 // 下个新的页面
let newPage = state.opened[0] let newPage = state.opened[0]
...@@ -199,7 +198,7 @@ export default { ...@@ -199,7 +198,7 @@ export default {
// 如果关闭的页面就是当前显示的页面 // 如果关闭的页面就是当前显示的页面
if (isCurrent) { if (isCurrent) {
// 去找一个新的页面 // 去找一个新的页面
let len = state.opened.length const len = state.opened.length
for (let i = 1; i < len; i++) { for (let i = 1; i < len; i++) {
if (state.opened[i].fullPath === tagName) { if (state.opened[i].fullPath === tagName) {
if (i < len - 1) { if (i < len - 1) {
...@@ -224,7 +223,7 @@ export default { ...@@ -224,7 +223,7 @@ export default {
// 最后需要判断是否需要跳到首页 // 最后需要判断是否需要跳到首页
if (isCurrent) { if (isCurrent) {
const { name = '', params = {}, query = {} } = newPage const { name = '', params = {}, query = {} } = newPage
let routerObj = { const routerObj = {
name, name,
params, params,
query query
...@@ -241,7 +240,7 @@ export default { ...@@ -241,7 +240,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload { pageSelect: 当前选中的tagName } * @param {Object} payload { pageSelect: 当前选中的tagName }
*/ */
closeLeft ({ state, commit, dispatch }, { pageSelect } = {}) { closeLeft({ state, commit, dispatch }, { pageSelect } = {}) {
return new Promise(async resolve => { return new Promise(async resolve => {
const pageAim = pageSelect || state.current const pageAim = pageSelect || state.current
let currentIndex = 0 let currentIndex = 0
...@@ -270,7 +269,7 @@ export default { ...@@ -270,7 +269,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload { pageSelect: 当前选中的tagName } * @param {Object} payload { pageSelect: 当前选中的tagName }
*/ */
closeRight ({ state, commit, dispatch }, { pageSelect } = {}) { closeRight({ state, commit, dispatch }, { pageSelect } = {}) {
return new Promise(async resolve => { return new Promise(async resolve => {
const pageAim = pageSelect || state.current const pageAim = pageSelect || state.current
let currentIndex = 0 let currentIndex = 0
...@@ -298,7 +297,7 @@ export default { ...@@ -298,7 +297,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Object} payload { pageSelect: 当前选中的tagName } * @param {Object} payload { pageSelect: 当前选中的tagName }
*/ */
closeOther ({ state, commit, dispatch }, { pageSelect } = {}) { closeOther({ state, commit, dispatch }, { pageSelect } = {}) {
return new Promise(async resolve => { return new Promise(async resolve => {
const pageAim = pageSelect || state.current const pageAim = pageSelect || state.current
let currentIndex = 0 let currentIndex = 0
...@@ -330,7 +329,7 @@ export default { ...@@ -330,7 +329,7 @@ export default {
* @description 关闭所有 tag * @description 关闭所有 tag
* @param {Object} context * @param {Object} context
*/ */
closeAll ({ state, commit, dispatch }) { closeAll({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 删除打开的页面 并在缓存设置中删除 // 删除打开的页面 并在缓存设置中删除
state.opened.splice(1).forEach(({ name }) => commit('keepAliveRemove', name)) state.opened.splice(1).forEach(({ name }) => commit('keepAliveRemove', name))
...@@ -353,7 +352,7 @@ export default { ...@@ -353,7 +352,7 @@ export default {
* @description 从已经打开的页面记录中更新需要缓存的页面记录 * @description 从已经打开的页面记录中更新需要缓存的页面记录
* @param {Object} state state * @param {Object} state state
*/ */
keepAliveRefresh (state) { keepAliveRefresh(state) {
state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.name) state.keepAlive = state.opened.filter(item => isKeepAlive(item)).map(e => e.name)
}, },
/** /**
...@@ -361,8 +360,8 @@ export default { ...@@ -361,8 +360,8 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {String} name name * @param {String} name name
*/ */
keepAliveRemove (state, name) { keepAliveRemove(state, name) {
const list = [ ...state.keepAlive ] const list = [...state.keepAlive]
const index = list.findIndex(item => item === name) const index = list.findIndex(item => item === name)
if (index !== -1) { if (index !== -1) {
...@@ -375,8 +374,8 @@ export default { ...@@ -375,8 +374,8 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {String} name name * @param {String} name name
*/ */
keepAlivePush (state, name) { keepAlivePush(state, name) {
const keep = [ ...state.keepAlive ] const keep = [...state.keepAlive]
keep.push(name) keep.push(name)
state.keepAlive = keep state.keepAlive = keep
}, },
...@@ -384,7 +383,7 @@ export default { ...@@ -384,7 +383,7 @@ export default {
* @description 清空页面缓存设置 * @description 清空页面缓存设置
* @param {Object} state state * @param {Object} state state
*/ */
keepAliveClean (state) { keepAliveClean(state) {
state.keepAlive = [] state.keepAlive = []
}, },
/** /**
...@@ -393,7 +392,7 @@ export default { ...@@ -393,7 +392,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {String} fullPath new fullPath * @param {String} fullPath new fullPath
*/ */
currentSet (state, fullPath) { currentSet(state, fullPath) {
state.current = fullPath state.current = fullPath
}, },
/** /**
...@@ -402,9 +401,9 @@ export default { ...@@ -402,9 +401,9 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Array} routes routes * @param {Array} routes routes
*/ */
init (state, routes) { init(state, routes) {
const pool = [] const pool = []
const push = function (routes) { const push = function(routes) {
routes.forEach(route => { routes.forEach(route => {
if (route.children) { if (route.children) {
push(route.children) push(route.children)
......
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
* @description 显示版本信息 * @description 显示版本信息
* @param {Object} state state * @param {Object} state state
*/ */
versionShow () { versionShow() {
util.log.capsule(process.env.VUE_APP_TITLE, `v${process.env.VUE_APP_VERSION}`) util.log.capsule(process.env.VUE_APP_TITLE, `v${process.env.VUE_APP_VERSION}`)
console.log('广联赛讯 http://www.glsx.com.cn') console.log('广联赛讯 http://www.glsx.com.cn')
// console.log('D2 Crud https://github.com/d2-projects/d2-crud') // console.log('D2 Crud https://github.com/d2-projects/d2-crud')
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
* @description 切换激活状态 * @description 切换激活状态
* @param {Object} state state * @param {Object} state state
*/ */
toggle (state) { toggle(state) {
state.active = !state.active state.active = !state.active
}, },
/** /**
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
}, },
/** /**
...@@ -34,9 +34,9 @@ export default { ...@@ -34,9 +34,9 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Array} menu menu * @param {Array} menu menu
*/ */
init (state, menu) { init(state, menu) {
const pool = [] const pool = []
const push = function (menu, titlePrefix = []) { const push = function(menu, titlePrefix = []) {
menu.forEach(m => { menu.forEach(m => {
if (m.children) { if (m.children) {
push(m.children, [ ...titlePrefix, m.title ]) push(m.children, [ ...titlePrefix, m.title ])
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Boolean} refresh 是否在设置之后刷新页面 * @param {Boolean} refresh 是否在设置之后刷新页面
*/ */
apply ({ state, commit }, refresh) { apply({ state, commit }, refresh) {
Vue.prototype.$ELEMENT.size = state.value Vue.prototype.$ELEMENT.size = state.value
if (refresh) { if (refresh) {
commit('d2admin/page/keepAliveClean', null, { root: true }) commit('d2admin/page/keepAliveClean', null, { root: true })
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
* @description 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198 * @description 确认已经加载组件尺寸设置 https://github.com/d2-projects/d2-admin/issues/198
* @param {Object} context * @param {Object} context
*/ */
isLoaded ({ state }) { isLoaded({ state }) {
if (state.value) return Promise.resolve() if (state.value) return Promise.resolve()
return new Promise(resolve => { return new Promise(resolve => {
const timer = setInterval(() => { const timer = setInterval(() => {
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {String} size 尺寸 * @param {String} size 尺寸
*/ */
set ({ state, dispatch }, size) { set({ state, dispatch }, size) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.value = size state.value = size
...@@ -60,7 +60,7 @@ export default { ...@@ -60,7 +60,7 @@ export default {
* @description 从持久化数据读取尺寸设置 * @description 从持久化数据读取尺寸设置
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.value = await dispatch('d2admin/db/get', { state.value = await dispatch('d2admin/db/get', {
......
...@@ -14,7 +14,7 @@ export default { ...@@ -14,7 +14,7 @@ export default {
* @description 返回当前的主题信息 不是一个名字 而是当前激活主题的所有数据 * @description 返回当前的主题信息 不是一个名字 而是当前激活主题的所有数据
* @param {Object} state state * @param {Object} state state
*/ */
activeSetting (state) { activeSetting(state) {
return state.list.find(theme => theme.name === state.activeName) return state.list.find(theme => theme.name === state.activeName)
} }
}, },
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
* @description 激活一个主题 * @description 激活一个主题
* @param {String} themeValue 需要激活的主题名称 * @param {String} themeValue 需要激活的主题名称
*/ */
set ({ state, commit, dispatch }, themeName) { set({ state, commit, dispatch }, themeName) {
return new Promise(async resolve => { return new Promise(async resolve => {
// 检查这个主题在主题列表里是否存在 // 检查这个主题在主题列表里是否存在
state.activeName = state.list.find(e => e.name === themeName) ? themeName : state.list[0].name state.activeName = state.list.find(e => e.name === themeName) ? themeName : state.list[0].name
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
/** /**
* @description 从持久化数据加载主题设置 * @param {Object} context * @description 从持久化数据加载主题设置 * @param {Object} context
*/ */
load ({ state, commit, dispatch }) { load({ state, commit, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
let activeName = await dispatch('d2admin/db/get', { let activeName = await dispatch('d2admin/db/get', {
...@@ -82,7 +82,7 @@ export default { ...@@ -82,7 +82,7 @@ export default {
* @description 将 vuex 中的主题应用到 dom * @description 将 vuex 中的主题应用到 dom
* @param {Object} state state * @param {Object} state state
*/ */
dom (state) { dom(state) {
document.body.className = `theme-${state.activeName}` document.body.className = `theme-${state.activeName}`
} }
} }
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {Boolean} active 新的状态 * @param {Boolean} active 新的状态
*/ */
set ({ state, dispatch }, active) { set({ state, dispatch }, active) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.active = active state.active = active
...@@ -32,7 +32,7 @@ export default { ...@@ -32,7 +32,7 @@ export default {
* 从数据库读取页面过渡动画设置 * 从数据库读取页面过渡动画设置
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.active = await dispatch('d2admin/db/get', { state.active = await dispatch('d2admin/db/get', {
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
* @description 切换状态 * @description 切换状态
* @param {Object} state state * @param {Object} state state
*/ */
toggle (state) { toggle(state) {
state.active = !state.active state.active = !state.active
}, },
/** /**
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
* @param {Object} state state * @param {Object} state state
* @param {Boolean} active active * @param {Boolean} active active
*/ */
set (state, active) { set(state, active) {
state.active = active state.active = active
} }
} }
......
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,7 @@ export default {
* @description 记录 UA * @description 记录 UA
* @param {Object} state state * @param {Object} state state
*/ */
get (state) { get(state) {
state.data = new UaParser().getResult() state.data = new UaParser().getResult()
} }
} }
......
const SESSION_NAME = `${process.env.VUE_APP_STORAGE_PREFIX}-${process.env.VUE_APP_VERSION}-user`
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
...@@ -10,7 +12,7 @@ export default { ...@@ -10,7 +12,7 @@ export default {
* @param {Object} context * @param {Object} context
* @param {*} info info * @param {*} info info
*/ */
set ({ state, dispatch }, info) { set({ state, dispatch }, info) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
state.info = info state.info = info
...@@ -21,7 +23,7 @@ export default { ...@@ -21,7 +23,7 @@ export default {
// value: info, // value: info,
// user: true // user: true
// }, { root: true }) // }, { root: true })
sessionStorage.setItem('tfims-user', escape(JSON.stringify(info))) sessionStorage.setItem(SESSION_NAME, escape(JSON.stringify(info)))
// end // end
resolve() resolve()
}) })
...@@ -30,7 +32,7 @@ export default { ...@@ -30,7 +32,7 @@ export default {
* @description 从数据库取用户数据 * @description 从数据库取用户数据
* @param {Object} context * @param {Object} context
*/ */
load ({ state, dispatch }) { load({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// store 赋值 // store 赋值
// state.info = await dispatch('d2admin/db/get', { // state.info = await dispatch('d2admin/db/get', {
...@@ -39,13 +41,13 @@ export default { ...@@ -39,13 +41,13 @@ export default {
// defaultValue: {}, // defaultValue: {},
// user: true // user: true
// }, { root: true }) // }, { root: true })
state.info = JSON.parse(unescape(sessionStorage.getItem('tfims-user'))) state.info = JSON.parse(unescape(sessionStorage.getItem(SESSION_NAME)))
// end // end
resolve() resolve()
}) })
}, },
clear ({ state, dispatch }) { clear({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
// await dispatch('d2admin/db/set', { // await dispatch('d2admin/db/set', {
// dbName: 'database', // dbName: 'database',
...@@ -54,7 +56,7 @@ export default { ...@@ -54,7 +56,7 @@ export default {
// user: true // user: true
// }, { root: true }) // }, { root: true })
state.info = null state.info = null
sessionStorage.removeItem('tfims-user') sessionStorage.removeItem(SESSION_NAME)
resolve() resolve()
}) })
} }
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<script> <script>
export default { export default {
name: 'page1', name: 'page1',
render: function (createElement) { render: function(createElement) {
return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' } return createElement('div', { attrs: { class: 'd2-layout-header-aside-menu-side' }
}, [ }, [
createElement('el-menu', { createElement('el-menu', {
......
...@@ -56,11 +56,11 @@ ...@@ -56,11 +56,11 @@
export default { export default {
name: 'page2', name: 'page2',
methods: { methods: {
handleClick (row) { handleClick(row) {
alert(JSON.stringify(row)) alert(JSON.stringify(row))
} }
}, },
data () { data() {
return { return {
testCache: '', testCache: '',
btn: { btn: {
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
import { isExistApi } from '@api/deviceManagement' import { isExistApi } from '@api/deviceManagement'
export default { export default {
name: 'EditDialog', name: 'EditDialog',
data () { data() {
return { return {
deviceNum: '', deviceNum: '',
deviceCode: '', deviceCode: '',
...@@ -142,31 +142,31 @@ export default { ...@@ -142,31 +142,31 @@ export default {
}, },
watch: { watch: {
isVisible (val) { isVisible(val) {
val && (this.deviceNum = this.editForm.deviceNum) val && (this.deviceNum = this.editForm.deviceNum)
val && (this.deviceName = this.editForm.deviceName) val && (this.deviceName = this.editForm.deviceName)
this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields() this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields()
} }
}, },
mounted () {}, mounted() {},
methods: { methods: {
async isCodeExist (rule, value, callback) { async isCodeExist(rule, value, callback) {
if (this.deviceNum !== value || this.deviceName !== this.editForm.deviceName) { if (this.deviceNum !== value || this.deviceName !== this.editForm.deviceName) {
const res = await isExistApi({ deviceNum: value, deviceName: this.editForm.deviceName, stationCode: this.editForm.stationCode }) const res = await isExistApi({ deviceNum: value, deviceName: this.editForm.deviceName, stationCode: this.editForm.stationCode })
res.deviceNum ? callback(new Error(rule.message)) : callback() res.deviceNum ? callback(new Error(rule.message)) : callback()
} }
}, },
validateCode (value) { validateCode(value) {
this.$refs.editRuleForm.validateField('deviceNum') this.$refs.editRuleForm.validateField('deviceNum')
}, },
handleClose () { handleClose() {
this.$emit('closeDialog') this.$emit('closeDialog')
}, },
handleConfirm () { handleConfirm() {
this.$refs.editRuleForm.validate((vaild) => { this.$refs.editRuleForm.validate((vaild) => {
if (vaild) { if (vaild) {
this.$emit('confirmDialog') this.$emit('confirmDialog')
......
...@@ -109,7 +109,7 @@ export default { ...@@ -109,7 +109,7 @@ export default {
components: { components: {
EditDialog EditDialog
}, },
data () { data() {
return { return {
// 编辑弹窗 // 编辑弹窗
editVisible: false, editVisible: false,
...@@ -173,23 +173,23 @@ export default { ...@@ -173,23 +173,23 @@ export default {
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
this.loadBaseData() this.loadBaseData()
}, },
methods: { methods: {
async loadBaseData () { async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY) const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
this.baseData.station = data this.baseData.station = data
}, },
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...@@ -197,7 +197,7 @@ export default { ...@@ -197,7 +197,7 @@ export default {
} }
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
this.tableData = res.deviceList this.tableData = res.deviceList
...@@ -209,12 +209,12 @@ export default { ...@@ -209,12 +209,12 @@ export default {
}) })
}, },
delObjMutiAttr (obj, keys) { delObjMutiAttr(obj, keys) {
keys.map(key => delete obj[key]) keys.map(key => delete obj[key])
return obj return obj
}, },
editDevice (params) { editDevice(params) {
params = this.delObjMutiAttr(params, ['createTime', 'keyWord', 'pageCount', 'pageSize', 'updateTime', 'stationName', 'stationCode']) params = this.delObjMutiAttr(params, ['createTime', 'keyWord', 'pageCount', 'pageSize', 'updateTime', 'stationName', 'stationCode'])
// console.log(params) // console.log(params)
editApi(params).then(res => { editApi(params).then(res => {
...@@ -227,7 +227,7 @@ export default { ...@@ -227,7 +227,7 @@ export default {
}, },
// 导入 // 导入
importFile (e) { importFile(e) {
const name = e.target.files[0].name const name = e.target.files[0].name
this.fileInfo.fileType = name.split('.')[1] this.fileInfo.fileType = name.split('.')[1]
// // 转码base64 // // 转码base64
...@@ -272,7 +272,7 @@ export default { ...@@ -272,7 +272,7 @@ export default {
} }
}, },
exportFile () { exportFile() {
const params = this.getParams() const params = this.getParams()
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
...@@ -283,40 +283,40 @@ export default { ...@@ -283,40 +283,40 @@ export default {
}, },
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleEditClose () { handleEditClose() {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleEditConfirm () { handleEditConfirm() {
var editParams = _.cloneDeep(this.editForm) var editParams = _.cloneDeep(this.editForm)
this.editDevice(editParams) this.editDevice(editParams)
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row) { handleEdit(row) {
// console.log(row) // console.log(row)
this.editForm = _.cloneDeep(row) this.editForm = _.cloneDeep(row)
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleDelete (row) { handleDelete(row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
......
...@@ -115,7 +115,7 @@ import { mapActions } from 'vuex' ...@@ -115,7 +115,7 @@ import { mapActions } from 'vuex'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'fimsMaintainManagement', name: 'fimsMaintainManagement',
data () { data() {
return { return {
// 搜索 // 搜索
searchForm: { searchForm: {
...@@ -299,12 +299,12 @@ export default { ...@@ -299,12 +299,12 @@ export default {
}, },
watch: { watch: {
'searchForm.createTime' (value) { 'searchForm.createTime'(value) {
!value && this.loadingGetList() !value && this.loadingGetList()
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
this.loadBaseData() this.loadBaseData()
}, },
...@@ -312,7 +312,7 @@ export default { ...@@ -312,7 +312,7 @@ export default {
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
async loadBaseData () { async loadBaseData() {
const modelToOptions = { 'stationCode': 'station', 'subsystemTypeCode': 'subsys' } const modelToOptions = { 'stationCode': 'station', 'subsystemTypeCode': 'subsys' }
const data = await this.load() const data = await this.load()
if (data) { if (data) {
...@@ -323,22 +323,22 @@ export default { ...@@ -323,22 +323,22 @@ export default {
} }
}, },
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
var time = [{attr: 'startTime', addTime: '00:00:00'}, {attr: 'endTime', addTime: '23:59:59'}] var time = [{ attr: 'startTime', addTime: '00:00:00' }, { attr: 'endTime', addTime: '23:59:59' }]
this.searchForm.createTime && this.searchForm.createTime.map((value, i) => this.searchForm[time[i].attr] = value + ' ' + time[i].addTime) this.searchForm.createTime && this.searchForm.createTime.map((value, i) => (this.searchForm[time[i].attr] = value + ' ' + time[i].addTime))
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...this.searchForm ...this.searchForm
} }
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
delete params.createTime delete params.createTime
// console.log(params) // console.log(params)
...@@ -351,7 +351,7 @@ export default { ...@@ -351,7 +351,7 @@ export default {
this.tableLoading = false this.tableLoading = false
}) })
}, },
exportOrder () { exportOrder() {
const params = this.getParams() const params = this.getParams()
delete params.createTime delete params.createTime
exportApi(params).then(res => { exportApi(params).then(res => {
...@@ -363,24 +363,24 @@ export default { ...@@ -363,24 +363,24 @@ export default {
}, },
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleDelete (row) { handleDelete(row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<script> <script>
export default { export default {
name: 'DetailDialog', name: 'DetailDialog',
data () { data() {
return { return {
} }
}, },
...@@ -29,10 +29,10 @@ export default { ...@@ -29,10 +29,10 @@ export default {
pdfUrl: String pdfUrl: String
}, },
mounted () {}, mounted() {},
methods: { methods: {
handleClose () { handleClose() {
this.$emit('closeDialog') this.$emit('closeDialog')
} }
} }
......
...@@ -114,14 +114,14 @@ ...@@ -114,14 +114,14 @@
<script> <script>
import DetailDialog from './detailDialog' import DetailDialog from './detailDialog'
import { getListApi, detailApi, removeApi, exportApi, downloadApi } from '@api/materiaOrderManagement' import { getListApi, removeApi, exportApi, downloadApi } from '@api/materiaOrderManagement'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'fimsMateriaOrderManagement', name: 'fimsMateriaOrderManagement',
components: { components: {
DetailDialog DetailDialog
}, },
data () { data() {
return { return {
detailVisible: false, detailVisible: false,
dialogTitle: '', dialogTitle: '',
...@@ -189,31 +189,31 @@ export default { ...@@ -189,31 +189,31 @@ export default {
}, },
watch: { watch: {
'searchForm.createTime' (value) { 'searchForm.createTime'(value) {
!value && this.loadingGetList() !value && this.loadingGetList()
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
}, },
methods: { methods: {
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
var time = [{attr: 'startTime', addTime: '00:00:00'}, {attr: 'endTime', addTime: '23:59:59'}] var time = [{ attr: 'startTime', addTime: '00:00:00' }, { attr: 'endTime', addTime: '23:59:59' }]
this.searchForm.createTime && this.searchForm.createTime.map((value, i) => this.searchForm[time[i].attr] = value + ' ' + time[i].addTime) this.searchForm.createTime && this.searchForm.createTime.map((value, i) => (this.searchForm[time[i].attr] = value + ' ' + time[i].addTime))
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...this.searchForm ...this.searchForm
} }
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
!params.orderCode && delete params.orderCode !params.orderCode && delete params.orderCode
delete params.createTime delete params.createTime
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
}) })
}, },
exportFile () { exportFile() {
const params = this.getParams() const params = this.getParams()
!params.orderCode && delete params.orderCode !params.orderCode && delete params.orderCode
delete params.createTime delete params.createTime
...@@ -241,29 +241,29 @@ export default { ...@@ -241,29 +241,29 @@ export default {
}, },
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleDetailClose () { handleDetailClose() {
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
}, },
// 表格-查看详情 // 表格-查看详情
handleDetail (row) { handleDetail(row) {
downloadApi({ downloadApi({
orderCode: row.orderCode orderCode: row.orderCode
}).then(res => { }).then(res => {
...@@ -275,7 +275,7 @@ export default { ...@@ -275,7 +275,7 @@ export default {
}) })
}, },
handleDelete (row) { handleDelete(row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
......
...@@ -58,7 +58,7 @@ import { getListApi } from '@api/materialList' ...@@ -58,7 +58,7 @@ import { getListApi } from '@api/materialList'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'fimsMaterialList', name: 'fimsMaterialList',
data () { data() {
return { return {
searchForm: { searchForm: {
keyWord: '' keyWord: ''
...@@ -95,24 +95,24 @@ export default { ...@@ -95,24 +95,24 @@ export default {
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
}, },
methods: { methods: {
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...this.searchForm ...this.searchForm
} }
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
this.tableData = res.deviceList this.tableData = res.deviceList
...@@ -125,18 +125,18 @@ export default { ...@@ -125,18 +125,18 @@ export default {
}, },
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
......
...@@ -81,7 +81,7 @@ import { BaseData } from '@/common/constants' ...@@ -81,7 +81,7 @@ import { BaseData } from '@/common/constants'
import notice from '@/common/notice' import notice from '@/common/notice'
export default { export default {
name: 'FimsReportingLogs', name: 'FimsReportingLogs',
data () { data() {
return { return {
tableLoading: false, tableLoading: false,
searchForm: { searchForm: {
...@@ -124,18 +124,18 @@ export default { ...@@ -124,18 +124,18 @@ export default {
}, },
watch: { watch: {
'searchForm.reportTime' (value) { 'searchForm.reportTime'(value) {
!value && this.loadingGetList() !value && this.loadingGetList()
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
this.loadBaseData() this.loadBaseData()
}, },
methods: { methods: {
async loadBaseData () { async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY) const data = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
this.baseData.station = data this.baseData.station = data
}, },
...@@ -170,7 +170,7 @@ export default { ...@@ -170,7 +170,7 @@ export default {
}) })
}, },
handleExport () { handleExport() {
const params = this.getParams() const params = this.getParams()
delete params.reportTime delete params.reportTime
exportApi(params).then(res => { exportApi(params).then(res => {
...@@ -184,18 +184,18 @@ export default { ...@@ -184,18 +184,18 @@ export default {
}, },
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
......
...@@ -74,7 +74,7 @@ import { constants } from 'fs'; ...@@ -74,7 +74,7 @@ import { constants } from 'fs';
import { isExistApi } from '@api/subSysManagement' import { isExistApi } from '@api/subSysManagement'
export default { export default {
name: 'EditDialog', name: 'EditDialog',
data () { data() {
return { return {
disabled: false, disabled: false,
title: '添加子系统', title: '添加子系统',
...@@ -117,7 +117,7 @@ export default { ...@@ -117,7 +117,7 @@ export default {
}, },
watch: { watch: {
isVisible (val) { isVisible(val) {
this.disabled = !!this.editForm.subsystemCode this.disabled = !!this.editForm.subsystemCode
this.title = !this.editForm.subsystemCode ? '添加子系统' : '编辑子系统' this.title = !this.editForm.subsystemCode ? '添加子系统' : '编辑子系统'
this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields() this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields()
...@@ -125,21 +125,21 @@ export default { ...@@ -125,21 +125,21 @@ export default {
}, },
methods: { methods: {
async isCodeExist (rule, value, callback) { async isCodeExist(rule, value, callback) {
if (this.editForm.trafficCode && !this.editForm.id) { if (this.editForm.trafficCode && !this.editForm.id) {
const res = await isExistApi({ subsystemCode: value, trafficCode: this.editForm.trafficCode }) const res = await isExistApi({ subsystemCode: value, trafficCode: this.editForm.trafficCode })
res.subsystemCode ? callback(new Error(rule.message)) : callback() res.subsystemCode ? callback(new Error(rule.message)) : callback()
} }
}, },
validateCode (value) { validateCode(value) {
this.$refs.editRuleForm.validateField('subsystemCode') this.$refs.editRuleForm.validateField('subsystemCode')
}, },
handleClose () { handleClose() {
this.$emit('closeDialog') this.$emit('closeDialog')
}, },
handleConfirm () { handleConfirm() {
this.$refs.editRuleForm.validate((vaild) => { this.$refs.editRuleForm.validate((vaild) => {
if (vaild) { if (vaild) {
this.$emit('confirmDialog') this.$emit('confirmDialog')
......
...@@ -124,7 +124,7 @@ export default { ...@@ -124,7 +124,7 @@ export default {
components: { components: {
EditDialog EditDialog
}, },
data () { data() {
return { return {
// 远程搜索-返回数组 // 远程搜索-返回数组
// remoteOptionArr: { // remoteOptionArr: {
...@@ -201,13 +201,13 @@ export default { ...@@ -201,13 +201,13 @@ export default {
} }
}, },
mounted () { mounted() {
this.loadingGetList() this.loadingGetList()
this.loadBaseData() this.loadBaseData()
}, },
methods: { methods: {
async loadBaseData () { async loadBaseData() {
const data = await this.$store.dispatch('d2admin/base/get', BaseData.SUBSYS.KEY) const data = await this.$store.dispatch('d2admin/base/get', BaseData.SUBSYS.KEY)
this.baseData.subsys = data this.baseData.subsys = data
}, },
...@@ -223,12 +223,12 @@ export default { ...@@ -223,12 +223,12 @@ export default {
// this.loadingGetList() // this.loadingGetList()
// }, // },
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...@@ -245,7 +245,7 @@ export default { ...@@ -245,7 +245,7 @@ export default {
// }) // })
// }, // },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
this.tableData = res.subsystemList this.tableData = res.subsystemList
...@@ -257,10 +257,10 @@ export default { ...@@ -257,10 +257,10 @@ export default {
}) })
}, },
editSubSystem (value) { editSubSystem(value) {
// console.log(value) // console.log(value)
const params = _.cloneDeep(this.editFormReset) const params = _.cloneDeep(this.editFormReset)
Object.keys(params).map(key => params[key] = value[key]) Object.keys(params).map(key => (params[key] = value[key]))
params.subsystemType = this.baseData.subsys.find(item => item.confCode === params.subsystemTypeCode).confValue params.subsystemType = this.baseData.subsys.find(item => item.confCode === params.subsystemTypeCode).confValue
if (!value.id) { if (!value.id) {
delete params.id delete params.id
...@@ -280,39 +280,39 @@ export default { ...@@ -280,39 +280,39 @@ export default {
}, },
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch() {
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleEditClose () { handleEditClose() {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleEditConfirm () { handleEditConfirm() {
var editParams = JSON.parse(JSON.stringify(this.editForm)) var editParams = JSON.parse(JSON.stringify(this.editForm))
this.editSubSystem(editParams) this.editSubSystem(editParams)
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row) { handleEdit(row) {
this.editForm = JSON.parse(JSON.stringify(row)) this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleDelete (row) { handleDelete(row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
......
export default { export default {
beforeRouteEnter (to, from, next) { beforeRouteEnter(to, from, next) {
next(instance => instance.$router.replace(JSON.parse(from.params.route))) next(instance => instance.$router.replace(JSON.parse(from.params.route)))
}, },
render: h => h() render: h => h()
......
export default { export default {
beforeRouteEnter (to, from, next) { beforeRouteEnter(to, from, next) {
next(instance => instance.$router.replace(from.fullPath)) next(instance => instance.$router.replace(from.fullPath))
}, },
render: h => h() render: h => h()
......
...@@ -71,9 +71,8 @@ ...@@ -71,9 +71,8 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { get } from 'lodash'
export default { export default {
data () { data() {
return { return {
uploading: false uploading: false
} }
...@@ -85,7 +84,7 @@ export default { ...@@ -85,7 +84,7 @@ export default {
}, },
methods: { methods: {
get: _.get, get: _.get,
handleShowMore (log) { handleShowMore(log) {
// 打印一条日志的所有信息到控制台 // 打印一条日志的所有信息到控制台
this.$notify({ this.$notify({
type: 'info', type: 'info',
...@@ -100,7 +99,7 @@ export default { ...@@ -100,7 +99,7 @@ export default {
console.groupEnd() console.groupEnd()
}, },
// 日志上传 // 日志上传
handleUpload () { handleUpload() {
this.uploading = true this.uploading = true
this.$notify({ this.$notify({
type: 'info', type: 'info',
......
...@@ -90,11 +90,11 @@ export default { ...@@ -90,11 +90,11 @@ export default {
} }
}, },
computed: { computed: {
dialogVisible () { dialogVisible() {
return this.isVisible return this.isVisible
} }
}, },
data () { data() {
return { return {
POST_DISABLED, POST_DISABLED,
company: [], company: [],
...@@ -186,12 +186,12 @@ export default { ...@@ -186,12 +186,12 @@ export default {
}, },
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
handleClose () { handleClose() {
this.$refs.regForm.resetFields() this.$refs.regForm.resetFields()
this.$event.$emit('e-reg-dialog', false) this.$event.$emit('e-reg-dialog', false)
}, },
// 提交注册数据 // 提交注册数据
submit () { submit() {
this.$refs.regForm.validate(vaild => { this.$refs.regForm.validate(vaild => {
if (vaild) { if (vaild) {
var __p = this.regForm var __p = this.regForm
...@@ -201,21 +201,21 @@ export default { ...@@ -201,21 +201,21 @@ export default {
notice.okTips('注册信息已提交,请等待管理员审核') notice.okTips('注册信息已提交,请等待管理员审核')
this.handleClose() this.handleClose()
} else { } else {
notice.errorTips(`注册失败!`) notice.errorTips('注册失败!')
} }
}) })
} }
}) })
}, },
// 加载业务所需所有数据 // 加载业务所需所有数据
async fetchData () { async fetchData() {
const { station, post } = await this.load() const { station, post } = await this.load()
this.baseData.posts = post this.baseData.posts = post
this.baseData.stations = station this.baseData.stations = station
Object.freeze(this.baseData) Object.freeze(this.baseData)
} }
}, },
mounted () { mounted() {
this.fetchData() this.fetchData()
} }
} }
......
...@@ -90,7 +90,7 @@ export default { ...@@ -90,7 +90,7 @@ export default {
components: { components: {
DialogReg: () => import('./dialogReg') DialogReg: () => import('./dialogReg')
}, },
data () { data() {
return { return {
registerDialogVisible: false, registerDialogVisible: false,
timeInterval: null, timeInterval: null,
...@@ -118,20 +118,20 @@ export default { ...@@ -118,20 +118,20 @@ export default {
}) })
} }
}, },
mounted () { mounted() {
this.timeInterval = setInterval(() => this.refreshTime(), 1000) this.timeInterval = setInterval(() => this.refreshTime(), 1000)
this.$event.$on('e-reg-dialog', res => (this.registerDialogVisible = res)) this.$event.$on('e-reg-dialog', res => (this.registerDialogVisible = res))
}, },
beforeDestroy () { beforeDestroy() {
clearInterval(this.timeInterval) clearInterval(this.timeInterval)
}, },
methods: { methods: {
...mapActions('d2admin/account', ['login']), ...mapActions('d2admin/account', ['login']),
refreshTime () { refreshTime() {
this.time = dayjs().format('HH:mm:ss') this.time = dayjs().format('HH:mm:ss')
}, },
// 提交登录信息 // 提交登录信息
submit () { submit() {
// console.log(navigator.userAgent.toLocaleLowerCase()) // console.log(navigator.userAgent.toLocaleLowerCase())
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {
if (valid) { if (valid) {
......
...@@ -109,10 +109,9 @@ ...@@ -109,10 +109,9 @@
import { getListApi, reportApi, exportApi } from '@api/systemMonitor' import { getListApi, reportApi, exportApi } from '@api/systemMonitor'
import notice from '@/common/notice' import notice from '@/common/notice'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { cloneDeep } from 'lodash'
export default { export default {
name: 'index', name: 'index',
data () { data() {
return { return {
subSystemRadio: '全部', subSystemRadio: '全部',
tag: Object.freeze({ tag: Object.freeze({
...@@ -226,7 +225,7 @@ export default { ...@@ -226,7 +225,7 @@ export default {
} }
}, },
mounted () { mounted() {
this.$echarts = echarts this.$echarts = echarts
this.loadingGetList() this.loadingGetList()
this.loadBaseData() this.loadBaseData()
...@@ -237,7 +236,7 @@ export default { ...@@ -237,7 +236,7 @@ export default {
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
async loadBaseData () { async loadBaseData() {
// this.baseData.station = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY) // this.baseData.station = await this.$store.dispatch('d2admin/base/get', BaseData.STATION.KEY)
const { station, subsys } = await this.load() const { station, subsys } = await this.load()
this.baseData.station = _.cloneDeep(station) this.baseData.station = _.cloneDeep(station)
...@@ -245,12 +244,12 @@ export default { ...@@ -245,12 +244,12 @@ export default {
this.baseData.subsys.unshift({ confCode: '', confValue: '全部' }) this.baseData.subsys.unshift({ confCode: '', confValue: '全部' })
}, },
loadingGetList () { loadingGetList() {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
}, },
/* 接口请求-start */ /* 接口请求-start */
getParams () { getParams() {
return { return {
pageCount: this.pageSize, pageCount: this.pageSize,
pageSize: this.currentPage, pageSize: this.currentPage,
...@@ -258,7 +257,7 @@ export default { ...@@ -258,7 +257,7 @@ export default {
} }
}, },
getList () { getList() {
const params = this.getParams() const params = this.getParams()
getListApi(params).then(res => { getListApi(params).then(res => {
this.tableData = res.subsystemList this.tableData = res.subsystemList
...@@ -269,7 +268,7 @@ export default { ...@@ -269,7 +268,7 @@ export default {
this.tableLoading = false this.tableLoading = false
}) })
}, },
getPie (label = '') { getPie(label = '') {
const params = { const params = {
subsystemTypeCode: label ? this.baseData.subsys.find(item => item.confValue === label).confCode : '' subsystemTypeCode: label ? this.baseData.subsys.find(item => item.confValue === label).confCode : ''
} }
...@@ -279,7 +278,7 @@ export default { ...@@ -279,7 +278,7 @@ export default {
notice.errorTips() notice.errorTips()
}) })
}, },
exportFile () { exportFile() {
const params = this.getParams() const params = this.getParams()
exportApi(params).then(res => { exportApi(params).then(res => {
this.$open(res.url) this.$open(res.url)
...@@ -293,11 +292,11 @@ export default { ...@@ -293,11 +292,11 @@ export default {
// offlineNum 离网数量 // offlineNum 离网数量
// normalNum 正常数量 // normalNum 正常数量
// breakdownNum 故障数量 // breakdownNum 故障数量
drawPie (params) { drawPie(params) {
let item = this.totalOptions.series[0] let item = this.totalOptions.series[0]
item.data[0].value = params.onlineNum ? params.onlineNum : 0 item.data[0].value = params.onlineNum ? params.onlineNum : 0
item.data[1].value = params.offlineNum ? params.offlineNum : 0 item.data[1].value = params.offlineNum ? params.offlineNum : 0
item = this.totalOptions.series[1] item = this.totalOptions.series[1]
item.data[0].value = params.breakdownNum ? params.breakdownNum : 0 item.data[0].value = params.breakdownNum ? params.breakdownNum : 0
item.data[1].value = params.normalNum ? params.normalNum : 0 item.data[1].value = params.normalNum ? params.normalNum : 0
...@@ -306,19 +305,19 @@ export default { ...@@ -306,19 +305,19 @@ export default {
}, },
// 搜索 // 搜索
handleSearch () { handleSearch() {
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange(value) {
this.pageSize = value this.pageSize = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
}, },
handleCurrentChange (value) { handleCurrentChange(value) {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!