Commit 0341a211 by wangql

aaa

2 parents f8b037ef 96a286c1
......@@ -7,7 +7,7 @@ VUE_APP_TITLE=tFIMS
VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 仓库地址
VUE_APP_REPO=https://github.com/d2-projects/d2-admin-start-kit
VUE_APP_REPO=
# 国际化配置
VUE_APP_I18N_LOCALE=zh-chs
......
......@@ -8,19 +8,19 @@
<title><%= VUE_APP_TITLE %></title>
<style>
html, body, #app { height: 100%; margin: 0px; padding: 0px; width: 100%; }
.d2-home { background-color: #303133; height: 100%; display: flex; flex-direction: column; }
.d2-home { background-color:#000; height: 100%; display: flex; flex-direction: column; }
.d2-home__main { user-select: none; width: 100%; flex-grow: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; }
.d2-home__footer { width: 100%; flex-grow: 0; text-align: center; padding: 1em 0; }
.d2-home__footer > a { font-size: 12px; color: #ABABAB; text-decoration: none; }
.d2-home__footer > a { font-size: 12px; color: #fff; text-decoration: none; }
.d2-home__loading { height: 32px; width: 32px; margin-bottom: 20px; }
.d2-home__title { color: #FFF; font-size: 14px; margin-bottom: 10px; }
.d2-home__sub-title { color: #ABABAB; font-size: 12px; }
.d2-home__title { color: #FFF; font-size: 20px; margin-bottom: 10px; }
.d2-home__sub-title { color: #fff; font-size: 14px; }
</style>
<script>
<!-- <script>
var _hmt = _hmt || [];
var hmid = "1dfa88d0c8571eef2d383070cb3e5ca1";
(function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?" + hmid; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s);})();
</script>
</script> -->
</head>
<body>
<noscript>
......
import request from './request'
const path = 'fims.subsystem.'
const methods = {
Add: `${path}add`,
Edit: `${path}edit`
}
function getListApi (data) {
data.method = `${path}list`
return request(data)
}
function editApi (data) {
return request(data)
}
function removeApi (data) {
data.method = `${path}remove`
return request(data)
}
export {
getListApi,
methods,
editApi,
removeApi
}
\ No newline at end of file
const sysMonitorPath = 'fims.system.'
const trafficManagePath = 'fims.traffic.'
const sysMonitorMethods = {
Search: `${sysMonitorPath}list`,
Report: `${sysMonitorPath}report`
}
const trafficManageMethods = {
Add: `${trafficManagePath}add`,
Search: `${trafficManagePath}list`,
Edit: `${trafficManagePath}edit`,
Remove: `${trafficManagePath}remove`
}
export {
sysMonitorMethods,
trafficManageMethods
}
import request from './request'
const sysMonitorPath = 'fims.system.'
const path = 'fims.system.'
function getListApi (data) {
data.method = `${sysMonitorPath}list`
data.method = `${path}list`
return request(data)
}
function reportApi (data) {
data.method = `${sysMonitorPath}report`
data.method = `${path}report`
return request(data)
}
export {
getListApi,
reportApi
}
\ No newline at end of file
}
import request from './request'
const trafficManagePath = 'fims.traffic.'
const path = 'fims.traffic.'
function getListApi (data) {
data.method = `${trafficManagePath}list`
return request(data)
const methods = {
Add: `${path}add`,
Edit: `${path}edit`
}
function addApi (data) {
data.method = `${trafficManagePath}add`
function getListApi (data) {
data.method = `${path}list`
return request(data)
}
// function addApi (data) {
// data.method = `${path}add`
// return request(data)
// }
function editApi (data) {
data.method = `${trafficManagePath}edit`
// data.method = `${path}edit`
return request(data)
}
function removeApi (data) {
data.method = `${trafficManagePath}remove`
data.method = `${path}remove`
return request(data)
}
export {
getListApi,
addApi,
methods,
// addApi,
editApi,
removeApi
}
\ No newline at end of file
removeApi
}
......@@ -3,12 +3,13 @@
:size="size"
:type="type"
:loading="loading"
v-roles="['3']"
v-if="isInRole"
@click="handleClick"
>{{label}}</el-button>
</template>
<script>
import {mapGetters} from 'vuex'
export default {
name: 'AuthButton',
props: {
......@@ -32,16 +33,23 @@ export default {
type: Boolean,
default: false
},
perms: {
id: {
type: String,
default: null
}
},
computed: {
...mapGetters('d2admin/auth', ['curBtns'])
},
data () {
return {}
return {
isInRole:false
}
},
beforeCreate () {
this.$vrm.setRoles(['1', '2', '3'])
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 () {
......
......@@ -27,11 +27,11 @@
<!-- 顶栏右侧 -->
<div class="d2-header-right" flex-box="0">
<!-- 如果你只想在开发环境显示这个按钮请添加 v-if="$env === 'development'" -->
<!-- <d2-header-search @click="handleSearchClick" v-if="$env === 'development'"/> -->
<!-- <d2-header-log v-if="$env === 'development'"/> -->
<d2-header-size/>
<d2-header-search @click="handleSearchClick"/>
<d2-header-log />
<!-- <d2-header-size /> -->
<d2-header-fullscreen/>
<!-- <d2-header-locales v-if="$env === 'development'"/> -->
<d2-header-locales />
<d2-header-theme/>
<d2-header-color/>
<d2-header-user/>
......
......@@ -76,42 +76,34 @@ util.deepFind = function (menus, id) {
return null
}
util.packRoutes = function (resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误')
}
let __aRouteInPermision = []
idsInPermision.forEach(obj => {
__aRouteInPermision.push(resources[obj.id])
})
return __aRouteInPermision
}
util.packAsideMenus = function (resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误')
}
let __aMenusInPermision = []
let __aSub = []
idsInPermision.forEach(obj => {
const { icon, path, meta } = resources[obj.id]
const { title, id, pid } = meta
if (obj.pid === '0') {
__aMenusInPermision.push({ title, icon, path, id, pid })
} else {
__aSub.push({ title, icon, path, id, pid })
}
})
let __parent = null
__aSub.forEach(obj => {
__parent = __aMenusInPermision.find(menu => menu.id === obj.pid)
if (__parent.children) {
__parent.children.push(obj)
} else {
__parent.children = [obj]
}
})
return __aMenusInPermision
/**
* 16进制颜色值 转换为 rgb
* @param {*} sColor 16进制颜色值
* @param {*} alpha 透明度
*/
util.colorToRgb = (sColor, alpha) => {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/
sColor = sColor.toLowerCase()
if (sColor && reg.test(sColor)) {
if (sColor.length === 4) {
var sColorNew = '#'
for (var i = 1; i < 4; i += 1) {
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1))
}
sColor = sColorNew
}
// 处理六位的颜色值
var sColorChange = []
for (let i = 1; i < 7; i += 2) {
sColorChange.push(parseInt('0x' + sColor.slice(i, i + 2)))
}
if (alpha || alpha === 0 || alpha === '0') {
return `rgba(${sColorChange.join(',')} ,${alpha})`
}
return `rgb(${sColorChange.join(',')})`
} else {
return sColor
}
}
export default util
......@@ -2,35 +2,65 @@
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Last Modified by: limin
* @Last Modified time: 2019-08-28 12:15:51
* @Last Modified time: 2019-08-28 23:05:36
*/
const permision = {
}
permision.packRoutes = function (resources, idsInPermision) {
const permision = {}
/**
* 打包如有与按钮
* resources 所有资源集合
* idsInPermision 返回的权限id集合
*/
permision.packRoutesBtns = function (resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误')
}
let __aRouteInPermision = []
let __aRouteInPermision = [],
__oBtnInPermision = {},
// __aBtnIdAll=[],
__objResource = null
idsInPermision.forEach(obj => {
__aRouteInPermision.push(resources[obj.id])
__objResource = resources[obj.id]
if(__objResource){//直接能取到的为路由 (也可以在routes 中定标识变量)
__aRouteInPermision.push(resources[obj.id])//push 进 路由数组
}else{ //如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量)
__objResource = resources[obj.pid]
if(__objResource && __objResource.auth && !__oBtnInPermision[obj.pid]){
__oBtnInPermision[obj.pid]=__objResource.auth
// __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)])
}
}
})
return __aRouteInPermision
return {'route':__aRouteInPermision,'btn':__oBtnInPermision}
}
/**
* 打包菜单
* resources 所有资源集合
* idsInPermision 返回的权限id集合
*/
permision.packAsideMenus = function (resources, idsInPermision) {
if (!resources || !idsInPermision || !idsInPermision.length) {
throw new Error('参数错误')
}
let __aMenusInPermision = []
let __aSub = []
/**
* 第一次循环 分出一级菜单与所有子菜单
*/
idsInPermision.forEach(obj => {
const __oMenu = permision.format2Menu(resources[obj.id])
if (obj.pid === '0') {
if(!__oMenu){ //不存在 可能是 按钮 直接继续循环
return true
}
if (obj.pid === '0') {//取出1级菜单
__aMenusInPermision.push(__oMenu)
} else {
} else {//取出子菜单
__aSub.push(__oMenu)
}
})
/**
* 第二次循环所有子菜单 ,然后挂载到对应的一级菜单
*/
let __parent = null
__aSub.forEach(obj => {
__parent = __aMenusInPermision.find(menu => menu.id === obj.pid)
......@@ -47,6 +77,7 @@ permision.packAsideMenus = function (resources, idsInPermision) {
* 格式化菜单 封装成系统所需格式
*/
permision.format2Menu = function (oMenu) {
if(!oMenu) return null
const { icon, path, meta } = oMenu
const { title, id, pid } = meta
return { title, icon, path, id, pid }
......
......@@ -71,7 +71,8 @@ router.afterEach(to => {
store.dispatch('d2admin/page/open', to)
// 更改标题
util.title(to.meta.title)
// store.dispatch('d2admin/auth/set', to.meta.title)
// 保存当前页面meta信息
store.dispatch('d2admin/auth/setCurrentPageMeta', to.meta)
})
export default router
......@@ -28,6 +28,32 @@ export const home = {
},
component: _import('systemMonitor')
}
export const sys =[
// 系统 前端日志
{
path: 'log',
name: 'log',
meta: {
title: '前端日志',
auth: true
},
component: _import('system/log')
},
// 刷新页面 必须保留
{
path: 'refresh',
name: 'refresh',
hidden: true,
component: _import('system/function/refresh')
},
// 页面重定向 必须保留
{
path: 'redirect/:route*',
name: 'redirect',
hidden: true,
component: _import('system/function/redirect')
}
]
/**
* 所有需动态过滤的资源点
......@@ -67,11 +93,13 @@ export const resources = {
component: _import('demo/page2'),
auth: {
'operation': [{ // 列表操作
id: '1020101',
name: '查看'
id: '1020201',
pid:'10202',
label: '查看'
}, { //
id: '1020102',
name: '编辑'
id: '1020202',
pid:'10202',
label: '编辑'
}],
'action': [] // 按钮操作
}
......@@ -85,16 +113,28 @@ export const resources = {
id: '10203',
pid: '102'
},
auth: {
'operation': [{ // 列表操作
id: '1020301',
pid:'10203',
label: '查看'
}, { //
id: '1020302',
pid:'10203',
label: '编辑'
}],
'action': [] // 按钮操作
},
component: _import('demo/page3')
},
// '103': {
// '102': {
// path: 'trafficManagement',
// icon: 'folder-o',
// name: '车辆管理',
// meta: {
// auth: true,
// title: '车辆管理',
// id: '103',
// id: '102',
// pid: '0'
// },
// component: _import('trafficManagement')
......@@ -110,19 +150,19 @@ export const resources = {
pid: '0'
},
component: _import('subSysManagement')
},
},
'104': {
path: 'trafficManagement',
icon: 'folder-o',
name: '物料管理',
name: '车辆管理',
meta: {
auth: true,
title: '物料管理',
title: '车辆管理',
id: '104',
pid: '0'
},
component: _import('trafficManagement')
},
},
'105': {
path: 'bb',
icon: 'folder-o',
......@@ -132,8 +172,8 @@ export const resources = {
title: '单据管理',
id: '105',
pid: '0'
},
},
}
},
'10501': {
path: '/cc',
icon: 'folder-o',
......@@ -145,7 +185,7 @@ export const resources = {
pid: '105'
},
component: _import('trafficManagement')
},
},
'10502': {
path: '/dd',
icon: 'folder-o',
......@@ -157,9 +197,9 @@ export const resources = {
pid: '105'
},
component: _import('trafficManagement')
},
},
'107': {
path: 'page',
path: 'user',
icon: 'folder-o',
name: '用户管理',
meta: {
......
......@@ -2,15 +2,18 @@
* @Author: limin
* @Date: 2019-08-27 17:25:12
* @Last Modified by: limin
* @Last Modified time: 2019-08-28 14:25:41
* @Last Modified time: 2019-08-29 00:53:59
*/
import util from '@/libs/util.js'
import router from '@/router'
import { resources as sources, home, frameInRoutes, errorPage } from '@/router/routes'
import { resources as sources, home, frameInRoutes,sys } from '@/router/routes'
export default {
namespaced: true,
state: {
source: ''
source:null,
meta:{},
btns:{},
btnIdAll:[]
},
getters: {
/**
......@@ -19,6 +22,34 @@ export default {
*/
source (state, dispatch) {
return state.source
},
/**
* @description 返回当前页面meta
* @param {Object} state state
*/
meta (state, dispatch) {
return state.meta
},
/**
* @description 当前角色拥有的所有按钮
* @param {Object} state state
*/
btns (state, dispatch) {
return state.btns
},
/**
* 返回当前页面的btn
* @param {*} state
*/
curBtns(state){
return state.btns[state.meta.id]
},
/**
* 返回当前页面的btn
* @param {*} state
*/
btnIdAll(state){
return state.btnIdAll
}
},
actions: {
......@@ -50,6 +81,17 @@ export default {
})
},
/**
* @description 保存当前角色权限资源
* @param {obj} source 需要保存的权限资源
*/
setCurrentPageMeta ({ state, commit, dispatch }, meta) {
return new Promise(async resolve => {
state.meta = meta
// end
resolve()
})
},
/**
* @description 从持久化数据加载资源数据
* @param {Object} context
*/
......@@ -61,13 +103,6 @@ export default {
path: 'source',
user: true
}, { root: true })
// console.log(document.querySelector('html').getAttribute('login')==='1');
// if( document.querySelector('html').getAttribute('login')==='1'){
// await dispatch('init')
// router.replace(router.currentRoute.path || '/')
// }
// 用户登录后从持久化数据加载一系列的设置
// await dispatch('d2admin/account/load', { root: true })
}
// end
resolve(state.source)
......@@ -79,33 +114,26 @@ export default {
*/
init ({ state, commit, dispatch }) {
return new Promise(async resolve => {
// 获取权限资源点
const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由
const __aRoutesInPermisions = util.permision.packRoutes(sources, __source)
frameInRoutes[0].children = [home, ...__aRoutesInPermisions]
router.addRoutes(frameInRoutes)
// router.addRoutes(errorPage)
await commit('d2admin/page/init', frameInRoutes, { root: true })
// 过滤左侧菜单栏
const __aMenusInPermisions = util.permision.packAsideMenus(sources, __source)
const __oHome = util.permision.format2Menu(home)
await commit('d2admin/menu/asideSet', [__oHome, ...__aMenusInPermisions], { root: true })
// DB -> store 加载用户名
// await dispatch('d2admin/user/load', null, { root: true })
// // DB -> store 加载主题
// await dispatch('d2admin/theme/load', null, { root: true })
// // DB -> store 加载页面过渡效果设置
// await dispatch('d2admin/transition/load', null, { root: true })
// // DB -> store 持久化数据加载上次退出时的多页列表
// await dispatch('d2admin/page/openedLoad', null, { root: true })
// // DB -> store 持久化数据加载侧边栏折叠状态
// await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true })
// // DB -> store 持久化数据加载全局尺寸
// await dispatch('d2admin/size/load', null, { root: true })
// 后台接口 -> store
// await dispatch('d2admin/auth/init', null, { root: true })
try {
// 获取权限资源点
const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由
const { route,btn } = util.permision.packRoutesBtns(sources, __source)
frameInRoutes[0].children = [home, ...route,...sys]
router.addRoutes(frameInRoutes)
state.btns = btn
await commit('d2admin/page/init', frameInRoutes, { root: true })
const __aMenus = [util.permision.format2Menu(home), ...util.permision.packAsideMenus(sources, __source)]
// 过滤左侧菜单栏
await commit('d2admin/menu/asideSet', __aMenus, { root: true })
// 初始化页面搜索
await commit('d2admin/search/init', __aMenus, { root: true })
} catch (error) {
if (error.message === '参数错误' && !await dispatch('load')) {
router.replace('/login')
return false
}
}
// end
resolve(state.source)
})
......
......@@ -7,6 +7,15 @@ export default {
// 颜色
value: process.env.VUE_APP_ELEMENT_COLOR
},
getters: {
/**
* @description 返回当前颜色值
* @param {Object} state state
*/
color (state, dispatch) {
return state.value
}
},
actions: {
/**
* @description 设置颜色
......
import { get } from 'lodash'
import router from '@/router'
import setting from '@/setting.js'
// import setting from '@/setting.js'
import home from '@/router/routes'
// 判定是否需要缓存
const isKeepAlive = data => get(data, 'meta.cache', false)
......@@ -11,7 +12,7 @@ export default {
// 可以在多页 tab 模式下显示的页面
pool: [],
// 当前显示的多页面列表
opened: setting.page.opened,
opened: [home],
// 已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201
openedLoaded: false,
// 当前页面
......@@ -45,7 +46,7 @@ export default {
const value = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'page.opened',
defaultValue: setting.page.opened,
defaultValue: [home],
user: true
}, { root: true })
// 在处理函数中进行数据优化 过滤掉现在已经失效的页签或者已经改变了信息的页签
......
......@@ -40,33 +40,26 @@
label="操作"
>
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
<el-button type="text" size="small">编辑</el-button>
<auth-button label="测试" @e-auth-click="test(scope.row)"/>
<auth-button label="测试11" @e-auth-click="test(scope.row)"/>
<auth-button label="查看" @e-auth-click="handleClick(scope.row)"/>
<auth-button label="编辑" @e-auth-click="handleClick(scope.row)"/>
<auth-button label="看不见我" @e-auth-click="handleClick(scope.row)"/>
</template>
</el-table-column>
</el-table>
</d2-container>
</template>
<script>
export default {
methods: {
handleClick (row) {
console.log(row)
},
test (row) {
console.log(row)
alert(JSON.stringify(row))
}
},
components: {
},
mounted () {
this.$event.$on('e-auth-click', function () {
alert(1)
})
},
data () {
return {
......
......@@ -3,7 +3,7 @@ import { constants } from 'fs';
<template>
<div>
<el-dialog
:title="!editForm.subSystemNum ? '添加子系统' : '编辑子系统'"
:title="!editForm.subsystemCode ? '添加子系统' : '编辑子系统'"
:visible.sync="isVisible"
:before-close="handleClose"
>
......@@ -15,42 +15,42 @@ import { constants } from 'fs';
>
<el-form-item
label="子系统编号"
prop="subSystemNum">
prop="subsystemCode">
<el-input
:disabled="disabled"
v-model="editForm.subSystemNum"
v-model="editForm.subsystemCode"
placeholder="请输入子系统编号"
></el-input>
</el-form-item>
<el-form-item
label="车辆编号"
prop="carNum">
prop="trafficCode">
<el-input
:disabled="disabled"
v-model="editForm.carNum"
v-model="editForm.trafficCode"
placeholder="请输入车辆编号"
></el-input>
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select v-model="editForm.type" placeholder="请选择类型" clearable filterable>
<el-form-item label="类型" prop="systemType">
<el-select v-model="editForm.systemType" 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="生产厂家" prop="manufacturer">
<el-input v-model="editForm.manufacturer" placeholder="请输入生产厂家" clearable></el-input>
<el-form-item label="生产厂家" prop="merchantName">
<el-input v-model="editForm.merchantName" placeholder="请输入生产厂家" clearable></el-input>
</el-form-item>
<el-form-item label="发送结点序列" prop="xl">
<el-input v-model="editForm.xl" placeholder="请输入发送结点序列" clearable></el-input>
<el-form-item label="发送结点序列" prop="sendSequence">
<el-input v-model="editForm.sendSequence" placeholder="请输入发送结点序列" clearable></el-input>
</el-form-item>
<el-form-item label="发送节点端口" prop="jk">
<el-input v-model="editForm.jk" placeholder="请输入发送节点端口" clearable></el-input>
<el-form-item label="发送节点端口" prop="sendPort">
<el-input v-model="editForm.sendPort" placeholder="请输入发送节点端口" clearable></el-input>
</el-form-item>
<el-form-item label="网关地址" prop="wgdz">
<el-input v-model="editForm.wgdz" placeholder="请输入网关地址" clearable></el-input>
<el-form-item label="网关地址" prop="gatewayUrl">
<el-input v-model="editForm.gatewayUrl" placeholder="请输入网关地址" clearable></el-input>
</el-form-item>
<el-form-item label="网关端口" prop="wgdk">
<el-input v-model="editForm.wgdk" placeholder="请输入网关端口" clearable></el-input>
<el-form-item label="网关端口" prop="gatewayPort">
<el-input v-model="editForm.gatewayPort" placeholder="请输入网关端口" clearable></el-input>
</el-form-item>
</el-form>
<div slot="footer">
......@@ -73,28 +73,28 @@ export default {
return {
disabled: false,
rules: {
subSystemNum: [
subsystemCode: [
{ required: true, message: '请输入子系统编号', trigger: 'blur' }
],
carNum: [
trafficCode: [
{ required: true, message: '请输入车辆编号', trigger: 'blur' }
],
type: [
systemType: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
manufacturer: [
merchantName: [
{ required: true, message: '请输入生产厂家', trigger: 'blur' }
],
xl: [
sendSequence: [
{ required: true, message: '请输入发送节点序列', trigger: 'blur' }
],
jk: [
sendPort: [
{ required: true, message: '请输入发送节点端口', trigger: 'blur' }
],
wgdz: [
gatewayUrl: [
{ required: true, message: '请输入网关地址', trigger: 'blur' }
],
wgdk: [
gatewayPort: [
{ required: true, message: '请输入网关端口', trigger: 'blur' }
]
}
......@@ -110,8 +110,7 @@ export default {
watch: {
isVisible (val) {
this.disabled = !!this.editForm.subSystemNum
// this.editForm.interface = this.editForm.carNum ? this.editForm.interface : '1'
this.disabled = this.editForm.subsystemCode ? true : false
this.$refs.editRuleForm.resetFields()
}
},
......
......@@ -7,19 +7,19 @@
label-width="85px"
>
<el-form-item label="子系统编号">
<el-input v-model="searchForm.subSystemNum" placeholder="请输入子系统编号" clearable></el-input>
<el-input v-model="searchForm.subsystemCode" placeholder="请输入子系统编号" clearable></el-input>
</el-form-item>
<el-form-item label="类型">
<el-select v-model="searchForm.type" placeholder="请选择类型" clearable filterable>
<el-select v-model="searchForm.systemTypeCode" 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-input v-model="searchForm.carNum" placeholder="请输入车辆编号" clearable></el-input>
<el-input v-model="searchForm.trafficCode" placeholder="请输入车辆编号" clearable></el-input>
</el-form-item>
<el-form-item label="生产厂家">
<el-input v-model="searchForm.manufacturer" placeholder="请输入生产厂家" clearable></el-input>
<el-input v-model="searchForm.merchantName" placeholder="请输入生产厂家" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
......@@ -97,6 +97,8 @@
<script>
import EditDialog from './editDialog'
import { getListApi, methods, editApi, removeApi } from '@api/subSysManagement'
import notice from '@/common/notice'
export default {
name: 'subSysManagement',
components: {
......@@ -107,74 +109,74 @@ export default {
// 新增/编辑弹窗
editVisible: false,
editForm: {
subSystemNum: '',
type: '',
carNum: '',
manufacturer: '',
xl: '',
jk: '',
wgdz: '',
wgdk: ''
subsystemCode: '',
systemType: '',
trafficCode: '',
merchantName: '',
sendSequence: '',
sendPort: '',
gatewayUrl: '',
gatewayPort: ''
},
// 搜索
searchForm: {
subSystemNum: '',
type: '',
carNum: '',
manufacturer: ''
subsystemCode: '',
systemTypeCode: '',
trafficCode: '',
merchantName: ''
},
tableData: [{
subSystemNum: '3#1F',
type: '座椅',
carNum: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司',
xl: '1.56',
jk: '4000',
wgdz: '192.168.1.1',
wgdk: '8000'
subsystemCode: '3#1F',
systemType: '座椅',
trafficCode: 'CRH45661-5648',
merchantName: '长春通富机电设备有限公司',
sendSequence: '1.56',
sendPort: '4000',
gatewayUrl: '192.168.1.1',
gatewayPort: '8000'
}, {
subSystemNum: '3#2F',
type: '桌板',
carNum: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司',
xl: '1.56',
jk: '4000',
wgdz: '192.168.1.1',
wgdk: '8000'
subsystemCode: '3#2F',
systemType: '桌板',
trafficCode: 'CRH45661-5648',
merchantName: '长春通富机电设备有限公司',
sendSequence: '1.56',
sendPort: '4000',
gatewayUrl: '192.168.1.1',
gatewayPort: '8000'
}, {
subSystemNum: '3#3F',
type: '座椅',
carNum: 'CRH45661-5648',
manufacturer: '长春通富机电设备有限公司',
xl: '1.56',
jk: '4000',
wgdz: '192.168.1.1',
wgdk: '8000'
subsystemCode: '3#3F',
systemType: '座椅',
trafficCode: 'CRH45661-5648',
merchantName: '长春通富机电设备有限公司',
sendSequence: '1.56',
sendPort: '4000',
gatewayUrl: '192.168.1.1',
gatewayPort: '8000'
}],
tableColumns: [{
label: '子系统编号',
prop: 'subSystemNum'
prop: 'subsystemCode'
}, {
label: '类型',
prop: 'type'
prop: 'systemType'
}, {
label: '车辆编号',
prop: 'carNum'
prop: 'trafficCode'
}, {
label: '生产厂家',
prop: 'manufacturer'
prop: 'merchantName'
}, {
label: '发送结点序列',
prop: 'xl'
prop: 'sendSequence'
}, {
label: '发送结点接口',
prop: 'jk'
prop: 'sendPort'
}, {
label: '网关地址',
prop: 'wgdz'
prop: 'gatewayUrl'
}, {
label: '网关端口',
prop: 'wgdk'
prop: 'gatewayPort'
}],
// 页码
currentPage: 1,
......@@ -183,10 +185,49 @@ export default {
}
},
mounted() {
this.loadingGetList()
},
methods: {
loadingGetList () {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams () {
return {
pageCount: this.pageSize,
pageSize: this.currentPage,
...this.searchForm
}
},
getList () {
const params = this.getParams()
getListApi(params).then(res => {
this.tableData = res
this.tableLoading = false
}).catch(err => {
notice.errorTips(err)
this.tableLoading = false
})
},
editSubSystem(value) {
const params = value
params.method = value.id ? methods.Edit : methods.Add
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
}).catch(err => {
notice.errorTips()
})
},
/* 接口请求-end */
// 搜索
handleSearch () {
console.log(this.searchForm)
this.loadingGetList()
},
// 页码
......@@ -194,12 +235,14 @@ export default {
console.log(value)
this.pageSize = value
// 调接口
this.loadingGetList()
},
handleCurrentChange (value) {
console.log(value)
this.currentPage = value
// 调接口
this.loadingGetList()
},
resetForm (obj) {
......@@ -213,18 +256,22 @@ export default {
},
handleAdd () {
console.log(this.editForm)
this.editVisible = !this.editVisible
},
handleEditClose () {
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
console.log(this.editForm)
},
handleEditConfirm () {
console.log(JSON.parse(JSON.stringify(this.editForm)))
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
var editParams = JSON.parse(JSON.stringify(this.editForm))
this.editSubSystem(this.editForm)
// this.editVisible = !this.editVisible
// this.resetForm(this.editForm)
},
// 表格-编辑
......
import Bg from './src/main'
/* istanbul ignore next */
// Bg.install = function(Vue) {
// Vue.component(Bg.name, Bg)
// }
export default Bg
import axios from '@/plugin/axios'
// 默认配置
const defaults = {
format: 'js',
idx: 0,
n: 1,
token: 'wqdjkwl1e21FQlk1j2',
wallpaper_path: ''
}
/**
* 返回数组
*/
export const getBingImages = options => {
// const xhr = new XMLHttpRequest()
// const data = null
return new Promise((resolve, reject) => {
let config = null
if (typeof options === 'undefined') {
config = defaults
} else {
config = {}
Object.assign(config, defaults, options)
}
axios({ url: config.wallpaper_path }).then(res => {
// request({ url: 'http://localhost:3000/api/wallpaper' }).then(res => {
// console.log(JSON.parse(res.data).base64)
// if (res.status === 'success') {
resolve(res)
// } else {
// reject('ERROR.')
// }
})
})
}
<template>
<div :style="oBgStyle" :class="withAnimation?'img imgA':'img'"></div>
</template>
<script>
import { getBingImages } from './get_bing_image.js'
export default {
name: 'Bg',
props: {
opacity: [String],
refresh: Boolean,
withAnimation: Boolean
},
data() {
return {
oBgStyle: {
backgroundImage: '',
opacity: this.opacity || '.1'
}
}
},
beforeMount() {
// const oBg = this.$get_session('oBg')
// if (oBg && !this.refresh) {
// this.oBgStyle.backgroundImage = oBg.bgi
// this.$emit('update:oBg', oBg)
// return
// }
getBingImages({ 'wallpaper_path': 'http://oss-config.test.glsx.com.cn:7060/api/wallpaper' }).then(data => {
const { path, copyright, copyrightlink } = data
this.oBgStyle.backgroundImage = `url(${path})`
const oBg = { bgi: this.oBgStyle.backgroundImage, copyright, copyrightlink }
// this.$set_session('oBg', JSON.stringify(oBg))
this.$emit('update:oBg', oBg)
}).catch(err=>{
console.log(err);
})
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
@keyframes img-action {
from{
transform: scale(1.1)
}
to{
transform: scale(1)
}
}
.img {
width: 100%;
height: 100%;
position: absolute;
}
.imgA {
animation: img-action 18s
}
</style>
<template>
<div class="page-login">
<!-- <bg opacity="1" :oBg.sync="bing" :refresh="true" :withAnimation="true"></bg> -->
<div class="page-login--layer page-login--layer-area">
<ul class="circles">
<li v-for="n in 10" :key="n"></li>
......@@ -81,7 +82,7 @@
</div>
</div>
<div class="page-login--content-footer">
<p class="page-login--content-footer-locales">
<!-- <p class="page-login--content-footer-locales">
<a
v-for="language in $languages"
:key="language.value"
......@@ -89,7 +90,7 @@
@click="$i18n.locale = language.value">
{{ language.label }}
</a>
</p>
</!-->
<p class="page-login--content-footer-copyright">
Copyright
<d2-icon name="copyright"/>
......@@ -98,11 +99,11 @@
@FairyEver
</a>
</p>
<p class="page-login--content-footer-options">
<!-- <p class="page-login--content-footer-options">
<a href="#">帮助</a>
<a href="#">隐私</a>
<a href="#">条款</a>
</p>
</p> -->
</div>
</div>
</div>
......@@ -126,8 +127,15 @@
import dayjs from 'dayjs'
import { mapActions } from 'vuex'
export default {
components: {
'Bg': () => import('./Bg')
},
data () {
return {
bing: {
copyright: '',
copyrightlink: ''
},
timeInterval: null,
time: dayjs().format('HH:mm:ss'),
// 快速选择用户
......
......@@ -17,7 +17,7 @@
prop="trafficCode">
<el-input
:disabled="disabled"
v-model="editForm.trafficCode"
v-model="editForm.trafficCode"
placeholder="请输入车辆编号"
></el-input>
</el-form-item>
......@@ -79,8 +79,8 @@ export default {
},
watch: {
isVisible(val) {
this.disabled = this.editForm.trafficCode ? true : false
isVisible (val) {
this.disabled = !!this.editForm.trafficCode
this.editForm.openType = this.editForm.trafficCode ? this.editForm.openType : '1'
this.$refs.editRuleForm.resetFields()
}
......
......@@ -101,7 +101,7 @@
<script>
import EditDialog from './editDialog'
import { getListApi, addApi, editApi, removeApi } from '@api/trafficManagement'
import { getListApi, methods, editApi, removeApi } from '@api/trafficManagement'
import notice from '@/common/notice'
export default {
name: 'trafficManagement',
......@@ -141,7 +141,7 @@ export default {
label: '接口开放',
prop: 'openType',
formatter: (cellValue) => {
if(cellValue.openType) {
if (cellValue.openType) {
return {
1: '是',
2: '否'
......@@ -175,7 +175,6 @@ export default {
},
getList () {
const params = this.getParams()
// params.method = trafficManageMethods.Search
getListApi(params).then(res => {
this.tableData = res
this.tableLoading = false
......@@ -184,9 +183,10 @@ export default {
this.tableLoading = false
})
},
addTraffic(value) {
editTraffic(value) {
const params = value
addApi(params).then(res => {
params.method = value.id ? methods.Edit : methods.Add
editApi(params).then(res => {
this.handleEditClose()
notice.okTips()
this.loadingGetList()
......@@ -227,19 +227,20 @@ export default {
},
handleAdd () {
console.log(this.editForm)
this.editVisible = !this.editVisible
},
handleEditClose () {
this.editVisible = !this.editVisible
this.resetForm(this.editForm)
console.log(this.editForm)
},
handleEditConfirm () {
console.log(JSON.parse(JSON.stringify(this.editForm)))
var editParams = JSON.parse(JSON.stringify(this.editForm))
// this.editVisible = !this.editVisible
// this.resetForm(this.editForm)
this.editTraffic(editParams)
},
// 表格-编辑
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!