Commit 22473faf by cwq0219

合并

2 parents 901cc638 3a1a644a
...@@ -13,8 +13,8 @@ const user_path = 'fims.user.' ...@@ -13,8 +13,8 @@ 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`
/** /**
* 用户登录 * 用户登录
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
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 BaseDataURL = 'fims.configuration.from.conftype'
// 基础数据 // 基础数据
const path = 'fims.base.' const path = 'fims.base.'
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
* @Last Modified time: 2019-09-06 12:22:40 * @Last Modified time: 2019-09-06 12:22:40
*/ */
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 { BaseDataURL } from '@/api/sys.base'
export const TYPE_NAME = 'confType' export const TYPE_NAME = 'confType'
/** /**
...@@ -38,16 +38,16 @@ export const RegistType = { ...@@ -38,16 +38,16 @@ export const RegistType = {
* 前端免登录验证接口名 * 前端免登录验证接口名
*/ */
export const LogExternals = [ export const LogExternals = [
LOGIN_URL, //登录 LOGIN_URL, // 登录
REG_URL, // 注册 REG_URL, // 注册
BaseDataURL, //基础数据 BaseDataURL, // 基础数据
Role_LIST_URL //角色列表 Role_LIST_URL // 角色列表
] ]
/** /**
* 登录来源 * 登录来源
*/ */
export const LOGIN_TYPE = 1 //1pc,2小程序 export const LOGIN_TYPE = 1 // 1pc,2小程序
/** /**
* 超级管理员类型 * 超级管理员类型
*/ */
export const SUPPER_ADMIN = 1 //
\ No newline at end of file \ No newline at end of file
export const SUPPER_ADMIN = 1 //
/* /*
* @Author: limin * @Author: limin
* @Date: 2019-09-06 10:12:23 * @Date: 2019-09-06 10:12:23
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-06 13:23:25 * @Last Modified time: 2019-09-06 13:23:25
*/ */
......
/* /*
* @Author: limin * @Author: limin
* @Date: 2019-09-06 10:11:24 * @Date: 2019-09-06 10:11:24
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-06 13:30:14 * @Last Modified time: 2019-09-06 13:30:14
*/ */
const dateFormat = (dateStr,time)=>{ const dateFormat = (dateStr, time) => {
//得到特定的时间 // 得到特定的时间
var date = new Date(dateStr); var date = new Date(dateStr)
var year = date.getFullYear(); var year = date.getFullYear()
//ES6语法填充:var month = (date.getMonth()+1).toString().padStart(2, '0'); // ES6语法填充:var month = (date.getMonth()+1).toString().padStart(2, '0');
var month = date.getMonth()+1<10 ? '0'+ (date.getMonth()+1) : date.getMonth()+1; var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1
var day = date.getDate()<10 ? '0' + date.getDate() : date.getDate(); var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
var hh = date.getHours()<10 ? '0' + date.getHours() : date.getHours(); var hh = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
var mm = date.getMinutes()<10 ? '0' + date.getMinutes() : date.getMinutes(); var mm = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
var ss = date.getSeconds()<10 ? '0' + date.getSeconds() : date.getSeconds(); var ss = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
//return `${year}-${month}-${day}`; // return `${year}-${month}-${day}`;
if(time&&time.toLowerCase() === 'yyyy-mm-dd'){ if (time && time.toLowerCase() === 'yyyy-mm-dd') {
return `${year}-${month}-${day}`; return `${year}-${month}-${day}`
}else if(time&&time.toLowerCase() === 'hh:mm:ss'){ } else if (time && time.toLowerCase() === 'hh:mm:ss') {
return `${hh}:${mm}:${ss}`; return `${hh}:${mm}:${ss}`
}else{ } else {
console.log(1); console.log(1)
return `${year}-${month}-${day} ${hh}:${mm}:${ss}`; return `${year}-${month}-${day} ${hh}:${mm}:${ss}`
} }
} }
export { dateFormat } export { dateFormat }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
></el-avatar> ></el-avatar>
</div> </div>
<div class="name-role"> <div class="name-role">
<span class="sender">{{ user.userName }} - {{ user.roleType||'' }}</span> <span class="sender">{{ user.userName }} - {{ ['超级管理员','管理员'][user.roleType] }}</span>
</div> </div>
<div class="registe-info"> <div class="registe-info">
<span class="registe-info"> <span class="registe-info">
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
</div> </div>
</div> </div>
<div class="personal-footer" @click="logOut"> <div class="personal-footer" @click="logOut">
<i class="fa fa-sign-out"></i> <el-button type="text"><i class="fa fa-sign-out"></i>注销</el-button>
注销
</div> </div>
<!--备份还原界面--> <!--备份还原界面-->
<!-- <backup ref="backupDialog" @afterRestore="afterRestore"></backup> --> <!-- <backup ref="backupDialog" @afterRestore="afterRestore"></backup> -->
...@@ -78,9 +77,9 @@ export default { ...@@ -78,9 +77,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.$store.commit('d2admin/gray/set', false) this.$store.commit('d2admin/gray/set', false)
Message({ // Message({
message: '取消注销操作' // message: '取消注销操作'
}) // })
}) })
}, },
clear () { clear () {
...@@ -96,9 +95,9 @@ export default { ...@@ -96,9 +95,9 @@ export default {
}) })
.catch(() => { .catch(() => {
this.$store.commit('d2admin/gray/set', false) this.$store.commit('d2admin/gray/set', false)
Message({ // Message({
message: '取消清除缓存操作' // message: '取消清除缓存操作'
}) // })
}) })
}, },
comfirm (text, title, cancleText) { comfirm (text, title, cancleText) {
...@@ -129,10 +128,10 @@ export default { ...@@ -129,10 +128,10 @@ export default {
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
.personal-panel { .personal-panel {
font-size: 14px; font-size: 14px;
width: 220px; width: 248px;
text-align: center; text-align: center;
border-color: rgba(180, 190, 190, 0.2); border-color: rgba(180, 190, 190, 0.2);
border-width: 1px; border-width: 1px;
...@@ -173,30 +172,31 @@ export default { ...@@ -173,30 +172,31 @@ export default {
} }
.main-operation { .main-operation {
padding: 8px; padding: 8px;
margin-right: 1px;
/* background: rgba(175, 182, 179, 0.3); */ /* background: rgba(175, 182, 179, 0.3); */
border-color: rgba(201, 206, 206, 0.2); border-color: rgba(201, 206, 206, 0.2);
border-top-width: 1px; border-top-width: 1px;
border-top-style: solid; border-top-style: solid;
display: flex;
justify-content: space-between;
} }
.main-operation-item { .main-operation-item {
margin: 4px; margin: 4px;
} }
.other-operation { .other-operation {
padding: 10px; padding: 0;
margin-right: 1px; margin-right: 1px;
text-align: left; text-align: left;
border-color: rgba(180, 190, 190, 0.2); border-color: rgba(180, 190, 190, 0.2);
border-top-width: 1px; border-top-width: 1px;
border-top-style: solid; border-top-style: solid;
} &-item {
.other-operation-item { padding: 12px 16px;
padding: 4px 8px; }
} &:hover{
.other-operation-item:hover { cursor: pointer;
cursor: pointer; color: rgb(19, 138, 156);
background: #9e94941e; background: #b1a6a61e;
color: rgb(19, 138, 156); }
} }
.personal-footer { .personal-footer {
margin-right: 1px; margin-right: 1px;
...@@ -207,10 +207,10 @@ export default { ...@@ -207,10 +207,10 @@ export default {
border-color: rgba(180, 190, 190, 0.2); border-color: rgba(180, 190, 190, 0.2);
border-top-width: 1px; border-top-width: 1px;
border-top-style: solid; border-top-style: solid;
} &:hover{
.personal-footer:hover { cursor: pointer;
cursor: pointer; color: rgb(19, 138, 156);
color: rgb(19, 138, 156); background: #b1a6a61e;
background: #b1a6a61e; }
} }
</style> </style>
...@@ -107,7 +107,7 @@ permision.packMenusBtns = function (resources) { ...@@ -107,7 +107,7 @@ permision.packMenusBtns = function (resources) {
__aParent.push(__oMenu) __aParent.push(__oMenu)
// __aAll.push(__oMenu) // __aAll.push(__oMenu)
// if (__oMenu.auth) { // if (__oMenu.auth) {
// __aAll = [...__aAll, ...__oMenu.auth] // __aAll = [...__aAll, ...__oMenu.auth]
// } // }
} else { // 取出子菜单 } else { // 取出子菜单
__aSub.push(__oMenu) __aSub.push(__oMenu)
...@@ -120,7 +120,7 @@ permision.packMenusBtns = function (resources) { ...@@ -120,7 +120,7 @@ permision.packMenusBtns = function (resources) {
__aSub.forEach(obj => { __aSub.forEach(obj => {
// __aAll.push(obj) // __aAll.push(obj)
// if (obj.auth) { // if (obj.auth) {
// __aAll = [...__aAll, ...obj.auth] // __aAll = [...__aAll, ...obj.auth]
// } // }
__parent = __aParent.find(menu => menu.authId === obj.parentId) __parent = __aParent.find(menu => menu.authId === obj.parentId)
if (__parent.children) { if (__parent.children) {
...@@ -165,13 +165,13 @@ permision.format2ResourceMenu = function (oMenu) { ...@@ -165,13 +165,13 @@ 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
const cloneItem= cloneDeep(item) const cloneItem = cloneDeep(item)
delete cloneItem.auth delete cloneItem.auth
return result.concat(item.auth ? permision.flatten([...item.auth,cloneItem]) : item); return result.concat(item.auth ? permision.flatten([...item.auth, cloneItem]) : item)
}, []); }, [])
} }
export default permision export default permision
...@@ -8,18 +8,18 @@ import router from '@/router' ...@@ -8,18 +8,18 @@ import router from '@/router'
import { import {
LogExternals LogExternals
} from '@/common/constants' } from '@/common/constants'
axios.defaults.withCredentials = true
import qs from 'qs' import qs from 'qs'
axios.defaults.withCredentials = true
const expiresMinute = 10 const expiresMinute = 10
// 创建一个错误 // 创建一个错误
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: '数据请求异常',
...@@ -44,7 +44,7 @@ function errorLog(error) { ...@@ -44,7 +44,7 @@ function errorLog(error) {
// VUE_APP_API=http://192.168.3.191:8944/router // VUE_APP_API=http://192.168.3.191:8944/router
// 创建一个 axios 实例 // 创建一个 axios 实例
const service = axios.create({ const service = axios.create({
baseURL: 'http://192.168.3.191:8944/router',//process.env.VUE_APP_API, baseURL: 'http://192.168.3.191:8944/router', // process.env.VUE_APP_API,
timeout: 5000 // 请求超时时间 timeout: 5000 // 请求超时时间
}) })
...@@ -66,7 +66,7 @@ service.interceptors.request.use( ...@@ -66,7 +66,7 @@ service.interceptors.request.use(
router.replace('/login') router.replace('/login')
} }
} }
const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000); const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000)
util.cookies.set('token', 'token', { util.cookies.set('token', 'token', {
expires: inExpiresMinutes expires: inExpiresMinutes
}) })
...@@ -87,7 +87,7 @@ service.interceptors.response.use( ...@@ -87,7 +87,7 @@ service.interceptors.response.use(
const dataAxios = response.data const dataAxios = response.data
// 这个状态码是和后端约定的 // 这个状态码是和后端约定的
const { const {
code,data code, data
} = dataAxios } = dataAxios
// 有 code 代表这是一个后端接口 可以进行进一步的判断 // 有 code 代表这是一个后端接口 可以进行进一步的判断
switch (+code) { switch (+code) {
...@@ -104,37 +104,37 @@ service.interceptors.response.use( ...@@ -104,37 +104,37 @@ service.interceptors.response.use(
if (error && error.response) { if (error && error.response) {
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:
error.message = '请求错误'; error.message = '请求错误'
break break
case 401: case 401:
error.message = '未授权,请登录'; error.message = '未授权,请登录'
break break
case 403: case 403:
error.message = '拒绝访问'; error.message = '拒绝访问'
break break
case 404: case 404:
error.message = `请求地址出错: ${error.response.config.url}`; error.message = `请求地址出错: ${error.response.config.url}`
break break
case 408: case 408:
error.message = '请求超时'; error.message = '请求超时'
break break
case 500: case 500:
error.message = '服务器内部错误'; error.message = '服务器内部错误'
break break
case 501: case 501:
error.message = '服务未实现'; error.message = '服务未实现'
break break
case 502: case 502:
error.message = '网关错误'; error.message = '网关错误'
break break
case 503: case 503:
error.message = '服务不可用'; error.message = '服务不可用'
break break
case 504: case 504:
error.message = '网关超时'; error.message = '网关超时'
break break
case 505: case 505:
error.message = 'HTTP版本不受支持'; error.message = 'HTTP版本不受支持'
break break
default: default:
break break
...@@ -145,4 +145,4 @@ service.interceptors.response.use( ...@@ -145,4 +145,4 @@ service.interceptors.response.use(
} }
) )
export default service
\ No newline at end of file \ No newline at end of file
export default service
...@@ -388,7 +388,7 @@ export const errorPage = { ...@@ -388,7 +388,7 @@ export const errorPage = {
// 导出需要显示菜单的 // 导出需要显示菜单的
export const frameInRoutes = frameIn export const frameInRoutes = frameIn
export const localRoutes ={ export const localRoutes = {
...resources, [home.meta.authId]: home ...resources, [home.meta.authId]: home
} }
......
...@@ -17,27 +17,27 @@ export default { ...@@ -17,27 +17,27 @@ export default {
// 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 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
// token 代表用户当前登录状态 建议在网络请求中携带 token // token 代表用户当前登录状态 建议在网络请求中携带 token
// 如有必要 token 需要定时更新,默认保存一天 // 如有必要 token 需要定时更新,默认保存一天
util.cookies.set('uuid', data.loginName) util.cookies.set('uuid', data.loginName)
const authes = data.roleType === SUPPER_ADMIN ? const authes = data.roleType === SUPPER_ADMIN
util.permision.flatten(Object.values({...sources, [home.meta.authId]: home })) ? util.permision.flatten(Object.values({ ...sources, [home.meta.authId]: home }))
.map(obj=>({authId:obj.authId,parentId:obj.parentId})) .map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
:cloneDeep(data.authes) && delete data.authes : cloneDeep(data.authes) && delete data.authes
await dispatch('d2admin/auth/set', authes, { root: true }) await dispatch('d2admin/auth/set', authes, { root: true })
// 设置 vuex 用户信息 // 设置 vuex 用户信息
await dispatch('d2admin/user/set', data, { root: true }) await dispatch('d2admin/user/set', data, { root: true })
// 强制初始化基础数据 // 强制初始化基础数据
dispatch('d2admin/base/init', null, { root: true }) dispatch('d2admin/base/init', null, { root: true })
// 用户登录后从持久化数据加载一系列的设置 // 用户登录后从持久化数据加载一系列的设置
await dispatch('load') await dispatch('load')
// 结束 // 结束
resolve() resolve()
}) })
.catch(err => { .catch(err => {
console.log('err: ', err) console.log('err: ', err)
reject(err) reject(err)
......
...@@ -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-04 14:06:32 * @Last Modified time: 2019-09-06 18:23:17
*/ */
import { FetchRoleList, CompanyList, DepartList, StationList, PostList, BaseDataApi } from '@/api/sys.base' import { FetchRoleList, CompanyList, DepartList, StationList, PostList, BaseDataApi } from '@/api/sys.base'
...@@ -37,19 +37,16 @@ export default { ...@@ -37,19 +37,16 @@ export default {
return new Promise(async resolve => { return new Promise(async resolve => {
Promise.all([ Promise.all([
FetchRoleList(), FetchRoleList(),
// CompanyList(),
// DepartList(),
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] = res) => {
state.role = role state.role = role.roles
state.station = station state.station = station.confes
state.subsys = subsys state.subsys = subsys.confes
state.post = post state.post = post.confes
await dispatch('save2db', { path: `base`, value: { role, station, post, subsys } }) await dispatch('save2db', { path: `base`, value: state })
resolve({ role, station, post, subsys }) resolve(state)
}) })
}) })
}, },
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<el-col :span="12" style="position: relative; display: flex; justify-content: flex-end; "> <el-col :span="12" style="position: relative; display: flex; justify-content: flex-end; ">
<span style="margin-right: 10px;"> <span style="margin-right: 10px;">
<auth-button <auth-button
category="Button" category="Button"
label="导出" label="导出"
></auth-button> ></auth-button>
</span> </span>
......
...@@ -300,13 +300,13 @@ export default { ...@@ -300,13 +300,13 @@ export default {
}, },
methods: { methods: {
...mapActions('d2admin/base', ["load"]), ...mapActions('d2admin/base', ['load']),
async loadBaseData () { async loadBaseData () {
const modelToOptions = { 'stationName': 'station', 'subsystemTypeCode': 'subsys' } const modelToOptions = { 'stationName': 'station', 'subsystemTypeCode': 'subsys' }
const data = await this.load() const data = await this.load()
if(data) { if (data) {
for(var item in modelToOptions) { for (var item in modelToOptions) {
let pos = this.searchFormArr.findIndex(arrItem => arrItem.model == item) let pos = this.searchFormArr.findIndex(arrItem => arrItem.model == item)
this.searchFormArr[pos].options = data[modelToOptions[item]].confes this.searchFormArr[pos].options = data[modelToOptions[item]].confes
} }
......
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,7 @@ export default {
// 所属站点 // 所属站点
stations: [], stations: [],
// 职务 // 职务
posts: [], posts: []
} }
} }
}, },
...@@ -182,8 +182,13 @@ export default { ...@@ -182,8 +182,13 @@ export default {
if (vaild) { if (vaild) {
var __p = this.regForm var __p = this.regForm
Reg(__p).then(res => { Reg(__p).then(res => {
notice.okTips('注册信息已提交,请等待管理员审核') const { operateStatus } = res
this.handleClose() if (operateStatus) {
notice.okTips('注册信息已提交,请等待管理员审核')
this.handleClose()
} else {
notice.errorTips(`注册失败!`)
}
}) })
} }
}) })
......
...@@ -95,11 +95,11 @@ ...@@ -95,11 +95,11 @@
<script> <script>
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { mapActions,mapState } from 'vuex' import { mapActions, mapState } from 'vuex'
import { LOGIN_TYPE } from '@/common/constants' import { LOGIN_TYPE } from '@/common/constants'
export default { export default {
components: { components: {
'DialogReg': () => import('./dialogReg'), 'DialogReg': () => import('./dialogReg')
}, },
data () { data () {
return { return {
...@@ -150,10 +150,10 @@ export default { ...@@ -150,10 +150,10 @@ export default {
// console.log(navigator.userAgent.toLocaleLowerCase()) // console.log(navigator.userAgent.toLocaleLowerCase())
this.$refs.loginForm.validate((valid) => { this.$refs.loginForm.validate((valid) => {
if (valid) { if (valid) {
const { browser , os } = this.$store.state.d2admin.ua.data const { browser, os } = this.$store.state.d2admin.ua.data
console.log(this.formLogin); console.log(this.formLogin)
const _p = {...this.formLogin,deviceCode:`${os.name}${os.version}-${browser.name}${browser.version}`} const _p = { ...this.formLogin, deviceCode: `${os.name}${os.version}-${browser.name}${browser.version}` }
console.log(_p); console.log(_p)
// 登录 // 登录
// 注意 这里的演示没有传验证码 // 注意 这里的演示没有传验证码
// 具体需要传递的数据请自行修改代码 // 具体需要传递的数据请自行修改代码
......
...@@ -121,10 +121,10 @@ import { getListApi, reportApi, exportApi } from '@api/systemMonitor' ...@@ -121,10 +121,10 @@ 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 { BaseData } from '@/common/constants' // import { BaseData } from '@/common/constants'
require('echarts/lib/chart/pie') // require('echarts/lib/chart/pie')
require('echarts/lib/component/tooltip') // require('echarts/lib/component/tooltip')
let echarts = require('echarts/lib/echarts') // let echarts = require('echarts/lib/echarts')
export default { export default {
name: 'systemMonitor', name: 'systemMonitor',
...@@ -261,16 +261,16 @@ export default { ...@@ -261,16 +261,16 @@ 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 = station.confes this.baseData.station = station.confes
this.baseData.subsys = JSON.parse(JSON.stringify(subsys.confes)) this.baseData.subsys = JSON.parse(JSON.stringify(subsys.confes))
this.baseData.subsys.unshift({ confCode: '', confValue: '全部'}) this.baseData.subsys.unshift({ confCode: '', confValue: '全部'})
// console.log(this.baseData) // console.log(this.baseData)
}, },
loadingGetList () { loadingGetList () {
this.tableLoading = true this.tableLoading = true
......
...@@ -188,7 +188,7 @@ export default { ...@@ -188,7 +188,7 @@ export default {
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.confes this.baseData.station = data.confes
}, },
loadingGetList () { loadingGetList () {
this.tableLoading = true this.tableLoading = true
this.getList() this.getList()
......
<template> <template>
<el-dialog <el-dialog
:title="roleForm.roleId?'编辑角色':'创建角色'" :title="title"
:before-close="handleClose" :before-close="handleClose"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="720px" width="720px"
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-divider content-position="left">权限设置</el-divider> <el-divider content-position="left">权限设置</el-divider>
<RoleTree :resources="resources" :checkedNodes.sync="checkedNodes" :defaultCheck="defaultCheck" :close="dialogVisible"></RoleTree> <RoleTree :resources="resources" :authIds.sync="authIds" :close="dialogVisible"></RoleTree>
<input type="hidden" v-model="authIds.length" prop="authIds"/>
<div slot="footer"> <div slot="footer">
<el-button @click="submit" type="primary" class="button-submit">保存</el-button> <el-button @click="submit" type="primary" class="button-submit">保存</el-button>
<el-button @click="handleClose" type="plain" class="button-submit">取消</el-button> <el-button @click="handleClose" type="plain" class="button-submit">取消</el-button>
...@@ -36,7 +37,7 @@ ...@@ -36,7 +37,7 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { Reg } from '@/api/sys.account' import { RoleReg } from '@/api/sys.account'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import notice from '@/common/notice' import notice from '@/common/notice'
import RoleTree from './roleTree' import RoleTree from './roleTree'
...@@ -60,8 +61,10 @@ export default { ...@@ -60,8 +61,10 @@ export default {
watch: { watch: {
editData: { editData: {
handler: function (value) { handler: function (value) {
this.title = value && value.roleId ? '编辑角色' : '创建角色'
Object.assign(this.roleForm, value) Object.assign(this.roleForm, value)
this.defaultCheck = this.roleForm.roles this.authIds = this.roleForm.authes || []
delete this.roleForm.authes
}, },
immediate: true immediate: true
} }
...@@ -75,15 +78,15 @@ export default { ...@@ -75,15 +78,15 @@ export default {
}, },
resources () { resources () {
const clone = util.deepClone(Object.values(localRoutes)) const clone = util.deepClone(Object.values(localRoutes))
const { menus }= util.permision.packMenusBtns(clone) const { menus } = util.permision.packMenusBtns(clone)
const all = util.permision.flatten(clone) const all = util.permision.flatten(clone)
return { menus,all } return { menus, all }
} }
}, },
data () { data () {
return { return {
defaultCheck: '', authIds: [],
checkedNodes: [], title: '',
roleForm: { roleForm: {
roleName: '', roleName: '',
description: '' description: ''
...@@ -91,27 +94,33 @@ export default { ...@@ -91,27 +94,33 @@ export default {
rules: Object.freeze({ rules: Object.freeze({
roleName: [ roleName: [
{ required: true, message: '角色名不能为空', trigger: ['blur'] } { required: true, message: '角色名不能为空', trigger: ['blur'] }
],
authIds: [
{ required: true, message: '请分配权限', trigger: ['blur'] }
] ]
}) })
} }
}, },
methods: { methods: {
handleClose (done) { handleClose (done) {
this.$event.$emit('e-reg-dialog', false) this.$event.$emit('e-role-dialog', false)
}, },
// 提交注册数据
submit () { submit () {
console.log(this.checkedNodes) this.$refs.roleForm.validate(vaild => {
// this.$refs.regForm.validate(vaild => { if (vaild) {
// if (vaild) { var __p = { ...this.roleForm, authIds: this.authIds }
// var __p = this.regForm RoleReg(__p).then(res => {
// Reg(__p).then(res => { const { operateStatus } = res
// notice.okTips('注册信息已提交,请等待管理员审核') if (operateStatus) {
// this.$refs.regForm.resetFields() notice.okTips(`${this.title}成功!`)
// this.$event.$emit('e-reg-dialog', false) this.$refs.regForm.resetFields()
// }) this.$event.$emit('e-role-dialog', false)
// } } else {
// }) notice.errorTips(`${this.title}失败!`)
}
})
}
})
} }
}, },
mounted () { mounted () {
......
...@@ -23,16 +23,16 @@ ...@@ -23,16 +23,16 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <!-- <el-pagination
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="page.pageCount" :current-page="page.pageCount"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="page.pageSize" :page-size="page.pageSize"
:total="page.total" :total="page.totalCount"
layout="sizes,total,->,prev,pager,next,jumper" layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination> ></el-pagination> -->
<edit-dialog <edit-dialog
:isVisible="editVisible" :isVisible="editVisible"
:editData="editData" :editData="editData"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
</template> </template>
<script> <script>
import { RoleList } from '@/api/sys.account' import { RoleList, RoleDetail } from '@/api/sys.account'
import notice from '@/common/notice' import notice from '@/common/notice'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
...@@ -53,9 +53,6 @@ export default { ...@@ -53,9 +53,6 @@ export default {
return { return {
// 新增/编辑弹窗 // 新增/编辑弹窗
editVisible: false, editVisible: false,
editData: {
roles: []
},
// 表格 // 表格
tableLoading: false, tableLoading: false,
tableData: [], tableData: [],
...@@ -72,18 +69,18 @@ export default { ...@@ -72,18 +69,18 @@ export default {
label: '创建时间', label: '创建时间',
prop: 'createTime' prop: 'createTime'
} }
]), ])
page: { // page: {
// 页码 // // 页码
pageCount: 1, // 每页条数 // pageCount: 1, // 每页条数
pageSize: 10, // 页码 // pageSize: 10, // 页码
total: 100 // total: 100
} // }
} }
}, },
mounted () { mounted () {
this.fetchData() this.fetchData()
this.$event.$on('e-reg-dialog', res => this.editVisible = res) this.$event.$on('e-role-dialog', res => this.editVisible = res)
}, },
methods: { methods: {
...@@ -95,7 +92,9 @@ export default { ...@@ -95,7 +92,9 @@ export default {
RoleList() RoleList()
.then(res => { .then(res => {
this.tableData = res this.tableData = res
// Object.freeze(this.tableData) const { pagination, roles } = res
this.tableData = roles
// this.page = pagination
this.tableLoading = false this.tableLoading = false
}) })
.catch(err => { .catch(err => {
...@@ -115,10 +114,9 @@ export default { ...@@ -115,10 +114,9 @@ export default {
// 调接口 // 调接口
this.loadRoleList() this.loadRoleList()
}, },
handleEdit (row ) { async handleEdit (row) {
row && (row.roles = [{ authId: '101', parentId: '0' }, { authId: '10601', parentId: '106' }, { authId: '1060101', parentId: '10601' }]) this.editData = row && await RoleDetail({ roleId: row.roleId })
this.editVisible = true this.editVisible = true
this.editData = util.deepClone(row)
} }
} }
} }
......
...@@ -39,14 +39,14 @@ export default { ...@@ -39,14 +39,14 @@ export default {
type: Object, type: Object,
default: {} default: {}
}, },
defaultCheck: [], authIds: [],
close: false close: false
}, },
watch: { watch: {
close (value) { close (value) {
// !value && this.reset(); // !value && this.reset();
}, },
defaultCheck: { authIds: {
handler (value) { handler (value) {
if (!value) return if (!value) return
let chk = [] let chk = []
...@@ -75,29 +75,29 @@ export default { ...@@ -75,29 +75,29 @@ export default {
this.setCheckedNodes() this.setCheckedNodes()
}, },
btnChange (node, data, sta) { btnChange (node, data, sta) {
let checked = sta //|| this.checked.some(child => child.parentId === node.key && child.authId !== data.authId); let checked = sta // || this.checked.some(child => child.parentId === node.key && child.authId !== data.authId);
checked && this.$refs.tree.setChecked(node.key, checked, true); checked && this.$refs.tree.setChecked(node.key, checked, true)
this.setCheckedNodes() this.setCheckedNodes()
}, },
setCheckedNodes () { setCheckedNodes () {
const { getCheckedKeys, getHalfCheckedKeys } = this.$refs.tree const { getCheckedKeys, getHalfCheckedKeys } = this.$refs.tree
let checkedNodes = [ let checkedIds = [
...getCheckedKeys(), ...getCheckedKeys(),
...getHalfCheckedKeys(), ...getHalfCheckedKeys(),
...this.checked ...this.checked
] ]
checkedNodes = checkedNodes.map(node => { checkedIds = checkedIds.map(node => {
const { authId, parentId } = this.resources.all.find( const { authId, parentId } = this.resources.all.find(
res => res.authId === node res => res.authId === node
) )
return { authId, parentId } return { authId, parentId }
}) })
this.$emit('update:checkedNodes', checkedNodes) this.$emit('update:authIds', checkedIds)
}, },
reset () { reset () {
this.checked = [] this.checked = []
this.$refs.tree.setCheckedKeys([]) this.$refs.tree.setCheckedKeys([])
this.$emit('update:checkedNodes', []) this.$emit('update:authIds', [])
} }
} }
} }
......
...@@ -108,8 +108,8 @@ export default { ...@@ -108,8 +108,8 @@ export default {
watch: { watch: {
editData: { editData: {
handler: function (value) { handler: function (value) {
this.title = value && value.id ? '编辑用户信息' : '创建用户'
Object.assign(this.regForm, value) Object.assign(this.regForm, value)
console.log(this.regForm)
}, },
immediate: true immediate: true
} }
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
stationCode: '', stationCode: '',
roleId: '' roleId: ''
}, },
resetForm: {}, title: '',
rules: Object.freeze({ rules: Object.freeze({
loginName: [ loginName: [
{ required: true, message: '用户名不能为空', trigger: ['blur'] } { required: true, message: '用户名不能为空', trigger: ['blur'] }
...@@ -181,9 +181,16 @@ export default { ...@@ -181,9 +181,16 @@ export default {
this.$refs.regForm.validate(vaild => { this.$refs.regForm.validate(vaild => {
if (vaild) { if (vaild) {
var __p = this.regForm var __p = this.regForm
__p.createType = RegistType.BY_ADMIN
Reg(__p).then(res => { Reg(__p).then(res => {
notice.okTips('创建成功') const { operateStatus } = res
this.$event.$emit('e-reg-dialog', false) if (operateStatus) {
notice.okTips(`${this.title}成功!`)
this.$refs.regForm.resetFields()
this.$event.$emit('e-reg-dialog', false)
} else {
notice.errorTips(`${this.title}失败!`)
}
}) })
} }
}) })
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</el-form-item> </el-form-item>
<el-form-item label="注册时间:"> <el-form-item label="注册时间:">
<el-date-picker <el-date-picker
v-model="searchForm.times" v-model="searchTimes"
type="daterange" type="daterange"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
...@@ -69,17 +69,17 @@ ...@@ -69,17 +69,17 @@
<el-table-column label="用户名" prop="loginName" width="200" align="center" ></el-table-column> <el-table-column label="用户名" prop="loginName" width="200" align="center" ></el-table-column>
<el-table-column label="角色" prop="roleName" width="140" align="center" ></el-table-column> <el-table-column label="角色" prop="roleName" width="140" align="center" ></el-table-column>
<el-table-column label="注册时间" prop="registerTime" width="200" align="center" ></el-table-column> <el-table-column label="注册时间" prop="registerTime" width="200" align="center" ></el-table-column>
<el-table-column label="有效期" prop="validTime" width="200" align="center" ></el-table-column> <el-table-column label="有效期" prop="validTime" width="200" align="center" ></el-table-column>
<el-table-column label="状态" prop="status" width="100" align="center"> <el-table-column label="状态" prop="status" width="100" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :effect="tag.effect" style="width:70px" :type="tag.type[scope.row.status]">{{tag.label[scope.row.status]}}</el-tag> <el-tag :effect="tag.effect" style="width:70px" :type="tag.type[scope.row.status]">{{tag.label[scope.row.status]}}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="姓名" prop="userName" width="120" align="center" ></el-table-column> <el-table-column label="姓名" prop="userName" width="120" align="center" ></el-table-column>
<el-table-column label="联系电话" prop="mobile" width="200" align="center" ></el-table-column> <el-table-column label="联系电话" prop="mobile" width="200" align="center" ></el-table-column>
<el-table-column label="所属公司" prop="companyName" width="200" align="center" ></el-table-column> <el-table-column label="所属公司" prop="companyName" width="200" align="center" ></el-table-column>
<el-table-column label="部门" prop="departName" width="200" align="center" ></el-table-column> <el-table-column label="部门" prop="departName" width="200" align="center" ></el-table-column>
<el-table-column label="职务" prop="postName" width="200" align="center" ></el-table-column> <el-table-column label="职务" prop="postName" width="200" align="center" ></el-table-column>
<el-table-column label="所属站点" prop="stationName" width="200" align="center" ></el-table-column> <el-table-column label="所属站点" prop="stationName" width="200" align="center" ></el-table-column>
<el-table-column align="center" fixed="right" width="200" label="操作"> <el-table-column align="center" fixed="right" width="200" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -91,10 +91,10 @@ ...@@ -91,10 +91,10 @@
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
:current-page="currentPage" :current-page="page.pageCount"
:page-sizes="[10,20,30,40]" :page-sizes="[10,20,30,40]"
:page-size="pageSize" :page-size="page.pageSize"
:total="total" :total="page.totalCount"
layout="sizes,total,->,prev,pager,next,jumper" layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination> ></el-pagination>
<dialog-reg :isVisible="registerDialogVisible" :editData="editData" /> <dialog-reg :isVisible="registerDialogVisible" :editData="editData" />
...@@ -121,10 +121,10 @@ export default { ...@@ -121,10 +121,10 @@ export default {
}, },
data () { data () {
return { return {
tag:Object.freeze({ tag: Object.freeze({
effect:'dark', effect: 'dark',
type:['', 'success', 'info','danger','warning'], type: ['', 'success', 'info', 'danger', 'warning'],
label:['未知', '正常', '已过期','禁用','待审核'] label: ['未知', '正常', '已过期', '禁用', '待审核']
}), }),
mapping: Object.freeze({ mapping: Object.freeze({
field: 'status', field: 'status',
...@@ -148,19 +148,20 @@ export default { ...@@ -148,19 +148,20 @@ export default {
searchForm: { searchForm: {
userName: '', userName: '',
companyName: '', companyName: '',
times: '',
postCode: '', postCode: '',
status: '', status: '',
stationCode: '', stationCode: '',
postCode: '' postCode: ''
}, },
searchTimes: [],
// 表格 // 表格
tableLoading: false, tableLoading: false,
tableData: [], tableData: [],
page: { page: {
// 页码 // 页码
pageCount: 1, pageCount: 1,
pageSize: 10 pageSize: 10,
totalCount: 0 // 总条数
}, },
/* -----------------------基础数据---------------------- */ /* -----------------------基础数据---------------------- */
baseData: { baseData: {
...@@ -197,9 +198,8 @@ export default { ...@@ -197,9 +198,8 @@ export default {
getParams () { getParams () {
let startTime = '' let startTime = ''
let endTime = '' let endTime = ''
if (this.searchForm.times) { if (this.searchTimes.length) {
[startTime, endTime] = this.searchForm.times [startTime, endTime] = this.searchTimes
delete this.searchForm.times
} }
return { return {
...this.page, ...this.page,
...@@ -213,7 +213,9 @@ export default { ...@@ -213,7 +213,9 @@ export default {
const params = this.getParams() const params = this.getParams()
UserList(params) UserList(params)
.then(res => { .then(res => {
this.tableData = res const { pagination, userList } = res
this.tableData = userList
this.page = pagination
this.tableLoading = false this.tableLoading = false
}) })
.catch(err => { .catch(err => {
...@@ -221,9 +223,9 @@ export default { ...@@ -221,9 +223,9 @@ export default {
this.tableLoading = false this.tableLoading = false
}) })
}, },
filterTag(value, row) { filterTag (value, row) {
return row.status === value; return row.status === value
}, },
handleRegister () { handleRegister () {
this.registerDialogVisible = true this.registerDialogVisible = true
}, },
...@@ -232,7 +234,7 @@ export default { ...@@ -232,7 +234,7 @@ export default {
}, },
// 页码 // 页码
handleSizeChange (value) { handleSizeChange (value) {
this.page.pageSize = value this.page.pageCount = value
this.loadUserList() this.loadUserList()
}, },
handleCurrentChange (value) { handleCurrentChange (value) {
......
...@@ -24,7 +24,8 @@ const cdn = { ...@@ -24,7 +24,8 @@ const cdn = {
`${CDN_DOMAIN}/vuex/3.1.1/vuex.min.js`, `${CDN_DOMAIN}/vuex/3.1.1/vuex.min.js`,
`${CDN_DOMAIN}/axios/0.19.0/axios.min.js`, `${CDN_DOMAIN}/axios/0.19.0/axios.min.js`,
`${CDN_DOMAIN}/js-cookie/2.2.0/js.cookie.min.js`, `${CDN_DOMAIN}/js-cookie/2.2.0/js.cookie.min.js`,
`${CDN_DOMAIN}/nprogress/0.2.0/nprogress.min.js` `${CDN_DOMAIN}/nprogress/0.2.0/nprogress.min.js`,
`${CDN_DOMAIN}/echarts/4.3.0-rc.1/echarts.min.js`,
// `${CDN_DOMAIN}/lodash.js/4.17.15/lodash.min.js` // `${CDN_DOMAIN}/lodash.js/4.17.15/lodash.min.js`
] ]
} }
...@@ -50,7 +51,8 @@ module.exports = { ...@@ -50,7 +51,8 @@ module.exports = {
'vuex': 'Vuex', 'vuex': 'Vuex',
'axios': 'axios', 'axios': 'axios',
'js-cookie': 'Cookies', 'js-cookie': 'Cookies',
'nprogress': 'NProgress' 'nprogress': 'NProgress',
'echarts':'echarts'
// 'lodash':'lodash' // 'lodash':'lodash'
} }
// 非开发环境 // 非开发环境
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!