6b92181e by lihua

专区的数据产品新建支持下拉或输入

1 parent f852f928
...@@ -348,6 +348,12 @@ export const existDamName = (params) => request({ ...@@ -348,6 +348,12 @@ export const existDamName = (params) => request({
348 method: 'get' 348 method: 'get'
349 }); 349 });
350 350
351 /** 获取资产目录可信空间数据下拉列表 */
352 export const getRegisterCatalogProductList = () => request({
353 url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/get-external-product`,
354 method: 'get'
355 });
356
351 // 获取数据产品目录登记评估详情 357 // 获取数据产品目录登记评估详情
352 export const getRegisterCatalogDetailGuids = (params) => request({ 358 export const getRegisterCatalogDetailGuids = (params) => request({
353 url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/register-evaluation-grounding-trading`, 359 url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/register-evaluation-grounding-trading`,
......
...@@ -23,14 +23,14 @@ import { ...@@ -23,14 +23,14 @@ import {
23 registerCatalogTableDelete, 23 registerCatalogTableDelete,
24 getRegisterCatalogTableList, 24 getRegisterCatalogTableList,
25 checkDamTableChange, 25 checkDamTableChange,
26 getTenantList 26 getTenantList,
27 getRegisterCatalogProductList
27 } from "@/api/modules/dataAsset"; 28 } from "@/api/modules/dataAsset";
28 import { ContentWrap } from '@/components/ContentWrap'; 29 import { ContentWrap } from '@/components/ContentWrap';
29 import importTableField from "./importTableField.vue"; 30 import importTableField from "./importTableField.vue";
30 import { useValidator } from '@/hooks/useValidator'; 31 import { useValidator } from '@/hooks/useValidator';
31 import useDataAssetStore from "@/store/modules/dataAsset"; 32 import useDataAssetStore from "@/store/modules/dataAsset";
32 import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common'; 33 import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common';
33 import { ElMessage } from 'element-plus';
34 34
35 const { proxy } = getCurrentInstance() as any; 35 const { proxy } = getCurrentInstance() as any;
36 const { required, checkExistName } = useValidator(); 36 const { required, checkExistName } = useValidator();
...@@ -103,17 +103,26 @@ const baseInfoExpand = ref(true); ...@@ -103,17 +103,26 @@ const baseInfoExpand = ref(true);
103 const assetTableInfoExpand = ref(true); 103 const assetTableInfoExpand = ref(true);
104 const importTableFieldRef = ref(); 104 const importTableFieldRef = ref();
105 const rightMainTenantList: any = ref([]); //权利主体下拉列表选择 105 const rightMainTenantList: any = ref([]); //权利主体下拉列表选择
106 const catalogProductList: any = ref([]); //获取资产目录可信空间数据下拉列表
106 const baseInfoFormRef = ref(); 107 const baseInfoFormRef = ref();
107 108
108 const baseInfoFormItems = ref([ 109 const baseInfoFormItems = ref([
109 { 110 {
110 label: '资源名称', 111 label: '资源名称',
111 type: 'input', 112 type: 'select',
112 placeholder: '请输入', 113 placeholder: '请输入',
113 field: 'damName', 114 field: 'damName',
114 maxlength: 50, 115 maxlength: 50,
115 default: '', 116 default: '',
116 required: true 117 required: true,
118 options: catalogProductList.value,
119 allowCreate: true,
120 filterable: true,
121 props: {
122 value: 'productId',
123 label: 'productName'
124 },
125 clearable: true,
117 }, 126 },
118 { 127 {
119 label: '资源类型', 128 label: '资源类型',
...@@ -496,6 +505,12 @@ const baseSelectChange = (val, item, row) => { ...@@ -496,6 +505,12 @@ const baseSelectChange = (val, item, row) => {
496 setFormItems(row); 505 setFormItems(row);
497 } 506 }
498 } 507 }
508 } else if (item.field == 'damName') {
509 let item = catalogProductList.value.find(c => c.productId == val);
510 if (item?.description) {
511 row.propertyDescription = item?.description;
512 setFormItems(row);
513 }
499 } 514 }
500 } 515 }
501 516
...@@ -555,6 +570,18 @@ onBeforeMount(() => { ...@@ -555,6 +570,18 @@ onBeforeMount(() => {
555 detailInfo.value = res.data || {}; 570 detailInfo.value = res.data || {};
556 baseInfoFormItems.value.forEach((item: any) => { 571 baseInfoFormItems.value.forEach((item: any) => {
557 item.default = detailInfo.value[item.field] == null ? '' : detailInfo.value[item.field]; 572 item.default = detailInfo.value[item.field] == null ? '' : detailInfo.value[item.field];
573 if (item.field == 'damName') {
574 if (detailInfo.value?.productCode) {
575 let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
576 if (!item) {
577 item.default = detailInfo.value.damName;
578 } else {
579 item.default = item.productCode;
580 }
581 } else {
582 item.default = detailInfo.value.damName;
583 }
584 }
558 if (item.field == 'subjectDomain') { 585 if (item.field == 'subjectDomain') {
559 let tree = detailInfo.value.subjectDomainTree?.[0]; 586 let tree = detailInfo.value.subjectDomainTree?.[0];
560 if (tree) { 587 if (tree) {
...@@ -641,6 +668,21 @@ onBeforeMount(() => { ...@@ -641,6 +668,21 @@ onBeforeMount(() => {
641 } 668 }
642 }) 669 })
643 } 670 }
671 getRegisterCatalogProductList().then((res: any) => {
672 catalogProductList.value = [];
673 if (res.code == proxy.$passCode) {
674 catalogProductList.value = res.data || [];
675 baseInfoFormItems.value[0].options = catalogProductList.value;
676 if (detailInfo.value?.productCode) {
677 let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
678 if (!item) {
679 baseInfoFormItems.value[0].default = detailInfo.value.damName;
680 }
681 }
682 } else {
683 proxy.$ElMessage.error(res.msg);
684 }
685 })
644 686
645 function replaceChildDictListKey(data) { 687 function replaceChildDictListKey(data) {
646 if (Array.isArray(data)) { 688 if (Array.isArray(data)) {
...@@ -693,6 +735,19 @@ const save = () => { ...@@ -693,6 +735,19 @@ const save = () => {
693 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => { 735 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
694 if (valid) { 736 if (valid) {
695 let params = { ...baseInfoFormRef.value.formInline }; 737 let params = { ...baseInfoFormRef.value.formInline };
738 let item = catalogProductList.value.find(c => c.productId == params.damName);
739 if (item) {
740 params.productCode = item.productId;
741 params.damName = item.productName;
742 params.foundMode = 5;
743 } else {
744 params.damName = params.damName;
745 if (params.damName.length > 50) {
746 proxy.$ElMessage.error('资源名称的长度不能超过50');
747 baseInfoExpand.value = true;
748 return;
749 }
750 }
696 /** 只有数据集和api类型时,目录表必填。 */ 751 /** 只有数据集和api类型时,目录表必填。 */
697 if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') { 752 if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') {
698 if (!params.databaseType) { 753 if (!params.databaseType) {
......
...@@ -1137,9 +1137,9 @@ const btnClick = (btn) => { ...@@ -1137,9 +1137,9 @@ const btnClick = (btn) => {
1137 const setFormItems = (row: any = null, isDetail = false) => { 1137 const setFormItems = (row: any = null, isDetail = false) => {
1138 console.log(row, '--------1---------'); 1138 console.log(row, '--------1---------');
1139 formInfo.value.items.forEach((item: any) => { 1139 formInfo.value.items.forEach((item: any) => {
1140 if (item.field == 'damType') { 1140 // if (item.field == 'damType') { //不需要此需求
1141 item.disabled = row.foundMode != 5; 1141 // item.disabled = row.foundMode != 5;
1142 } 1142 // }
1143 if (item.field == 'productImg') { 1143 if (item.field == 'productImg') {
1144 // item.default = row ? (row.productPic ? [row.productPic] : row[item.field] || []) : [] 1144 // item.default = row ? (row.productPic ? [row.productPic] : row[item.field] || []) : []
1145 item.default = row.productPic && Object.keys(row.productPic).length ? [row.productPic] : [] 1145 item.default = row.productPic && Object.keys(row.productPic).length ? [row.productPic] : []
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!