产品支持上传文件
Showing
2 changed files
with
122 additions
and
8 deletions
| ... | @@ -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,6 +1087,7 @@ const save = () => { | ... | @@ -1035,6 +1087,7 @@ 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 }; |
| 1090 | if (params.isFileResource != 'Y') { | ||
| 1038 | let associationApiList: string[] = []; | 1091 | let associationApiList: string[] = []; |
| 1039 | for (const api of productData.value) { | 1092 | for (const api of productData.value) { |
| 1040 | if (!api.apiGuid) { | 1093 | if (!api.apiGuid) { |
| ... | @@ -1069,6 +1122,13 @@ const save = () => { | ... | @@ -1069,6 +1122,13 @@ const save = () => { |
| 1069 | return; | 1122 | return; |
| 1070 | } | 1123 | } |
| 1071 | } | 1124 | } |
| 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) { |
| ... | @@ -1241,9 +1301,9 @@ const handleImportSave = (val) => { | ... | @@ -1241,9 +1301,9 @@ const handleImportSave = (val) => { |
| 1241 | <ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true" | 1301 | <ContentWrap id="id-baseInfo" title="资源基本信息" description="" :isExpand="baseInfoExpand" :expand-swicth="true" |
| 1242 | class="mb16" @expand="(v) => baseInfoExpand = v"> | 1302 | class="mb16" @expand="(v) => baseInfoExpand = v"> |
| 1243 | <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" | 1303 | <Form ref="baseInfoFormRef" :itemList="baseInfoFormItems" formId="base-info-form" :rules="baseInfoFormRules" |
| 1244 | @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" col="col3" /> | 1304 | @selectChange="baseSelectChange" @checkboxChange="handleBaseInfoCheckboxChange" @radio-group-change="handleBaseInfoRadioChange" col="col3" /> |
| 1245 | </ContentWrap> | 1305 | </ContentWrap> |
| 1246 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2'" id="product-info" title="服务包信息" expandSwicth | 1306 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType == '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="product-info" title="服务包信息" expandSwicth |
| 1247 | style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description="" | 1307 | style="margin-top: 15px" :isExpand="expandServiceInfo" @expand="(v) => (expandServiceInfo = v)" description="" |
| 1248 | class="mb16"> | 1308 | class="mb16"> |
| 1249 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" | 1309 | <Table ref="productTableRef" :tableInfo="productTableInfo" class="fiveRow-table" |
| ... | @@ -1252,7 +1312,7 @@ const handleImportSave = (val) => { | ... | @@ -1252,7 +1312,7 @@ const handleImportSave = (val) => { |
| 1252 | <el-button :disabled="productData.length >= apiList.length" link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button> | 1312 | <el-button :disabled="productData.length >= apiList.length" link @click="addProduct" :icon="CirclePlus" v-preReClick>添加服务</el-button> |
| 1253 | </div> | 1313 | </div> |
| 1254 | </ContentWrap> | 1314 | </ContentWrap> |
| 1255 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2'" id="id-tableInfo" title="资源表" description="" | 1315 | <ContentWrap v-if="baseInfoFormRef?.formInline?.damType != '2' && baseInfoFormRef?.formInline?.isFileResource != 'Y'" id="id-tableInfo" title="资源表" description="" |
| 1256 | :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v"> | 1316 | :expand-swicth="true" :isExpand="assetTableInfoExpand" @expand="(v) => assetTableInfoExpand = v"> |
| 1257 | <div v-show="assetDataTableInfo.data.length" class="tools_btns"> | 1317 | <div v-show="assetDataTableInfo.data.length" class="tools_btns"> |
| 1258 | <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> | 1318 | <el-button type="primary" @click="handleCreateTable" v-preReClick>添加</el-button> | ... | ... |
| ... | @@ -1444,7 +1444,7 @@ const respParamsTableInfo = ref({ | ... | @@ -1444,7 +1444,7 @@ const respParamsTableInfo = ref({ |
| 1444 | </div> | 1444 | </div> |
| 1445 | </div> | 1445 | </div> |
| 1446 | </ContentWrap> | 1446 | </ContentWrap> |
| 1447 | <ContentWrap v-if="productTableInfo.data?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px"> | 1447 | <ContentWrap v-if="productTableInfo.data?.length && !detailInfo.attachments?.length" id="product-info" title="服务包信息" style="margin: 16px 16px 16px"> |
| 1448 | <Table ref="productTableRef" :tableInfo="productTableInfo" /> | 1448 | <Table ref="productTableRef" :tableInfo="productTableInfo" /> |
| 1449 | </ContentWrap> | 1449 | </ContentWrap> |
| 1450 | <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px"> | 1450 | <ContentWrap v-if="isJSZQ" id="id-paramsInfo" title="入参出参信息" description="" style="margin: 16px 16px 16px"> |
| ... | @@ -1457,7 +1457,57 @@ const respParamsTableInfo = ref({ | ... | @@ -1457,7 +1457,57 @@ const respParamsTableInfo = ref({ |
| 1457 | </el-tab-pane> | 1457 | </el-tab-pane> |
| 1458 | </el-tabs> | 1458 | </el-tabs> |
| 1459 | </ContentWrap> | 1459 | </ContentWrap> |
| 1460 | <ContentWrap id="id-table" title="资源表" v-if="detailInfo.damCatalogTableInfo?.length" description="" | 1460 | <ContentWrap id="id-table" title="文件资源" v-if="detailInfo.attachments?.length" description="" |
| 1461 | style="margin: 16px 16px 16px"> | ||
| 1462 | <div class="list_panel"> | ||
| 1463 | <div class="list_item is_block"> | ||
| 1464 | <div class="file_item"> | ||
| 1465 | <span class="item_label">上传文件:</span> | ||
| 1466 | <span class="item_value"> | ||
| 1467 | <span v-for="productDetailItem in (detailInfo.attachments || [])" | ||
| 1468 | :style="{ 'padding-left': '0px', height: '32px', display: 'block' }"> | ||
| 1469 | <div class="file-operate"> | ||
| 1470 | <template | ||
| 1471 | 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'"> | ||
| 1472 | <img class="file-img" src="../../assets/images/excel.png" /> | ||
| 1473 | </template> | ||
| 1474 | <template | ||
| 1475 | v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'doc' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'docx'"> | ||
| 1476 | <img class="file-img" src="../../assets/images/word.png" /> | ||
| 1477 | </template> | ||
| 1478 | <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'zip'"> | ||
| 1479 | <img class="file-img" src="../../assets/images/zip.png" /> | ||
| 1480 | </template> | ||
| 1481 | <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'rar'"> | ||
| 1482 | <img class="file-img" src="../../assets/images/RAR.png" /> | ||
| 1483 | </template> | ||
| 1484 | <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'pdf'"> | ||
| 1485 | <img class="file-img" src="../../assets/images/PDF.png" /> | ||
| 1486 | </template> | ||
| 1487 | <template v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'png'"> | ||
| 1488 | <img class="file-img" src="../../assets/images/png.png" /> | ||
| 1489 | </template> | ||
| 1490 | <template | ||
| 1491 | v-else-if="productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'jpg' || productDetailItem.name.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase() == 'jpeg'"> | ||
| 1492 | <img class="file-img" src="../../assets/images/jpg.png" /> | ||
| 1493 | </template> | ||
| 1494 | <div class="file-name"><ellipsis-tooltip :content="productDetailItem.name ?? ''" class-name="w100f" | ||
| 1495 | refName="tooltipOver"></ellipsis-tooltip></div> | ||
| 1496 | <div | ||
| 1497 | v-if="foundMode != 'download' && ['pdf', 'png', 'jpg', 'jpeg'].includes(productDetailItem.name?.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase())" | ||
| 1498 | :style="{ right: '36px' }" class="file-preview" @click="onUploadFilePreview(productDetailItem)"> | ||
| 1499 | 查看 | ||
| 1500 | </div> | ||
| 1501 | <div :style="{ right: '0px' }" class="file-preview" v-if="foundMode == 'download' || foundMode == 'readAndDown' || foundMode == '1'" | ||
| 1502 | @click="onUploadFileDownload(productDetailItem)">下载</div> | ||
| 1503 | </div> | ||
| 1504 | </span> | ||
| 1505 | </span> | ||
| 1506 | </div> | ||
| 1507 | </div> | ||
| 1508 | </div> | ||
| 1509 | </ContentWrap> | ||
| 1510 | <ContentWrap id="id-table" title="资源表" v-if="detailInfo.damCatalogTableInfo?.length && !detailInfo.attachments?.length" description="" | ||
| 1461 | style="margin: 16px 16px 16px"> | 1511 | style="margin: 16px 16px 16px"> |
| 1462 | <el-table v-show="!fullscreenLoading" ref="tableRef" :data="detailInfo.damCatalogTableInfo" | 1512 | <el-table v-show="!fullscreenLoading" ref="tableRef" :data="detailInfo.damCatalogTableInfo" |
| 1463 | :highlight-current-row="true" stripe border @expand-change="handleTableExpandChange" max-height="350" | 1513 | :highlight-current-row="true" stripe border @expand-change="handleTableExpandChange" max-height="350" |
| ... | @@ -1595,9 +1645,9 @@ const respParamsTableInfo = ref({ | ... | @@ -1595,9 +1645,9 @@ const respParamsTableInfo = ref({ |
| 1595 | <img class="file-img" src="../../assets/images/jpg.png" /> | 1645 | <img class="file-img" src="../../assets/images/jpg.png" /> |
| 1596 | </template> | 1646 | </template> |
| 1597 | <div class="file-name">{{ item.name }}</div> | 1647 | <div class="file-name">{{ item.name }}</div> |
| 1598 | <div :style="{ right: '36px' }" v-if="foundMode != 'download' && item.name.substring(item.name.lastIndexOf('.') + 1) == 'pdf' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'png' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpg' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpeg'" | 1648 | <div :style="{ right: '36px' }" v-if="item.name.substring(item.name.lastIndexOf('.') + 1) == 'pdf' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'png' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpg' || item.name.substring(item.name.lastIndexOf('.') + 1) == 'jpeg'" |
| 1599 | class="file-preview" @click="onUploadFilePreview(item)">查看</div> | 1649 | class="file-preview" @click="onUploadFilePreview(item)">查看</div> |
| 1600 | <div v-if="foundMode == 'download' || foundMode == 'readAndDown' || foundMode == '1'" :style="{ right: '0px' }" class="file-preview" @click="onUploadFileDownload(item)">下载</div> | 1650 | <div :style="{ right: '0px' }" class="file-preview" @click="onUploadFileDownload(item)">下载</div> |
| 1601 | </div> | 1651 | </div> |
| 1602 | </span> | 1652 | </span> |
| 1603 | </div> | 1653 | </div> |
| ... | @@ -2150,6 +2200,10 @@ const respParamsTableInfo = ref({ | ... | @@ -2150,6 +2200,10 @@ const respParamsTableInfo = ref({ |
| 2150 | } | 2200 | } |
| 2151 | } | 2201 | } |
| 2152 | 2202 | ||
| 2203 | .file_item { | ||
| 2204 | width: 70%; | ||
| 2205 | } | ||
| 2206 | |||
| 2153 | .file-operate { | 2207 | .file-operate { |
| 2154 | display: flex; | 2208 | display: flex; |
| 2155 | align-items: center; | 2209 | align-items: center; | ... | ... |
-
Please register or sign in to post a comment