Commit 48c5be22 by cwq0219

业务剥离;mock获取数据

1 parent 7a3690aa
...@@ -3,10 +3,8 @@ ...@@ -3,10 +3,8 @@
# 页面 title 前缀 # 页面 title 前缀
VUE_APP_TITLE=tFIMS VUE_APP_TITLE=tFIMS
# 网络请求公用地址 http://tfims.glsx.com.cn/router
VUE_APP_API=http://tfims.test.glsx.com.cn/router
# 仓库地址 # 仓库地址
VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5d638b3b6fbe9a0ac59d872e/tFIMS VUE_APP_REPO=https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config
# 国际化配置 # 国际化配置
VUE_APP_I18N_LOCALE=zh-chs VUE_APP_I18N_LOCALE=zh-chs
...@@ -14,6 +12,4 @@ VUE_APP_I18N_FALLBACK_LOCALE=en ...@@ -14,6 +12,4 @@ VUE_APP_I18N_FALLBACK_LOCALE=en
VUE_APP_ELEMENT_COLOR=#409EFF VUE_APP_ELEMENT_COLOR=#409EFF
VUE_APP_MAIN_COLOR=#3D6FE4
VUE_APP_STORAGE_PREFIX=tfims VUE_APP_STORAGE_PREFIX=tfims
\ No newline at end of file \ No newline at end of file
# 开发环境 # 开发环境
# 页面 title 前缀
VUE_APP_TITLE=TFims Dev
# 网络请求开发地址 # 网络请求开发地址
VUE_APP_API=https://oss-config.test.glsx.com.cn/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
\ No newline at end of file \ No newline at end of file
# VUE_APP_API=https://oss-config.test.glsx.com.cn/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
\ No newline at end of file \ No newline at end of file
...@@ -18,29 +18,63 @@ module.exports = { ...@@ -18,29 +18,63 @@ module.exports = {
plugins: ['vue'], plugins: ['vue'],
globals: { globals: {
NODE_ENV: false, NODE_ENV: false,
_:false, _: false,
echarts:false echarts: false
}, },
rules: { rules: {
// allow async-await 'arrow-spacing': [2, {
'generator-star-spacing': 'off', 'before': true,
// allow debugger during development 'after': true
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', }],
// 添加,分号必须 'block-spacing': [2, 'always'],
// semi: ['error', 'always'], 'brace-style': [2, '1tbs', {
'semi': [2, 'never'], 'allowSingleLine': true
'semi-spacing': [2, { }],
'comma-dangle': [2, 'never'],
'comma-spacing': [2, {
'before': false, 'before': false,
'after': true 'after': true
}], }],
'no-unexpected-multiline': 'off', 'comma-style': [2, 'last'],
'space-before-function-paren': ['error', 'never'], 'curly': [2, 'multi-line'],
quotes: [ 'dot-location': [2, 'property'],
'error', 'indent': [2, 2, {
'single', 'SwitchCase': 1
{ }],
avoidEscape: true 'key-spacing': [2, {
} 'beforeColon': false,
] 'afterColon': true
}],
'keyword-spacing': [2, {
'before': true,
'after': true
}],
'new-cap': [2, {
'newIsCap': true,
'capIsNew': false
}],
'no-extra-parens': [2, 'functions'],
'no-floating-decimal': 2,
'no-multi-spaces': 2,
'no-multiple-empty-lines': [2, {
'max': 1
}],
'no-trailing-spaces': 2,
'quotes': [2, 'single', {
'avoidEscape': true,
'allowTemplateLiterals': true
}],
'semi': [2, 'never'],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [2, {
'words': true,
'nonwords': false
}],
'spaced-comment': [2, 'always'],
'prefer-const': 2
} }
};
\ No newline at end of file \ No newline at end of file
};
{ {
"name": "test1", "name": "test",
"version": "0.1.0", "version": "0.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
......
{ {
"name": "test1", "name": "test",
"version": "0.1.0", "version": "0.1.0",
"scripts": { "scripts": {
"serve": "vue-cli-service serve --open", "serve": "vue-cli-service serve --open",
......
...@@ -9,7 +9,7 @@ import axios from '@/plugin/axios' ...@@ -9,7 +9,7 @@ import axios from '@/plugin/axios'
import sign from './sign' import sign from './sign'
import RequestMethods from './request.methods' import RequestMethods from './request.methods'
const request = (params = {}, method = RequestMethods.GET, noSignAttr = []) => { const request = (params = {}, method = RequestMethods.GET, noSignAttr = []) => {
params.source = 'test1' params.source = 'test'
params.app_key = '48e5e13229b82c1b4e6e8c96151f0637' params.app_key = '48e5e13229b82c1b4e6e8c96151f0637'
params.timestamp = new Date().getTime() params.timestamp = new Date().getTime()
params.v = '1.0.0' params.v = '1.0.0'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:55 * @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-01-07 16:26:04 * @Last Modified time: 2020-09-02 11:18:58
*/ */
import request from './request' import request from './request'
...@@ -22,7 +22,23 @@ export const ROLE_LIST_URL = `${ROLE_PATH}list` ...@@ -22,7 +22,23 @@ export const ROLE_LIST_URL = `${ROLE_PATH}list`
*/ */
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)
return new Promise(resolve => {
resolve({
stationCode: 'STA_HEB',
roleId: 7,
roleType: 2,
// companyName: '广联',
mobile: '15234057707',
userName: 'wxw',
loginName: 'foutouren',
// postName: '部门经理',
// postCode: '2003',
// stationName: '哈尔滨',
// validTime: '2020-09-04 10:39:28',
authes: []
})
})
} }
/** /**
......
/* /*
* @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: chenwq
* @Last Modified time: 2019-09-18 20:07:42 * @Last Modified time: 2020-09-22 11:25:48
*/ */
// import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account' // import { LOGIN_URL, REG_URL, ROLE_LIST_URL } from '@/api/sys.account'
...@@ -22,10 +22,10 @@ export const ConfigType = { ...@@ -22,10 +22,10 @@ export const ConfigType = {
* 前端基础数据管理对应的接口名称的key * 前端基础数据管理对应的接口名称的key
*/ */
export const BaseData = { export const BaseData = {
ROLE: { KEY: 'role', TYPE: '' }, ROLE: { KEY: 'role', TYPE: '' }
STATION: { KEY: 'station', TYPE: ConfigType.STATION }, // STATION: { KEY: 'station', TYPE: ConfigType.STATION },
POST: { KEY: 'post', TYPE: ConfigType.POST }, // POST: { KEY: 'post', TYPE: ConfigType.POST },
SUBSYS: { KEY: 'subsys', TYPE: ConfigType.SUBSYS } // SUBSYS: { KEY: 'subsys', TYPE: ConfigType.SUBSYS }
} }
/** /**
* 注册类型 * 注册类型
...@@ -37,16 +37,16 @@ export const RegistType = { ...@@ -37,16 +37,16 @@ export const RegistType = {
/** /**
* 前端免登录验证接口名 * 前端免登录验证接口名
*/ */
export const LogExternals = [ // export const LogExternals = [
'fims.user.login', // 登录 // 'fims.user.login', // 登录
'fims.user.register', // 注册 // 'fims.user.register', // 注册
'fims.configuration.from.conftype', // 基础数据 // 'fims.configuration.from.conftype', // 基础数据
'fims.role.list' // 角色列表 // 'fims.role.list' // 角色列表
] // ]
/** /**
* 登录来源 * 登录来源
*/ */
export const LOGIN_TYPE = 1 // 1pc,2小程序 // export const LOGIN_TYPE = 1 // 1pc,2小程序
/** /**
* 超级管理员类型 * 超级管理员类型
*/ */
...@@ -55,4 +55,4 @@ export const SUPPER_ADMIN = 1 // ...@@ -55,4 +55,4 @@ export const SUPPER_ADMIN = 1 //
/** /**
* 职务置灰选项 * 职务置灰选项
*/ */
export const POST_DISABLED = ['2001', '2002', '2003'] // 总经理 仓库 部门经理 // export const POST_DISABLED = ['2001', '2002', '2003'] // 总经理 仓库 部门经理
...@@ -263,7 +263,7 @@ export default { ...@@ -263,7 +263,7 @@ export default {
refreshTable(clearMuti = true) { refreshTable(clearMuti = true) {
this.beforeSearchFn().then(res => { this.beforeSearchFn().then(res => {
console.log(res) // console.log(res)
// 清空多选 // 清空多选
clearMuti && this.clearMutiSelect() clearMuti && this.clearMutiSelect()
this.loading = true this.loading = true
......
// Vue // Vue
import Vue from 'vue' import Vue from 'vue'
import axios from 'axios'
// import i18n from './i18n' // import i18n from './i18n'
import App from './App' import App from './App'
// 核心插件 // 核心插件
...@@ -23,30 +24,48 @@ import router from './router' ...@@ -23,30 +24,48 @@ import router from './router'
// 核心插件 // 核心插件
Vue.use(d2Admin) Vue.use(d2Admin)
// Vue.use(D2Crud) // Vue.use(D2Crud)
new Vue({ var baseConfig = ''
router, axios({
store, baseURL: process.env.VUE_APP_REPO + '/temp-admin-config',
// i18n, method: 'get'
render: h => h(App), }).then(({
// created () { data
// 处理路由 得到每一级的路由设置 }) => {
// this.$store.commit('d2admin/page/init', frameInRoutes) baseConfig = data
// 设置顶栏菜单 (暂时不需要) new Vue({
// this.$store.commit('d2admin/menu/headerSet', menuHeader) router,
// 设置侧边栏菜单 (TODO 进行过滤) store,
// this.$store.commit('d2admin/menu/asideSet', menuAside) // i18n,
// 初始化菜单搜索功能 render: h => {
// this.$store.commit('d2admin/search/init', menuHeader) Vue.prototype.baseConfig = data
// }, return h(App)
mounted() { },
Vue.config.devtools = true // created () {
// 展示系统信息 // 处理路由 得到每一级的路由设置
this.$store.commit('d2admin/releases/versionShow') // this.$store.commit('d2admin/page/init', frameInRoutes)
// 用户登录后从数据库加载一系列的设置 // 设置顶栏菜单 (暂时不需要)
this.$store.dispatch('d2admin/account/load') // this.$store.commit('d2admin/menu/headerSet', menuHeader)
// 获取并记录用户 UA // 设置侧边栏菜单 (TODO 进行过滤)
this.$store.commit('d2admin/ua/get') // this.$store.commit('d2admin/menu/asideSet', menuAside)
// 初始化全屏监听 // 初始化菜单搜索功能
this.$store.dispatch('d2admin/fullscreen/listen') // this.$store.commit('d2admin/search/init', menuHeader)
} // },
}).$mount('#app') created() {
// 系统配置
Vue.config.devtools = true
// 展示系统信息
this.$store.commit('d2admin/releases/versionShow')
// 用户登录后从数据库加载一系列的设置
this.$store.dispatch('d2admin/account/load')
// 获取并记录用户 UA
this.$store.commit('d2admin/ua/get')
// 初始化全屏监听
this.$store.dispatch('d2admin/fullscreen/listen')
},
mounted() {}
}).$mount('#app')
})
export {
baseConfig
}
...@@ -4,13 +4,16 @@ import { ...@@ -4,13 +4,16 @@ import {
Message Message
} from 'element-ui' } from 'element-ui'
import util from '@/libs/util' import util from '@/libs/util'
import router from '@/router' // import router from '@/router'
// import {
// LogExternals
// } from '@/common/constants'
import { import {
LogExternals baseConfig
} from '@/common/constants' } from '@/main'
import Qs from 'qs' import Qs from 'qs'
axios.defaults.withCredentials = true axios.defaults.withCredentials = true
const expiresMinute = 60 // 过期时间(分钟) // const expiresMinute = 60 // 过期时间(分钟)
// var refreshTable = false // 标记是否刷新表格 // var refreshTable = false // 标记是否刷新表格
// 创建一个错误 // 创建一个错误
export function errorCreate(msg) { export function errorCreate(msg) {
...@@ -44,8 +47,8 @@ function errorLog(error) { ...@@ -44,8 +47,8 @@ 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: process.env.VUE_APP_API, // baseURL: baseURL,
timeout: 5000, // 请求超时时间 // timeout: 5000, // 请求超时时间
transformRequest: [function(data) { transformRequest: [function(data) {
return Qs.stringify(data) return Qs.stringify(data)
}] }]
...@@ -55,21 +58,26 @@ const service = axios.create({ ...@@ -55,21 +58,26 @@ const service = axios.create({
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
return new Promise(async resolve => { return new Promise(async resolve => {
const { url, params } = config // const {
// url,
// params
// } = config
// params.refreshTable && (refreshTable = true) // params.refreshTable && (refreshTable = true)
await store.commit('d2admin/loading/set', true) await store.commit('d2admin/loading/set', true)
const uuid = util.cookies.get('uuid') // const uuid = util.cookies.get('uuid')
// 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作) // 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作)
if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) { // if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) {
await store.dispatch('d2admin/account/logout') // await store.dispatch('d2admin/account/logout')
router.replace('/login') // router.replace('/login')
} // }
if (uuid) { // 判断 cookie 是否存在 存在则更新时间 避免登出时 记录空值 // if (uuid) { // 判断 cookie 是否存在 存在则更新时间 避免登出时 记录空值
const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000) // const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000)
util.cookies.set('uuid', uuid, { // util.cookies.set('uuid', uuid, {
expires: inExpiresMinutes // expires: inExpiresMinutes
}) // })
} // }
config.url = baseConfig.axios.baseURL + config.url
config.timeout = baseConfig.axios.timeout
resolve(config) resolve(config)
}) })
}, },
...@@ -86,20 +94,24 @@ service.interceptors.response.use( ...@@ -86,20 +94,24 @@ service.interceptors.response.use(
store.commit('d2admin/loading/set', false) store.commit('d2admin/loading/set', false)
// dataAxios 是 axios 返回数据中的 data // dataAxios 是 axios 返回数据中的 data
const dataAxios = response.data const dataAxios = response.data
const ruleResult = baseConfig.axios.result
// 这个状态码是和后端约定的 // 这个状态码是和后端约定的
const { code, data } = dataAxios // const {
// code,
// data
// } = dataAxios
// 有 code 代表这是一个后端接口 可以进行进一步的判断 // 有 code 代表这是一个后端接口 可以进行进一步的判断
switch (+code) { switch (+dataAxios[ruleResult.code_key]) {
case 0: case ruleResult.code_success_value:
// [ 示例 ] code === 0 代表没有错误 // [ 示例 ] code === 0 代表没有错误
// if (refreshTable) { // if (refreshTable) {
// store.commit('d2admin/refreshtable/set', !store.state.d2admin.refreshtable.value) // store.commit('d2admin/refreshtable/set', !store.state.d2admin.refreshtable.value)
// refreshTable = false // refreshTable = false
// } // }
return data return dataAxios[ruleResult.data_key]
default: default:
// 不是正确的 code // 不是正确的 code
errorCreate(`${dataAxios.message}`) errorCreate(`${dataAxios[ruleResult.message_key]}`)
break break
} }
// refreshTable = false // refreshTable = false
......
...@@ -2,6 +2,7 @@ import util from '@/libs/util.js' ...@@ -2,6 +2,7 @@ import util from '@/libs/util.js'
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'
import { baseConfig } from '@/main'
export default { export default {
namespaced: true, namespaced: true,
actions: { actions: {
...@@ -23,7 +24,7 @@ export default { ...@@ -23,7 +24,7 @@ export default {
// token 代表用户当前登录状态 建议在网络请求中携带 token // token 代表用户当前登录状态 建议在网络请求中携带 token
// 如有必要 token 需要定时更新,默认保存一天 // 如有必要 token 需要定时更新,默认保存一天
util.cookies.set('uuid', data.loginName) util.cookies.set('uuid', data.loginName)
// data.roleType = SUPPER_ADMIN data.roleType = baseConfig.hasAuth ? data.roleType : SUPPER_ADMIN
const authes = (+data.roleType === SUPPER_ADMIN) const authes = (+data.roleType === SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes)) ? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId })) .map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
......
...@@ -2,30 +2,18 @@ ...@@ -2,30 +2,18 @@
* @Author: limin * @Author: limin
* @Date: 2019-09-01 17:56:57 * @Date: 2019-09-01 17:56:57
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2019-09-29 14:50:07 * @Last Modified time: 2020-09-01 16:25:36
*/ */
import { FetchRoleList, BaseDataApi } from '@/api/sys.base' // import { FetchRoleList } from '@/api/sys.base'
import { BaseData, TYPE_NAME, ConfigType } from '@/common/constants' // const map = {
const map = { // [BaseData.ROLE.KEY]: FetchRoleList,
[BaseData.ROLE.KEY]: FetchRoleList, // }
// [BaseData.COMPANY]: CompanyList,
// [BaseData.DEPART.KEY]: DepartList,
[BaseData.STATION.KEY]: BaseDataApi,
[BaseData.POST.KEY]: BaseDataApi,
[BaseData.SUBSYS.KEY]: BaseDataApi
}
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
// 角色 // // 角色
role: [], // role: [],
// 站点
station: [],
// 职务
post: [],
// 子系统
subsys: []
}, },
actions: { actions: {
/** /**
...@@ -35,29 +23,20 @@ export default { ...@@ -35,29 +23,20 @@ export default {
*/ */
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 }), // ]).then(async([role, station, post, subsys]) => {
BaseDataApi({ [TYPE_NAME]: ConfigType.POST }), // state.role = role
BaseDataApi({ [TYPE_NAME]: ConfigType.SUBSYS }) // await dispatch('save2db', { name: '', value: state })
]).then(async([role, station, post, subsys]) => { resolve(state)
state.role = role // })
state.station = station
state.subsys = subsys
state.post = post
await dispatch('save2db', { name: '', value: state })
resolve(state)
})
}) })
}, },
// 重置 // 重置
clear({ state, dispatch }) { clear({ state, dispatch }) {
return new Promise(async resolve => { return new Promise(async resolve => {
state.role = [] // state.role = []
state.station = [] // await dispatch('save2db', { name: '', value: state })
state.subsys = []
state.post = []
await dispatch('save2db', { name: '', value: state })
resolve(state) resolve(state)
}) })
}, },
...@@ -94,11 +73,11 @@ export default { ...@@ -94,11 +73,11 @@ export default {
*/ */
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')
} // }
const { role, station, post, subsys } = state // const { role, station, post, subsys } = state
resolve({ role, station, post, subsys }) resolve({})
}) })
}, },
/** /**
...@@ -140,8 +119,8 @@ export default { ...@@ -140,8 +119,8 @@ export default {
*/ */
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()
}) })
}, },
async reset({ dispatch }) { async reset({ dispatch }) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<d2-container class="indexPage"> <d2-container class="indexPage">
<div class="echarts"> <div class="echarts">
<el-row> <el-row>
<el-col :span="24"> <!-- <el-col :span="24">
<span style="margin-right: 20px;color:#909399"><d2-el-icon name="s-data"/> 类型</span> <span style="margin-right: 20px;color:#909399"><d2-el-icon name="s-data"/> 类型</span>
<el-radio-group v-model="radio" @change="getPie"> <el-radio-group v-model="radio" @change="getPie">
<el-radio-button <el-radio-button
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
> >
</el-radio-button> </el-radio-button>
</el-radio-group> </el-radio-group>
</el-col> </el-col> -->
<el-col :span="24"> <el-col :span="24">
<div id="totalEcharts" style="width: 100%; height: 400px;"></div> <div id="totalEcharts" style="width: 100%; height: 400px;"></div>
</el-col> </el-col>
...@@ -67,17 +67,17 @@ export default { ...@@ -67,17 +67,17 @@ export default {
// selected: true // selected: true
}] }]
}] }]
},
baseData: {
station: [],
subsys: []
} }
// baseData: {
// station: [],
// subsys: []
// }
} }
}, },
mounted() { mounted() {
this.$echarts = echarts this.$echarts = echarts
this.loadBaseData() // this.loadBaseData()
this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts')) this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts'))
this.getPie() this.getPie()
}, },
...@@ -85,15 +85,15 @@ export default { ...@@ -85,15 +85,15 @@ export default {
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
async loadBaseData() { // async loadBaseData() {
/** // /**
* 全局方法-获取公共参数 // * 全局方法-获取公共参数
*/ // */
const { station, subsys } = await this.load() // const { station, subsys } = await this.load()
this.baseData.station = _.cloneDeep(station) // this.baseData.station = _.cloneDeep(station)
this.baseData.subsys = _.cloneDeep(subsys) // this.baseData.subsys = _.cloneDeep(subsys)
this.baseData.subsys.unshift({ confCode: '', confValue: '全部' }) // this.baseData.subsys.unshift({ confCode: '', confValue: '全部' })
}, // },
getPie(label = '') { getPie(label = '') {
const params = { const params = {
...@@ -119,7 +119,7 @@ export default { ...@@ -119,7 +119,7 @@ export default {
// normalNum 正常数量 // normalNum 正常数量
// breakdownNum 故障数量 // breakdownNum 故障数量
drawPie(params) { drawPie(params) {
let item = this.totalOptions.series[0] const 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
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<el-form-item label="确认密码:" prop="confirm"> <el-form-item label="确认密码:" prop="confirm">
<el-input type="password" v-model="regForm.confirm" placeholder="请再输入一次密码" clearable maxlength="12" :show-word-limit="true" :show-password="true"></el-input> <el-input type="password" v-model="regForm.confirm" placeholder="请再输入一次密码" clearable maxlength="12" :show-word-limit="true" :show-password="true"></el-input>
</el-form-item> </el-form-item>
<el-row> <!-- <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="姓名:" prop="userName"> <el-form-item label="姓名:" prop="userName">
<el-input v-model="regForm.userName" placeholder="请输入姓名" clearable maxlength="8" :show-word-limit="true"></el-input> <el-input v-model="regForm.userName" placeholder="请输入姓名" clearable maxlength="8" :show-word-limit="true"></el-input>
...@@ -35,14 +35,14 @@ ...@@ -35,14 +35,14 @@
<el-input v-model="regForm.mobile" placeholder="请输入联系方式" oninput ="value=value.replace(/[^\d]/g,'')" clearable maxlength="11" :show-word-limit="true"></el-input> <el-input v-model="regForm.mobile" placeholder="请输入联系方式" oninput ="value=value.replace(/[^\d]/g,'')" clearable maxlength="11" :show-word-limit="true"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row> -->
<el-form-item label="所属公司:" prop="companyName"> <!-- <el-form-item label="所属公司:" prop="companyName">
<el-input v-model="regForm.companyName" placeholder="请输入公司名称" maxlength="32" :show-word-limit="true" clearable ></el-input> <el-input v-model="regForm.companyName" placeholder="请输入公司名称" maxlength="32" :show-word-limit="true" clearable ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="部门:" prop="departName"> <el-form-item label="部门:" prop="departName">
<el-input v-model="regForm.departName" placeholder="请输入部门名称" maxlength="32" :show-word-limit="true" clearable></el-input> <el-input v-model="regForm.departName" placeholder="请输入部门名称" maxlength="32" :show-word-limit="true" clearable></el-input>
</el-form-item> </el-form-item> -->
<el-row> <!-- <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="职务:" prop="postCode"> <el-form-item label="职务:" prop="postCode">
<el-select v-model="regForm.postCode" placeholder="请选择"> <el-select v-model="regForm.postCode" placeholder="请选择">
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row> -->
<el-form-item flex="main:left cross:center"></el-form-item> <el-form-item flex="main:left cross:center"></el-form-item>
</el-form> </el-form>
<div slot="footer"> <div slot="footer">
...@@ -79,9 +79,9 @@ ...@@ -79,9 +79,9 @@
</template> </template>
<script> <script>
import { Reg } from '@/api/sys.account' import { Reg } from '@/api/sys.account'
import { mapActions } from 'vuex' // import { mapActions } from 'vuex'
import notice from '@/common/notice' import notice from '@/common/notice'
import { RegistType, POST_DISABLED } from '@/common/constants' // import { RegistType, POST_DISABLED } from '@/common/constants'
export default { export default {
name: 'DialogReg', name: 'DialogReg',
props: { props: {
...@@ -97,19 +97,19 @@ export default { ...@@ -97,19 +97,19 @@ export default {
}, },
data() { data() {
return { return {
POST_DISABLED, // POST_DISABLED,
company: [], company: [],
regForm: { regForm: {
createType: RegistType.BY_SELF, // 1 自注册 2 管理员创建 // createType: RegistType.BY_SELF, // 1 自注册 2 管理员创建
loginName: '', loginName: '',
password: '', password: '',
confirm: '', confirm: ''
userName: '', // userName: '',
mobile: '', // mobile: '',
companyName: '', // companyName: '',
departName: '', // departName: '',
postCode: '', // postCode: '',
stationCode: '' // stationCode: ''
}, },
rules: Object.freeze({ rules: Object.freeze({
loginName: [ loginName: [
...@@ -174,19 +174,19 @@ export default { ...@@ -174,19 +174,19 @@ export default {
stationCode: [ stationCode: [
{ required: true, message: '所属站点不能为空', trigger: ['blur'] } { required: true, message: '所属站点不能为空', trigger: ['blur'] }
] ]
}), })
/* -----------------------基础数据---------------------- */ /* -----------------------基础数据---------------------- */
baseData: { // baseData: {
// 所属站点 // // 所属站点
stations: [], // stations: [],
// 职务 // // 职务
posts: [] // posts: []
} // }
} }
}, },
methods: { methods: {
...mapActions('d2admin/base', ['init']), // ...mapActions('d2admin/base', ['init']),
handleClose() { handleClose() {
this.$refs.regForm.resetFields() this.$refs.regForm.resetFields()
this.$event.$emit('e-reg-dialog', false) this.$event.$emit('e-reg-dialog', false)
...@@ -207,18 +207,18 @@ export default { ...@@ -207,18 +207,18 @@ export default {
}) })
} }
}) })
},
// 加载业务所需所有数据
async fetchData() {
// // 强制初始化基础数据
const { station, post } = await this.init()
this.baseData.posts = post
this.baseData.stations = station
Object.freeze(this.baseData)
} }
// 加载业务所需所有数据
// async fetchData() {
// // // 强制初始化基础数据
// const { station, post } = await this.init()
// this.baseData.posts = post
// this.baseData.stations = station
// Object.freeze(this.baseData)
// }
}, },
mounted() { mounted() {
this.fetchData() // this.fetchData()
} }
} }
</script> </script>
......
...@@ -3,16 +3,28 @@ ...@@ -3,16 +3,28 @@
<dialog-reg :isVisible="registerDialogVisible" /> <dialog-reg :isVisible="registerDialogVisible" />
<div class="page-login--layer page-login--layer-area"> <div class="page-login--layer page-login--layer-area">
<ul class="circles"> <ul class="circles">
<li v-for="n in 10" :key="n"></li> <li
v-for="n in 10"
:key="n"
></li>
</ul> </ul>
</div> </div>
<div class="page-login--layer page-login--layer-time" flex="main:center cross:center"></div> <div
class="page-login--layer page-login--layer-time"
flex="main:center cross:center"
></div>
<div class="page-login--layer"> <div class="page-login--layer">
<div class="page-login--content" flex="dir:top main:justify cross:stretch box:justify"> <div
class="page-login--content"
flex="dir:top main:justify cross:stretch box:justify"
>
<div class="page-login--content-header"> <div class="page-login--content-header">
<p class="page-login--content-header-motto"></p> <p class="page-login--content-header-motto"></p>
</div> </div>
<div class="page-login--content-main" flex="dir:top main:center cross:center"> <div
class="page-login--content-main"
flex="dir:top main:center cross:center"
>
<!-- form --> <!-- form -->
<div class="page-login--form"> <div class="page-login--form">
<div class="form-left"> <div class="form-left">
...@@ -24,8 +36,8 @@ ...@@ -24,8 +36,8 @@
size="default" size="default"
> >
<div class="title-wrap"> <div class="title-wrap">
<span class="form-title">tFIMS管理系统</span> <span class="form-title">{{systemName}}</span>
<span class="form-sub">让服务更智慧、更直接</span> <span class="form-sub">{{systemSubName}}</span>
</div> </div>
<div class="input-wrap"> <div class="input-wrap">
<el-form-item prop="loginName"> <el-form-item prop="loginName">
...@@ -38,7 +50,10 @@ ...@@ -38,7 +50,10 @@
maxlength="10" maxlength="10"
v-focus v-focus
> >
<d2-el-icon slot="prepend" name="user"></d2-el-icon> <d2-el-icon
slot="prepend"
name="user"
></d2-el-icon>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
...@@ -47,15 +62,25 @@ ...@@ -47,15 +62,25 @@
v-model="formLogin.password" v-model="formLogin.password"
v-on:keyup.native.13="submit" v-on:keyup.native.13="submit"
clearable clearable
maxlength="12" maxlength="12"
placeholder="请输入密码" placeholder="请输入密码"
> >
<d2-el-icon slot="prepend" name="key"/> <d2-el-icon
slot="prepend"
name="key"
/>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item class="form-action"> <el-form-item class="form-action">
<el-button @click="submit" type="primary" :loading="$store.state.d2admin.loading.value" class="button-login">登录</el-button>
<el-button <el-button
@click="submit"
type="primary"
:loading="$store.state.d2admin.loading.value"
class="button-login"
:style="{'width': hasReg ? '' : '100%'}"
>登录</el-button>
<el-button
v-if="hasReg"
@click.prevent="registerDialogVisible = true" @click.prevent="registerDialogVisible = true"
plain plain
class="button-reg" class="button-reg"
...@@ -85,7 +110,7 @@ ...@@ -85,7 +110,7 @@
<script> <script>
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { mapActions } from 'vuex' import { mapActions } 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')
...@@ -98,8 +123,8 @@ export default { ...@@ -98,8 +123,8 @@ export default {
// 表单 // 表单
formLogin: { formLogin: {
loginName: '', loginName: '',
password: '', password: ''
loginType: LOGIN_TYPE // loginType: LOGIN_TYPE
}, },
// 表单校验 // 表单校验
rules: Object.freeze({ rules: Object.freeze({
...@@ -118,6 +143,12 @@ export default { ...@@ -118,6 +143,12 @@ export default {
}) })
} }
}, },
created() {
// console.log(this.baseConfig)
this.systemName = this.baseConfig.sysName || '系统'
this.systemSubName = this.baseConfig.subName || '说明'
this.hasReg = this.baseConfig.hasReg || false
},
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))
...@@ -139,10 +170,10 @@ export default { ...@@ -139,10 +170,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
const _p = { const _p = {
...this.formLogin, ...this.formLogin
deviceCode: `${os.name}${os.version}-${browser.name}${browser.version}` // deviceCode: `${os.name}${os.version}-${browser.name}${browser.version}`
} }
// 登录 // 登录
// 注意 这里的演示没有传验证码 // 注意 这里的演示没有传验证码
...@@ -316,13 +347,13 @@ export default { ...@@ -316,13 +347,13 @@ export default {
.img-top { .img-top {
width: 364px; width: 364px;
height: 24px; height: 24px;
background: url("./image/bz.png"); background: url('./image/bz.png');
margin-bottom: 53px; margin-bottom: 53px;
transform: translateX(-20px); transform: translateX(-20px);
} }
.img-bg { .img-bg {
// box-sizing: border-box; // box-sizing: border-box;
background: url("./image/bg.png"); background: url('./image/bg.png');
width: 322px; width: 322px;
height: 276px; height: 276px;
// border:6px solid #F4F9FF; // border:6px solid #F4F9FF;
......
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { mapActions } from 'vuex' // import { mapActions } from 'vuex'
import notice from '@/common/notice' import notice from '@/common/notice'
import { RegistType, POST_DISABLED } from '@/common/constants' // import { RegistType, POST_DISABLED } from '@/common/constants'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
name: 'DialogReg', name: 'DialogReg',
...@@ -108,9 +108,9 @@ export default { ...@@ -108,9 +108,9 @@ export default {
}, },
data() { data() {
return { return {
POST_DISABLED, // POST_DISABLED,
regForm: { regForm: {
createType: RegistType.BY_ADMIN, // 1 自注册 2 管理员创建 // createType: RegistType.BY_ADMIN, // 1 自注册 2 管理员创建
loginName: '', loginName: '',
userName: '', userName: '',
roleId: '' roleId: ''
...@@ -154,20 +154,20 @@ export default { ...@@ -154,20 +154,20 @@ export default {
// { required: true, message: '所属站点不能为空', trigger: ['blur'] } // { required: true, message: '所属站点不能为空', trigger: ['blur'] }
// ], // ],
roleId: [{ required: true, message: '角色不能为空', trigger: ['blur'] }] roleId: [{ required: true, message: '角色不能为空', trigger: ['blur'] }]
}), })
/* -----------------------基础数据---------------------- */ /* -----------------------基础数据---------------------- */
baseData: { // baseData: {
// 所属站点 // // 所属站点
stations: [], // stations: [],
// 职务 // // 职务
posts: [], // posts: [],
// roles // // roles
roles: [] // roles: []
} // }
} }
}, },
methods: { methods: {
...mapActions('d2admin/base', ['load']), // ...mapActions('d2admin/base', ['load']),
handleClose(done) { handleClose(done) {
this.$event.$emit('e-reg-dialog-close', false) this.$event.$emit('e-reg-dialog-close', false)
}, },
...@@ -176,7 +176,7 @@ export default { ...@@ -176,7 +176,7 @@ 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 // __p.createType = RegistType.BY_ADMIN
// __p.postName = this.baseData.posts.find(post => post.confCode === __p.postCode).confValue // __p.postName = this.baseData.posts.find(post => post.confCode === __p.postCode).confValue
this.submitFunction(__p).then(res => { this.submitFunction(__p).then(res => {
const { operateStatus } = res const { operateStatus } = res
...@@ -190,18 +190,18 @@ export default { ...@@ -190,18 +190,18 @@ export default {
}) })
} }
}) })
},
// 加载业务所需所有数据
async fetchData() {
const { role, station, post } = await this.load()
this.baseData.posts = post
this.baseData.stations = station
this.baseData.roles = role.roles
Object.freeze(this.baseData)
} }
// 加载业务所需所有数据
// async fetchData() {
// const { role, station, post } = await this.load()
// this.baseData.posts = post
// this.baseData.stations = station
// this.baseData.roles = role.roles
// Object.freeze(this.baseData)
// }
}, },
mounted() { mounted() {
this.fetchData() // this.fetchData()
} }
} }
</script> </script>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<el-form-item label="用户:"> <el-form-item label="用户:">
<el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" clearable></el-input> <el-input v-model="searchForm.userName" placeholder="请输入用户名/姓名/联系电话" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="角色:"> <!-- <el-form-item label="角色:">
<el-select v-model="searchForm.roleId" clearable placeholder="请选择"> <el-select v-model="searchForm.roleId" clearable placeholder="请选择">
<el-option <el-option
v-for="(role,index) in baseData.roles" v-for="(role,index) in baseData.roles"
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
:key="index" :key="index"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item> -->
<el-form-item label="注册时间:"> <el-form-item label="注册时间:">
<el-date-picker <el-date-picker
v-model="searchTimes" v-model="searchTimes"
...@@ -132,31 +132,31 @@ export default { ...@@ -132,31 +132,31 @@ export default {
prop: 'userName', prop: 'userName',
width: '120' width: '120'
}] }]
},
/* -----------------------基础数据---------------------- */
baseData: {
// 所属站点
stations: [],
// 职务
posts: [],
// 角色
roles: []
} }
/* -----------------------基础数据---------------------- */
// baseData: {
// // 所属站点
// stations: [],
// // 职务
// posts: [],
// // 角色
// roles: []
// }
} }
}, },
watch: { watch: {
'searchTimes'(value) { 'searchTimes'(value) {
Object.assign(this.searchForm, util.formatTime(this.searchTimes)) Object.assign(this.searchForm, util.formatTime(this.searchTimes))
},
'$store.state.d2admin.base.role'(value) {
this.baseData.roles = value
this.key = new Date()
} }
// '$store.state.d2admin.base.role'(value) {
// this.baseData.roles = value
// this.key = new Date()
// }
}, },
mounted() { mounted() {
this.fetchData() // this.fetchData()
this.$event.$on('e-reg-dialog-close', isReload => { this.$event.$on('e-reg-dialog-close', isReload => {
isReload && this.$refs.userTable.refreshTable() isReload && this.$refs.userTable.refreshTable()
this.registerDialogVisible = false this.registerDialogVisible = false
...@@ -166,17 +166,17 @@ export default { ...@@ -166,17 +166,17 @@ export default {
methods: { methods: {
...mapActions('d2admin/base', ['load']), ...mapActions('d2admin/base', ['load']),
// 加载业务所需所有数据 // 加载业务所需所有数据
fetchData() { // fetchData() {
this.loadBaseData() // this.loadBaseData()
}, // },
async loadBaseData() { // async loadBaseData() {
const { role, station, post } = await this.load() // const { role, station, post } = await this.load()
this.baseData.posts = post // this.baseData.posts = post
this.baseData.stations = station // this.baseData.stations = station
this.baseData.roles = role.roles // this.baseData.roles = role.roles
Object.freeze(this.baseData) // Object.freeze(this.baseData)
}, // },
/* 接口请求-start */ /* 接口请求-start */
filterTag(value, row) { filterTag(value, row) {
return row.status === value return row.status === value
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!