01429202 by lihua

api服务接口联调

1 parent 0e618e1d
......@@ -98,7 +98,7 @@ VITE_APP_CIRCULATION = https://daop-lt-test.zgsjzc.com/
VITE_APP_DATA_DELIVERY = https://daop-jgjf-test.zgsjzc.com/
#数据服务接口地址
VITE_APP_SERVICE_BASEURL = ms-daop-jgjf-data-open-service
VITE_APP_SERVICE_BASEURL = ms-daop-trust-api-service
# 本地访问地址
# VITE_API_CIRCULATION_URL = http://localhost:9000/circulation
......
......@@ -84,7 +84,7 @@ VITE_API_MESSAGE = ms-daop-message-service
VITE_APP_PERSONAL_URL = ms-daop-personel-service
#数据服务接口地址
VITE_APP_SERVICE_BASEURL = ms-daop-jgjf-data-open-service
VITE_APP_SERVICE_BASEURL = ms-daop-trust-api-service
#流通平台接口地址
VITE_APP_CIRCULATION = https://sz-lt.zgsjzc.com/
......
......@@ -266,8 +266,8 @@ export const getSceneValidApiLabel = (isApiValid = false) => request({
})
/** 根据标签获取有效的api列表 */
export const getValidApi = (sceneGuid) => request({
url: `${import.meta.env.VITE_APP_SERVICE_BASEURL}/api-base-info/list-valid?sceneGuid=${sceneGuid}`,
export const getValidApi = () => request({
url: `${import.meta.env.VITE_APP_SERVICE_BASEURL}/api-base-info/activate-list`,
method: 'get'
})
......
......@@ -77,11 +77,16 @@ const routes: RouteRecordRaw[] = [
name: 'apiDetail',
component: () => import('@/views/data_service/detail_serviceApi.vue'),
meta: {
title: '流程详情',
title: '详情-',
sidebar: false,
breadcrumb: false,
cache: true,
reuse: true
},
beforeEnter: (to, from) => {
if (to.query.guid) {
to.meta.title = `详情-${to.query.apiName}`;
}
}
},
{
......
......@@ -24,6 +24,10 @@ import {
getTenantList,
getRegisterCatalogProductList
} from "@/api/modules/dataAsset";
import {
getValidApi,
apiTypes
} from "@/api/modules/dataService";
import { ContentWrap } from '@/components/ContentWrap';
import importTableField from "./importTableField.vue";
import { useValidator } from '@/hooks/useValidator';
......@@ -668,9 +672,11 @@ const productTableInfo = ref({
fields: [
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "服务名称", field: "apiGuid", width: 180, required: true, columClass: 'edit-colum', type: 'edit' },
{ label: "API类型", field: "apiType", width: 100 },
{ label: "API地址", field: "requestUrl", width: 240 },
{ label: "描述", field: "apiDescription", width: 240 },
{ label: "API类型", field: "apiType", width: 100, getName: (scope) => {
return scope.row.apiType && apiTypes.find(a => a.value == scope.row.apiType)?.label;
} },
{ label: "API地址", field: "requestUrl", minWidth: 240 },
{ label: "描述", field: "apiDescription", width: 300 },
],
editInfo: {
apiGuid: {
......@@ -850,6 +856,11 @@ onBeforeMount(() => {
baseInfoFormRef.value.ruleFormRef.clearValidate(['sceneDescription', 'subjectDomain', 'coverageAreas', 'isPublicData', 'dataSources', 'propertyDescription', 'sceneLimit']);
}, 0);
assetDataTableInfo.value.data = detailInfo.value.damCatalogTableInfo;
productData.value = detailInfo.value.associationApiInfo?.map(d => {
d.apiGuid = d.guid;
return d;
}) || [];
productTableInfo.value.data = productData.value;
} else {
proxy.$ElMessage.error(res.msg);
fullscreenLoading.value = false;
......@@ -960,6 +971,15 @@ onBeforeMount(() => {
proxy.$ElMessage.error(res.msg);
}
})
getValidApi().then((res: any) => {
if (res.code == proxy.$passCode) {
apiList.value = res.data || [];
productTableInfo.value.editInfo.apiGuid.options = apiList.value;
} else {
proxy.$ElMessage.error(res.msg);
}
})
});
const cancel = () => {
......
......@@ -19,6 +19,9 @@ import {
getCertificateDetail,
getRegisterCatalogDetailGuids
} from "@/api/modules/dataAsset";
import {
apiTypes
} from "@/api/modules/dataService";
import { changeNum } from '@/utils/common'
import { ElMessage, ElMessageBox } from "element-plus";
import { passFlowData, rejectFlowData, revokeFlowData, isMyFirstNode } from "@/api/modules/workFlowService";
......@@ -193,7 +196,7 @@ const getDetailInfo = () => {
detailInfo.value = data;
publicDataProductsMainRSVO.value = detailInfo.value.publicDataProductsMainRSVO || {};
//TODO. 返回服务包信息
productTableInfo.value.data = detailInfo.value.associationApiVO || [];
productTableInfo.value.data = detailInfo.value.associationApiInfo || [];
// detailInfo.value.damTypeName = damTypes.find(d => d.value == detailInfo.value.damType)?.label;
detailInfo.value.dataSourcesName = dataSourcesList.find(d => d.value == detailInfo.value.dataSources)?.label;
if (!isJSZQ.value) {
......@@ -328,8 +331,10 @@ const productTableInfo = ref({
height: '214px',
fields: [
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "服务名称", field: "apiGuid", width: 180 },
{ label: "API类型", field: "apiType", width: 100 },
{ label: "服务名称", field: "apiName", width: 180 },
{ label: "API类型", field: "apiType", width: 100, getName: (scope) => {
return scope.row.apiType && apiTypes.find(a => a.value == scope.row.apiType)?.label;
} },
{ label: "API地址", field: "requestUrl", width: 240 },
{ label: "描述", field: "apiDescription", width: 240 },
],
......
......@@ -66,21 +66,22 @@ const tableSearchItemList: any = ref([
placeholder: 'API类型',
options: apiTypes,
clearable: true
}, {
type: 'select',
label: '',
field: 'approveState',
default: '',
placeholder: '全部状态',
options: [
{ label: '草稿中', value: 'N' },
{ label: '审批中', value: 'A' },
{ label: '已通过', value: 'Y' },
{ label: '已驳回', value: 'R' },
{ label: '已撤销', value: 'C' },
],
clearable: true
}
},
// {
// type: 'select',
// label: '',
// field: 'approveState',
// default: '',
// placeholder: '全部状态',
// options: [
// { label: '草稿中', value: 'N' },
// { label: '审批中', value: 'A' },
// { label: '已通过', value: 'Y' },
// { label: '已驳回', value: 'R' },
// { label: '已撤销', value: 'C' },
// ],
// clearable: true
// }
]);
const getTableData = () => {
......@@ -163,14 +164,15 @@ const tableInfo = ref({
},
{ label: "API请求路径", field: "requestUrl", width: TableColumnWidth.DESCRIPTION },
{
label: '状态', field: 'apiState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 96, align: 'center', isDisabled: (scope) => {
if (scope.row.apiState == 1 && scope.row.bindingCount > 0) {//被授权的不能禁用。
return true;
}
return scope.row.approveState != 'Y';//正在审批中的不能停用。草稿中的不能启用。
}
label: '状态', field: 'apiState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 96, align: 'center'
// , isDisabled: (scope) => {
// if (scope.row.apiState == 1) {//被授权的不能禁用。
// return true;
// }
// return scope.row.approveState != 'Y';//正在审批中的不能停用。草稿中的不能启用。
// }
},
{ label: "审批状态", field: "approveState", type: "tag", width: TableColumnWidth.STATE, align: 'center' },
// { label: "审批状态", field: "approveState", type: "tag", width: TableColumnWidth.STATE, align: 'center' },
{ label: "API描述", field: "apiDescription", width: TableColumnWidth.DESCRIPTION },
{ label: "修改人", field: "updateUserName", width: TableColumnWidth.USERNAME },
{ label: "修改时间", field: "updateTime", width: 170 },
......@@ -185,12 +187,12 @@ const tableInfo = ref({
label: "操作",
type: "btn",
isMore: false,
width: 200,
width: 180,
btns: (scope) => {
const { row } = scope;
let list: any = [];
list.push({ label: "编辑", value: "edit", click: apiManageTableBtnMap.EDIT });
list.push({ label: "删除", value: "del", click: apiManageTableBtnMap.DELETE });
list.push({ label: "编辑", disabled: row.apiState == 1, value: "edit", click: apiManageTableBtnMap.EDIT });
list.push({ label: "删除", disabled: row.apiState == 1, value: "del", click: apiManageTableBtnMap.DELETE });
list.push({ label: "详情", value: "detail", click: apiManageTableBtnMap.DETAIL });
list.push({ label: "复制", value: "copy", click: apiManageTableBtnMap.COPY })
return list;
......@@ -266,7 +268,7 @@ const apiManageTableBtnMap = {
let row = scope.row;
router.push({
name: 'apiDetail',
query: { guid: row.guid, type: 'detail' }
query: { guid: row.guid, apiName: row.apiName }
});
return;
// const approveVO = row.approveVO || {};
......@@ -343,7 +345,7 @@ const apiManageTableBtnMap = {
if (res.code == proxy.$passCode) {
APIDataPage.value.curr = 1;
getTableData();
proxy.$ElMessage.success('删除该API提交成功');
proxy.$ElMessage.success('删除该API成功');
} else {
proxy.$ElMessage.error(res.msg);
}
......
......@@ -5,37 +5,33 @@
<script lang="ts" setup name="apiTest">
import { ref } from 'vue';
import {
getValidApiLabel,
getSceneValidApiLabel,
getAllApi,
getValidApi,
testApiData,
getApiDetail
} from "@/api/modules/dataService";
import { TableColumnWidth } from '@/utils/enum';
import { useValidator } from '@/hooks/useValidator';
import { progressProps } from 'element-plus';
import { useRouter } from "vue-router";
const { required } = useValidator();
const router = useRouter();
const { proxy } = getCurrentInstance() as any;
/** API下拉列表。已发布的启用的API名称,选择后自动带出路径和请求参数。 */
const apiLabelList = ref([]);
const processDTOSValue = ref([]);
const validApiList = ref([]);
const apiFormRef = ref();
/** 选择要测试的API. */
const apiFormItems = ref([
{
type: 'tree-select',
type: 'select',
label: 'API名称',
field: 'apiGuid',
default: '',
placeholder: '请选择',
options: [],
options: validApiList.value,
col: 'path-w30',
props: {
label: "sceneName",
label: "apiName",
children: "children",
value: 'guid',
isLeaf: 'isLeaf'
......@@ -43,7 +39,7 @@ const apiFormItems = ref([
filterable: true,
clearable: true,
required: true
},
},
// {
// type: 'input',
// label: 'API路径',
......@@ -86,7 +82,7 @@ const apiFormItems = ref([
]);
const apiFormRules = ref({
apiGuid: [required('请选择数据产品')]
apiGuid: [required('请选择API')]
});
const requestParamsTableInfo = ref({
......@@ -208,98 +204,19 @@ const resultFormItems = ref([{
const getValidLabelPromise: any = ref(null);
onBeforeMount(() => {
getValidLabelPromise.value = getSceneValidApiLabel().then((res: any) => {
getValidLabelPromise.value = null;
getValidApi().then((res: any) => {
if (res.code == proxy.$passCode) {
apiLabelList.value = res.data || [];
validApiList.value = res.data || [];
apiFormItems.value[0].options = validApiList.value;
} else {
proxy.$ElMessage.error(res.msg);
}
})
// selectApiDetailInfo.value = {
// requestUrl: 'baidu.com',
// sceneName: '场景A',
// sceneGuid: 'A',
// processOrderNo: [
// {
// processOrderNo:1111,
// guid:'02e799002ad64cd3b1bc5aa31b592eca',
// requirementOrderName:'需求名称1',
// },
// {
// processOrderNo:2222,
// guid:'02e799002ad64cd3b1bc5aa31b592eca',
// requirementOrderName:'需求名称2',
// }
// ]
// };
if(selectApiDetailInfo.value?.processOrderNo?.length>0){
selectApiDetailInfo.value.processOrderNo.forEach(item=>{
item.noName=item.processOrderNo + '' + item.requirementOrderName
})
}
console.log('selectApiDetailInfo',selectApiDetailInfo.value);
})
const apiNodeLoad = (node, resolve, item) => {
if (node.level === 0) {
if (getValidLabelPromise.value) {
getValidLabelPromise.value.then(() => {
resolve(apiLabelList.value);
});
return;
}
resolve(apiLabelList.value)
} else if (node.level === 1) {
getAllApi(node.data.guid).then((res: any) => {
if (res.code == proxy.$passCode) {
const apiData = res.data?.map(d => {
d.sceneName = d.apiName;
d.isLeaf = true;
return d;
}) ?? [];
resolve(apiData);
} else {
proxy.$ElMessage.error(res.msg);
}
});
}
}
const getApiDetailPromise: any = ref(null);
const selectApiDetailInfo: any = ref({});////选择数据产品后带出来的信息
const apiSelectNodeChange = (node, item) => {
if (!node.isLeaf) {
return true;
}
requestParamsTableInfo.value.loading = true;
getApiDetailPromise.value = getApiDetail(node.guid).then((res: any) => {
getApiDetailPromise.value = null;
requestParamsTableInfo.value.loading = false;
requestParamsTableInfo.value.data = [];
if (res.code == proxy.$passCode) {
let data = res.data;
selectApiDetailInfo.value = res.data || {};
if(data.processDTOS&&data.processDTOS.length>0){
let processDTOS=data.processDTOS || [];
if(processDTOS?.length>0){
processDTOS.forEach(obj=>{
obj.noName=obj.processOrderNo + '' + obj.requirementOrderName
})
}
processDTOSValue.value = processDTOS || [];
}
}
else {
proxy.$ElMessage.error(res.msg);
}
})
}
const apiSelectChange = (val) => {
if (!val) {//清空值
apiFormItems.value[0].default = val;
......@@ -310,13 +227,13 @@ const apiSelectChange = (val) => {
} else {
resultFormItems.value[0].default = '';
resultFormItems.value[1].default = '';
if (getApiDetailPromise.value) {
getApiDetailPromise.value.then(() => {
requestParamsTableInfo.value.loading = true;
getApiDetail(val).then((res: any) => {
requestParamsTableInfo.value.loading = false;
requestParamsTableInfo.value.data = [];
if (res.code == proxy.$passCode) {
selectApiDetailInfo.value = res.data || {};
apiFormItems.value[0].default = val;
// apiFormItems.value[1].default = selectApiDetailInfo.value.requestUrl;
// apiFormItems.value[2].default = selectApiDetailInfo.value.sceneName;
// apiFormItems.value[3].default = selectApiDetailInfo.value.sceneGuid;
// apiFormItems.value[4].default = selectApiDetailInfo.value.processOrderNo;
let apiConfigAccessRSVOS = selectApiDetailInfo.value.apiConfigAccessRSVOS || [];
apiConfigAccessRSVOS.forEach(vo => {
if (vo.paramType == 'REQ') {
......@@ -325,29 +242,12 @@ const apiSelectChange = (val) => {
requestParamsTableInfo.value.data.push({ ...vo, isConst: true, introductionValue: vo.defaultValue });
}
})
if (selectApiDetailInfo.value.authenticationType == 'N') {
defaultParamsTableInfo.value.data = defaultParamsData.value.concat([{
paramName: 'appKey',
dataType: '字符型',
isRequired: '是',
value: ''
}]);
} else {
defaultParamsTableInfo.value.data = defaultParamsData.value;
}
});
} else {
apiFormItems.value[0].default = val;
// apiFormItems.value[1].default = selectApiDetailInfo.value.requestUrl;
let apiConfigAccessRSVOS = selectApiDetailInfo.value.apiConfigAccessRSVOS || [];
apiConfigAccessRSVOS.forEach(vo => {
if (vo.paramType == 'REQ') {
requestParamsTableInfo.value.data.push({ ...vo, introductionValue: vo.defaultValue });
} else if (vo.paramType == 'CONSTANT') {
requestParamsTableInfo.value.data.push({ ...vo, isConst: true, introductionValue: vo.defaultValue });
}
})
}
defaultParamsTableInfo.value.data = defaultParamsData.value;
}
else {
proxy.$ElMessage.error(res.msg);
}
})
}
}
......@@ -400,15 +300,6 @@ const startTestApi = () => {
}
});
}
const seeDetail = (row) => {
console.log('row',row);
router.push({
name: 'processSheetDetail',
query: {
guid: row.guid,
}
});
}
</script>
......@@ -417,27 +308,9 @@ const seeDetail = (row) => {
<ContentWrap id="id-requestParams" title="请求参数" description="">
<div>
<Form ref="apiFormRef" :itemList="apiFormItems" formId="table-base-form" :rules="apiFormRules" col="col3"
@treeSelectLoad="apiNodeLoad" @treeSelectNodeChange="apiSelectNodeChange" @select-change="apiSelectChange" />
<el-row :gutter="24" class="mb10" v-if="selectApiDetailInfo?.sceneName">
<el-col :span="24">
<span class="label">API路径:</span>
<!-- -->
<span class="value">{{ selectApiDetailInfo?.requestUrl||'-' }}</span>
</el-col>
<!-- <el-col :span="12">
<span class="label">场景名称:</span>
<span class="value">{{ selectApiDetailInfo?.sceneName }}</span>
</el-col>
-->
</el-row>
<!-- <el-row :gutter="24" class="mb10" v-if="selectApiDetailInfo?.sceneName">
<el-col :span="24">
<span class="label">加工单号:</span>
<span v-for="(obj,idx) in processDTOSValue" @click="seeDetail(obj)" class="value cursor" style="color:#4fa1a4;padding-right:8px">{{ obj.noName }}{{ idx<processDTOSValue.length-1?'、':'' }}</span>
</el-col>
</el-row> -->
@select-change="apiSelectChange" />
</div>
<Table :tableInfo="requestParamsTableInfo" class="mb10 mt8" />
</ContentWrap>
<ContentWrap id="id-defaultParams" title="DEFAULT" description="" class="mt16">
......@@ -462,10 +335,12 @@ const seeDetail = (row) => {
width: calc(60% - 6px) !important;
max-width: 720px;
}
.el-form-item.path-w30 {
width: calc(30% - 6px) !important;
max-width: 540px;
}
.el-form-item.path-w20 {
width: calc(18% - 6px) !important;
max-width: 540px;
......@@ -490,6 +365,7 @@ const seeDetail = (row) => {
.mb10 {
margin-bottom: 10px;
}
.value {
color: #212121;
}
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!