|
|
@@ -0,0 +1,92 @@
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
+import { serviceURL } from "@/services/request";
|
|
|
+import { getToken } from "@/services/bus/token";
|
|
|
+import { OperationTabMenuAuth } from '@/services/go/commonService/interface';
|
|
|
+
|
|
|
+interface IframeCode {
|
|
|
+ code: string;
|
|
|
+ tabIndex: number,
|
|
|
+ buttons: {
|
|
|
+ // 权限按钮 info(详情):add(新增):edit(修改):del(停用启用)
|
|
|
+ [key: string]: string,
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const iframeCode: IframeCode[] = [
|
|
|
+ {
|
|
|
+ code: 'goods_spot', // 基础设置-商品设置-现货品种
|
|
|
+ tabIndex: 1,
|
|
|
+ buttons: {
|
|
|
+ goods_spot_add: 'add',
|
|
|
+ goods_spot_edit: 'edit',
|
|
|
+ goods_spot_stop: 'stop',
|
|
|
+ goods_spot_recover: 'recover',
|
|
|
+ info: 'info',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'goods_hedge', // 基础设置-商品设置-套保品种
|
|
|
+ tabIndex: 2,
|
|
|
+ buttons: {
|
|
|
+ goods_hedge_add: 'add',
|
|
|
+ goods_hedge_edit: 'edit',
|
|
|
+ info: 'info',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'hedge_ratio_checkpending', // 风管审核-套保比例审核-待审核
|
|
|
+ tabIndex: 1,
|
|
|
+ buttons: {
|
|
|
+ hedge_ratio_check: 'check',
|
|
|
+ info: 'info',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'hedge_ratio_performance', // 风管审核-套保比例审核-已审核
|
|
|
+ tabIndex: 2,
|
|
|
+ buttons: {
|
|
|
+ info: 'info',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'spot_params_checkpending', // 风管审核-现货参数审核-待审核
|
|
|
+ tabIndex: 1,
|
|
|
+ buttons: {
|
|
|
+ spot_params_check: 'check',
|
|
|
+ info: 'info',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: 'spot_params_performance', // 风管审核-现货参数审核-已审核
|
|
|
+ tabIndex: 2,
|
|
|
+ buttons: {
|
|
|
+ info: 'info',
|
|
|
+ }
|
|
|
+ }
|
|
|
+]
|
|
|
+
|
|
|
+/**
|
|
|
+ * 获取管理端url
|
|
|
+ */
|
|
|
+export function getIframeUrl(): string {
|
|
|
+ let param = 'resourcepcmenu=';
|
|
|
+ const route = useRoute();
|
|
|
+ const url = 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 fn = (code: string) => auth.find((e) => e.code === code);
|
|
|
+
|
|
|
+ // 拼接按钮权限参数
|
|
|
+ Object.entries(item.buttons).forEach((values) => {
|
|
|
+ if (values[0] === 'info' || fn(values[0])) {
|
|
|
+ param += `:${values[1]}`;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return `${serviceURL.pcMangerUrl + url}?token=${getToken()}&tabindex=${item.tabIndex}&${param}`;
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+}
|