数据使用接口联调
Showing
3 changed files
with
48 additions
and
7 deletions
| ... | @@ -46,3 +46,17 @@ export const deleteDataUse = (params) => request({ | ... | @@ -46,3 +46,17 @@ export const deleteDataUse = (params) => request({ |
| 46 | method: 'delete', | 46 | method: 'delete', |
| 47 | data: params | 47 | data: params |
| 48 | }); | 48 | }); |
| 49 | |||
| 50 | /** 下载数据 */ | ||
| 51 | export const downloadTableData = (params) => request({ | ||
| 52 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/download?userGuid=${params.userGuid}&subjectGuid=${params.subjectGuid}`, | ||
| 53 | method: 'get', | ||
| 54 | responseType: 'blob' | ||
| 55 | }); | ||
| 56 | |||
| 57 | /** 分发连接器 */ | ||
| 58 | export const distributeContract = (params) => request({ | ||
| 59 | url: `${import.meta.env.VITE_APP_DIGITAL_CONTRACT_URL}/contract-use/distribute`, | ||
| 60 | method: 'post', | ||
| 61 | data: params | ||
| 62 | }) | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -4,6 +4,7 @@ import { commonPageConfig, TableColumnWidth } from '@/utils/enum'; | ... | @@ -4,6 +4,7 @@ import { commonPageConfig, TableColumnWidth } from '@/utils/enum'; |
| 4 | import { | 4 | import { |
| 5 | getDataUsePageList, | 5 | getDataUsePageList, |
| 6 | deleteDataUse, | 6 | deleteDataUse, |
| 7 | distributeContract, | ||
| 7 | } from "@/api/modules/dataDelivery"; | 8 | } from "@/api/modules/dataDelivery"; |
| 8 | import { useValidator } from "@/hooks/useValidator"; | 9 | import { useValidator } from "@/hooks/useValidator"; |
| 9 | 10 | ||
| ... | @@ -114,7 +115,7 @@ const btnHanldesMap = { | ... | @@ -114,7 +115,7 @@ const btnHanldesMap = { |
| 114 | guid: scope.row.dataProductGuid, | 115 | guid: scope.row.dataProductGuid, |
| 115 | type: 'detail', | 116 | type: 'detail', |
| 116 | foundMode: 'read', | 117 | foundMode: 'read', |
| 117 | name: scope.row.dataProductName, | 118 | name: scope.row.dataProductName |
| 118 | } | 119 | } |
| 119 | }); | 120 | }); |
| 120 | }, | 121 | }, |
| ... | @@ -126,6 +127,7 @@ const btnHanldesMap = { | ... | @@ -126,6 +127,7 @@ const btnHanldesMap = { |
| 126 | type: 'detail', | 127 | type: 'detail', |
| 127 | foundMode: 'download', | 128 | foundMode: 'download', |
| 128 | name: scope.row.dataProductName, | 129 | name: scope.row.dataProductName, |
| 130 | useGuid: scope.row.guid | ||
| 129 | } | 131 | } |
| 130 | }); | 132 | }); |
| 131 | }, | 133 | }, |
| ... | @@ -222,12 +224,14 @@ const templateFormItems = ref([{ | ... | @@ -222,12 +224,14 @@ const templateFormItems = ref([{ |
| 222 | }, | 224 | }, |
| 223 | filterable: true, | 225 | filterable: true, |
| 224 | multiple: true, | 226 | multiple: true, |
| 227 | collapse: true, | ||
| 228 | tagsTooltip: true, | ||
| 225 | clearable: true, | 229 | clearable: true, |
| 226 | required: true | 230 | required: true |
| 227 | }]); | 231 | }]); |
| 228 | 232 | ||
| 229 | const templateFormRules = ref({ | 233 | const templateFormRules = ref({ |
| 230 | tenantGuids: [required('请选择分发连接器')] | 234 | tenantGuids: [{ required: true, trigger: 'change', message: "请选择分发连接器" }] |
| 231 | }); | 235 | }); |
| 232 | 236 | ||
| 233 | const tenantDialogInfo = ref({ | 237 | const tenantDialogInfo = ref({ |
| ... | @@ -244,8 +248,18 @@ const tenantDialogInfo = ref({ | ... | @@ -244,8 +248,18 @@ const tenantDialogInfo = ref({ |
| 244 | btns: { | 248 | btns: { |
| 245 | submit: (btn, info) => { | 249 | submit: (btn, info) => { |
| 246 | tenantDialogInfo.value.submitBtnLoading = true; | 250 | tenantDialogInfo.value.submitBtnLoading = true; |
| 247 | 251 | distributeContract({ | |
| 248 | tenantDialogInfo.value.visible = false; | 252 | useGuid: currTableData.value.guid, |
| 253 | nodeGuid: info.tenantGuids | ||
| 254 | }).then((res: any) => { | ||
| 255 | tenantDialogInfo.value.submitBtnLoading = false; | ||
| 256 | if (res?.code == proxy.$passCode) { | ||
| 257 | tenantDialogInfo.value.visible = false; | ||
| 258 | proxy.$ElMessage.success('分发连接器提交成功'); | ||
| 259 | } else { | ||
| 260 | res?.msg && proxy.$ElMessage.error(res?.msg) | ||
| 261 | } | ||
| 262 | }) | ||
| 249 | }, | 263 | }, |
| 250 | cancel: () => { | 264 | cancel: () => { |
| 251 | tenantDialogInfo.value.visible = false; | 265 | tenantDialogInfo.value.visible = false; | ... | ... |
| ... | @@ -22,12 +22,15 @@ import { | ... | @@ -22,12 +22,15 @@ import { |
| 22 | import { | 22 | import { |
| 23 | apiTypes | 23 | apiTypes |
| 24 | } from "@/api/modules/dataService"; | 24 | } from "@/api/modules/dataService"; |
| 25 | import { changeNum } from '@/utils/common' | 25 | import { changeNum, download } from '@/utils/common' |
| 26 | import { ElMessage, ElMessageBox } from "element-plus"; | 26 | import { ElMessage, ElMessageBox } from "element-plus"; |
| 27 | import { passFlowData, rejectFlowData, revokeFlowData, isMyFirstNode } from "@/api/modules/workFlowService"; | 27 | import { passFlowData, rejectFlowData, revokeFlowData, isMyFirstNode } from "@/api/modules/workFlowService"; |
| 28 | import { onUploadFilePreview, onUploadFileDownload } from '@/api/modules/common'; | 28 | import { onUploadFilePreview, onUploadFileDownload } from '@/api/modules/common'; |
| 29 | import useDataAssetStore from "@/store/modules/dataAsset"; | 29 | import useDataAssetStore from "@/store/modules/dataAsset"; |
| 30 | import { TableColumnWidth } from '@/utils/enum'; | 30 | import { TableColumnWidth } from '@/utils/enum'; |
| 31 | import { | ||
| 32 | downloadTableData | ||
| 33 | } from "@/api/modules/dataDelivery"; | ||
| 31 | 34 | ||
| 32 | const router = useRouter(); | 35 | const router = useRouter(); |
| 33 | const route = useRoute(); | 36 | const route = useRoute(); |
| ... | @@ -446,7 +449,16 @@ const handleTableViewData = (scope) => { | ... | @@ -446,7 +449,16 @@ const handleTableViewData = (scope) => { |
| 446 | 449 | ||
| 447 | /** 下载数据 */ | 450 | /** 下载数据 */ |
| 448 | const handleTableViewDataDown = (scope) => { | 451 | const handleTableViewDataDown = (scope) => { |
| 449 | //TODO | 452 | downloadTableData({ |
| 453 | userGuid: route.query.useGuid, | ||
| 454 | subjectGuid: scope.row.guid | ||
| 455 | }).then((res: any) => { | ||
| 456 | if (res && !res.msg) { | ||
| 457 | download(res, `${scope.row.tableChName}.xlsx`, 'excel'); | ||
| 458 | } else { | ||
| 459 | res?.msg && ElMessage.error(res?.msg); | ||
| 460 | } | ||
| 461 | }) | ||
| 450 | } | 462 | } |
| 451 | 463 | ||
| 452 | const toolBtns: any = computed(() => { | 464 | const toolBtns: any = computed(() => { |
| ... | @@ -1458,9 +1470,10 @@ const respParamsTableInfo = ref({ | ... | @@ -1458,9 +1470,10 @@ const respParamsTableInfo = ref({ |
| 1458 | <span>{{ scope.row["updateTime"] || '--' }}</span> | 1470 | <span>{{ scope.row["updateTime"] || '--' }}</span> |
| 1459 | </template> | 1471 | </template> |
| 1460 | </el-table-column> | 1472 | </el-table-column> |
| 1461 | <el-table-column label="操作" v-if="!detailInfo.nodeId || foundMode == 'download'" minWidth="120px" align="left" fixed="right" show-overflow-tooltip> | 1473 | <el-table-column label="操作" v-if="!detailInfo.nodeId || foundMode == 'download'" width="220px" align="left" fixed="right" show-overflow-tooltip> |
| 1462 | <template #default="scope"> | 1474 | <template #default="scope"> |
| 1463 | <span class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span> | 1475 | <span class="text_btn" @click="handleTableViewData(scope)">查看样例数据</span> |
| 1476 | <el-divider direction="vertical" /> | ||
| 1464 | <span class="text_btn" @click="handleTableViewDataDown(scope)">下载数据</span> | 1477 | <span class="text_btn" @click="handleTableViewDataDown(scope)">下载数据</span> |
| 1465 | </template> | 1478 | </template> |
| 1466 | </el-table-column> | 1479 | </el-table-column> | ... | ... |
-
Please register or sign in to post a comment