99c58775 by lihua

数据使用接口联调

1 parent 37f6d6c0
......@@ -46,3 +46,17 @@ export const deleteDataUse = (params) => request({
method: 'delete',
data: params
});
/** 下载数据 */
export const downloadTableData = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download?userGuid=${params.userGuid}&subjectGuid=${params.subjectGuid}`,
method: 'get',
responseType: 'blob'
});
/** 分发连接器 */
export const distributeContract = (params) => request({
url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/distribute`,
method: 'post',
data: params
})
\ No newline at end of file
......
......@@ -4,6 +4,7 @@ import { commonPageConfig, TableColumnWidth } from '@/utils/enum';
import {
getDataUsePageList,
deleteDataUse,
distributeContract,
} from "@/api/modules/dataDelivery";
import { useValidator } from "@/hooks/useValidator";
......@@ -114,7 +115,7 @@ const btnHanldesMap = {
guid: scope.row.dataProductGuid,
type: 'detail',
foundMode: 'read',
name: scope.row.dataProductName,
name: scope.row.dataProductName
}
});
},
......@@ -126,6 +127,7 @@ const btnHanldesMap = {
type: 'detail',
foundMode: 'download',
name: scope.row.dataProductName,
useGuid: scope.row.guid
}
});
},
......@@ -222,12 +224,14 @@ const templateFormItems = ref([{
},
filterable: true,
multiple: true,
collapse: true,
tagsTooltip: true,
clearable: true,
required: true
}]);
const templateFormRules = ref({
tenantGuids: [required('请选择分发连接器')]
tenantGuids: [{ required: true, trigger: 'change', message: "请选择分发连接器" }]
});
const tenantDialogInfo = ref({
......@@ -244,8 +248,18 @@ const tenantDialogInfo = ref({
btns: {
submit: (btn, info) => {
tenantDialogInfo.value.submitBtnLoading = true;
tenantDialogInfo.value.visible = false;
distributeContract({
useGuid: currTableData.value.guid,
nodeGuid: info.tenantGuids
}).then((res: any) => {
tenantDialogInfo.value.submitBtnLoading = false;
if (res?.code == proxy.$passCode) {
tenantDialogInfo.value.visible = false;
proxy.$ElMessage.success('分发连接器提交成功');
} else {
res?.msg && proxy.$ElMessage.error(res?.msg)
}
})
},
cancel: () => {
tenantDialogInfo.value.visible = false;
......
......@@ -22,12 +22,15 @@ import {
import {
apiTypes
} from "@/api/modules/dataService";
import { changeNum } from '@/utils/common'
import { changeNum, download } from '@/utils/common'
import { ElMessage, ElMessageBox } from "element-plus";
import { passFlowData, rejectFlowData, revokeFlowData, isMyFirstNode } from "@/api/modules/workFlowService";
import { onUploadFilePreview, onUploadFileDownload } from '@/api/modules/common';
import useDataAssetStore from "@/store/modules/dataAsset";
import { TableColumnWidth } from '@/utils/enum';
import {
downloadTableData
} from "@/api/modules/dataDelivery";
const router = useRouter();
const route = useRoute();
......@@ -446,7 +449,16 @@ const handleTableViewData = (scope) => {
/** 下载数据 */
const handleTableViewDataDown = (scope) => {
//TODO
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);
}
})
}
const toolBtns: any = computed(() => {
......@@ -1458,9 +1470,10 @@ const respParamsTableInfo = ref({
<span>{{ scope.row["updateTime"] || '--' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" v-if="!detailInfo.nodeId || foundMode == 'download'" minWidth="120px" align="left" fixed="right" show-overflow-tooltip>
<el-table-column label="操作" v-if="!detailInfo.nodeId || foundMode == 'download'" width="220px" align="left" fixed="right" show-overflow-tooltip>
<template #default="scope">
<span class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span>
<el-divider direction="vertical" />
<span class="text_btn" @click="handleTableViewDataDown(scope)">下载数据</span>
</template>
</el-table-column>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!