Commit f75599bb authored by 徐一鸣's avatar 徐一鸣

Merge branch 'dev' into xym

parents aa97492c 5169da0d
......@@ -24,10 +24,12 @@
</ul>
</div>
<div class="state_detail">
<p
v-text="currentState.content"
style="text-align: center;margin-top: 20px;"
></p>
<div class="state_message">
<p v-for="(text, index) in currentState.content" :key="index">
<span v-text="index + 1"></span>
<span v-text="text"></span>
</p>
</div>
</div>
</div>
</template>
......@@ -84,7 +86,6 @@ export default {
return;
}
console.log(state);
this.selectedState = state;
},
},
......@@ -134,10 +135,30 @@ export default {
.state_detail {
height: 500px;
flex-grow: 1;
padding: 25px 40px;
border-radius: 7px;
background-color: #f8f9fd;
overflow: hidden;
}
.state_message {
height: 100%;
overflow: auto;
}
.state_message > p {
white-space: nowrap;
padding: 10px 0;
}
.state_message > p > span {
display: inline-block;
vertical-align: middle;
font-size: 14px;
line-height: 22px;
color: #242c43;
}
.state_message > p > span:first-child {
width: 65px;
color: #8890a7;
}
.icon_and_text > * {
display: inline-block;
vertical-align: middle;
......
......@@ -6,39 +6,42 @@
{{ item.title }}
</p>
<p v-if="!(item.prop && item.prop == 'title')">
<span v-if="item.type == 'url'" style="white-space:pre-wrap;"
>访问地址: <a :href="item.info" target="_blank">{{ item.info }}</a></span
>
<span v-if="item.type == 'url'" style="white-space:pre-wrap;">
访问地址:
<a :href="item.info" target="_blank">{{ item.info }}</a>
</span>
<span v-else v-html="item.info" style="white-space:pre-wrap;"></span>
<span v-if="item.type && item.type == 'down'" class="filebtn" @click="download(item.url)"
>下载文件</span
>
<span
v-if="item.type && item.type == 'down'"
class="filebtn"
@click="download(item.url)"
>下载文件</span>
</p>
<slot
v-if="item.type && item.type == 'solt'"
:name="item.solt_name"
></slot>
<slot v-if="item.type && item.type == 'solt'" :name="item.solt_name"></slot>
</div>
</div>
</template>
<script>
import helper from "@/services/helper";
export default {
data() {
return {};
return {
helper: helper
};
},
props: ["list_arr"],
mounted() {
console.log(this.$slots);
},
methods:{
download(val){
// this.$emit('download',val)
console.log(val);
const a = document.createElement('a'); // 创建a标签
a.setAttribute('download', '');// download属性
a.setAttribute('href', val);// href链接
a.click();// 自执行点击事件
}
methods: {
download(val) {
// this.$emit('download',val)
console.log(val);
const a = document.createElement("a"); // 创建a标签
a.setAttribute("download", ""); // download属性
a.setAttribute("href", val); // href链接
a.click(); // 自执行点击事件
}
}
};
</script>
......
<template>
<!--
this page will be destoryed after userRoles is available
-->
<div class="menu">
<img src="../assets/imgs/home_img_logo.png" alt class="logo" />
<div style="float:right;cursor: pointer;position:relative;" class="user_hover">
<span
v-if="userInfo.user_name && userInfo.user_name !=''"
class="user"
>{{ userInfo.user_name }}</span>
<span v-else @click="gotopage('login')" class="user">请登录</span>
<img
:class="userInfo.picture_path ? 'user_pic': 'user_default'"
:src="
userInfo.picture_path || require('../assets/imgs/home_ic_user.png')
"
/>
<div v-if="userInfo.user_name && userInfo.user_name !=''" class="user_menu">
<div
v-for="(item, index) in user_arr"
:key="index + 700"
@click="gotopage(item.path)"
>{{ item.name }}</div>
</div>
<div v-if="userInfo.user_name && userInfo.user_name !=''" class="sj"></div>
</div>
<div
style="float:right;cursor: pointer;position:relative;"
class="shop_hover"
@click="gotopage('/shop/shopping_cart')"
>
<div class="car">
<el-badge v-if="menuCartNum != 0" :value="menuCartNum" :max="99" class="number"></el-badge>
<img src="../assets/imgs/home_ic_shop.png" alt class="car_img" />
</div>
<div v-if="userInfo.user_name && userInfo.user_name !=''" class="shop_menu">
<div class="shop_list_title">最近加入的服务:</div>
<div
v-for="(item, index) in shopping_list"
:key="'shopping' + index"
class="shop_list_cell shop_line"
>
<img :src="item.service.cover" class="shop_img" />
<div class="shop_cell_msgs">
<p @click="getDetail(item.id)" class="shop_cell_name over_one">
{{
item.service_id == 0
? item.application.app_name
: item.service.name
}}
</p>
<p class="shop_cell_msg bover_one">
{{
item.service_id == 0
? item.application.ywly
: item.service.sectors_name
}}
</p>
<p class="shop_cell_msg over_one">
{{
item.service_id == 0
? item.application.org
: item.service.organization_name
}}
</p>
</div>
<div>
<img @click.stop="deleteItem(item.id)" src="../assets/imgs/ic_delete.png" alt />
</div>
</div>
<div class="shop_footer">
<el-button @click="settlement" size="small" class="shop_settlement">去购物车申请结算</el-button>
</div>
</div>
<div v-if="userInfo.user_name && userInfo.user_name !=''" class="shop_sj"></div>
</div>
<div style="float:right">
<div
v-for="(item, index) in menu_arr"
:key="index + 200"
class="menu_box user_hover"
@click="navAction(index, item.visit_url)"
:style="{ color: now_menu == index ? '#fff' : '' }"
>
{{ item.menu_name }}
<div class="user_menu" v-if="item.Child && item.Child.length" style="left: 30px;">
<div
v-for="(v, indexs) in item.Child"
:key="indexs + 700"
@click.stop="gotoChildPage(v, index)"
>{{ v.menu_name }}</div>
</div>
<div class="sj" v-if="item.Child && item.Child.length" style="left: 60px;"></div>
<div class="bottom_show" v-if="now_menu == index"></div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
menu_arr: [
// {
// name: "工作台",
// path: "/workplace",
// children: [
// {
// name: "服务注册",
// path: "/fwzc/fwcs"
// },
// {
// name: "服务管理",
// path: "/fwgl/"
// },
// {
// name: "应用管理",
// path: "/yygl/"
// }
// ]
// },
// {
// name: "技术支持",
// path: "/xxx"
// },
// {
// name: "服务超市",
// path: "/services_shop",
// children: [
// {
// name: "数据服务",
// path: "/shop/data_service_list/5"
// },
// {
// name: "时空服务",
// path: "/shop/space_time_service_list/6"
// },
// {
// name: "视频服务",
// path: "/shop/video_service_list/7"
// },
// {
// name: "感知服务",
// path: "/shop/perception_service_list/10"
// },
// {
// name: "综合应用",
// path: "/shop/comprehensive_app_list/11"
// },
// {
// name: "云资源服务",
// path: "/shop/cloud"
// },
// {
// name: "应用商店",
// path: "/shop/app_store_list/12"
// }
// ]
// }
],
now_menu: 2,
user_arr: [
{ name: "个人档案", path: "/user/user_info" },
{ name: "消息通知", path: "/user/message" },
{ name: "收银中心", path: "" },
{ name: "关于BD-aPaaS", path: "" },
{ name: "退出登录", path: "logout" }
],
shopping_list: [],
menuCartNum: 0
};
},
mounted() {
this.getNowMenu();
this.getList();
},
computed: {
getMenuCartState() {
return this.$store.state.menuCartState;
},
userInfo() {
return this.$store.state.userInfo || {};
}
},
watch: {
getMenuCartState(newVal) {
this.getList();
}
},
methods: {
gotopage(n) {
if (n == "logout") {
window.location.href = "/iam/api/logout";
} else if (n == "login") {
let path = this.$route.path;
window.location.href = "/iam/login/#/login?ReturnUrl=" + path;
} else {
this.$router.push(n);
}
},
settlement() {
this.$router.push({ name: "shoppingCart" });
},
deleteItem(id) {
let query = [id];
this.$api.serviceShop.delShoppingCart(query).then(response => {
this.getList();
});
},
getDetail() {
// if you want goto detail page, you should give me the type at first
// at here, we will goto shopping cart
this.$router.push({ name: "shoppingCart" });
},
navAction(index, path) {
this.$router.push(path);
this.now_menu = index;
window.sessionStorage.setItem("menuIndex", index);
},
gotoChildPage(v, parent) {
if (v.visit_url) {
if (v.visit_url == "/fwgl/" || v.visit_url == "/yygl/") {
this.$router.push(v.visit_url + this.$store.getters.level);
} else if (parent == 2) {
this.$router.push(v.visit_url);
this.$store.commit("serviceShopMenuAct", v.visit_url);
} else {
this.$router.push(v.visit_url);
}
this.now_menu = parent;
window.sessionStorage.setItem("menuIndex", parent);
}
},
getList() {
this.$api.serviceShop.getShoppingCart().then(response => {
if (response.data.success == "1") {
this.menuCartNum = response.data.data.valid
? response.data.data.valid.length
: 0;
this.shopping_list = response.data.data.valid
? response.data.data.valid.slice(0, 3)
: [];
} else {
console.log(response.data.message);
}
});
},
getMenuIndex() {
let index = window.sessionStorage.getItem("menuIndex");
console.log(index);
this.now_menu = index ? index : 2;
},
getNowMenu() {
this.$api.general.getNowMenu({ teamName: "APAAS3" }).then(response => {
if (response.data.success == 1) {
this.menu_arr = response.data.data[0].Child;
this.getMenuIndex();
}
});
}
}
};
</script>
<style scoped>
.menu {
width: 100%;
height: 84px;
background-color: #0f2683;
color: #8390ee;
line-height: 84px;
}
.logo {
float: left;
margin: 30px 0 0 40px;
}
.user {
float: right;
display: inline-block;
width: 140px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 20px;
font-size: 16px;
}
.user_pic {
float: right;
margin-right: 10px;
margin-top: 26px;
width: 30px;
height: 30px;
}
.user_default {
float: right;
margin-right: 10px;
margin-top: 30px;
}
.car {
float: right;
width: 50px;
text-align: center;
position: relative;
}
.number {
position: absolute;
background-color: #e56600;
border-radius: 11px;
color: #fcefd6;
line-height: 18px;
height: 20px;
text-align: center;
left: 38px;
top: 26px;
z-index: 2;
}
.car_img {
position: relative;
top: 7px;
}
.menu_box {
float: right;
width: 185px;
text-align: center;
cursor: pointer;
position: relative;
}
.menu_box:nth-of-type(1) {
margin-right: 52px;
}
.bottom_show {
width: 24px;
height: 5px;
background-color: #e56600;
border-radius: 3px;
position: absolute;
bottom: 0px;
left: calc(50% - 12px);
}
.user_menu {
width: 135px;
background-color: #ffffff;
box-shadow: 0px 3px 6px 0px #f4f7fc;
border-radius: 8px;
position: absolute;
top: 80px;
left: -20px;
overflow: hidden;
display: none;
z-index: 1;
}
.shop_menu {
width: 280px;
background-color: #ffffff;
box-shadow: 0px 3px 6px 0px #f4f7fc;
border-radius: 8px;
position: absolute;
top: 80px;
left: -20px;
overflow: hidden;
display: none;
z-index: 1;
padding: 10px 20px;
}
.user_hover:hover .user_menu {
display: block;
}
.user_hover:hover .sj {
display: block;
}
.shop_hover {
height: 100%;
margin-right: 50px;
}
.shop_hover:hover .shop_menu {
display: block;
}
.shop_hover:hover .shop_sj {
display: block;
}
.user_menu div {
width: 135px;
height: 44px;
line-height: 44px;
text-align: center;
color: #0d1847;
}
.user_menu div:hover {
background-color: #e56600;
color: #fff;
}
.sj {
width: 16px;
height: 16px;
background-color: #e56600;
position: absolute;
top: 72px;
transform: rotate(45deg);
display: none;
}
.shop_sj {
width: 16px;
height: 16px;
background-color: #fff;
position: absolute;
top: 72px;
left: 20px;
transform: rotate(45deg);
display: none;
}
.shop_list_title {
color: #8890a7;
font-size: 14px;
height: 30px;
line-height: 30px;
}
.shop_list_cell {
height: 80px;
padding: 10px 0;
display: flex;
line-height: 26px;
}
.shop_line {
border-bottom: #f4f7fc 2px solid;
}
.shop_line:nth-last-child(2) {
border-bottom: 0;
}
.shop_img {
width: 60px;
height: 60px;
border-radius: 8px;
}
.shop_footer {
width: 100%;
height: 50px;
text-align: right;
padding: 15px 0;
line-height: 30px;
}
.shop_settlement {
background-color: #e56600;
color: #fcefd6;
}
.shop_cell_msgs {
width: calc(100% - 80px);
margin-left: 10px;
}
.shop_cell_name {
color: #2d3867;
font-size: 14px;
line-height: 24px;
}
.shop_cell_name:hover {
color: #0d0807;
}
.shop_cell_msg {
color: #8890a7;
font-size: 12px;
line-height: 18px;
}
.over_one {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
<style>
.number .el-badge__content {
background-color: #e56600;
border: 0;
line-height: 18px;
padding: 0 7px;
}
</style>
\ No newline at end of file
......@@ -121,7 +121,7 @@ export default {
return;
}
console.log("menu permission init.");
// console.log("menu permission init.");
let permissionsList = this.deepClone(this.list);
let permissions = this.permissions;
......@@ -190,21 +190,38 @@ export default {
this.uppermissions();
},
initPermissionsList() {
this.permissionsList.forEach((item) => {
this.traverse(item, (item) => {
let selected = item.selected;
const getSelectedState = (item) => {
let selected = item.selected;
let child = item.Child || [];
if (item.selected !== 0) {
let allSelcted = true;
if (child.length > 0 && selected !== 0) {
let selectedLength1 = 0;
let selectedLength2 = 0;
item.Child &&
item.Child.forEach((v) => {
allSelcted = v.selected === 0 && allSelcted;
});
child.forEach((v) => {
let v_selected = getSelectedState(v);
this.$set(item, "selected", allSelcted ? 1 : 2);
if (v_selected === 1) {
selectedLength1++;
} else if (v_selected === 2) {
selectedLength2++;
}
});
if (selectedLength1 === child.length) {
selected = 1;
} else if (selectedLength1 + selectedLength2 > 0) {
selected = 2;
}
});
item.selected = selected;
}
return selected;
};
this.permissionsList.forEach((item) => {
getSelectedState(item);
});
// this.$emit("change-list", this.permissionsList);
......
......@@ -78,18 +78,18 @@
v-for="(item, index) in menu_arr"
:key="index + 200"
class="menu_box user_hover"
@click="navAction(index, item.path)"
@click="navAction(index, item.visit_url)"
:style="{ color: now_menu == index ? '#fff' : '' }"
>
{{ item.name }}
<div class="user_menu" v-if="item.children && item.children.length" style="left: 30px;">
{{ item.menu_name }}
<div class="user_menu" v-if="item.Child && item.Child.length" style="left: 30px;">
<div
v-for="(v, indexs) in item.children"
v-for="(v, indexs) in item.Child"
:key="indexs + 700"
@click.stop="gotoChildPage(v, index)"
>{{ v.name }}</div>
>{{ v.menu_name }}</div>
</div>
<div class="sj" v-if="item.children && item.children.length" style="left: 60px;"></div>
<div class="sj" v-if="item.Child && item.Child.length" style="left: 60px;"></div>
<div class="bottom_show" v-if="now_menu == index"></div>
</div>
</div>
......@@ -100,70 +100,13 @@
export default {
data() {
return {
menu_arr: [
{
name: "工作台",
path: "/workplace",
children: [
{
name: "服务注册",
path: "/fwzc/fwcs"
},
{
name: "服务管理",
path: "/fwgl/"
},
{
name: "应用管理",
path: "/yygl/"
}
]
},
{
name: "技术支持",
path: "/xxx"
},
{
name: "服务超市",
path: "/services_shop",
children: [
{
name: "数据服务",
path: "/shop/data_service_list/5"
},
{
name: "时空服务",
path: "/shop/space_time_service_list/6"
},
{
name: "视频服务",
path: "/shop/video_service_list/7"
},
{
name: "感知服务",
path: "/shop/perception_service_list/10"
},
{
name: "综合应用",
path: "/shop/comprehensive_app_list/11"
},
{
name: "云资源服务",
path: "/shop/cloud"
},
{
name: "应用商店",
path: "/shop/app_store_list/12"
}
]
}
],
menu_arr: [],
now_menu: 2,
user_arr: [
{ name: "个人档案", path: "/user/user_info" },
{ name: "消息通知", path: "/user/message" },
{ name: "收银中心", path: "/authority" },
{ name: "关于BD-aPaaS", path: "/data_analysis" },
{ name: "收银中心", path: "" },
{ name: "关于BD-aPaaS", path: "" },
{ name: "退出登录", path: "logout" }
],
shopping_list: [],
......@@ -171,7 +114,7 @@ export default {
};
},
mounted() {
this.getMenuIndex();
this.getNowMenu();
this.getList();
},
computed: {
......@@ -218,14 +161,14 @@ export default {
window.sessionStorage.setItem("menuIndex", index);
},
gotoChildPage(v, parent) {
if (v.path) {
if (v.path == "/fwgl/" || v.path == "/yygl/") {
this.$router.push(v.path + this.$store.getters.level);
if (v.visit_url) {
if (v.visit_url == "/fwgl/" || v.visit_url == "/yygl/") {
this.$router.push(v.visit_url + this.$store.getters.level);
} else if (parent == 2) {
this.$router.push(v.path);
this.$store.commit("serviceShopMenuAct", v.path);
this.$router.push(v.visit_url);
this.$store.commit("serviceShopMenuAct", v.visit_url);
} else {
this.$router.push(v.path);
this.$router.push(v.visit_url);
}
this.now_menu = parent;
window.sessionStorage.setItem("menuIndex", parent);
......@@ -249,6 +192,14 @@ export default {
let index = window.sessionStorage.getItem("menuIndex");
console.log(index);
this.now_menu = index ? index : 2;
},
getNowMenu() {
this.$api.general.getNowMenu({ teamName: "APAAS3" }).then(response => {
if (response.data.success == 1) {
this.menu_arr = response.data.data[0].Child;
this.getMenuIndex();
}
});
}
}
};
......
......@@ -23,18 +23,25 @@
</div>
</el-col>
<el-col :span="6" class="cell_specification">
<div>
<div v-if="cellItem.order_type == 1">
<div>规格:日访问次数:{{ cellItem.spec_svc_count }}次,日访问量:{{ cellItem.spec_svc_pv }}</div>
<div
class="cell_specification_type"
>申请方式:{{ cellItem.duration_unit == 1 ? $t('lang.byMonth') : $t('lang.byYear') }}</div>
</div>
<div v-else-if="cellItem.order_type == 2">
<div>规格:{{ cellItem.spec_app == 0 ? "申请获取应用镜像部署权限" : "申请获取应用镜像开发权限" }}</div>
</div>
<div v-else-if="cellItem.order_type == 3">
<div>规格:CPU 2核,内存 4GB,容器组 8个;数据盘 3块,每块数据盘容量 2GB</div>
<div class="cell_specification_type">单个容器组:CPU最高 4核,默认 2核;内存最高 8 GB,默认 4GB</div>
</div>
</el-col>
<el-col :span="4" class="approval_status">
<div>
<div v-if="cellItem.approval_first_level == 0 && cellItem.pay_status != -1">待审核</div>
<div
v-if="cellItem.approval_first_level == 1&& cellItem.approval_second_level == 0 && cellItem.pay_status != -1"
v-if="cellItem.approval_first_level == 1 && cellItem.approval_second_level == 0 && cellItem.pay_status != -1"
>审核中</div>
<div v-if="cellItem.approval_second_level == 1 && cellItem.pay_status != -1">审核通过</div>
<div v-if="cellItem.approval_first_level == -1 && cellItem.pay_status != -1">审核未通过</div>
......
......@@ -8,7 +8,6 @@
<h3
class="detail-title"
v-text="item.name + ':'"
v-if="item.type != 'rich-text'"
></h3>
<service-steps
......
<template>
<div class="service_shop_menu">
<ul class="service_shop_menu_list">
<li v-for="(item, index) in menuList" :key="index" @click="active(item.router)">
<li v-for="(item, index) in menuList" :key="index" @click="active(item.visit_url)">
<img
v-if="item.router == actives"
:src="require('../assets/imgs/' + item.active + '.png')"
v-if="item.visit_url == actives"
:src="item.active != '' ? require('../assets/imgs/' + item.active + '.png') : ''"
class="menu_img"
/>
<img v-else :src="require('../assets/imgs/' + item.default + '.png')" class="menu_img" />
<span :class="item.router == actives ? 'menu_item_active':'menu_item'">{{ item.label }}</span>
<span
:class="item.visit_url == actives ? 'menu_item_active':'menu_item'"
>{{ item.menu_name }}</span>
</li>
</ul>
</div>
......@@ -20,57 +22,7 @@ export default {
data() {
return {
actives: "",
menuList: [
{
id: 0,
label: "数据服务",
router: "/shop/data_service_list/5",
active: "tool_ic_shujufw_sel",
default: "tool_ic_shujufw"
},
{
id: 1,
label: "时空服务",
router: "/shop/space_time_service_list/6",
active: "tool_ic_shikongfw_sel",
default: "tool_ic_shikongfw"
},
{
id: 2,
label: "视频服务",
router: "/shop/video_service_list/7",
active: "tool_ic_shipinfw_sel",
default: "tool_ic_shipinfw"
},
{
id: 3,
label: "感知服务",
router: "/shop/perception_service_list/10",
active: "tool_ic_ganzhifw_sel",
default: "tool_ic_ganzhifw"
},
{
id: 4,
label: "综合服务",
router: "/shop/comprehensive_app_list/11",
active: "tool_ic_zongheyyfw_sel",
default: "tool_ic_zongheyyfw"
},
{
id: 5,
label: "云资源服务",
router: "/shop/cloud",
active: "tool_ic_yunziyuanfw_sel",
default: "tool_ic_yunziyuanfw"
},
{
id: 6,
label: "应用商店",
router: "/shop/app_store_list/12",
active: "tool_ic_yingyongsd_sel",
default: "tool_ic_yingyongsd"
}
]
menuList: []
};
},
computed: {
......@@ -84,6 +36,7 @@ export default {
}
},
mounted() {
this.getShopMenu();
this.$store.commit("serviceShopMenuAct", this.$route.path);
this.actives = this.$store.state.serviceShopMenu;
},
......@@ -94,6 +47,60 @@ export default {
getActiveMenu(val) {
this.actives = val;
this.$router.push(val);
},
getShopMenu() {
this.$api.general.getNowMenu({ teamName: "APAAS3" }).then(response => {
if (response.data.success == 1) {
let arr = response.data.data[0].Child;
let shopArr = [];
arr.forEach(item => {
if (item.visit_url == "/services_shop") {
shopArr = item.Child;
}
});
shopArr.forEach(item => {
let uri = item.visit_url.substring(6);
if (uri.indexOf("/") != -1) {
uri = uri.substring(0, uri.indexOf("/"));
}
switch (uri) {
case "data_service_list":
item.active = "tool_ic_shujufw_sel";
item.default = "tool_ic_shujufw";
break;
case "space_time_service_list":
item.active = "tool_ic_shikongfw_sel";
item.default = "tool_ic_shikongfw";
break;
case "video_service_list":
item.active = "tool_ic_shipinfw_sel";
item.default = "tool_ic_shipinfw";
break;
case "perception_service_list":
item.active = "tool_ic_ganzhifw_sel";
item.default = "tool_ic_ganzhifw";
break;
case "comprehensive_app_list":
item.active = "tool_ic_zongheyyfw_sel";
item.default = "tool_ic_zongheyyfw";
break;
case "cloud":
item.active = "tool_ic_yunziyuanfw_sel";
item.default = "tool_ic_yunziyuanfw";
break;
case "app_store_list":
item.active = "tool_ic_yingyongsd_sel";
item.default = "tool_ic_yingyongsd";
break;
default:
item.active = "1";
item.default = "1";
break;
}
});
this.menuList = shopArr;
}
});
}
}
};
......
......@@ -58,7 +58,7 @@ import helper from "@/services/helper";
export default {
props: {
item: {
type: [String,Number],
type: [String, Number],
default: ""
},
header: {
......@@ -95,7 +95,8 @@ export default {
anotherData: {
directory: "file"
},
inputTextUp: ""
inputTextUp: "",
helper: helper
}),
mounted() {
this.inputText = this.item;
......@@ -118,7 +119,7 @@ export default {
url: response.data,
name: response.data
});
this.inputTextUp = file.name;
this.inputTextUp = helper.downloadFileFormat(file.name);
this.$emit("changeUpFile", {
rowId: this.rowId,
header: this.header,
......
......@@ -44,7 +44,7 @@ Vue.use(VueI18n)
const i18n = new VueI18n({
locale: 'zh',
messages: {
'zh': require('@/i18n/language-zh')
'zh': require('@/assets/i18n/language-zh')
}
})
......
......@@ -149,8 +149,8 @@ export default {
{ required: true, message: "请填写菜单访问地址", trigger: "blur" },
{
min: 0,
max: 30,
message: "访问地址长度不超过30个字",
max: 50,
message: "访问地址长度不超过50个字",
trigger: "blur"
}
],
......
......@@ -16,18 +16,20 @@
</el-button>
</template>
<div class="apass_table" slot="list">
<el-table class="user_roles_table" :border="false" :data="roleData">
<el-table-column width="60" align="right">
<el-table class="user_roles_table" :border="false" :data="roleList">
<el-table-column width="50" align="right"></el-table-column>
<el-table-column width="300">
<template slot="header">
<span style="margin-left: 25px;">角色</span>
</template>
<template slot-scope="scope">
<el-checkbox
class="apass_checkbox"
v-model="scope.row.selected"
@change="updateRoles"
></el-checkbox>
</template>
</el-table-column>
<el-table-column label="角色">
<template slot-scope="scope">
<span v-text="scope.row.role_name"></span>
>
{{ scope.row.role_name }}
</el-checkbox>
</template>
</el-table-column>
<el-table-column label="说明">
......@@ -48,13 +50,14 @@ export default {
components: { apassList },
data: () => ({
roleTotal: 0,
roleData: [],
roleList: [],
showDialog: false,
userRoles: null,
roles: null,
}),
computed: {
roleIds() {
return this.roleData.map((item) => item.role_id);
return this.roleList.map((item) => item.role_id);
},
},
methods: {
......@@ -63,13 +66,13 @@ export default {
if (this.roles === null) {
this.getUserRoles(() => {
this.getRoles(filters);
this.getRoleList(filters);
});
} else {
this.getRoles(filters);
this.getRoleList(filters);
}
},
getRoles(filters) {
getRoleList(filters) {
this.$http
.get(`/apaas/backmgt/role/list`, {
params: {
......@@ -84,20 +87,22 @@ export default {
});
this.roleTotal = data.total;
this.roleData = data.data;
this.roleList = data.data;
})
.catch((error) => {
console.log(error);
});
},
getUserRoles(callback) {
getUserRoles(cb) {
this.$http
.get(`/apaas/backmgt/user/roles/${this.$route.params.id}`)
.then(({ data }) => {
this.roles = data.data.map((item) => item.role_id);
// console.log(this.roles);
let userRoles = data.data.map((item) => item.role_id);
typeof callback === "function" && callback();
this.userRoles = userRoles;
this.roles = userRoles;
typeof cb === "function" && cb();
})
.catch((error) => {
console.log(error);
......@@ -109,7 +114,7 @@ export default {
return this.roleIds.indexOf(item) === -1;
})
.concat(
this.roleData
this.roleList
.filter((item) => {
return item.selected;
})
......@@ -121,18 +126,51 @@ export default {
// console.log(this.roles);
},
setUserRoles() {
if (this.roles.length > 0) {
this.$http
.post(`/apaas/backmgt/user/addRole`, {
let add = [];
let remove = [];
let requests = [];
this.roles.forEach((item) => {
if (this.userRoles.indexOf(item) === -1) {
add.push(item);
}
});
this.userRoles.forEach((item) => {
if (this.roles.indexOf(item) === -1) {
remove.push(item);
}
});
if (add.length > 0) {
requests.push(
this.$http.post(`/apaas/backmgt/user/addRole`, {
user_id: this.$route.params.id,
role_id: this.roles,
role_id: add,
})
);
}
if (remove.length > 0) {
requests.push(
this.$http.post(`/apaas/backmgt/role/userDel`, {
user_id: this.$route.params.id,
role_id: remove,
})
);
}
if (requests.length > 0) {
Promise.all(requests)
.then(({ data }) => {
this.$message({
message: `分配角色成功.`,
type: "success",
});
this.$router.push("/authority/users");
setTimeout(() => {
this.$router.push("/authority/users");
}, 200);
})
.catch((error) => {
this.$message({
......@@ -142,7 +180,7 @@ export default {
});
} else {
this.$message({
message: "用户角色不能为空!",
message: "您没有进行任何修改.",
type: "warning",
});
}
......
......@@ -32,7 +32,6 @@ export default {
getVal(val) {
let uri = val.substring(6);
uri = uri.substring(0, uri.indexOf("/"));
console.log(uri);
switch (uri) {
case "data_service_list":
this.name = "数据服务";
......
......@@ -58,21 +58,44 @@ export default {
console.log(error);
});
this.$http
.get(`/apaas/hubApi/market/readme/${this.id}`)
.then(({ data }) => {
this.detailData = [
let detailData = [
{
name: "获取流程",
type: "step",
value: ["应用申请", "信息填写", "审核确认", "应用获取"],
},
];
Promise.all([
this.$http.get(`/apaas/hubApi/market/app/detail/${this.id}`),
this.$http.get(`/apaas/hubApi/market/values/${this.id}`),
])
.then((response) => {
let data1 = response[0].data.data;
let data2 = response[1].data.data;
detailData.push(
{
name: "获取流程",
type: "step",
value: ["应用申请", "信息填写", "审核确认", "应用获取"],
name: "应用简介",
type: "text",
value: data1.yyjj,
},
{
name: "富文本",
type: "rich-text",
value: data.data,
name: "功能简介",
type: "text",
value: data1.gnjj,
},
];
{
name: "应用场景",
type: "text",
value: data1.cjsl,
},
{
name: "应用参数",
type: "rich-text",
value: data2,
}
);
this.detailData = detailData;
})
.catch(function(error) {
console.log(error);
......
......@@ -89,7 +89,7 @@
<div class="detail_title">{{ orderDetail.order_type == 1 ? "服务" : "应用"}}信息</div>
<div class="detail_service">
<el-row class="detail_service_row">
<el-col :span="10" class="detail_service_msg">
<el-col :span="10" v-if="orderDetail.order_type == 1" class="detail_service_msg">
<img :src="orderDetail.cover" class="detail_service_msg_img" />
<div class="detail_service_msg_right">
<div class="detail_service_name">
......@@ -105,8 +105,28 @@
</div>
</div>
</el-col>
<el-col :span="10" v-else-if="orderDetail.order_type == 2" class="detail_service_msg">
<img :src="orderDetail.cover" class="detail_service_msg_img" />
<div class="detail_service_msg_right">
<div class="detail_service_name">
<span>{{ orderDetail.name }}</span>
</div>
<div class="detail_service_msg_other">
<div class="detail_service_type">{{ orderDetail.sector }}</div>
<div class="detail_service_creator">{{ orderDetail.src_organization }}</div>
</div>
</div>
</el-col>
<el-col :span="10" v-else-if="orderDetail.order_type == 3" class="detail_service_msg">
<img :src="orderDetail.cover" class="detail_service_msg_img" />
<div class="detail_service_msg_right">
<div class="detail_service_name_cloud">
<span>{{ orderDetail.name }}</span>
</div>
</div>
</el-col>
<el-col :span="8" class="detail_service_specification">
<div>
<div v-if="orderDetail.order_type == 1">
<div>
<span class="detail_service_specification_gg">规格:</span>
<span
......@@ -120,6 +140,18 @@
>{{orderDetail.duration_unit == 1 ? "按月" : "按年"}}</span>
</div>
</div>
<div v-else-if="orderDetail.order_type == 2">
<div>
<span class="detail_service_specification_gg">规格:</span>
<span class="detail_service_specification_val">申请获取应用镜像部署权限</span>
</div>
</div>
<div v-else-if="orderDetail.order_type == 3">
<div>
<span class="detail_service_specification_gg">类型:</span>
<span class="detail_service_specification_val">申请新的工作区域</span>
</div>
</div>
</el-col>
<el-col :span="6" class="detail_service_time">
<div>
......@@ -131,10 +163,64 @@
</el-col>
</el-row>
</div>
<div class="detail_s_title">应用场景:</div>
<div class="detail_app_scence">{{ orderDetail.scene }}</div>
<div class="detail_s_title">申请内容:</div>
<table-um :headers="header_arr" :datas="data"></table-um>
<div v-if="orderDetail.order_type == 2">
<div class="detail_s_title">应用简介:</div>
<div class="detail_app_scence">{{ orderDetail.scene }}</div>
</div>
<div v-if="orderDetail.order_type == 2">
<div class="detail_s_title">功能简介:</div>
<div class="detail_app_scence">{{ orderDetail.scene }}</div>
</div>
<div v-if="orderDetail.order_type == 1 || orderDetail.order_type == 2">
<div class="detail_s_title">应用场景:</div>
<div class="detail_app_scence">{{ orderDetail.scene }}</div>
</div>
<div v-if="orderDetail.order_type == 3">
<div class="detail_s_title">工作区域描述:</div>
<div class="detail_app_scence">{{ orderDetail.scene }}</div>
</div>
<div v-if="orderDetail.order_type == 3" class="params_block">
<span class="params_block_title">申请规格:</span>
<div class="params_block_item">
<div class="params_block_item_in">
<span class="params_block_item_title">CPU:</span>
<span class="params_block_item_val">2核</span>
</div>
<div class="params_block_item_in">
<span class="params_block_item_title">内存:</span>
<span class="params_block_item_val">4GB</span>
</div>
<div class="params_block_item_in">
<span class="params_block_item_title">容器组:</span>
<span class="params_block_item_val">2核</span>
</div>
<div class="params_block_item_in">
<span class="params_block_item_title">数据盘:</span>
<span class="params_block_item_val">2核</span>
</div>
</div>
<span class="params_block_title margin_top_20">单个容器组规格:</span>
<div class="params_block_item">
<div class="params_block_item_in">
<span class="params_block_item_title">CPU:</span>
<p class="params_block_item_val">
<span class="val_has_2">最高&nbsp;2核</span>
<span class="val_has_2">默认&nbsp;2核</span>
</p>
</div>
<div class="params_block_item_in">
<span class="params_block_item_title">CPU:</span>
<p class="params_block_item_val">
<span class="val_has_2">最高&nbsp;2核</span>
<span class="val_has_2">默认&nbsp;2核</span>
</p>
</div>
</div>
</div>
<div v-if="orderDetail.order_type == 1">
<div class="detail_s_title">申请内容:</div>
<table-um :headers="header_arr" :datas="data"></table-um>
</div>
<div class="detail_title">申请人信息</div>
<info-list @download="download" :list_arr="list_arr" class="detail_s_val"></info-list>
<process-card :data="approval_arr1" class="detail_s_val"></process-card>
......@@ -512,6 +598,19 @@ export default {
-webkit-box-orient: vertical;
font-size: 16px;
}
.detail_service_name_cloud {
width: 100%;
line-height: 24px;
margin-top: 50px;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
font-size: 16px;
}
.detail_service_msg_other {
position: absolute;
bottom: 2px;
......@@ -598,6 +697,42 @@ export default {
background-color: #e1e4fb;
color: #626de9;
}
.params_block {
background-color: #f8f9fd;
border-radius: 8px;
margin: 10px 0;
padding: 20px;
font-size: 14px;
line-height: 22px;
}
.params_block_title {
padding-left: 10px;
color: #242c43;
}
.params_block_item {
padding: 10px 0 0 0;
}
.params_block_item_in {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
}
.params_block_item_title {
color: #8890a7;
width: 120px;
text-align: right;
}
.params_block_item_val {
color: #242c43;
width: calc(100% - 130px);
}
.val_has_2 {
margin-right: 20px;
}
.margin_top_20 {
display: block;
margin-top: 20px;
}
</style>
<style>
.pop_rate .el-rate__icon {
......
......@@ -135,12 +135,12 @@
:modal-append-to-body="false"
>
<div class="change_psw">
<el-form ref="form" :model="form">
<el-form ref="form" :model="form" :rules="passRules">
<el-form-item class="dia_item">
<p>旧密码:</p>
<el-input v-model="form.passwordOld"></el-input>
</el-form-item>
<el-form-item class="dia_item">
<el-form-item prop="passwordNew" class="dia_item">
<p>新密码:</p>
<el-input v-model="form.passwordNew" :type="visible1 ? 'password':'text'">
<span
......@@ -152,7 +152,7 @@
></span>
</el-input>
</el-form-item>
<el-form-item class="dia_item">
<el-form-item prop="nextname" class="dia_item">
<p>请再次输入密码:</p>
<el-input v-model="form.nextname" :type="visible2 ? 'password':'text'">
<span
......@@ -183,44 +183,77 @@ export default {
BlockRadius,
UploadFile
},
data: () => ({
activeName: "0",
userId: "",
is_admin: 0,
user_data: {
accountNo: "",
password: "12345678",
nickname: "",
contactPerson: "",
phone: "",
email: "",
organization: "",
userType: "",
userTypeName: ""
},
visible1: true,
visible2: true,
form: {
passwordOld: "",
passwordNew: "",
nextname: ""
},
imgList: [],
formBusiness: {
businessSystemName: "",
domainName: "",
ip_white: [],
ip_black: [],
private_token: "",
description: ""
},
whiteAddShow: false,
blackAddShow: false,
newIpWhite: "",
newIpBlack: "",
diaPassWord: false,
couldUp: true
}),
data() {
var checkNewPass = (rule, value, callback) => {
let reg = new RegExp(
/^.*(?=.{6,50})(?=.*\d)(?=.*[A-Z]{1,})(?=.*[a-z]{1,}).*$/
);
if (value == "") {
callback(new Error("请输入新密码"));
} else if (value == this.form.passwordOld) {
callback(new Error("新密码不应与旧密码一致"));
} else if (!reg.test(value)) {
callback(new Error("密码包含大小写字母、数字,长度不小于6位"));
} else {
callback();
}
};
var checkNextPass = (rule, value, callback) => {
if (value !== this.form.passwordNew) {
callback(new Error("密码和确认密码不一致"));
} else {
callback();
}
};
return {
activeName: "0",
userId: "",
is_admin: 0,
user_data: {
accountNo: "",
password: "12345678",
nickname: "",
contactPerson: "",
phone: "",
email: "",
organization: "",
userType: "",
userTypeName: ""
},
visible1: true,
visible2: true,
form: {
passwordOld: "",
passwordNew: "",
nextname: ""
},
passRules: {
passwordNew: [
{ required: true, message: "请输入新密码", trigger: "blur" },
{ validator: checkNewPass, trigger: "blur" }
],
nextname: [
{ required: true, message: "请再次输入新密码", trigger: "blur" },
{ validator: checkNextPass, trigger: "blur" }
]
},
imgList: [],
formBusiness: {
businessSystemName: "",
domainName: "",
ip_white: [],
ip_black: [],
private_token: "",
description: ""
},
whiteAddShow: false,
blackAddShow: false,
newIpWhite: "",
newIpBlack: "",
diaPassWord: false,
couldUp: true
};
},
mounted() {
this.getCurrentUser();
},
......
......@@ -114,12 +114,18 @@
>
<div class="description_info">
<i class="el-icon-warning-outline"></i>
<p>
压缩包上传提示:<br />
1.必须包含以下文件:Chart.yaml,README.md,step.yaml,values.yaml,logo.png;<br />
2.上述文件必须按照上述名称进行命名;<br />
3.请将文件夹压缩为“.zip”、“.tgz”、“.tar.gz”格式,如:名称为redis-ha的文件夹压缩为redis-ha.zip。
</p>
<p
v-html="
`1.必须包含以下文件:Chart.yaml,README.md,step.yaml,values.yaml,logo.png,templates/NOTES.txt;<br />
2.上述文件必须按照上述名称进行命名;<br />
3.step.yaml文件为values.yaml中的可配置参数,templates/NOTES.txt文件为应用的部署信息;<br />
4.templates/NOTES.txt主要用于用户部署后的访问,可以按照如下示例进行编写:<br />
&ensp;&ensp;this is a postgresql.<br />
&ensp;&ensp;author : Tom<br />
&ensp;&ensp;内部地址: {{ .Release.Name }}.{{ .Release.Namespace }}:5432<br />
5.请将文件夹压缩为“.zip”、“.tgz”、“.tar.gz”格式,如:名称为redis-ha的文件夹压缩为redis-ha.zip。<br />`
"
></p>
</div>
<el-upload
ref="step2_upload"
......
......@@ -150,7 +150,7 @@ export default {
{
getLabel(item) {
return (
["申请上架", "申请下架", "申请上架"][item.state] || "-"
["申请上架", "申请下架", "审核"][item.state] || "-"
);
},
callback(item) {
......@@ -199,7 +199,7 @@ export default {
prop: "state",
data: [
{
name: "上架",
name: "审核",
value: 1,
},
{
......@@ -430,7 +430,7 @@ export default {
label: "服务状态",
prop: "state",
getText(item) {
return ["已下架", "已上架", "上架"][item.state];
return ["已下架", "已上架", "审核"][item.state];
},
align: "center",
},
......@@ -459,7 +459,7 @@ export default {
prop: "state",
data: [
{
name: "上架",
name: "审核",
value: 1,
},
{
......
......@@ -425,7 +425,7 @@ export default {
"其他",
],
open_arr: ["共享", "受限", "敏感"],
service_state_arr: ["已下架","已上架", "上架"],
service_state_arr: ["已下架","已上架", "审核"],
request_arr: ["GET", "POST", "PUT", "DELETE"],
list_arr: [
{
......
......@@ -69,7 +69,7 @@
<p class="formname">接口编码:</p>
<el-input v-model="form.code"></el-input>
</el-form-item>
<el-form-item v-if="now_user==2" prop="people" :rules="[
<!-- <el-form-item v-if="now_user==2" prop="people" :rules="[
{ required: true, message: '请输入发布人', trigger: 'blur' },
]">
<p class="formname">发布人:</p>
......@@ -80,7 +80,7 @@
]">
<p class="formname">联系方式:</p>
<el-input v-model="form.phone"></el-input>
</el-form-item>
</el-form-item> -->
<el-form-item prop="resource">
<p class="formname">开放程度:</p>
<el-radio-group v-model="form.resource">
......@@ -395,6 +395,7 @@ export default {
if (valid) {
this.setService()
} else {
this.$message.error('请填写完整表单')
console.log('error submit!!');
return false;
}
......
......@@ -214,7 +214,9 @@
</div>
</block-radius>
<block-radius v-show="resultShow">
<div v-show="(activeBtn == 0 || activeBtn == 4 && zhyyVal == 0) && resSuccess">
<div
v-show="(activeBtn == 0 || activeBtn == 4 && (zhyyVal == 22 || zhyyVal == 23)) && resSuccess"
>
<div class="sjfw_qqcstx">请求参数信息填写:</div>
<ces-table
ref="fwcs_sjfw_qqcs"
......@@ -258,7 +260,7 @@
headerCellClassName="th_pink"
></ces-table>
</div>
<div v-show="(activeBtn == 1 || activeBtn == 4 && zhyyVal != 0) && resSuccess">
<div v-show="(activeBtn == 1 || (activeBtn == 4 && zhyyVal == 34)) && resSuccess">
<div class="skfw_csfwxx">测试服务信息:</div>
<div class="test_succ">
<div class="skcs_jg">
......@@ -468,15 +470,15 @@ export default {
tokenVal: "",
sjfwQqt: "JSON",
zhfwQqt: "JSON",
skfwQqt: "ArcGIS Server Web",
skfwQqt: "",
skfwRadios: [],
optionsZhyy: [
{ label: "模型算法类", value: 0 },
{ label: "查询验证类", value: 1 },
{ label: "流程类", value: 2 },
{ label: "应用类", value: 3 }
{ label: "模型算法类", value: 22 },
{ label: "查询验证类", value: 23 },
{ label: "流程类", value: 24 },
{ label: "应用类", value: 34 }
],
zhyyVal: 0,
zhyyVal: 22,
jcxxtx: false,
form: {
name: "",
......@@ -620,7 +622,9 @@ export default {
if (this.activeZh == 1) {
contentType = this.zhfwQqt;
if (this.zhfwQqt == "JSON") {
bodys = this.$refs.zhfwJsonCodes ? this.$refs.zhfwJsonCodes.getCodesVal() : "";
bodys = this.$refs.zhfwJsonCodes
? this.$refs.zhfwJsonCodes.getCodesVal()
: "";
} else if (this.zhfwQqt == "form-data") {
let request = this.$refs.fwcs_zhfw_qq_form.getTableData().concat();
request.pop();
......@@ -641,7 +645,9 @@ export default {
content_type: contentType,
data_service_type1: this.btnList[this.activeBtn].id,
data_service_type2:
this.activeBtn == 1
this.activeBtn == 0
? 12
: this.activeBtn == 1
? this.skfwQqt
: this.activeBtn == 4
? this.zhyyVal
......@@ -670,21 +676,31 @@ export default {
this.clickFwcs();
},
nextJcxx() {
let requestData = this.$refs.fwcs_sjfw_qqcs.getTableData();
let responseData = this.$refs.fwcs_sjfw_fhcs.getTableData();
this.requestRules = 0;
this.responseRules = 0;
this.checkTable(requestData, 0);
this.checkTable(responseData, 1);
if (this.requestRules == 0 && this.responseRules == 0) {
this.request_fields = requestData;
this.response_fields = responseData;
if (
this.activeBtn == 0 ||
(this.activeBtn == 4 && (this.zhyyVal == 22 || this.zhyyVal == 23))
) {
let requestData = this.$refs.fwcs_sjfw_qqcs.getTableData();
let responseData = this.$refs.fwcs_sjfw_fhcs.getTableData();
this.requestRules = 0;
this.responseRules = 0;
this.checkTable(requestData, 0);
this.checkTable(responseData, 1);
if (this.requestRules == 0 && this.responseRules == 0) {
this.request_fields = requestData;
this.response_fields = responseData;
this.jcxxtx = true;
this.getOrganization();
} else if (this.requestRules != 0) {
this.$message.error("请完善请求参数信息中的字段名称");
} else if (this.responseRules != 0) {
this.$message.error("请完善返回参数信息中的字段名称");
}
} else {
this.request_fields = [];
this.response_fields = [];
this.jcxxtx = true;
this.getOrganization();
} else if (this.requestRules != 0) {
this.$message.error("请完善请求参数信息中的字段名称");
} else if (this.responseRules != 0) {
this.$message.error("请完善返回参数信息中的字段名称");
}
},
checkTable(arr, rule) {
......@@ -736,7 +752,6 @@ export default {
} else if (this.activeBtn == 4) {
if (this.activeZh == 1) {
contentType = this.zhfwQqt;
}
}
let query = {
......@@ -748,7 +763,9 @@ export default {
descript: this.form.desc,
data_service_type1: this.btnList[this.activeBtn].id,
data_service_type2:
this.activeBtn == 1
this.activeBtn == 0
? 12
: this.activeBtn == 1
? this.skfwQqt
: this.activeBtn == 4
? this.zhyyVal
......@@ -827,6 +844,7 @@ export default {
if (response.data.success == 1) {
this.btnList = response.data.data;
this.skfwRadios = this.btnList[1].childDomains;
this.skfwQqt = this.skfwRadios[0].id;
this.activeBtn = 0;
} else {
console.log(response.data.errMsg);
......
......@@ -40,23 +40,10 @@
<div class="menu_text">
<p>{{ item.text }}</p>
<p
:style="
index == menu_arr[now_user].length - 1 ||
(now_user == 1 && index == 0) ||
(now_user == 2 && index == 0)
? { color: item.color, marginRight: '-20px' }
: { color: item.color }
"
:style="{ color: item.color }"
>
<span style="font-size:36px">{{ item.num }}</span>
<span
v-if="
index == menu_arr[now_user].length - 1 ||
(now_user == 1 && index == 0) ||
(now_user == 2 && index == 0)
"
></span
>
<span style="font-size:36px">{{ helper.numberFormat(item.num, 2) }}</span>
<span v-if="item.num > 10000"></span>
</p>
</div>
</div>
......@@ -70,17 +57,14 @@
style="margin-top:20px;margin-bottom:10px;font-size:18px;color: #0d1847;font-weight:600;padding-left:20px;"
>
云资源概况分析
<img
style="vertical-align:-9px;"
src="@/assets/imgs/home_btn_enter.png"
alt
/>
<img style="vertical-align:-9px;" src="@/assets/imgs/home_btn_enter.png" alt />
</p>
<div class="data_charts">
<div class="data_charts_left" style="width:100%;">
<p><span></span>
服务健康状态
<el-select style="float:right;" v-model="fw_value" placeholder="请选择">
<p>
<span></span>
服务健康状态
<el-select style="float:right;" v-model="fw_value" placeholder="请选择">
<el-option
v-for="item in fw_options"
:key="item.value"
......@@ -110,9 +94,7 @@
<div class="online_tool">
<p
style="margin-top:20px;margin-bottom:10px;font-size:18px;color: #0d1847;font-weight:600;height:28px;padding-left:20px;"
>
在线组件工具
</p>
>在线组件工具</p>
<div class="online_contain">
<div
v-for="(item, index) in online_tool_arr"
......@@ -134,15 +116,13 @@
style="margin-top:20px;margin-bottom:10px;font-size:18px;color: #0d1847;font-weight:600;padding-left:20px;"
>
数据资产看板
<img
style="vertical-align:-9px;"
src="@/assets/imgs/home_btn_enter.png"
alt
/>
<img style="vertical-align:-9px;" src="@/assets/imgs/home_btn_enter.png" alt />
</p>
<div class="data_charts" style="width:100%;">
<div class="data_charts_left">
<p><span></span> 服务健康状态</p>
<p>
<span></span> 服务健康状态
</p>
<div :id="health" class="health"></div>
</div>
<div class="data_charts_left" style="width:420px;margin-left:40px;">
......@@ -160,7 +140,9 @@
<div :id="fwyy" class="fwyy"></div>
</div>
<div class="data_charts_right">
<p><span></span> 服务运营分析</p>
<p>
<span></span> 服务运营分析
</p>
<div :id="yy_asy" class="yy_asy"></div>
</div>
</div>
......@@ -174,23 +156,25 @@
style="margin-top:20px;margin-bottom:10px;font-size:18px;color: #0d1847;font-weight:600;padding-left:20px;"
>
数据资产看板
<img
style="vertical-align:-9px;"
src="@/assets/imgs/home_btn_enter.png"
alt
/>
<img style="vertical-align:-9px;" src="@/assets/imgs/home_btn_enter.png" alt />
</p>
<div class="data_charts" style="width:100%;">
<div class="data_charts_left" style="width:590px;">
<p><span></span> 服务运营分析</p>
<p>
<span></span> 服务运营分析
</p>
<div :id="yy_asy" class="yy_asy" style="width:590px;"></div>
</div>
<div class="data_charts_left" style="width:285px;">
<p><span></span> 服务类型分析</p>
<p>
<span></span> 服务类型分析
</p>
<div :id="fwlx_asy" class="health" style="width:265px;"></div>
</div>
<div class="data_charts_left" style="width:285px;">
<p><span></span> 应用类型分析</p>
<p>
<span></span> 应用类型分析
</p>
<div :id="yylx_asy" class="health" style="width:265px;"></div>
</div>
</div>
......@@ -223,9 +207,7 @@
: {}
"
@click="change_now_type(index)"
>
{{ item }}
</div>
>{{ item }}</div>
<div class="myservice_btn" v-if="now_user == 0||now_user == 4" @click="gotozc()">
<img src="@/assets/imgs/home_ic_release.png" alt />&nbsp; 服务注册
</div>
......@@ -239,12 +221,12 @@
@distribut="distribut"
></table-um>
<list-pagination
:total="listTotal"
:page-size="pageSize"
:page-sizes="[]"
:current-page="currentPage"
@current-change="changeCurrentPage"
></list-pagination>
:total="listTotal"
:page-size="pageSize"
:page-sizes="[]"
:current-page="currentPage"
@current-change="changeCurrentPage"
></list-pagination>
</div>
</div>
<div class="online_tool" :style="now_user == 0||now_user == 4 ? {} : { width: '590px' }">
......@@ -271,9 +253,7 @@
: {}
"
@click="change_now_app(index)"
>
{{ item }}
</div>
>{{ item }}</div>
</div>
<el-scrollbar class="myapp_contain" v-if="now_user == 0||now_user == 4">
<div
......@@ -296,12 +276,12 @@
height="285"
></table-um>
<list-pagination
:total="listTotal1"
:page-size="pageSize"
:page-sizes="[]"
:current-page="currentPage1"
@current-change="changeCurrentPage1"
></list-pagination>
:total="listTotal1"
:page-size="pageSize"
:page-sizes="[]"
:current-page="currentPage1"
@current-change="changeCurrentPage1"
></list-pagination>
</div>
</div>
</div>
......@@ -313,16 +293,17 @@ import uuidv1 from "uuid/v1";
import tableUm from "@/components/table/table-um";
import ListPagination from "@/components/comments-pagination";
import helper from "@/services/helper.js";
import dashBoard from '../../components/e-charts/dashboard'
import dashBoard from "../../components/e-charts/dashboard";
import { formatDateTime_date } from "@/utils/common";
import { mapGetters,mapState } from 'vuex'
import {getCookie} from '../../services/cookie'
import { mapGetters, mapState } from "vuex";
import { getCookie } from "../../services/cookie";
var echarts = require("echarts");
export default {
data() {
return {
service_data:[],
app_data:[],
helper: helper,
service_data: [],
app_data: [],
listTotal: 0,
currentPage: 1,
listTotal1: 0,
......@@ -330,16 +311,16 @@ export default {
pageSize: 5,
person: "",
login_time: "",
detailsUrl:[
['/fwgl/0/0/servicedetail/','/fwgl/0/1/applyserviceedit/'],
['/fwgl/1/0/servicedetail/','/fwgl/1/1/approvalserviceedit/'],
['/fwgl/2/0/servicedetail/','/fwgl/2/1/approvalserviceedit/'],
],//服务跳转链接
detailsUrl1:[
['/yygl/0/0/detail/','/yygl/0/1/deploydetail/'],
['/yygl/1/0/detail/','/yygl/1/2/approvaldetail/'],
['/yygl/2/0/detail/','/yygl/2/2/approvaldetail/'],
],//应用跳转链接
detailsUrl: [
["/fwgl/0/0/servicedetail/", "/fwgl/0/1/applyserviceedit/"],
["/fwgl/1/0/servicedetail/", "/fwgl/1/1/approvalserviceedit/"],
["/fwgl/2/0/servicedetail/", "/fwgl/2/1/approvalserviceedit/"]
], //服务跳转链接
detailsUrl1: [
["/yygl/0/0/detail/", "/yygl/0/1/deploydetail/"],
["/yygl/1/0/detail/", "/yygl/1/2/approvaldetail/"],
["/yygl/2/0/detail/", "/yygl/2/2/approvaldetail/"]
], //应用跳转链接
now_user: 2, //0:普通用户,1:组织管理员,2:超级管理员
now_type: 0,
now_app: 0,
......@@ -352,14 +333,18 @@ export default {
fw_options: [
{
value: 0,
label: "服务总数",
label: "服务总数"
},
{
value: 1,
label: "应用总数",
},
label: "应用总数"
}
],
app_url_arr: [
["/apaas/hubApi/market/list", "/apaas/hubApi/market/deployList"],
["/apaas/hubApi/market/list", "/apaas/hubApi/market/applyList"],
["/apaas/hubApi/market/list", "/apaas/hubApi/market/applyList"]
],
app_url_arr: [['/apaas/hubApi/market/list','/apaas/hubApi/market/deployList'], ["/apaas/hubApi/market/list", "/apaas/hubApi/market/applyList"], ["/apaas/hubApi/market/list", "/apaas/hubApi/market/applyList"]],
app_head: [
[],
[
......@@ -369,33 +354,33 @@ export default {
label: "应用名称",
width: "90px",
align: "left",
type:'href',
id:'app_id'
type: "href",
id: "app_id"
},
{
prop: "type_name",
label: "应用类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "version",
label: "应用版本",
width: "80px",
align: "center",
align: "center"
},
{
prop: "create_date",
label: "应用创建时间",
width: "160px",
align: "center",
align: "center"
},
{
prop: "deploy_times",
label: "被部署次数",
width: "100px",
align: "center",
},
align: "center"
}
],
[
{
......@@ -403,34 +388,34 @@ export default {
label: "应用名称",
width: "90px",
align: "left",
type:'href',
id:'id'
type: "href",
id: "id"
},
{
prop: "type_name",
label: "应用类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "version",
label: "应用版本",
width: "80px",
align: "center",
align: "center"
},
{
prop: "time",
label: "应用审批时间",
width: "160px",
align: "center",
align: "center"
},
{
prop: "apply_status",
label: "审批状态",
width: "100px",
align: "center",
},
],
align: "center"
}
]
],
[
[
......@@ -439,33 +424,33 @@ export default {
label: "应用名称",
width: "90px",
align: "left",
type:'href',
id:'app_id'
type: "href",
id: "app_id"
},
{
prop: "type_name",
label: "应用类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "version",
label: "应用版本",
width: "80px",
align: "center",
align: "center"
},
{
prop: "create_date",
label: "应用创建时间",
width: "160px",
align: "center",
align: "center"
},
{
prop: "deploy_times",
label: "被部署次数",
width: "100px",
align: "center",
},
align: "center"
}
],
[
{
......@@ -473,44 +458,52 @@ export default {
label: "应用名称",
width: "90px",
align: "left",
type:'href',
id:'id'
type: "href",
id: "id"
},
{
prop: "type_name",
label: "应用类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "version",
label: "应用版本",
width: "80px",
align: "center",
align: "center"
},
{
prop: "time",
label: "应用审批时间",
width: "160px",
align: "center",
align: "center"
},
{
prop: "apply_status",
label: "审批状态",
width: "100px",
align: "center",
},
],
],
align: "center"
}
]
]
],
service_url_arr: [
[
"/apaas/service/v3/service/manager/list",
"/apaas/service/v3/service/apply/service/list",
"/apaas/service/v3/service/manager/list"
],
[
"/apaas/service/v3/service/manager/list",
"/apaas/service/v3/service/approval/applied/list",
"nor_cloud"
],
["/apaas/service/v3/service/manager/list", "/apaas/service/v3/service/approval/applied/list", "nor_cloud"],
["/apaas/service/v3/service/manager/list", "/apaas/service/v3/service/approval/applied/list", "nor_cloud_manage"],
[
"/apaas/service/v3/service/manager/list",
"/apaas/service/v3/service/approval/applied/list",
"nor_cloud_manage"
]
],
service_head: [
[
......@@ -520,27 +513,27 @@ export default {
label: "服务名称",
width: "250px",
align: "left",
type:'href',
id:'id',
type: "href",
id: "id"
},
{
prop: "data_service_type1_name",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "create_time",
label: "注册发布时间",
width: "200px",
align: "center",
align: "center"
},
{
prop: "request_count",
label: "被调用次数",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
......@@ -548,92 +541,92 @@ export default {
label: "服务名称",
width: "250px",
align: "left",
type:'href',
id:'id',
type: "href",
id: "id"
},
{
prop: "data_service_type1_name",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "apply_time",
label: "申请时间",
width: "200px",
align: "center",
align: "center"
},
{
prop: "approval_status",
label: "申请审批状态",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
prop: "fwmc",
label: "服务名称",
width: "250px",
align: "left",
align: "left"
},
{
prop: "fwlx",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "spsj",
label: "审批时间",
width: "200px",
align: "center",
align: "center"
},
{
prop: "spzt",
label: "审批状态",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
prop: "gzqy",
label: "工作区域",
width: "150px",
align: "left",
align: "left"
},
{
prop: "wlhj",
label: "网络环境",
width: "120px",
align: "center",
align: "center"
},
{
prop: "cpu",
label: "CPU(核)",
width: "90px",
align: "center",
align: "center"
},
{
prop: "ncgb",
label: "内存(GB)",
width: "90px",
align: "center",
align: "center"
},
{
prop: "zyzlgb",
label: "资源总量(GB)",
width: "120px",
align: "center",
align: "center"
},
{
prop: "sqzt",
label: "申请状态",
width: "110px",
align: "center",
},
],
align: "center"
}
]
],
[
[
......@@ -642,27 +635,27 @@ export default {
label: "服务名称",
width: "140px",
align: "left",
type:'href',
id:'id'
type: "href",
id: "id"
},
{
prop: "data_service_type1_name",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "create_time",
label: "注册发布时间",
width: "180px",
align: "center",
align: "center"
},
{
prop: "request_count",
label: "被调用次数",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
......@@ -670,58 +663,58 @@ export default {
label: "服务名称",
width: "140px",
align: "left",
type:'href',
id:'service_apply_info.id'
type: "href",
id: "service_apply_info.id"
},
{
prop: "data_service_type1_name",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "approval_time",
label: "审批时间",
width: "180px",
align: "center",
align: "center"
},
{
prop: "approval_status",
label: "审批状态",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
prop: "gzqy",
label: "工作区域",
width: "100px",
align: "left",
align: "left"
},
{
prop: "wlhj",
label: "网络环境",
width: "90px",
align: "center",
align: "center"
},
{
prop: "cpu",
label: "CPU(核)",
width: "80px",
align: "center",
align: "center"
},
{
prop: "ncgb",
label: "内存(GB)",
width: "80px",
align: "center",
align: "center"
},
{
prop: "zyzlgb",
label: "资源总量(GB)",
width: "110px",
align: "center",
align: "center"
},
{
prop: "sqzt",
......@@ -732,14 +725,14 @@ export default {
btnList: [
{
label: "分配",
type: "distribut",
type: "distribut"
},
{
label: "已分配",
},
],
},
],
label: "已分配"
}
]
}
]
],
[
[
......@@ -748,83 +741,83 @@ export default {
label: "服务名称",
width: "140px",
align: "left",
type:'href',
id:'id'
type: "href",
id: "id"
},
{
prop: "data_service_type1_name",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "create_time",
label: "注册发布时间",
width: "180px",
align: "center",
align: "center"
},
{
prop: "request_count",
label: "被调用次数",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
prop: "name",
label: "服务名称",
width: "140px",
type:'href',
id:'service_apply_info.id',
align: "left",
type: "href",
id: "service_apply_info.id",
align: "left"
},
{
prop: "data_service_type1_name",
label: "服务类型",
width: "120px",
align: "center",
align: "center"
},
{
prop: "approval_time",
label: "审批时间",
width: "180px",
align: "center",
align: "center"
},
{
prop: "approval_status",
label: "审批状态",
width: "110px",
align: "center",
},
align: "center"
}
],
[
{
prop: "sszz",
label: "所属组织",
width: "170px",
align: "left",
align: "left"
},
{
prop: "cpu",
label: "CPU使用量(核)",
width: "120px",
align: "center",
align: "center"
},
{
prop: "ncgb",
label: "内存使用量(GB)",
width: "130px",
align: "center",
align: "center"
},
{
prop: "gzqysl",
label: "工作区域数量(个)",
width: "130px",
align: "center",
},
],
],
align: "center"
}
]
]
],
fw_value: 0,
menu_arr: [
......@@ -835,7 +828,7 @@ export default {
bg: "#e6ebfe",
color: "#515fe7",
type: "service_count",
num: "",
num: ""
},
{
text: "应用总数",
......@@ -843,7 +836,7 @@ export default {
bg: "#e5f4fe",
color: "#38aef9",
type: "app_count",
num: "",
num: ""
},
{
text: "收益总额",
......@@ -851,8 +844,8 @@ export default {
bg: "#fcefd6",
color: "#ea7d19",
type: "earnings_money",
num: "",
},
num: ""
}
],
[
{
......@@ -861,7 +854,7 @@ export default {
bg: "#e6ebfe",
color: "#515fe7",
type: "org_user",
num: "",
num: ""
},
{
text: "服务总数",
......@@ -869,7 +862,7 @@ export default {
bg: "#e5f4fe",
color: "#38aef9",
type: "service_count",
num: "",
num: ""
},
{
text: "应用总数",
......@@ -877,7 +870,7 @@ export default {
bg: "#e7fdfc",
color: "#25bdb1",
type: "app_count",
num: "",
num: ""
},
{
text: "交易总额",
......@@ -885,8 +878,8 @@ export default {
bg: "#fcefd6",
color: "#ea7d19",
type: "trade_money",
num: "",
},
num: ""
}
],
[
{
......@@ -895,7 +888,7 @@ export default {
bg: "#e6ebfe",
color: "#515fe7",
type: "total_user",
num: "",
num: ""
},
{
text: "服务总数",
......@@ -903,7 +896,7 @@ export default {
bg: "#e5f4fe",
color: "#38aef9",
type: "service_count",
num: "",
num: ""
},
{
text: "应用总数",
......@@ -911,7 +904,7 @@ export default {
bg: "#e7fdfc",
color: "#25bdb1",
type: "app_count",
num: "",
num: ""
},
{
text: "交易总额",
......@@ -919,79 +912,79 @@ export default {
bg: "#fcefd6",
color: "#ea7d19",
type: "trade_money",
num: "",
},
],
num: ""
}
]
],
online_tool_arr: [
{
text: "智能绘图",
pic: require("@/assets/imgs/home_tool_ic_znht.png"),
bg: "#e5f4fe",
color: "#38aef9",
color: "#38aef9"
},
{
text: "数据开发",
pic: require("@/assets/imgs/home_tool_ic_sjkf.png"),
bg: "#e6ebfe",
color: "#515fe7",
color: "#515fe7"
},
{
text: "模型工场",
pic: require("@/assets/imgs/home_tool_ic_mxgc.png"),
bg: "#e6ebfe",
color: "#515fe7",
color: "#515fe7"
},
{
text: "流程设计",
pic: require("@/assets/imgs/home_tool_ic_lcsj.png"),
bg: "#e6ebfe",
color: "#515fe7",
color: "#515fe7"
},
{
text: "可视化报表",
pic: require("@/assets/imgs/home_tool_ic_kshbb.png"),
bg: "#fff2e2",
color: "#ea7d19",
color: "#ea7d19"
},
{
text: "模板应用",
pic: require("@/assets/imgs/home_tool_ic_mbyy.png"),
bg: "#fff2e2",
color: "#ea7d19",
color: "#ea7d19"
},
{
text: "应用创新",
pic: require("@/assets/imgs/home_tool_ic_yycx.png"),
bg: "#e7fdfc",
color: "#25bdb1",
},
color: "#25bdb1"
}
],
service_arr: [
["服务列表", "申请服务", "云资源"],
["服务列表", "服务审批", "云资源管理"],
["服务列表", "服务审批", "云资源管理"],
["服务列表", "服务审批", "云资源管理"]
],
apptype_arr: [
["应用仓库", "部署的应用"],
["应用仓库", "应用审批"],
["应用仓库", "应用审批"],
["应用仓库", "应用审批"]
],
app_arr: [],
service_app_count:{},
service_app_count: {},
manage_arr: [
{
pic: require("@/assets/imgs/home_tool_ic_organize.png"),
text: "组织管理",
role: 1,
url:'',
url: ""
},
{
pic: require("@/assets/imgs/home_tool_ic_quanxian.png"),
text: "权限管理",
role: 2,
url:'/authority/organization'
},
url: "/authority/organization"
}
// {
// pic: require("@/assets/imgs/home_tool_ic_quanxian.png"),
// text: "容器管理",
......@@ -1002,50 +995,47 @@ export default {
// text: "数据管控",
// role: 2,
// },
],
]
};
},
components: {
tableUm,
ListPagination,
dashBoard,
dashBoard
},
computed: {
...mapGetters([
'level',
]),
...mapState(['userInfo']),
},
created() {
...mapGetters(["level"]),
...mapState(["userInfo"])
},
created() {},
mounted() {
console.log(this.level);
if(this.userInfo){
this.now_user = this.level
this.manage_arr[0].url = '/authority/organization/detail/'+this.userInfo.department_id
this.init_func()
}else{
this.getCurrentUser()
if (this.userInfo) {
this.now_user = this.level;
this.manage_arr[0].url =
"/authority/organization/detail/" + this.userInfo.department_id;
this.init_func();
} else {
this.getCurrentUser();
}
},
methods: {
gotopage(id,deploy){
if(deploy){
this.$router.push(this.detailsUrl1[0][1]+deploy)
}else{
this.$router.push(this.detailsUrl1[0][0]+id)
gotopage(id, deploy) {
if (deploy) {
this.$router.push(this.detailsUrl1[0][1] + deploy);
} else {
this.$router.push(this.detailsUrl1[0][0] + id);
}
},
change_now_app(val){
this.now_app = val
this.currentPage1 = 1
this.get_app_list()
change_now_app(val) {
this.now_app = val;
this.currentPage1 = 1;
this.get_app_list();
},
change_now_type(val){
this.now_type = val
this.currentPage = 1
this.get_service_list()
change_now_type(val) {
this.now_type = val;
this.currentPage = 1;
this.get_service_list();
},
changeCurrentPage(value) {
this.currentPage = value;
......@@ -1055,86 +1045,107 @@ export default {
this.currentPage1 = value;
this.get_app_list();
},
get_app_list(){
get_app_list() {
this.$http
.get(`${this.app_url_arr[this.now_user][this.now_app]}?page=${this.currentPage1}&limit=${this.now_user==0||this.now_user==4?10000:this.pageSize}`)
.then((response) => {
if(!response.data.success){
return
.get(
`${this.app_url_arr[this.now_user][this.now_app]}?page=${
this.currentPage1
}&limit=${
this.now_user == 0 || this.now_user == 4 ? 10000 : this.pageSize
}`
)
.then(response => {
if (!response.data.success) {
return;
}
let data = response.data.data;
if(this.now_user==0||this.now_user==4){
if (this.now_user == 0 || this.now_user == 4) {
this.app_arr = data;
}else{
this.app_data = data
} else {
this.app_data = data;
this.app_data.forEach(e => {
if(e.create_date){
e.create_date = e.create_date.split('.')[0].replace('T'," ")
if (e.create_date) {
e.create_date = e.create_date.split(".")[0].replace("T", " ");
}
});
this.listTotal1 = response.data.total
this.listTotal1 = response.data.total;
}
})
});
},
get_service_list(){
get_service_list() {
this.$http
.get(`${this.service_url_arr[this.now_user][this.now_type]}?page=${this.currentPage}&size=${this.pageSize}`)
.then((response) => {
.get(
`${this.service_url_arr[this.now_user][this.now_type]}?page=${
this.currentPage
}&size=${this.pageSize}`
)
.then(response => {
console.log(response);
if(!response.data.success){
return
if (!response.data.success) {
return;
}
let data = response.data.data;
this.service_data = data.data
this.service_data = data.data;
this.service_data.forEach(e => {
if(e.create_time){
e.create_time = e.create_time.split('+')[0].replace('T'," ")
if (e.create_time) {
e.create_time = e.create_time.split("+")[0].replace("T", " ");
}
if(e.service_apply_info&&e.service_apply_info.approval_time){
e.approval_time = helper.dateStringTransform(e.service_apply_info.approval_time)
}else{
e.approval_time = ''
if (e.service_apply_info && e.service_apply_info.approval_time) {
e.approval_time = helper.dateStringTransform(
e.service_apply_info.approval_time
);
} else {
e.approval_time = "";
}
if(e.service_apply_info&&e.service_apply_info.apply_time){
e.apply_time = helper.dateStringTransform(e.service_apply_info.apply_time)
}else{
e.apply_time = ''
if (e.service_apply_info && e.service_apply_info.apply_time) {
e.apply_time = helper.dateStringTransform(
e.service_apply_info.apply_time
);
} else {
e.apply_time = "";
}
if(e.service_apply_info&&e.service_apply_info.approval_status){
if(this.now_user!==0&&this.now_user!==4){
e.approval_status = ["-", "已审批", "待审批"][e.service_apply_info.approval_status]
}else{
e.approval_status = ["-", "待审批", "审批中", "审批通过", "审批未通过"][e.service_apply_info.approval_status]
if (e.service_apply_info && e.service_apply_info.approval_status) {
if (this.now_user !== 0 && this.now_user !== 4) {
e.approval_status = ["-", "已审批", "待审批"][
e.service_apply_info.approval_status
];
} else {
e.approval_status = [
"-",
"待审批",
"审批中",
"审批通过",
"审批未通过"
][e.service_apply_info.approval_status];
}
}else{
e.approval_status = ''
} else {
e.approval_status = "";
}
});
this.listTotal = data.total
this.listTotal = data.total;
})
.catch(function(response) {});
},
init_func(){
init_func() {
this.getInfoData();
this.get_service_list()
this.get_app_list()
this.get_service_list();
this.get_app_list();
this.getUserData();
if (this.now_user == 0||this.now_user == 4) {
this.getHealth();
// this.getoperatingdata();
} else if (this.now_user == 1) {
this.getHealth();
this.getoperatingdata();
this.getappusedata();
} else if (this.now_user == 2) {
this.getoperatingdata();
this.getfwlxdata();
this.getyylxdata();
}
if (this.now_user == 0 || this.now_user == 4) {
this.getHealth();
// this.getoperatingdata();
} else if (this.now_user == 1) {
this.getHealth();
this.getoperatingdata();
this.getappusedata();
} else if (this.now_user == 2) {
this.getoperatingdata();
this.getfwlxdata();
this.getyylxdata();
}
},
getCurrentUser() {
this.$api.user.getNowUser().then(({ data }) => {
......@@ -1143,10 +1154,10 @@ export default {
console.log(data.data);
console.log("--- user info ---");
this.$store.commit("userInfofun", data.data);
this.now_user = this.level
this.manage_arr[0].url = data.data.department_id
console.log(this.level);
this.init_func()
this.now_user = this.level;
this.manage_arr[0].url = data.data.department_id;
console.log(this.level);
this.init_func();
} else {
console.log(data.errMsg);
}
......@@ -1163,12 +1174,15 @@ export default {
},
getUserData() {
this.person = this.userInfo.user_name;
this.login_time = decodeURIComponent(getCookie('lastLogin')).replace('+',' ');
this.login_time = decodeURIComponent(getCookie("lastLogin")).replace(
"+",
" "
);
},
getoperatingdata() {
this.$http
.get("/apaas/service/v3/workplace/statistics/business")
.then((response) => {
.then(response => {
console.log(response);
let data = response.data.data;
this.init_yy(
......@@ -1180,29 +1194,41 @@ export default {
})
.catch(function(response) {});
},
change_service_app(val){
change_service_app(val) {
console.log(val);
if(val == 0){
this.init_fwyy(this.service_app_count.serviceData.xAxisData, this.service_app_count.serviceData.seriesData,val);
}else{
this.init_fwyy(this.service_app_count.appData.xAxisData, this.service_app_count.appData.seriesData,val);
if (val == 0) {
this.init_fwyy(
this.service_app_count.serviceData.xAxisData,
this.service_app_count.serviceData.seriesData,
val
);
} else {
this.init_fwyy(
this.service_app_count.appData.xAxisData,
this.service_app_count.appData.seriesData,
val
);
}
},
getappusedata() {
this.$http
.get("/apaas/service/v3/workplace/statistics/serviceapp/count/trend")
.then((response) => {
.then(response => {
console.log(response);
let data = response.data.data;
this.service_app_count = data
this.init_fwyy(this.service_app_count.serviceData.xAxisData, this.service_app_count.serviceData.seriesData,this.fw_value);
this.service_app_count = data;
this.init_fwyy(
this.service_app_count.serviceData.xAxisData,
this.service_app_count.serviceData.seriesData,
this.fw_value
);
})
.catch(function(response) {});
},
getfwlxdata() {
this.$http
.get("/apaas/service/v3/workplace/statistics/service/type")
.then((response) => {
.then(response => {
console.log(response);
let data = response.data.data;
this.init_fwlx_asy(data.seriesData);
......@@ -1212,9 +1238,9 @@ export default {
getyylxdata() {
this.$http
.get("/apaas/hubApi/index/appTypesAnalysis")
.then((response) => {
.then(response => {
console.log(response);
if(response.data.success){
if (response.data.success) {
let data = response.data.data;
this.init_yylx_asy(data.series[0].data);
}
......@@ -1224,10 +1250,14 @@ export default {
getHealth() {
this.$http
.get("/apaas/service/v3/workplace/statistics/health/status")
.then((response) => {
.then(response => {
console.log(response);
let data = response.data.data;
var temp = Math.round(data.seriesData[0].value/(data.seriesData[0].value+data.seriesData[1].value)*100)
var temp = Math.round(
(data.seriesData[0].value /
(data.seriesData[0].value + data.seriesData[1].value)) *
100
);
console.log(temp);
this.init_health(temp);
})
......@@ -1236,16 +1266,12 @@ export default {
getInfoData() {
this.$http
.get("/apaas/service/v3/workplace/statistics/basic")
.then((response) => {
.then(response => {
console.log(response);
let data = response.data.data;
this.menu_arr[this.now_user].forEach((e, idx) => {
if (data[e.type]||data[e.type]==0) {
this.$set(
this.menu_arr[this.now_user][idx],
"num",
data[e.type]
);
if (data[e.type] || data[e.type] == 0) {
this.$set(this.menu_arr[this.now_user][idx], "num", data[e.type]);
}
});
})
......@@ -1257,7 +1283,7 @@ export default {
},
manage_func(n) {
console.log(n);
this.$router.push(n)
this.$router.push(n);
},
init_health(num) {
var options = {
......@@ -1266,15 +1292,15 @@ export default {
textStyle: {
color: "#000",
fontSize: 40,
fontWeight: 200,
fontWeight: 200
},
subtext: "健康占比",
subtextStyle: {
color: "#c9cedd",
color: "#c9cedd"
},
itemGap: -10, // 主副标题距离
left: "center",
top: "center",
top: "center"
},
angleAxis: {
max: 100, // 满分
......@@ -1282,37 +1308,37 @@ export default {
startAngle: 90,
// 隐藏刻度线
axisLine: {
show: false,
show: false
},
axisTick: {
show: false,
show: false
},
axisLabel: {
show: false,
show: false
},
splitLine: {
show: false,
},
show: false
}
},
radiusAxis: {
type: "category",
// 隐藏刻度线
axisLine: {
show: false,
show: false
},
axisTick: {
show: false,
show: false
},
axisLabel: {
show: false,
show: false
},
splitLine: {
show: false,
},
show: false
}
},
polar: {
center: ["50%", "50%"],
radius: "140%", //图形大小
radius: "140%" //图形大小
},
series: [
{
......@@ -1326,17 +1352,17 @@ export default {
normal: {
color: "#e56600",
shadowColor: "rgba(0, 0, 0, 0.2)",
shadowBlur: 20,
},
},
},
shadowBlur: 20
}
}
}
],
coordinateSystem: "polar",
roundCap: true,
barWidth: 10,
barGap: "-100%", // 两环重叠
z: 2,
z: 2
},
{
// 灰色环
......@@ -1348,17 +1374,17 @@ export default {
itemStyle: {
color: "#c9cedd",
shadowColor: "rgba(0, 0, 0, 0.2)",
shadowBlur: 20,
},
},
shadowBlur: 20
}
}
],
coordinateSystem: "polar",
roundCap: true,
barWidth: 10,
barGap: "-100%", // 两环重叠
z: 1,
},
],
z: 1
}
]
};
window[this.health] = echarts.init(document.getElementById(this.health));
window[this.health].setOption(options, true);
......@@ -1383,28 +1409,28 @@ export default {
white: {
color: "#ddd",
align: "center",
padding: [3, 0],
},
padding: [3, 0]
}
};
var placeHolderStyle = {
normal: {
label: {
show: false,
show: false
},
labelLine: {
show: false,
show: false
},
color: "rgba(0, 0, 0, 0)",
borderColor: "rgba(0, 0, 0, 0)",
borderWidth: 0,
},
borderWidth: 0
}
};
var data = [];
var color = ["#515fe7", "#36a5ec", "#da9f2a", "#23b2a7", "#d46002"];
var legendarr = [];
var temp2_data = 0
var temp2_data = 0;
data_val.forEach(e => {
temp2_data = temp2_data + e.value
temp2_data = temp2_data + e.value;
});
for (var i = 0; i < data_val.length; i++) {
data.push(
......@@ -1416,14 +1442,14 @@ export default {
borderWidth: 5,
shadowBlur: 20,
borderColor: color[i],
shadowColor: color[i],
},
},
shadowColor: color[i]
}
}
},
{
value: temp2_data/10,
value: temp2_data / 10,
name: "",
itemStyle: placeHolderStyle,
itemStyle: placeHolderStyle
}
);
legendarr.push(data_val[i].name);
......@@ -1455,18 +1481,18 @@ export default {
return "";
}
},
rich: rich,
},
},
rich: rich
}
}
},
data: data,
},
data: data
}
];
var options = {
color: color,
tooltip: {
show: false,
show: false
},
legend: {
bottom: -5,
......@@ -1475,13 +1501,13 @@ export default {
itemHeight: 10,
orient: "horizontal",
data: legendarr,
backgroundColor: "#f4f7fc",
backgroundColor: "#f4f7fc"
},
toolbox: {
show: false,
show: false
},
series: seriesObj,
series: seriesObj
};
return options;
},
......@@ -1494,28 +1520,28 @@ export default {
tooltip: {
trigger: "axis",
axisPointer: {
type: "cross",
},
type: "cross"
}
},
grid: {
top: "20",
bottom: "45",
bottom: "45"
},
legend: {
data: ["服务调用总数", "应用部署总数", "收益总额"],
bottom: 0,
itemWidth: 10,
itemHeight: 10,
backgroundColor: "#f4f7fc",
backgroundColor: "#f4f7fc"
},
xAxis: [
{
type: "category",
axisTick: {
alignWithLabel: true,
alignWithLabel: true
},
data: xarr,
},
data: xarr
}
],
yAxis: [
{
......@@ -1525,9 +1551,9 @@ export default {
position: "right",
axisLine: {
lineStyle: {
color: colors[1],
},
},
color: colors[1]
}
}
},
{
type: "value",
......@@ -1536,10 +1562,10 @@ export default {
position: "left",
axisLine: {
lineStyle: {
color: colors[1],
},
},
},
color: colors[1]
}
}
}
],
series: [
{
......@@ -1549,9 +1575,9 @@ export default {
data: service,
itemStyle: {
barBorderRadius: 6,
color: colors[2],
color: colors[2]
},
barWidth: 12,
barWidth: 12
},
{
name: "应用部署总数",
......@@ -1560,9 +1586,9 @@ export default {
data: app,
itemStyle: {
barBorderRadius: 6,
color: colors[0],
color: colors[0]
},
barWidth: 12,
barWidth: 12
},
{
name: "收益总额",
......@@ -1570,59 +1596,59 @@ export default {
yAxisIndex: 0,
data: get,
itemStyle: {
color: colors[0],
color: colors[0]
},
symbol: "circle",
},
],
symbol: "circle"
}
]
};
window[this.yy_asy] = echarts.init(document.getElementById(this.yy_asy));
window[this.yy_asy].setOption(options, true);
},
init_fwyy(xarr, yarr,n) {
init_fwyy(xarr, yarr, n) {
var dataname = ["服务总数", "应用总数"];
var options = {
tooltip: {
trigger: "axis",
axisPointer: {
label: {
backgroundColor: "#fff",
},
},
backgroundColor: "#fff"
}
}
},
legend: {
data: [dataname[n]],
itemWidth: 14,
itemHeight: 10,
bottom: 0,
bottom: 0
},
grid: {
borderColor: "#f2f2f2",
top: 20,
bottom: 45,
right: 0,
right: 0
},
xAxis: {
type: "category",
axisTick: { show: false },
axisLine: { show: false },
nameTextStyle: {
color: "#0d1847",
color: "#0d1847"
},
data: xarr,
data: xarr
},
yAxis: {
type: "value",
axisLine: {
show: false,
lineStyle: {
color: "#c9cedd",
},
color: "#c9cedd"
}
},
axisTick: { show: false },
nameTextStyle: {
color: "#f2f2f2",
},
color: "#f2f2f2"
}
},
series: [
{
......@@ -1633,27 +1659,27 @@ export default {
sampling: "average",
symbol: "circle",
itemStyle: {
color: "#0a92c4",
color: "#0a92c4"
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "#0a92c4",
color: "#0a92c4"
},
{
offset: 1,
color: "#ffe",
},
]),
},
},
],
color: "#ffe"
}
])
}
}
]
};
window[this.fwyy] = echarts.init(document.getElementById(this.fwyy));
window[this.fwyy].setOption(options, true);
},
},
}
}
};
</script>
......
......@@ -24,8 +24,14 @@
</div>
</div>
<div class="type_box_select">
<mavon-editor v-model="list_arr" :boxShadow="false" :toolbarsFlag="false" :subfield="subfield" :defaultOpen="preview" :editable="false" v-if="now_service == 0"/>
<!-- <mavon-editor v-model="list_arr" :boxShadow="false" :toolbarsFlag="false" :subfield="subfield" :defaultOpen="preview" :editable="false" v-if="now_service == 0"/> -->
<info-list
:list_arr="list_arr"
v-if="now_service == 0"
>
<mavon-editor slot="app_code" v-model="appcode" :boxShadow="false" :toolbarsFlag="false" :subfield="subfield" :defaultOpen="preview" :editable="false"/>
</info-list>
<div v-if="now_service == 1&&now_user == 0">
<p style="color:#8890a7;">镜像列表:</p>
<!-- <table-um
......@@ -253,7 +259,25 @@ export default {
now_service: 0,
header_arr: [],
list_arr: '',
list_arr: [
{
title: "应用简介:",
info: "",
},
{
title: "功能简介:",
info: "",
},
{
title: "应用场景:",
info: "",
},
{
title: "应用参数:",
info: "",
type: "solt",
solt_name: "app_code",
}],
appcode: "",
addImageFlag:false
};
......@@ -280,6 +304,7 @@ export default {
this.get_image_list()
this.get_options()
this.get_file_name()
this.get_app_code()
},
mounted() {
this.header_arr = [
......@@ -588,13 +613,24 @@ export default {
getServiceBaseInfo() {
this.$http
.get("/apaas/hubApi/market/readme/"+this.$route.params.id)
.get("/apaas/hubApi/market/app/detail/"+this.$route.params.id)
.then((response) => {
let data = response.data.data;
this.list_arr = data
this.$set(this.list_arr[0], "info", data.yyjj);
this.$set(this.list_arr[1], "info", data.gnjj);
this.$set(this.list_arr[2], "info", data.cjsl);
})
.catch(function(response) {});
},
get_app_code(){
this.$http
.get("/apaas/hubApi/market/values/"+this.$route.params.id)
.then((response) => {
let data = response.data.data;
this.appcode = data
})
.catch(function(response) {});
}
},
};
......
......@@ -463,6 +463,9 @@ export default {
this.getServiceBaseInfo();
this.getServiceyxztInfo();
this.getImageInfo();
if(this.$route.query.showstate){
this.now_service = 1
}
},
mounted() {},
methods: {
......
......@@ -25,24 +25,36 @@
ref="step1_form"
class="step_form"
label-position="top"
:model="image_info"
:model="baseInfoForm"
:rules="image_rules"
>
<el-form-item label="镜像名称:" prop="image_name">
<el-input
v-model="image_info.image_name"
placeholder="请输入镜像名称"
></el-input>
<el-form-item label="工作区域:" prop="namespace">
<el-select
v-model="baseInfoForm.namespace"
placeholder="请选择工作区域"
>
<el-option
v-for="item in area_options"
:key="item.value"
:label="item.text"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="版本号:" prop="tag">
<el-form-item label="应用部署名称:" prop="name">
<el-input
v-model="image_info.tag"
placeholder="请输入版本号"
v-model="baseInfoForm.name"
placeholder="请输入应用部署名称"
></el-input>
</el-form-item>
</el-form>
<div class="apass_button step_action">
<el-button type="primary" @click="nextStep">
<el-button
type="primary"
:disabled="is_loading"
@click="sub_yy_form('step1_form', 1)"
>
下一步
</el-button>
</div>
......@@ -53,11 +65,130 @@
:active-icon="require('@/assets/imgs/progress_ic_yingyongpz.png')"
>
<!-- content -->
<div class="apass_button step_action">
<el-button type="primary" plain @click="preStep">
<el-form
v-show="!senior_flag"
ref="step2_form"
class="step_form"
label-position="top"
:rules="app_set_rules"
>
<div v-for="(item, index) in step2_arr" :key="index + 10000">
<el-form-item :label="item.text" v-if="item.type == 'text'">
<el-input v-model="item.value"></el-input>
</el-form-item>
<el-form-item :label="item.text" v-if="item.type == 'radio'">
<div
:class="{ select_box: true, is_select: item.val == vision }"
v-for="vision in item.value"
:key="vision"
@click="change_appset(item, 'val', vision)"
>
{{ vision }}
</div>
</el-form-item>
<el-form-item
:label="item.text + '-内存:'"
class="limitsd"
v-if="item.type == 'resource'"
>
<el-input
type="number"
class="limitinput"
v-model="item.memory"
placeholder="请输入内存"
></el-input>
<el-select
v-model="item.memory_type"
class="timeslect"
placeholder="请选择内存"
>
<el-option
v-for="item in memory_arr"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
:label="item.text + '-CPU:'"
v-if="item.type == 'resource'"
>
<el-input
type="number"
v-model="item.cpu"
placeholder="请输入标题"
>
<template slot="append">M</template>
</el-input>
</el-form-item>
<el-form-item :label="item.text" v-if="item.type == 'switch'">
<div
class="openbgc"
@click="openstart(item, 'value')"
:style="
!item.value
? {
backgroundImage:
'url(' +
require('@/assets/imgs/btn_off_hov.png') +
')',
}
: {}
"
></div>
</el-form-item>
<el-form-item :label="item.text" v-if="item.type == 'storage'">
<div
:class="{
select_box: true,
is_select: item.storage == save,
}"
v-for="save in save_arr[item.dwtype]"
:key="save"
@click="change_appset(item, 'storage', save)"
>
{{ save }}
</div>
</el-form-item>
</div>
</el-form>
<div class="senior_box" @click="senior_flag = true" v-if="!senior_flag">
高级配置
</div>
<div class="apass_button step_action" v-if="!senior_flag">
<el-button type="primary" plain @click="pre_step">
上一步
</el-button>
<el-button type="primary" @click="nextStep">
<el-button
type="primary"
:disabled="is_loading"
@click="sub_app_set()"
>
下一步
</el-button>
</div>
<p
v-if="senior_flag"
style="color: #58617a;font-size: 14px;margin-bottom:10px;margin-top:30px;"
>
高级配置:
</p>
<v-apaas-code v-if="senior_flag" :datas="app_set_code"></v-apaas-code>
<div class="apass_button step_action" v-if="senior_flag">
<el-button type="primary" plain @click="deal_code(0)">
取消
</el-button>
<el-button
type="primary"
:disabled="is_loading"
@click="deal_code(1)"
>
下一步
</el-button>
</div>
......@@ -72,99 +203,341 @@
style="margin-top: 30px;"
></deployment-info>
<div class="apass_button step_action">
<el-button type="primary">
<el-button
type="primary"
v-if="finallyState === 1"
@click="finallyAction1"
>
前往查看
</el-button>
<el-button type="primary">
<el-button
type="primary"
v-if="finallyState === 2"
@click="finallyAction2"
>
重新部署
</el-button>
</div>
</app-build-step>
</app-build-steps>
<apass-dialog
ref="dialog"
:title="dialogInfo.title"
:msg="dialogInfo.msg"
:submit="dialogInfo.submit"
></apass-dialog>
</div>
</template>
<script>
import appBuildSteps from "@/components/app-build-steps/app-build-steps";
import appBuildStep from "@/components/app-build-steps/app-build-step";
import apassDialog from "@/components/apass-dialog";
import codes from "@/components/codes";
import yaml from "js-yaml";
var checkNumber = (rule, value, callback) => {
if (!value) {
return callback(new Error("不能为空"));
}
setTimeout(() => {
if (new RegExp("^[1-9][0-9]*$").test(value)) {
callback();
} else {
callback(new Error("请输入正整数"));
}
});
};
var checkName = (rule, value, callback) => {
if (new RegExp("^[a-z]([0-9]||[a-z]||-)*$").test(value)) {
callback();
} else {
callback(new Error("小写字母开头,可以由小写字母、数字、- 组成"));
}
};
import deploymentInfo from "@/components/deployment-info";
export default {
components: {
appBuildSteps,
appBuildStep,
apassDialog,
deploymentInfo,
"v-apaas-code": codes,
},
data: () => ({
step: 0,
dialogInfo: {
title: "",
msg: "",
submit: null,
},
image_info: {
image_name: "",
tag: "",
file: "",
},
image_rules: {
image_name: [
{ required: true, message: "请输入镜像名称", trigger: "blur" },
],
tag: [{ required: true, message: "请输入版本号", trigger: "blur" }],
file: [{ required: true, message: "请选择镜像文件", trigger: "change" }],
senior_flag: false,
begin_code: "",
baseInfoForm: {
namespace: "",
name: "",
},
evtUuid: "",
evtSource: null,
listStatus: [],
state: "",
text: "",
url: "",
act: 0,
stateList: [
{
name: "获取部署参数",
value: "values",
content: "获取部署参数",
state: 1,
},
app_set: {},
app_set_info: {},
area_options: [
{
name: "拉取部署文件",
value: "pull-chart",
content: "拉取部署文件",
state: 1,
name: "12312",
value: 1,
},
],
save_arr: [
["2Gi", "4Gi", "8Gi", "16Gi", "32Gi", "64Gi", "128Gi", "256Gi", "512Gi"],
["2TB", "4TB", "8TB", "16TB", "32TB", "64TB", "128TB", "256TB", "512TB"],
],
memory_arr: [
{
name: "开始部署",
value: "install",
content: "开始部署",
state: 1,
value: "Mi",
label: "Mi",
},
{
name: "部署状态",
value: "deploy-status",
content: "部署状态",
state: 2,
value: "Gi",
label: "Gi",
},
],
image_rules: {
namespace: [
{ required: true, message: "请选择工作区域", trigger: "change" },
],
name: [
{ required: true, message: "请输入应用部署名称", trigger: "blur" },
{ validator: checkName, trigger: "blur" },
],
},
app_set_code: "",
is_change: false,
is_loading: false,
app_set_rules: {
title: [{ required: true, message: "请输入标题", trigger: "blur" }],
memory: [
{ required: true, message: "请输入内存", trigger: "blur" },
{ validator: checkNumber, trigger: "blur" },
],
cpu: [
{ required: true, message: "请输入cpu", trigger: "blur" },
{ validator: checkNumber, trigger: "blur" },
],
vision: [{ required: true, message: "请选择版本号", trigger: "change" }],
save_memory: [
{ required: true, message: "请选择存储容量", trigger: "change" },
],
},
step2_arr: [],
deploy_id: "",
evtUuid: "",
evtSource: null,
stateList: [],
finallyState: 0,
}),
methods: {
preStep() {
get_name_space() {
this.$http.get(`/apaas/hubApi/market/namespaces`).then((response) => {
console.log(response);
this.area_options = response.data.data;
});
},
get_step_info() {
this.$http
.get(`/apaas/hubApi/market/step/${this.$route.params.app_id}`)
.then((response) => {
let step2_arr = JSON.parse(response.data.data).configInfo;
console.log(step2_arr);
step2_arr.forEach((e) => {
if (e.type == "radio") {
e["val"] = e.value[0];
// this.deal_key_value(this.app_set_info,e.name,e.type,e.value[0])
} else if (e.type == "storage") {
e["dwtype"] = e.storage.indexOf("Gi") == -1 ? 1 : 0;
// this.deal_key_value(this.app_set_info,e.name,e.type,e.storage)
} else if (e.type == "resource") {
let memory = e.memory;
let cpu = e.cpu;
e["memory_type"] = memory.indexOf("Mi") == -1 ? "Gi" : "Mi";
e["memory"] = parseInt(memory);
e["cpu"] = parseInt(cpu);
// this.deal_key_value(this.app_set_info,e.name,'resource',[memory,cpu])
} else {
// this.deal_key_value(this.app_set_info,e.name,e.type,e.value)
}
});
this.step2_arr = step2_arr;
console.log(this.app_set_info);
});
},
get_step_file() {
this.$http
.get(`/apaas/hubApi/market/values/${this.$route.params.app_id}`)
.then((response) => {
this.app_set_code = response.data.data;
});
},
change_appset(obj, key, val) {
console.log(key, val);
this.$set(obj, key, val);
},
deal_key_value(key_string, type, value) {
var key_arr = key_string.split(".");
var temp = this.app_set_info;
key_arr.forEach((e, index) => {
if (key_arr.length - 1 == index) {
if (type == "resource") {
temp[e] = {
limits: {
memory: value[1] + value[0],
cpu: value[2] + "m",
},
requests: {
memory: value[1] + value[0],
cpu: value[2] + "m",
},
};
} else if (type == "storage") {
temp[e] = {
volumeClaimTemplate: {
spec: {
storageClassName: "nfs-client",
accessModes: ["ReadWriteOnce"],
resources: {
requests: {
storage: value,
},
},
},
selector: {},
},
};
} else {
temp[e] = value;
}
} else {
if (temp[e]) {
} else {
temp[e] = {};
}
temp = temp[e];
}
});
},
deal_key_text(obj, key_string) {
var key_arr = key_string.split(".");
var temp = obj;
key_arr.forEach((e, index) => {
if (key_arr.length - 1 == index) {
} else {
temp = temp[e];
}
});
},
deal_code(n) {
if (n) {
//调用接口
this.change_form_aploy(0);
}
this.senior_flag = false;
},
change_form_aploy(n) {
this.is_loading = true;
if (n == 1) {
//表单提交
var temp = {
app_id: parseInt(this.$route.params.app_id),
up_userid: this.$store.state.userInfo.user_id,
name: this.baseInfoForm.name,
namespace: this.baseInfoForm.namespace,
uu: this.evtUuid,
values: this.app_set_info,
};
} else {
//编辑提交
var temp = {
app_id: parseInt(this.$route.params.app_id),
up_userid: this.$store.state.userInfo.user_id,
name: this.baseInfoForm.name,
namespace: this.baseInfoForm.namespace,
uu: this.evtUuid,
values: yaml.load(this.app_set_code),
};
}
this.next_step();
this.$http
.post(`/apaas/hubApi/market/build`, temp)
.then((response) => {
this.is_loading = false;
if (response.data.success === 1) {
// this.$message.success("开始部署成功");
this.deploy_id = response.data.data.deploy_id;
}
})
.catch(() => {
this.is_loading = false;
});
},
sub_yy_form(formName, n) {
this.$refs[formName].validate((valid) => {
if (valid) {
if (n == 1) {
this.get_work_name();
} else if (n == 2) {
this.sub_app_set();
}
} else {
console.log("error submit!!");
return false;
}
});
},
get_work_name() {
this.is_loading = true;
this.$http
.get(
`/apaas/hubApi/market/exist/${this.baseInfoForm.namespace}?name=${this.baseInfoForm.name}`
)
.then((response) => {
console.log(response);
this.is_loading = false;
if (response.data.success) {
if (response.data.data) {
this.$message.error("工作名称已存在");
} else {
this.next_step();
}
}
})
.catch(() => {
this.is_loading = false;
});
},
sub_app_set() {
this.is_loading = true;
this.step2_arr.forEach((e) => {
if (e.type == "radio") {
this.deal_key_value(e.name, e.type, e.val);
} else if (e.type == "storage") {
this.deal_key_value(e.name, e.type, e.storage);
} else if (e.type == "resource") {
let memory = e.memory;
let cpu = e.cpu;
this.deal_key_value(e.name, "resource", [
e.memory_type,
e.memory,
e.cpu,
]);
} else {
this.deal_key_value(e.name, e.type, e.value);
}
});
console.log(this.app_set_info);
console.log(this.step2_arr);
//表单提交调用接口
this.change_form_aploy(1);
},
openstart(item, key) {
if (item[key]) {
this.$set(item, key, false);
// item[key] = false;
} else {
// item[key] = true;
this.$set(item, key, true);
}
},
pre_step() {
this.step--;
},
nextStep() {
next_step() {
this.step++;
},
getStatus() {
get_status() {
let evtUuid = Math.random()
.toString(16)
.substr(3);
......@@ -175,81 +548,85 @@ export default {
this.evtUuid = evtUuid;
this.evtSource = evtSource;
evtSource.addEventListener("message", function(e) {
if (this.listStatus.map((o) => o.status).indexOf(e.lastEventId) == -1) {
if (this.listStatus.length) {
this.listStatus[this.listStatus.length - 1].success = "success";
}
this.listStatus.push({
status: e.lastEventId,
success: JSON.parse(e.data).state,
data: JSON.parse(e.data).data,
});
this.text = this.listStatus[this.listStatus.length - 1].data;
this.text = "<span class='linenum'></span>" + this.text;
this.text = this.text.replace(
/\n/g,
"\n<span class='linenum'></span>"
);
this.text = this.text.replace(/>==>/g, ">>");
this.act = this.listStatus.length - 1;
} else {
let i = this.listStatus.map((o) => o.status).indexOf(e.lastEventId);
let item = this.listStatus[i].data;
evtSource.addEventListener("message", (event) => {
console.log(event);
this.update_status({
id: event.lastEventId,
data: JSON.parse(event.data),
});
});
},
update_status(event) {
let names = {
values: "获取部署参数",
"pull-chart": "拉取部署文件",
install: "开始部署",
"deploy-status": "部署状态",
};
let currentState = this.stateList.find((state) => {
return state.value === event.id;
});
item = item + "\n" + JSON.parse(e.data).data;
if (!currentState) {
if (this.stateList.length > 0) {
this.stateList[this.stateList.length - 1].state = 1;
}
this.listStatus[i].data = item;
this.text = this.listStatus[this.listStatus.length - 1].data;
this.text = "<span class='linenum'></span>" + this.text;
this.text = this.text.replace(
/\n/g,
"\n<span class='linenum'></span>"
);
this.text = this.text.replace(/>==>/g, ">>");
this.act = this.listStatus.length - 1;
this.stateList.push({
name: names[event.id],
value: event.id,
content: [],
state: 0,
});
if (JSON.parse(e.data).state != "notes") {
this.listStatus[i].success = JSON.parse(e.data).state;
}
}
currentState = this.stateList[this.stateList.length - 1];
}
if (JSON.parse(e.data).state == "success") {
this.state = "部署成功!";
this.url = `https://${window.location.host}/apaas/ui/#/pods?namespace=${this.baseInfoForm.namespace}`;
}
currentState.content.push(...event.data.data.split("\n"));
for (let i = 0; i < this.listStatus.length; i++) {
switch (this.listStatus[i].status) {
case "values":
this.listStatus[i].statusHan = "获取部署参数";
break;
case "pull-chart":
this.listStatus[i].statusHan = "拉取部署文件";
break;
case "install":
this.listStatus[i].statusHan = "开始部署";
break;
case "deploy-status":
this.listStatus[i].statusHan = "部署状态";
break;
default:
this.listStatus[i].statusHan = "其他";
break;
}
if (event.id === "deploy-status") {
let finallyState = event.data.state === "success" ? 1 : 2;
this.finallyState = finallyState;
currentState.state = finallyState;
} else {
if (event.data.state !== "notes") {
currentState.state = 2;
}
}
},
finallyAction1() {
this.$router.push({
path: `/yygl/0/1/deploydetail/${this.deploy_id}`,
query: {
showstate: true,
},
});
},
finallyAction2() {
this.init();
},
init() {
this.step = 0;
this.get_status();
this.get_name_space();
this.get_step_info();
this.get_step_file();
},
},
mounted() {
this.getStatus();
created() {
this.init();
},
};
</script>
<style scoped>
.openbgc {
width: 56px;
height: 23px;
background-image: url("~@/assets/imgs/btn_on_hov.png");
background-size: contain;
cursor: pointer;
}
.deployment-container {
margin: 20px 40px;
}
......@@ -265,9 +642,60 @@ export default {
.step_action .el-button:not(:last-child) {
margin-right: 30px;
}
.select_box {
height: 35px;
line-height: 35px;
background-color: #f7f8f9;
border-radius: 6px;
font-size: 14px;
color: #6573ae;
text-align: center;
float: left;
margin-right: 10px;
cursor: pointer;
padding: 0 20px;
}
.is_select {
background-color: #515fe7;
color: #f8f9fd;
}
.limitsd {
position: relative;
}
.deployment-container .step_form .el-form-item.limitsd .timeslect {
position: absolute;
width: 100px;
right: 0;
top: 0;
}
.senior_box {
width: 124px;
height: 44px;
background-color: #0f2683;
border-radius: 8px;
font-size: 16px;
color: #f8f9fd;
line-height: 44px;
text-align: center;
cursor: pointer;
}
</style>
<style>
.deployment-container .step_form .el-form-item .el-input-group__append,
.el-input-group__prepend {
border-radius: 0 8px 8px 0;
}
.limitsd .timeslect .el-input__inner {
width: 100px;
border-radius: 0 8px 8px 0;
background-color: rgba(15, 38, 131, 1);
color: rgba(248, 249, 253, 1);
border: 0;
}
.limitsd .limitinput .el-input__inner {
width: 860px;
}
.deployment-container .avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
......
......@@ -54,3 +54,27 @@ module.exports.dateStringTransform = function (date) {
return date;
}
}
module.exports.downloadFileFormat = function (fileUrl) {
/*
input: /apaas/static/docs/image/images/1234.png
output: 1234.png
*/
if (fileUrl != "") {
return fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
} else {
return "";
}
}
module.exports.numberFormat = function (num, decimals) {
/*
input: 10000 1000
output: 10 1000
*/
if (num > 10000) {
return Math.floor(num / 10000).toFixed(decimals);
} else {
return num;
}
}
\ No newline at end of file
......@@ -17,7 +17,7 @@
},
{
"name": "服务状态",
"text": "上架中"
"text": "审核中"
}
],
"second": [
......
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