9ba51b92 by lihua

数据产品目录

1 parent fe68b0ea
...@@ -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 importTableField from "./importTableField.vue"; ...@@ -31,6 +29,8 @@ import importTableField from "./importTableField.vue";
31 import { useValidator } from '@/hooks/useValidator'; 29 import { useValidator } from '@/hooks/useValidator';
32 import useDataAssetStore from "@/store/modules/dataAsset"; 30 import useDataAssetStore from "@/store/modules/dataAsset";
33 import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common'; 31 import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common';
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,30 +109,40 @@ const getArea = (node, resolve) => { ...@@ -100,30 +109,40 @@ 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([]); //权利主体下拉列表选择
106 const catalogProductList: any = ref([]); //获取资产目录可信空间数据下拉列表 116 //const catalogProductList: any = ref([]); //获取资产目录可信空间数据下拉列表
107 const baseInfoFormRef = ref(); 117 const baseInfoFormRef = ref();
108 118
109 const baseInfoFormItems = ref([ 119 const baseInfoFormItems = ref([
110 { 120 {
111 label: '资源名称', 121 label: '资源名称',
112 type: 'select', 122 type: 'input',
113 placeholder: '请输入', 123 placeholder: '请输入',
114 field: 'damName', 124 field: 'damName',
115 maxlength: 50, 125 maxlength: 50,
116 default: '', 126 default: '',
117 required: true, 127 required: true
118 options: catalogProductList.value,
119 // allowCreate: true,不需要支持输入
120 filterable: true,
121 props: {
122 value: 'productId',
123 label: 'productName'
124 },
125 clearable: true,
126 }, 128 },
129 // {
130 // label: '资源名称',
131 // type: 'select',
132 // placeholder: '请输入',
133 // field: 'damName',
134 // maxlength: 50,
135 // default: '',
136 // required: true,
137 // options: catalogProductList.value,
138 // allowCreate: true,
139 // filterable: true,
140 // props: {
141 // value: 'productId',
142 // label: 'productName'
143 // },
144 // clearable: true,
145 // },
127 { 146 {
128 label: '资源类型', 147 label: '资源类型',
129 type: 'select', 148 type: 'select',
...@@ -166,7 +185,8 @@ const baseInfoFormItems = ref([ ...@@ -166,7 +185,8 @@ const baseInfoFormItems = ref([
166 lazy: false, 185 lazy: false,
167 props: { 186 props: {
168 value: 'value', 187 value: 'value',
169 label: 'label' 188 label: 'label',
189 children: 'childDictList'
170 }, 190 },
171 filterable: true, 191 filterable: true,
172 clearable: true, 192 clearable: true,
...@@ -174,6 +194,82 @@ const baseInfoFormItems = ref([ ...@@ -174,6 +194,82 @@ const baseInfoFormItems = ref([
174 required: true 194 required: true
175 }, 195 },
176 { 196 {
197 label: '行业分类',
198 type: 'select',
199 placeholder: '请选择',
200 field: 'industry',
201 default: '',
202 options: industryDictList.value || [],
203 props: {
204 value: 'value',
205 label: 'label'
206 },
207 required: true,
208 filterable: true,
209 visible: true
210 },
211 {
212 label: '机构分类',
213 type: 'select',
214 placeholder: '请选择',
215 field: 'institutionType',
216 default: '',
217 options: institutionTypeDictList.value || [],
218 props: {
219 value: 'value',
220 label: 'label'
221 },
222 required: true,
223 filterable: true,
224 visible: true
225 },
226 {
227 label: '领域',
228 type: 'select',
229 placeholder: '请选择',
230 field: 'domain',
231 default: '003',
232 options: domainDictList.value,
233 props: {
234 value: 'value',
235 label: 'label',
236 children: 'children'
237 },
238 required: true,
239 filterable: true,
240 visible: true
241 }, {
242 label: '应用场景',
243 type: 'select',
244 placeholder: '请选择',
245 field: 'scenario',
246 default: '',
247 options: [], // 根据所选择领域显示列表
248 props: {
249 value: 'value',
250 label: 'label'
251 },
252 required: true,
253 filterable: true,
254 visible: true
255 },
256 {
257 label: "更新频率",
258 type: "select",
259 placeholder: "请选择",
260 field: "updateFrequency",
261 default: '',
262 props: {
263 value: 'value',
264 label: 'label'
265 },
266 multiple: false,
267 options: updateFrequencyDictList.value,
268 filterable: true,
269 required: true,
270 clearable: true,
271 },
272 {
177 label: '数据覆盖地域', 273 label: '数据覆盖地域',
178 type: 'checkbox-select', 274 type: 'checkbox-select',
179 placeholder: '全国', 275 placeholder: '全国',
...@@ -269,6 +365,38 @@ const baseInfoFormItems = ref([ ...@@ -269,6 +365,38 @@ const baseInfoFormItems = ref([
269 required: true, 365 required: true,
270 }, 366 },
271 { 367 {
368 label: '是否缓存',
369 type: 'radio-group',
370 placeholder: '',
371 field: 'isCache',
372 block: false,
373 default: 'N',
374 options: [{
375 value: 'Y',
376 label: '是'
377 }, {
378 value: 'N',
379 label: '否'
380 }],
381 required: true,
382 },
383 {
384 label: '是否加密存储',
385 type: 'radio-group',
386 placeholder: '',
387 field: 'isEncrypField',
388 block: false,
389 default: 'N',
390 options: [{
391 value: 'Y',
392 label: '是'
393 }, {
394 value: 'N',
395 label: '否'
396 }],
397 required: true,
398 },
399 {
272 label: '资源描述', 400 label: '资源描述',
273 type: 'textarea', 401 type: 'textarea',
274 placeholder: '该数据资源主要包含的信息,数据更新方式等。', 402 placeholder: '该数据资源主要包含的信息,数据更新方式等。',
...@@ -331,6 +459,12 @@ const baseInfoFormRules = ref({ ...@@ -331,6 +459,12 @@ const baseInfoFormRules = ref({
331 rightMain: [required(route.query.dataSources == '1' ? '请选择权利主体' : '请填写权利主体')], 459 rightMain: [required(route.query.dataSources == '1' ? '请选择权利主体' : '请填写权利主体')],
332 dataSources: [required('请选择数据来源')], 460 dataSources: [required('请选择数据来源')],
333 isPublicData: [required('请选择是否公共数据')], 461 isPublicData: [required('请选择是否公共数据')],
462 isCache: [required('请选择是否缓存')],
463 industry: [required('请选择行业分类')],
464 institutionType: [required('请选择机构分类')],
465 domain: [required('请选择领域')],
466 scenario: [required('请选择应用场景')],
467 updateFrequency: [required('请选择更新频率')]
334 }); 468 });
335 469
336 const getTableFieldPromise: any = ref({}); 470 const getTableFieldPromise: any = ref({});
...@@ -491,6 +625,9 @@ const setFormItems = (val) => { ...@@ -491,6 +625,9 @@ const setFormItems = (val) => {
491 if (item.children?.length) { 625 if (item.children?.length) {
492 item.children[0].default = val[item.children[0].field] || []; 626 item.children[0].default = val[item.children[0].field] || [];
493 } 627 }
628 if (item.field == 'scenario') {
629 item.options = domainDictList.value.find(s => s.value == val['domain'])?.childDictList || []
630 }
494 }); 631 });
495 } 632 }
496 633
...@@ -505,13 +642,10 @@ const baseSelectChange = (val, item, row) => { ...@@ -505,13 +642,10 @@ const baseSelectChange = (val, item, row) => {
505 setFormItems(row); 642 setFormItems(row);
506 } 643 }
507 } 644 }
508 } else if (item.field == 'damName') { 645 } else if (item.field == 'domain') {
509 let item = catalogProductList.value.find(c => c.productId == val); 646 row.scenario = ''; //清空下应用场景
510 if (item?.description) {
511 row.propertyDescription = item?.description;
512 setFormItems(row); 647 setFormItems(row);
513 } 648 }
514 }
515 } 649 }
516 650
517 const handleBaseInfoCheckboxChange = (val, info) => { 651 const handleBaseInfoCheckboxChange = (val, info) => {
...@@ -521,6 +655,86 @@ const handleBaseInfoCheckboxChange = (val, info) => { ...@@ -521,6 +655,86 @@ const handleBaseInfoCheckboxChange = (val, info) => {
521 setFormItems(info); 655 setFormItems(info);
522 } 656 }
523 657
658 /** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */
659 const productTableRef = ref();
660 const productData: any = ref([]);
661
662 const apiList: any = ref([]);
663
664 /** 基本信息的入参定义表格配置 */
665 const productTableInfo = ref({
666 id: "input-product-table",
667 height: '214px',
668 fields: [
669 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
670 { label: "服务名称", field: "apiGuid", width: 180, required: true, columClass: 'edit-colum', type: 'edit' },
671 { label: "API类型", field: "apiType", width: 100 },
672 { label: "API地址", field: "requestUrl", width: 240 },
673 { label: "描述", field: "apiDescription", width: 240 },
674 ],
675 editInfo: {
676 apiGuid: {
677 label: '',
678 type: 'select',
679 field: 'apiGuid',
680 default: '',
681 options: apiList.value,
682 props: {
683 label: 'apiName',
684 value: 'guid',
685 disabled: 'disabled'
686 },
687 placeholder: '请选择',
688 clearable: false,
689 filterable: true
690 },
691 },
692 STATUS: 'edit',
693 data: productData.value,
694 showPage: false,
695 actionInfo: {
696 show: true,
697 label: "操作",
698 type: "btn",
699 width: 60,
700 fixed: 'right',
701 btns: [
702 {
703 label: "删除", value: "remove", click: (scope) => {
704 let index = scope.$index;
705 proxy.$openMessageBox("此操作将永久删除, 是否继续?", () => {
706 productData.value.splice(index, 1);
707 productTableInfo.value.data = productData.value;
708 proxy.$ElMessage.success('服务包删除成功');
709 }, () => {
710 proxy.$ElMessage.info("已取消");
711 });
712 }
713 },
714 ]
715 },
716 loading: false
717 });
718
719 /** 给表格添加一行入参定义。 */
720 const addProduct = () => {
721 productData.value.push({ apiGuid: '' });
722 productTableInfo.value.data = productData.value;
723 nextTick(() => {
724 scrollLastRowToView(productTableRef.value?.tableRef, productData.value.length);
725 })
726 }
727
728 /** 根据下拉选择的产品带出产品相关信息 */
729 const hanldeTableSelectChange = (val, scope, item) => {
730 let productItem = val && apiList.value.find(p => p.guid == val);
731 scope.row.guid = val;
732 scope.row.apiName = productItem?.apiName;
733 scope.row.apiType = productItem?.apiType;
734 scope.row.requestUrl = productItem?.requestUrl;
735 scope.row.apiDescription = productItem?.apiDescription;
736 }
737
524 const handleCreateTable = () => { 738 const handleCreateTable = () => {
525 if (assetDataTableInfo.value.data.length >= 15) { 739 if (assetDataTableInfo.value.data.length >= 15) {
526 proxy.$ElMessage.error('最多允许添加15张资源表'); 740 proxy.$ElMessage.error('最多允许添加15张资源表');
...@@ -570,18 +784,6 @@ onBeforeMount(() => { ...@@ -570,18 +784,6 @@ onBeforeMount(() => {
570 detailInfo.value = res.data || {}; 784 detailInfo.value = res.data || {};
571 baseInfoFormItems.value.forEach((item: any) => { 785 baseInfoFormItems.value.forEach((item: any) => {
572 item.default = detailInfo.value[item.field] == null ? '' : detailInfo.value[item.field]; 786 item.default = detailInfo.value[item.field] == null ? '' : detailInfo.value[item.field];
573 if (item.field == 'damName') {
574 item.default = detailInfo.value?.productCode || item.default || '';
575 if (detailInfo.value?.productCode) {
576 let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
577 !item && catalogProductList.value.push({
578 productId: detailInfo.value?.productCode,
579 productName: detailInfo.value?.damName,
580 description: detailInfo.value.propertyDescription
581 });
582 baseInfoFormItems.value[0].options = catalogProductList.value;
583 }
584 }
585 if (item.field == 'subjectDomain') { 787 if (item.field == 'subjectDomain') {
586 let tree = detailInfo.value.subjectDomainTree?.[0]; 788 let tree = detailInfo.value.subjectDomainTree?.[0];
587 if (tree) { 789 if (tree) {
...@@ -625,6 +827,8 @@ onBeforeMount(() => { ...@@ -625,6 +827,8 @@ onBeforeMount(() => {
625 } 827 }
626 } else if (item.field == 'rightMain') { 828 } else if (item.field == 'rightMain') {
627 item.default = route.query.dataSources == '1' ? detailInfo.value.rightMain : detailInfo.value.rightMainName; 829 item.default = route.query.dataSources == '1' ? detailInfo.value.rightMain : detailInfo.value.rightMainName;
830 } else if (item.field == 'scenario') {
831 item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || []
628 } 832 }
629 }); 833 });
630 if (route.query.guid && route.query.foundMode == '2') { 834 if (route.query.guid && route.query.foundMode == '2') {
...@@ -668,54 +872,90 @@ onBeforeMount(() => { ...@@ -668,54 +872,90 @@ onBeforeMount(() => {
668 } 872 }
669 }) 873 })
670 } 874 }
671 getRegisterCatalogProductList().then((res: any) => { 875
672 catalogProductList.value = []; 876 // getRegisterCatalogProductList().then((res: any) => {
877 // catalogProductList.value = [];
878 // if (res.code == proxy.$passCode) {
879 // catalogProductList.value = res.data || [];
880 // baseInfoFormItems.value[0].options = catalogProductList.value;
881 // if (detailInfo.value?.productCode) {
882 // let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
883 // if (!item) {
884 // baseInfoFormItems.value[0].default = detailInfo.value.damName;
885 // }
886 // }
887 // } else {
888 // proxy.$ElMessage.error(res.msg);
889 // }
890 // })
891
892 getParamsList({
893 dictType: "资产类型",
894 }).then((res: any) => {
673 if (res.code == proxy.$passCode) { 895 if (res.code == proxy.$passCode) {
674 catalogProductList.value = res.data || []; 896 damTypes.value = res.data || [];
675 if (detailInfo.value?.productCode) { 897 let item = baseInfoFormItems.value.find(item => item.field == 'damType');
676 let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode); 898 item && (item.options = damTypes.value);
677 !item && catalogProductList.value.push({ 899 } else {
678 productId: detailInfo.value?.productCode, 900 proxy.$ElMessage.error(res.msg);
679 productName: detailInfo.value?.damName,
680 description: detailInfo.value?.propertyDescription
681 });
682 } 901 }
683 baseInfoFormItems.value[0].options = catalogProductList.value; 902 })
903 getParamsList({
904 dictType: "数据资产目录主题名称",
905 }).then((res: any) => {
906 if (res.code == proxy.$passCode) {
907 subjectDomainListData.value = res.data || [];
908 let item = baseInfoFormItems.value.find(item => item.field == 'subjectDomain');
909 item && (item.options = subjectDomainListData.value);
684 } else { 910 } else {
685 proxy.$ElMessage.error(res.msg); 911 proxy.$ElMessage.error(res.msg);
686 } 912 }
687 }) 913 })
688 914
689 function replaceChildDictListKey(data) { 915 getParamsList({
690 if (Array.isArray(data)) { 916 dictType: "行业分类",
691 return data.map(item => replaceChildDictListKey(item)); 917 }).then((res: any) => {
692 } else if (data && typeof data === 'object') { 918 if (res.code == proxy.$passCode) {
693 const { childDictList, ...rest } = data; 919 industryDictList.value = res.data || [];
694 return { 920 let item = baseInfoFormItems.value.find(item => item.field == 'industry');
695 ...rest, 921 item && (item.options = industryDictList.value);
696 children: childDictList ? replaceChildDictListKey(childDictList) : undefined, 922 } else {
697 }; 923 proxy.$ElMessage.error(res.msg);
698 } 924 }
699 return data; 925 })
926
927 getParamsList({ dictType: '领域' }).then((res: any) => {
928 if (res.code == proxy.$passCode) {
929 domainDictList.value = res.data || [];
930 let itemIndex = baseInfoFormItems.value.findIndex(item => item.field == 'domain');
931 let item = baseInfoFormItems.value[itemIndex];
932 item && (item.options = domainDictList.value);
933 let item1 = baseInfoFormItems.value[itemIndex + 1];
934 item1 && item.default && (item1.options = domainDictList.value.find(s => s.value == item.default)?.childDictList || []);
935 } else {
936 proxy.$ElMessage.error(res.msg);
700 } 937 }
938 });
939
701 getParamsList({ 940 getParamsList({
702 dictType: "资产类型", 941 dictType: "组织机构性质",
703 }).then((res: any) => { 942 }).then((res: any) => {
704 if (res.code == proxy.$passCode) { 943 if (res.code == proxy.$passCode) {
705 damTypes.value = res.data || []; 944 institutionTypeDictList.value = res.data || [];
706 let item = baseInfoFormItems.value.find(item => item.field == 'damType'); 945 let item = baseInfoFormItems.value.find(item => item.field == 'institutionType');
707 item && (item.options = damTypes.value); 946 item && (item.options = institutionTypeDictList.value);
708 } else { 947 } else {
709 proxy.$ElMessage.error(res.msg); 948 proxy.$ElMessage.error(res.msg);
710 } 949 }
711 }) 950 })
951
712 getParamsList({ 952 getParamsList({
713 dictType: "数据资产目录主题名称", 953 dictType: "更新周期",
714 }).then((res: any) => { 954 }).then((res: any) => {
715 if (res.code == proxy.$passCode) { 955 if (res.code == proxy.$passCode) {
716 subjectDomainListData.value = replaceChildDictListKey(res.data) || []; 956 updateFrequencyDictList.value = res.data || [];
717 let item = baseInfoFormItems.value.find(item => item.field == 'subjectDomain'); 957 let item = baseInfoFormItems.value.find(item => item.field == 'updateFrequency');
718 item && (item.options = subjectDomainListData.value); 958 item && (item.options = updateFrequencyDictList.value);
719 } else { 959 } else {
720 proxy.$ElMessage.error(res.msg); 960 proxy.$ElMessage.error(res.msg);
721 } 961 }
...@@ -737,28 +977,25 @@ const save = () => { ...@@ -737,28 +977,25 @@ const save = () => {
737 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => { 977 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
738 if (valid) { 978 if (valid) {
739 let params = { ...baseInfoFormRef.value.formInline }; 979 let params = { ...baseInfoFormRef.value.formInline };
740 let item = catalogProductList.value.find(c => c.productId == params.damName); 980 let associationApiList: string[] = [];
741 if (item) { 981 for (const api of productData.value) {
742 params.productCode = item.productId; 982 if (!api.apiGuid) {
743 params.damName = item.productName; 983 proxy.$ElMessage.error('服务包信息未填写完整');
744 params.foundMode = 5; 984 expandServiceInfo.value = true;
745 } else {
746 params.damName = params.damName;
747 if (params.damName.length > 50) {
748 proxy.$ElMessage.error('资源名称的长度不能超过50');
749 baseInfoExpand.value = true;
750 return; 985 return;
751 } 986 }
987 associationApiList.push(api.apiGuid);
752 } 988 }
989 params.associationApi = associationApiList;
753 /** 只有数据集和api类型时,目录表必填。 */ 990 /** 只有数据集和api类型时,目录表必填。 */
754 if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') { 991 if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') {
755 if (!params.databaseType) { 992 if (!params.databaseType) {
756 proxy.$ElMessage.error('资源类型为数据集或API时,数据库类型必填'); 993 proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
757 baseInfoExpand.value = true; 994 baseInfoExpand.value = true;
758 return; 995 return;
759 } 996 }
760 if (!assetDataTableInfo.value.data) { 997 if (!assetDataTableInfo.value.data) {
761 proxy.$ElMessage.error('资源类型为数据集或API时,必需添加资源表'); 998 proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表');
762 assetTableInfoExpand.value = true; 999 assetTableInfoExpand.value = true;
763 nextTick(() => { 1000 nextTick(() => {
764 setTimeout(() => { 1001 setTimeout(() => {
...@@ -945,6 +1182,14 @@ const handleImportSave = (val) => { ...@@ -945,6 +1182,14 @@ const handleImportSave = (val) => {
945 <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" 1182 <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules"
946 @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> 1183 @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" />
947 </ContentWrap> 1184 </ContentWrap>
1185 <ContentWrap id="product-info" title="服务包信息" expandSwicth style="margin-top: 15px" :isExpand="expandServiceInfo"
1186 @expand="(v) => (expandServiceInfo = v)" description="" class="mb16">
1187 <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table"
1188 @table-select-change="hanldeTableSelectChange" />
1189 <div class="row-add-btn">
1190 <el-button link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button>
1191 </div>
1192 </ContentWrap>
948 <ContentWrap id="id-tableInfo" title="资源表" description="" :expand-swicth="true" :isExpand="assetTableInfoExpand" 1193 <ContentWrap id="id-tableInfo" title="资源表" description="" :expand-swicth="true" :isExpand="assetTableInfoExpand"
949 @expand="(v) => assetTableInfoExpand = v"> 1194 @expand="(v) => assetTableInfoExpand = v">
950 <div v-show="assetDataTableInfo.data.length" class="tools_btns"> 1195 <div v-show="assetDataTableInfo.data.length" class="tools_btns">
......
...@@ -192,6 +192,8 @@ const getDetailInfo = () => { ...@@ -192,6 +192,8 @@ const getDetailInfo = () => {
192 const data = res.data || {}; 192 const data = res.data || {};
193 detailInfo.value = data; 193 detailInfo.value = data;
194 publicDataProductsMainRSVO.value = detailInfo.value.publicDataProductsMainRSVO || {}; 194 publicDataProductsMainRSVO.value = detailInfo.value.publicDataProductsMainRSVO || {};
195 //TODO. 返回服务包信息
196 productTableInfo.value.data = detailInfo.value.associationApiVO || [];
195 // detailInfo.value.damTypeName = damTypes.find(d => d.value == detailInfo.value.damType)?.label; 197 // detailInfo.value.damTypeName = damTypes.find(d => d.value == detailInfo.value.damType)?.label;
196 detailInfo.value.dataSourcesName = dataSourcesList.find(d => d.value == detailInfo.value.dataSources)?.label; 198 detailInfo.value.dataSourcesName = dataSourcesList.find(d => d.value == detailInfo.value.dataSources)?.label;
197 if (!isJSZQ.value) { 199 if (!isJSZQ.value) {
...@@ -320,6 +322,25 @@ const getDetailInfo = () => { ...@@ -320,6 +322,25 @@ const getDetailInfo = () => {
320 }) 322 })
321 } 323 }
322 324
325 /** ----------------- 数据包信息 --------------------- */
326 const productTableInfo = ref({
327 id: "input-product-table",
328 height: '214px',
329 fields: [
330 { label: "序号", type: "index", width: TableColumnWidth.INDEX, align: "center" },
331 { label: "服务名称", field: "apiGuid", width: 180 },
332 { label: "API类型", field: "apiType", width: 100 },
333 { label: "API地址", field: "requestUrl", width: 240 },
334 { label: "描述", field: "apiDescription", width: 240 },
335 ],
336 data: [],
337 showPage: false,
338 actionInfo: {
339 show: false
340 },
341 loading: false
342 });
343
323 onBeforeMount(() => { 344 onBeforeMount(() => {
324 if (!assetStore.isRefreshDamCatalog) { 345 if (!assetStore.isRefreshDamCatalog) {
325 getDetailInfo(); 346 getDetailInfo();
...@@ -357,11 +378,12 @@ const isTextTruncated = () => { ...@@ -357,11 +378,12 @@ const isTextTruncated = () => {
357 isTruncated.value = false; 378 isTruncated.value = false;
358 isExpanded.value = false; 379 isExpanded.value = false;
359 nextTick(() => { 380 nextTick(() => {
360 let domDesc = document.getElementsByClassName('right-main')?.[0]; 381 let dom = document.getElementsByClassName('right-main')?.[0];
382 let domDesc = dom?.children?.length && dom?.children?.[dom.children.length - 1];
361 if (!domDesc) { 383 if (!domDesc) {
362 return; 384 return;
363 } 385 }
364 if (domDesc.clientHeight > 82) { 386 if (domDesc.clientHeight > 21) {
365 isTruncated.value = true; 387 isTruncated.value = true;
366 } else { 388 } else {
367 isTruncated.value = false; 389 isTruncated.value = false;
...@@ -1209,8 +1231,23 @@ const respParamsTableInfo = ref({ ...@@ -1209,8 +1231,23 @@ const respParamsTableInfo = ref({
1209 detailInfo.subjectDomain }}</div> 1231 detailInfo.subjectDomain }}</div>
1210 <div class="dataLabel dataLabel1" v-if="detailInfo.databaseType">{{ detailInfo.databaseType }}</div> 1232 <div class="dataLabel dataLabel1" v-if="detailInfo.databaseType">{{ detailInfo.databaseType }}</div>
1211 <div class="dataLabel dataLabel1">{{ detailInfo.dataSourcesName }}</div> 1233 <div class="dataLabel dataLabel1">{{ detailInfo.dataSourcesName }}</div>
1234 <div class="dataLabel dataLabel1" v-if="detailInfo.updateFrequency">{{ detailInfo.updateFrequencyName }}</div>
1235 </div>
1236 </div>
1237 <template v-if="detailInfo?.foundMode == 1">
1238 <div class="row-extra-desc">
1239 <div class="per-extra-desc">{{ '行业分类:' + (detailInfo.industryName || '--') }}</div>
1240 <div>{{ '机构分类:' + (detailInfo.institutionTypeName || '--') }}</div>
1241 </div>
1242 <div class="row-extra-desc">
1243 <div class="per-extra-desc">{{ '领域:' + (detailInfo.domainName || '--') }}</div>
1244 <div>{{ '应用场景:' + (detailInfo.scenarioName || '--') }}</div>
1212 </div> 1245 </div>
1246 <div class="row-extra-desc">
1247 <div class="per-extra-desc">{{ '是否缓存:' + (detailInfo.isCache == 'Y' ? '是' : '否') }}</div>
1248 <div>{{ '是否加密存储:' + (detailInfo.scenario == 'Y' ? '是' : '否') }}</div>
1213 </div> 1249 </div>
1250 </template>
1214 <div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }} 1251 <div v-show="detailInfo.rightMainName" class="applicationScenarios">{{ '权利主体:' + detailInfo.rightMainName }}
1215 </div> 1252 </div>
1216 <div class="applicationScenarios" 1253 <div class="applicationScenarios"
...@@ -1299,7 +1336,7 @@ const respParamsTableInfo = ref({ ...@@ -1299,7 +1336,7 @@ const respParamsTableInfo = ref({
1299 </div> 1336 </div>
1300 <div class="list_item is_block"> 1337 <div class="list_item is_block">
1301 <span class="item_label">产品关键词:</span> 1338 <span class="item_label">产品关键词:</span>
1302 <span class="item_value">{{ publicDataProductsMainRSVO.productKeywords?.join(',') || '--' }}</span> 1339 <span class="item_value">{{ publicDataProductsMainRSVO?.productKeywords?.join(',') || '--' }}</span>
1303 </div> 1340 </div>
1304 <div class="list_item is_block"> 1341 <div class="list_item is_block">
1305 <span class="item_label">产品描述:</span> 1342 <span class="item_label">产品描述:</span>
...@@ -1307,6 +1344,9 @@ const respParamsTableInfo = ref({ ...@@ -1307,6 +1344,9 @@ const respParamsTableInfo = ref({
1307 </div> 1344 </div>
1308 </div> 1345 </div>
1309 </ContentWrap> 1346 </ContentWrap>
1347 <ContentWrap v-if="productTableInfo.data?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px">
1348 <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" />
1349 </ContentWrap>
1310 <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px"> 1350 <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px">
1311 <el-tabs v-model="activeTabName" class="param-tabs"> 1351 <el-tabs v-model="activeTabName" class="param-tabs">
1312 <el-tab-pane label="入参信息" name="reqParamList"> 1352 <el-tab-pane label="入参信息" name="reqParamList">
...@@ -1354,7 +1394,7 @@ const respParamsTableInfo = ref({ ...@@ -1354,7 +1394,7 @@ const respParamsTableInfo = ref({
1354 <span>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span> 1394 <span>{{ scope.row["fieldPrecision"] == null ? '--' : scope.row["fieldPrecision"] }}</span>
1355 </template> 1395 </template>
1356 </el-table-column> 1396 </el-table-column>
1357 <el-table-column prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip> 1397 <el-table-column v-if="detailInfo.foundMode != 1" prop="dictionaryCode" label="关联字典" width="130px" align="left" show-overflow-tooltip>
1358 <template #default="scope"> 1398 <template #default="scope">
1359 <span>{{ scope.row["dictionaryName"] || '--' }}</span> 1399 <span>{{ scope.row["dictionaryName"] || '--' }}</span>
1360 </template> 1400 </template>
...@@ -1851,7 +1891,7 @@ const respParamsTableInfo = ref({ ...@@ -1851,7 +1891,7 @@ const respParamsTableInfo = ref({
1851 letter-spacing: 0; 1891 letter-spacing: 0;
1852 line-height: 30px; 1892 line-height: 30px;
1853 font-weight: 600; 1893 font-weight: 600;
1854 max-width: calc(100% - 250px); 1894 max-width: calc(100% - 320px);
1855 } 1895 }
1856 1896
1857 .dataLabel { 1897 .dataLabel {
...@@ -1890,9 +1930,24 @@ const respParamsTableInfo = ref({ ...@@ -1890,9 +1930,24 @@ const respParamsTableInfo = ref({
1890 .expand_btn { 1930 .expand_btn {
1891 position: absolute; 1931 position: absolute;
1892 right: 0px; 1932 right: 0px;
1893 top: 58px; 1933 bottom: 0px;
1934 font-size: 14px;
1935 line-height: 21px;
1936 }
1937
1938 .row-extra-desc {
1939 width: 100%;
1940 display: flex;
1941 margin-top: 4px;
1894 font-size: 14px; 1942 font-size: 14px;
1943 color: #666666;
1944 letter-spacing: 0;
1895 line-height: 21px; 1945 line-height: 21px;
1946 font-weight: 400;
1947
1948 .per-extra-desc {
1949 width: 400px;
1950 }
1896 } 1951 }
1897 } 1952 }
1898 } 1953 }
......
...@@ -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,
...@@ -48,7 +46,7 @@ const damTypesOptions = ref<any>([ ...@@ -48,7 +46,7 @@ const damTypesOptions = ref<any>([
48 { label: "自建", value: 1 }, 46 { label: "自建", value: 1 },
49 { label: "加工交付", value: 2 }, 47 { label: "加工交付", value: 2 },
50 { label: "江苏专区", value: 4 }, 48 { label: "江苏专区", value: 4 },
51 { label: "可信数据空间", value: 5 }, 49 // { label: "可信数据空间", value: 5 },
52 ]) 50 ])
53 const searchItemList = ref([ 51 const searchItemList = ref([
54 { 52 {
...@@ -109,20 +107,20 @@ const searchItemList = ref([ ...@@ -109,20 +107,20 @@ const searchItemList = ref([
109 label: 'label' 107 label: 'label'
110 } 108 }
111 }, 109 },
112 { 110 // {
113 type: "select", 111 // type: "select",
114 label: "", 112 // label: "",
115 field: "isRegister", 113 // field: "isRegister",
116 default: "", 114 // default: "",
117 placeholder: "登记状态", 115 // placeholder: "登记状态",
118 clearable: true, 116 // clearable: true,
119 filterable: true, 117 // filterable: true,
120 options: isRegisterOptions.value, 118 // options: isRegisterOptions.value,
121 props: { 119 // props: {
122 value: 'value', 120 // value: 'value',
123 label: 'label' 121 // label: 'label'
124 } 122 // }
125 }, 123 // },
126 ]); 124 ]);
127 125
128 const pageInfo = ref({ 126 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!