diff --git a/vue/y9vue-interfacePlatform/src/api/home/home.ts b/vue/y9vue-interfacePlatform/src/api/home/home.ts index 89a648e..17b557c 100644 --- a/vue/y9vue-interfacePlatform/src/api/home/home.ts +++ b/vue/y9vue-interfacePlatform/src/api/home/home.ts @@ -88,4 +88,18 @@ export const getRealTimeLog = async (params) => { cType: false, 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, + }); }; \ No newline at end of file diff --git a/vue/y9vue-interfacePlatform/src/api/interface/interface.ts b/vue/y9vue-interfacePlatform/src/api/interface/interface.ts index 054877c..3ee7476 100644 --- a/vue/y9vue-interfacePlatform/src/api/interface/interface.ts +++ b/vue/y9vue-interfacePlatform/src/api/interface/interface.ts @@ -212,4 +212,32 @@ export const downLoadInterfaceFile = async (uri) => { cType: false, 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, + }); }; \ No newline at end of file diff --git a/vue/y9vue-interfacePlatform/src/api/lib/request.js b/vue/y9vue-interfacePlatform/src/api/lib/request.js index 817601c..707fb82 100644 --- a/vue/y9vue-interfacePlatform/src/api/lib/request.js +++ b/vue/y9vue-interfacePlatform/src/api/lib/request.js @@ -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, }); diff --git a/vue/y9vue-interfacePlatform/src/views/execute/index.vue b/vue/y9vue-interfacePlatform/src/views/execute/index.vue index 654b623..da28bb2 100644 --- a/vue/y9vue-interfacePlatform/src/views/execute/index.vue +++ b/vue/y9vue-interfacePlatform/src/views/execute/index.vue @@ -23,16 +23,63 @@ + + + + + {{ $t('服务使用概况') }} + + + + + + + {{ serviceUsedData.registerCount }} + {{ $t('注册接口数') }} + + + {{ serviceUsedData.aveCount }} + {{ $t('平均每天请求次数') }} + + + {{ serviceUsedData.todayCount }} + {{ $t('今日调用次数') }} + + + + + + + + 系统CPU使用率 + + + + + + 内存使用率 + + + + + + + + + \ No newline at end of file diff --git a/vue/y9vue-interfacePlatform/src/views/interface-v2/authApplyInfo.vue b/vue/y9vue-interfacePlatform/src/views/interface-v2/authApplyInfo.vue index e8f7d44..234e0c2 100644 --- a/vue/y9vue-interfacePlatform/src/views/interface-v2/authApplyInfo.vue +++ b/vue/y9vue-interfacePlatform/src/views/interface-v2/authApplyInfo.vue @@ -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,8 +139,15 @@ function openPubDialog(id, type, name, isAuth) { getApplyInfoById(para).then((response) => { ruleFormConfig.value.model = response.data interfaceId.value = response.data.interfaceId - nextTick(() => { - applyInfoRef.value.initFormData(response.data) + 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) + }) }) }) } diff --git a/vue/y9vue-interfacePlatform/src/views/interface-v2/index.vue b/vue/y9vue-interfacePlatform/src/views/interface-v2/index.vue index 192e91e..e8f0605 100644 --- a/vue/y9vue-interfacePlatform/src/views/interface-v2/index.vue +++ b/vue/y9vue-interfacePlatform/src/views/interface-v2/index.vue @@ -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 = { diff --git a/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialog.vue b/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialog.vue index 379d43f..3c4aad0 100644 --- a/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialog.vue +++ b/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialog.vue @@ -31,7 +31,7 @@ + :filterConfig="requestHeaderParameterTableFilter"> 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) diff --git a/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialogApplyTable.vue b/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialogApplyTable.vue index 9552121..81153d6 100644 --- a/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialogApplyTable.vue +++ b/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceDialogApplyTable.vue @@ -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) diff --git a/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceRegister.vue b/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceRegister.vue index 3af2ba4..77c97dd 100644 --- a/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceRegister.vue +++ b/vue/y9vue-interfacePlatform/src/views/interface-v2/interfaceRegister.vue @@ -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})