From 85c35d50d4613a7c506d1caf24684b6a6eade749 Mon Sep 17 00:00:00 2001 From: xuyiming Date: Tue, 7 Jul 2020 14:41:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AE=A1=E7=90=86-=E4=BA=91?= =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8=EF=BC=88=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=92=8C=E7=BB=84=E7=BB=87=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=EF=BC=89=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95=E5=AE=8C?= =?UTF-8?q?=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/allot-info-confirm.vue | 106 +++++---- .../organization-list/organization-card.vue | 16 +- .../organization-list/organization-list.vue | 5 + src/pages/workbench/fwgl/fwglList.vue | 225 ++++++++++++------ 4 files changed, 231 insertions(+), 121 deletions(-) diff --git a/src/components/allot-info-confirm.vue b/src/components/allot-info-confirm.vue index 4d834f6..003cd0b 100644 --- a/src/components/allot-info-confirm.vue +++ b/src/components/allot-info-confirm.vue @@ -11,29 +11,23 @@

申请组织:

申请用户:

联系电话:

-

+

上传申请文件:

-

+

@@ -42,35 +36,37 @@

基本信息:

工作区域名称: - +

中文名称: - +

描述信息: - +

工作区域申请规格:

CPU: - +

内存: - +

申请时长:

申请时长: - +

