Commit 304ea2ab by wangql

Merge branch 'master' of http://192.168.3.233:8090/glsx-web/tFIMS

2 parents 1fda41d3 bd581883
...@@ -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: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-01 17:18:41 * @Last Modified time: 2019-09-02 14:26:14
*/ */
import request from './request' import request from './request'
...@@ -27,3 +27,12 @@ export function Reg (data = {}) { ...@@ -27,3 +27,12 @@ export function Reg (data = {}) {
data.method = `${user_path}register` data.method = `${user_path}register`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
/**
* 获取用户列表
* @param {*} data 参数
*/
export function UserList (data = {}) {
data.method = `${user_path}search`
return request(data, RequestMethods.GET)
}
...@@ -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: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-01 17:19:07 * @Last Modified time: 2019-09-02 10:49:21
*/ */
import request from './request' import request from './request'
...@@ -44,3 +44,12 @@ export function FetchRoleList (data = {}) { ...@@ -44,3 +44,12 @@ export function FetchRoleList (data = {}) {
data.method = `fims.role.list` data.method = `fims.role.list`
return request(data, RequestMethods.GET) return request(data, RequestMethods.GET)
} }
/**
* 获取职务列表
* @param {*} data 参数
*/
export function PostList (data = {}) {
data.method = `${path}post`
return request(data, RequestMethods.GET)
}
...@@ -11,7 +11,13 @@ function reportApi (data) { ...@@ -11,7 +11,13 @@ function reportApi (data) {
return request(data) return request(data)
} }
function exportApi (data) {
data.method = `${path}export`
return request(data)
}
export { export {
getListApi, getListApi,
reportApi reportApi,
exportApi
} }
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
.d2-layout-header-aside-content { .d2-layout-header-aside-content {
// [布局] 顶栏 // [布局] 顶栏
.d2-theme-header { .d2-theme-header {
transition: .1s ease;
// logo区域 // logo区域
.logo-group { .logo-group {
transition: width .3s; transition: width .3s;
...@@ -143,6 +144,7 @@ ...@@ -143,6 +144,7 @@
} }
} }
.el-menu-item { .el-menu-item {
transition: .1s ease;
@extend %header-menu-item; @extend %header-menu-item;
border-bottom: none; border-bottom: none;
} }
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
* @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-01 19:06:01 * @Last Modified time: 2019-09-02 10:52:44
*/ */
export const BaseData = { export const BaseData = {
ROLE: 'role', ROLE: 'role',
COMPANY: 'company', COMPANY: 'company',
DEPART: 'depart', DEPART: 'depart',
STATION: 'station' STATION: 'station',
POST:'post'
} }
export default {
name: 'AuthButton',
props: {
label: {
type: String,
default: ''
},
size: {
type: String,
default: 'mini'
},
// type: {
// type: String,
// default: 'text'
// },
category:{
type: String,
default: 'operation'
},
loading: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
id: {
type: String,
default: null
},
accept: {
type: String,
default: null
},
mapping: {
type: Object,
default: null
},
data: Object,
},
functional: true , // 开启函数化组件
render: (h, ctx) => {
const _this = ctx.parent //获取 vue this 实例
// console.log(ctx);
/**
* 获取传入参数
* category 非必填 button 类别 暂时两种 1 表格操作:operation ,2 Button 按钮: action 默认 operation ----- route 中不标明 视为默认值 operation
* data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* label 当传入label 字段时 标识明确指定渲染该label 的按钮
*/
const { category , data , mapping, label } = ctx.props
let curBtns = []
/**
* 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中
* @param {*} btn
*/
const filter = btn => mapping ? mapping[data[mapping['field']]].includes(btn.label):true
const $store = _this.$store.getters['d2admin/auth/curBtns']
if(label){ //指定label
const __item = $store.find(btn => (btn.label === label) && filter(btn))
__item && curBtns.push(__item)
}else {
/**
* 拿到当前模块(页面) 所拥有按钮列表 过滤type属性 与 映射关系 返回需要显示的按钮列表
*/
curBtns = $store.filter(btn => {
if(category === 'operation'){
return (btn.category === 'operation' || !btn.category) && filter(btn)
}
return (btn.category === category) && filter(btn)
})
}
if(curBtns.length===0) return ''
const __aBtns = []
/**
* 循环最终显示的按钮列表
* 并渲染到页面
*/
curBtns.forEach(btn =>
__aBtns.push(h('el-button', {
props: {
type:btn.type||'text',
},
style:{
color:btn.color
},
on: {
click: ()=>btn.handle && _this[btn.handle](data)
}
}, [btn.label])))
return h('div', {}, [...__aBtns,ctx.children])
}
}
\ No newline at end of file \ No newline at end of file
<template>
<el-button
:size="size"
:type="type"
:loading="loading"
v-if="isInRole"
@click="handleClick"
>{{label}}</el-button>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
name: 'AuthButton',
props: {
label: {
type: String,
default: 'Button'
},
size: {
type: String,
default: 'mini'
},
type: {
type: String,
default: 'text'
},
loading: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
},
id: {
type: String,
default: null
}
},
computed: {
...mapGetters('d2admin/auth', ['curBtns'])
},
data () {
return {
isInRole: false
}
},
created () {
// this.$vrm.setRoles(this.btnIdAll)
const { action, operation } = this.curBtns
this.isInRole = [...action, ...operation].find(obj => obj.id === this.id || obj.label === this.label)
},
methods: {
handleClick: function () {
this.$emit('e-auth-click', {})
}
}
}
</script>
<style scoped>
</style>
import Vue from 'vue' import Vue from 'vue'
import d2Container from './d2-container' import d2Container from './d2-container'
import authButton from './d2-auth/d2-auth-btn.vue' import authButton from './d2-auth/d2-auth-btn.js'
// 注意 有些组件使用异步加载会有影响 // 注意 有些组件使用异步加载会有影响
Vue.component('d2-container', d2Container) Vue.component('d2-container', d2Container)
......
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
data () { data () {
return { return {
options: [ options: [
{ label: '默认', value: 'default' }, { label: '大', value: 'default' },
{ label: '中', value: 'medium' }, { label: '中', value: 'medium' },
{ label: '小', value: 'small' }, { label: '小', value: 'small' },
{ label: '最小', value: 'mini' } { label: '最小', value: 'mini' }
......
...@@ -16,12 +16,9 @@ ...@@ -16,12 +16,9 @@
flex-box="0" flex-box="0"
flex> flex>
<div class="logo-group d2-theme-header-logo" :class="asideCollapse ? 'logo-only' : 'logo-all'" flex-box="0"> <div class="logo-group d2-theme-header-logo" :class="asideCollapse ? 'logo-only' : 'logo-all'" flex-box="0">
<img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`"> <img v-if="asideCollapse" :src="`${$baseUrl}image/theme/logo/icon-only.png`">
<img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`"> <img v-else :src="`${$baseUrl}image/theme/logo/all.png`">
</div> </div>
<!-- <div class="toggle-aside-btn" @click="handleToggleAside" flex-box="0">
<d2-icon name="bars"/>
</div> -->
<hamburger :onClick="handleToggleAside" :isActive="asideCollapse" flex-box="0" class="toggle-aside-btn"></hamburger> <hamburger :onClick="handleToggleAside" :isActive="asideCollapse" flex-box="0" class="toggle-aside-btn"></hamburger>
<d2-menu-header flex-box="1"/> <d2-menu-header flex-box="1"/>
<!-- 顶栏右侧 --> <!-- 顶栏右侧 -->
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @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-08-28 23:05:36 * @Last Modified time: 2019-09-03 09:07:46
*/ */
const permision = {} const permision = {}
/** /**
...@@ -16,21 +16,30 @@ permision.packRoutesBtns = function (resources, idsInPermision) { ...@@ -16,21 +16,30 @@ permision.packRoutesBtns = function (resources, idsInPermision) {
} }
let __aRouteInPermision = [] let __aRouteInPermision = []
let __oBtnInPermision = {} let __oBtnInPermision = {}
// __aBtnIdAll=[],
let __objResource = null let __objResource = null
let __obj = null
idsInPermision.forEach(obj => { idsInPermision.forEach(obj => {
__objResource = resources[obj.id] __objResource = resources[obj.id]
if (__objResource) { // 直接能取到的为路由 (也可以在routes 中定标识变量) if (__objResource) { // 直接能取到的为路由 (也可以在routes 中定标识变量)
__aRouteInPermision.push(resources[obj.id])// push 进 路由数组 __aRouteInPermision.push(resources[obj.id]) // push 进 路由数组
} else { // 如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量) } else { // 如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量)
__objResource = resources[obj.pid] __objResource = resources[obj.pid]
if (__objResource && __objResource.auth && !__oBtnInPermision[obj.pid]) { if (__objResource && __objResource.auth) {
__oBtnInPermision[obj.pid] = __objResource.auth __obj =__objResource.auth.find(o => o.id === obj.id)
if (__oBtnInPermision[obj.pid] && __oBtnInPermision[obj.pid].length) {
__oBtnInPermision[obj.pid].push(__obj)
} else {
__oBtnInPermision[obj.pid] = [__obj]
}
// __oBtnInPermision[obj.pid] = __objResource.auth
// __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)]) // __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)])
} }
} }
}) })
return { 'route': __aRouteInPermision, 'btn': __oBtnInPermision } return {
'route': __aRouteInPermision,
'btn': __oBtnInPermision
}
} }
/** /**
...@@ -78,9 +87,23 @@ permision.packAsideMenus = function (resources, idsInPermision) { ...@@ -78,9 +87,23 @@ permision.packAsideMenus = function (resources, idsInPermision) {
*/ */
permision.format2Menu = function (oMenu) { permision.format2Menu = function (oMenu) {
if (!oMenu) return null if (!oMenu) return null
const { icon, path, meta } = oMenu const {
const { title, id, pid } = meta icon,
return { title, icon, path, id, pid } path,
meta
} = oMenu
const {
title,
id,
pid
} = meta
return {
title,
icon,
path,
id,
pid
}
} }
export default permision export default permision
\ No newline at end of file \ No newline at end of file
...@@ -8,11 +8,12 @@ const _import = require('@/libs/util.import.' + process.env.NODE_ENV) ...@@ -8,11 +8,12 @@ const _import = require('@/libs/util.import.' + process.env.NODE_ENV)
*/ */
const frameIn = [{ const frameIn = [{
path: '/', path: '/',
redirect: { name: 'index' }, redirect: {
name: 'index'
},
component: layoutHeaderAside, component: layoutHeaderAside,
children: [] children: []
} }]
]
/** /**
* 首页 * 首页
*/ */
...@@ -26,7 +27,15 @@ export const home = { ...@@ -26,7 +27,15 @@ export const home = {
id: '101', id: '101',
pid: '0' pid: '0'
}, },
component: _import('systemMonitor') component: _import('systemMonitor'),
auth: [{
id: '10101',
pid: '101',
label: '导出',
type: 'button',
category:'Button',
handle: 'exportFile'
}]
} }
export const sys = [ export const sys = [
// 系统 前端日志 // 系统 前端日志
...@@ -59,89 +68,101 @@ export const sys = [ ...@@ -59,89 +68,101 @@ export const sys = [
* 所有需动态过滤的资源点 * 所有需动态过滤的资源点
*/ */
export const resources = { export const resources = {
// '102': {
// path: '/page',
// icon: 'folder-o',
// name: '页面',
// meta: {
// auth: true,
// title: '页面',
// id: '102',
// pid: '0',
// cache: true
// }
// },
// '10201': {
// path: '/page1',
// name: 'page1',
// meta: {
// auth: true,
// title: '页面 1',
// id: '10201',
// pid: '102',
// cache: true
// },
// component: _import('demo/page1')
// },
// '10202': {
// path: '/page2',
// name: 'page2',
// meta: {
// auth: true,
// title: '页面 2',
// id: '10202',
// pid: '102',
// cache: true
// },
// component: _import('demo/page2'),
// auth: [{ // 列表操作
// id: '1020201',
// pid: '10202',
// label: '查看'
// }, { //
// id: '1020202',
// pid: '10202',
// label: '编辑'
// }],
// },
// '10203': {
// path: '/page3',
// name: '页面 3',
// meta: {
// auth: true,
// title: '页面 3',
// id: '10203',
// pid: '102'
// },
// auth: [{ // 列表操作
// id: '1020301',
// pid: '10203',
// label: '查看'
// }, { //
// id: '1020302',
// pid: '10203',
// label: '编辑'
// }],
// component: _import('demo/page3')
// },
'102': { '102': {
path: '/page', path: 'trafficManagement',
icon: 'folder-o', icon: 'train',
name: '页面', name: '车辆管理',
meta: { meta: {
auth: true, auth: true,
title: '页面', title: '车辆管理',
id: '102', id: '102',
pid: '0', pid: '0'
cache: true
}
}, },
'10201': { component: _import('trafficManagement'),
path: '/page1', auth: [{
name: 'page1',
meta: {
auth: true,
title: '页面 1',
id: '10201', id: '10201',
pid: '102', pid: '102',
cache: true label: '编辑',
}, handle: 'handleEdit'
component: _import('demo/page1') }, {
},
'10202': {
path: '/page2',
name: 'page2',
meta: {
auth: true,
title: '页面 2',
id: '10202', id: '10202',
pid: '102', pid: '102',
cache: true label: '删除',
}, handle: 'handleDelete'
component: _import('demo/page2'), }, {
auth: {
'operation': [{ // 列表操作
id: '1020201',
pid: '10202',
label: '查看'
}, { //
id: '1020202',
pid: '10202',
label: '编辑'
}],
'action': [] // 按钮操作
}
},
'10203': {
path: '/page3',
name: '页面 3',
meta: {
auth: true,
title: '页面 3',
id: '10203', id: '10203',
pid: '102' pid: '102',
}, label: '添加车辆',
auth: { category: 'Button',
'operation': [{ // 列表操作 type: 'button',
id: '1020301', handle: 'handleEdit'
pid: '10203', }]
label: '查看'
}, { //
id: '1020302',
pid: '10203',
label: '编辑'
}],
'action': [] // 按钮操作
},
component: _import('demo/page3')
}, },
// '102': {
// path: 'trafficManagement',
// icon: 'train',
// name: '车辆管理',
// meta: {
// auth: true,
// title: '车辆管理',
// id: '102',
// pid: '0'
// },
// component: _import('trafficManagement')
// },
'103': { '103': {
path: '/subSysManagement', path: '/subSysManagement',
icon: 'th-list', icon: 'th-list',
...@@ -152,21 +173,76 @@ export const resources = { ...@@ -152,21 +173,76 @@ export const resources = {
id: '103', id: '103',
pid: '0' pid: '0'
}, },
component: _import('subSysManagement') component: _import('subSysManagement'),
auth: [{
id: '10301',
pid: '103',
label: '编辑',
handle: 'handleEdit'
}, {
id: '10302',
pid: '103',
label: '删除',
handle: 'handleDelete'
}, {
id: '10303',
pid: '103',
label: '添加子系统',
category: 'Button',
type: 'button',
handle: 'handleEdit'
}]
}, },
'104': { '104': {
path: '/trafficManagement', path: '/deviceManagement',
icon: 'train', icon: 'train',
name: '车辆管理', name: '物料管理',
meta: { meta: {
auth: true, auth: true,
title: '物料管理', title: '物料管理',
id: '104', id: '104',
pid: '0' pid: '0'
}, },
component: _import('deviceManagement') component: _import('deviceManagement'),
auth: [{
id: '10401',
pid: '104',
label: '编辑',
handle: 'handleEdit'
}, {
id: '10402',
pid: '104',
label: '删除',
handle: 'handleDelete'
}, {
id: '10403',
pid: '104',
label: '导出',
type:'button',
category:'Button',
handle: 'exportFile'
}, {
id: '10404',
pid: '104',
label: '导入',
type:'button',
category:'Button'
}]
}, },
'105': { '105': {
path: 'materialList',
icon: 'folder-o',
icon: 'file-text-o',
name: '物料列表',
meta: {
auth: true,
title: '物料列表',
id: '105',
pid: '0'
},
component: _import('materialList'),
},
'106': {
path: '/bb', path: '/bb',
icon: 'file-text-o', icon: 'file-text-o',
name: '单据管理', name: '单据管理',
...@@ -187,7 +263,25 @@ export const resources = { ...@@ -187,7 +263,25 @@ export const resources = {
id: '10601', id: '10601',
pid: '106' pid: '106'
}, },
component: _import('materiaOrderManagement') component: _import('materiaOrderManagement'),
auth: [{
id: '1060101',
pid: '10601',
label: '查看详情',
handle: 'handleDetail'
}, {
id: '1060102',
pid: '10601',
label: '删除',
handle: 'handleDelete'
}, {
id: '1060103',
pid: '10601',
label: '订单下载',
category: 'Button',
type: 'button',
handle: 'exportFile'
}]
}, },
'10602': { '10602': {
path: '/maintainManagement', path: '/maintainManagement',
...@@ -199,10 +293,23 @@ export const resources = { ...@@ -199,10 +293,23 @@ export const resources = {
id: '10602', id: '10602',
pid: '106' pid: '106'
}, },
component: _import('maintainManagement') component: _import('maintainManagement'),
auth: [{
id: '1060201',
pid: '10602',
label: '删除',
handle: 'handleDelete'
}, {
id: '1060202',
pid: '10602',
label: '导出订单',
category: 'Button',
type: 'button',
handle: 'exportOrder'
}]
}, },
'107': { '107': {
path: '/user', path: '/userManager',
icon: 'users', icon: 'users',
name: '用户管理', name: '用户管理',
meta: { meta: {
...@@ -213,7 +320,7 @@ export const resources = { ...@@ -213,7 +320,7 @@ export const resources = {
} }
}, },
'10701': { '10701': {
path: '/userManage', path: '/user',
name: '用户管理', name: '用户管理',
icon: 'user', icon: 'user',
meta: { meta: {
...@@ -222,7 +329,41 @@ export const resources = { ...@@ -222,7 +329,41 @@ export const resources = {
id: '10701', id: '10701',
pid: '107' pid: '107'
}, },
component: _import('userManage/loginLogs') auth: [{ // 列表操作
id: '1070101',
pid: '10701',
label: '审核',
handle:'handleEdit'
}, { //
id: '1070102',
pid: '10701',
label: '重置密码'
}, { //
id: '1070103',
pid: '10701',
label: '编辑'
}, { //
id: '1070104',
pid: '10701',
label: '延期'
}, { //
id: '1070105',
pid: '10701',
label: '禁用',
color:'#FF0000'
}, { //
id: '1070106',
pid: '10701',
label: '激活'
}, { // 列表操作
id: '1070107',
pid: '10701',
label: '创建用户',
category:'action',
type:'button',
handle:'handleRegister'
}],
component: _import('userManage/user')
}, },
'10702': { '10702': {
path: '/jurisdictionManage', path: '/jurisdictionManage',
......
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
name: user.name name: user.name
}, { root: true }) }, { root: true })
// 强制初始化基础数据 // 强制初始化基础数据
await dispatch('d2admin/base/init', null, { root: true }) dispatch('d2admin/base/init', null, { root: true })
// 用户登录后从持久化数据加载一系列的设置 // 用户登录后从持久化数据加载一系列的设置
await dispatch('load') await dispatch('load')
// 结束 // 结束
...@@ -84,13 +84,10 @@ export default { ...@@ -84,13 +84,10 @@ export default {
await dispatch('d2admin/page/openedLoad', null, { root: true }) await dispatch('d2admin/page/openedLoad', null, { root: true })
// DB -> store 持久化数据加载侧边栏折叠状态 // DB -> store 持久化数据加载侧边栏折叠状态
await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true }) await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true })
// await dispatch('d2admin/size/set', 'medium', { root: true })
// DB -> store 持久化数据加载全局尺寸 // DB -> store 持久化数据加载全局尺寸
await dispatch('d2admin/size/load', null, { root: true }) await dispatch('d2admin/size/load', null, { root: true })
// DB - > 初始化 基础数据 // DB - > 初始化 基础数据
// await dispatch('d2admin/base/init', null, { root: true }) // await dispatch('d2admin/base/init', null, { root: true })
// // store 设置系统主色
// await dispatch('d2admin/color/set', process.env.VUE_APP_MAIN_COLOR)
// 后台接口 -> store // 后台接口 -> store
// await dispatch('d2admin/auth/init', null, { root: true }) // await dispatch('d2admin/auth/init', null, { root: true })
// end // end
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-27 17:25:12 * @Date: 2019-08-27 17:25:12
* @Last Modified by: limin * @Last Modified by: limin
* @Last Modified time: 2019-09-01 19:00:46 * @Last Modified time: 2019-09-03 09:03:37
*/ */
import util from '@/libs/util.js' import util from '@/libs/util.js'
import router from '@/router' import router from '@/router'
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
// 获取权限资源点 // 获取权限资源点
const __source = await dispatch('load') const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由 // 过滤资源点 并动态添加到路由
const { route, btn } = util.permision.packRoutesBtns(sources, __source) const { route, btn } = util.permision.packRoutesBtns({...sources,[home.meta.id]:home}, __source)
frameInRoutes[0].children = [home, ...route, ...sys] frameInRoutes[0].children = [home, ...route, ...sys]
router.addRoutes(frameInRoutes) router.addRoutes(frameInRoutes)
state.btns = btn state.btns = btn
......
...@@ -2,16 +2,17 @@ ...@@ -2,16 +2,17 @@
* @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-01 18:57:45 * @Last Modified time: 2019-09-02 11:20:15
*/ */
import { FetchRoleList, CompanyList, DepartList, StationList } from '@/api/sys.base' import { FetchRoleList, CompanyList, DepartList, StationList,PostList } from '@/api/sys.base'
import { BaseData } from '@/common/constants' import { BaseData } from '@/common/constants'
const map = { const map = {
[BaseData.ROLE]: FetchRoleList, [BaseData.ROLE]: FetchRoleList,
[BaseData.COMPANY]: CompanyList, [BaseData.COMPANY]: CompanyList,
[BaseData.DEPART]: DepartList, [BaseData.DEPART]: DepartList,
[BaseData.STATION]: StationList [BaseData.STATION]: StationList,
[BaseData.POST]: PostList
} }
export default { export default {
namespaced: true, namespaced: true,
...@@ -23,7 +24,9 @@ export default { ...@@ -23,7 +24,9 @@ export default {
// 部门 // 部门
depart: [], depart: [],
// 站点 // 站点
station: [] station: [],
//职务
post:[]
}, },
actions: { actions: {
/** /**
...@@ -37,14 +40,16 @@ export default { ...@@ -37,14 +40,16 @@ export default {
FetchRoleList(), FetchRoleList(),
CompanyList(), CompanyList(),
DepartList(), DepartList(),
StationList() StationList(),
]).then( async ([role, company, depart, station] = res) => { PostList()
]).then( async ([role, company, depart, station, post] = res) => {
state.role = role state.role = role
state.station = station state.station = station
state.depart = depart state.depart = depart
state.company = company state.company = company
await dispatch('save2db', {path: `base`,value: {role, company, depart, station}}) state.post = post
resolve({ role, company, depart, station }) await dispatch('save2db', {path: `base`,value: {role, company, depart, station,post}})
resolve({ role, company, depart, station,post })
}) })
}) })
}, },
...@@ -77,8 +82,8 @@ export default { ...@@ -77,8 +82,8 @@ export default {
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, company, depart, station} = state const {role, company, depart, station, post} = state
resolve({role, company, depart, station}) resolve({role, company, depart, station, post})
}) })
}, },
/** /**
......
import Vue from 'vue' import Vue from 'vue'
import router from '@/router' import router from '@/router'
const size = 'medium' // medium small mini
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
// 尺寸 // 尺寸
value: 'medium' // medium small mini value: ''// medium small mini
}, },
actions: { actions: {
/** /**
...@@ -66,7 +66,7 @@ export default { ...@@ -66,7 +66,7 @@ export default {
state.value = await dispatch('d2admin/db/get', { state.value = await dispatch('d2admin/db/get', {
dbName: 'sys', dbName: 'sys',
path: 'size.value', path: 'size.value',
defaultValue: 'default', defaultValue: size,
user: true user: true
}, { root: true }) }, { root: true })
// 应用 // 应用
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<el-table <el-table
:data="tableData" :data="tableData"
border border
size="small"
style="width: 100%"> style="width: 100%">
<el-table-column <el-table-column
fixed fixed
......
...@@ -27,15 +27,17 @@ ...@@ -27,15 +27,17 @@
</el-form> </el-form>
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">物料列表</el-col> <el-col :span="12">物料列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right; position: relative;">
<el-button class="import-button" style="">导入 <auth-button
category="Button"
>
<input <input
type="file" type="file"
class="import-input" class="import-input"
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@change="importFile($event)" /> @change="importFile($event)" />
</el-button> </auth-button>
<el-button>导出</el-button> <!-- <auth-button label="导出" type="Button" @e-auth-click="exportFile"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -72,14 +74,15 @@ ...@@ -72,14 +74,15 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <auth-button :data="scope.row"></auth-button>
<!-- <el-button
type="text" type="text"
@click="handleEdit(scope.row, scope.$index)" @click="handleEdit(scope.row, scope.$index)"
>编辑</el-button> >编辑</el-button>
<el-button <el-button
type="text" type="text"
@click="handleDelete(scope.$index, scope.row)" @click="handleDelete(scope.$index, scope.row)"
>删除</el-button> >删除</el-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -225,6 +228,15 @@ export default { ...@@ -225,6 +228,15 @@ export default {
notice.errorTips() notice.errorTips()
}) })
}, },
exportFile () {
const params = this.getParams()
exportApi(params).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
})
},
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch () {
...@@ -258,7 +270,7 @@ export default { ...@@ -258,7 +270,7 @@ export default {
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row, index = -1) { handleEdit (row) {
// console.log(index) // console.log(index)
// console.log(row) // console.log(row)
console.log(row) console.log(row)
...@@ -266,17 +278,22 @@ export default { ...@@ -266,17 +278,22 @@ export default {
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleDelete (index, row) { handleDelete (row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log(index) // // console.log(index)
console.log(row) // console.log(row)
this.$message({ // this.$message({
type: 'success', // type: 'success',
message: '删除成功' // message: '删除成功'
// })
removeApi(row).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
}) })
}).catch(err => {}) }).catch(err => {})
} }
...@@ -285,17 +302,15 @@ export default { ...@@ -285,17 +302,15 @@ export default {
</script> </script>
<style scoped> <style scoped>
.import-button { /* .import-button {
width: 70px;
height: 40px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
cursor: pointer; cursor: pointer;
} } */
.import-input { .import-input {
opacity: 0; opacity: 0;
position: absolute; position: absolute;
left: 0; right: 0;
top: 0; top: 0;
width: 70px; width: 70px;
height: 100%; height: 100%;
......
...@@ -44,7 +44,8 @@ ...@@ -44,7 +44,8 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">作业单列表</el-col> <el-col :span="12">作业单列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button @click="exportOrder">导出订单</el-button> <auth-button category="Button"></auth-button>
<!-- <auth-button label="导出订单" type="" @e-auth-click="exportOrder"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -81,10 +82,13 @@ ...@@ -81,10 +82,13 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <auth-button
type="text" :data="scope.row"
@click="handleDelete(scope.$index, scope.row)" ></auth-button>
>删除</el-button> <!-- <auth-button
label="删除"
@e-auth-click="handleDelete(scope.$index, scope.row)"
></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -306,17 +310,22 @@ export default { ...@@ -306,17 +310,22 @@ export default {
this.loadingGetList() this.loadingGetList()
}, },
handleDelete (index, row) { handleDelete (row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log(index) // console.log(index)
console.log(row) // console.log(row)
this.$message({ // this.$message({
type: 'success', // type: 'success',
message: '删除成功' // message: '删除成功'
// })
removeApi(row).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
}) })
}).catch(err => {}) }).catch(err => {})
} }
......
...@@ -3,10 +3,13 @@ ...@@ -3,10 +3,13 @@
<div class="detailDialog"> <div class="detailDialog">
<el-dialog <el-dialog
:visible.sync="isVisible" :visible.sync="isVisible"
:title="title"
:before-close="handleClose" :before-close="handleClose"
width="800px"
> >
<!-- <embed src="file:///D:/project需求/高铁/物料申请单_20190830150550.pdf" width="100%" height="800px"></embed> --> <!-- <embed src="file:///D:/project需求/高铁/物料申请单_20190830150550.pdf" width="100%" height="800px"></embed> -->
<iframe width="100%" height="800px" scrolling="yes" frameborder="0" src="https://web.stanford.edu/~xgzhou/zhou_book2017.pdf"></iframe> <iframe width="100%" height="800px" scrolling="yes" frameborder="0" src="https://web.stanford.edu/~xgzhou/zhou_book2017.pdf"></iframe>
<!-- <iframe width="100%" height="550px" scrolling="yes" frameborder="0" src="https://pan.baidu.com/s/1Juauwf2c5nkNZuj6rc0W0Q"></iframe> -->
<!-- <embed width="100%" height="800px" src="https://web.stanford.edu/~xgzhou/zhou_book2017.pdf"> --> <!-- <embed width="100%" height="800px" src="https://web.stanford.edu/~xgzhou/zhou_book2017.pdf"> -->
</el-dialog> </el-dialog>
</div> </div>
...@@ -24,7 +27,8 @@ export default { ...@@ -24,7 +27,8 @@ export default {
isVisible: { isVisible: {
type: Boolean, type: Boolean,
default: false default: false
} },
title: ''
}, },
mounted () {}, mounted () {},
...@@ -37,10 +41,8 @@ export default { ...@@ -37,10 +41,8 @@ export default {
} }
</script> </script>
<style scoped> <style>
.header-title { .detailDialog .el-dialog__body {
text-align: center; padding: 0 20px;
font-size: 18px;
font-weight: bold;
} }
</style> </style>
...@@ -34,7 +34,8 @@ ...@@ -34,7 +34,8 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">订单列表</el-col> <el-col :span="12">订单列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button>订单下载</el-button> <auth-button category="Button"></auth-button>
<!-- <auth-button label="订单下载" type="" @e-auth-click="exportFile"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -71,14 +72,15 @@ ...@@ -71,14 +72,15 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <auth-button :data="scope.row"></auth-button>
type="text" <!-- <el-button
label="查看详情"
@click="handleDetail(scope.row, scope.$index)" @click="handleDetail(scope.row, scope.$index)"
>查看详情</el-button> ></el-button>
<el-button <auth-button
type="text" label="删除"
@click="handleDelete(scope.$index, scope.row)" @e-auth-click="handleDelete(scope.$index, scope.row)"
>删除</el-button> ></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -95,6 +97,7 @@ ...@@ -95,6 +97,7 @@
</el-pagination> </el-pagination>
<detail-dialog <detail-dialog
:isVisible="detailVisible" :isVisible="detailVisible"
:title="dialogTitle"
@closeDialog="handleDetailClose" @closeDialog="handleDetailClose"
></detail-dialog> ></detail-dialog>
</d2-container> </d2-container>
...@@ -112,6 +115,7 @@ export default { ...@@ -112,6 +115,7 @@ export default {
data () { data () {
return { return {
detailVisible: false, detailVisible: false,
dialogTitle: '',
// 搜索 // 搜索
searchForm: { searchForm: {
orderCode: '', orderCode: '',
...@@ -195,6 +199,14 @@ export default { ...@@ -195,6 +199,14 @@ export default {
notice.errorTips() notice.errorTips()
}) })
}, },
exportFile () {
const params = this.getParams()
downloadApi(params).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
})
},
/* 接口请求-end */ /* 接口请求-end */
// 搜索 // 搜索
handleSearch () { handleSearch () {
...@@ -217,42 +229,26 @@ export default { ...@@ -217,42 +229,26 @@ export default {
this.loadingGetList() this.loadingGetList()
}, },
// resetForm (obj) {
// for (var item in obj) {
// if (obj[item] instanceof Array) {
// obj[item] = []
// } else {
// obj[item] = ''
// }
// }
// },
handleDetailClose () { handleDetailClose () {
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
}, },
// handleEditConfirm () {
// console.log(JSON.parse(JSON.stringify(this.editForm)))
// var editParams = JSON.parse(JSON.stringify(this.editForm))
// this.editSubSystem(this.editForm)
// },
// 表格-查看详情 // 表格-查看详情
handleDetail (row, index = -1) { handleDetail (row) {
this.dialogTitle = row.orderType
this.detailVisible = !this.detailVisible this.detailVisible = !this.detailVisible
}, },
handleDelete (index, row) { handleDelete (row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log(index) removeApi(row).then(res => {
console.log(row) notice.okTips()
this.$message({ }).catch(err => {
type: 'success', notice.errorTips()
message: '删除成功'
}) })
}).catch(err => {}) }).catch(err => {})
} }
......
...@@ -156,21 +156,6 @@ export default { ...@@ -156,21 +156,6 @@ export default {
this.currentPage = value this.currentPage = value
// 调接口 // 调接口
this.loadingGetList() this.loadingGetList()
},
handleDelete (index, row) {
this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log(index)
console.log(row)
this.$message({
type: 'success',
message: '删除成功'
})
}).catch(err => {})
} }
} }
} }
......
...@@ -28,7 +28,9 @@ ...@@ -28,7 +28,9 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">子系统列表</el-col> <el-col :span="12">子系统列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button @click="handleEdit(editFormReset)">添加子系统</el-button> <auth-button category="Button" :data="editFormReset"></auth-button>
<!-- <el-button @click="handleEdit(editFormReset)">添加子系统</el-button> -->
<!-- <auth-button label="添加子系统" type="" @e-auth-click="handleEdit(editFormReset)"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -65,14 +67,17 @@ ...@@ -65,14 +67,17 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <auth-button
type="text" :data="scope.row"
@click="handleEdit(scope.row, scope.$index)" ></auth-button>
>编辑</el-button> <!-- <auth-button
<el-button label="编辑"
type="text" @e-auth-click="handleEdit(scope.row, scope.$index)"
@click="handleDelete(scope.$index, scope.row)" ></auth-button>
>删除</el-button> <auth-button
label="删除"
@e-auth-click="handleDelete(scope.$index, scope.row)"
></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -253,22 +258,27 @@ export default { ...@@ -253,22 +258,27 @@ export default {
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row, index = -1) { 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 (index, row) { handleDelete (row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log(index) // console.log(index)
console.log(row) // console.log(row)
this.$message({ // this.$message({
type: 'success', // type: 'success',
message: '删除成功' // message: '删除成功'
// })
removeApi(row).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
}) })
}).catch(err => {}) }).catch(err => {})
} }
......
...@@ -62,9 +62,9 @@ ...@@ -62,9 +62,9 @@
<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="请选择">
<el-option <el-option
:label="role.roleName" :label="post.postName"
:value="role.roleId" :value="post.postCode"
v-for="(role,index) in baseData.roles" v-for="(post,index) in baseData.posts"
:key="index" :key="index"
></el-option> ></el-option>
</el-select> </el-select>
...@@ -191,8 +191,8 @@ export default { ...@@ -191,8 +191,8 @@ export default {
baseData: { baseData: {
// 所属站点 // 所属站点
stations: [], stations: [],
// 角色 // 职务
roles: [], posts: [],
// 部门 // 部门
departs: [], departs: [],
// 公司 // 公司
...@@ -220,8 +220,8 @@ export default { ...@@ -220,8 +220,8 @@ export default {
}, },
// 加载业务所需所有数据 // 加载业务所需所有数据
async fetchData () { async fetchData () {
const { role, company, depart, station } = await this.load() const { role, company, depart, station,post } = await this.load()
this.baseData.roles = role this.baseData.posts = post
this.baseData.stations = station this.baseData.stations = station
this.baseData.departs = depart this.baseData.departs = depart
this.baseData.companys = company this.baseData.companys = company
......
...@@ -60,7 +60,8 @@ ...@@ -60,7 +60,8 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">车辆状态列表</el-col> <el-col :span="12">车辆状态列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button>导出</el-button> <auth-button category="Button"></auth-button>
<!-- <auth-button label="导出" type="Button" @e-auth-click="exportFile"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -110,9 +111,10 @@ ...@@ -110,9 +111,10 @@
</template> </template>
<script> <script>
import { getListApi, reportApi } from '@api/systemMonitor' import { getListApi, reportApi, exportApi } from '@api/systemMonitor'
import notice from '@/common/notice' import notice from '@/common/notice'
require('echarts/lib/chart/pie') require('echarts/lib/chart/pie')
require("echarts/lib/component/tooltip");
let echarts = require('echarts/lib/echarts') let echarts = require('echarts/lib/echarts')
...@@ -148,7 +150,8 @@ export default { ...@@ -148,7 +150,8 @@ export default {
center: ['25%', '50%'], center: ['25%', '50%'],
label: { label: {
normal: { normal: {
fontSize: 16 fontSize: 16,
formatter: '{b}: {c}'
} }
}, },
data: [{ data: [{
...@@ -172,7 +175,8 @@ export default { ...@@ -172,7 +175,8 @@ export default {
center: ['75%', '50%'], center: ['75%', '50%'],
label: { label: {
normal: { normal: {
fontSize: 16 fontSize: 16,
formatter: '{b}: {c}'
} }
}, },
data: [{ data: [{
...@@ -277,6 +281,14 @@ export default { ...@@ -277,6 +281,14 @@ export default {
notice.errorTips(err) notice.errorTips(err)
}) })
}, },
exportFile () {
const params = this.getParams()
exportApi(params).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
})
},
/* 接口请求-end */ /* 接口请求-end */
/* onlineNum Int 在网数量 /* onlineNum Int 在网数量
offlineNum int 离网数量 offlineNum int 离网数量
......
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">车辆列表</el-col> <el-col :span="12">车辆列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<el-button @click="handleEdit(editFormReset)">添加车辆</el-button> <auth-button category="Button" :data="editFormReset"></auth-button>
<!-- <el-button @click="handleEdit(editFormReset)">添加车辆</el-button> -->
<!-- <auth-button label="添加车辆" type="" @e-auth-click="handleEdit(editFormReset)"></auth-button> -->
</el-col> </el-col>
</el-row> </el-row>
<el-table <el-table
...@@ -68,14 +70,15 @@ ...@@ -68,14 +70,15 @@
label="操作" label="操作"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <auth-button :data="scope.row"></auth-button>
type="text" <!-- <auth-button
@click="handleEdit(scope.row, scope.$index)" label="编辑"
>编辑</el-button> @e-auth-click="handleEdit(scope.row, scope.$index)"
<el-button ></auth-button>
type="text" <auth-button
@click="handleDelete(scope.$index, scope.row)" label="删除"
>删除</el-button> @e-auth-click="handleDelete(scope.$index, scope.row)"
></auth-button> -->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -247,24 +250,29 @@ export default { ...@@ -247,24 +250,29 @@ export default {
}, },
// 表格-编辑 // 表格-编辑
handleEdit (row, index = -1) { handleEdit (row) {
// console.log(index) // console.log(index)
// console.log(row) // console.log(row)
this.editForm = JSON.parse(JSON.stringify(row)) this.editForm = JSON.parse(JSON.stringify(row))
this.editVisible = !this.editVisible this.editVisible = !this.editVisible
}, },
handleDelete (index, row) { handleDelete (row) {
this.$confirm('确认删除?', '删除', { this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认', comfirmButtonText: '确认',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
console.log(index) // console.log(index)
console.log(row) // console.log(row)
this.$message({ // this.$message({
type: 'success', // type: 'success',
message: '删除成功' // message: '删除成功'
// })
removeApi(row).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
}) })
}).catch(err => {}) }).catch(err => {})
} }
......
<!-- 车辆管理 -->
<template>
<d2-container class="user">
<el-form :inline="true" :model="searchForm" label-width="85px">
<el-form-item label="用户">
<el-input v-model="searchForm.name" placeholder="请输入用户名/姓名/联系电话" clearable></el-input>
</el-form-item>
<el-form-item label="所属公司:">
<el-select v-model="searchForm.companyCode" placeholder="请选择">
<el-option
:label="company.companyName"
:value="company.companyCode"
v-for="(company,index) in baseData.companys"
:key="index"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="注册时间">
<el-date-picker
v-model="searchForm.times"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="角色:">
<el-select v-model="searchForm.postCode" placeholder="请选择">
<el-option
:label="role.roleName"
:value="role.roleId"
v-for="(role,index) in baseData.roles"
:key="index"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="searchForm.status" placeholder="请选择状态" clearable filterable>
<el-option label="在网" value="1"></el-option>
<el-option label="离网" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属站点:">
<el-select v-model="searchForm.stationCode" placeholder="请选择" class="sigle-select">
<el-option
:label="station.stationName"
:value="station.stationCode"
v-for="(station,index) in baseData.stations"
:key="index"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="职务:">
<el-select v-model="searchForm.postCode" placeholder="请选择">
<el-option
:label="post.postName"
:value="post.postCode"
v-for="(post,index) in baseData.posts"
:key="index"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
</el-form>
<el-row style="height: 40px; line-height: 40px">
<el-col :span="12">用户列表</el-col>
<el-col :span="12" style="text-align: right">
<auth-button category="action" label="创建用户"></auth-button>
</el-col>
</el-row>
<el-table :data="tableData" v-loading="tableLoading" border style="margin: 20px 0;">
<el-table-column align="center" width="60px" label="序号" type="index"></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
>
<template slot-scope="scope">
<template v-if="item.formatter">{{item.formatter(scope.row)}}</template>
<template v-else>{{tableData[scope.$index][item.prop]}}</template>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<auth-button :mapping="mapping" :data="scope.row"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination>
<!-- <edit-dialog
:isVisible="editVisible"
:editForm="editForm"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
></edit-dialog>-->
</d2-container>
</template>
<script>
// import EditDialog from './editDialog'
import { UserList } from "@/api/sys.account";
import notice from "@/common/notice";
import { mapActions } from "vuex";
export default {
name: "FimsUserUsers",
components: {
// EditDialog
},
data() {
return {
mapping:Object.freeze({
'field':'status',
'1':['重置密码','编辑','延期','禁用'],
'2':['重置密码','编辑','激活'],
'3':['重置密码','编辑','激活'],
'4':['审核']
}),
// 新增/编辑弹窗
editVisible: false,
editForm: {
name: "",
stationCode: "",
stationName: "",
merchantName: "",
openType: ""
},
// 搜索
searchForm: {
name: "",
companyCode: "",
times: "",
postCode: "",
status: "",
stationCode: "",
postCode: ""
},
// 表格
tableLoading: false,
tableData: [],
tableColumns: [
{
label: "用户名",
prop: "loginName"
},
{
label: "角色",
prop: "roleName"
},
{
label: "注册时间",
prop: "registerTime"
},
{
label: "有效期",
prop: "validTime"
},
{
label: "状态",
prop: "status",
formatter: cellValue => {
return {
1: "正常",
2: "已过期",
3:'禁用',
4:'待审核'
}[cellValue.status];
}
},
{
label: "姓名",
prop: "userName"
},
{
label: "联系电话",
prop: "mobile"
},
{
label: "所属公司",
prop: "companyName"
},
{
label: "部门",
prop: "departName"
},
{
label: "职务",
prop: "postName"
},
{
label: "所属站点",
prop: "stationName"
}
],
page: {
// 页码
pageCount: 1,
pageSize: 10
},
/* -----------------------基础数据---------------------- */
baseData: {
// 所属站点
stations: [],
// 职务
posts: [],
// 部门
departs: [],
// 公司
companys: [],
//角色
roles: []
}
};
},
mounted() {
this.fetchData();
},
methods: {
...mapActions("d2admin/base", ["load"]),
// 加载业务所需所有数据
fetchData() {
this.loadBaseData(), this.loadUserList();
},
async loadBaseData() {
const { role, company, depart, station, post } = await this.load();
this.baseData.posts = post;
this.baseData.stations = station;
this.baseData.departs = depart;
this.baseData.companys = company;
this.baseData.roles = role;
Object.freeze(this.baseData);
},
/* 接口请求-start */
getParams() {
return {
...this.page,
...this.searchForm
};
},
loadUserList() {
this.tableLoading = true;
const params = this.getParams();
UserList(params)
.then(res => {
this.tableData = res;
this.tableLoading = false;
})
.catch(err => {
notice.errorTips(err);
this.tableLoading = false;
});
},
handleRegister(){
console.log(this.searchForm);
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value;
// 调接口
this.loadUserList();
},
handleCurrentChange(value) {
this.page.pageCount = value;
// 调接口
this.loadUserList();
},
handleEdit(row){
console.log(row);
},
handleDelete(index, row) {
this.$confirm("确认删除?", "删除", {
comfirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning"
})
.then(() => {
// console.log(index)
// console.log(row)
// this.$message({
// type: 'success',
// message: '删除成功'
// })
removeApi(row).then(res => {
notice.okTips()
}).catch(err => {
notice.errorTips()
})
})
.catch(err => {});
}
}
};
</script>
<style scoped>
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!