1c6ae929 by lihua

添加数据产品下载源文件

1 parent b24883dd
...@@ -35,6 +35,7 @@ import { ...@@ -35,6 +35,7 @@ import {
35 getContractStrategy 35 getContractStrategy
36 } from "@/api/modules/dataDelivery"; 36 } from "@/api/modules/dataDelivery";
37 import StrategyTable from '../data_smart_contract/components/strategyTable.vue'; 37 import StrategyTable from '../data_smart_contract/components/strategyTable.vue';
38 import { getDownFileSignByUrl, obsDownloadRequest, parseAndDecodeUrl } from '@/api/modules/obsService';
38 39
39 const router = useRouter(); 40 const router = useRouter();
40 const route = useRoute(); 41 const route = useRoute();
...@@ -477,26 +478,45 @@ const handleTableViewData = (scope) => { ...@@ -477,26 +478,45 @@ const handleTableViewData = (scope) => {
477 } 478 }
478 479
479 /** 下载数据 */ 480 /** 下载数据 */
480 const handleTableViewDataDown = (scope) => { 481 const handleTableViewDataDown = async (scope) => {
481 downloadTableDataCheck({ 482 if (foundMode.value == 'download' || foundMode.value == 'readAndDown') {
482 userGuid: route.query.useGuid, 483 downloadTableDataCheck({
483 subjectGuid: scope.row.guid 484 userGuid: route.query.useGuid,
484 }).then((res: any) => { 485 subjectGuid: scope.row.guid
485 if (res?.code == proxy.$passCode) { 486 }).then((res: any) => {
486 downloadTableData({ 487 if (res?.code == proxy.$passCode) {
487 userGuid: route.query.useGuid, 488 downloadTableData({
488 subjectGuid: scope.row.guid 489 userGuid: route.query.useGuid,
489 }).then((res: any) => { 490 subjectGuid: scope.row.guid
490 if (res && !res.msg) { 491 }).then((res: any) => {
491 download(res, `${scope.row.tableChName}.xlsx`, 'excel'); 492 if (res && !res.msg) {
492 } else { 493 download(res, `${scope.row.tableChName}.xlsx`, 'excel');
493 res?.msg && ElMessage.error(res?.msg); 494 } else {
494 } 495 res?.msg && ElMessage.error(res?.msg);
495 }) 496 }
496 } else { 497 })
497 ElMessage.error(res?.msg || '下载失败'); 498 } else {
499 ElMessage.error(res?.msg || '下载失败');
500 }
501 })
502 } else if (!detailInfo.nodeId && foundMode.value == '1' && userData.superTubeFlag == 'Y') { //下载源文件
503 let fileUrl = scope.row.fileUrl;
504 const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(fileUrl).fileName);
505 if (!refSignInfo?.data) {
506 refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
507 return;
498 } 508 }
499 }) 509 obsDownloadRequest(refSignInfo?.data).then((res: any) => {
510 if (res && !res.msg) {
511 let f = scope.row.fileName;
512 let name = f.name;
513 var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
514 download(res, name, fileSuffix);
515 } else {
516 res?.msg && ElMessage.error(res?.msg);
517 }
518 })
519 }
500 } 520 }
501 521
502 const toolBtns: any = computed(() => { 522 const toolBtns: any = computed(() => {
...@@ -1526,8 +1546,10 @@ const respParamsTableInfo = ref({ ...@@ -1526,8 +1546,10 @@ const respParamsTableInfo = ref({
1526 <!-- 如果是下载,就只显示下载,如果是查看和下载就都显示,就两个按钮都显示。仅查看,就仅查看 --> 1546 <!-- 如果是下载,就只显示下载,如果是查看和下载就都显示,就两个按钮都显示。仅查看,就仅查看 -->
1527 <span v-show="foundMode != 'download'" class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span> 1547 <span v-show="foundMode != 'download'" class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span>
1528 <el-divider v-show="foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y')" direction="vertical" /> 1548 <el-divider v-show="foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y')" direction="vertical" />
1529 <span v-show="foundMode == 'download' || foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y')" class="text_btn" 1549 <span v-if="foundMode == 'download' || foundMode == 'readAndDown'" class="text_btn"
1530 @click="handleTableViewDataDown(scope)">下载数据</span> 1550 @click="handleTableViewDataDown(scope)">下载数据</span>
1551 <span v-else-if="!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y'" class="text_btn"
1552 @click="handleTableViewDataDown(scope)">下载</span>
1531 </template> 1553 </template>
1532 </el-table-column> 1554 </el-table-column>
1533 </el-table> 1555 </el-table>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!