ed2390a1 by lihua

支持文件资源下载的使用控制

1 parent f93ef1cd
......@@ -60,6 +60,12 @@ export const downloadTableData = (params) => request({
responseType: 'blob'
});
/** 下载文件前的检查 */
export const downloadFileCheck = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download-file?userGuid=${params.userGuid}&fileName=${params.fileName}`,
method: 'get'
});
/** 下载数据前的检查 */
export const downloadTableDataCheck = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download-check?userGuid=${params.userGuid}&subjectGuid=${params.subjectGuid}`,
......
......@@ -32,7 +32,8 @@ import { TableColumnWidth } from '@/utils/enum';
import {
downloadTableData,
downloadTableDataCheck,
getContractStrategy
getContractStrategy,
downloadFileCheck
} from "@/api/modules/dataDelivery";
import StrategyTable from '../data_smart_contract/components/strategyTable.vue';
import { getDownFileSignByUrl, obsDownloadRequest, parseAndDecodeUrl } from '@/api/modules/obsService';
......@@ -477,6 +478,24 @@ const handleTableViewData = (scope) => {
});
}
/** 下载文件资源 */
const downloadFile = (productDetailItem) => {
if (foundMode.value == '1') {
onUploadFileDownload(productDetailItem);
} else {// 使用次数需要先调用
downloadFileCheck({
userGuid: route.query.useGuid,
fileName: productDetailItem
}).then((res: any) => {
if (res?.code == proxy.$passCode) {
onUploadFileDownload(productDetailItem);
} else {
ElMessage.error(res?.msg || '下载失败');
}
});
}
}
/** 下载数据 */
const handleTableViewDataDown = async (scope) => {
if (foundMode.value == 'download' || foundMode.value == 'readAndDown') {
......@@ -1490,15 +1509,8 @@ const respParamsTableInfo = ref({
</template>
<div class="file-name"><ellipsis-tooltip :content="productDetailItem.name ?? ''" class-name="w100f"
refName="tooltipOver"></ellipsis-tooltip></div>
<div
v-if="['pdf', 'png', 'jpg', 'jpeg'].includes(productDetailItem.name?.substring(productDetailItem.name.lastIndexOf('.') + 1).toLowerCase())"
:style="{ right: '36px' }" class="file-preview" @click="onUploadFilePreview(productDetailItem)">
查看
</div>
<div :style="{ right: '0px' }" class="file-preview"
@click="onUploadFileDownload(productDetailItem)">
下载
</div>
<div :style="{ right: '0px' }" class="file-preview" v-if="foundMode == 'download' || foundMode == 'readAndDown' || (!detailInfo.nodeId && foundMode == '1')"
@click="downloadFile">下载</div>
</div>
</span>
</span>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!