添加数据产品下载源文件
Showing
3 changed files
with
99 additions
and
34 deletions
| ... | @@ -60,6 +60,12 @@ export const downloadTableData = (params) => request({ | ... | @@ -60,6 +60,12 @@ export const downloadTableData = (params) => request({ |
| 60 | responseType: 'blob' | 60 | responseType: 'blob' |
| 61 | }); | 61 | }); |
| 62 | 62 | ||
| 63 | /** 下载文件前的检查 */ | ||
| 64 | export const downloadFileCheck = (params) => request({ | ||
| 65 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download-file?userGuid=${params.userGuid}&fileName=${params.fileName}`, | ||
| 66 | method: 'get' | ||
| 67 | }); | ||
| 68 | |||
| 63 | /** 下载数据前的检查 */ | 69 | /** 下载数据前的检查 */ |
| 64 | export const downloadTableDataCheck = (params) => request({ | 70 | export const downloadTableDataCheck = (params) => request({ |
| 65 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download-check?userGuid=${params.userGuid}&subjectGuid=${params.subjectGuid}`, | 71 | 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([ | ... | @@ -444,6 +444,34 @@ const baseInfoFormItems = ref([ |
| 444 | filterable: true, | 444 | filterable: true, |
| 445 | required: false, //非必填,只能选择跟领域匹配的逻辑空间 | 445 | required: false, //非必填,只能选择跟领域匹配的逻辑空间 |
| 446 | clearable: true, | 446 | clearable: true, |
| 447 | }, { | ||
| 448 | label: '是否文件资源', | ||
| 449 | type: 'radio-group', | ||
| 450 | placeholder: '', | ||
| 451 | field: 'isFileResource', | ||
| 452 | block: false, | ||
| 453 | disabled: false, | ||
| 454 | default: 'N', | ||
| 455 | options: [{ | ||
| 456 | value: 'Y', | ||
| 457 | label: '是' | ||
| 458 | }, { | ||
| 459 | value: 'N', | ||
| 460 | label: '否' | ||
| 461 | }], | ||
| 462 | required: true, | ||
| 463 | }, | ||
| 464 | { | ||
| 465 | label: '选择文件上传', | ||
| 466 | tip: '', | ||
| 467 | type: 'upload-file', | ||
| 468 | accept: '', | ||
| 469 | required: true, | ||
| 470 | default: [], | ||
| 471 | block: false, | ||
| 472 | field: 'attachments', | ||
| 473 | col: 'col2', | ||
| 474 | visible: false, | ||
| 447 | }, | 475 | }, |
| 448 | { | 476 | { |
| 449 | label: '资源描述', | 477 | label: '资源描述', |
| ... | @@ -516,7 +544,16 @@ const baseInfoFormRules = ref({ | ... | @@ -516,7 +544,16 @@ const baseInfoFormRules = ref({ |
| 516 | domain: [required('请选择领域')], | 544 | domain: [required('请选择领域')], |
| 517 | scenario: [required('请选择应用场景')], | 545 | scenario: [required('请选择应用场景')], |
| 518 | medDepartmentCode: [required('请选择所属科室')], | 546 | medDepartmentCode: [required('请选择所属科室')], |
| 519 | updateFrequency: [required('请选择更新频率')] | 547 | updateFrequency: [required('请选择更新频率')], |
| 548 | attachments: [{ | ||
| 549 | validator: (rule: any, value: any, callback: any) => { | ||
| 550 | if (!value?.length) { | ||
| 551 | callback(new Error('请上传文件')) | ||
| 552 | } else { | ||
| 553 | callback(); | ||
| 554 | } | ||
| 555 | }, trigger: 'change' | ||
| 556 | }] | ||
| 520 | }); | 557 | }); |
| 521 | 558 | ||
| 522 | const getTableFieldPromise: any = ref({}); | 559 | const getTableFieldPromise: any = ref({}); |
| ... | @@ -685,6 +722,9 @@ const setFormItems = (val) => { | ... | @@ -685,6 +722,9 @@ const setFormItems = (val) => { |
| 685 | item.visible = val['domain'] == '003' | 722 | item.visible = val['domain'] == '003' |
| 686 | } else if (item.field == 'subjectDomain') { | 723 | } else if (item.field == 'subjectDomain') { |
| 687 | item.visible = val['domain'] == '004'; | 724 | item.visible = val['domain'] == '004'; |
| 725 | } else if (item.field == 'attachments') { | ||
| 726 | item.visible = val['isFileResource'] == 'Y'; | ||
| 727 | item.default = val[item.field] || []; | ||
| 688 | } | 728 | } |
| 689 | }); | 729 | }); |
| 690 | } | 730 | } |
| ... | @@ -716,6 +756,12 @@ const handleBaseInfoCheckboxChange = (val, info) => { | ... | @@ -716,6 +756,12 @@ const handleBaseInfoCheckboxChange = (val, info) => { |
| 716 | setFormItems(info); | 756 | setFormItems(info); |
| 717 | } | 757 | } |
| 718 | 758 | ||
| 759 | const handleBaseInfoRadioChange = (val, info, item) => { | ||
| 760 | if (item.field == 'isFileResource') { | ||
| 761 | setFormItems(info); | ||
| 762 | } | ||
| 763 | } | ||
| 764 | |||
| 719 | /** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */ | 765 | /** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */ |
| 720 | const productTableRef = ref(); | 766 | const productTableRef = ref(); |
| 721 | const productData: any = ref([]); | 767 | const productData: any = ref([]); |
| ... | @@ -922,6 +968,11 @@ onBeforeMount(() => { | ... | @@ -922,6 +968,11 @@ onBeforeMount(() => { |
| 922 | item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || [] | 968 | item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || [] |
| 923 | } else if (item.field == 'medDepartmentCode') { | 969 | } else if (item.field == 'medDepartmentCode') { |
| 924 | item.visible = detailInfo.value['domain'] == '003' | 970 | item.visible = detailInfo.value['domain'] == '003' |
| 971 | } else if (item.field == 'isFileResource') { | ||
| 972 | item.default = detailInfo.value.attachments?.length ? 'Y' : 'N'; | ||
| 973 | } else if (item.field == 'attachments') { | ||
| 974 | item.default = detailInfo.value.attachments || []; | ||
| 975 | item.visible = item.default.length > 0; | ||
| 925 | } | 976 | } |
| 926 | if (item.field == 'isCache' || item.field == 'isEncrypField') { | 977 | if (item.field == 'isCache' || item.field == 'isEncrypField') { |
| 927 | item.disabled = true; | 978 | item.disabled = true; |
| ... | @@ -1081,40 +1132,48 @@ const save = () => { | ... | @@ -1081,40 +1132,48 @@ const save = () => { |
| 1081 | baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => { | 1132 | baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => { |
| 1082 | if (valid) { | 1133 | if (valid) { |
| 1083 | let params = { ...baseInfoFormRef.value.formInline }; | 1134 | let params = { ...baseInfoFormRef.value.formInline }; |
| 1084 | let associationApiList: string[] = []; | 1135 | if (params.isFileResource != 'Y') { |
| 1085 | for (const api of productData.value) { | 1136 | let associationApiList: string[] = []; |
| 1086 | if (!api.apiGuid) { | 1137 | for (const api of productData.value) { |
| 1087 | proxy.$ElMessage.error('服务包信息未填写完整'); | 1138 | if (!api.apiGuid) { |
| 1088 | expandServiceInfo.value = true; | 1139 | proxy.$ElMessage.error('服务包信息未填写完整'); |
| 1089 | return; | 1140 | expandServiceInfo.value = true; |
| 1141 | return; | ||
| 1142 | } | ||
| 1143 | associationApiList.push(api.apiGuid); | ||
| 1090 | } | 1144 | } |
| 1091 | associationApiList.push(api.apiGuid); | 1145 | params.associationApi = associationApiList; |
| 1092 | } | 1146 | /** 只有数据集和api类型时,目录表必填。 */ |
| 1093 | params.associationApi = associationApiList; | 1147 | if ((params.damType == '1') && route.query.foundMode != '2') { |
| 1094 | /** 只有数据集和api类型时,目录表必填。 */ | 1148 | // if (!params.databaseType) { |
| 1095 | if ((params.damType == '1') && route.query.foundMode != '2') { | 1149 | // proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填'); |
| 1096 | // if (!params.databaseType) { | 1150 | // baseInfoExpand.value = true; |
| 1097 | // proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填'); | 1151 | // return; |
| 1098 | // baseInfoExpand.value = true; | 1152 | // } |
| 1099 | // return; | 1153 | if (!assetDataTableInfo.value.data?.length) { |
| 1100 | // } | 1154 | proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表'); |
| 1101 | if (!assetDataTableInfo.value.data?.length) { | 1155 | assetTableInfoExpand.value = true; |
| 1102 | proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表'); | 1156 | nextTick(() => { |
| 1103 | assetTableInfoExpand.value = true; | 1157 | setTimeout(() => { |
| 1104 | nextTick(() => { | 1158 | handleContentWrapView('tableInfo'); |
| 1105 | setTimeout(() => { | 1159 | }, 500) |
| 1106 | handleContentWrapView('tableInfo'); | 1160 | }); |
| 1107 | }, 500) | 1161 | return; |
| 1108 | }); | 1162 | } |
| 1109 | return; | ||
| 1110 | } | 1163 | } |
| 1111 | } | 1164 | if (params.damType == '2' && route.query.foundMode != '2') { |
| 1112 | if (params.damType == '2' && route.query.foundMode != '2') { | 1165 | if (!associationApiList?.length) { |
| 1113 | if (!associationApiList?.length) { | 1166 | proxy.$ElMessage.error('资源类型为数据接口时,服务包不能为空'); |
| 1114 | proxy.$ElMessage.error('资源类型为数据接口时,服务包不能为空'); | 1167 | return; |
| 1115 | return; | 1168 | } |
| 1116 | } | 1169 | } |
| 1117 | } | 1170 | } |
| 1171 | params.attachments = params.attachments?.map(item => { | ||
| 1172 | return { | ||
| 1173 | name: item.name, | ||
| 1174 | url: item.url | ||
| 1175 | } | ||
| 1176 | }) || []; | ||
| 1118 | if (params.coverageArea == 'all') { | 1177 | if (params.coverageArea == 'all') { |
| 1119 | params.coverageArea = [['all']]; | 1178 | params.coverageArea = [['all']]; |
| 1120 | } else if (!params.coverageArea) { | 1179 | } else if (!params.coverageArea) { |
| ... | @@ -1287,9 +1346,9 @@ const handleImportSave = (val) => { | ... | @@ -1287,9 +1346,9 @@ const handleImportSave = (val) => { |
| 1287 | <ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true" | 1346 | <ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true" |
| 1288 | class="mb16" @expand="(v) => baseInfoExpand = v"> | 1347 | class="mb16" @expand="(v) => baseInfoExpand = v"> |
| 1289 | <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" | 1348 | <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" |
| 1290 | @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> | 1349 | @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" @radio-group-change="handleBaseInfoRadioChange" col="col3" /> |
| 1291 | </ContentWrap> | 1350 | </ContentWrap> |
| 1292 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2'" id="product-info" title="服务包信息" expandSwicth | 1351 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="product-info" title="服务包信息" expandSwicth |
| 1293 | style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description="" | 1352 | style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description="" |
| 1294 | class="mb16"> | 1353 | class="mb16"> |
| 1295 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" | 1354 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" |
| ... | @@ -1299,7 +1358,7 @@ const handleImportSave = (val) => { | ... | @@ -1299,7 +1358,7 @@ const handleImportSave = (val) => { |
| 1299 | v-preReClick>添加服务</el-button> | 1358 | v-preReClick>添加服务</el-button> |
| 1300 | </div> | 1359 | </div> |
| 1301 | </ContentWrap> | 1360 | </ContentWrap> |
| 1302 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2'" id="id-tableInfo" title="资源表" description="" | 1361 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="id-tableInfo" title="资源表" description="" |
| 1303 | :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v"> | 1362 | :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v"> |
| 1304 | <div v-show="assetDataTableInfo.data.length" class="tools_btns"> | 1363 | <div v-show="assetDataTableInfo.data.length" class="tools_btns"> |
| 1305 | <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> | 1364 | <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> | ... | ... |
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment