| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import { ref } from 'vue';
- import { useRoute } from 'vue-router';
- import { initData } from "@/common/methods";
- import { serviceURL } from "@/services/request";
- import { getToken } from "@/services/bus/token";
- import { OperationTabMenuAuth } from '@/services/go/commonService/interface';
- const iframeCode: { code: string, tabIndex: number }[] = [
- {
- code: 'goods_spot', // 基础设置-商品设置-现货品种
- tabIndex: 1,
- },
- {
- code: 'goods_hedge', // 基础设置-商品设置-套保品种
- tabIndex: 2,
- },
- {
- code: 'company_normal', // 基础设置-主体设置-正常
- tabIndex: 1,
- },
- {
- code: 'company_disabled', // 基础设置-主体设置-停用
- tabIndex: 2,
- },
- {
- code: 'futures_spot_finish', // 现货套保-期现关联-外部成交单关联
- tabIndex: 1,
- },
- {
- code: 'futures_spot_order', // 现货套保-期现关联-期现单据关联
- tabIndex: 2,
- },
- {
- code: 'futures_spot_record', // 现货套保-期现关联-关联记录
- tabIndex: 3,
- },
- {
- code: 'hedge_ratio_checkpending', // 风管审核-套保比例审核-待审核
- tabIndex: 1,
- },
- {
- code: 'hedge_ratio_performance', // 风管审核-套保比例审核-已审核
- tabIndex: 2,
- },
- {
- code: 'spot_params_checkpending', // 风管审核-现货参数审核-待审核
- tabIndex: 1,
- },
- {
- code: 'spot_params_performance', // 风管审核-现货参数审核-已审核
- tabIndex: 2,
- },
- {
- code: 'price_report_spot', // 统计报表-定价报表
- tabIndex: 1,
- }
- ]
- /**
- * 获取管理端url
- */
- export function getIframeUrl() {
- const route = useRoute();
- const url = ref('');
- const getUrl = () => {
- // 管理端地址
- const serviceUrl = serviceURL.pcMangerUrl + route.meta.url;
- // 根据当前路由 name(code) 查找出对应的 iframeCode
- const item = iframeCode.find((item) => item.code === route.name);
- if (item) {
- const auth = route.meta.auth as OperationTabMenuAuth[];
- const param = auth.reduce((res, item) => res + `:${item.code}`, '');
- url.value = `${serviceUrl}?token=${getToken()}&tabindex=${item.tabIndex}&resourcepcmenu=${param}`;
- }
- }
- initData(() => {
- getUrl();
- })
- return {
- url
- }
- }
|