Commit 295fd996 authored by 徐一鸣's avatar 徐一鸣

服务管理优化

parent 5e81398d
<template> <template>
<div class="fwgl_container"> <div class="fwgl_container">
<side-nav-bar :nav-list="navList" :title-path="navList[0].path"></side-nav-bar> <side-nav-bar
:nav-list="navList"
:title-path="navList[0] && navList[0].path"
></side-nav-bar>
<div class="main_container"> <div class="main_container">
<router-view <router-view
:key="'type_' + $route.params && $route.params.type" :key="'type_' + $route.params && $route.params.type"
...@@ -18,66 +21,75 @@ export default { ...@@ -18,66 +21,75 @@ export default {
}, },
data: () => ({ data: () => ({
navList: [], navList: [],
userLevel: 0,
}), }),
mounted() { watch: {
this.navList = [ "$route.fullPath"(path) {
this.initNavList();
},
},
methods: {
initNavList() {
let level = parseInt(this.$route.params.level);
// 普通用户 // 普通用户
{ if (level == 0) {
level: 0, this.navList = [
name: "注册发布的服务", {
path: "/fwgl/list/0/注册发布的服务", name: "注册发布的服务",
}, path: `/fwgl/list/${level}/0`,
{ },
level: 0, {
name: "申请的服务", name: "申请的服务",
path: "/fwgl/list/1/申请的服务", path: `/fwgl/list/${level}/1`,
}, },
{ {
level: 0, name: "审批的服务",
name: "审批的服务", path: `/fwgl/list/${level}/2`,
path: "/fwgl/list/2/审批的服务", },
}, {
{ name: "云资源服务",
level: 0, path: `/fwgl/list/${level}/3`,
name: "云资源服务", },
path: "/fwgl/list/3/云资源服务", ];
}, }
// 组织管理员 // 组织管理员
{ else if (level == 1) {
level: 1, this.navList = [
name: "组织服务管理", {
path: "/fwgl/list/4/组织服务管理", name: "组织服务管理",
}, path: `/fwgl/list/${level}/0`,
{ },
level: 1, {
name: "服务审批管理", name: "服务审批管理",
path: "/fwgl/list/5/服务审批管理", path: `/fwgl/list/${level}/1`,
}, },
{ {
level: 1, name: "云资源管理",
name: "云资源管理", path: `/fwgl/list/${level}/2`,
path: "/fwgl/list/6/云资源管理", },
}, ];
}
// 超级管理员 // 超级管理员
{ else if (level == 2) {
level: 2, this.navList = [
name: "平台服务管理", {
path: "/fwgl/list/7/平台服务管理", name: "平台服务管理",
}, path: `/fwgl/list/${level}/0`,
{ },
level: 2, {
name: "服务审批管理", name: "服务审批管理",
path: "/fwgl/list/8/服务审批管理", path: `/fwgl/list/${level}/1`,
}, },
{ {
level: 2, name: "云资源管理",
name: "云资源管理", path: `/fwgl/list/${level}/2`,
path: "/fwgl/list/9/云资源管理", },
}, ];
].filter((nav) => nav.level === this.userLevel); }
},
this.$router.push(this.navList[0].path); },
mounted() {
this.initNavList();
}, },
}; };
</script> </script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
class="r_yhgl_table" class="r_yhgl_table"
size="mini" size="mini"
url="tableData" url="tableData"
detailsUrl="/fwgl/servicedetail/" :detailsUrl="`/fwgl/servicedetail/${$route.params.level}/`"
:border="false" :border="false"
:headers="headers" :headers="headers"
:searchShow="true" :searchShow="true"
...@@ -104,7 +104,7 @@ export default { ...@@ -104,7 +104,7 @@ export default {
this.$refs.myConfirm.showModel(); this.$refs.myConfirm.showModel();
}, },
editItem(item) { editItem(item) {
this.$router.push("/fwgl/serviceedit/" + item.id); this.$router.push(`/fwgl/serviceedit/${this.$route.params.level}/${item.id}`);
}, },
soldOutItem(item) { soldOutItem(item) {
this.confirmOptions.title = "是否删除该条服务?"; this.confirmOptions.title = "是否删除该条服务?";
...@@ -132,161 +132,158 @@ export default { ...@@ -132,161 +132,158 @@ export default {
}, },
}, },
mounted() { mounted() {
switch (parseInt(this.$route.params.type)) { let level = parseInt(this.$route.params.level);
case 0: let type = parseInt(this.$route.params.type);
this.headers = [
{ label: "服务名称", prop: "name", type: "href", align: "left" }, if (level == 0 && type == 0) {
{ label: "服务url", prop: "date", type: "", align: "center" }, this.headers = [
{ label: "开放程度", prop: "address", type: "", align: "center" }, { label: "服务名称", prop: "name", type: "href", align: "left" },
{ label: "服务描述", prop: "address", type: "", align: "left" }, { label: "服务url", prop: "date", type: "", align: "center" },
{ { label: "开放程度", prop: "address", type: "", align: "center" },
label: "注册发布时间", { label: "服务描述", prop: "address", type: "", align: "left" },
prop: "address", {
type: "", label: "注册发布时间",
align: "center", prop: "address",
}, type: "",
{ label: "服务类型", prop: "address", type: "", align: "center" }, align: "center",
{ },
label: "操作", { label: "服务类型", prop: "address", type: "", align: "center" },
type: "Button", {
align: "center", label: "操作",
width: 240, type: "Button",
btnList: [ align: "center",
{ width: 240,
type: "action-edit", btnList: [
label: "编辑", {
line: "|", type: "action-edit",
}, label: "编辑",
{ line: "|",
type: "action-sold-out", },
label: "申请下架", {
line: "|", type: "action-sold-out",
}, label: "申请下架",
{ line: "|",
type: "action-delete", },
label: "删除", {
}, type: "action-delete",
], label: "删除",
}, },
]; ],
break; },
case 1: ];
this.headers = [ } else if (level == 0 && type == 1) {
{ label: "服务名称", prop: "name", type: "href", align: "left" }, this.headers = [
{ label: "服务领域", prop: "date", type: "", align: "center" }, { label: "服务名称", prop: "name", type: "href", align: "left" },
{ label: "开放程度", prop: "address", type: "", align: "center" }, { label: "服务领域", prop: "date", type: "", align: "center" },
{ label: "服务描述", prop: "address", type: "", align: "left" }, { label: "开放程度", prop: "address", type: "", align: "center" },
{ label: "申请时间", prop: "address", type: "", align: "left" }, { label: "服务描述", prop: "address", type: "", align: "left" },
{ label: "服务类型", prop: "address", type: "", align: "center" }, { label: "申请时间", prop: "address", type: "", align: "left" },
{ { label: "服务类型", prop: "address", type: "", align: "center" },
label: "操作", {
type: "Button", label: "操作",
align: "center", type: "Button",
width: 160, align: "center",
btnList: [ width: 160,
{ btnList: [
type: "action-cancel", {
label: "取消", type: "action-cancel",
line: "|", label: "取消",
}, line: "|",
{ },
type: "action-delete", {
label: "删除", type: "action-delete",
}, label: "删除",
], },
}, ],
]; },
break; ];
case 2: } else if (level == 0 && type == 2) {
this.headers = [ this.headers = [
{ label: "服务名称", prop: "name", type: "href", align: "left" }, { label: "服务名称", prop: "name", type: "href", align: "left" },
{ label: "服务领域", prop: "address", type: "", align: "center" }, { label: "服务领域", prop: "address", type: "", align: "center" },
{ label: "开放程度", prop: "address", type: "", align: "center" }, { label: "开放程度", prop: "address", type: "", align: "center" },
{ label: "请求方式", prop: "address", type: "", align: "center" }, { label: "请求方式", prop: "address", type: "", align: "center" },
{ label: "服务描述", prop: "address", type: "", align: "left" }, { label: "服务描述", prop: "address", type: "", align: "left" },
{ label: "审批时间", prop: "address", type: "", align: "center" }, { label: "审批时间", prop: "address", type: "", align: "center" },
{ label: "服务类型", prop: "address", type: "", align: "center" }, { label: "服务类型", prop: "address", type: "", align: "center" },
{ label: "审批状态", prop: "address", type: "", align: "center" }, { label: "审批状态", prop: "address", type: "", align: "center" },
{ {
label: "操作", label: "操作",
type: "Button", type: "Button",
align: "center", align: "center",
width: 160, width: 160,
btnList: [ btnList: [
{ {
type: "action-examine", type: "action-examine",
label: "审批", label: "审批",
line: "|", line: "|",
}, },
{ {
type: "action-delete", type: "action-delete",
label: "删除", label: "删除",
}, },
], ],
}, },
]; ];
break; } else if (level == 0 && type == 2) {
case 3: this.headers = [
this.headers = [ { label: "工作区域", prop: "name", type: "href", align: "left" },
{ label: "工作区域", prop: "name", type: "href", align: "left" }, { label: "网络环境", prop: "name", type: "", align: "center" },
{ label: "网络环境", prop: "name", type: "", align: "center" }, { label: "CPU(核)", prop: "name", type: "", align: "center" },
{ label: "CPU(核)", prop: "name", type: "", align: "center" }, { label: "内存(GB)", prop: "name", type: "", align: "center" },
{ label: "内存(GB)", prop: "name", type: "", align: "center" }, { label: "资源总量(GB)", prop: "name", type: "", align: "center" },
{ label: "资源总量(GB)", prop: "name", type: "", align: "center" }, { label: "实例数(个)", prop: "name", type: "", align: "center" },
{ label: "实例数(个)", prop: "name", type: "", align: "center" }, { label: "申请时间", prop: "name", type: "", align: "center" },
{ label: "申请时间", prop: "name", type: "", align: "center" }, { label: "申请状态", prop: "name", type: "", align: "center" },
{ label: "申请状态", prop: "name", type: "", align: "center" }, {
{ label: "操作",
label: "操作", type: "Button",
type: "Button", align: "center",
align: "center", width: 160,
width: 160, btnList: [
btnList: [ {
{ type: "action-detail",
type: "action-detail", label: "查看详情",
label: "查看详情", },
}, ],
], },
}, ];
]; } else {
break; this.headers = [
default: { label: "服务名称", prop: "name", type: "href", align: "left" },
this.headers = [ { label: "服务url", prop: "date", type: "", align: "center" },
{ label: "服务名称", prop: "name", type: "href", align: "left" }, { label: "开放程度", prop: "address", type: "", align: "center" },
{ label: "服务url", prop: "date", type: "", align: "center" }, { label: "服务描述", prop: "address", type: "", align: "left" },
{ label: "开放程度", prop: "address", type: "", align: "center" }, {
{ label: "服务描述", prop: "address", type: "", align: "left" }, label: "注册发布时间",
{ prop: "address",
label: "注册发布时间", type: "",
prop: "address", align: "center",
type: "", },
align: "center", { label: "服务类型", prop: "address", type: "", align: "center" },
}, {
{ label: "服务类型", prop: "address", type: "", align: "center" }, label: "操作",
{ type: "Button",
label: "操作", align: "center",
type: "Button", width: 240,
align: "center", btnList: [
width: 160, {
btnList: [ type: "action-edit",
{ label: "编辑",
type: "action-edit", line: "|",
label: "编辑", },
line: "|", {
}, type: "action-sold-out",
{ label: "申请下架",
type: "action-sold-out", line: "|",
label: "申请下架", },
line: "|", {
}, type: "action-delete",
{ label: "删除",
type: "action-delete", },
label: "删除", ],
}, },
], ];
},
];
break;
} }
}, },
}; };
......
...@@ -58,23 +58,23 @@ export default new Router({ ...@@ -58,23 +58,23 @@ export default new Router({
], ],
}, },
{ {
path: "/fwgl", // 服务管理 path: "/fwgl/:level", // 服务管理 level:用户等级
name: "fwgl", name: "fwgl",
// redirect: "/fwgl/list", redirect: "/fwgl/list/:level/0",
component: () => import("@/pages/fwgl"), component: () => import("@/pages/fwgl"),
children: [ children: [
{ {
path: "/fwgl/list/:type/:name", // 服务管理/我的服务 path: "/fwgl/list/:level/:type", // 服务管理/我的服务
name: "fwglList", name: "fwglList",
component: () => import("@/pages/fwglList"), component: () => import("@/pages/fwglList"),
}, },
{ {
path: "/fwgl/servicedetail/:id", path: "/fwgl/servicedetail/:level/:id",
name: "servicedetail", name: "servicedetail",
component: () => import("@/pages/serviceDetail"), component: () => import("@/pages/serviceDetail"),
}, },
{ {
path: "/fwgl/serviceedit/:id", path: "/fwgl/serviceedit/:level/:id",
name: "serviceedit", name: "serviceedit",
component: () => import("@/pages/serviceEdit"), component: () => import("@/pages/serviceEdit"),
}, },
...@@ -105,17 +105,17 @@ export default new Router({ ...@@ -105,17 +105,17 @@ export default new Router({
{ {
path: "/example_topology", // 拓扑图实例 path: "/example_topology", // 拓扑图实例
name: "example_topology", name: "example_topology",
component: () => import("@/pages/example_topology") component: () => import("@/pages/example_topology"),
}, },
{ {
path: "/example_commodity", // 商品详情实例 path: "/example_commodity", // 商品详情实例
name: "example_commodity", name: "example_commodity",
component: () => import("@/pages/example_commodity") component: () => import("@/pages/example_commodity"),
}, },
{ {
path: "/example_com_list", // 商品列表实例 path: "/example_com_list", // 商品列表实例
name: "example_com_list", name: "example_com_list",
component: () => import("@/pages/example_com_list") component: () => import("@/pages/example_com_list"),
} },
] ],
}); });
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