Commit a3953ae3 by wangna

Merge branch 'development-202206' of http://114.115.138.98:8900/fukai/vue-gjjs…

Merge branch 'development-202206' of http://114.115.138.98:8900/fukai/vue-gjjs into development-202206
parents 442aae34 dffe10a6
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
</c-table-column> </c-table-column>
<slot></slot> <slot></slot>
</el-table> </el-table>
<c-col :span="16"> <c-col :span="16" v-if="tableData.length>10">
<el-pagination <el-pagination
v-if="paginationShow" v-if="paginationShow"
class="eContainer-pagination" class="eContainer-pagination"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
@current-change="currentChange" @current-change="currentChange"
></el-pagination> ></el-pagination>
</c-col> </c-col>
<c-col :span="8"> <c-col :span="8" style="float:right">
<div class="paginationLable" v-if="paginationShow"> <div class="paginationLable" v-if="paginationShow">
当前显示第 {{ (currentPage - 1) * pageSize + 1 }}-{{ 当前显示第 {{ (currentPage - 1) * pageSize + 1 }}-{{
currentPage * pageSize > tableData.length currentPage * pageSize > tableData.length
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
<el-button type="primary" @click="saveColumnEvent" style="margin-left:10px;">保存</el-button> <el-button type="primary" @click="saveColumnEvent" style="margin-left:10px;">保存</el-button>
</span> </span>
</el-dialog> </el-dialog>
<c-col :span="16"> <c-col :span="16" v-if="tableData.length>10">
<el-pagination <el-pagination
v-if="paginationShow" v-if="paginationShow"
class="eContainer-pagination" class="eContainer-pagination"
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
@current-change="currentChange" @current-change="currentChange"
></el-pagination> ></el-pagination>
</c-col> </c-col>
<c-col :span="8"> <c-col :span="8" style="float:right">
<div class="paginationLable" v-if="paginationShow"> <div class="paginationLable" v-if="paginationShow">
当前显示第 {{ (currentPage - 1) * pageSize + 1 }}-{{ 当前显示第 {{ (currentPage - 1) * pageSize + 1 }}-{{
currentPage * pageSize > tableData.length currentPage * pageSize > tableData.length
......
...@@ -16,21 +16,21 @@ ...@@ -16,21 +16,21 @@
></el-table-column> ></el-table-column>
<slot></slot> <slot></slot>
</el-table> </el-table>
<c-col :span="16"> <c-col :span="16" v-if="tableData.length>10">
<el-pagination <el-pagination
class="eContainer-pagination" class="eContainer-pagination"
layout="prev, pager, next, jumper" layout="prev, pager, next, jumper"
:page-sizes="pageSizes" :page-sizes="pageSizes"
:page-size="pageSize" :page-size="pageSize"
:current-page="currentPage" :current-page="currentPage"
:total="tableData.length" :total="tableData.length"
@size-change="sizeChange" @size-change="sizeChange"
@current-change="currentChange" @current-change="currentChange"
></el-pagination> ></el-pagination>
</c-col>
<c-col :span="8" style="float:right">
<div class="paginationLable">当前显示第 {{(currentPage - 1) * pageSize + 1}}-{{currentPage * pageSize > tableData.length ? tableData.length : currentPage * pageSize}} 条,共 {{tableData.length}}</div>
</c-col> </c-col>
<c-col :span="8">
<div class="paginationLable">当前显示第 {{(currentPage - 1) * pageSize + 1}}-{{currentPage * pageSize > tableData.length ? tableData.length : currentPage * pageSize}} 条,共 {{tableData.length}}</div>
</c-col>
</div> </div>
</template> </template>
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
</template> </template>
<SubMenu :subMenuList="item.children" :openFlgArr="openFlgArr" /> <SubMenu :subMenuList="item.children" :openFlgArr="openFlgArr" />
</el-submenu> </el-submenu>
<!-- <el-menu-item v-else :key="item.path" :index="item.isDz ? null : item.path" @click="gotoView(item)"> -->
<el-menu-item v-else :key="item.path" :index="item.path" <el-menu-item v-else :key="item.path" :index="item.path"
:route="item.isDz ? { name: 'DzSys', params: { path: getDynamicPath(item.path), title: item.name}} : { path: item.path }"> :route="item.isDz ? { name: 'DzSys', params: { path: getDynamicPath(item.path), title: item.name}} : { path: item.path }">
<template slot="title"> <template slot="title">
...@@ -40,14 +39,6 @@ export default { ...@@ -40,14 +39,6 @@ export default {
getOpenFlag(index) { getOpenFlag(index) {
return this.openFlgArr.includes(index); return this.openFlgArr.includes(index);
}, },
// gotoView(item) {
// if (!item.isDz) {
// return
// }
// const path = item.path
// const p = path.split("/")
// this.$router.push({name: 'DzSys', params: {path: p[p.length - 1], title: item.name}})
// }
getDynamicPath(path) { getDynamicPath(path) {
const p = path.split("/") const p = path.split("/")
return p[p.length - 1] return p[p.length - 1]
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<c-col :span="16" style="text-align:left"> <c-col :span="16" style="text-align:left">
<el-pagination <el-pagination
class="eContainer-pagination" class="eContainer-pagination"
v-if="paginationShow" v-if="paginationShow && total>10"
:background="type == 'small' ? false : true" :background="type == 'small' ? false : true"
small small
layout="prev, pager, next, jumper" layout="prev, pager, next, jumper"
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
v-on="$listeners" v-on="$listeners"
></el-pagination> ></el-pagination>
</c-col> </c-col>
<c-col :span="8"> <c-col :span="8" style="float:right">
<div class="paginationLable" v-if="paginationShow"> <div class="paginationLable" v-if="paginationShow">
当前显示第 {{ page1 }}-{{ page2 }} 条,共 {{ total }} 当前显示第 {{ page1 }}-{{ page2 }} 条,共 {{ total }}
</div> </div>
......
...@@ -214,7 +214,6 @@ import Dbiusr from "./Dbiusr" ...@@ -214,7 +214,6 @@ import Dbiusr from "./Dbiusr"
import Dbibch from "./Dbibch" import Dbibch from "./Dbibch"
import Infact from "./Infact" import Infact from "./Infact"
import DzSys from "~/views/Layout/dz/DzSys.vue";
/** /**
* 带有name的才会被添加进顶部的标签页里 * 带有name的才会被添加进顶部的标签页里
...@@ -443,6 +442,6 @@ const BusRouter = [ ...@@ -443,6 +442,6 @@ const BusRouter = [
{ path: 'Ordrel', component: Ordrel, name: 'Ordrel', meta: { title: 'Ordrel' } }, { path: 'Ordrel', component: Ordrel, name: 'Ordrel', meta: { title: 'Ordrel' } },
{ path: 'Infact', component: Infact, name: 'Infact', meta: { title: '账户' } }, { path: 'Infact', component: Infact, name: 'Infact', meta: { title: '账户' } },
{ path: 'dzsys/:path', component: DzSys, name: 'DzSys', meta: { title: (tag) => { return '电证 - ' + tag.params.title } } }, { path: 'dzsys/:path', name: 'DzSys', meta: { title: (tag) => { return '电证 - ' + tag.params.title } } },
] ]
export default BusRouter export default BusRouter
\ No newline at end of file
...@@ -5,10 +5,22 @@ ...@@ -5,10 +5,22 @@
<router-view :key="key" /> <router-view :key="key" />
</keep-alive> </keep-alive>
</transition> </transition>
<component
v-for="item in hasOpenComponentsArr"
:key="item.name"
:is="item.name"
v-show="$route.path === item.path"
></component>
</section> </section>
</template> </template>
<script> <script>
import Vue from "vue";
import DzSys from "~/views/Layout/dz/DzSys.vue";
import { getDzSysMenu } from "~/views/Layout/dz/menus.js";
export default { export default {
name: "Business", name: "Business",
watch: { watch: {
...@@ -18,19 +30,78 @@ export default { ...@@ -18,19 +30,78 @@ export default {
} else { } else {
this.$store.commit("setMode", "normal"); this.$store.commit("setMode", "normal");
} }
this.componentsArr.forEach(comp => {
if (!this.visitedViews.find(view => view.path === comp.path)) {
comp.hasOpen = false
}
})
// 判断当前路由是否iframe页
this.isOpenIframePage();
}, },
}, },
created: () => { created() {
console.log("进入业务交易界面"); console.log("进入业务交易界面");
// 设置iframe页的数组对象
const componentsArr = []
const dzSysMenu = getDzSysMenu()
this.getComponentsArr(componentsArr, dzSysMenu ? dzSysMenu.children : []);
componentsArr.forEach((item) => {
Vue.component(item.name, DzSys);
});
this.componentsArr = componentsArr;
// 判断当前路由是否iframe页
this.isOpenIframePage();
}, },
computed: { computed: {
cachedViews() { cachedViews() {
return this.$store.state.TagsView.cachedViews; return this.$store.state.TagsView.cachedViews;
}, },
visitedViews() {
return this.$store.state.TagsView.visitedViews;
},
key() { key() {
return this.$route.path; return this.$route.path;
}, },
// 实现懒加载,只渲染已经打开过(hasOpen:true)的iframe页
hasOpenComponentsArr() {
return this.componentsArr.filter(item => item.hasOpen);
}
},
data() {
return {
componentsArr: []
}
}, },
methods: {
// 根据当前路由设置hasOpen
isOpenIframePage() {
const target = this.componentsArr.find(item => {
return item.path === this.$route.path
});
if (target && !target.hasOpen) {
target.hasOpen = true;
}
},
// 遍历路由的所有页面,把含有iframeComponent标识的收集起来
getComponentsArr(arr, menus) {
for (let i = 0; i < menus.length; i++) {
const menu = menus[i];
if (menu.children.length) {
const tempArr = []
this.getComponentsArr(tempArr, menu.children)
arr.push(...tempArr)
} else {
arr.push({
name: menu.value,
path: menu.path,
hasOpen: false, // 是否打开过,默认false
})
}
}
}
}
}; };
</script> </script>
......
...@@ -14,10 +14,11 @@ const generateMenuTree = (menus) => { ...@@ -14,10 +14,11 @@ const generateMenuTree = (menus) => {
} else { } else {
arr.push({ arr.push({
name: menu.label, name: menu.label,
value: 'dzsys-' + menu.value,
path: '/business/dzsys/' + menu.value, path: '/business/dzsys/' + menu.value,
isDz: true, isDz: true,
icon: "el-icon-document", icon: "el-icon-document",
children: [] children: []
}) })
} }
} }
...@@ -25,16 +26,16 @@ const generateMenuTree = (menus) => { ...@@ -25,16 +26,16 @@ const generateMenuTree = (menus) => {
} }
export const getDzSysMenu = () => { export const getDzSysMenu = () => {
const menuStr = window.sessionStorage.getItem('menu') const menuStr = window.sessionStorage.getItem('menu')
if (!menuStr) { if (!menuStr) {
return null; return null;
} }
const menusConfig = JSON.parse(menuStr); const menusConfig = JSON.parse(menuStr);
// menusConfig.unshift( { id: null, label: "登陆", value: "login", subMenu: [] } ) // menusConfig.unshift( { id: null, label: "登陆", value: "login", subMenu: [] } )
return { return {
name: '电证系统', name: '电证系统',
index: 'dzsys', index: 'dzsys',
path: 'dzsys', path: 'dzsys',
children: generateMenuTree(menusConfig) children: generateMenuTree(menusConfig)
} }
} }
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
placeholder="请选择" placeholder="请选择"
> >
<el-option <el-option
v-for="item in codes.uiltxt" v-for="item in codes.uiltxt1"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
......
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