diff --git a/src/components/allot-info-confirm.vue b/src/components/allot-info-confirm.vue index 4d834f6a4c40c8c706ba40165f5cb34e3977f66c..003cd0b8cf3211db0d31d1832ee41851df12f15f 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 5aaaeac6b6850b0e9c7e4317a6e1e182d2f6886e..3381adfb594da0e018afbff4d81c9525e1e78ff4 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;