Commit f0ed1124 authored by 赵伟庚's avatar 赵伟庚

[feat](容器平台配置): 接口对接完成

parent 548fa1b4
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
:paddingLeft="32" :paddingLeft="32"
:indexWidth="108" :indexWidth="108"
:stripe="true"> :stripe="true">
<template v-slot:name="{ row }"> <template v-slot:platform_name="{ row }">
<span class="can_click_text" @click="viewDetail(row)"> <span class="can_click_text" @click="viewDetail(row)">
{{ row.name }} {{ row.platform_name }}
</span> </span>
</template> </template>
<template v-slot:created_time="{ row }"> <template v-slot:platform_type="{ row }">
{{ row.created_time.split("+")[0].replace("T", " ").replace("Z", " ") }} {{ ["", "自有平台", "第三方平台"][row.platform_type] }}
</template> </template>
<template v-slot:action="{ row }"> <template v-slot:action="{ row }">
<bg-table-btn <bg-table-btn
...@@ -77,27 +77,43 @@ ...@@ -77,27 +77,43 @@
:rules="rules" :rules="rules"
label-width="130px" label-width="130px"
style="margin-top: 24px"> style="margin-top: 24px">
<el-form-item label="平台类型" prop="type"> <el-form-item label="平台类型" prop="platform_type">
<el-radio-group v-model="formData.type"> <el-radio-group v-model="formData.platform_type">
<el-radio v-for="(item, index) in typeList" :key="'type' + index" :label="item.value"> <el-radio v-for="(item, index) in typeList" :key="'platform_type' + index" :label="item.value">
{{ item.name }} {{ item.name }}
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="平台名称" prop="name"> <el-form-item label="平台名称" prop="platform_name">
<el-input v-model.trim="formData.name" placeholder="请输入平台名称" maxlength="50" show-word-limit /> <el-input v-model.trim="formData.platform_name" placeholder="请输入平台名称" maxlength="50" show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="平台帐号" prop="account" v-if="formData.type == 1"> <el-form-item label="平台帐号" prop="platform_account" v-if="formData.platform_type == 1">
<el-input v-model.trim="formData.account" placeholder="请输入aPaaS在该平台注册的帐号" maxlength="50" show-word-limit /> <el-input
v-model.trim="formData.platform_account"
placeholder="请输入aPaaS在该平台注册的帐号"
maxlength="50"
show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="工作组名称" prop="group_name" v-if="formData.type == 1"> <el-form-item label="工作组名称" prop="work_group" v-if="formData.platform_type == 1">
<el-input v-model.trim="formData.group_name" placeholder="请输入aPaaS在该平台注册申请的工作组名称" maxlength="50" show-word-limit /> <el-input
v-model.trim="formData.work_group"
placeholder="请输入aPaaS在该平台注册申请的工作组名称"
maxlength="50"
show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="服务地址" prop="address" v-if="formData.type == 1"> <el-form-item label="服务地址" prop="service_url" v-if="formData.platform_type == 1">
<el-input v-model.trim="formData.address" placeholder="请输入服务地址URL" maxlength="100" show-word-limit /> <el-input
v-model.trim="formData.service_url"
placeholder="请输入服务地址URL"
maxlength="100"
show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="服务地址TOKEN" prop="address_toekn" v-if="formData.type == 1"> <el-form-item label="服务地址TOKEN" prop="service_token" v-if="formData.platform_type == 1">
<el-input v-model.trim="formData.address_toekn" placeholder="请输入服务地址的TOKEN参数" maxlength="100" show-word-limit /> <el-input
v-model.trim="formData.service_token"
placeholder="请输入服务地址的TOKEN参数"
maxlength="100"
show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="APISERVER" prop="apiserver"> <el-form-item label="APISERVER" prop="apiserver">
<el-input <el-input
...@@ -106,12 +122,16 @@ ...@@ -106,12 +122,16 @@
maxlength="100" maxlength="100"
show-word-limit /> show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="SERVER TOKEN" prop="server_token"> <el-form-item label="SERVER TOKEN" prop="token">
<el-input v-model.trim="formData.server_token" placeholder="请输入SERVER TOKEN参数" maxlength="100" show-word-limit /> <el-input
v-model.trim="formData.token"
placeholder="请输入SERVER TOKEN参数"
maxlength="100"
show-word-limit />
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="desc"> <el-form-item label="描述" prop="platform_desc">
<el-input <el-input
v-model.trim="formData.desc" v-model.trim="formData.platform_desc"
placeholder="请输入描述" placeholder="请输入描述"
maxlength="300" maxlength="300"
show-word-limit show-word-limit
...@@ -135,7 +155,7 @@ ...@@ -135,7 +155,7 @@
<bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon> <bg-icon style="font-size: 12px; color: #fff; margin-right: 8px" icon="#bg-ic-checklist"></bg-icon>
测试链接 测试链接
</el-button> </el-button>
<el-button type="primary" @click="postData">保存</el-button> <el-button type="primary" :disabled="!testSuccess" @click="postData">保存</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
...@@ -174,15 +194,15 @@ const state = reactive({ ...@@ -174,15 +194,15 @@ const state = reactive({
headers: [ headers: [
{ {
label: "容器平台名称", label: "容器平台名称",
prop: "name", prop: "platform_name",
}, },
{ {
label: "平台类型", label: "平台类型",
prop: "type_name", prop: "platform_type",
}, },
{ {
label: "描述", label: "描述",
prop: "desc", prop: "platform_desc",
minWidth: 346, minWidth: 346,
}, },
{ {
...@@ -203,31 +223,31 @@ const state = reactive({ ...@@ -203,31 +223,31 @@ const state = reactive({
], ],
tableRows: [], tableRows: [],
tableTotal: 0, tableTotal: 0,
actionRow: {}, actionRow: {}, // 当前选中的数据
delDialog: false, delDialog: false, // 删除弹窗
dialogType: 1, dialogType: 1, // 1-新增 2-编辑
addDialog: false, addDialog: false, // 新增/编辑弹窗
formData: { formData: {
type: 1, platform_type: 1,
name: "", platform_name: "",
account: "", platform_account: "",
group_name: "", work_group: "",
address: "", service_url: "",
address_toekn: "", service_token: "",
apiserver: "", apiserver: "",
server_token: "", token: "",
desc: "", platform_desc: "",
}, },
rules: { rules: {
name: [{ required: true, message: "平台名称不能为空", trigger: "blur" }], platform_name: [{ required: true, message: "平台名称不能为空", trigger: "blur" }],
type: [{ required: true, message: "请选择平台类型", trigger: "change" }], platform_type: [{ required: true, message: "请选择平台类型", trigger: "change" }],
account: [{ required: true, message: "平台帐号不能为空", trigger: "blur" }], platform_account: [{ required: true, message: "平台帐号不能为空", trigger: "blur" }],
group_name: [{ required: true, message: "工作组名称不能为空", trigger: "blur" }], work_group: [{ required: true, message: "工作组名称不能为空", trigger: "blur" }],
address: [{ required: true, message: "服务地址URL不能为空", trigger: "blur" }], service_url: [{ required: true, message: "服务地址URL不能为空", trigger: "blur" }],
address_toekn: [{ required: true, message: "服务地址的TOKEN参数不能为空", trigger: "blur" }], service_token: [{ required: true, message: "服务地址的TOKEN参数不能为空", trigger: "blur" }],
apiserver: [{ required: true, message: "APISERVER参数不能为空", trigger: "blur" }], apiserver: [{ required: true, message: "APISERVER参数不能为空", trigger: "blur" }],
server_token: [{ required: true, message: "SERVER TOKEN参数不能为空", trigger: "blur" }], token: [{ required: true, message: "SERVER TOKEN参数不能为空", trigger: "blur" }],
desc: [{ required: true, message: "描述不能为空", trigger: "blur" }], platform_desc: [{ required: true, message: "描述不能为空", trigger: "blur" }],
}, },
typeList: [ typeList: [
{ {
...@@ -239,7 +259,7 @@ const state = reactive({ ...@@ -239,7 +259,7 @@ const state = reactive({
value: 2, value: 2,
}, },
], ],
detailDialog: false, detailDialog: false, // 详情弹窗
platfromInfo: [ platfromInfo: [
{ {
name: "平台类型", name: "平台类型",
...@@ -287,92 +307,47 @@ const state = reactive({ ...@@ -287,92 +307,47 @@ const state = reactive({
nameWidth: 144, nameWidth: 144,
}, },
], ],
testSuccess: false, // 测试链接结果
}); });
const getRoleRows = () => { const getRoleRows = () => {
let params = { ...state.filter }; let params = { ...state.filter };
console.log(params); axios.get(`/apaas/application/v5/platform/list`, { params }).then((res) => {
state.tableRows = [ if (res.data.code == 200) {
{ state.tableRows = res.data.data || [];
id: 1, state.tableTotal = res.data.total;
type: 1, } else {
name: "比格容器云平台", ElMessage.error(res.data.data);
account: "admin", }
group_name: "beagle", });
type_name: "自有平台", }; // 获取列表
desc: "这是一个由比格大数据公司自主研发的一款云原生容器平台这是一个由比格大数据公司自主研发的一款云原生容器平台",
created_by: "王先生",
created_time: "2020-01-01 00:00:00",
address: "https://cloud1.wodcloud.com/",
address_token: "11112321123123123123",
apiserver: "https://apaas1.wodcloud.com/",
server_token: "1234567bqsid123k12s0h1d3uhf493fh02hd3h38ff",
},
{
id: 2,
type: 2,
name: "阿里云平台",
type_name: "第三方平台",
desc: "阿里云平台",
created_by: "王先生",
created_time: "2020-01-01 00:00:00",
apiserver: "https://apaas2.wodcloud.com/",
server_token: "abcdefgbqsis0h1d3uhf493fh02hdd102h9s3h38ff",
},
{
id: 3,
type: 2,
name: "腾讯云平台",
type_name: "第三方平台",
desc: "这是腾讯云平台啊",
created_by: "王先生",
created_time: "2020-01-01 00:00:00",
apiserver: "https://apaas3.wodcloud.com",
server_token: "bqsid123k12s0h1d3uhf493fh02hddsaassdsh38ff",
},
];
state.tableTotal = 3;
// axios.get(`/apaas/system/v5/role/list`, { params }).then((res) => {
// if (res.data.code == 200) {
// state.tableRows = res.data.data || [];
// state.tableTotal = res.data.total;
// } else {
// ElMessage.error(res.data.data);
// }
// });
}; // 获取角色列表
const changePage = (val) => { const changePage = (val) => {
state.filter.page = val; state.filter.page = val;
getRoleRows(); getRoleRows();
}; // 改变页码 }; // 改变页码
const changeSize = (val) => { const changeSize = (val) => {
state.filter.limit = val; state.filter.limit = val;
changePage(1); changePage(1);
}; // 改变每页条数 }; // 改变每页条数
const changeSearch = (val) => { const changeSearch = (val) => {
state.filter.search = val; state.filter.search = val;
changePage(1); changePage(1);
}; // 表格关键字筛选 }; // 表格关键字筛选
const register = () => { const register = () => {
resetForm(); resetForm();
state.dialogType = 1; state.dialogType = 1;
state.addDialog = true; state.addDialog = true;
}; // 新增 }; // 新增
const resetForm = () => { const resetForm = () => {
state.formData = { state.formData = {
type: 1, platform_type: 1,
name: "", platform_name: "",
account: "", platform_account: "",
group_name: "", work_group: "",
address: "", service_url: "",
address_toekn: "", service_token: "",
apiserver: "", apiserver: "",
server_token: "", token: "",
desc: "", platform_desc: "",
}; };
if (bgForm.value) { if (bgForm.value) {
nextTick(() => { nextTick(() => {
...@@ -383,51 +358,89 @@ const resetForm = () => { ...@@ -383,51 +358,89 @@ const resetForm = () => {
}); });
}); });
} }
}; }; // 重置表单
const viewDetail = (row) => { const viewDetail = async (row) => {
state.platfromInfo[0].value = row.type_name let { data } = await getDetail(row.id);
state.platfromInfo[1].value = row.name if (data.code == 200) {
state.platfromInfo[2].value = row.account state.platfromInfo[0].value = ["", "自有平台", "第三方平台"][data.data.platform_type];
state.platfromInfo[3].value = row.group_name state.platfromInfo[1].value = data.data.platform_name;
state.platfromInfo[4].value = row.address state.platfromInfo[2].value = data.data.platform_account;
state.platfromInfo[5].value = row.address_token state.platfromInfo[3].value = data.data.work_group;
state.platfromInfo[6].value = row.apiserver state.platfromInfo[4].value = data.data.service_url;
state.platfromInfo[7].value = row.server_token state.platfromInfo[5].value = data.data.service_token;
state.platfromInfo[8].value = row.desc state.platfromInfo[6].value = data.data.apiserver;
if (row.type == 2) { state.platfromInfo[7].value = data.data.token;
state.platfromInfo.splice(2,4) state.platfromInfo[8].value = data.data.platform_desc;
if (data.data.platform_type == 2) {
state.platfromInfo.splice(2, 4);
} }
state.detailDialog = true; state.detailDialog = true;
console.log(row, "查看详情"); } else {
ElMessage.error(data.data);
}
}; // 查看详情 }; // 查看详情
const getDetail = (id) => {
const edit_row = (row) => { return axios.get(`/apaas/application/v5/platform/detail/${id}`);
}; // 获取详情
const edit_row = async (row) => {
resetForm(); resetForm();
let { data } = await getDetail(row.id);
if (data.code == 200) {
Object.assign(state.formData, data.data);
state.dialogType = 2; state.dialogType = 2;
state.addDialog = true; state.addDialog = true;
} else {
ElMessage.error(data.data);
}
}; // 编辑 }; // 编辑
const testUrl = () => {
const testUrl = () => {}; bgForm.value.validate((valid) => {
const postData = () => {}; if (valid) {
let params = {
...state.formData,
};
axios.post(`/apaas/application/v5/platform/check`, params).then((res) => {
if (res.data.code == 200) {
ElMessage.success("链接测试通过!");
state.testSuccess = true;
} else {
ElMessage.error(res.data.data);
}
});
}
});
}; // 测试链接
const postData = () => {
let params = {
...state.formData,
};
let url = ["", "/apaas/application/v5/platform/add", "/apaas/application/v5/platform/update"];
axios.post(url[state.dialogType], params).then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg);
state.addDialog = false;
state.testSuccess = false;
changePage(1);
} else {
ElMessage.error(res.data.data);
}
});
}; // 新建/编辑数据
const delete_row = (row) => { const delete_row = (row) => {
state.actionRow = row; state.actionRow = row;
state.delDialog = true; state.delDialog = true;
}; // 删除 }; // 删除
const deleteData = () => { const deleteData = () => {
console.log(state.actionRow); axios.delete(`/apaas/application/v5/platform/${state.actionRow.id}`).then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg);
state.delDialog = false; state.delDialog = false;
// axios.delete(`/apaas/system/v5/role/delete`, { data: { ids: [...ids] } }).then((res) => { changePage(1);
// if (res.data.code == 200) { } else {
// ElMessage.success(res.data.msg); ElMessage.error(res.data.data);
// state.delDialog = false; }
// changePage(1); });
// } else { }; // 确认删除
// ElMessage.error(res.data.data);
// }
// });
};
onBeforeMount(() => { onBeforeMount(() => {
getRoleRows(); getRoleRows();
}); });
...@@ -445,6 +458,7 @@ const { ...@@ -445,6 +458,7 @@ const {
typeList, typeList,
detailDialog, detailDialog,
platfromInfo, platfromInfo,
testSuccess,
} = toRefs(state); } = toRefs(state);
</script> </script>
......
import { defineConfig } from 'vite' import { defineConfig } from "vite";
import vue from '@vitejs/plugin-vue' import vue from "@vitejs/plugin-vue";
const path = require('path') const path = require("path");
function resolve_path (dir) { function resolve_path(dir) {
return path.join(__dirname, './', dir) return path.join(__dirname, "./", dir);
} }
export default { export default {
plugins: [ plugins: [vue()],
vue()
],
//本地运行基础路径,如:http://localhost:5173/apaas/ui/ //本地运行基础路径,如:http://localhost:5173/apaas/ui/
base: "/apaas/manage/ui/", base: "/apaas/manage/ui/",
clearScreen:false, clearScreen: false,
resolve:{ resolve: {
//别名,代码引入时方便引入 //别名,代码引入时方便引入
alias:{ alias: {
'@':resolve_path('src'), "@": resolve_path("src"),
} },
}, },
css:{ css: {
devSourcemap:true,//代码编排,调试时是否能看到源码 devSourcemap: true, //代码编排,调试时是否能看到源码
}, },
server:{ server: {
host:'0.0.0.0',//host配置,0.0.0.0会添加本地ip,开启局域网访问路径 host: "0.0.0.0", //host配置,0.0.0.0会添加本地ip,开启局域网访问路径
hmr:true,//热更新 hmr: true, //热更新
proxy: { proxy: {
// 选项写法 // 选项写法
'/apaas/system':{ "/apaas/system": {
target: 'https://apaas5.wodcloud.com/apaas/system', // 所要代理的目标地址 target: "https://apaas5.wodcloud.com/apaas/system", // 所要代理的目标地址
rewrite: path => path.replace(/^\/apaas\/system/, ''), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的) rewrite: (path) => path.replace(/^\/apaas\/system/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的)
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false,//解决证书缺失问题 secure: false, //解决证书缺失问题
}, },
'/apaas/portal/ui':{ "/apaas/portal/ui": {
target: 'https://apaas5.wodcloud.com/apaas/portal/ui', // 所要代理的目标地址 target: "https://apaas5.wodcloud.com/apaas/portal/ui", // 所要代理的目标地址
rewrite: path => path.replace(/^\/apaas\/portal\/ui/, ''), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的) rewrite: (path) => path.replace(/^\/apaas\/portal\/ui/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的)
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false,//解决证书缺失问题 secure: false, //解决证书缺失问题
}, },
'/apaas/service':{ "/apaas/service": {
target: 'https://apaas5.wodcloud.com/apaas/service', // 所要代理的目标地址 target: "https://apaas5.wodcloud.com/apaas/service", // 所要代理的目标地址
rewrite: path => path.replace(/^\/apaas\/service/, ''), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的) rewrite: (path) => path.replace(/^\/apaas\/service/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的)
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false,//解决证书缺失问题 secure: false, //解决证书缺失问题
}, },
'/apaas/common':{ "/apaas/common": {
target: 'https://apaas5.wodcloud.com/apaas/common', // 所要代理的目标地址 target: "https://apaas5.wodcloud.com/apaas/common", // 所要代理的目标地址
rewrite: path => path.replace(/^\/apaas\/common/, ''), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的) rewrite: (path) => path.replace(/^\/apaas\/common/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的)
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false,//解决证书缺失问题 secure: false, //解决证书缺失问题
}, },
} "/apaas/application/v5": {
target: "https://apaas5.wodcloud.com/apaas/application/v5",
rewrite: (path) => path.replace(/^\/apaas\/application\/v5/, ""),
changeOrigin: true,
secure: false,
}, },
build:{
outDir:'dist/apaas/manage/ui',//打包输出文件夹
assetsDir:'static',//打包输出静态文件
}, },
},
} build: {
outDir: "dist/apaas/manage/ui", //打包输出文件夹
assetsDir: "static", //打包输出静态文件
},
};
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