Commit af91be88 authored by 李苏's avatar 李苏 💬

动态路由 和 修改

parent 92f63fb5
......@@ -6,7 +6,7 @@ ENV = 'http://demo.ruoyi.vip/'
# 格物管理系统/开发环境
VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_Print = 'http://119.3.92.249:18080/dmg'
VUE_APP_BASE_Print = 'http://192.168.30.254:18080/dmg'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
......@@ -5,4 +5,4 @@ VUE_APP_TITLE = 陕钢安全管理
ENV = 'production'
# 陕钢安全管理/生产环境
VUE_APP_BASE_API = 'http://localhost:80/'
VUE_APP_BASE_API = '/dev-api'
This diff is collapsed.
......@@ -79,22 +79,34 @@ const permission = {
getRouters({}).then(res => {
let menus=res.data.menu
let asymenus=JSON.parse(JSON.stringify(res.data.menu))
/* 权限路由*/
console.log(menus,'权限路由——————————————————————————————',powerRoutes)
/* */
let mapTree=function(arr){
/* 逻辑判断*/
arr.forEach((item,index)=>{
let mkid=item.meta.mkid
function filter (data) {
var newData = data.filter(
(item)=>{
let hasMkid=false
menus.forEach(e=>{
if(e.mkid==mkid){
asymenus.forEach(e=>{
if(e.mkid==item.meta.mkid){
hasMkid=true
}
})
return hasMkid
}
)
newData.forEach(x => x.children && (x.children = filter(x.children)))
return newData
}
let mapTree=function(arr){
/* 逻辑判断*/
arr.forEach((item,index)=>{
/* 存在权限*/
if(hasMkid){
console.log(item,'存在')
}else{
console.log(item,'不存在')
arr.splice(index,1)
}
if(item.children&&item.children.length>0){
......@@ -103,7 +115,8 @@ const permission = {
})
return arr
}
let newPowerRoutes=filter(powerRoutes)
console.log(newPowerRoutes,'newPowerRoutes')
/* 转化菜单格式*/
let delArr=[]
menus.forEach((item,index)=>{
......@@ -125,7 +138,8 @@ const permission = {
newmenus.push(mi)
}
})
res.data=dgmk(newmenus,0)
res.data=[...dgmk(newmenus,0),...newPowerRoutes]
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
......@@ -133,6 +147,9 @@ const permission = {
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
router.addRoutes(asyncRoutes);
// router.addRoutes(powerRoutes1)
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
commit('SET_DEFAULT_ROUTES', sidebarRoutes)
......
......@@ -9,13 +9,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注" ref="bz" prop="bz">
......
......@@ -3,12 +3,12 @@
<!-- 填写表单内容,slot=form必写-->
<el-form slot="form" ref="form" :model="form" label-width="80px" :rules="rules">
<el-row :gutter="20">
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="序号" ref="appid" prop="appid">
<el-input :readonly="readonly" v-model="form.appid"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
</el-col> -->
<el-col :span="24">
<el-form-item label="标准名称" ref="name" prop="name">
<el-input :readonly="readonly" v-model="form.name"></el-input>
</el-form-item>
......
......@@ -3,12 +3,12 @@
<!-- 填写表单内容,slot=form必写-->
<el-form slot="form" ref="form" :model="form" label-width="80px" :rules="rules">
<el-row :gutter="20">
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" fieldType='int'></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
</el-col> -->
<el-col :span="24">
<el-form-item label="名称" ref="name" prop="name">
<el-input :readonly="readonly" v-model="form.name"></el-input>
</el-form-item>
......
......@@ -16,13 +16,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="备注" ref="bz" prop="bz">
......
......@@ -2,13 +2,13 @@
<RelDialog :type='type' :editApp='editApp' :app='app' :buttonApp='buttonApp'>
<!-- 填写表单内容,slot=form必写-->
<el-form slot="form" ref="form" :model="form" label-width="80px" :rules="rules">
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="名称" ref="name" prop="name">
......
......@@ -22,16 +22,12 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="24">
<el-form-item label="部门" ref="bmid" prop="bmid">
<RelSelect :readonly="readonly" style="width: 100%;" src='/kzzx/bm/query' filterable clearable :match="{value:'id',label:'bmmc'}" v-model='form.bmid' ></RelSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="24">
......
......@@ -2,13 +2,13 @@
<RelDialog :type='type' :editApp='editApp' :app='app' :buttonApp='buttonApp'>
<!-- 填写表单内容,slot=form必写-->
<el-form slot="form" ref="form" :model="form" label-width="80px" :rules="rules">
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="上层分类" ref="pid" prop="pid">
......
......@@ -2,13 +2,13 @@
<RelDialog :type='type' :editApp='editApp' :app='app' :buttonApp='buttonApp'>
<!-- 填写表单内容,slot=form必写-->
<el-form slot="form" ref="form" :model="form" label-width="80px" :rules="rules">
<el-row :gutter="20">
<!-- <el-row :gutter="20">
<el-col :span="24">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="上层分类" ref="pid" prop="pid">
......
......@@ -78,12 +78,12 @@
<!-- <el-input :readonly="readonly" v-model="form.pzxx" ></el-input> -->
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item label="序号" ref="xh" prop="xh">
<el-input :readonly="readonly" v-model="form.xh" ></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
</el-col> -->
<el-col :span="24">
<el-form-item label="图形编号" ref="txcode" prop="txcode">
<el-input :readonly="readonly" v-model="form.txcode" ></el-input>
</el-form-item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment