6db18366 by lihua

数据产品目录

1 parent b3d3da60
......@@ -4,8 +4,7 @@ VITE_APP_TITLE = 可信数据空间
# VITE_API_BASEURL = https://www.zgsjzc.com/api
# VITE_API_BASEURL = https://swzl-test.csbr.cn/api
# VITE_API_BASEURL = http://localhost:9000
VITE_API_BASEURL = http://192.168.9.1:58052/
# VITE_API_BASEURL = http://192.168.6.20:8052/
VITE_API_BASEURL = http://192.168.6.20:58052/
VITE_IDASS_BASEURL = https://idaas-test.csbr.cn/login
......
......@@ -5,6 +5,8 @@ import useUserStore from "@/store/modules/user";
import useKeepAliveStore from '@/store/modules/keepAlive'
import { ElMessageBox, ElMessage } from "element-plus";
import { isEqual } from "lodash-es";
import useMenuStore from "@/store/modules/menu";
import useSettingsStore from '@/store/modules/settings'
const router = useRouter();
const route = useRoute();
......@@ -38,6 +40,17 @@ watch(
pathIndex = index
return item.path === newRouter.path
})
if (!newRouter?.meta.title) {
let title: any = '';
for (const m of (useMenuStore().allMenus || [])) {
let child = m.children?.find(cc => cc.path == newRouter.fullPath);
if (child) {
title = child.meta?.title;
break;
}
}
newRouter.meta.title = title;
}
if (option) {
list.splice(pathIndex, 1, newRouter);
} else {
......@@ -45,9 +58,11 @@ watch(
}
}
const settingsStore = useSettingsStore();
settingsStore.setTitle(newRouter.meta.title);
}
tabbarList.value = list;
tabbarActive.value = isExist[0]?.fullPath || newRouter.fullPath;
tabbarActive.value = newRouter.fullPath;
userStore.setTabbar(tabbarList.value);
userStore.setActiveTabbar(combPath, newRouter.fullPath);
},
......
......@@ -153,7 +153,12 @@ router.afterEach((to, from) => {
settingsStore.settings.app.enableProgress && (isLoading.value = false)
// 设置页面 title
if (settingsStore.settings.app.routeBaseOn !== 'filesystem') {
settingsStore.setTitle(to.meta.title)
let title: any = '';
if (!to.meta.title) {
let child = userStore.tabbar?.find((t: any) => t.fullPath == to.fullPath);
title = child?.meta?.title;
}
settingsStore.setTitle(to.meta.title || title)
}
else {
settingsStore.setTitle(to.meta.title)
......
......@@ -7,7 +7,7 @@ const routes: RouteRecordRaw[] = [
path: '/data-asset/register-catalog',
component: Layout,
meta: {
title: '自有数据产品',
title: '数据产品',
icon: 'sidebar-videos',
},
children: [
......@@ -16,7 +16,7 @@ const routes: RouteRecordRaw[] = [
name: 'registerCatalogManagement',
component: () => import('@/views/data_asset/registerCatalogManagement.vue'),
meta: {
title: '自有数据产品',
title: '',
sidebar: false,
breadcrumb: false,
cache: true
......@@ -27,7 +27,7 @@ const routes: RouteRecordRaw[] = [
name: 'registerCatalogCreate',
component: () => import('@/views/data_asset/registerCatalogCreate.vue'),
meta: {
title: '新建自有数据产品',
title: '新建数据产品',
sidebar: false,
breadcrumb: false,
cache: true,
......@@ -149,7 +149,7 @@ const routes: RouteRecordRaw[] = [
name: 'authorDataCatalogManagement',
component: () => import('@/views/data_asset/authorDataCatalogManagement.vue'),
meta: {
title: '授权数据产品',
title: '',
sidebar: false,
breadcrumb: false,
cache: true
......
......@@ -6,6 +6,27 @@ function Layout() {
const routes: RouteRecordRaw[] = [
{
path: '/data-asset/data-source',
component: Layout,
meta: {
title: '数据源管理',
icon: 'sidebar-videos',
},
children: [
{
path: '',
name: 'dataSource',
component: () => import('@/views/data_service/dataSource.vue'),
meta: {
title: '',
sidebar: false,
breadcrumb: false,
cache: true
},
},
],
},
{
path: '/data-service/api-management',
component: Layout,
meta: {
......@@ -18,7 +39,7 @@ const routes: RouteRecordRaw[] = [
name: 'apiManagement',
component: () => import('@/views/data_service/apiManagement.vue'),
meta: {
title: '管理API',
title: '',
sidebar: false,
breadcrumb: false,
cache: true
......@@ -90,7 +111,7 @@ const routes: RouteRecordRaw[] = [
name: 'apiTest',
component: () => import('@/views/data_service/apiTest.vue'),
meta: {
title: '测试API',
title: '',
sidebar: false,
breadcrumb: false,
cache: true
......
......@@ -659,7 +659,8 @@ defineExpose({
<span v-else>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
</template>
</el-table-column>
<el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
<!-- 直接去掉这一列 -->
<!-- <el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
<template #default="scope">
<el-select v-if="scope.row['isEdit'] && !(tableCreateInfo.guid && scope.row['isPrimary'] == 'Y')"
v-model="scope.row['dictionaryCode']" placeholder="请选择" clearable filterable>
......@@ -669,7 +670,7 @@ defineExpose({
<span v-else>{{ scope.row['dictionaryCode'] ? (paramsList.find(p => p.value ==
scope.row['dictionaryCode'])?.label || "--") : '--' }}</span>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column prop="isPrimary" label="是否主键" width="130px" align="left" show-overflow-tooltip>
<template #default="scope">
<el-select v-if="scope.row['isEdit'] && !tableCreateInfo.guid" v-model="scope.row['isPrimary']"
......
......@@ -8,11 +8,9 @@ import { useRouter, useRoute } from "vue-router";
import useUserStore from "@/store/modules/user";
import {
getAreaData,
getCurrentUserInfo
getParamsList,
} from "@/api/modules/queryService";
import {
getParamsList,
dataSourcesList,
registerCatalogSave,
existDamName,
getRegisterCatalogDetail,
......@@ -31,6 +29,8 @@ import importTableField from "./importTableField.vue";
import { useValidator } from '@/hooks/useValidator';
import useDataAssetStore from "@/store/modules/dataAsset";
import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common';
import { TableColumnWidth } from '@/utils/enum';
import { CirclePlus } from '@element-plus/icons-vue';
const { proxy } = getCurrentInstance() as any;
const { required, checkExistName } = useValidator();
......@@ -50,6 +50,15 @@ const getAreaDataPromise: any = ref({});
const getAreaDatas: any = ref({});
const parentAreaData: any = ref([]);
/** 行业分类类型列表 */
const industryDictList: any = ref([]);
/** 领域字典列表 */
const domainDictList: any = ref([]);
/** 机构类型字典列表 */
const institutionTypeDictList: any = ref([]);
/** 更新频率字典列表 */
const updateFrequencyDictList: any = ref([]);
const getArea = (node, resolve) => {
const { level } = node
let params = {
......@@ -100,30 +109,40 @@ const getArea = (node, resolve) => {
}
const baseInfoExpand = ref(true);
const expandServiceInfo = ref(true);
const assetTableInfoExpand = ref(true);
const importTableFieldRef = ref();
const rightMainTenantList: any = ref([]); //权利主体下拉列表选择
const catalogProductList: any = ref([]); //获取资产目录可信空间数据下拉列表
//const catalogProductList: any = ref([]); //获取资产目录可信空间数据下拉列表
const baseInfoFormRef = ref();
const baseInfoFormItems = ref([
{
label: '资源名称',
type: 'select',
type: 'input',
placeholder: '请输入',
field: 'damName',
maxlength: 50,
default: '',
required: true,
options: catalogProductList.value,
allowCreate: true,
filterable: true,
props: {
value: 'productId',
label: 'productName'
},
clearable: true,
required: true
},
// {
// label: '资源名称',
// type: 'select',
// placeholder: '请输入',
// field: 'damName',
// maxlength: 50,
// default: '',
// required: true,
// options: catalogProductList.value,
// allowCreate: true,
// filterable: true,
// props: {
// value: 'productId',
// label: 'productName'
// },
// clearable: true,
// },
{
label: '资源类型',
type: 'select',
......@@ -166,7 +185,8 @@ const baseInfoFormItems = ref([
lazy: false,
props: {
value: 'value',
label: 'label'
label: 'label',
children: 'childDictList'
},
filterable: true,
clearable: true,
......@@ -174,6 +194,82 @@ const baseInfoFormItems = ref([
required: true
},
{
label: '行业分类',
type: 'select',
placeholder: '请选择',
field: 'industry',
default: '',
options: industryDictList.value || [],
props: {
value: 'value',
label: 'label'
},
required: true,
filterable: true,
visible: true
},
{
label: '机构分类',
type: 'select',
placeholder: '请选择',
field: 'institutionType',
default: '',
options: institutionTypeDictList.value || [],
props: {
value: 'value',
label: 'label'
},
required: true,
filterable: true,
visible: true
},
{
label: '领域',
type: 'select',
placeholder: '请选择',
field: 'domain',
default: '003',
options: domainDictList.value,
props: {
value: 'value',
label: 'label',
children: 'children'
},
required: true,
filterable: true,
visible: true
}, {
label: '应用场景',
type: 'select',
placeholder: '请选择',
field: 'scenario',
default: '',
options: [], // 根据所选择领域显示列表
props: {
value: 'value',
label: 'label'
},
required: true,
filterable: true,
visible: true
},
{
label: "更新频率",
type: "select",
placeholder: "请选择",
field: "updateFrequency",
default: '',
props: {
value: 'value',
label: 'label'
},
multiple: false,
options: updateFrequencyDictList.value,
filterable: true,
required: true,
clearable: true,
},
{
label: '数据覆盖地域',
type: 'checkbox-select',
placeholder: '全国',
......@@ -237,7 +333,7 @@ const baseInfoFormItems = ref([
options: route.query.dataSources == '1' ? [{ //如果是授权数据则不能选择其余的
value: 1,
label: '授权数据',
}]: [{
}] : [{
value: 2,
label: '自有数据',
},
......@@ -269,6 +365,38 @@ const baseInfoFormItems = ref([
required: true,
},
{
label: '是否缓存',
type: 'radio-group',
placeholder: '',
field: 'isCache',
block: false,
default: 'N',
options: [{
value: 'Y',
label: '是'
}, {
value: 'N',
label: '否'
}],
required: true,
},
{
label: '是否加密存储',
type: 'radio-group',
placeholder: '',
field: 'isEncrypField',
block: false,
default: 'N',
options: [{
value: 'Y',
label: '是'
}, {
value: 'N',
label: '否'
}],
required: true,
},
{
label: '资源描述',
type: 'textarea',
placeholder: '该数据资源主要包含的信息,数据更新方式等。',
......@@ -331,6 +459,12 @@ const baseInfoFormRules = ref({
rightMain: [required(route.query.dataSources == '1' ? '请选择权利主体' : '请填写权利主体')],
dataSources: [required('请选择数据来源')],
isPublicData: [required('请选择是否公共数据')],
isCache: [required('请选择是否缓存')],
industry: [required('请选择行业分类')],
institutionType: [required('请选择机构分类')],
domain: [required('请选择领域')],
scenario: [required('请选择应用场景')],
updateFrequency: [required('请选择更新频率')]
});
const getTableFieldPromise: any = ref({});
......@@ -491,6 +625,9 @@ const setFormItems = (val) => {
if (item.children?.length) {
item.children[0].default = val[item.children[0].field] || [];
}
if (item.field == 'scenario') {
item.options = domainDictList.value.find(s => s.value == val['domain'])?.childDictList || []
}
});
}
......@@ -505,13 +642,10 @@ const baseSelectChange = (val, item, row) => {
setFormItems(row);
}
}
} else if (item.field == 'damName') {
let item = catalogProductList.value.find(c => c.productId == val);
if (item?.description) {
row.propertyDescription = item?.description;
} else if (item.field == 'domain') {
row.scenario = ''; //清空下应用场景
setFormItems(row);
}
}
}
const handleBaseInfoCheckboxChange = (val, info) => {
......@@ -521,6 +655,86 @@ const handleBaseInfoCheckboxChange = (val, info) => {
setFormItems(info);
}
/** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */
const productTableRef = ref();
const productData: any = ref([]);
const apiList: any = ref([]);
/** 基本信息的入参定义表格配置 */
const productTableInfo = ref({
id: "input-product-table",
height: '214px',
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 },
],
editInfo: {
apiGuid: {
label: '',
type: 'select',
field: 'apiGuid',
default: '',
options: apiList.value,
props: {
label: 'apiName',
value: 'guid',
disabled: 'disabled'
},
placeholder: '请选择',
clearable: false,
filterable: true
},
},
STATUS: 'edit',
data: productData.value,
showPage: false,
actionInfo: {
show: true,
label: "操作",
type: "btn",
width: 60,
fixed: 'right',
btns: [
{
label: "删除", value: "remove", click: (scope) => {
let index = scope.$index;
proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => {
productData.value.splice(index, 1);
productTableInfo.value.data = productData.value;
proxy.$ElMessage.success('服务包删除成功');
}, () => {
proxy.$ElMessage.info("已取消");
});
}
},
]
},
loading: false
});
/** 给表格添加一行入参定义。 */
const addProduct = () => {
productData.value.push({ apiGuid: '' });
productTableInfo.value.data = productData.value;
nextTick(() => {
scrollLastRowToView(productTableRef.value?.tableRef, productData.value.length);
})
}
/** 根据下拉选择的产品带出产品相关信息 */
const hanldeTableSelectChange = (val, scope, item) => {
let productItem = val && apiList.value.find(p => p.guid == val);
scope.row.guid = val;
scope.row.apiName = productItem?.apiName;
scope.row.apiType = productItem?.apiType;
scope.row.requestUrl = productItem?.requestUrl;
scope.row.apiDescription = productItem?.apiDescription;
}
const handleCreateTable = () => {
if (assetDataTableInfo.value.data.length >= 15) {
proxy.$ElMessage.error('最多允许添加15张资源表');
......@@ -570,18 +784,6 @@ onBeforeMount(() => {
detailInfo.value = res.data || {};
baseInfoFormItems.value.forEach((item: any) => {
item.default = detailInfo.value[item.field] == null ? '' : detailInfo.value[item.field];
if (item.field == 'damName') {
if (detailInfo.value?.productCode) {
let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
if (!item) {
item.default = detailInfo.value.damName;
} else {
item.default = item.productCode;
}
} else {
item.default = detailInfo.value.damName;
}
}
if (item.field == 'subjectDomain') {
let tree = detailInfo.value.subjectDomainTree?.[0];
if (tree) {
......@@ -625,6 +827,8 @@ onBeforeMount(() => {
}
} else if (item.field == 'rightMain') {
item.default = route.query.dataSources == '1' ? detailInfo.value.rightMain : detailInfo.value.rightMainName;
} else if (item.field == 'scenario') {
item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || []
}
});
if (route.query.guid && route.query.foundMode == '2') {
......@@ -668,52 +872,90 @@ onBeforeMount(() => {
}
})
}
getRegisterCatalogProductList().then((res: any) => {
catalogProductList.value = [];
// getRegisterCatalogProductList().then((res: any) => {
// catalogProductList.value = [];
// if (res.code == proxy.$passCode) {
// catalogProductList.value = res.data || [];
// baseInfoFormItems.value[0].options = catalogProductList.value;
// if (detailInfo.value?.productCode) {
// let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
// if (!item) {
// baseInfoFormItems.value[0].default = detailInfo.value.damName;
// }
// }
// } else {
// proxy.$ElMessage.error(res.msg);
// }
// })
getParamsList({
dictType: "资产类型",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
catalogProductList.value = res.data || [];
baseInfoFormItems.value[0].options = catalogProductList.value;
if (detailInfo.value?.productCode) {
let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
if (!item) {
baseInfoFormItems.value[0].default = detailInfo.value.damName;
}
damTypes.value = res.data || [];
let item = baseInfoFormItems.value.find(item => item.field == 'damType');
item && (item.options = damTypes.value);
} else {
proxy.$ElMessage.error(res.msg);
}
})
getParamsList({
dictType: "数据资产目录主题名称",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
subjectDomainListData.value = res.data || [];
let item = baseInfoFormItems.value.find(item => item.field == 'subjectDomain');
item && (item.options = subjectDomainListData.value);
} else {
proxy.$ElMessage.error(res.msg);
}
})
function replaceChildDictListKey(data) {
if (Array.isArray(data)) {
return data.map(item => replaceChildDictListKey(item));
} else if (data && typeof data === 'object') {
const { childDictList, ...rest } = data;
return {
...rest,
children: childDictList ? replaceChildDictListKey(childDictList) : undefined,
};
getParamsList({
dictType: "行业分类",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
industryDictList.value = res.data || [];
let item = baseInfoFormItems.value.find(item => item.field == 'industry');
item && (item.options = industryDictList.value);
} else {
proxy.$ElMessage.error(res.msg);
}
return data;
})
getParamsList({ dictType: '领域' }).then((res: any) => {
if (res.code == proxy.$passCode) {
domainDictList.value = res.data || [];
let itemIndex = baseInfoFormItems.value.findIndex(item => item.field == 'domain');
let item = baseInfoFormItems.value[itemIndex];
item && (item.options = domainDictList.value);
let item1 = baseInfoFormItems.value[itemIndex + 1];
item1 && item.default && (item1.options = domainDictList.value.find(s => s.value == item.default)?.childDictList || []);
} else {
proxy.$ElMessage.error(res.msg);
}
});
getParamsList({
dictType: "资产类型",
dictType: "组织机构性质",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
damTypes.value = res.data || [];
let item = baseInfoFormItems.value.find(item => item.field == 'damType');
item && (item.options = damTypes.value);
institutionTypeDictList.value = res.data || [];
let item = baseInfoFormItems.value.find(item => item.field == 'institutionType');
item && (item.options = institutionTypeDictList.value);
} else {
proxy.$ElMessage.error(res.msg);
}
})
getParamsList({
dictType: "数据资产目录主题名称",
dictType: "更新周期",
}).then((res: any) => {
if (res.code == proxy.$passCode) {
subjectDomainListData.value = replaceChildDictListKey(res.data) || [];
let item = baseInfoFormItems.value.find(item => item.field == 'subjectDomain');
item && (item.options = subjectDomainListData.value);
updateFrequencyDictList.value = res.data || [];
let item = baseInfoFormItems.value.find(item => item.field == 'updateFrequency');
item && (item.options = updateFrequencyDictList.value);
} else {
proxy.$ElMessage.error(res.msg);
}
......@@ -735,28 +977,25 @@ const save = () => {
baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
let params = { ...baseInfoFormRef.value.formInline };
let item = catalogProductList.value.find(c => c.productId == params.damName);
if (item) {
params.productCode = item.productId;
params.damName = item.productName;
params.foundMode = 5;
} else {
params.damName = params.damName;
if (params.damName.length > 50) {
proxy.$ElMessage.error('资源名称的长度不能超过50');
baseInfoExpand.value = true;
let associationApiList: string[] = [];
for (const api of productData.value) {
if (!api.apiGuid) {
proxy.$ElMessage.error('服务包信息未填写完整');
expandServiceInfo.value = true;
return;
}
associationApiList.push(api.apiGuid);
}
params.associationApi = associationApiList;
/** 只有数据集和api类型时,目录表必填。 */
if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') {
if (!params.databaseType) {
proxy.$ElMessage.error('资源类型为数据集或API时,数据库类型必填');
proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
baseInfoExpand.value = true;
return;
}
if (!assetDataTableInfo.value.data) {
proxy.$ElMessage.error('资源类型为数据集或API时,必需添加资源表');
proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表');
assetTableInfoExpand.value = true;
nextTick(() => {
setTimeout(() => {
......@@ -940,6 +1179,14 @@ const handleImportSave = (val) => {
<Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules"
@selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" />
</ContentWrap>
<ContentWrap id="product-info" title="服务包信息" expandSwicth style="margin-top: 15px" :isExpand="expandServiceInfo"
@expand="(v) => (expandServiceInfo = v)" description="" class="mb16">
<Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table"
@table-select-change="hanldeTableSelectChange" />
<div class="row-add-btn">
<el-button link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button>
</div>
</ContentWrap>
<ContentWrap id="id-tableInfo" title="资源表" description="" :expand-swicth="true" :isExpand="assetTableInfoExpand"
@expand="(v) => assetTableInfoExpand = v">
<div v-show="assetDataTableInfo.data.length" class="tools_btns">
......
......@@ -192,6 +192,8 @@ const getDetailInfo = () => {
const data = res.data || {};
detailInfo.value = data;
publicDataProductsMainRSVO.value = detailInfo.value.publicDataProductsMainRSVO || {};
//TODO. 返回服务包信息
productTableInfo.value.data = detailInfo.value.associationApiVO || [];
// 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) {
......@@ -320,6 +322,25 @@ const getDetailInfo = () => {
})
}
/** ----------------- 数据包信息 --------------------- */
const productTableInfo = ref({
id: "input-product-table",
height: '214px',
fields: [
{ label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
{ label: "服务名称", field: "apiGuid", width: 180 },
{ label: "API类型", field: "apiType", width: 100 },
{ label: "API地址", field: "requestUrl", width: 240 },
{ label: "描述", field: "apiDescription", width: 240 },
],
data: [],
showPage: false,
actionInfo: {
show: false
},
loading: false
});
onBeforeMount(() => {
if (!assetStore.isRefreshDamCatalog) {
getDetailInfo();
......@@ -357,11 +378,12 @@ const isTextTruncated = () => {
isTruncated.value = false;
isExpanded.value = false;
nextTick(() => {
let domDesc = document.getElementsByClassName('right-main')?.[0];
let dom = document.getElementsByClassName('right-main')?.[0];
let domDesc = dom?.children?.length && dom?.children?.[dom.children.length - 1];
if (!domDesc) {
return;
}
if (domDesc.clientHeight > 82) {
if (domDesc.clientHeight > 21) {
isTruncated.value = true;
} else {
isTruncated.value = false;
......@@ -1210,8 +1232,23 @@ const respParamsTableInfo = ref({
detailInfo.subjectDomain }}</div>
<div class="dataLabel dataLabel1" v-if="detailInfo.databaseType">{{ detailInfo.databaseType }}</div>
<div class="dataLabel dataLabel1">{{ detailInfo.dataSourcesName }}</div>
<div class="dataLabel dataLabel1" v-if="detailInfo.updateFrequency">{{ detailInfo.updateFrequencyName }}</div>
</div>
</div>
<template v-if="detailInfo?.foundMode == 1">
<div class="row-extra-desc">
<div class="per-extra-desc">{{ '行业分类:' + (detailInfo.industryName || '--') }}</div>
<div>{{ '机构分类:' + (detailInfo.institutionTypeName || '--') }}</div>
</div>
<div class="row-extra-desc">
<div class="per-extra-desc">{{ '领域:' + (detailInfo.domainName || '--') }}</div>
<div>{{ '应用场景:' + (detailInfo.scenarioName || '--') }}</div>
</div>
<div class="row-extra-desc">
<div class="per-extra-desc">{{ '是否缓存:' + (detailInfo.isCache == 'Y' ? '是' : '否') }}</div>
<div>{{ '是否加密存储:' + (detailInfo.scenario == 'Y' ? '是' : '否') }}</div>
</div>
</template>
<div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }}
</div>
<div class="applicationScenarios"
......@@ -1300,7 +1337,7 @@ const respParamsTableInfo = ref({
</div>
<div class="list_item is_block">
<span class="item_label">产品关键词:</span>
<span class="item_value">{{ publicDataProductsMainRSVO.productKeywords?.join(',') || '--' }}</span>
<span class="item_value">{{ publicDataProductsMainRSVO?.productKeywords?.join(',') || '--' }}</span>
</div>
<div class="list_item is_block">
<span class="item_label">产品描述:</span>
......@@ -1308,6 +1345,9 @@ const respParamsTableInfo = ref({
</div>
</div>
</ContentWrap>
<ContentWrap v-if="productTableInfo.data?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px">
<Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" />
</ContentWrap>
<ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px">
<el-tabs v-model="activeTabName" class="param-tabs">
<el-tab-pane label="入参信息" name="reqParamList">
......@@ -1355,7 +1395,7 @@ const respParamsTableInfo = ref({
<span>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
</template>
</el-table-column>
<el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
<el-table-column v-if="detailInfo.foundMode != 1" prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
<template #default="scope">
<span>{{ scope.row["dictionaryName"] || '--' }}</span>
</template>
......@@ -1852,7 +1892,7 @@ const respParamsTableInfo = ref({
letter-spacing: 0;
line-height: 30px;
font-weight: 600;
max-width: calc(100% - 250px);
max-width: calc(100% - 320px);
}
.dataLabel {
......@@ -1891,9 +1931,24 @@ const respParamsTableInfo = ref({
.expand_btn {
position: absolute;
right: 0px;
top: 58px;
bottom: 0px;
font-size: 14px;
line-height: 21px;
}
.row-extra-desc {
width: 100%;
display: flex;
margin-top: 4px;
font-size: 14px;
color: #666666;
letter-spacing: 0;
line-height: 21px;
font-weight: 400;
.per-extra-desc {
width: 400px;
}
}
}
}
......
......@@ -5,9 +5,7 @@ name: registerCatalogManagement
<script lang="ts" setup name="registerCatalogManagement">
import { ref } from "vue";
import TableTools from "@/components/Tools/table_tools.vue";
import { ElMessageBox } from "element-plus";
import { useRouter, useRoute } from "vue-router";
import { MoreFilled } from "@element-plus/icons-vue";
import {
getParamsList,
getDamCatalogTable,
......@@ -49,7 +47,7 @@ const damTypesOptions = ref<any>([
{ label: "加工交付", value: 2 },
{ label: "专区", value: 3 },
{ label: "江苏专区", value: 4 },
{ label: "数据港", value: 5 },
// { label: "数据港", value: 5 },
])
const searchItemList = ref([
{
......@@ -110,20 +108,20 @@ const searchItemList = ref([
label: 'label'
}
},
{
type: "select",
label: "",
field: "isRegister",
default: "",
placeholder: "登记状态",
clearable: true,
filterable: true,
options: isRegisterOptions.value,
props: {
value: 'value',
label: 'label'
}
},
// {
// type: "select",
// label: "",
// field: "isRegister",
// default: "",
// placeholder: "登记状态",
// clearable: true,
// filterable: true,
// options: isRegisterOptions.value,
// props: {
// value: 'value',
// label: 'label'
// }
// },
]);
const pageInfo = ref({
......
......@@ -259,6 +259,14 @@ const apiManageTableBtnMap = {
/** 详情 */
DETAIL: (scope) => {
let row = scope.row;
const approveVO = row.approveVO || {};
if (!approveVO && row.isApprove == 'N') {
router.push({
name: 'apiDetail',
query: { guid: row.guid, type: 'detail' }
});
return;
}
if (!row.approveGuid) {
proxy.$ElMessage.error(`【${row.apiName}】关联流程已删除!`);
return;
......
<route lang="yaml">
name: dataSource
</route>
<script lang="ts" setup name="dataSource">
import { ref, onMounted } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import TableTools from "@/components/Tools/table_tools.vue";
import {
addDataSource,
getDataSourceList,
deleteDataSource,
updateDataSource,
getDataSourceDetail,
checkDataSourceConnect,
checkDataSourceConnectTest,
getAllFlowData
} from "@/api/modules/queryService";
const { proxy } = getCurrentInstance() as any;
const searchItemList = ref([
{
type: "select",
label: "",
field: "systemLayer",
default: "",
placeholder: "系统分层",
options: [
{ label: "业务系统", value: "业务系统" },
{ label: "数据中心", value: "数据中心" },
],
clearable: true,
},
{
type: "select",
label: "",
field: "databaseType",
default: "",
placeholder: "库类型",
options: [
{ label: "mysql", value: "mysql" },
{ label: "doris", value: "doris" },
{ label: "oracle", value: "oracle" },
],
clearable: true,
},
{
type: "select",
label: "",
field: "connectStatus",
default: "",
placeholder: "连通状态",
options: [
{ label: "已连通", value: "1" },
{ label: "连通失败", value: "2" },
],
clearable: true,
},
{
type: "input",
label: "",
field: "databaseNameZh",
default: "",
placeholder: "数据源名称",
clearable: true,
},
{
type: "input",
label: "",
field: "databaseNameEn",
default: "",
placeholder: "数据库名",
clearable: true,
},
]);
const currTableData: any = ref<Object>({});
const page = ref({
limit: 50,
curr: 1,
sizes: [
{ label: "10", value: 10 },
{ label: "50", value: 50 },
{ label: "100", value: 100 },
{ label: "150", value: 150 },
{ label: "200", value: 200 },
],
systemLayer: '',
databaseType: '',
connectStatus: '',
databaseNameZh: '',
databaseNameEn: ''
});
const selectRowData = ref([]);
const tableInfo = ref({
id: "data-source-table",
multiple: true,
fields: [
{ label: "序号", type: "index", width: 56, align: "center" },
{ label: "数据源名称", field: "databaseNameZh", width: 120 },
{ label: "系统分层", field: "systemLayer", width: 96 },
{ label: "库类型", field: "databaseType", width: 96 },
{ label: "数据库名", field: "databaseNameEn", width: 200 },
{
label: "连通状态",
field: "connectStatus",
type: "tag",
width: 96,
align: "center",
},
{ label: "连通时间", field: "lastCheckTime", width: 172 },
{ label: "操作人", field: "updateUserName", width: 140 },
{ label: "更新时间", field: "updateTime", width: 172 },
],
data: [],
page: {
type: "normal",
rows: 0,
...page.value,
},
actionInfo: {
label: "操作",
type: "btn",
width: 160,
btns: [
{ label: "编辑", value: "edit" },
{ label: "连通测试", value: "test" },
{ label: "删除", value: "delete" },
],
},
loading: false,
});
const tabActiveName = ref("1");
const tabsInfo: any = ref({
type: "tabs",
title: "",
style: {
padding: "0 24px",
},
tabsInfo: {
activeName: "",
tabs: [
{ label: "常规", name: "常规" },
// { label: "SSL", name: "SSL" }, //未支持,先隐藏掉
// { label: "SSH", name: "SSH" },
// { label: "HTTP", name: "HTTP" },
],
},
});
const formItems: any = ref([]);
const formRules: any = ref({});
const flowList: any = ref([])
const formInfo: any = ref({
type: "form",
title: "",
style: {
padding: "0 24px",
overflow: 'hidden auto'
},
formInfo: {
id: "add-source-form",
items: formItems.value,
rules: formRules.value,
},
});
const contents: any = ref({
normal: {
items: [
{
label: "数据源名称",
type: "input",
placeholder: "请输入",
field: "databaseNameZh",
default: "",
clearable: true,
required: true,
},
{
label: "系统分层",
type: "select",
placeholder: "请选择",
field: "systemLayer",
default: "",
options: [
{
label: "业务系统",
value: "业务系统",
},
{
label: "数据中心",
value: "数据中心",
},
],
clearable: true,
required: true,
},
{
label: "库类型",
type: "select",
placeholder: "请选择",
field: "databaseType",
default: "",
options: [
{ label: "mysql", value: "mysql" },
{ label: "doris", value: "doris" },
{ label: "oracle", value: "oracle" },
],
clearable: true,
required: true,
},
{
label: "业务系统",
type: "select",
placeholder: "请选择",
field: "bizSystem",
default: "",
options: [],
clearable: true,
required: true,
},
{
label: "集群信息",
type: "textarea-group",
placeholder: "请输入",
field: "jqxx",
default: "",
tooltipContent:
"格式:doris-fe-zs.doris:8030,doris-fe-zs.doris:8090 多个地址用英文半角逗号分隔",
children: [
{
label: "feLoadUrl",
type: "textarea",
placeholder: "请输入",
field: "feLoadUrl",
default: "",
clearable: true,
required: true,
block: true,
},
{
label: "beLoadUrl",
type: "textarea",
placeholder: "请输入",
field: "beLoadUrl",
default: "",
clearable: true,
required: true,
block: true,
},
{
label: "dorisJdbcUrl",
type: "textarea",
placeholder: "请输入",
field: "dorisJdbcUrl",
default: "",
clearable: true,
required: true,
block: true,
},
],
block: true,
visible: false,
},
{
label: "服务器",
type: "input",
placeholder: "请输入",
field: "host",
default: "",
clearable: true,
required: true,
},
{
label: "端口",
type: "input",
placeholder: "请输入",
field: "port",
default: "",
clearable: true,
required: true,
},
{
label: "用户名",
type: "input",
placeholder: "请输入",
field: "logonUser",
default: "",
clearable: true,
required: true,
autocompleteSetting: {
autocomplete: "off",
readonly: true,
},
},
{
label: "密码",
type: "password",
placeholder: "请输入",
field: "password",
default: "",
clearable: true,
required: true,
autocompleteSetting: {
autocomplete: "off",
readonly: true,
},
},
{
label: "数据库名",
type: "input",
placeholder: "请输入",
field: "databaseNameEn",
default: "",
clearable: true,
required: true,
},
{
label: "连接属性",
type: "textarea-tips",
placeholder: "请输入",
field: "linkage",
default: "",
tips: {
type: "table",
size: 400,
placement: "right",
offset: 12,
tableInfo: {
id: "",
fields: [
{ label: "数据库", field: "jsmc", width: 120 },
{ label: "连接属性", field: "sx", width: 200 },
],
data: [
{
jsmc: "MYSQL8.0",
sx: "列出支持的连接属性,并给出解释和范例,多个属性用;分割",
cjsj: "2022-12-12 08:12:12",
},
{
jsmc: "MYSQL8.0",
sx: "服务器的时区:serverTimezone=Asia/Shanghai;",
cjsj: "2022-12-12 08:12:12",
},
{
jsmc: "MYSQL8.0",
sx: "useUnicode=utf8;",
cjsj: "2022-12-12 08:12:12",
},
{
jsmc: "MYSQL8.0",
sx: "characterEncoding=utf8;",
cjsj: "2022-12-12 08:12:12",
},
{
jsmc: "MYSQL8.0",
sx: "useSSL=false",
cjsj: "2022-12-12 08:12:12",
},
],
showPage: false,
tableTool: [],
actionInfo: {
show: false,
},
btn: {
label: "",
value: "QuestionFilled",
},
},
},
clearable: true,
required: false,
block: true,
},
],
rules: {
databaseNameZh: [
{
validator: (rule: any, value: any, callback: any) => {
if (value === "") {
callback(new Error("请填写数据源名称"));
} else {
if (
dialogInfo.value.type == "edit" &&
value == currTableData.value.databaseNameZh
) {
callback();
return;
}
callback();
// let params: any = {
// dataPermissionName: value,
// };
// if (dialogInfo.value.type == 'edit') {
// params.guid = currTableData.value.guid
// }
// checkPermissionDict(params)
// .then((res: any) => {
// if (res.code == proxy.$passCode) {
// if (res.data) {
// callback(new Error("该名称已存在,请填写其他名称"));
// } else {
// callback();
// }
// } else {
// callback(new Error(res.msg));
// }
// })
// .catch((xhr) => {
// callback(new Error(xhr.msg));
// });
}
},
trigger: "blur",
},
],
bizSystem: [{
required: true,
message: "请选择业务系统",
trigger: "change",
}],
systemLayer: [
{
required: true,
message: "请选择系统分层",
trigger: "change",
},
],
databaseType: [
{
required: true,
message: "请选择库类型",
trigger: "change",
},
],
host: [
{
required: true,
message: "请填写服务器ip地址",
trigger: "blur",
},
],
port: [
{
required: true,
message: "请填写端口号",
trigger: "blur",
},
],
logonUser: [
{
required: true,
message: "请填写用户名",
trigger: "blur",
},
],
password: [
{
required: true,
message: "请填写密码",
trigger: "blur",
},
],
databaseNameEn: [
{
required: true,
message: "请填写数据库名",
trigger: "blur",
},
],
feLoadUrl: [
{
validator: (rule: any, value: any, callback: any) => {
if (value === "") {
callback(new Error("请填写feLoadUrl"));
} else {
if (
dialogInfo.value.type == "edit" &&
value == currTableData.value.feLoadUrl
) {
callback();
return;
}
callback();
}
},
trigger: "blur",
},
],
beLoadUrl: [
{
validator: (rule: any, value: any, callback: any) => {
if (value === "") {
callback(new Error("请填写beLoadUrl"));
} else {
if (
dialogInfo.value.type == "edit" &&
value == currTableData.value.beLoadUrl
) {
callback();
return;
}
callback();
}
},
trigger: "blur",
},
],
dorisJdbcUrl: [
{
validator: (rule: any, value: any, callback: any) => {
if (value === "") {
callback(new Error("请填写dorisJdbcUrl"));
} else {
if (
dialogInfo.value.type == "edit" &&
value == currTableData.value.dorisJdbcUrl
) {
callback();
return;
}
callback();
}
},
trigger: "blur",
},
],
},
},
ssl: {
items: [
{
label: "",
type: "checkbox",
col: "margin_b_0",
placeholder: "使用SSL",
field: "useSsl",
required: false,
block: true,
},
{
label: "",
type: "checkbox-panel",
placeholder: "使用验证",
field: "yz",
children: [
{
label: "客户端秘钥",
type: "file-upload",
placeholder: "选择文件上传",
field: "khdmy",
disabled: true,
required: true,
block: true,
},
{
label: "客户端证书",
type: "file-upload",
placeholder: "选择文件上传",
field: "khdzs",
disabled: true,
required: true,
block: true,
},
{
label: "CA证书",
type: "file-upload",
placeholder: "选择文件上传",
field: "cazs",
disabled: true,
required: true,
block: true,
},
{
label: "指定密码检索表",
type: "append-empty",
placeholder: "请输入",
field: "khdzs",
disabled: true,
required: true,
block: true,
},
],
required: false,
block: true,
},
],
rules: {},
},
ssh: {
items: [
{
label: "",
type: "checkbox-panel",
placeholder: "使用SSH",
field: "yz",
children: [
{
label: "主机名或IP地址",
type: "input",
placeholder: "请输入",
field: "khdmy",
required: false,
disabled: true,
},
{
label: "端口",
type: "input",
placeholder: "请输入",
field: "khdzs",
required: false,
disabled: true,
},
{
label: "用户名",
type: "input",
placeholder: "请输入",
field: "cazs",
required: false,
disabled: true,
},
{
label: "验证方法",
type: "select",
placeholder: "请选择",
field: "yzfs",
options: [
{ label: "密码", value: "pwd" },
{ label: "手机号", value: "tel" },
],
required: false,
disabled: true,
},
{
label: "密码",
type: "input",
placeholder: "请输入",
field: "pwd",
required: false,
disabled: true,
},
{
label: "",
type: "checkbox",
placeholder: "保存密码",
field: "savePwd",
required: false,
},
],
required: false,
block: true,
},
],
rules: {},
},
http: {
items: [
{
label: "",
type: "checkbox-input",
placeholder: "使用HTTP通道",
field: "tddz",
children: [
{
label: "",
type: "input",
placeholder: "通道地址",
field: "khdmy",
required: false,
disabled: true,
},
],
block: true,
},
{
label: "",
type: "tabs-panel-card",
placeholder: "用base64编码传出查询",
field: "basebm",
tabsInfo: {
type: "card",
activeName: "yz",
col: "border",
tabs: [
{
label: "验证",
name: "yz",
pane: {
type: "form",
title: "",
formInfo: {
id: "",
items: [
{
label: "",
type: "checkbox-panel",
col: "margin_b_0 border_none col_3",
placeholder: "使用密码验证",
field: "mmyz",
children: [
{
label: "",
type: "input",
placeholder: "用户名",
field: "cazs",
required: false,
disabled: true,
},
{
label: "",
type: "input",
placeholder: "密码",
field: "pwd",
required: false,
disabled: true,
},
{
label: "",
type: "checkbox",
placeholder: "保存密码",
field: "savePwd",
required: false,
},
],
required: false,
block: true,
},
{
label: "",
type: "checkbox-panel",
col: "border_none",
placeholder: "使用证书验证",
field: "zsyz",
children: [
{
label: "客户端秘钥",
type: "file-upload",
placeholder: "选择文件上传",
field: "khdmy",
disabled: true,
required: true,
block: true,
},
{
label: "客户端证书",
type: "file-upload",
placeholder: "选择文件上传",
field: "khdzs",
disabled: true,
required: true,
block: true,
},
{
label: "CA证书",
type: "file-upload",
placeholder: "选择文件上传",
field: "cazs",
disabled: true,
required: true,
block: true,
},
{
label: "密码短语",
type: "append-empty",
placeholder: "请输入",
field: "khdzs",
disabled: true,
required: true,
block: true,
},
],
required: false,
block: true,
},
],
},
},
},
{
label: "代理服务器",
name: "dl",
pane: {
type: "form",
title: "",
formInfo: {
id: "",
items: [
{
label: "",
type: "checkbox-panel",
col: "border_none",
placeholder: "使用代理服务器",
field: "yz",
children: [
{
label: "主机名或IP地址",
type: "input",
placeholder: "请输入",
field: "khdmy",
required: false,
disabled: true,
},
{
label: "端口",
type: "input",
placeholder: "请输入",
field: "khdzs",
required: false,
disabled: true,
},
{
label: "用户名",
type: "input",
placeholder: "请输入",
field: "cazs",
required: false,
disabled: true,
},
{
label: "验证方法",
type: "select",
placeholder: "请选择",
field: "yzfs",
options: [
{ label: "密码", value: "pwd" },
{ label: "手机号", value: "tel" },
],
required: false,
disabled: true,
},
{
label: "密码",
type: "input",
placeholder: "请输入",
field: "pwd",
required: false,
disabled: true,
},
{
label: "",
type: "checkbox",
placeholder: "保存密码",
field: "savePwd",
required: false,
},
],
required: false,
block: true,
},
],
},
},
},
],
},
children: [
{
label: "主机名或IP地址",
type: "input",
placeholder: "请输入",
field: "khdmy",
required: false,
},
{
label: "端口",
type: "input",
placeholder: "请输入",
field: "khdzs",
required: false,
},
{
label: "用户名",
type: "input",
placeholder: "请输入",
field: "cazs",
required: false,
},
{
label: "验证方法",
type: "select",
placeholder: "请选择",
field: "yzfs",
default: "pwd",
options: [
{ label: "密码", value: "pwd" },
{ label: "手机号", value: "tel" },
],
required: false,
},
{
label: "密码",
type: "input",
placeholder: "请输入",
field: "pwd",
required: false,
},
{
label: "",
type: "checkbox",
placeholder: "保存密码",
field: "savePwd",
required: false,
},
],
required: false,
block: true,
},
],
rules: {},
},
});
const dialogRef = ref();
const dialogInfo = ref({
visible: false,
size: 700,
direction: "column",
height: '440px',
header: {
title: "",
},
type: "",
readonly: false,
contents: [],
footer: {
btns: [
{ type: "default", label: "取消", value: "cancel" },
{ type: "primary", label: "确定", value: "submit" },
],
textBtns: [{ type: "primary", label: "连通测试", value: "connect" }],
},
});
const setFormItems = (name, info: any = null) => {
let contentFormInfo: any = {};
if (name == "常规") {
tabActiveName.value = "1";
contentFormInfo = contents.value["normal"];
} else if (name == "SSL") {
tabActiveName.value = "2";
contentFormInfo = contents.value["ssl"];
} else if (name == "SSH") {
tabActiveName.value = "3";
contentFormInfo = contents.value["ssh"];
} else if (name == "HTTP") {
tabActiveName.value = "4";
contentFormInfo = contents.value["http"];
}
tabsInfo.value.tabsInfo.activeName = name;
formItems.value = contentFormInfo.items;
formRules.value = contentFormInfo.rules;
if (info !== null) {
const type = dialogInfo.value.type;
formItems.value.map((item) => {
if (
item.field == "host" ||
item.field == "port" ||
item.field == "logonUser" ||
item.field == "password"
) {
if (type == "edit" || type == "detail") {
item.default = info?.[item.field] ?? "";
} else {
item.default = info[item.field] ?? "";
}
if (item.field == "logonUser" || item.field == "password") {
item.autocompleteSetting.readonly = true;
}
} else if (item.field == "jqxx") {
item.visible = info.databaseType == "doris";
item.children.map((child) => {
if (type == 'edit' || type == 'detail') {
child.default = info?.[child.field] ?? "";
} else {
child.default = info[child.field] ?? "";
}
});
} else if (item.field == 'bizSystem') {
item.visible = info.systemLayer == '业务系统';
item.default = info[item.field] || "";
}
else {
item.default = info[item.field] || "";
}
});
} else {
formItems.value.map((item) => {
if (item.field == "logonUser" || item.field == "password") {
item.autocompleteSetting.readonly = true;
}
});
}
formInfo.value.formInfo.items = formItems.value;
formInfo.value.formInfo.rules = formRules.value;
const content: any = [tabsInfo.value, formInfo.value];
dialogInfo.value.contents = content;
};
const getFirstPageData = () => {
page.value.curr = 1;
getTableData();
};
onMounted(() => {
getAllFlowData({ dictType: "业务系统" }).then((res) => {
flowList.value = res.data
contents.value.normal.items[3].options = flowList.value
})
})
const toSearch = (val: any, clear: boolean = false) => {
if (clear) {
searchItemList.value.map((item) => (item.default = ""));
page.value.systemLayer = "";
page.value.databaseType = "";
page.value.connectStatus = "";
page.value.databaseNameZh = "";
page.value.databaseNameEn = "";
} else {
page.value.systemLayer = val.systemLayer;
page.value.databaseType = val.databaseType;
page.value.connectStatus = val.connectStatus;
page.value.databaseNameZh = val.databaseNameZh;
page.value.databaseNameEn = val.databaseNameEn;
}
getTableData();
};
const getTableData = () => {
tableInfo.value.loading = true;
getDataSourceList({
pageIndex: page.value.curr,
pageSize: page.value.limit,
systemLayer: page.value.systemLayer,
databaseType: page.value.databaseType,
connectStatus: page.value.connectStatus,
databaseNameZh: page.value.databaseNameZh,
databaseNameEn: page.value.databaseNameEn
})
.then((res: any) => {
if (res.code == proxy.$passCode) {
const data = res.data || {};
tableInfo.value.data = data.records || [];
tableInfo.value.page.limit = data.pageSize;
tableInfo.value.page.curr = data.pageIndex;
tableInfo.value.page.rows = data.totalRows;
} else {
ElMessage({
type: "error",
message: res.msg,
});
}
tableInfo.value.loading = false;
})
.catch((xhr) => {
tableInfo.value.loading = false;
});
};
const tableSelectionChange = (val) => {
selectRowData.value = val.map((item) => item.guid);
};
const tablePageChange = (info) => {
page.value.curr = Number(info.curr);
page.value.limit = Number(info.limit);
getTableData();
};
const tabChange = (tabName) => {
// TODO.等添加了tab切换之后再保留旧值.
setFormItems(tabName);
};
/** 表单修改时的原始值 */
const originValue: any = ref({});
const formSelectChange = (val, row, info) => {
console.log(row, info)
if (row.field == "databaseType" || row.field == 'systemLayer') {
if (tabsInfo.value.tabsInfo.activeName == "常规") {
let newInfo = originValue.value = Object.assign(originValue.value, info);
setFormItems("常规", newInfo);
}
}
};
const tableBtnClick = (scope, btn) => {
const type = btn.value;
const row = scope.row;
currTableData.value = row;
if (type == "edit") {
dialogInfo.value.type = type;
dialogInfo.value.header.title = "编辑数据源";
const guid = row.guid;
getDataSourceDetail(guid).then((res: any) => {
if (res.code == proxy.$passCode && res.data) {
const data = res.data;
currTableData.value = data;
setDetailInfo();
} else {
ElMessage({
type: "error",
message: res.msg,
});
}
});
} else if (type == "test") {
checkConnect({});
} else if (type == "delete") {
open("此操作将永久删除, 是否继续?", "warning");
}
};
const open = (msg, type, isBatch = false) => {
ElMessageBox.confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: type,
}).then(() => {
let guids = [currTableData.value.guid];
if (isBatch) {
guids = selectRowData.value;
}
deleteDataSource(guids).then((res: any) => {
if (res.code == proxy.$passCode) {
getTableData();
ElMessage({
type: "success",
message: "删除成功",
});
} else {
ElMessage({
type: "error",
message: res.msg,
});
}
});
});
};
const setDetailInfo = async () => {
let info = Object.assign({}, currTableData.value, currTableData.value.dataConfigure || {});
let newInfo = originValue.value = Object.assign(originValue.value, info);
setFormItems("常规", newInfo);
dialogInfo.value.visible = true;
};
const checkConnect = (val) => {
let params = { guid: currTableData.value.guid };
checkDataSourceConnect(params).then((res: any) => {
if (res.code == proxy.$passCode && res.data && res.data == "1") {
getTableData();
ElMessage({
type: "success",
message: "连通成功",
});
} else {
getTableData();
ElMessage({
type: "error",
message: "连通失败",
});
}
});
};
const loadDialog = async () => {
dialogInfo.value.type = "add";
dialogInfo.value.header.title = "添加数据源";
originValue.value = {};
setFormItems("常规", {});
dialogInfo.value.visible = true;
};
const batching = (type) => {
if (type == "delete") {
if (selectRowData.value.length == 0) {
ElMessage({
type: "error",
message: "请选择需要删除的数据",
});
return;
}
open("此操作将永久删除, 是否继续?", "warning", true);
}
};
const dialogBtnClick = (btn, info) => {
if (btn.value == "submit") {
// dialogInfo.value.footer.btns.map((item: any) => item.disabled = true)
const params = { ...info };
delete params.host;
delete params.port;
delete params.logonUser;
delete params.password;
delete params.feLoadUrl;
delete params.beLoadUrl;
delete params.dorisJdbcUrl;
params.dataConnectionContract = tabActiveName.value;
if (dialogInfo.value.type == "add") {
params.dataConfigureAddDTO = {
host: info.host,
port: info.port,
logonUser: info.logonUser,
password: info.password,
feLoadUrl: info.feLoadUrl,
beLoadUrl: info.beLoadUrl,
dorisJdbcUrl: info.dorisJdbcUrl
};
addDataSource(params)
.then((res: any) => {
if (res.code == proxy.$passCode) {
getFirstPageData();
ElMessage({
type: "success",
message: "添加数据源成功",
});
dialogInfo.value.visible = false;
} else {
ElMessage({
type: "error",
message: res.msg,
});
// dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
}
})
.catch(() => {
// dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
});
} else {
params.dataConfigureUpdateDTO = {
guid: currTableData.value.dataConfigure.guid,
host: info.host,
port: info.port,
logonUser: info.logonUser,
password:
info.password == "******"
? currTableData.value.dataConfigure.password
: info.password,
feLoadUrl: info.feLoadUrl,
beLoadUrl: info.beLoadUrl,
dorisJdbcUrl: info.dorisJdbcUrl
};
params.guid = currTableData.value.guid;
updateDataSource(params)
.then((res: any) => {
if (res.code == proxy.$passCode) {
getTableData();
ElMessage({
type: "success",
message: "修改数据源成功",
});
dialogInfo.value.visible = false;
} else {
ElMessage({
type: "error",
message: res.msg,
});
}
// dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
})
.catch(() => {
// dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
});
}
} else if (btn.value == "connect") {
const params = {
databaseType: info.databaseType,
databaseNameEn: info.databaseNameEn,
host: info.host,
port: info.port,
logonUser: info.logonUser,
password: info.password,
linkage: info.linkage,
};
checkDataSourceConnectTest(params).then((res: any) => {
if (res.code == proxy.$passCode) {
if (res.data && res.data == "1") {
ElMessage({
type: "success",
message: "连通成功",
});
} else {
ElMessage({
type: "error",
message: "连通失败",
});
}
} else {
ElMessage({
type: "error",
message: res.msg,
});
}
});
} else if (btn.value == "cancel") {
// dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
nextTick(() => {
dialogInfo.value.visible = false;
});
}
};
</script>
<template>
<div class="container_wrap">
<div class="table_tool_wrap has_search">
<TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" />
<div class="tools_btns">
<el-button type="primary" @click="loadDialog" v-preReClick>新建</el-button>
<el-button @click="batching('delete')" v-preReClick>批量删除</el-button>
</div>
</div>
<div class="table_panel_wrap">
<Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange"
@tableSelectionChange="tableSelectionChange" />
</div>
<Dialog ref="dialogRef" :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @tableBtnClick="tableBtnClick"
@selectChange="formSelectChange" @tabChange="tabChange" />
</div>
</template>
<style lang="scss" scoped>
.container_wrap {
overflow: hidden auto;
}
.table_tool_wrap {
width: 100%;
height: 84px !important;
padding: 0 8px;
.tools_btns {
padding: 8px 0 0;
}
}
.table_panel_wrap {
width: 100%;
height: calc(100% - 84px);
padding: 8px 8px 0;
}
</style>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!