diff --git a/config/dev.env.js b/config/dev.env.js index b6614db..9ff7267 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -1,8 +1,15 @@ +/* + * @Author: zwq + * @Date: 2021-11-15 08:20:28 + * @LastEditors: zwq + * @LastEditTime: 2021-12-06 15:34:11 + * @Description: + */ 'use strict' const merge = require('webpack-merge') const prodEnv = require('./prod.env') module.exports = merge(prodEnv, { NODE_ENV: '"development"', - OPEN_PROXY: false // 是否开启代理, 重置后需重启vue-cli + OPEN_PROXY: true // 是否开启代理, 重置后需重启vue-cli }) diff --git a/config/index.js b/config/index.js index b89e19f..78aec8f 100644 --- a/config/index.js +++ b/config/index.js @@ -1,3 +1,10 @@ +/* + * @Author: zwq + * @Date: 2021-11-15 08:20:28 + * @LastEditors: zwq + * @LastEditTime: 2021-12-07 14:48:25 + * @Description: + */ 'use strict' // Template version: 1.2.5 // see http://vuejs-templates.github.io/webpack for documentation. @@ -14,10 +21,10 @@ module.exports = { // 代理列表, 是否开启代理通过[./dev.env.js]配置 proxyTable: devEnv.OPEN_PROXY === false ? {} : { '/proxyApi': { - target: 'http://demo.renren.io/renren-fast/', + target: 'http://192.168.0.134:8080/', changeOrigin: true, pathRewrite: { - '^/proxyApi': '/' + '^/proxyApi': '/api' } } }, diff --git a/src/mock/index.js b/src/mock/index.js index 9c5aa84..398c7b3 100644 --- a/src/mock/index.js +++ b/src/mock/index.js @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2021-11-15 08:20:28 * @LastEditors: zwq - * @LastEditTime: 2021-11-15 17:17:47 + * @LastEditTime: 2021-12-06 15:15:08 * @Description: */ import Mock from 'mockjs' @@ -18,14 +18,14 @@ import * as sysUser from './modules/sys-user' // tips // 1. 开启/关闭[业务模块]拦截, 通过调用fnCreate方法[isOpen参数]设置. // 2. 开启/关闭[业务模块中某个请求]拦截, 通过函数返回对象中的[isOpen属性]设置. -fnCreate(common, true) -fnCreate(jobSchedule, true) -fnCreate(oss, true) -fnCreate(sysConfig, true) -fnCreate(sysLog, true) -fnCreate(sysMenu, true) -fnCreate(sysRole, true) -fnCreate(sysUser, true) +fnCreate(common, false) +fnCreate(jobSchedule, false) +fnCreate(oss, false) +fnCreate(sysConfig, false) +fnCreate(sysLog, false) +fnCreate(sysMenu, false) +fnCreate(sysRole, false) +fnCreate(sysUser, false) /** * 创建mock模拟数据 diff --git a/src/router/index.js b/src/router/index.js index 50ab047..807fc91 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,3 +1,10 @@ +/* + * @Author: zwq + * @Date: 2021-11-15 08:20:28 + * @LastEditors: zwq + * @LastEditTime: 2021-12-08 14:18:09 + * @Description: + */ /** * 全站路由配置 * @@ -6,8 +13,6 @@ */ import Vue from 'vue' import Router from 'vue-router' -import http from '@/utils/httpRequest' -import { isURL } from '@/utils/validate' import { clearLoginInfo } from '@/utils' Vue.use(Router) @@ -41,6 +46,7 @@ const mainRoutes = { { path: '/demo-echarts', component: _import('demo/echarts'), name: 'demo-echarts', meta: { title: 'demo-echarts', isTab: true } }, { path: '/demo-ueditor', component: _import('demo/ueditor'), name: 'demo-ueditor', meta: { title: 'demo-ueditor', isTab: true } }, { path: '/basic-cache', component: _import('basic/cache'), name: 'basic-cache', meta: { title: '缓存区信息' } }, + { path: '/basic-processInfo', component: _import('basic/processInfo'), name: 'basic-processInfo', meta: { title: '工艺信息' } }, { path: '/basic-cache-location', component: _import('basic/components/location'), name: 'basic-cache-location', meta: { title: '库位信息' } }, { path: '/basic-equipmentInfo', component: _import('basic/equipmentInfo'), name: 'basic-equipmentInfo', meta: { title: '设备基础信息' } }, { path: '/basic-carInfo', component: _import('basic/carInfo'), name: 'basic-carInfo', meta: { title: '车辆信息' } }, @@ -79,108 +85,6 @@ const mainRoutes = { const router = new Router({ mode: 'hash', scrollBehavior: () => ({ y: 0 }), - isAddDynamicMenuRoutes: false, // 是否已经添加动态(菜单)路由 routes: globalRoutes.concat(mainRoutes) }) - -router.beforeEach((to, from, next) => { - // 添加动态(菜单)路由 - // 1. 已经添加 or 全局路由, 直接访问 - // 2. 获取菜单列表, 添加并保存本地存储 - if (router.options.isAddDynamicMenuRoutes || fnCurrentRouteType(to, globalRoutes) === 'global') { - next() - } else { - http({ - url: http.adornUrl('/sys/menu/nav'), - method: 'get', - params: http.adornParams() - }).then(({data}) => { - if (data && data.code === 0) { - fnAddDynamicMenuRoutes(data.menuList) - router.options.isAddDynamicMenuRoutes = true - sessionStorage.setItem('menuList', JSON.stringify(data.menuList || '[]')) - sessionStorage.setItem('permissions', JSON.stringify(data.permissions || '[]')) - next({ ...to, replace: true }) - } else { - sessionStorage.setItem('menuList', '[]') - sessionStorage.setItem('permissions', '[]') - next() - } - }).catch((e) => { - console.log(`%c${e} 请求菜单列表和权限失败,跳转至登录页!!`, 'color:blue') - router.push({ name: 'login' }) - }) - } -}) - -/** - * 判断当前路由类型, global: 全局路由, main: 主入口路由 - * @param {*} route 当前路由 - */ -function fnCurrentRouteType (route, globalRoutes = []) { - var temp = [] - for (var i = 0; i < globalRoutes.length; i++) { - if (route.path === globalRoutes[i].path) { - return 'global' - } else if (globalRoutes[i].children && globalRoutes[i].children.length >= 1) { - temp = temp.concat(globalRoutes[i].children) - } - } - return temp.length >= 1 ? fnCurrentRouteType(route, temp) : 'main' -} - -/** - * 添加动态(菜单)路由 - * @param {*} menuList 菜单列表 - * @param {*} routes 递归创建的动态(菜单)路由 - */ -function fnAddDynamicMenuRoutes (menuList = [], routes = []) { - var temp = [] - for (var i = 0; i < menuList.length; i++) { - if (menuList[i].list && menuList[i].list.length >= 1) { - temp = temp.concat(menuList[i].list) - } else if (menuList[i].url && /\S/.test(menuList[i].url)) { - menuList[i].url = menuList[i].url.replace(/^\//, '') - var route = { - path: menuList[i].url.replace('/', '-'), - component: null, - name: menuList[i].url.replace('/', '-'), - meta: { - menuId: menuList[i].menuId, - title: menuList[i].name, - isDynamic: true, - isTab: true, - iframeUrl: '' - } - } - // url以http[s]://开头, 通过iframe展示 - if (isURL(menuList[i].url)) { - route['path'] = `i-${menuList[i].menuId}` - route['name'] = `i-${menuList[i].menuId}` - route['meta']['iframeUrl'] = menuList[i].url - } else { - try { - route['component'] = _import(`modules/${menuList[i].url}`) || null - } catch (e) {} - } - routes.push(route) - } - } - if (temp.length >= 1) { - fnAddDynamicMenuRoutes(temp, routes) - } else { - mainRoutes.name = 'main-dynamic' - mainRoutes.children = routes - router.addRoutes([ - mainRoutes, - { path: '*', redirect: { name: '404' } } - ]) - sessionStorage.setItem('dynamicMenuRoutes', JSON.stringify(mainRoutes.children || '[]')) - console.log('\n') - console.log('%c!<-------------------- 动态(菜单)路由 s -------------------->', 'color:blue') - console.log(mainRoutes.children) - console.log('%c!<-------------------- 动态(菜单)路由 e -------------------->', 'color:blue') - } -} - export default router diff --git a/src/views/basic/alarmInfo.vue b/src/views/basic/alarmInfo.vue index 7d7b965..4f0611b 100644 --- a/src/views/basic/alarmInfo.vue +++ b/src/views/basic/alarmInfo.vue @@ -4,10 +4,10 @@ @@ -30,25 +30,25 @@ width="50"> @@ -61,7 +61,7 @@ label="操作"> @@ -88,7 +88,6 @@ paramKey: '' }, dataList: [], - options: [], pageIndex: 1, pageSize: 10, totalPage: 0, @@ -107,17 +106,17 @@ getDataList () { this.dataListLoading = true this.$http({ - url: this.$http.adornUrl('/sys/config/list'), - method: 'get', - params: this.$http.adornParams({ - 'page': this.pageIndex, - 'limit': this.pageSize, - 'paramKey': this.dataForm.paramKey + url: this.$http.adornUrl('alarmBase/page'), + method: 'post', + data: this.$http.adornData({ + 'current': this.pageIndex, + 'size': this.pageSize, + 'alarmClass': this.dataForm.paramKey }) }).then(({data}) => { if (data && data.code === 0) { - this.dataList = data.page.list - this.totalPage = data.page.totalCount + this.dataList = data.data.records + this.totalPage = data.data.total } else { this.dataList = [] this.totalPage = 0 @@ -151,9 +150,9 @@ type: 'warning' }).then(() => { this.$http({ - url: this.$http.adornUrl('/sys/config/delete'), + url: this.$http.adornUrl('alarmBase/delete'), method: 'post', - data: this.$http.adornData(id, false) + data: this.$http.adornData({id}) }).then(({data}) => { if (data && data.code === 0) { this.$message({ diff --git a/src/views/basic/cache.vue b/src/views/basic/cache.vue index 7bf5a03..b709d4e 100644 --- a/src/views/basic/cache.vue +++ b/src/views/basic/cache.vue @@ -22,19 +22,19 @@ width="50"> @@ -114,17 +114,17 @@ getDataList () { this.dataListLoading = true this.$http({ - url: this.$http.adornUrl('/sys/config/list'), - method: 'get', - params: this.$http.adornParams({ - 'page': this.pageIndex, - 'limit': this.pageSize, - 'paramKey': this.dataForm.paramKey + url: this.$http.adornUrl('warehouse/page'), + method: 'post', + data: this.$http.adornData({ + 'current': this.pageIndex, + 'size': this.pageSize, + 'code': this.dataForm.paramKey }) }).then(({data}) => { if (data && data.code === 0) { - this.dataList = data.page.list - this.totalPage = data.page.totalCount + this.dataList = data.data.records + this.totalPage = data.data.total } else { this.dataList = [] this.totalPage = 0 @@ -161,9 +161,9 @@ type: 'warning' }).then(() => { this.$http({ - url: this.$http.adornUrl('/sys/config/delete'), + url: this.$http.adornUrl('warehouse/delete'), method: 'post', - data: this.$http.adornData(id, false) + data: this.$http.adornData({id}) }).then(({data}) => { if (data && data.code === 0) { this.$message({ diff --git a/src/views/basic/carInfo.vue b/src/views/basic/carInfo.vue index 379fe88..376104b 100644 --- a/src/views/basic/carInfo.vue +++ b/src/views/basic/carInfo.vue @@ -4,10 +4,10 @@ @@ -30,25 +30,25 @@ width="50"> @@ -88,7 +88,6 @@ paramKey: '' }, dataList: [], - options: [], pageIndex: 1, pageSize: 10, totalPage: 0, @@ -107,17 +106,17 @@ getDataList () { this.dataListLoading = true this.$http({ - url: this.$http.adornUrl('/sys/config/list'), - method: 'get', - params: this.$http.adornParams({ - 'page': this.pageIndex, - 'limit': this.pageSize, - 'paramKey': this.dataForm.paramKey + url: this.$http.adornUrl('vehicle/page'), + method: 'post', + data: this.$http.adornData({ + 'current': this.pageIndex, + 'size': this.pageSize, + 'vehicleName': this.dataForm.paramKey }) }).then(({data}) => { if (data && data.code === 0) { - this.dataList = data.page.list - this.totalPage = data.page.totalCount + this.dataList = data.data.records + this.totalPage = data.data.total } else { this.dataList = [] this.totalPage = 0 @@ -151,9 +150,9 @@ type: 'warning' }).then(() => { this.$http({ - url: this.$http.adornUrl('/sys/config/delete'), + url: this.$http.adornUrl('vehicle/delete'), method: 'post', - data: this.$http.adornData(id, false) + data: this.$http.adornData({id}) }).then(({data}) => { if (data && data.code === 0) { this.$message({ diff --git a/src/views/basic/components/alarmInfo-add.vue b/src/views/basic/components/alarmInfo-add.vue index a69d206..d31a841 100644 --- a/src/views/basic/components/alarmInfo-add.vue +++ b/src/views/basic/components/alarmInfo-add.vue @@ -1,17 +1,24 @@ +