03f23573 by lihua

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

1 parent 9a429b63
......@@ -348,6 +348,12 @@ export const existDamName = (params) => request({
method: 'get'
});
/** 获取资产目录可信空间数据下拉列表 */
export const getRegisterCatalogProductList = () => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/get-external-product`,
method: 'get'
});
// 获取数据产品目录登记评估详情
export const getRegisterCatalogDetailGuids = (params) => request({
url: `${import.meta.env.VITE_API_NEW_PORTAL}/dam-catalog-table/register-evaluation-grounding-trading`,
......
......@@ -23,14 +23,14 @@ import {
registerCatalogTableDelete,
getRegisterCatalogTableList,
checkDamTableChange,
getTenantList
getTenantList,
getRegisterCatalogProductList
} from "@/api/modules/dataAsset";
import { ContentWrap } from '@/components/ContentWrap';
import importTableField from "./importTableField.vue";
import { useValidator } from '@/hooks/useValidator';
import useDataAssetStore from "@/store/modules/dataAsset";
import { handleContentWrapView, scrollLastRowToView, changeNum } from '@/utils/common';
import { ElMessage } from 'element-plus';
const { proxy } = getCurrentInstance() as any;
const { required, checkExistName } = useValidator();
......@@ -103,17 +103,26 @@ const baseInfoExpand = ref(true);
const assetTableInfoExpand = ref(true);
const importTableFieldRef = ref();
const rightMainTenantList: any = ref([]); //权利主体下拉列表选择
const catalogProductList: any = ref([]); //获取资产目录可信空间数据下拉列表
const baseInfoFormRef = ref();
const baseInfoFormItems = ref([
{
label: '资源名称',
type: 'input',
type: 'select',
placeholder: '请输入',
field: 'damName',
maxlength: 50,
default: '',
required: true
required: true,
options: catalogProductList.value,
allowCreate: true,
filterable: true,
props: {
value: 'productId',
label: 'productName'
},
clearable: true,
},
{
label: '资源类型',
......@@ -496,6 +505,12 @@ const baseSelectChange = (val, item, row) => {
setFormItems(row);
}
}
} else if (item.field == 'damName') {
let item = catalogProductList.value.find(c => c.productId == val);
if (item?.description) {
row.propertyDescription = item?.description;
setFormItems(row);
}
}
}
......@@ -555,6 +570,18 @@ onBeforeMount(() => {
detailInfo.value = res.data || {};
baseInfoFormItems.value.forEach((item: any) => {
item.default = detailInfo.value[item.field] == null ? '' : detailInfo.value[item.field];
if (item.field == 'damName') {
if (detailInfo.value?.productCode) {
let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
if (!item) {
item.default = detailInfo.value.damName;
} else {
item.default = item.productCode;
}
} else {
item.default = detailInfo.value.damName;
}
}
if (item.field == 'subjectDomain') {
let tree = detailInfo.value.subjectDomainTree?.[0];
if (tree) {
......@@ -641,6 +668,21 @@ onBeforeMount(() => {
}
})
}
getRegisterCatalogProductList().then((res: any) => {
catalogProductList.value = [];
if (res.code == proxy.$passCode) {
catalogProductList.value = res.data || [];
baseInfoFormItems.value[0].options = catalogProductList.value;
if (detailInfo.value?.productCode) {
let item = catalogProductList.value.find(c => c.productId == detailInfo.value?.productCode);
if (!item) {
baseInfoFormItems.value[0].default = detailInfo.value.damName;
}
}
} else {
proxy.$ElMessage.error(res.msg);
}
})
function replaceChildDictListKey(data) {
if (Array.isArray(data)) {
......@@ -693,6 +735,19 @@ const save = () => {
baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
let params = { ...baseInfoFormRef.value.formInline };
let item = catalogProductList.value.find(c => c.productId == params.damName);
if (item) {
params.productCode = item.productId;
params.damName = item.productName;
params.foundMode = 5;
} else {
params.damName = params.damName;
if (params.damName.length > 50) {
proxy.$ElMessage.error('资源名称的长度不能超过50');
baseInfoExpand.value = true;
return;
}
}
/** 只有数据集和api类型时,目录表必填。 */
if ((params.damType == '1' || params.damType == '2') && route.query.foundMode != '2') {
if (!params.databaseType) {
......
......@@ -1139,9 +1139,9 @@ const btnClick = (btn) => {
const setFormItems = (row: any = null, isDetail = false) => {
// console.log(row, '--------1---------');
formInfo.value.items.forEach((item: any) => {
if (item.field == 'damType') {
item.disabled = row.foundMode != 5;
}
// if (item.field == 'damType') { //不需要此需求
// item.disabled = row.foundMode != 5;
// }
if (item.field == 'productImg') {
// item.default = row ? (row.productPic ? [row.productPic] : row[item.field] || []) : []
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!