ca58d6b4 by lihua

数据产品目录

1 parent 9eadeb70
...@@ -4,8 +4,7 @@ VITE_APP_TITLE = 可信数据空间 ...@@ -4,8 +4,7 @@ VITE_APP_TITLE = 可信数据空间
4 # VITE_API_BASEURL = https://www.zgsjzc.com/api 4 # VITE_API_BASEURL = https://www.zgsjzc.com/api
5 # VITE_API_BASEURL = https://swzl-test.csbr.cn/api 5 # VITE_API_BASEURL = https://swzl-test.csbr.cn/api
6 # VITE_API_BASEURL = http://localhost:9000 6 # VITE_API_BASEURL = http://localhost:9000
7 VITE_API_BASEURL = http://192.168.9.1:58052/ 7 VITE_API_BASEURL = http://192.168.6.20:58052/
8 # VITE_API_BASEURL = http://192.168.6.20:8052/
9 8
10 VITE_IDASS_BASEURL = https://daop-test.zgsjzc.com/portalLogin 9 VITE_IDASS_BASEURL = https://daop-test.zgsjzc.com/portalLogin
11 10
......
...@@ -5,6 +5,8 @@ import useUserStore from "@/store/modules/user"; ...@@ -5,6 +5,8 @@ import useUserStore from "@/store/modules/user";
5 import useKeepAliveStore from '@/store/modules/keepAlive' 5 import useKeepAliveStore from '@/store/modules/keepAlive'
6 import { ElMessageBox, ElMessage } from "element-plus"; 6 import { ElMessageBox, ElMessage } from "element-plus";
7 import { isEqual } from "lodash-es"; 7 import { isEqual } from "lodash-es";
8 import useMenuStore from "@/store/modules/menu";
9 import useSettingsStore from '@/store/modules/settings'
8 10
9 const router = useRouter(); 11 const router = useRouter();
10 const route = useRoute(); 12 const route = useRoute();
...@@ -38,6 +40,17 @@ watch( ...@@ -38,6 +40,17 @@ watch(
38 pathIndex = index 40 pathIndex = index
39 return item.path === newRouter.path 41 return item.path === newRouter.path
40 }) 42 })
43 if (!newRouter?.meta.title) {
44 let title: any = '';
45 for (const m of (useMenuStore().allMenus || [])) {
46 let child = m.children?.find(cc => cc.path == newRouter.fullPath);
47 if (child) {
48 title = child.meta?.title;
49 break;
50 }
51 }
52 newRouter.meta.title = title;
53 }
41 if (option) { 54 if (option) {
42 list.splice(pathIndex, 1, newRouter); 55 list.splice(pathIndex, 1, newRouter);
43 } else { 56 } else {
...@@ -45,9 +58,11 @@ watch( ...@@ -45,9 +58,11 @@ watch(
45 } 58 }
46 59
47 } 60 }
61 const settingsStore = useSettingsStore();
62 settingsStore.setTitle(newRouter.meta.title);
48 } 63 }
49 tabbarList.value = list; 64 tabbarList.value = list;
50 tabbarActive.value = isExist[0]?.fullPath || newRouter.fullPath; 65 tabbarActive.value = newRouter.fullPath;
51 userStore.setTabbar(tabbarList.value); 66 userStore.setTabbar(tabbarList.value);
52 userStore.setActiveTabbar(combPath, newRouter.fullPath); 67 userStore.setActiveTabbar(combPath, newRouter.fullPath);
53 }, 68 },
......
...@@ -153,7 +153,12 @@ router.afterEach((to, from) => { ...@@ -153,7 +153,12 @@ router.afterEach((to, from) => {
153 settingsStore.settings.app.enableProgress && (isLoading.value = false) 153 settingsStore.settings.app.enableProgress && (isLoading.value = false)
154 // 设置页面 title 154 // 设置页面 title
155 if (settingsStore.settings.app.routeBaseOn !== 'filesystem') { 155 if (settingsStore.settings.app.routeBaseOn !== 'filesystem') {
156 settingsStore.setTitle(to.meta.title) 156 let title: any = '';
157 if (!to.meta.title) {
158 let child = userStore.tabbar?.find((t: any) => t.fullPath == to.fullPath);
159 title = child?.meta?.title;
160 }
161 settingsStore.setTitle(to.meta.title || title)
157 } 162 }
158 else { 163 else {
159 settingsStore.setTitle(to.meta.title) 164 settingsStore.setTitle(to.meta.title)
......
...@@ -7,7 +7,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -7,7 +7,7 @@ const routes: RouteRecordRaw[] = [
7 path: '/data-asset/register-catalog', 7 path: '/data-asset/register-catalog',
8 component: Layout, 8 component: Layout,
9 meta: { 9 meta: {
10 title: '自有数据产品', 10 title: '数据产品',
11 icon: 'sidebar-videos', 11 icon: 'sidebar-videos',
12 }, 12 },
13 children: [ 13 children: [
...@@ -16,7 +16,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -16,7 +16,7 @@ const routes: RouteRecordRaw[] = [
16 name: 'registerCatalogManagement', 16 name: 'registerCatalogManagement',
17 component: () => import('@/views/data_asset/registerCatalogManagement.vue'), 17 component: () => import('@/views/data_asset/registerCatalogManagement.vue'),
18 meta: { 18 meta: {
19 title: '自有数据产品', 19 title: '',
20 sidebar: false, 20 sidebar: false,
21 breadcrumb: false, 21 breadcrumb: false,
22 cache: true 22 cache: true
...@@ -27,7 +27,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -27,7 +27,7 @@ const routes: RouteRecordRaw[] = [
27 name: 'registerCatalogCreate', 27 name: 'registerCatalogCreate',
28 component: () => import('@/views/data_asset/registerCatalogCreate.vue'), 28 component: () => import('@/views/data_asset/registerCatalogCreate.vue'),
29 meta: { 29 meta: {
30 title: '新建自有数据产品', 30 title: '新建数据产品',
31 sidebar: false, 31 sidebar: false,
32 breadcrumb: false, 32 breadcrumb: false,
33 cache: true, 33 cache: true,
...@@ -149,7 +149,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -149,7 +149,7 @@ const routes: RouteRecordRaw[] = [
149 name: 'authorDataCatalogManagement', 149 name: 'authorDataCatalogManagement',
150 component: () => import('@/views/data_asset/authorDataCatalogManagement.vue'), 150 component: () => import('@/views/data_asset/authorDataCatalogManagement.vue'),
151 meta: { 151 meta: {
152 title: '授权数据产品', 152 title: '',
153 sidebar: false, 153 sidebar: false,
154 breadcrumb: false, 154 breadcrumb: false,
155 cache: true 155 cache: true
......
...@@ -6,6 +6,27 @@ function Layout() { ...@@ -6,6 +6,27 @@ function Layout() {
6 6
7 const routes: RouteRecordRaw[] = [ 7 const routes: RouteRecordRaw[] = [
8 { 8 {
9 path: '/data-asset/data-source',
10 component: Layout,
11 meta: {
12 title: '数据源管理',
13 icon: 'sidebar-videos',
14 },
15 children: [
16 {
17 path: '',
18 name: 'dataSource',
19 component: () => import('@/views/data_service/dataSource.vue'),
20 meta: {
21 title: '',
22 sidebar: false,
23 breadcrumb: false,
24 cache: true
25 },
26 },
27 ],
28 },
29 {
9 path: '/data-service/api-management', 30 path: '/data-service/api-management',
10 component: Layout, 31 component: Layout,
11 meta: { 32 meta: {
...@@ -18,7 +39,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -18,7 +39,7 @@ const routes: RouteRecordRaw[] = [
18 name: 'apiManagement', 39 name: 'apiManagement',
19 component: () => import('@/views/data_service/apiManagement.vue'), 40 component: () => import('@/views/data_service/apiManagement.vue'),
20 meta: { 41 meta: {
21 title: '管理API', 42 title: '',
22 sidebar: false, 43 sidebar: false,
23 breadcrumb: false, 44 breadcrumb: false,
24 cache: true 45 cache: true
...@@ -90,7 +111,7 @@ const routes: RouteRecordRaw[] = [ ...@@ -90,7 +111,7 @@ const routes: RouteRecordRaw[] = [
90 name: 'apiTest', 111 name: 'apiTest',
91 component: () => import('@/views/data_service/apiTest.vue'), 112 component: () => import('@/views/data_service/apiTest.vue'),
92 meta: { 113 meta: {
93 title: '测试API', 114 title: '',
94 sidebar: false, 115 sidebar: false,
95 breadcrumb: false, 116 breadcrumb: false,
96 cache: true 117 cache: true
......
...@@ -659,7 +659,8 @@ defineExpose({ ...@@ -659,7 +659,8 @@ defineExpose({
659 <span v-else>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span> 659 <span v-else>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
660 </template> 660 </template>
661 </el-table-column> 661 </el-table-column>
662 <el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip> 662 <!-- 直接去掉这一列 -->
663 <!-- <el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
663 <template #default="scope"> 664 <template #default="scope">
664 <el-select v-if="scope.row['isEdit'] && !(tableCreateInfo.guid && scope.row['isPrimary'] == 'Y')" 665 <el-select v-if="scope.row['isEdit'] && !(tableCreateInfo.guid && scope.row['isPrimary'] == 'Y')"
665 v-model="scope.row['dictionaryCode']" placeholder="请选择" clearable filterable> 666 v-model="scope.row['dictionaryCode']" placeholder="请选择" clearable filterable>
...@@ -669,7 +670,7 @@ defineExpose({ ...@@ -669,7 +670,7 @@ defineExpose({
669 <span v-else>{{ scope.row['dictionaryCode'] ? (paramsList.find(p => p.value == 670 <span v-else>{{ scope.row['dictionaryCode'] ? (paramsList.find(p => p.value ==
670 scope.row['dictionaryCode'])?.label || "--") : '--' }}</span> 671 scope.row['dictionaryCode'])?.label || "--") : '--' }}</span>
671 </template> 672 </template>
672 </el-table-column> 673 </el-table-column> -->
673 <el-table-column prop="isPrimary" label="是否主键" width="130px" align="left" show-overflow-tooltip> 674 <el-table-column prop="isPrimary" label="是否主键" width="130px" align="left" show-overflow-tooltip>
674 <template #default="scope"> 675 <template #default="scope">
675 <el-select v-if="scope.row['isEdit'] && !tableCreateInfo.guid" v-model="scope.row['isPrimary']" 676 <el-select v-if="scope.row['isEdit'] && !tableCreateInfo.guid" v-model="scope.row['isPrimary']"
......
...@@ -8,11 +8,9 @@ import { useRouter, useRoute } from "vue-router"; ...@@ -8,11 +8,9 @@ import { useRouter, useRoute } from "vue-router";
8 import useUserStore from "@/store/modules/user"; 8 import useUserStore from "@/store/modules/user";
9 import { 9 import {
10 getAreaData, 10 getAreaData,
11 getCurrentUserInfo 11 getParamsList,
12 } from "@/api/modules/queryService"; 12 } from "@/api/modules/queryService";
13 import { 13 import {
14 getParamsList,
15 dataSourcesList,
16 registerCatalogSave, 14 registerCatalogSave,
17 existDamName, 15 existDamName,
18 getRegisterCatalogDetail, 16 getRegisterCatalogDetail,
...@@ -31,6 +29,8 @@ import { useValidator } from '@/hooks/useValidator'; ...@@ -31,6 +29,8 @@ import { useValidator } from '@/hooks/useValidator';
31 import useDataAssetStore from "@/store/modules/dataAsset"; 29 import useDataAssetStore from "@/store/modules/dataAsset";
32 import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common'; 30 import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common';
33 import { ElMessage } from 'element-plus'; 31 import { ElMessage } from 'element-plus';
32 import { TableColumnWidth } from '@/utils/enum';
33 import { CirclePlus } from '@element-plus/icons-vue';
34 34
35 const { proxy } = getCurrentInstance() as any; 35 const { proxy } = getCurrentInstance() as any;
36 const { required, checkExistName } = useValidator(); 36 const { required, checkExistName } = useValidator();
...@@ -50,6 +50,15 @@ const getAreaDataPromise: any = ref({}); ...@@ -50,6 +50,15 @@ const getAreaDataPromise: any = ref({});
50 const getAreaDatas: any = ref({}); 50 const getAreaDatas: any = ref({});
51 const parentAreaData: any = ref([]); 51 const parentAreaData: any = ref([]);
52 52
53 /** 行业分类类型列表 */
54 const industryDictList: any = ref([]);
55 /** 领域字典列表 */
56 const domainDictList: any = ref([]);
57 /** 机构类型字典列表 */
58 const institutionTypeDictList: any = ref([]);
59 /** 更新频率字典列表 */
60 const updateFrequencyDictList: any = ref([]);
61
53 const getArea = (node, resolve) => { 62 const getArea = (node, resolve) => {
54 const { level } = node 63 const { level } = node
55 let params = { 64 let params = {
...@@ -100,6 +109,7 @@ const getArea = (node, resolve) => { ...@@ -100,6 +109,7 @@ const getArea = (node, resolve) => {
100 } 109 }
101 110
102 const baseInfoExpand = ref(true); 111 const baseInfoExpand = ref(true);
112 const expandServiceInfo = ref(true);
103 const assetTableInfoExpand = ref(true); 113 const assetTableInfoExpand = ref(true);
104 const importTableFieldRef = ref(); 114 const importTableFieldRef = ref();
105 const rightMainTenantList: any = ref([]); //权利主体下拉列表选择 115 const rightMainTenantList: any = ref([]); //权利主体下拉列表选择
...@@ -115,6 +125,23 @@ const baseInfoFormItems = ref([ ...@@ -115,6 +125,23 @@ const baseInfoFormItems = ref([
115 default: '', 125 default: '',
116 required: true 126 required: true
117 }, 127 },
128 // {
129 // label: '资源名称',
130 // type: 'select',
131 // placeholder: '请输入',
132 // field: 'damName',
133 // maxlength: 50,
134 // default: '',
135 // required: true,
136 // options: catalogProductList.value,
137 // allowCreate: true,
138 // filterable: true,
139 // props: {
140 // value: 'productId',
141 // label: 'productName'
142 // },
143 // clearable: true,
144 // },
118 { 145 {
119 label: '资源类型', 146 label: '资源类型',
120 type: 'select', 147 type: 'select',
...@@ -157,7 +184,8 @@ const baseInfoFormItems = ref([ ...@@ -157,7 +184,8 @@ const baseInfoFormItems = ref([
157 lazy: false, 184 lazy: false,
158 props: { 185 props: {
159 value: 'value', 186 value: 'value',
160 label: 'label' 187 label: 'label',
188 children: 'childDictList'
161 }, 189 },
162 filterable: true, 190 filterable: true,
163 clearable: true, 191 clearable: true,
...@@ -165,6 +193,82 @@ const baseInfoFormItems = ref([ ...@@ -165,6 +193,82 @@ const baseInfoFormItems = ref([
165 required: true 193 required: true
166 }, 194 },
167 { 195 {
196 label: '行业分类',
197 type: 'select',
198 placeholder: '请选择',
199 field: 'industry',
200 default: '',
201 options: industryDictList.value || [],
202 props: {
203 value: 'value',
204 label: 'label'
205 },
206 required: true,
207 filterable: true,
208 visible: true
209 },
210 {
211 label: '机构分类',
212 type: 'select',
213 placeholder: '请选择',
214 field: 'institutionType',
215 default: '',
216 options: institutionTypeDictList.value || [],
217 props: {
218 value: 'value',
219 label: 'label'
220 },
221 required: true,
222 filterable: true,
223 visible: true
224 },
225 {
226 label: '领域',
227 type: 'select',
228 placeholder: '请选择',
229 field: 'domain',
230 default: '003',
231 options: domainDictList.value,
232 props: {
233 value: 'value',
234 label: 'label',
235 children: 'children'
236 },
237 required: true,
238 filterable: true,
239 visible: true
240 }, {
241 label: '应用场景',
242 type: 'select',
243 placeholder: '请选择',
244 field: 'scenario',
245 default: '',
246 options: [], // 根据所选择领域显示列表
247 props: {
248 value: 'value',
249 label: 'label'
250 },
251 required: true,
252 filterable: true,
253 visible: true
254 },
255 {
256 label: "更新频率",
257 type: "select",
258 placeholder: "请选择",
259 field: "updateFrequency",
260 default: '',
261 props: {
262 value: 'value',
263 label: 'label'
264 },
265 multiple: false,
266 options: updateFrequencyDictList.value,
267 filterable: true,
268 required: true,
269 clearable: true,
270 },
271 {
168 label: '数据覆盖地域', 272 label: '数据覆盖地域',
169 type: 'checkbox-select', 273 type: 'checkbox-select',
170 placeholder: '全国', 274 placeholder: '全国',
...@@ -228,7 +332,7 @@ const baseInfoFormItems = ref([ ...@@ -228,7 +332,7 @@ const baseInfoFormItems = ref([
228 options: route.query.dataSources == '1' ? [{ //如果是授权数据则不能选择其余的 332 options: route.query.dataSources == '1' ? [{ //如果是授权数据则不能选择其余的
229 value: 1, 333 value: 1,
230 label: '授权数据', 334 label: '授权数据',
231 }]: [{ 335 }] : [{
232 value: 2, 336 value: 2,
233 label: '自有数据', 337 label: '自有数据',
234 }, 338 },
...@@ -260,6 +364,38 @@ const baseInfoFormItems = ref([ ...@@ -260,6 +364,38 @@ const baseInfoFormItems = ref([
260 required: true, 364 required: true,
261 }, 365 },
262 { 366 {
367 label: '是否缓存',
368 type: 'radio-group',
369 placeholder: '',
370 field: 'isCache',
371 block: false,
372 default: 'N',
373 options: [{
374 value: 'Y',
375 label: '是'
376 }, {
377 value: 'N',
378 label: '否'
379 }],
380 required: true,
381 },
382 {
383 label: '是否加密存储',
384 type: 'radio-group',
385 placeholder: '',
386 field: 'isEncrypField',
387 block: false,
388 default: 'N',
389 options: [{
390 value: 'Y',
391 label: '是'
392 }, {
393 value: 'N',
394 label: '否'
395 }],
396 required: true,
397 },
398 {
263 label: '资源描述', 399 label: '资源描述',
264 type: 'textarea', 400 type: 'textarea',
265 placeholder: '该数据资源主要包含的信息,数据更新方式等。', 401 placeholder: '该数据资源主要包含的信息,数据更新方式等。',
...@@ -322,6 +458,12 @@ const baseInfoFormRules = ref({ ...@@ -322,6 +458,12 @@ const baseInfoFormRules = ref({
322 rightMain: [required(route.query.dataSources == '1' ? '请选择权利主体' : '请填写权利主体')], 458 rightMain: [required(route.query.dataSources == '1' ? '请选择权利主体' : '请填写权利主体')],
323 dataSources: [required('请选择数据来源')], 459 dataSources: [required('请选择数据来源')],
324 isPublicData: [required('请选择是否公共数据')], 460 isPublicData: [required('请选择是否公共数据')],
461 isCache: [required('请选择是否缓存')],
462 industry: [required('请选择行业分类')],
463 institutionType: [required('请选择机构分类')],
464 domain: [required('请选择领域')],
465 scenario: [required('请选择应用场景')],
466 updateFrequency: [required('请选择更新频率')]
325 }); 467 });
326 468
327 const getTableFieldPromise: any = ref({}); 469 const getTableFieldPromise: any = ref({});
...@@ -482,6 +624,9 @@ const setFormItems = (val) => { ...@@ -482,6 +624,9 @@ const setFormItems = (val) => {
482 if (item.children?.length) { 624 if (item.children?.length) {
483 item.children[0].default = val[item.children[0].field] || []; 625 item.children[0].default = val[item.children[0].field] || [];
484 } 626 }
627 if (item.field == 'scenario') {
628 item.options = domainDictList.value.find(s => s.value == val['domain'])?.childDictList || []
629 }
485 }); 630 });
486 } 631 }
487 632
...@@ -496,6 +641,9 @@ const baseSelectChange = (val, item, row) => { ...@@ -496,6 +641,9 @@ const baseSelectChange = (val, item, row) => {
496 setFormItems(row); 641 setFormItems(row);
497 } 642 }
498 } 643 }
644 } else if (item.field == 'domain') {
645 row.scenario = ''; //清空下应用场景
646 setFormItems(row);
499 } 647 }
500 } 648 }
501 649
...@@ -506,6 +654,86 @@ const handleBaseInfoCheckboxChange = (val, info) => { ...@@ -506,6 +654,86 @@ const handleBaseInfoCheckboxChange = (val, info) => {
506 setFormItems(info); 654 setFormItems(info);
507 } 655 }
508 656
657 /** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */
658 const productTableRef = ref();
659 const productData: any = ref([]);
660
661 const apiList: any = ref([]);
662
663 /** 基本信息的入参定义表格配置 */
664 const productTableInfo = ref({
665 id: "input-product-table",
666 height: '214px',
667 fields: [
668 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
669 { label: "服务名称", field: "apiGuid", width: 180, required: true, columClass: 'edit-colum', type: 'edit' },
670 { label: "API类型", field: "apiType", width: 100 },
671 { label: "API地址", field: "requestUrl", width: 240 },
672 { label: "描述", field: "apiDescription", width: 240 },
673 ],
674 editInfo: {
675 apiGuid: {
676 label: '',
677 type: 'select',
678 field: 'apiGuid',
679 default: '',
680 options: apiList.value,
681 props: {
682 label: 'apiName',
683 value: 'guid',
684 disabled: 'disabled'
685 },
686 placeholder: '请选择',
687 clearable: false,
688 filterable: true
689 },
690 },
691 STATUS: 'edit',
692 data: productData.value,
693 showPage: false,
694 actionInfo: {
695 show: true,
696 label: "操作",
697 type: "btn",
698 width: 60,
699 fixed: 'right',
700 btns: [
701 {
702 label: "删除", value: "remove", click: (scope) => {
703 let index = scope.$index;
704 proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => {
705 productData.value.splice(index, 1);
706 productTableInfo.value.data = productData.value;
707 proxy.$ElMessage.success('服务包删除成功');
708 }, () => {
709 proxy.$ElMessage.info("已取消");
710 });
711 }
712 },
713 ]
714 },
715 loading: false
716 });
717
718 /** 给表格添加一行入参定义。 */
719 const addProduct = () => {
720 productData.value.push({ apiGuid: '' });
721 productTableInfo.value.data = productData.value;
722 nextTick(() => {
723 scrollLastRowToView(productTableRef.value?.tableRef, productData.value.length);
724 })
725 }
726
727 /** 根据下拉选择的产品带出产品相关信息 */
728 const hanldeTableSelectChange = (val, scope, item) => {
729 let productItem = val && apiList.value.find(p => p.guid == val);
730 scope.row.guid = val;
731 scope.row.apiName = productItem?.apiName;
732 scope.row.apiType = productItem?.apiType;
733 scope.row.requestUrl = productItem?.requestUrl;
734 scope.row.apiDescription = productItem?.apiDescription;
735 }
736
509 const handleCreateTable = () => { 737 const handleCreateTable = () => {
510 if (assetDataTableInfo.value.data.length >= 15) { 738 if (assetDataTableInfo.value.data.length >= 15) {
511 proxy.$ElMessage.error('最多允许添加15张资源表'); 739 proxy.$ElMessage.error('最多允许添加15张资源表');
...@@ -598,6 +826,8 @@ onBeforeMount(() => { ...@@ -598,6 +826,8 @@ onBeforeMount(() => {
598 } 826 }
599 } else if (item.field == 'rightMain') { 827 } else if (item.field == 'rightMain') {
600 item.default = route.query.dataSources == '1' ? detailInfo.value.rightMain : detailInfo.value.rightMainName; 828 item.default = route.query.dataSources == '1' ? detailInfo.value.rightMain : detailInfo.value.rightMainName;
829 } else if (item.field == 'scenario') {
830 item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || []
601 } 831 }
602 }); 832 });
603 if (route.query.guid && route.query.foundMode == '2') { 833 if (route.query.guid && route.query.foundMode == '2') {
...@@ -642,18 +872,22 @@ onBeforeMount(() => { ...@@ -642,18 +872,22 @@ onBeforeMount(() => {
642 }) 872 })
643 } 873 }
644 874
645 function replaceChildDictListKey(data) { 875 // getRegisterCatalogProductList().then((res: any) => {
646 if (Array.isArray(data)) { 876 // catalogProductList.value = [];
647 return data.map(item => replaceChildDictListKey(item)); 877 // if (res.code == proxy.$passCode) {
648 } else if (data && typeof data === 'object') { 878 // catalogProductList.value = res.data || [];
649 const { childDictList, ...rest } = data; 879 // baseInfoFormItems.value[0].options = catalogProductList.value;
650 return { 880 // if (detailInfo.value?.productCode) {
651 ...rest, 881 // let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
652 children: childDictList ? replaceChildDictListKey(childDictList) : undefined, 882 // if (!item) {
653 }; 883 // baseInfoFormItems.value[0].default = detailInfo.value.damName;
654 } 884 // }
655 return data; 885 // }
656 } 886 // } else {
887 // proxy.$ElMessage.error(res.msg);
888 // }
889 // })
890
657 getParamsList({ 891 getParamsList({
658 dictType: "资产类型", 892 dictType: "资产类型",
659 }).then((res: any) => { 893 }).then((res: any) => {
...@@ -669,13 +903,62 @@ onBeforeMount(() => { ...@@ -669,13 +903,62 @@ onBeforeMount(() => {
669 dictType: "数据资产目录主题名称", 903 dictType: "数据资产目录主题名称",
670 }).then((res: any) => { 904 }).then((res: any) => {
671 if (res.code == proxy.$passCode) { 905 if (res.code == proxy.$passCode) {
672 subjectDomainListData.value = replaceChildDictListKey(res.data) || []; 906 subjectDomainListData.value = res.data || [];
673 let item = baseInfoFormItems.value.find(item => item.field == 'subjectDomain'); 907 let item = baseInfoFormItems.value.find(item => item.field == 'subjectDomain');
674 item && (item.options = subjectDomainListData.value); 908 item && (item.options = subjectDomainListData.value);
675 } else { 909 } else {
676 proxy.$ElMessage.error(res.msg); 910 proxy.$ElMessage.error(res.msg);
677 } 911 }
678 }) 912 })
913
914 getParamsList({
915 dictType: "行业分类",
916 }).then((res: any) => {
917 if (res.code == proxy.$passCode) {
918 industryDictList.value = res.data || [];
919 let item = baseInfoFormItems.value.find(item => item.field == 'industry');
920 item && (item.options = industryDictList.value);
921 } else {
922 proxy.$ElMessage.error(res.msg);
923 }
924 })
925
926 getParamsList({ dictType: '领域' }).then((res: any) => {
927 if (res.code == proxy.$passCode) {
928 domainDictList.value = res.data || [];
929 let itemIndex = baseInfoFormItems.value.findIndex(item => item.field == 'domain');
930 let item = baseInfoFormItems.value[itemIndex];
931 item && (item.options = domainDictList.value);
932 let item1 = baseInfoFormItems.value[itemIndex + 1];
933 item1 && item.default && (item1.options = domainDictList.value.find(s => s.value == item.default)?.childDictList || []);
934 } else {
935 proxy.$ElMessage.error(res.msg);
936 }
937 });
938
939 getParamsList({
940 dictType: "组织机构性质",
941 }).then((res: any) => {
942 if (res.code == proxy.$passCode) {
943 institutionTypeDictList.value = res.data || [];
944 let item = baseInfoFormItems.value.find(item => item.field == 'institutionType');
945 item && (item.options = institutionTypeDictList.value);
946 } else {
947 proxy.$ElMessage.error(res.msg);
948 }
949 })
950
951 getParamsList({
952 dictType: "更新周期",
953 }).then((res: any) => {
954 if (res.code == proxy.$passCode) {
955 updateFrequencyDictList.value = res.data || [];
956 let item = baseInfoFormItems.value.find(item => item.field == 'updateFrequency');
957 item && (item.options = updateFrequencyDictList.value);
958 } else {
959 proxy.$ElMessage.error(res.msg);
960 }
961 })
679 }); 962 });
680 963
681 const cancel = () => { 964 const cancel = () => {
...@@ -693,15 +976,25 @@ const save = () => { ...@@ -693,15 +976,25 @@ const save = () => {
693 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => { 976 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
694 if (valid) { 977 if (valid) {
695 let params = { ...baseInfoFormRef.value.formInline }; 978 let params = { ...baseInfoFormRef.value.formInline };
979 let associationApiList: string[] = [];
980 for (const api of productData.value) {
981 if (!api.apiGuid) {
982 proxy.$ElMessage.error('服务包信息未填写完整');
983 expandServiceInfo.value = true;
984 return;
985 }
986 associationApiList.push(api.apiGuid);
987 }
988 params.associationApi = associationApiList;
696 /** 只有数据集和api类型时,目录表必填。 */ 989 /** 只有数据集和api类型时,目录表必填。 */
697 if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') { 990 if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') {
698 if (!params.databaseType) { 991 if (!params.databaseType) {
699 proxy.$ElMessage.error('资源类型为数据集或API时,数据库类型必填'); 992 proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
700 baseInfoExpand.value = true; 993 baseInfoExpand.value = true;
701 return; 994 return;
702 } 995 }
703 if (!assetDataTableInfo.value.data) { 996 if (!assetDataTableInfo.value.data) {
704 proxy.$ElMessage.error('资源类型为数据集或API时,必需添加资源表'); 997 proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表');
705 assetTableInfoExpand.value = true; 998 assetTableInfoExpand.value = true;
706 nextTick(() => { 999 nextTick(() => {
707 setTimeout(() => { 1000 setTimeout(() => {
...@@ -885,6 +1178,14 @@ const handleImportSave = (val) => { ...@@ -885,6 +1178,14 @@ const handleImportSave = (val) => {
885 <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" 1178 <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules"
886 @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> 1179 @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" />
887 </ContentWrap> 1180 </ContentWrap>
1181 <ContentWrap id="product-info" title="服务包信息" expandSwicth style="margin-top: 15px" :isExpand="expandServiceInfo"
1182 @expand="(v) => (expandServiceInfo = v)" description="" class="mb16">
1183 <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table"
1184 @table-select-change="hanldeTableSelectChange" />
1185 <div class="row-add-btn">
1186 <el-button link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button>
1187 </div>
1188 </ContentWrap>
888 <ContentWrap id="id-tableInfo" title="资源表" description="" :expand-swicth="true" :isExpand="assetTableInfoExpand" 1189 <ContentWrap id="id-tableInfo" title="资源表" description="" :expand-swicth="true" :isExpand="assetTableInfoExpand"
889 @expand="(v) => assetTableInfoExpand = v"> 1190 @expand="(v) => assetTableInfoExpand = v">
890 <div v-show="assetDataTableInfo.data.length" class="tools_btns"> 1191 <div v-show="assetDataTableInfo.data.length" class="tools_btns">
......
...@@ -191,6 +191,8 @@ const getDetailInfo = () => { ...@@ -191,6 +191,8 @@ const getDetailInfo = () => {
191 const data = res.data || {}; 191 const data = res.data || {};
192 detailInfo.value = data; 192 detailInfo.value = data;
193 publicDataProductsMainRSVO.value = detailInfo.value.publicDataProductsMainRSVO || {}; 193 publicDataProductsMainRSVO.value = detailInfo.value.publicDataProductsMainRSVO || {};
194 //TODO. 返回服务包信息
195 productTableInfo.value.data = detailInfo.value.associationApiVO || [];
194 // detailInfo.value.damTypeName = damTypes.find(d => d.value == detailInfo.value.damType)?.label; 196 // detailInfo.value.damTypeName = damTypes.find(d => d.value == detailInfo.value.damType)?.label;
195 detailInfo.value.dataSourcesName = dataSourcesList.find(d => d.value == detailInfo.value.dataSources)?.label; 197 detailInfo.value.dataSourcesName = dataSourcesList.find(d => d.value == detailInfo.value.dataSources)?.label;
196 if (!isJSZQ.value) { 198 if (!isJSZQ.value) {
...@@ -319,6 +321,25 @@ const getDetailInfo = () => { ...@@ -319,6 +321,25 @@ const getDetailInfo = () => {
319 }) 321 })
320 } 322 }
321 323
324 /** ----------------- 数据包信息 --------------------- */
325 const productTableInfo = ref({
326 id: "input-product-table",
327 height: '214px',
328 fields: [
329 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
330 { label: "服务名称", field: "apiGuid", width: 180 },
331 { label: "API类型", field: "apiType", width: 100 },
332 { label: "API地址", field: "requestUrl", width: 240 },
333 { label: "描述", field: "apiDescription", width: 240 },
334 ],
335 data: [],
336 showPage: false,
337 actionInfo: {
338 show: false
339 },
340 loading: false
341 });
342
322 onBeforeMount(() => { 343 onBeforeMount(() => {
323 if (!assetStore.isRefreshDamCatalog) { 344 if (!assetStore.isRefreshDamCatalog) {
324 getDetailInfo(); 345 getDetailInfo();
...@@ -356,11 +377,12 @@ const isTextTruncated = () => { ...@@ -356,11 +377,12 @@ const isTextTruncated = () => {
356 isTruncated.value = false; 377 isTruncated.value = false;
357 isExpanded.value = false; 378 isExpanded.value = false;
358 nextTick(() => { 379 nextTick(() => {
359 let domDesc = document.getElementsByClassName('right-main')?.[0]; 380 let dom = document.getElementsByClassName('right-main')?.[0];
381 let domDesc = dom?.children?.length && dom?.children?.[dom.children.length - 1];
360 if (!domDesc) { 382 if (!domDesc) {
361 return; 383 return;
362 } 384 }
363 if (domDesc.clientHeight > 82) { 385 if (domDesc.clientHeight > 21) {
364 isTruncated.value = true; 386 isTruncated.value = true;
365 } else { 387 } else {
366 isTruncated.value = false; 388 isTruncated.value = false;
...@@ -1195,8 +1217,23 @@ const respParamsTableInfo = ref({ ...@@ -1195,8 +1217,23 @@ const respParamsTableInfo = ref({
1195 detailInfo.subjectDomain }}</div> 1217 detailInfo.subjectDomain }}</div>
1196 <div class="dataLabel dataLabel1" v-if="detailInfo.databaseType">{{ detailInfo.databaseType }}</div> 1218 <div class="dataLabel dataLabel1" v-if="detailInfo.databaseType">{{ detailInfo.databaseType }}</div>
1197 <div class="dataLabel dataLabel1">{{ detailInfo.dataSourcesName }}</div> 1219 <div class="dataLabel dataLabel1">{{ detailInfo.dataSourcesName }}</div>
1220 <div class="dataLabel dataLabel1" v-if="detailInfo.updateFrequency">{{ detailInfo.updateFrequencyName }}</div>
1221 </div>
1222 </div>
1223 <template v-if="detailInfo?.foundMode == 1">
1224 <div class="row-extra-desc">
1225 <div class="per-extra-desc">{{ '行业分类:' + (detailInfo.industryName || '--') }}</div>
1226 <div>{{ '机构分类:' + (detailInfo.institutionTypeName || '--') }}</div>
1227 </div>
1228 <div class="row-extra-desc">
1229 <div class="per-extra-desc">{{ '领域:' + (detailInfo.domainName || '--') }}</div>
1230 <div>{{ '应用场景:' + (detailInfo.scenarioName || '--') }}</div>
1198 </div> 1231 </div>
1232 <div class="row-extra-desc">
1233 <div class="per-extra-desc">{{ '是否缓存:' + (detailInfo.isCache == 'Y' ? '是' : '否') }}</div>
1234 <div>{{ '是否加密存储:' + (detailInfo.scenario == 'Y' ? '是' : '否') }}</div>
1199 </div> 1235 </div>
1236 </template>
1200 <div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }} 1237 <div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }}
1201 </div> 1238 </div>
1202 <div class="applicationScenarios" 1239 <div class="applicationScenarios"
...@@ -1285,7 +1322,7 @@ const respParamsTableInfo = ref({ ...@@ -1285,7 +1322,7 @@ const respParamsTableInfo = ref({
1285 </div> 1322 </div>
1286 <div class="list_item is_block"> 1323 <div class="list_item is_block">
1287 <span class="item_label">产品关键词:</span> 1324 <span class="item_label">产品关键词:</span>
1288 <span class="item_value">{{ publicDataProductsMainRSVO.productKeywords?.join(',') || '--' }}</span> 1325 <span class="item_value">{{ publicDataProductsMainRSVO?.productKeywords?.join(',') || '--' }}</span>
1289 </div> 1326 </div>
1290 <div class="list_item is_block"> 1327 <div class="list_item is_block">
1291 <span class="item_label">产品描述:</span> 1328 <span class="item_label">产品描述:</span>
...@@ -1293,6 +1330,9 @@ const respParamsTableInfo = ref({ ...@@ -1293,6 +1330,9 @@ const respParamsTableInfo = ref({
1293 </div> 1330 </div>
1294 </div> 1331 </div>
1295 </ContentWrap> 1332 </ContentWrap>
1333 <ContentWrap v-if="productTableInfo.data?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px">
1334 <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" />
1335 </ContentWrap>
1296 <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px"> 1336 <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px">
1297 <el-tabs v-model="activeTabName" class="param-tabs"> 1337 <el-tabs v-model="activeTabName" class="param-tabs">
1298 <el-tab-pane label="入参信息" name="reqParamList"> 1338 <el-tab-pane label="入参信息" name="reqParamList">
...@@ -1340,7 +1380,7 @@ const respParamsTableInfo = ref({ ...@@ -1340,7 +1380,7 @@ const respParamsTableInfo = ref({
1340 <span>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span> 1380 <span>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
1341 </template> 1381 </template>
1342 </el-table-column> 1382 </el-table-column>
1343 <el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip> 1383 <el-table-column v-if="detailInfo.foundMode != 1" prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
1344 <template #default="scope"> 1384 <template #default="scope">
1345 <span>{{ scope.row["dictionaryName"] || '--' }}</span> 1385 <span>{{ scope.row["dictionaryName"] || '--' }}</span>
1346 </template> 1386 </template>
...@@ -1838,7 +1878,7 @@ const respParamsTableInfo = ref({ ...@@ -1838,7 +1878,7 @@ const respParamsTableInfo = ref({
1838 letter-spacing: 0; 1878 letter-spacing: 0;
1839 line-height: 30px; 1879 line-height: 30px;
1840 font-weight: 600; 1880 font-weight: 600;
1841 max-width: calc(100% - 250px); 1881 max-width: calc(100% - 320px);
1842 } 1882 }
1843 1883
1844 .dataLabel { 1884 .dataLabel {
...@@ -1877,9 +1917,24 @@ const respParamsTableInfo = ref({ ...@@ -1877,9 +1917,24 @@ const respParamsTableInfo = ref({
1877 .expand_btn { 1917 .expand_btn {
1878 position: absolute; 1918 position: absolute;
1879 right: 0px; 1919 right: 0px;
1880 top: 58px; 1920 bottom: 0px;
1921 font-size: 14px;
1922 line-height: 21px;
1923 }
1924
1925 .row-extra-desc {
1926 width: 100%;
1927 display: flex;
1928 margin-top: 4px;
1881 font-size: 14px; 1929 font-size: 14px;
1930 color: #666666;
1931 letter-spacing: 0;
1882 line-height: 21px; 1932 line-height: 21px;
1933 font-weight: 400;
1934
1935 .per-extra-desc {
1936 width: 400px;
1937 }
1883 } 1938 }
1884 } 1939 }
1885 } 1940 }
......
...@@ -5,9 +5,7 @@ name: registerCatalogManagement ...@@ -5,9 +5,7 @@ name: registerCatalogManagement
5 <script lang="ts" setup name="registerCatalogManagement"> 5 <script lang="ts" setup name="registerCatalogManagement">
6 import { ref } from "vue"; 6 import { ref } from "vue";
7 import TableTools from "@/components/Tools/table_tools.vue"; 7 import TableTools from "@/components/Tools/table_tools.vue";
8 import { ElMessageBox } from "element-plus";
9 import { useRouter, useRoute } from "vue-router"; 8 import { useRouter, useRoute } from "vue-router";
10 import { MoreFilled } from "@element-plus/icons-vue";
11 import { 9 import {
12 getParamsList, 10 getParamsList,
13 getDamCatalogTable, 11 getDamCatalogTable,
...@@ -49,7 +47,7 @@ const damTypesOptions = ref<any>([ ...@@ -49,7 +47,7 @@ const damTypesOptions = ref<any>([
49 { label: "加工交付", value: 2 }, 47 { label: "加工交付", value: 2 },
50 { label: "深圳专区", value: 3 }, 48 { label: "深圳专区", value: 3 },
51 { label: "江苏专区", value: 4 }, 49 { label: "江苏专区", value: 4 },
52 { label: "可信数据空间", value: 5 }, 50 // { label: "数据港", value: 5 },
53 ]) 51 ])
54 const searchItemList = ref([ 52 const searchItemList = ref([
55 { 53 {
...@@ -110,20 +108,20 @@ const searchItemList = ref([ ...@@ -110,20 +108,20 @@ const searchItemList = ref([
110 label: 'label' 108 label: 'label'
111 } 109 }
112 }, 110 },
113 { 111 // {
114 type: "select", 112 // type: "select",
115 label: "", 113 // label: "",
116 field: "isRegister", 114 // field: "isRegister",
117 default: "", 115 // default: "",
118 placeholder: "登记状态", 116 // placeholder: "登记状态",
119 clearable: true, 117 // clearable: true,
120 filterable: true, 118 // filterable: true,
121 options: isRegisterOptions.value, 119 // options: isRegisterOptions.value,
122 props: { 120 // props: {
123 value: 'value', 121 // value: 'value',
124 label: 'label' 122 // label: 'label'
125 } 123 // }
126 }, 124 // },
127 ]); 125 ]);
128 126
129 const pageInfo = ref({ 127 const pageInfo = ref({
......
...@@ -259,6 +259,14 @@ const apiManageTableBtnMap = { ...@@ -259,6 +259,14 @@ const apiManageTableBtnMap = {
259 /** 详情 */ 259 /** 详情 */
260 DETAIL: (scope) => { 260 DETAIL: (scope) => {
261 let row = scope.row; 261 let row = scope.row;
262 const approveVO = row.approveVO || {};
263 if (!approveVO && row.isApprove == 'N') {
264 router.push({
265 name: 'apiDetail',
266 query: { guid: row.guid, type: 'detail' }
267 });
268 return;
269 }
262 if (!row.approveGuid) { 270 if (!row.approveGuid) {
263 proxy.$ElMessage.error(`【${row.apiName}】关联流程已删除!`); 271 proxy.$ElMessage.error(`【${row.apiName}】关联流程已删除!`);
264 return; 272 return;
......
1 <route lang="yaml">
2 name: dataSource
3 </route>
4
5 <script lang="ts" setup name="dataSource">
6 import { ref, onMounted } from "vue";
7 import { ElMessage, ElMessageBox } from "element-plus";
8 import TableTools from "@/components/Tools/table_tools.vue";
9
10 import {
11 addDataSource,
12 getDataSourceList,
13 deleteDataSource,
14 updateDataSource,
15 getDataSourceDetail,
16 checkDataSourceConnect,
17 checkDataSourceConnectTest,
18 getAllFlowData
19 } from "@/api/modules/queryService";
20
21 const { proxy } = getCurrentInstance() as any;
22
23 const searchItemList = ref([
24 {
25 type: "select",
26 label: "",
27 field: "systemLayer",
28 default: "",
29 placeholder: "系统分层",
30 options: [
31 { label: "业务系统", value: "业务系统" },
32 { label: "数据中心", value: "数据中心" },
33 ],
34 clearable: true,
35 },
36 {
37 type: "select",
38 label: "",
39 field: "databaseType",
40 default: "",
41 placeholder: "库类型",
42 options: [
43 { label: "mysql", value: "mysql" },
44 { label: "doris", value: "doris" },
45 { label: "oracle", value: "oracle" },
46 ],
47 clearable: true,
48 },
49 {
50 type: "select",
51 label: "",
52 field: "connectStatus",
53 default: "",
54 placeholder: "连通状态",
55 options: [
56 { label: "已连通", value: "1" },
57 { label: "连通失败", value: "2" },
58 ],
59 clearable: true,
60 },
61 {
62 type: "input",
63 label: "",
64 field: "databaseNameZh",
65 default: "",
66 placeholder: "数据源名称",
67 clearable: true,
68 },
69 {
70 type: "input",
71 label: "",
72 field: "databaseNameEn",
73 default: "",
74 placeholder: "数据库名",
75 clearable: true,
76 },
77 ]);
78
79 const currTableData: any = ref<Object>({});
80 const page = ref({
81 limit: 50,
82 curr: 1,
83 sizes: [
84 { label: "10", value: 10 },
85 { label: "50", value: 50 },
86 { label: "100", value: 100 },
87 { label: "150", value: 150 },
88 { label: "200", value: 200 },
89 ],
90 systemLayer: '',
91 databaseType: '',
92 connectStatus: '',
93 databaseNameZh: '',
94 databaseNameEn: ''
95 });
96 const selectRowData = ref([]);
97 const tableInfo = ref({
98 id: "data-source-table",
99 multiple: true,
100 fields: [
101 { label: "序号", type: "index", width: 56, align: "center" },
102 { label: "数据源名称", field: "databaseNameZh", width: 120 },
103 { label: "系统分层", field: "systemLayer", width: 96 },
104 { label: "库类型", field: "databaseType", width: 96 },
105 { label: "数据库名", field: "databaseNameEn", width: 200 },
106 {
107 label: "连通状态",
108 field: "connectStatus",
109 type: "tag",
110 width: 96,
111 align: "center",
112 },
113 { label: "连通时间", field: "lastCheckTime", width: 172 },
114 { label: "操作人", field: "updateUserName", width: 140 },
115 { label: "更新时间", field: "updateTime", width: 172 },
116 ],
117 data: [],
118 page: {
119 type: "normal",
120 rows: 0,
121 ...page.value,
122 },
123 actionInfo: {
124 label: "操作",
125 type: "btn",
126 width: 160,
127 btns: [
128 { label: "编辑", value: "edit" },
129 { label: "连通测试", value: "test" },
130 { label: "删除", value: "delete" },
131 ],
132 },
133 loading: false,
134 });
135
136 const tabActiveName = ref("1");
137 const tabsInfo: any = ref({
138 type: "tabs",
139 title: "",
140 style: {
141 padding: "0 24px",
142 },
143 tabsInfo: {
144 activeName: "",
145 tabs: [
146 { label: "常规", name: "常规" },
147 // { label: "SSL", name: "SSL" }, //未支持,先隐藏掉
148 // { label: "SSH", name: "SSH" },
149 // { label: "HTTP", name: "HTTP" },
150 ],
151 },
152 });
153 const formItems: any = ref([]);
154 const formRules: any = ref({});
155 const flowList: any = ref([])
156 const formInfo: any = ref({
157 type: "form",
158 title: "",
159 style: {
160 padding: "0 24px",
161 overflow: 'hidden auto'
162 },
163 formInfo: {
164 id: "add-source-form",
165 items: formItems.value,
166 rules: formRules.value,
167 },
168 });
169 const contents: any = ref({
170 normal: {
171 items: [
172 {
173 label: "数据源名称",
174 type: "input",
175 placeholder: "请输入",
176 field: "databaseNameZh",
177 default: "",
178 clearable: true,
179 required: true,
180 },
181 {
182 label: "系统分层",
183 type: "select",
184 placeholder: "请选择",
185 field: "systemLayer",
186 default: "",
187 options: [
188 {
189 label: "业务系统",
190 value: "业务系统",
191 },
192 {
193 label: "数据中心",
194 value: "数据中心",
195 },
196 ],
197 clearable: true,
198 required: true,
199 },
200 {
201 label: "库类型",
202 type: "select",
203 placeholder: "请选择",
204 field: "databaseType",
205 default: "",
206 options: [
207 { label: "mysql", value: "mysql" },
208 { label: "doris", value: "doris" },
209 { label: "oracle", value: "oracle" },
210 ],
211 clearable: true,
212 required: true,
213 },
214 {
215 label: "业务系统",
216 type: "select",
217 placeholder: "请选择",
218 field: "bizSystem",
219 default: "",
220 options: [],
221 clearable: true,
222 required: true,
223 },
224 {
225 label: "集群信息",
226 type: "textarea-group",
227 placeholder: "请输入",
228 field: "jqxx",
229 default: "",
230 tooltipContent:
231 "格式:doris-fe-zs.doris:8030,doris-fe-zs.doris:8090 多个地址用英文半角逗号分隔",
232 children: [
233 {
234 label: "feLoadUrl",
235 type: "textarea",
236 placeholder: "请输入",
237 field: "feLoadUrl",
238 default: "",
239 clearable: true,
240 required: true,
241 block: true,
242 },
243 {
244 label: "beLoadUrl",
245 type: "textarea",
246 placeholder: "请输入",
247 field: "beLoadUrl",
248 default: "",
249 clearable: true,
250 required: true,
251 block: true,
252 },
253 {
254 label: "dorisJdbcUrl",
255 type: "textarea",
256 placeholder: "请输入",
257 field: "dorisJdbcUrl",
258 default: "",
259 clearable: true,
260 required: true,
261 block: true,
262 },
263 ],
264 block: true,
265 visible: false,
266 },
267 {
268 label: "服务器",
269 type: "input",
270 placeholder: "请输入",
271 field: "host",
272 default: "",
273 clearable: true,
274 required: true,
275 },
276 {
277 label: "端口",
278 type: "input",
279 placeholder: "请输入",
280 field: "port",
281 default: "",
282 clearable: true,
283 required: true,
284 },
285 {
286 label: "用户名",
287 type: "input",
288 placeholder: "请输入",
289 field: "logonUser",
290 default: "",
291 clearable: true,
292 required: true,
293 autocompleteSetting: {
294 autocomplete: "off",
295 readonly: true,
296 },
297 },
298 {
299 label: "密码",
300 type: "password",
301 placeholder: "请输入",
302 field: "password",
303 default: "",
304 clearable: true,
305 required: true,
306 autocompleteSetting: {
307 autocomplete: "off",
308 readonly: true,
309 },
310 },
311 {
312 label: "数据库名",
313 type: "input",
314 placeholder: "请输入",
315 field: "databaseNameEn",
316 default: "",
317 clearable: true,
318 required: true,
319 },
320 {
321 label: "连接属性",
322 type: "textarea-tips",
323 placeholder: "请输入",
324 field: "linkage",
325 default: "",
326 tips: {
327 type: "table",
328 size: 400,
329 placement: "right",
330 offset: 12,
331 tableInfo: {
332 id: "",
333 fields: [
334 { label: "数据库", field: "jsmc", width: 120 },
335 { label: "连接属性", field: "sx", width: 200 },
336 ],
337 data: [
338 {
339 jsmc: "MYSQL8.0",
340 sx: "列出支持的连接属性,并给出解释和范例,多个属性用;分割",
341 cjsj: "2022-12-12 08:12:12",
342 },
343 {
344 jsmc: "MYSQL8.0",
345 sx: "服务器的时区:serverTimezone=Asia/Shanghai;",
346 cjsj: "2022-12-12 08:12:12",
347 },
348 {
349 jsmc: "MYSQL8.0",
350 sx: "useUnicode=utf8;",
351 cjsj: "2022-12-12 08:12:12",
352 },
353 {
354 jsmc: "MYSQL8.0",
355 sx: "characterEncoding=utf8;",
356 cjsj: "2022-12-12 08:12:12",
357 },
358 {
359 jsmc: "MYSQL8.0",
360 sx: "useSSL=false",
361 cjsj: "2022-12-12 08:12:12",
362 },
363 ],
364 showPage: false,
365 tableTool: [],
366 actionInfo: {
367 show: false,
368 },
369 btn: {
370 label: "",
371 value: "QuestionFilled",
372 },
373 },
374 },
375 clearable: true,
376 required: false,
377 block: true,
378 },
379 ],
380 rules: {
381 databaseNameZh: [
382 {
383 validator: (rule: any, value: any, callback: any) => {
384 if (value === "") {
385 callback(new Error("请填写数据源名称"));
386 } else {
387 if (
388 dialogInfo.value.type == "edit" &&
389 value == currTableData.value.databaseNameZh
390 ) {
391 callback();
392 return;
393 }
394 callback();
395 // let params: any = {
396 // dataPermissionName: value,
397 // };
398 // if (dialogInfo.value.type == 'edit') {
399 // params.guid = currTableData.value.guid
400 // }
401 // checkPermissionDict(params)
402 // .then((res: any) => {
403 // if (res.code == proxy.$passCode) {
404 // if (res.data) {
405 // callback(new Error("该名称已存在,请填写其他名称"));
406 // } else {
407 // callback();
408 // }
409 // } else {
410 // callback(new Error(res.msg));
411 // }
412 // })
413 // .catch((xhr) => {
414 // callback(new Error(xhr.msg));
415 // });
416 }
417 },
418 trigger: "blur",
419 },
420 ],
421 bizSystem: [{
422 required: true,
423 message: "请选择业务系统",
424 trigger: "change",
425 }],
426 systemLayer: [
427 {
428 required: true,
429 message: "请选择系统分层",
430 trigger: "change",
431 },
432 ],
433 databaseType: [
434 {
435 required: true,
436 message: "请选择库类型",
437 trigger: "change",
438 },
439 ],
440 host: [
441 {
442 required: true,
443 message: "请填写服务器ip地址",
444 trigger: "blur",
445 },
446 ],
447 port: [
448 {
449 required: true,
450 message: "请填写端口号",
451 trigger: "blur",
452 },
453 ],
454 logonUser: [
455 {
456 required: true,
457 message: "请填写用户名",
458 trigger: "blur",
459 },
460 ],
461 password: [
462 {
463 required: true,
464 message: "请填写密码",
465 trigger: "blur",
466 },
467 ],
468 databaseNameEn: [
469 {
470 required: true,
471 message: "请填写数据库名",
472 trigger: "blur",
473 },
474 ],
475 feLoadUrl: [
476 {
477 validator: (rule: any, value: any, callback: any) => {
478 if (value === "") {
479 callback(new Error("请填写feLoadUrl"));
480 } else {
481 if (
482 dialogInfo.value.type == "edit" &&
483 value == currTableData.value.feLoadUrl
484 ) {
485 callback();
486 return;
487 }
488 callback();
489 }
490 },
491 trigger: "blur",
492 },
493 ],
494 beLoadUrl: [
495 {
496 validator: (rule: any, value: any, callback: any) => {
497 if (value === "") {
498 callback(new Error("请填写beLoadUrl"));
499 } else {
500 if (
501 dialogInfo.value.type == "edit" &&
502 value == currTableData.value.beLoadUrl
503 ) {
504 callback();
505 return;
506 }
507 callback();
508 }
509 },
510 trigger: "blur",
511 },
512 ],
513 dorisJdbcUrl: [
514 {
515 validator: (rule: any, value: any, callback: any) => {
516 if (value === "") {
517 callback(new Error("请填写dorisJdbcUrl"));
518 } else {
519 if (
520 dialogInfo.value.type == "edit" &&
521 value == currTableData.value.dorisJdbcUrl
522 ) {
523 callback();
524 return;
525 }
526 callback();
527 }
528 },
529 trigger: "blur",
530 },
531 ],
532 },
533 },
534 ssl: {
535 items: [
536 {
537 label: "",
538 type: "checkbox",
539 col: "margin_b_0",
540 placeholder: "使用SSL",
541 field: "useSsl",
542 required: false,
543 block: true,
544 },
545 {
546 label: "",
547 type: "checkbox-panel",
548 placeholder: "使用验证",
549 field: "yz",
550 children: [
551 {
552 label: "客户端秘钥",
553 type: "file-upload",
554 placeholder: "选择文件上传",
555 field: "khdmy",
556 disabled: true,
557 required: true,
558 block: true,
559 },
560 {
561 label: "客户端证书",
562 type: "file-upload",
563 placeholder: "选择文件上传",
564 field: "khdzs",
565 disabled: true,
566 required: true,
567 block: true,
568 },
569 {
570 label: "CA证书",
571 type: "file-upload",
572 placeholder: "选择文件上传",
573 field: "cazs",
574 disabled: true,
575 required: true,
576 block: true,
577 },
578 {
579 label: "指定密码检索表",
580 type: "append-empty",
581 placeholder: "请输入",
582 field: "khdzs",
583 disabled: true,
584 required: true,
585 block: true,
586 },
587 ],
588 required: false,
589 block: true,
590 },
591 ],
592 rules: {},
593 },
594 ssh: {
595 items: [
596 {
597 label: "",
598 type: "checkbox-panel",
599 placeholder: "使用SSH",
600 field: "yz",
601 children: [
602 {
603 label: "主机名或IP地址",
604 type: "input",
605 placeholder: "请输入",
606 field: "khdmy",
607 required: false,
608 disabled: true,
609 },
610 {
611 label: "端口",
612 type: "input",
613 placeholder: "请输入",
614 field: "khdzs",
615 required: false,
616 disabled: true,
617 },
618 {
619 label: "用户名",
620 type: "input",
621 placeholder: "请输入",
622 field: "cazs",
623 required: false,
624 disabled: true,
625 },
626 {
627 label: "验证方法",
628 type: "select",
629 placeholder: "请选择",
630 field: "yzfs",
631 options: [
632 { label: "密码", value: "pwd" },
633 { label: "手机号", value: "tel" },
634 ],
635 required: false,
636 disabled: true,
637 },
638 {
639 label: "密码",
640 type: "input",
641 placeholder: "请输入",
642 field: "pwd",
643 required: false,
644 disabled: true,
645 },
646 {
647 label: "",
648 type: "checkbox",
649 placeholder: "保存密码",
650 field: "savePwd",
651 required: false,
652 },
653 ],
654 required: false,
655 block: true,
656 },
657 ],
658 rules: {},
659 },
660 http: {
661 items: [
662 {
663 label: "",
664 type: "checkbox-input",
665 placeholder: "使用HTTP通道",
666 field: "tddz",
667 children: [
668 {
669 label: "",
670 type: "input",
671 placeholder: "通道地址",
672 field: "khdmy",
673 required: false,
674 disabled: true,
675 },
676 ],
677 block: true,
678 },
679 {
680 label: "",
681 type: "tabs-panel-card",
682 placeholder: "用base64编码传出查询",
683 field: "basebm",
684 tabsInfo: {
685 type: "card",
686 activeName: "yz",
687 col: "border",
688 tabs: [
689 {
690 label: "验证",
691 name: "yz",
692 pane: {
693 type: "form",
694 title: "",
695 formInfo: {
696 id: "",
697 items: [
698 {
699 label: "",
700 type: "checkbox-panel",
701 col: "margin_b_0 border_none col_3",
702 placeholder: "使用密码验证",
703 field: "mmyz",
704 children: [
705 {
706 label: "",
707 type: "input",
708 placeholder: "用户名",
709 field: "cazs",
710 required: false,
711 disabled: true,
712 },
713 {
714 label: "",
715 type: "input",
716 placeholder: "密码",
717 field: "pwd",
718 required: false,
719 disabled: true,
720 },
721 {
722 label: "",
723 type: "checkbox",
724 placeholder: "保存密码",
725 field: "savePwd",
726 required: false,
727 },
728 ],
729 required: false,
730 block: true,
731 },
732 {
733 label: "",
734 type: "checkbox-panel",
735 col: "border_none",
736 placeholder: "使用证书验证",
737 field: "zsyz",
738 children: [
739 {
740 label: "客户端秘钥",
741 type: "file-upload",
742 placeholder: "选择文件上传",
743 field: "khdmy",
744 disabled: true,
745 required: true,
746 block: true,
747 },
748 {
749 label: "客户端证书",
750 type: "file-upload",
751 placeholder: "选择文件上传",
752 field: "khdzs",
753 disabled: true,
754 required: true,
755 block: true,
756 },
757 {
758 label: "CA证书",
759 type: "file-upload",
760 placeholder: "选择文件上传",
761 field: "cazs",
762 disabled: true,
763 required: true,
764 block: true,
765 },
766 {
767 label: "密码短语",
768 type: "append-empty",
769 placeholder: "请输入",
770 field: "khdzs",
771 disabled: true,
772 required: true,
773 block: true,
774 },
775 ],
776 required: false,
777 block: true,
778 },
779 ],
780 },
781 },
782 },
783 {
784 label: "代理服务器",
785 name: "dl",
786 pane: {
787 type: "form",
788 title: "",
789 formInfo: {
790 id: "",
791 items: [
792 {
793 label: "",
794 type: "checkbox-panel",
795 col: "border_none",
796 placeholder: "使用代理服务器",
797 field: "yz",
798 children: [
799 {
800 label: "主机名或IP地址",
801 type: "input",
802 placeholder: "请输入",
803 field: "khdmy",
804 required: false,
805 disabled: true,
806 },
807 {
808 label: "端口",
809 type: "input",
810 placeholder: "请输入",
811 field: "khdzs",
812 required: false,
813 disabled: true,
814 },
815 {
816 label: "用户名",
817 type: "input",
818 placeholder: "请输入",
819 field: "cazs",
820 required: false,
821 disabled: true,
822 },
823 {
824 label: "验证方法",
825 type: "select",
826 placeholder: "请选择",
827 field: "yzfs",
828 options: [
829 { label: "密码", value: "pwd" },
830 { label: "手机号", value: "tel" },
831 ],
832 required: false,
833 disabled: true,
834 },
835 {
836 label: "密码",
837 type: "input",
838 placeholder: "请输入",
839 field: "pwd",
840 required: false,
841 disabled: true,
842 },
843 {
844 label: "",
845 type: "checkbox",
846 placeholder: "保存密码",
847 field: "savePwd",
848 required: false,
849 },
850 ],
851 required: false,
852 block: true,
853 },
854 ],
855 },
856 },
857 },
858 ],
859 },
860 children: [
861 {
862 label: "主机名或IP地址",
863 type: "input",
864 placeholder: "请输入",
865 field: "khdmy",
866 required: false,
867 },
868 {
869 label: "端口",
870 type: "input",
871 placeholder: "请输入",
872 field: "khdzs",
873 required: false,
874 },
875 {
876 label: "用户名",
877 type: "input",
878 placeholder: "请输入",
879 field: "cazs",
880 required: false,
881 },
882 {
883 label: "验证方法",
884 type: "select",
885 placeholder: "请选择",
886 field: "yzfs",
887 default: "pwd",
888 options: [
889 { label: "密码", value: "pwd" },
890 { label: "手机号", value: "tel" },
891 ],
892 required: false,
893 },
894 {
895 label: "密码",
896 type: "input",
897 placeholder: "请输入",
898 field: "pwd",
899 required: false,
900 },
901 {
902 label: "",
903 type: "checkbox",
904 placeholder: "保存密码",
905 field: "savePwd",
906 required: false,
907 },
908 ],
909 required: false,
910 block: true,
911 },
912 ],
913 rules: {},
914 },
915 });
916
917 const dialogRef = ref();
918 const dialogInfo = ref({
919 visible: false,
920 size: 700,
921 direction: "column",
922 height: '440px',
923 header: {
924 title: "",
925 },
926 type: "",
927 readonly: false,
928 contents: [],
929 footer: {
930 btns: [
931 { type: "default", label: "取消", value: "cancel" },
932 { type: "primary", label: "确定", value: "submit" },
933 ],
934 textBtns: [{ type: "primary", label: "连通测试", value: "connect" }],
935 },
936 });
937
938 const setFormItems = (name, info: any = null) => {
939 let contentFormInfo: any = {};
940 if (name == "常规") {
941 tabActiveName.value = "1";
942 contentFormInfo = contents.value["normal"];
943 } else if (name == "SSL") {
944 tabActiveName.value = "2";
945 contentFormInfo = contents.value["ssl"];
946 } else if (name == "SSH") {
947 tabActiveName.value = "3";
948 contentFormInfo = contents.value["ssh"];
949 } else if (name == "HTTP") {
950 tabActiveName.value = "4";
951 contentFormInfo = contents.value["http"];
952 }
953
954 tabsInfo.value.tabsInfo.activeName = name;
955 formItems.value = contentFormInfo.items;
956 formRules.value = contentFormInfo.rules;
957
958 if (info !== null) {
959 const type = dialogInfo.value.type;
960 formItems.value.map((item) => {
961 if (
962 item.field == "host" ||
963 item.field == "port" ||
964 item.field == "logonUser" ||
965 item.field == "password"
966 ) {
967 if (type == "edit" || type == "detail") {
968 item.default = info?.[item.field] ?? "";
969 } else {
970 item.default = info[item.field] ?? "";
971 }
972 if (item.field == "logonUser" || item.field == "password") {
973 item.autocompleteSetting.readonly = true;
974 }
975 } else if (item.field == "jqxx") {
976 item.visible = info.databaseType == "doris";
977 item.children.map((child) => {
978 if (type == 'edit' || type == 'detail') {
979 child.default = info?.[child.field] ?? "";
980 } else {
981 child.default = info[child.field] ?? "";
982 }
983 });
984 } else if (item.field == 'bizSystem') {
985 item.visible = info.systemLayer == '业务系统';
986 item.default = info[item.field] || "";
987 }
988 else {
989 item.default = info[item.field] || "";
990 }
991 });
992 } else {
993 formItems.value.map((item) => {
994 if (item.field == "logonUser" || item.field == "password") {
995 item.autocompleteSetting.readonly = true;
996 }
997 });
998 }
999
1000 formInfo.value.formInfo.items = formItems.value;
1001 formInfo.value.formInfo.rules = formRules.value;
1002
1003 const content: any = [tabsInfo.value, formInfo.value];
1004 dialogInfo.value.contents = content;
1005 };
1006
1007 const getFirstPageData = () => {
1008 page.value.curr = 1;
1009 getTableData();
1010 };
1011 onMounted(() => {
1012 getAllFlowData({ dictType: "业务系统" }).then((res) => {
1013 flowList.value = res.data
1014 contents.value.normal.items[3].options = flowList.value
1015 })
1016 })
1017 const toSearch = (val: any, clear: boolean = false) => {
1018 if (clear) {
1019 searchItemList.value.map((item) => (item.default = ""));
1020 page.value.systemLayer = "";
1021 page.value.databaseType = "";
1022 page.value.connectStatus = "";
1023 page.value.databaseNameZh = "";
1024 page.value.databaseNameEn = "";
1025 } else {
1026 page.value.systemLayer = val.systemLayer;
1027 page.value.databaseType = val.databaseType;
1028 page.value.connectStatus = val.connectStatus;
1029 page.value.databaseNameZh = val.databaseNameZh;
1030 page.value.databaseNameEn = val.databaseNameEn;
1031 }
1032 getTableData();
1033 };
1034
1035 const getTableData = () => {
1036 tableInfo.value.loading = true;
1037 getDataSourceList({
1038 pageIndex: page.value.curr,
1039 pageSize: page.value.limit,
1040 systemLayer: page.value.systemLayer,
1041 databaseType: page.value.databaseType,
1042 connectStatus: page.value.connectStatus,
1043 databaseNameZh: page.value.databaseNameZh,
1044 databaseNameEn: page.value.databaseNameEn
1045 })
1046 .then((res: any) => {
1047 if (res.code == proxy.$passCode) {
1048 const data = res.data || {};
1049 tableInfo.value.data = data.records || [];
1050 tableInfo.value.page.limit = data.pageSize;
1051 tableInfo.value.page.curr = data.pageIndex;
1052 tableInfo.value.page.rows = data.totalRows;
1053 } else {
1054 ElMessage({
1055 type: "error",
1056 message: res.msg,
1057 });
1058 }
1059 tableInfo.value.loading = false;
1060 })
1061 .catch((xhr) => {
1062 tableInfo.value.loading = false;
1063 });
1064 };
1065
1066 const tableSelectionChange = (val) => {
1067 selectRowData.value = val.map((item) => item.guid);
1068 };
1069
1070 const tablePageChange = (info) => {
1071 page.value.curr = Number(info.curr);
1072 page.value.limit = Number(info.limit);
1073 getTableData();
1074 };
1075
1076 const tabChange = (tabName) => {
1077 // TODO.等添加了tab切换之后再保留旧值.
1078 setFormItems(tabName);
1079 };
1080
1081 /** 表单修改时的原始值 */
1082 const originValue: any = ref({});
1083
1084 const formSelectChange = (val, row, info) => {
1085 console.log(row, info)
1086 if (row.field == "databaseType" || row.field == 'systemLayer') {
1087 if (tabsInfo.value.tabsInfo.activeName == "常规") {
1088 let newInfo = originValue.value = Object.assign(originValue.value, info);
1089 setFormItems("常规", newInfo);
1090 }
1091 }
1092 };
1093
1094 const tableBtnClick = (scope, btn) => {
1095 const type = btn.value;
1096 const row = scope.row;
1097 currTableData.value = row;
1098 if (type == "edit") {
1099 dialogInfo.value.type = type;
1100 dialogInfo.value.header.title = "编辑数据源";
1101 const guid = row.guid;
1102 getDataSourceDetail(guid).then((res: any) => {
1103 if (res.code == proxy.$passCode && res.data) {
1104 const data = res.data;
1105 currTableData.value = data;
1106 setDetailInfo();
1107 } else {
1108 ElMessage({
1109 type: "error",
1110 message: res.msg,
1111 });
1112 }
1113 });
1114 } else if (type == "test") {
1115 checkConnect({});
1116 } else if (type == "delete") {
1117 open("此操作将永久删除, 是否继续?", "warning");
1118 }
1119 };
1120
1121 const open = (msg, type, isBatch = false) => {
1122 ElMessageBox.confirm(msg, "提示", {
1123 confirmButtonText: "确定",
1124 cancelButtonText: "取消",
1125 type: type,
1126 }).then(() => {
1127 let guids = [currTableData.value.guid];
1128 if (isBatch) {
1129 guids = selectRowData.value;
1130 }
1131 deleteDataSource(guids).then((res: any) => {
1132 if (res.code == proxy.$passCode) {
1133 getTableData();
1134 ElMessage({
1135 type: "success",
1136 message: "删除成功",
1137 });
1138 } else {
1139 ElMessage({
1140 type: "error",
1141 message: res.msg,
1142 });
1143 }
1144 });
1145 });
1146 };
1147
1148 const setDetailInfo = async () => {
1149 let info = Object.assign({}, currTableData.value, currTableData.value.dataConfigure || {});
1150 let newInfo = originValue.value = Object.assign(originValue.value, info);
1151 setFormItems("常规", newInfo);
1152 dialogInfo.value.visible = true;
1153 };
1154
1155 const checkConnect = (val) => {
1156 let params = { guid: currTableData.value.guid };
1157 checkDataSourceConnect(params).then((res: any) => {
1158 if (res.code == proxy.$passCode && res.data && res.data == "1") {
1159 getTableData();
1160 ElMessage({
1161 type: "success",
1162 message: "连通成功",
1163 });
1164 } else {
1165 getTableData();
1166 ElMessage({
1167 type: "error",
1168 message: "连通失败",
1169 });
1170 }
1171 });
1172 };
1173
1174 const loadDialog = async () => {
1175 dialogInfo.value.type = "add";
1176 dialogInfo.value.header.title = "添加数据源";
1177 originValue.value = {};
1178 setFormItems("常规", {});
1179 dialogInfo.value.visible = true;
1180 };
1181
1182 const batching = (type) => {
1183 if (type == "delete") {
1184 if (selectRowData.value.length == 0) {
1185 ElMessage({
1186 type: "error",
1187 message: "请选择需要删除的数据",
1188 });
1189 return;
1190 }
1191 open("此操作将永久删除, 是否继续?", "warning", true);
1192 }
1193 };
1194
1195 const dialogBtnClick = (btn, info) => {
1196 if (btn.value == "submit") {
1197 // dialogInfo.value.footer.btns.map((item: any) => item.disabled = true)
1198 const params = { ...info };
1199 delete params.host;
1200 delete params.port;
1201 delete params.logonUser;
1202 delete params.password;
1203 delete params.feLoadUrl;
1204 delete params.beLoadUrl;
1205 delete params.dorisJdbcUrl;
1206 params.dataConnectionContract = tabActiveName.value;
1207 if (dialogInfo.value.type == "add") {
1208 params.dataConfigureAddDTO = {
1209 host: info.host,
1210 port: info.port,
1211 logonUser: info.logonUser,
1212 password: info.password,
1213 feLoadUrl: info.feLoadUrl,
1214 beLoadUrl: info.beLoadUrl,
1215 dorisJdbcUrl: info.dorisJdbcUrl
1216 };
1217 addDataSource(params)
1218 .then((res: any) => {
1219 if (res.code == proxy.$passCode) {
1220 getFirstPageData();
1221 ElMessage({
1222 type: "success",
1223 message: "添加数据源成功",
1224 });
1225 dialogInfo.value.visible = false;
1226 } else {
1227 ElMessage({
1228 type: "error",
1229 message: res.msg,
1230 });
1231 // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
1232 }
1233 })
1234 .catch(() => {
1235 // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
1236 });
1237 } else {
1238 params.dataConfigureUpdateDTO = {
1239 guid: currTableData.value.dataConfigure.guid,
1240 host: info.host,
1241 port: info.port,
1242 logonUser: info.logonUser,
1243 password:
1244 info.password == "******"
1245 ? currTableData.value.dataConfigure.password
1246 : info.password,
1247 feLoadUrl: info.feLoadUrl,
1248 beLoadUrl: info.beLoadUrl,
1249 dorisJdbcUrl: info.dorisJdbcUrl
1250 };
1251 params.guid = currTableData.value.guid;
1252 updateDataSource(params)
1253 .then((res: any) => {
1254 if (res.code == proxy.$passCode) {
1255 getTableData();
1256 ElMessage({
1257 type: "success",
1258 message: "修改数据源成功",
1259 });
1260 dialogInfo.value.visible = false;
1261 } else {
1262 ElMessage({
1263 type: "error",
1264 message: res.msg,
1265 });
1266 }
1267 // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
1268 })
1269 .catch(() => {
1270 // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
1271 });
1272 }
1273 } else if (btn.value == "connect") {
1274 const params = {
1275 databaseType: info.databaseType,
1276 databaseNameEn: info.databaseNameEn,
1277 host: info.host,
1278 port: info.port,
1279 logonUser: info.logonUser,
1280 password: info.password,
1281 linkage: info.linkage,
1282 };
1283 checkDataSourceConnectTest(params).then((res: any) => {
1284 if (res.code == proxy.$passCode) {
1285 if (res.data && res.data == "1") {
1286 ElMessage({
1287 type: "success",
1288 message: "连通成功",
1289 });
1290 } else {
1291 ElMessage({
1292 type: "error",
1293 message: "连通失败",
1294 });
1295 }
1296 } else {
1297 ElMessage({
1298 type: "error",
1299 message: res.msg,
1300 });
1301 }
1302 });
1303 } else if (btn.value == "cancel") {
1304 // dialogInfo.value.footer.btns.map((item: any) => delete item.disabled)
1305 nextTick(() => {
1306 dialogInfo.value.visible = false;
1307 });
1308 }
1309 };
1310 </script>
1311
1312 <template>
1313 <div class="container_wrap">
1314 <div class="table_tool_wrap has_search">
1315 <TableTools :searchItems="searchItemList" :searchId="'data-source-search'" @search="toSearch" />
1316 <div class="tools_btns">
1317 <el-button type="primary" @click="loadDialog" v-preReClick>新建</el-button>
1318 <el-button @click="batching('delete')" v-preReClick>批量删除</el-button>
1319 </div>
1320 </div>
1321 <div class="table_panel_wrap">
1322 <Table :tableInfo="tableInfo" @tableBtnClick="tableBtnClick" @tablePageChange="tablePageChange"
1323 @tableSelectionChange="tableSelectionChange" />
1324 </div>
1325
1326 <Dialog ref="dialogRef" :dialogInfo="dialogInfo" @btnClick="dialogBtnClick" @tableBtnClick="tableBtnClick"
1327 @selectChange="formSelectChange" @tabChange="tabChange" />
1328 </div>
1329 </template>
1330
1331 <style lang="scss" scoped>
1332 .container_wrap {
1333 overflow: hidden auto;
1334 }
1335
1336 .table_tool_wrap {
1337 width: 100%;
1338 height: 84px !important;
1339 padding: 0 8px;
1340
1341 .tools_btns {
1342 padding: 8px 0 0;
1343 }
1344 }
1345
1346 .table_panel_wrap {
1347 width: 100%;
1348 height: calc(100% - 84px);
1349 padding: 8px 8px 0;
1350 }
1351 </style>
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!