1c6ae929 by lihua

添加数据产品下载源文件

1 parent b24883dd
......@@ -35,6 +35,7 @@ import {
getContractStrategy
} from "@/api/modules/dataDelivery";
import StrategyTable from '../data_smart_contract/components/strategyTable.vue';
import { getDownFileSignByUrl, obsDownloadRequest, parseAndDecodeUrl } from '@/api/modules/obsService';
const router = useRouter();
const route = useRoute();
......@@ -477,26 +478,45 @@ const handleTableViewData = (scope) => {
}
/** 下载数据 */
const handleTableViewDataDown = (scope) => {
downloadTableDataCheck({
userGuid: route.query.useGuid,
subjectGuid: scope.row.guid
}).then((res: any) => {
if (res?.code == proxy.$passCode) {
downloadTableData({
userGuid: route.query.useGuid,
subjectGuid: scope.row.guid
}).then((res: any) => {
if (res && !res.msg) {
download(res, `${scope.row.tableChName}.xlsx`, 'excel');
} else {
res?.msg && ElMessage.error(res?.msg);
}
})
} else {
ElMessage.error(res?.msg || '下载失败');
const handleTableViewDataDown = async (scope) => {
if (foundMode.value == 'download' || foundMode.value == 'readAndDown') {
downloadTableDataCheck({
userGuid: route.query.useGuid,
subjectGuid: scope.row.guid
}).then((res: any) => {
if (res?.code == proxy.$passCode) {
downloadTableData({
userGuid: route.query.useGuid,
subjectGuid: scope.row.guid
}).then((res: any) => {
if (res && !res.msg) {
download(res, `${scope.row.tableChName}.xlsx`, 'excel');
} else {
res?.msg && ElMessage.error(res?.msg);
}
})
} else {
ElMessage.error(res?.msg || '下载失败');
}
})
} else if (!detailInfo.nodeId && foundMode.value == '1' && userData.superTubeFlag == 'Y') { //下载源文件
let fileUrl = scope.row.fileUrl;
const refSignInfo: any = await getDownFileSignByUrl(parseAndDecodeUrl(fileUrl).fileName);
if (!refSignInfo?.data) {
refSignInfo?.msg && ElMessage.error(refSignInfo?.msg);
return;
}
})
obsDownloadRequest(refSignInfo?.data).then((res: any) => {
if (res && !res.msg) {
let f = scope.row.fileName;
let name = f.name;
var fileSuffix = name ? name.substring(name.lastIndexOf('.') + 1) : '';
download(res, name, fileSuffix);
} else {
res?.msg && ElMessage.error(res?.msg);
}
})
}
}
const toolBtns: any = computed(() => {
......@@ -1526,8 +1546,10 @@ const respParamsTableInfo = ref({
<!-- 如果是下载,就只显示下载,如果是查看和下载就都显示,就两个按钮都显示。仅查看,就仅查看 -->
<span v-show="foundMode != 'download'" class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span>
<el-divider v-show="foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y')" direction="vertical" />
<span v-show="foundMode == 'download' || foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y')" class="text_btn"
<span v-if="foundMode == 'download' || foundMode == 'readAndDown'" class="text_btn"
@click="handleTableViewDataDown(scope)">下载数据</span>
<span v-else-if="!detailInfo.nodeId && foundMode == '1' && userData.superTubeFlag == 'Y'" class="text_btn"
@click="handleTableViewDataDown(scope)">下载</span>
</template>
</el-table-column>
</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!