662c9c39 by lihua

产品支持上传文件

1 parent f9f62ee9
...@@ -426,6 +426,35 @@ const baseInfoFormItems = ref([ ...@@ -426,6 +426,35 @@ const baseInfoFormItems = ref([
426 required: true, 426 required: true,
427 }, 427 },
428 { 428 {
429 label: '是否文件资源',
430 type: 'radio-group',
431 placeholder: '',
432 field: 'isFileResource',
433 block: false,
434 disabled: false,
435 default: 'N',
436 options: [{
437 value: 'Y',
438 label: '是'
439 }, {
440 value: 'N',
441 label: '否'
442 }],
443 required: true,
444 },
445 {
446 label: '选择文件上传',
447 tip: '',
448 type: 'upload-file',
449 accept: '',
450 required: true,
451 default: [],
452 block: false,
453 field: 'attachments',
454 col: 'col2',
455 visible: false,
456 },
457 {
429 label: '资源描述', 458 label: '资源描述',
430 type: 'textarea', 459 type: 'textarea',
431 placeholder: '该数据资源主要包含的信息,数据更新方式等。', 460 placeholder: '该数据资源主要包含的信息,数据更新方式等。',
...@@ -496,7 +525,16 @@ const baseInfoFormRules = ref({ ...@@ -496,7 +525,16 @@ const baseInfoFormRules = ref({
496 domain: [required('请选择领域')], 525 domain: [required('请选择领域')],
497 scenario: [required('请选择应用场景')], 526 scenario: [required('请选择应用场景')],
498 medDepartmentCode: [required('请选择所属科室')], 527 medDepartmentCode: [required('请选择所属科室')],
499 updateFrequency: [required('请选择更新频率')] 528 updateFrequency: [required('请选择更新频率')],
529 attachments: [{
530 validator: (rule: any, value: any, callback: any) => {
531 if (!value?.length) {
532 callback(new Error('请上传文件'))
533 } else {
534 callback();
535 }
536 }, trigger: 'change'
537 }]
500 }); 538 });
501 539
502 const getTableFieldPromise: any = ref({}); 540 const getTableFieldPromise: any = ref({});
...@@ -665,6 +703,9 @@ const setFormItems = (val) => { ...@@ -665,6 +703,9 @@ const setFormItems = (val) => {
665 item.visible = val['domain'] == '003' 703 item.visible = val['domain'] == '003'
666 } else if (item.field == 'subjectDomain') { 704 } else if (item.field == 'subjectDomain') {
667 item.visible = val['domain'] == '004'; 705 item.visible = val['domain'] == '004';
706 } else if (item.field == 'attachments') {
707 item.visible = val['isFileResource'] == 'Y';
708 item.default = val[item.field] || [];
668 } 709 }
669 }); 710 });
670 } 711 }
...@@ -693,6 +734,12 @@ const handleBaseInfoCheckboxChange = (val, info) => { ...@@ -693,6 +734,12 @@ const handleBaseInfoCheckboxChange = (val, info) => {
693 setFormItems(info); 734 setFormItems(info);
694 } 735 }
695 736
737 const handleBaseInfoRadioChange = (val, info, item) => {
738 if (item.field == 'isFileResource') {
739 setFormItems(info);
740 }
741 }
742
696 /** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */ 743 /** ------------------- 添加选择数据服务API表格,多选 ---------------------------- */
697 const productTableRef = ref(); 744 const productTableRef = ref();
698 const productData: any = ref([]); 745 const productData: any = ref([]);
...@@ -881,6 +928,11 @@ onBeforeMount(() => { ...@@ -881,6 +928,11 @@ onBeforeMount(() => {
881 item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || [] 928 item.options = domainDictList.value.find(s => s.value == detailInfo.value['domain'])?.childDictList || []
882 } else if (item.field == 'medDepartmentCode') { 929 } else if (item.field == 'medDepartmentCode') {
883 item.visible = detailInfo.value['domain'] == '003' 930 item.visible = detailInfo.value['domain'] == '003'
931 } else if (item.field == 'isFileResource') {
932 item.default = detailInfo.value.attachments?.length ? 'Y' : 'N';
933 } else if (item.field == 'attachments') {
934 item.default = detailInfo.value.attachments || [];
935 item.visible = item.default.length > 0;
884 } 936 }
885 if (item.field == 'isCache' || item.field == 'isEncrypField') { 937 if (item.field == 'isCache' || item.field == 'isEncrypField') {
886 item.disabled = true; 938 item.disabled = true;
...@@ -1035,40 +1087,48 @@ const save = () => { ...@@ -1035,40 +1087,48 @@ const save = () => {
1035 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => { 1087 baseInfoFormRef.value?.ruleFormRef?.validate((valid, errorItem) => {
1036 if (valid) { 1088 if (valid) {
1037 let params = { ...baseInfoFormRef.value.formInline }; 1089 let params = { ...baseInfoFormRef.value.formInline };
1038 let associationApiList: string[] = []; 1090 if (params.isFileResource != 'Y') {
1039 for (const api of productData.value) { 1091 let associationApiList: string[] = [];
1040 if (!api.apiGuid) { 1092 for (const api of productData.value) {
1041 proxy.$ElMessage.error('服务包信息未填写完整'); 1093 if (!api.apiGuid) {
1042 expandServiceInfo.value = true; 1094 proxy.$ElMessage.error('服务包信息未填写完整');
1043 return; 1095 expandServiceInfo.value = true;
1096 return;
1097 }
1098 associationApiList.push(api.apiGuid);
1044 } 1099 }
1045 associationApiList.push(api.apiGuid); 1100 params.associationApi = associationApiList;
1046 } 1101 /** 只有数据集和api类型时,目录表必填。 */
1047 params.associationApi = associationApiList; 1102 if ((params.damType == '1') && route.query.foundMode != '2') {
1048 /** 只有数据集和api类型时,目录表必填。 */ 1103 // if (!params.databaseType) {
1049 if ((params.damType == '1') && route.query.foundMode != '2') { 1104 // proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填');
1050 // if (!params.databaseType) { 1105 // baseInfoExpand.value = true;
1051 // proxy.$ElMessage.error('资源类型为数据集时,数据库类型必填'); 1106 // return;
1052 // baseInfoExpand.value = true; 1107 // }
1053 // return; 1108 if (!assetDataTableInfo.value.data?.length) {
1054 // } 1109 proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表');
1055 if (!assetDataTableInfo.value.data?.length) { 1110 assetTableInfoExpand.value = true;
1056 proxy.$ElMessage.error('资源类型为数据集时,必需添加资源表'); 1111 nextTick(() => {
1057 assetTableInfoExpand.value = true; 1112 setTimeout(() => {
1058 nextTick(() => { 1113 handleContentWrapView('tableInfo');
1059 setTimeout(() => { 1114 }, 500)
1060 handleContentWrapView('tableInfo'); 1115 });
1061 }, 500) 1116 return;
1062 }); 1117 }
1063 return;
1064 } 1118 }
1065 } 1119 if (params.damType == '2' && route.query.foundMode != '2') {
1066 if (params.damType == '2' && route.query.foundMode != '2') { 1120 if (!associationApiList?.length) {
1067 if (!associationApiList?.length) { 1121 proxy.$ElMessage.error('资源类型为数据接口时,服务包不能为空');
1068 proxy.$ElMessage.error('资源类型为数据接口时,服务包不能为空'); 1122 return;
1069 return; 1123 }
1070 } 1124 }
1071 } 1125 }
1126 params.attachments = params.attachments?.map(item => {
1127 return {
1128 name: item.name,
1129 url: item.url
1130 }
1131 }) || [];
1072 if (params.coverageArea == 'all') { 1132 if (params.coverageArea == 'all') {
1073 params.coverageArea = [['all']]; 1133 params.coverageArea = [['all']];
1074 } else if (!params.coverageArea) { 1134 } else if (!params.coverageArea) {
...@@ -1244,9 +1304,9 @@ const handleImportSave = (val) => { ...@@ -1244,9 +1304,9 @@ const handleImportSave = (val) => {
1244 <ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true" 1304 <ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true"
1245 class="mb16" @expand="(v) => baseInfoExpand = v"> 1305 class="mb16" @expand="(v) => baseInfoExpand = v">
1246 <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" 1306 <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules"
1247 @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> 1307 @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" @radio-group-change="handleBaseInfoRadioChange" col="col3" />
1248 </ContentWrap> 1308 </ContentWrap>
1249 <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2'" id="product-info" title="服务包信息" expandSwicth 1309 <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="product-info" title="服务包信息" expandSwicth
1250 style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description="" 1310 style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description=""
1251 class="mb16"> 1311 class="mb16">
1252 <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" 1312 <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table"
...@@ -1255,7 +1315,7 @@ const handleImportSave = (val) => { ...@@ -1255,7 +1315,7 @@ const handleImportSave = (val) => {
1255 <el-button :disabled="productData.length >= apiList.length" link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button> 1315 <el-button :disabled="productData.length >= apiList.length" link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button>
1256 </div> 1316 </div>
1257 </ContentWrap> 1317 </ContentWrap>
1258 <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2'" id="id-tableInfo" title="资源表" description="" 1318 <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="id-tableInfo" title="资源表" description=""
1259 :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v"> 1319 :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v">
1260 <div v-show="assetDataTableInfo.data.length" class="tools_btns"> 1320 <div v-show="assetDataTableInfo.data.length" class="tools_btns">
1261 <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> 1321 <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button>
......
...@@ -1441,7 +1441,7 @@ const respParamsTableInfo = ref({ ...@@ -1441,7 +1441,7 @@ const respParamsTableInfo = ref({
1441 </div> 1441 </div>
1442 </div> 1442 </div>
1443 </ContentWrap> 1443 </ContentWrap>
1444 <ContentWrap v-if="productTableInfo.data?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px"> 1444 <ContentWrap v-if="productTableInfo.data?.length && !detailInfo.attachments?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px">
1445 <Table ref="productTableRef" :tableInfo="productTableInfo" /> 1445 <Table ref="productTableRef" :tableInfo="productTableInfo" />
1446 </ContentWrap> 1446 </ContentWrap>
1447 <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px"> 1447 <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px">
...@@ -1454,7 +1454,59 @@ const respParamsTableInfo = ref({ ...@@ -1454,7 +1454,59 @@ const respParamsTableInfo = ref({
1454 </el-tab-pane> 1454 </el-tab-pane>
1455 </el-tabs> 1455 </el-tabs>
1456 </ContentWrap> 1456 </ContentWrap>
1457 <ContentWrap id="id-table" title="资源表" v-if="detailInfo.damCatalogTableInfo?.length" description="" 1457 <ContentWrap id="id-table" title="文件资源" v-if="detailInfo.attachments?.length" description=""
1458 style="margin: 16px 16px 16px">
1459 <div class="list_panel">
1460 <div class="list_item is_block">
1461 <div class="file_item">
1462 <span class="item_label">其它证明文件:</span>
1463 <span class="item_value">
1464 <span v-for="productDetailItem in (detailInfo.attachments || [])"
1465 :style="{ 'padding-left': '0px', height: '32px', display: 'block' }">
1466 <div class="file-operate">
1467 <template
1468 v-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'xls' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'xlsx' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'csv'">
1469 <img class="file-img" src="../../assets/images/excel.png" />
1470 </template>
1471 <template
1472 v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'doc' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'docx'">
1473 <img class="file-img" src="../../assets/images/word.png" />
1474 </template>
1475 <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'zip'">
1476 <img class="file-img" src="../../assets/images/zip.png" />
1477 </template>
1478 <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'rar'">
1479 <img class="file-img" src="../../assets/images/RAR.png" />
1480 </template>
1481 <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'pdf'">
1482 <img class="file-img" src="../../assets/images/PDF.png" />
1483 </template>
1484 <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'png'">
1485 <img class="file-img" src="../../assets/images/png.png" />
1486 </template>
1487 <template
1488 v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'jpg' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'jpeg'">
1489 <img class="file-img" src="../../assets/images/jpg.png" />
1490 </template>
1491 <div class="file-name"><ellipsis-tooltip :content="productDetailItem.name ?? ''" class-name="w100f"
1492 refName="tooltipOver"></ellipsis-tooltip></div>
1493 <div
1494 v-if="['pdf', 'png', 'jpg', 'jpeg'].includes(productDetailItem.name?.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase())"
1495 :style="{ right: '36px' }" class="file-preview" @click="onUploadFilePreview(productDetailItem)">
1496 查看
1497 </div>
1498 <div :style="{ right: '0px' }" class="file-preview"
1499 @click="onUploadFileDownload(productDetailItem)">
1500 下载
1501 </div>
1502 </div>
1503 </span>
1504 </span>
1505 </div>
1506 </div>
1507 </div>
1508 </ContentWrap>
1509 <ContentWrap id="id-table" title="资源表" v-if="detailInfo.damCatalogTableInfo?.length && !detailInfo.attachments?.length" description=""
1458 style="margin: 16px 16px 16px"> 1510 style="margin: 16px 16px 16px">
1459 <el-table v-show="!fullscreenLoading" ref="tableRef" :data="detailInfo.damCatalogTableInfo" 1511 <el-table v-show="!fullscreenLoading" ref="tableRef" :data="detailInfo.damCatalogTableInfo"
1460 :highlight-current-row="true" stripe border @expand-change="handleTableExpandChange" max-height="350" 1512 :highlight-current-row="true" stripe border @expand-change="handleTableExpandChange" max-height="350"
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!