@@ -82,7 +78,12 @@ 取消 - + 确认提交 @@ -96,6 +97,7 @@ export default { components: { apassDialog }, data: () => ({ detail: null, + submitLoading: false, }), methods: { showDialog() { @@ -104,18 +106,22 @@ export default { hideDialog() { this.$refs.confrim.hide(); }, - getDetail(applyid) { + getDetail(apply_id) { this.$http - .get("/apaas/service/v3/resource/user/apply/approveddetail", { + .get("/apaas/service/v3/resource/apply/distributionDisplay", { params: { - type: 0, - applyid: applyid, + apply_id: apply_id, }, }) .then(({ data }) => { if (data.success) { - console.log(data.data); - // this.detail = data.data; + let datas = data.data; + + this.detail = { + ...datas, + cpu: `最高${datas.max_cpu}核,默认${datas.min_cpu}核`, + memory: `最高${datas.max_memory}GB,默认${datas.min_memory}GB`, + }; } else { this.$message({ message: "获取详情失败", @@ -130,24 +136,44 @@ export default { }); }); - this.detail = { - a_申请组织: "贵州省交通运输厅", - a_申请用户: "贵州省交通运输厅", - a_联系电话: "13523232333", - a_上传申请文件: "云资源申请修改意见V2.0审批审批函.pdf", - a_工作区域名称: "aPaaS-V3.0", - a_中文名称: "aPaaS平台V3.0", - a_描述信息: - "用于部署运行aPaaS平台V3.0用于部署运行aPaaS平台V3.0用于部署运行aPaaS平台V3.0", - a_CPU: "最高2核,默认1核", - a_内存: "最高2GB,默认1GB", - a_申请时长: "6个月", - }; - this.showDialog(); }, confrimAction() { - console.log("confrim"); + this.submitLoading = true; + + this.$http + .put("/apaas/service/v3/resource/apply/distribution", null, { + params: { + id: this.detail.id, + user_id: this.detail.user_id, + }, + }) + .then(({ data }) => { + this.submitLoading = false; + + if (data.success) { + this.$message({ + message: "分配成功", + type: "success", + }); + + this.$emit("allot-success"); + this.hideDialog(); + } else { + this.$message({ + message: "分配失败", + type: "warning", + }); + } + }) + .catch((error) => { + this.submitLoading = false; + + this.$message({ + message: "分配失败", + type: "warning", + }); + }); }, }, }; diff --git a/src/components/organization-list/organization-card.vue b/src/components/organization-list/organization-card.vue index 5aaaeac..3381adf 100644 --- a/src/components/organization-list/organization-card.vue +++ b/src/components/organization-list/organization-card.vue @@ -1,10 +1,15 @@ @@ -71,6 +112,7 @@ import apassList from "@/components/apass-list"; import apassDialog from "@/components/apass-dialog"; import allotInfoConfirm from "@/components/allot-info-confirm"; import Dashboard from "@/components/e-charts/dashboard"; +import organizationList from "@/components/organization-list/organization-list"; export default { components: { @@ -78,6 +120,7 @@ export default { apassDialog, allotInfoConfirm, Dashboard, + organizationList, }, data: () => ({ level: 0, // 用户等级 @@ -103,6 +146,7 @@ export default { computed: { ...mapState({ fwglNav: "fwglNav", + userInfo: "userInfo", }), pathName() { return this.fwglNav[this.level][this.type]; @@ -1091,35 +1135,6 @@ export default { // 超级管理员 --- 云资源管理 else if (level == 2 && type == 2) { this.listUrl = "/apaas/service/v3/resource/user/apply/list"; - /* this.cloud_admin = { - dashboard_list: [ - { - name: "cpu使用量", - value: 6, - total: 10, - unit: "(核)", - }, - { - name: "内存使用量", - value: 13, - total: 20, - unit: "(GB)", - }, - { - name: "数据盘使用量", - value: 240, - total: 560, - unit: "(GB)", - }, - { - name: "容器组使用量", - value: 10, - total: 18, - unit: "(个)", - }, - ], - histogram: {}, - }; */ } // Error @@ -1145,7 +1160,7 @@ export default { limit: filter.size, depart: "", state1: filter.state1, - State2: filter.State2, + state2: filter.state2, }; } else { params = { @@ -1177,39 +1192,70 @@ export default { // console.log(data); if (this.type == 2) { - this.listTotal = data.total; - this.listData = data.data.cloud_apply_list; + const cloud = data.data.cloud_resource_count; - this.cloud_zuzhi = { - org_name: "北京比格大数据", - used_area: 2, - dashboard_list: [ - { - name: "cpu使用量", - value: 6, - total: 10, - unit: "(核)", - }, - { - name: "内存使用量", - value: 13, - total: 20, - unit: "(GB)", - }, - { - name: "数据盘使用量", - value: 500, - total: 560, - unit: "(GB)", - }, - { - name: "容器组使用量", - value: 10, - total: 18, - unit: "(个)", - }, - ], - }; + if (this.level == 1) { + this.listTotal = data.total; + this.listData = data.data.cloud_apply_list; + this.cloud_zuzhi = { + count_zy: cloud.count_zy, + dashboard_list: [ + { + name: "cpu使用量", + value: cloud.cpu_use, + total: cloud.cpu_total, + unit: "(核)", + }, + { + name: "内存使用量", + value: cloud.memory_use, + total: cloud.memory_total, + unit: "(GB)", + }, + { + name: "数据盘使用量", + value: cloud.disk_use, + total: cloud.disk_total, + unit: "(GB)", + }, + { + name: "容器组使用量", + value: cloud.containers_use, + total: cloud.containers_total, + unit: "(个)", + }, + ], + }; + } else if (this.level == 2) { + this.cloud_admin = { + dashboard_list: [ + { + name: "cpu使用量", + value: cloud.cpu_use, + total: cloud.cpu_total, + unit: "(核)", + }, + { + name: "内存使用量", + value: cloud.memory_use, + total: cloud.memory_total, + unit: "(GB)", + }, + { + name: "数据盘使用量", + value: cloud.disk_use, + total: cloud.disk_total, + unit: "(GB)", + }, + { + name: "容器组使用量", + value: cloud.containers_use, + total: cloud.containers_total, + unit: "(个)", + }, + ], + }; + } } else { this.listTotal = data.data.total; this.listData = data.data.data; @@ -1218,6 +1264,27 @@ export default { .catch((error) => { console.log(error); }); + + // 超管的云资源管理展示的是组织列表 + if (this.level == 2 && this.type == 2) { + this.$http + .get("/apaas/backmgt/department/list", { + params: { + search: filter.keyword, + page: filter.page, + limit: filter.size, + }, + }) + .then(({ data }) => { + // console.log(data); + + this.listTotal = data.total; + this.listData = data.data; + }) + .catch((error) => { + console.log(error); + }); + } }, showDialog() { this.$refs.dialog.show(); @@ -1414,7 +1481,7 @@ export default { this.$refs.allotConfirm.getDetail(item.apply_id); }, getDashboardOptions(item) { - let percent = Math.round((item.value / item.total) * 100); + let percent = Math.round((item.value / item.total) * 100) || 0; let colors = ["#515fe7", "#e7ecfd"]; if (percent >= 80) { @@ -1569,6 +1636,9 @@ export default { ], }; }, + allotSuccess() { + this.init(this.tempFliter); + }, }, created() { this.level = parseInt(this.$route.params.level); @@ -1599,35 +1669,36 @@ export default { .service_management_list { height: 100%; } -.zuzhi_title { +.cloud_title { margin-top: 15px; } -.zuzhi_title > span, -.zuzhi_title > span::before { +.cloud_title > span, +.cloud_title > span::before { display: inline-block; vertical-align: middle; } -.zuzhi_title > span:nth-child(1)::before { +.cloud_title > span:nth-child(1)::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background-color: #515fe7; margin-right: 10px; + margin-bottom: 2px; } -.zuzhi_title > span:nth-child(1) { +.cloud_title > span:nth-child(1) { font-size: 16px; color: #242c43; line-height: 30px; } -.zuzhi_title > span:nth-child(2)::before { +.cloud_title > span:nth-child(2)::before { content: ""; width: 2px; height: 12px; background-color: #b4c0f5; margin: 0 10px; } -.zuzhi_title > span:nth-child(2) { +.cloud_title > span:nth-child(2) { font-size: 14px; line-height: 1; color: #58617a; -- 2.26.0