9fbe3018 by lihua

添加数据产品下载源文件

1 parent e8f7d2ee
......@@ -60,6 +60,12 @@ export const downloadTableData = (params) => request({
responseType: 'blob'
});
/** 下载文件前的检查 */
export const downloadFileCheck = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download-file?userGuid=${params.userGuid}&fileName=${params.fileName}`,
method: 'get'
});
/** 下载数据前的检查 */
export const downloadTableDataCheck = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download-check?userGuid=${params.userGuid}&subjectGuid=${params.subjectGuid}`,
......
......@@ -444,6 +444,34 @@ const baseInfoFormItems = ref([
filterable: true,
required: false, //非必填,只能选择跟领域匹配的逻辑空间
clearable: true,
}, {
label: '是否文件资源',
type: 'radio-group',
placeholder: '',
field: 'isFileResource',
block: false,
disabled: false,
default: 'N',
options: [{
value: 'Y',
label: '是'
}, {
value: 'N',
label: '否'
}],
required: true,
},
{
label: '选择文件上传',
tip: '',
type: 'upload-file',
accept: '',
required: true,
default: [],
block: false,
field: 'attachments',
col: 'col2',
visible: false,
},
{
label: '资源描述',
......@@ -516,7 +544,16 @@ const baseInfoFormRules = ref({
domain: [required('请选择领域')],
scenario: [required('请选择应用场景')],
medDepartmentCode: [required('请选择所属科室')],
updateFrequency: [required('请选择更新频率')]
updateFrequency: [required('请选择更新频率')],
attachments: [{
validator: (rule: any, value: any, callback: any) => {
if (!value?.length) {
callback(new Error('请上传文件'))
} else {
callback();
}
}, trigger: 'change'
}]
});
const getTableFieldPromise: any = ref({});
......@@ -685,6 +722,9 @@ const setFormItems = (val) => {
item.visible = val['domain'] == '003'
} else if (item.field == 'subjectDomain') {
item.visible = val['domain'] == '004';
} else if (item.field == 'attachments') {
item.visible = val['isFileResource'] == 'Y';
item.default = val[item.field] || [];
}
});
}
......@@ -716,6 +756,12 @@ const handleBaseInfoCheckboxChange = (val, info) => {
setFormItems(info);
}
const handleBaseInfoRadioChange = (val, info, item) => {
if (item.field == 'isFileResource') {
setFormItems(info);
}
}
/** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */
const productTableRef = ref();
const productData: any = ref([]);
......@@ -922,6 +968,11 @@ onBeforeMount(() => {
item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || []
} else if (item.field == 'medDepartmentCode') {
item.visible = detailInfo.value['domain'] == '003'
} else if (item.field == 'isFileResource') {
item.default = detailInfo.value.attachments?.length ? 'Y' : 'N';
} else if (item.field == 'attachments') {
item.default = detailInfo.value.attachments || [];
item.visible = item.default.length > 0;
}
if (item.field == 'isCache' || item.field == 'isEncrypField') {
item.disabled = true;
......@@ -1081,40 +1132,48 @@ const save = () => {
baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
if (valid) {
let params = { ...baseInfoFormRef.value.formInline };
let associationApiList: string[] = [];
for (const api of productData.value) {
if (!api.apiGuid) {
proxy.$ElMessage.error('服务包信息未填写完整');
expandServiceInfo.value = true;
return;
if (params.isFileResource != 'Y') {
let associationApiList: string[] = [];
for (const api of productData.value) {
if (!api.apiGuid) {
proxy.$ElMessage.error('服务包信息未填写完整');
expandServiceInfo.value = true;
return;
}
associationApiList.push(api.apiGuid);
}
associationApiList.push(api.apiGuid);
}
params.associationApi = associationApiList;
/** 只有数据集和api类型时,目录表必填。 */
if ((params.damType == '1') && route.query.foundMode != '2') {
// if (!params.databaseType) {
// proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
// baseInfoExpand.value = true;
// return;
// }
if (!assetDataTableInfo.value.data?.length) {
proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表');
assetTableInfoExpand.value = true;
nextTick(() => {
setTimeout(() => {
handleContentWrapView('tableInfo');
}, 500)
});
return;
params.associationApi = associationApiList;
/** 只有数据集和api类型时,目录表必填。 */
if ((params.damType == '1') && route.query.foundMode != '2') {
// if (!params.databaseType) {
// proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
// baseInfoExpand.value = true;
// return;
// }
if (!assetDataTableInfo.value.data?.length) {
proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表');
assetTableInfoExpand.value = true;
nextTick(() => {
setTimeout(() => {
handleContentWrapView('tableInfo');
}, 500)
});
return;
}
}
}
if (params.damType == '2' && route.query.foundMode != '2') {
if (!associationApiList?.length) {
proxy.$ElMessage.error('资源类型为数据接口时,服务包不能为空');
return;
if (params.damType == '2' && route.query.foundMode != '2') {
if (!associationApiList?.length) {
proxy.$ElMessage.error('资源类型为数据接口时,服务包不能为空');
return;
}
}
}
params.attachments = params.attachments?.map(item => {
return {
name: item.name,
url: item.url
}
}) || [];
if (params.coverageArea == 'all') {
params.coverageArea = [['all']];
} else if (!params.coverageArea) {
......@@ -1287,9 +1346,9 @@ const handleImportSave = (val) => {
<ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true"
class="mb16" @expand="(v) => baseInfoExpand = v">
<Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules"
@selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" />
@selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" @radio-group-change="handleBaseInfoRadioChange" col="col3" />
</ContentWrap>
<ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2'" id="product-info" title="服务包信息" expandSwicth
<ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="product-info" title="服务包信息" expandSwicth
style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description=""
class="mb16">
<Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table"
......@@ -1299,7 +1358,7 @@ const handleImportSave = (val) => {
v-preReClick>添加服务</el-button>
</div>
</ContentWrap>
<ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2'" id="id-tableInfo" title="资源表" description=""
<ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="id-tableInfo" title="资源表" description=""
:expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v">
<div v-show="assetDataTableInfo.data.length" class="tools_btns">
<el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!