Commit c8bd797d authored by renjintao's avatar renjintao

bug

parent 19655e94
<template>
<div class="ib">
<div class="ib" v-if="!isMore">
<span v-if="type=='text'" :style="style">{{name}}</span>
<Tag v-if="type=='tag'" :color="tagcolor">{{name}}</Tag>
<Badge v-if="type=='dot'" :color="tagcolor" :text="name" />
<Icon v-if="type=='icon'" :type="item.icon" :color="tagcolor" :title="name" size="24" />
</div>
<div class="ib" v-else v-for="(li,i) in items" :key="i">
<span v-if="type=='text'" :style="li.style">{{li.name}}</span>
<Tag v-if="type=='tag'" :color="li.tagcolor">{{li.name}}</Tag>
<Badge v-if="type=='dot'" :color="li.tagcolor" :text="li.name" />
&nbsp;
</div>
<div class="ib" v-if="!isMore">
<span v-if="type=='text'" :style="style">{{name}}</span>
<Tag v-if="type=='tag'" :color="tagcolor">{{name}}</Tag>
<Badge v-if="type=='dot'" :color="tagcolor" :text="name" />
<Icon v-if="type=='icon'" :type="item.icon" :color="tagcolor" :title="name" size="24" />
</div>
<div class="ib" v-else v-for="(li,i) in items" :key="i">
<span v-if="type=='text'" :style="li.style">{{li.name}}</span>
<Tag v-if="type=='tag'" :color="li.tagcolor">{{li.name}}</Tag>
<Badge v-if="type=='dot'" :color="li.tagcolor" :text="li.name" />
&nbsp;
</div>
</div>
</template>
<script>
export default {
name: 'state',
data() {
return {
name: '',
isMore:false,
item: {},
items: [],
data: []
}
},
props: {
default: {
type: String,
default: ''
},
type: {
type: String,
default: 'text',
validator: function(value) {
return ['text', 'tag', 'dot','icon'].indexOf(value) != -1
}
},
code: {
type: String,
required: true
},
value: {
type: [String, Number],
required: false
name: 'state',
data() {
return {
name: '',
isMore: false,
item: {},
items: [],
data: []
}
},
color: {
type: Boolean,
default: true
props: {
default: {
type: String,
default: ''
},
type: {
type: String,
default: 'text',
validator: function (value) {
return ['text', 'tag', 'dot', 'icon'].indexOf(value) != -1
}
},
code: {
type: String,
required: true
},
value: {
type: [String, Number],
required: false
},
color: {
type: Boolean,
default: true
},
icon: {
type: Boolean,
default: false
},
img: {
type: Boolean,
default: false
}
},
icon: {
type: Boolean,
default: false
created() {
this.data = this.$store.getters.dictionaryByKey(this.code) || []
},
img: {
type: Boolean,
default: false
}
},
created() {
this.data = this.$store.getters.dictionaryByKey(this.code) || []
},
methods: {
setName(v) {
if ((v+"").indexOf(',')==-1) {
var item
this.data.map((u) => {
if (u.code == v) {
item = u
}
})
if (item) {
this.name = item.name
this.item = item
} else {
this.name = this.value
methods: {
setName(v) {
if ((v + "").indexOf(',') == -1) {
var item
this.data.map((u) => {
if (u.code == v) {
item = u
}
})
if (item) {
this.name = item.name
this.item = item
} else {
if (!this.value && typeof (this.value) != "undefined") {
this.name = this.value
} else {
this.name = ''
}
}
} else {
this.isMore = true;
var items = [];
var ul = (v + "").split(',')
this.data.map((u) => {
if (ul.indexOf(u.code) > -1) {
u.tagcolor = u.color | 'default'
u.style = {
color: u.color | 'inherit'
}
items.push(u)
}
})
this.items = items;
}
}
} else {
this.isMore=true;
var items=[];
var ul=(v+"").split(',')
this.data.map((u) => {
if (ul.indexOf(u.code)>-1) {
u.tagcolor=u.color|'default'
u.style={color: u.color|'inherit'}
items.push(u)
}
})
this.items=items;
}
}
},
computed: {
tagcolor() {
if (
this.color &&
this.item &&
this.item.color != '' &&
this.item.color != null
) {
return this.item.color
}
return 'default'
},
style() {
if (!this.color) {
return {}
}
return {
color:
this.item && this.item.color != '' && this.item.color != null
? this.item.color
: 'inherit'
}
}
},
watch: {
value(v) {
this.setName(v)
// this.$forceUpdate()
computed: {
tagcolor() {
if (
this.color &&
this.item &&
this.item.color != '' &&
this.item.color != null
) {
return this.item.color
}
return 'default'
},
style() {
if (!this.color) {
return {}
}
return {
color: this.item && this.item.color != '' && this.item.color != null ?
this.item.color : 'inherit'
}
}
},
data(v){
if(v.length>0){
this.setName(this.value)
this.$forceUpdate()
}
watch: {
value(v) {
this.setName(v)
// this.$forceUpdate()
},
data(v) {
if (v.length > 0) {
this.setName(this.value)
this.$forceUpdate()
}
}
}
}
}
</script>
\ No newline at end of file
</script>
<template>
<MainLayout />
<MainLayout />
</template>
<script>
import MainLayout from "./basic-layout";
// 配置
import Setting from "@/setting";
// 方法
import { getHeaderName, getMenuSider, getSiderSubmenu } from "@/libs/system";
import {
getHeaderName,
getMenuSider,
getSiderSubmenu
} from "@/libs/system";
// 菜单和路由
import menuHeader from "@/menu/header";
import menuSider from "@/menu/sider";
import { frameInRoutes } from "@/router/routes";
import {
frameInRoutes
} from "@/router/routes";
export default {
middleware: "auth",
components: { MainLayout },
data() {
return {
menus: []
};
},
created() {
// 处理路由 得到每一级的路由设置
this.$store.commit("admin/page/init", frameInRoutes);
// 设置顶栏菜单
this.$store.commit("admin/menu/setHeader", menuHeader);
// 加载用户登录的数据
this.$store.dispatch("admin/account/load");
// 初始化全屏监听
this.$store.dispatch("admin/layout/listenFullscreen");
},
mounted() {
this.getMenu();
},
watch: {
// 监听路由 控制侧边栏显示 标记当前顶栏菜单(如需要)
$route(to, from) {
let path = to.matched[to.matched.length - 1].path;
if (!Setting.dynamicSiderMenu) {
let headerName = getHeaderName(path, menuSider);
if (headerName === null) {
path = to.path;
headerName = getHeaderName(path, menuSider);
}
// 在 404 时,是没有 headerName 的
if (headerName !== null) {
this.$store.commit("admin/menu/setHeaderName", headerName);
middleware: "auth",
components: {
MainLayout
},
data() {
return {
menus: []
};
},
created() {
// 处理路由 得到每一级的路由设置
this.$store.commit("admin/page/init", frameInRoutes);
// 设置顶栏菜单
this.$store.commit("admin/menu/setHeader", menuHeader);
// 加载用户登录的数据
this.$store.dispatch("admin/account/load");
// 初始化全屏监听
this.$store.dispatch("admin/layout/listenFullscreen");
},
mounted() {
this.getMenu();
},
watch: {
// 监听路由 控制侧边栏显示 标记当前顶栏菜单(如需要)
$route(to, from) {
let path = to.matched[to.matched.length - 1].path;
if (!Setting.dynamicSiderMenu) {
let headerName = getHeaderName(path, menuSider);
if (headerName === null) {
path = to.path;
headerName = getHeaderName(path, menuSider);
}
// 在 404 时,是没有 headerName 的
if (headerName !== null) {
this.$store.commit("admin/menu/setHeaderName", headerName);
const filterMenuSider = getMenuSider(menuSider, headerName);
this.$store.commit("admin/menu/setSider", filterMenuSider);
this.$store.commit("admin/menu/setActivePath", to.path);
const filterMenuSider = getMenuSider(menuSider, headerName);
this.$store.commit("admin/menu/setSider", filterMenuSider);
this.$store.commit("admin/menu/setActivePath", to.path);
const openNames = getSiderSubmenu(path, menuSider);
this.$store.commit("admin/menu/setOpenNames", openNames);
const openNames = getSiderSubmenu(path, menuSider);
this.$store.commit("admin/menu/setOpenNames", openNames);
}
} else {
let menus = this.$store.state.admin.menu.sider;
this.$store.commit("admin/menu/setActivePath", to.path);
const openNames = getSiderSubmenu(path, menus);
this.$store.commit("admin/menu/setOpenNames", openNames);
}
// this.appRouteChange(to, from);
}
} else {
let menus = this.$store.state.admin.menu.sider;
this.$store.commit("admin/menu/setActivePath", to.path);
const openNames = getSiderSubmenu(path, menus);
this.$store.commit("admin/menu/setOpenNames", openNames);
}
// this.appRouteChange(to, from);
}
},
methods: {
},
methods: {
getMenu() {
this.$http.sysUser.getusermenu({id:"portal"}).then(res => {
if (res.result) {
this.menus = res.result[0].children;
this.toMenu(this.menus);
let headerName = "home";
this.$store.commit("admin/menu/setHeaderName", headerName);
this.$store.commit("admin/page/init", this.menus);
const filterMenuSider = getMenuSider(this.menus, headerName);
this.$store.commit("admin/menu/setSider", filterMenuSider);
// if (to) {
// this.$store.commit("admin/menu/setActivePath", to.path);
// }
getMenu() {
this.$http.sysUser.getusermenu({
id: "portal"
}).then(res => {
if (res.result) {
this.menus = res.result[0].children;
this.toMenu(this.menus);
let headerName = "home";
this.$store.commit("admin/menu/setHeaderName", headerName);
this.$store.commit("admin/page/init", this.menus);
const filterMenuSider = getMenuSider(this.menus, headerName);
this.$store.commit("admin/menu/setSider", filterMenuSider);
// if (to) {
// this.$store.commit("admin/menu/setActivePath", to.path);
// }
// const openNames = getSiderSubmenu(path, menuSider);
// this.$store.commit("admin/menu/setOpenNames", openNames);
} else {
this.$Message.error("加载产品树失败!");
}
});
},
toMenu(list) {
list.forEach(datas => {
var that = this;
var listObj = {};
datas.path = datas.url;
let name = datas.url.replace(/\//g, "-");
datas.header = "home";
delete datas.target;
if (name.substr(0, 1) == "-") {
name = name.substr(1);
}
if (name.charAt(name.length - 1) == "-") {
name = name.substr(0, name.length - 1);
}
datas.meta = {
auth: false,
title: datas.title,
closable: true
};
datas.name = name;
if (datas.children != null) {
this.toMenu(datas.children);
// const openNames = getSiderSubmenu(path, menuSider);
// this.$store.commit("admin/menu/setOpenNames", openNames);
} else {
this.$Message.error("加载产品树失败!");
}
});
},
toMenu(list) {
list.forEach(datas => {
var that = this;
var listObj = {};
datas.path = datas.url;
let name = datas.url.replace(/\//g, "-");
datas.header = "home";
delete datas.target;
if (name.substr(0, 1) == "-") {
name = name.substr(1);
}
if (name.charAt(name.length - 1) == "-") {
name = name.substr(0, name.length - 1);
}
datas.meta = {
auth: false,
title: datas.title,
closable: true
};
datas.name = name;
if (datas.children != null) {
this.toMenu(datas.children);
}
});
this.menusNew = list;
}
});
this.menusNew = list;
}
}
};
</script>
\ No newline at end of file
</script>
......@@ -302,6 +302,7 @@ export default {
key: "licensedToWork",
title: this.l("licensedToWork"),
align: "left",
code: "User.base.workLicense",
},
{
key: "positionId",
......
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