服务器资源查看前端提交
This commit is contained in:
parent
18ecf05d1d
commit
ffda3a3117
|
@ -89,3 +89,17 @@ export const getRealTimeLog = async (params) => {
|
|||
params: params,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 今日该执行端调用接口执行次数
|
||||
* @param params :page、limit
|
||||
* @returns
|
||||
*/
|
||||
export const getInvokeNumToday = async (params) => {
|
||||
return await platformRequest({
|
||||
url: "/api/rest/statistics/getInvokeNumToday",
|
||||
method: 'GET',
|
||||
cType: false,
|
||||
params: params,
|
||||
});
|
||||
};
|
|
@ -213,3 +213,31 @@ export const downLoadInterfaceFile = async (uri) => {
|
|||
responseType:'blob'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取注册接口数量列表--执行端
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export const getRegisterNum = async (params) => {
|
||||
return await platformRequest({
|
||||
url: "/api/rest/interface/getRegisterNum",
|
||||
method: 'GET',
|
||||
cType: false,
|
||||
params: params,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取接口注册执行端IP端口
|
||||
* @param params
|
||||
* @returns
|
||||
*/
|
||||
export const getIpPortByInterfaceId = async (params) => {
|
||||
return await platformRequest({
|
||||
url: "/api/rest/interface/getIpPortByInterfaceId",
|
||||
method: 'GET',
|
||||
cType: false,
|
||||
params: params,
|
||||
});
|
||||
};
|
|
@ -22,7 +22,7 @@ function y9Request(baseUrl = '') {
|
|||
let requestList = new Set();
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: import.meta.env.VUE_APP_CONTEXT,
|
||||
baseURL: baseUrl==""?import.meta.env.VUE_APP_CONTEXT:baseUrl,
|
||||
withCredentials: true,
|
||||
timeout: 0,
|
||||
});
|
||||
|
|
|
@ -23,16 +23,63 @@
|
|||
</template>
|
||||
</y9Dialog>
|
||||
|
||||
<y9Dialog v-model:config="openChartConfig">
|
||||
<template v-slot>
|
||||
<el-card class="box-card">
|
||||
<div class="card-header">
|
||||
<span>{{ $t('服务使用概况') }}</span>
|
||||
<div style="height: 32px;"></div>
|
||||
</div>
|
||||
<div class="overview-content">
|
||||
<!-- 数值展示 -->
|
||||
<div class="stat-items">
|
||||
<div class="stat-item">
|
||||
<h2>{{ serviceUsedData.registerCount }}</h2>
|
||||
<span>{{ $t('注册接口数') }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<h2>{{ serviceUsedData.aveCount }}</h2>
|
||||
<span>{{ $t('平均每天请求次数') }}</span>
|
||||
</div>
|
||||
<div class="stat-item">
|
||||
<h2>{{ serviceUsedData.todayCount }}</h2>
|
||||
<span>{{ $t('今日调用次数') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-row class="bottomArea">
|
||||
<el-col :span="4"></el-col>
|
||||
<el-col :span="8">
|
||||
<el-row class="labelTitle"><span>系统CPU使用率</span></el-row>
|
||||
<el-row>
|
||||
<div ref="cpuChartContainerRef" style="width: 100%; height: 200px;"></div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-row class="labelTitle"><span>内存使用率</span></el-row>
|
||||
<el-row>
|
||||
<div ref="memoryChartContainerRef" style="width: 100%; height: 200px;"></div>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="4"></el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
</y9Dialog>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { computed, h, ref, inject } from 'vue';
|
||||
import { computed, h, ref, inject, nextTick } from 'vue';
|
||||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import { getPage, saveInfo, getInfoById, delInfoById, updateEnable } from '@/api/execute/execute'
|
||||
import {getMayApplyInterfaceList} from '@/api/interface/interface'
|
||||
import { getPage, saveInfo, delInfoById } from '@/api/execute/execute'
|
||||
import {getRegisterNum} from '@/api/interface/interface'
|
||||
import { getCpuUsed, getMaxMemory, getUsedMemory,getHttpServerReqs } from '@/api/serviceResourceIndicators/serviceResourceIndicators'
|
||||
import {getInvokeNumToday} from "@/api/home/home";
|
||||
import { ElMessage, ElMessageBox, ElSwitch } from 'element-plus';
|
||||
import '@/assets/css/tablestatusfontcolor.css';
|
||||
import * as echarts from 'echarts';
|
||||
import 'echarts-liquidfill';
|
||||
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
|
@ -42,9 +89,17 @@ const selectedDate = ref();
|
|||
const query: any = ref({});
|
||||
const filterRef = ref();
|
||||
const interfaceList = ref([]);
|
||||
const cpuChartContainerRef = ref();
|
||||
const memoryChartContainerRef = ref();
|
||||
const serviceUsedData = ref({
|
||||
registerCount:0,
|
||||
todayCount:0,
|
||||
aveCount:0
|
||||
})
|
||||
|
||||
const limitInfo = ref(false)
|
||||
const sameId = ref()
|
||||
const qbaseUrl = ref()
|
||||
|
||||
//表格配置
|
||||
let y9TableConfig = ref({
|
||||
|
@ -123,10 +178,12 @@ let y9TableConfig = ref({
|
|||
{
|
||||
title: computed(() => t('操作')),
|
||||
fixed: 'right',
|
||||
width: 210,
|
||||
render: (row) => {
|
||||
return h('div', [h('span', { onClick: () => { view(row) } }, t("详情")),
|
||||
h('span', { class: 'leftMargin', onClick: () => { edit(row,"OUT_OF_SERVICE") } }, t('下线')),
|
||||
h('span', { class: 'leftMargin', onClick: () => { edit(row,"UP") } }, t('上线')),
|
||||
h('span', { class: 'leftMargin', onClick: () => { openChartView(row) } }, t('服务使用情况')),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +202,15 @@ const filterOperaConfig = ref({
|
|||
value: '',
|
||||
key: 'name',
|
||||
label: computed(() => t('名称')),
|
||||
labelWidth: '82px',
|
||||
labelWidth: '42px',
|
||||
span: settingStore.device === 'mobile' ? 24 : 6
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
value: '',
|
||||
key: 'ip',
|
||||
label: computed(() => t('IP')),
|
||||
labelWidth: '42px',
|
||||
span: settingStore.device === 'mobile' ? 24 : 6
|
||||
},
|
||||
{
|
||||
|
@ -216,7 +281,8 @@ function analysisData(data){
|
|||
ip: instance.ipAddr,
|
||||
port: instance.port["$"],
|
||||
status: instance.status,
|
||||
createTime: instance.leaseInfo.registrationTimestamp
|
||||
createTime: instance.leaseInfo.registrationTimestamp,
|
||||
baseUrl: instance.healthCheckUrl.slice(0,-6)
|
||||
}
|
||||
tableData.push(instanceData)
|
||||
}
|
||||
|
@ -251,6 +317,16 @@ const validateNumber = (rule: any, value: any, callback: any) => {
|
|||
callback();
|
||||
}
|
||||
};
|
||||
// 服务器使用情况
|
||||
let openChartConfig = ref({
|
||||
show: false,
|
||||
title: computed(() => t('')),
|
||||
showFooter: true,
|
||||
onOkLoading: true,
|
||||
onOk:(newConfig) =>{
|
||||
openChartView(qbaseUrl.value)
|
||||
}
|
||||
});
|
||||
|
||||
// 增加 修改应用 弹框的变量配置 控制
|
||||
let addDialogConfig = ref({
|
||||
|
@ -372,24 +448,6 @@ let ruleFormConfig = ref({
|
|||
labelAlign: 'center',
|
||||
}
|
||||
});
|
||||
function addDialog() {
|
||||
initInterfaceList()
|
||||
ruleFormConfig.value.model = {isEnable: true }
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
disabled: false
|
||||
}
|
||||
} else {
|
||||
it.props.disabled = false
|
||||
}
|
||||
}
|
||||
addDialogConfig.value.okText = "保存"
|
||||
addDialogConfig.value.title = computed(() => t('新增黑名单信息'))
|
||||
addDialogConfig.value.show = true
|
||||
}
|
||||
|
||||
|
||||
//编辑
|
||||
async function edit(row,type) {
|
||||
let alertText = "下线"
|
||||
|
@ -465,55 +523,243 @@ async function view(data) {
|
|||
addDialogConfig.value.title = computed(() => t('查看实例信息'))
|
||||
addDialogConfig.value.show = true
|
||||
}
|
||||
//删除
|
||||
async function delData(id) {
|
||||
ElMessageBox.confirm(
|
||||
'是否确认删除这条数据',
|
||||
'删除数据确认',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info',
|
||||
draggable: true
|
||||
const openChartView = (data)=>{
|
||||
qbaseUrl.value = data
|
||||
openChartConfig.value.okText = "刷新"
|
||||
openChartConfig.value.title = computed(() => t('查看服务使用情况'))
|
||||
openChartConfig.value.show = true
|
||||
let baseData = {
|
||||
baseUrl:data.baseUrl
|
||||
}
|
||||
).then(() => {
|
||||
let para = {
|
||||
id: id
|
||||
getCpuUsed(baseData).then((res)=>{
|
||||
console.log(res)
|
||||
nextTick(() => {
|
||||
const myChart = echarts.init(cpuChartContainerRef.value)
|
||||
myChart.setOption(buildOptions(parseFloat(res.measurements[0].value.toFixed(4))))
|
||||
})
|
||||
})
|
||||
getMaxMemory(baseData).then((res) => {
|
||||
let maxMemory = res.measurements[0].value
|
||||
getUsedMemory(baseData).then((res) => {
|
||||
let usedMemory = res.measurements[0].value;
|
||||
let used = (usedMemory/maxMemory).toFixed(4);
|
||||
nextTick(() => {
|
||||
const memoryChart = echarts.init(memoryChartContainerRef.value)
|
||||
memoryChart.setOption(buildOptions(parseFloat(used)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
let param = {
|
||||
id:data.instanceId
|
||||
}
|
||||
delInfoById(para).then((res) => {
|
||||
if (res.status == "success") {
|
||||
ElMessage({ type: 'info', message: '删除成功' })
|
||||
getDataList(null)
|
||||
getRegisterNum(param).then((res)=>{
|
||||
serviceUsedData.value.registerCount = res.data[0].num
|
||||
})
|
||||
getInvokeNumToday(param).then((res)=>{
|
||||
serviceUsedData.value.todayCount = res.data
|
||||
})
|
||||
getHttpServerReqs(baseData).then((res)=>{
|
||||
let measurements = res.measurements;
|
||||
for(let it of measurements){
|
||||
if(it.statistic.toUpperCase()=="COUNT"){
|
||||
serviceUsedData.value.aveCount = calculateAverageDailyCallCount(data.createTime,it.value)
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
// 计算平均每天调用次数
|
||||
const calculateAverageDailyCallCount = (registrationDate,totalCallCount) => {
|
||||
const now = new Date();
|
||||
const registrationDateObj = new Date(registrationDate);
|
||||
const daysSinceRegistration = (now - registrationDateObj) / (1000 * 60 * 60 * 24);
|
||||
if(daysSinceRegistration<1){
|
||||
return totalCallCount;
|
||||
}
|
||||
const averageDailyCallCount = totalCallCount / daysSinceRegistration;
|
||||
return averageDailyCallCount.toFixed(2); // 保留两位小数
|
||||
};
|
||||
|
||||
function Pie() {
|
||||
let dataArr = [];
|
||||
for (var i = 0; i < 150; i++) {
|
||||
if (i % 2 === 0) {
|
||||
dataArr.push({
|
||||
name: (i + 1).toString(),
|
||||
value: 50,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#00AFFF",
|
||||
borderWidth: 0,
|
||||
borderColor: "rgba(0,0,0,0)",
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ElMessage({ type: 'warning', message: "删除失败" + res.msg })
|
||||
dataArr.push({
|
||||
name: (i + 1).toString(),
|
||||
value: 100,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "rgba(0,0,0,0)",
|
||||
borderWidth: 0,
|
||||
borderColor: "rgba(0,0,0,0)"
|
||||
}
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
return dataArr
|
||||
}
|
||||
async function initInterfaceList() {
|
||||
let para = {
|
||||
page:1,
|
||||
limit:9999999,
|
||||
mayApply:'发布'
|
||||
}
|
||||
getMayApplyInterfaceList(para).then((res) => {
|
||||
interfaceList.value = []
|
||||
for (let it of res.data) {
|
||||
let item = {
|
||||
label: it.interfaceName+"-"+it.version,
|
||||
value: it.id
|
||||
function buildOptions(usedData){
|
||||
let options = {
|
||||
backgroundColor: 'transparent', // 画布背景色
|
||||
series: [
|
||||
{
|
||||
// value: 50, // 内容 配合formatter
|
||||
type: 'liquidFill',
|
||||
radius: '70%', // 控制中间圆球的尺寸(此处可以理解为距离外圈圆的距离控制)
|
||||
center: ['50%', '50%'],
|
||||
data: [usedData, {
|
||||
value: usedData,
|
||||
direction: 'left', //波浪方向
|
||||
}], // data个数代表波浪数
|
||||
backgroundStyle: {
|
||||
borderWidth: 1,
|
||||
color: 'rgba(62, 208, 255, 1)' // 球体本景色
|
||||
},
|
||||
amplitude: '6 %',//波浪的振幅
|
||||
// 修改波浪颜色
|
||||
// color: ['#0286ea', 'l#0b99ff'], // 每个波浪不同颜色,颜色数组长度为对应的波浪个数
|
||||
color: [{
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{
|
||||
offset: 1,
|
||||
color: '#6CDEFC',
|
||||
},
|
||||
{
|
||||
offset: 0,
|
||||
color: '#429BF7',
|
||||
},
|
||||
],
|
||||
globalCoord: false,
|
||||
},
|
||||
],
|
||||
label: {
|
||||
normal: {
|
||||
formatter: (usedData * 100).toFixed(2)+'%',
|
||||
// formatter: function(params){
|
||||
// return params.value* 100 + " \n%";
|
||||
// },
|
||||
rich: {
|
||||
d: {
|
||||
fontSize: 20,
|
||||
}
|
||||
interfaceList.value.push(item)
|
||||
},
|
||||
textStyle: {
|
||||
fontSize: 32,
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
|
||||
for(let it of ruleFormConfig.value.itemList){
|
||||
if(it.prop=='interfaceIds'){
|
||||
it.props.options = interfaceList.value
|
||||
},
|
||||
outline: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'pie',
|
||||
z: 1,
|
||||
center: ['50%', '50%'],
|
||||
radius: ['72%', '73.5%'], // 控制外圈圆的粗细
|
||||
hoverAnimation: false,
|
||||
data: [
|
||||
{
|
||||
name: '',
|
||||
value: 500,
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
itemStyle: {
|
||||
color: '#00AFFF'
|
||||
},
|
||||
emphasis: {
|
||||
labelLine: {
|
||||
show: false
|
||||
},
|
||||
itemStyle: {
|
||||
color: '#00AFFF'
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
]
|
||||
},
|
||||
{ //外发光
|
||||
type: 'pie',
|
||||
z: 1,
|
||||
zlevel: -1,
|
||||
radius: ['70%', '90.5%'],
|
||||
center: ["50%", "50%"],
|
||||
hoverAnimation: false,
|
||||
clockWise: false,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderWidth: 20,
|
||||
color: 'rgba(224,242,255,1)',
|
||||
}
|
||||
},
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
data: [100]
|
||||
},
|
||||
{ //底层外发光
|
||||
type: 'pie',
|
||||
z:1,
|
||||
zlevel: -2,
|
||||
radius: ['70%', '100%'],
|
||||
center: ["50%", "50%"],
|
||||
hoverAnimation: false,
|
||||
clockWise: false,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
borderWidth: 20,
|
||||
color: 'rgba(224,242,255,.4)',
|
||||
}
|
||||
},
|
||||
label: {
|
||||
show: false
|
||||
},
|
||||
data: [100]
|
||||
},
|
||||
// 虚点
|
||||
{
|
||||
type: 'pie',
|
||||
zlevel: 0,
|
||||
silent: true,
|
||||
radius: ['78%', '80%'],
|
||||
z: 1,
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
},
|
||||
labelLine: {
|
||||
normal: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
data: Pie()
|
||||
},
|
||||
]
|
||||
}
|
||||
return options
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
@ -525,3 +771,98 @@ getMayApplyInterfaceList(para).then((res) => {
|
|||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.box-card {
|
||||
border-radius: 4px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
:deep(.el-card__header) {
|
||||
padding: 12px 20px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
background-color: var(--el-bg-color);
|
||||
}
|
||||
|
||||
:deep(.el-card__body) {
|
||||
height: 130px !important;
|
||||
padding: 0px 15px 15px 15px !important;
|
||||
}
|
||||
.overview-content {
|
||||
height: calc(100% - 21px);
|
||||
display: flex;
|
||||
padding: 0px 20px;
|
||||
|
||||
.stat-items {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
|
||||
.stat-item {
|
||||
text-align: center;
|
||||
min-width: 80px;
|
||||
|
||||
h2 {
|
||||
font-size: 45px;
|
||||
color: var(--el-color-primary);
|
||||
margin-bottom: 6px;
|
||||
font-family: yjsz;
|
||||
font-weight: 400;
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
white-space: nowrap;
|
||||
|
||||
span {
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
:deep(.el-pagination) {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.el-pagination__jump {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.btn-prev,
|
||||
.btn-next {
|
||||
min-width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
.el-pager {
|
||||
li {
|
||||
min-width: 22px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.labelTitle{
|
||||
text-align: center;
|
||||
display: flex; justify-content: center;
|
||||
span {
|
||||
font-size: 16px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
.bottomArea{
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
|
@ -24,7 +24,7 @@
|
|||
import { computed, ref, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import applyInfo from './applyInfo.vue';
|
||||
import { getApplyInfoByInterfaceId } from '@/api/interface/interface'
|
||||
import { getApplyInfoByInterfaceId,getIpPortByInterfaceId } from '@/api/interface/interface'
|
||||
import { downLoadSecret, getApplyInfoById } from '@/api/apply/apply'
|
||||
|
||||
// 注入 字体对象
|
||||
|
@ -64,7 +64,9 @@ let ruleFormConfig = ref({
|
|||
model: {
|
||||
interfaceId: props.interfaceId,
|
||||
applyStopTime: "",
|
||||
applyTime: ""
|
||||
applyTime: "",
|
||||
ip:"",
|
||||
port:""
|
||||
},
|
||||
rules: {
|
||||
// 表单验证规则。类型:FormRules
|
||||
|
@ -91,6 +93,22 @@ let ruleFormConfig = ref({
|
|||
props: {
|
||||
slotName: "openAuthDialog"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('执行端IP')),
|
||||
prop: 'ip',
|
||||
props: {
|
||||
disabled: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('执行端端口')),
|
||||
prop: 'port',
|
||||
props: {
|
||||
disabled: true,
|
||||
}
|
||||
}
|
||||
],
|
||||
descriptionsFormConfig: {
|
||||
|
@ -121,10 +139,17 @@ function openPubDialog(id, type, name, isAuth) {
|
|||
getApplyInfoById(para).then((response) => {
|
||||
ruleFormConfig.value.model = response.data
|
||||
interfaceId.value = response.data.interfaceId
|
||||
let paraInterfaceId = {
|
||||
id:interfaceId.value
|
||||
}
|
||||
getIpPortByInterfaceId(paraInterfaceId).then((resD)=>{
|
||||
ruleFormConfig.value.model.ip = resD.data.ip;
|
||||
ruleFormConfig.value.model.port = resD.data.port;
|
||||
nextTick(() => {
|
||||
applyInfoRef.value.initFormData(response.data)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
isAuthInfo.value = isAuth
|
||||
interfaceName.value = (name != undefined ? name : "")
|
||||
|
|
|
@ -752,8 +752,7 @@ const uploadInterfaceFile = (id) => {
|
|||
}
|
||||
//接口文档预览按钮
|
||||
const viewInterfaceFile = (url, interfaceId) => {
|
||||
console.log(url)
|
||||
console.log(interfaceId)
|
||||
|
||||
if (url != null && url != undefined && url != "") {
|
||||
if (props.status == "发布" || props.status == "申请") {
|
||||
let para = {
|
||||
|
|
|
@ -144,7 +144,7 @@ import { computed, h, ref, inject } from 'vue';
|
|||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById,downLoadInterfaceFile } from '@/api/interface/interface'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById,downLoadInterfaceFile,getRegisterNum } from '@/api/interface/interface'
|
||||
import {getListByType,getListByPid} from '@/api/systemidentifier/systemidentifier'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import interfaceAuth from '@/views/auth/interfaceAuth.vue';
|
||||
|
@ -152,6 +152,8 @@ import parameter from '../parameter/parameterTable.vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
//
|
||||
const exceuteInstanceInfo = ref([])
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
const { t } = useI18n();
|
||||
|
@ -851,7 +853,9 @@ let ruleFormConfig = ref({
|
|||
{ required: true, message: computed(() => t('请输入链接地址')), trigger: 'blur' },
|
||||
{ validator: validateUrl, trigger: 'blur' }
|
||||
],
|
||||
illustrate: [{ required: true, message: computed(() => t('接口描述不能为空')), trigger: 'blur' }]
|
||||
illustrate: [{ required: true, message: computed(() => t('接口描述不能为空')), trigger: 'blur' }],
|
||||
executeInstanceId:[{required:true,message:computed(()=> t('部署实例不能为空')),trigger:'blur'}]
|
||||
|
||||
},
|
||||
itemList: [
|
||||
{
|
||||
|
@ -955,6 +959,14 @@ let ruleFormConfig = ref({
|
|||
slotName: "isLimitData"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: computed(() => t('部署实例')),
|
||||
prop: 'executeInstanceId',
|
||||
props: {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('接口负责人')),
|
||||
|
@ -1241,6 +1253,16 @@ async function addDialog() {
|
|||
ruleFormConfig.value.model.id = res.data
|
||||
discardInterfaceId.value = res.data
|
||||
interfaceId.value = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
exceuteInstanceInfo.value = []
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
value1.value = "false"
|
||||
value2.value = "false"
|
||||
value3.value = "false"
|
||||
|
@ -1252,6 +1274,9 @@ async function addDialog() {
|
|||
} else {
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
analysisYableData('[]', false)
|
||||
analysisTreeData(res)
|
||||
|
@ -1268,6 +1293,16 @@ async function edit(id) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
exceuteInstanceInfo.value = []
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1276,6 +1311,9 @@ async function edit(id) {
|
|||
} else {
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, false)
|
||||
|
@ -1292,6 +1330,16 @@ async function updateVersion(id) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
exceuteInstanceInfo.value = []
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1300,6 +1348,9 @@ async function updateVersion(id) {
|
|||
} else {
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, false)
|
||||
|
@ -1326,6 +1377,16 @@ async function view(id, show) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
exceuteInstanceInfo.value = []
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1334,6 +1395,9 @@ async function view(id, show) {
|
|||
} else {
|
||||
it.props.disabled = true
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, true)
|
||||
|
@ -1352,6 +1416,16 @@ async function approveView(id, show) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
exceuteInstanceInfo.value = []
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
let arry = []
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
|
@ -1373,6 +1447,9 @@ async function approveView(id, show) {
|
|||
}
|
||||
arry.push(interfaceFileUrl)
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
ruleFormConfig.value.itemList = arry;
|
||||
initData(res.data)
|
||||
|
|
|
@ -144,7 +144,7 @@ import { computed, h, ref, inject } from 'vue';
|
|||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById } from '@/api/interface/interface'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById,getRegisterNum } from '@/api/interface/interface'
|
||||
import {getListByType,getListByPid} from '@/api/systemidentifier/systemidentifier'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import interfaceAuth from '@/views/auth/interfaceAuth.vue';
|
||||
|
@ -152,6 +152,8 @@ import parameter from '../parameter/parameterTable.vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
//部署实例信息
|
||||
const exceuteInstanceInfo = ref([])
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
const { t } = useI18n();
|
||||
|
@ -960,6 +962,14 @@ let ruleFormConfig = ref({
|
|||
slotName: "isLimitData"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: computed(() => t('部署实例')),
|
||||
prop: 'executeInstanceId',
|
||||
props: {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('接口负责人')),
|
||||
|
@ -1246,6 +1256,15 @@ async function view(id, show) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1254,6 +1273,9 @@ async function view(id, show) {
|
|||
} else {
|
||||
it.props.disabled = true
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, true)
|
||||
|
|
|
@ -183,7 +183,7 @@ import { computed, h, ref, inject } from 'vue';
|
|||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import {saveUpdateVersionInfo,saveInterfaceInfo,getInterfaceId,getInterfaceInfoById} from '@/api/interface/interface'
|
||||
import {saveUpdateVersionInfo,saveInterfaceInfo,getInterfaceId,getInterfaceInfoById,getRegisterNum} from '@/api/interface/interface'
|
||||
import {getListByType,getListByPid} from '@/api/systemidentifier/systemidentifier'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import interfaceAuth from '@/views/auth/interfaceAuth.vue';
|
||||
|
@ -191,6 +191,8 @@ import parameter from '../parameter/parameterTable.vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
//部署实例信息
|
||||
const exceuteInstanceInfo = ref([])
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
const loading = ref(false)
|
||||
|
@ -739,7 +741,8 @@ let ruleFormConfig = ref({
|
|||
],
|
||||
illustrate:[{required:true,message:computed(()=> t('接口描述不能为空')),trigger:'blur'}],
|
||||
systemId:[{required:true,message:computed(()=> t('接口归属系统不能为空')),trigger:'blur'}],
|
||||
deptId:[{required:true,message:computed(()=> t('接口负责人单位不能为空')),trigger:'blur'}]
|
||||
deptId:[{required:true,message:computed(()=> t('接口负责人单位不能为空')),trigger:'blur'}],
|
||||
executeInstanceId:[{required:true,message:computed(()=> t('部署实例不能为空')),trigger:'blur'}]
|
||||
},
|
||||
itemList: [
|
||||
{
|
||||
|
@ -844,6 +847,14 @@ let ruleFormConfig = ref({
|
|||
slotName: "isLimitData"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: computed(() => t('部署实例')),
|
||||
prop: 'executeInstanceId',
|
||||
props: {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('接口负责人')),
|
||||
|
@ -1154,6 +1165,15 @@ async function addDialog(){
|
|||
ruleFormConfig.value.model.id = res.data
|
||||
discardInterfaceId.value = res.data
|
||||
interfaceId.value = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for(let it of ruleFormConfig.value.itemList){
|
||||
if(it.props==undefined){
|
||||
it.props = {
|
||||
|
@ -1162,6 +1182,9 @@ async function addDialog(){
|
|||
}else{
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
analysisYableData('[]',false)
|
||||
analysisTreeData(res)
|
||||
|
@ -1614,6 +1637,32 @@ getListByType(selectParameter).then((res) => {
|
|||
deptList.value.push(item)
|
||||
}
|
||||
})
|
||||
//解析json数据
|
||||
function analysisData(data){
|
||||
//存储需要的列表数据
|
||||
let tableData = []
|
||||
//获取注册应用数据列表
|
||||
let applications = data.applications.application
|
||||
//解析转化为table数据
|
||||
for(let application of applications){
|
||||
let appName = application.name
|
||||
//解析实例
|
||||
for(let instance of application.instance){
|
||||
let instanceData = {
|
||||
name: appName,
|
||||
instanceId: instance.instanceId,
|
||||
hostName:instance.hostName,
|
||||
ip: instance.ipAddr,
|
||||
port: instance.port["$"],
|
||||
status: instance.status,
|
||||
createTime: instance.leaseInfo.registrationTimestamp,
|
||||
baseUrl: instance.healthCheckUrl.slice(0,-6)
|
||||
}
|
||||
tableData.push(instanceData)
|
||||
}
|
||||
}
|
||||
return tableData
|
||||
}
|
||||
defineExpose({addDialog,edit,view,updateVersion})
|
||||
</script>
|
||||
<style scoped>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
import { computed, ref, nextTick } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import applyInfo from './applyInfo.vue';
|
||||
import { getApplyInfoByInterfaceId } from '@/api/interface/interface'
|
||||
import { getApplyInfoByInterfaceId,getIpPortByInterfaceId } from '@/api/interface/interface'
|
||||
import { downLoadSecret, getApplyInfoById } from '@/api/apply/apply'
|
||||
|
||||
// 注入 字体对象
|
||||
|
@ -64,7 +64,9 @@ let ruleFormConfig = ref({
|
|||
model: {
|
||||
interfaceId: props.interfaceId,
|
||||
applyStopTime: "",
|
||||
applyTime: ""
|
||||
applyTime: "",
|
||||
ip:"",
|
||||
port:""
|
||||
},
|
||||
rules: {
|
||||
// 表单验证规则。类型:FormRules
|
||||
|
@ -91,6 +93,22 @@ let ruleFormConfig = ref({
|
|||
props: {
|
||||
slotName: "openAuthDialog"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('执行端IP')),
|
||||
prop: 'ip',
|
||||
props: {
|
||||
disabled: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
label: computed(() => t('执行端端口')),
|
||||
prop: 'port',
|
||||
props: {
|
||||
disabled: true,
|
||||
}
|
||||
}
|
||||
],
|
||||
descriptionsFormConfig: {
|
||||
|
@ -103,7 +121,6 @@ let ruleFormConfig = ref({
|
|||
function openPubDialog(id, type, name, isAuth) {
|
||||
interfaceId.value = id
|
||||
openDialog.value = true
|
||||
debugger
|
||||
if (type == "申请") {
|
||||
let para = {
|
||||
id: id
|
||||
|
@ -121,10 +138,17 @@ function openPubDialog(id, type, name, isAuth) {
|
|||
getApplyInfoById(para).then((response) => {
|
||||
ruleFormConfig.value.model = response.data
|
||||
interfaceId.value = response.data.interfaceId
|
||||
let paraInterfaceId = {
|
||||
id:interfaceId.value
|
||||
}
|
||||
getIpPortByInterfaceId(paraInterfaceId).then((resD)=>{
|
||||
ruleFormConfig.value.model.ip = resD.data.ip;
|
||||
ruleFormConfig.value.model.port = resD.data.port;
|
||||
nextTick(() => {
|
||||
applyInfoRef.value.initFormData(response.data)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
isAuthInfo.value = isAuth
|
||||
interfaceName.value = (name != undefined ? name : "")
|
||||
|
|
|
@ -144,7 +144,7 @@ import { computed, h, ref, inject } from 'vue';
|
|||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById,downLoadInterfaceFile } from '@/api/interface/interface'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById,downLoadInterfaceFile,getRegisterNum } from '@/api/interface/interface'
|
||||
import {getListByType,getListByPid} from '@/api/systemidentifier/systemidentifier'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import interfaceAuth from '@/views/auth/interfaceAuth.vue';
|
||||
|
@ -152,6 +152,8 @@ import parameter from '../parameter/parameterTable.vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
//实例信息
|
||||
const exceuteInstanceInfo = ref([])
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
const { t } = useI18n();
|
||||
|
@ -850,7 +852,8 @@ let ruleFormConfig = ref({
|
|||
{ required: true, message: computed(() => t('请输入链接地址')), trigger: 'blur' },
|
||||
{ validator: validateUrl, trigger: 'blur' }
|
||||
],
|
||||
illustrate: [{ required: true, message: computed(() => t('接口描述不能为空')), trigger: 'blur' }]
|
||||
illustrate: [{ required: true, message: computed(() => t('接口描述不能为空')), trigger: 'blur' }],
|
||||
executeInstanceId:[{required:true,message:computed(()=> t('部署实例不能为空')),trigger:'blur'}]
|
||||
},
|
||||
itemList: [
|
||||
{
|
||||
|
@ -946,6 +949,14 @@ let ruleFormConfig = ref({
|
|||
slotName: "isAuth"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: computed(() => t('部署实例')),
|
||||
prop: 'executeInstanceId',
|
||||
props: {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'slot',
|
||||
label: computed(() => t('是否控制数据请求范围')),
|
||||
|
@ -1267,6 +1278,16 @@ async function edit(id) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
exceuteInstanceInfo.value = []
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1275,6 +1296,9 @@ async function edit(id) {
|
|||
} else {
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, false)
|
||||
|
@ -1291,6 +1315,16 @@ async function updateVersion(id) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
exceuteInstanceInfo.value = []
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1299,6 +1333,9 @@ async function updateVersion(id) {
|
|||
} else {
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, false)
|
||||
|
@ -1329,6 +1366,16 @@ async function view(id, show) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
exceuteInstanceInfo.value = []
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1337,6 +1384,9 @@ async function view(id, show) {
|
|||
} else {
|
||||
it.props.disabled = true
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, true)
|
||||
|
@ -1355,6 +1405,16 @@ async function approveView(id, show) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
exceuteInstanceInfo.value = []
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
let arry = []
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
|
@ -1376,6 +1436,9 @@ async function approveView(id, show) {
|
|||
}
|
||||
arry.push(interfaceFileUrl)
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
ruleFormConfig.value.itemList = arry;
|
||||
initData(res.data)
|
||||
|
|
|
@ -144,7 +144,7 @@ import { computed, h, ref, inject } from 'vue';
|
|||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById } from '@/api/interface/interface'
|
||||
import { saveUpdateVersionInfo, saveInterfaceInfo, getInterfaceId, getInterfaceInfoById,getRegisterNum } from '@/api/interface/interface'
|
||||
import {getListByType,getListByPid} from '@/api/systemidentifier/systemidentifier'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import interfaceAuth from '@/views/auth/interfaceAuth.vue';
|
||||
|
@ -152,6 +152,8 @@ import parameter from '../parameter/parameterTable.vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
//
|
||||
const exceuteInstanceInfo = ref([])
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
const { t } = useI18n();
|
||||
|
@ -953,11 +955,11 @@ let ruleFormConfig = ref({
|
|||
}
|
||||
},
|
||||
{
|
||||
type: 'slot',
|
||||
label: computed(() => t('是否控制数据请求范围')),
|
||||
prop: 'isLimitData',
|
||||
props:{
|
||||
slotName: "isLimitData"
|
||||
type: 'select',
|
||||
label: computed(() => t('部署实例')),
|
||||
prop: 'executeInstanceId',
|
||||
props: {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -1246,6 +1248,16 @@ async function view(id, show) {
|
|||
}
|
||||
let res = await getInterfaceInfoById(para)
|
||||
ruleFormConfig.value.model = res.data
|
||||
exceuteInstanceInfo.value = []
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for (let it of ruleFormConfig.value.itemList) {
|
||||
if (it.props == undefined) {
|
||||
it.props = {
|
||||
|
@ -1254,6 +1266,9 @@ async function view(id, show) {
|
|||
} else {
|
||||
it.props.disabled = true
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
initData(res.data)
|
||||
analysisYableData(res.data.parameters, true)
|
||||
|
|
|
@ -186,7 +186,7 @@ import { computed, h, ref, inject } from 'vue';
|
|||
import { useSettingStore } from '@/store/modules/settingStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { $validCheck } from '@/utils/validate'
|
||||
import {saveUpdateVersionInfo,saveInterfaceInfo,getInterfaceId,getInterfaceInfoById} from '@/api/interface/interface'
|
||||
import {saveUpdateVersionInfo,saveInterfaceInfo,getInterfaceId,getInterfaceInfoById,getRegisterNum} from '@/api/interface/interface'
|
||||
import {getListByType,getListByPid} from '@/api/systemidentifier/systemidentifier'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import interfaceAuth from '@/views/auth/interfaceAuth.vue';
|
||||
|
@ -194,6 +194,8 @@ import parameter from '../parameter/parameterTable.vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { nextTick } from 'vue';
|
||||
|
||||
//
|
||||
const exceuteInstanceInfo = ref([])
|
||||
// 注入 字体对象
|
||||
const fontSizeObj: any = inject('sizeObjInfo');
|
||||
const loading = ref(false)
|
||||
|
@ -742,7 +744,8 @@ let ruleFormConfig = ref({
|
|||
],
|
||||
illustrate:[{required:true,message:computed(()=> t('接口描述不能为空')),trigger:'blur'}],
|
||||
systemId:[{required:true,message:computed(()=> t('接口归属系统不能为空')),trigger:'blur'}],
|
||||
deptId:[{required:true,message:computed(()=> t('接口负责人单位不能为空')),trigger:'blur'}]
|
||||
deptId:[{required:true,message:computed(()=> t('接口负责人单位不能为空')),trigger:'blur'}],
|
||||
executeInstanceId:[{required:true,message:computed(()=> t('部署实例不能为空')),trigger:'blur'}]
|
||||
},
|
||||
itemList: [
|
||||
{
|
||||
|
@ -839,6 +842,14 @@ let ruleFormConfig = ref({
|
|||
slotName: "isAuth"
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: computed(() => t('部署实例')),
|
||||
prop: 'executeInstanceId',
|
||||
props: {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
// {
|
||||
// type: 'slot',
|
||||
// label: computed(() => t('是否控制数据请求范围')),
|
||||
|
@ -888,7 +899,12 @@ let ruleFormConfig = ref({
|
|||
}
|
||||
systemList.value.push(item)
|
||||
}
|
||||
ruleFormConfig.value.itemList[11].props.options = systemList.value
|
||||
for(let it of ruleFormConfig.value.itemList){
|
||||
if(it.prop == "systemId"){
|
||||
it.props.options = systemList.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1152,6 +1168,15 @@ async function addDialog(){
|
|||
ruleFormConfig.value.model.id = res.data
|
||||
discardInterfaceId.value = res.data
|
||||
interfaceId.value = res.data
|
||||
let resExecute = await getRegisterNum()
|
||||
//let executeTable = analysisData(resExecute)
|
||||
for(let it of resExecute.data){
|
||||
let item = {
|
||||
label: computed(() => t("实例ID:" + it.instanceId + " 已注册接口数:"+it.num)), value: it.instanceId
|
||||
}
|
||||
exceuteInstanceInfo.value.push(item)
|
||||
|
||||
}
|
||||
for(let it of ruleFormConfig.value.itemList){
|
||||
if(it.props==undefined){
|
||||
it.props = {
|
||||
|
@ -1160,6 +1185,9 @@ async function addDialog(){
|
|||
}else{
|
||||
it.props.disabled = false
|
||||
}
|
||||
if(it.prop=="executeInstanceId"){
|
||||
it.props.options = exceuteInstanceInfo.value;
|
||||
}
|
||||
}
|
||||
analysisYableData('[]',false)
|
||||
analysisTreeData(res)
|
||||
|
@ -1612,6 +1640,32 @@ getListByType(selectParameter).then((res) => {
|
|||
deptList.value.push(item)
|
||||
}
|
||||
})
|
||||
//解析json数据
|
||||
function analysisData(data){
|
||||
//存储需要的列表数据
|
||||
let tableData = []
|
||||
//获取注册应用数据列表
|
||||
let applications = data.applications.application
|
||||
//解析转化为table数据
|
||||
for(let application of applications){
|
||||
let appName = application.name
|
||||
//解析实例
|
||||
for(let instance of application.instance){
|
||||
let instanceData = {
|
||||
name: appName,
|
||||
instanceId: instance.instanceId,
|
||||
hostName:instance.hostName,
|
||||
ip: instance.ipAddr,
|
||||
port: instance.port["$"],
|
||||
status: instance.status,
|
||||
createTime: instance.leaseInfo.registrationTimestamp,
|
||||
baseUrl: instance.healthCheckUrl.slice(0,-6)
|
||||
}
|
||||
tableData.push(instanceData)
|
||||
}
|
||||
}
|
||||
return tableData
|
||||
}
|
||||
defineExpose({addDialog,edit,view,updateVersion})
|
||||
</script>
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue