Commit ca773a064f06e11925b975af3760bb292750b7bf

Authored by fengwotao
1 parent 9135bfd5

feat(src/api): 修改url传组织id,过滤其他组织

@@ -16,7 +16,7 @@ import { PaginationResult } from '/#/external/axios'; @@ -16,7 +16,7 @@ import { PaginationResult } from '/#/external/axios';
16 DEVICE_ATTR_LIST = '/device/attributes', 16 DEVICE_ATTR_LIST = '/device/attributes',
17 GET_PUBLIC_INTERFACE_ALL = '/data_view_interface/find/can_use_interfaces', 17 GET_PUBLIC_INTERFACE_ALL = '/data_view_interface/find/can_use_interfaces',
18 //ft 18 //ft
19 - GET_PUBLIC_INTERFACE_DETAIL = '/data_view_interface/get_interface_details' 19 + GET_PUBLIC_INTERFACE_DETAIL = '/data_view_interface/get_interface_details'
20 } 20 }
21 21
22 export const getPublicInterface = async (params: Record<'page' | 'pageSize', number>) => { 22 export const getPublicInterface = async (params: Record<'page' | 'pageSize', number>) => {
@@ -26,9 +26,10 @@ export const getPublicInterface = async (params: Record<'page' | 'pageSize', num @@ -26,9 +26,10 @@ export const getPublicInterface = async (params: Record<'page' | 'pageSize', num
26 }) 26 })
27 } 27 }
28 28
29 -export const getOrgList = async () => { 29 +export const getOrgList = async (params:object) => {
30 return defHttp.get({ 30 return defHttp.get({
31 - url: Api.ORG_LISt 31 + url: Api.ORG_LISt,
  32 + params
32 }) 33 })
33 } 34 }
34 35
1 -import { excludeParseEventKeyList, excludeParseEventValueList } from "@/enums/eventEnum" 1 +import { excludeParseEventKeyList, excludeParseEventValueList } from '@/enums/eventEnum'
2 2
3 const tryRunFunction = (v: string) => { 3 const tryRunFunction = (v: string) => {
4 try { 4 try {
@@ -30,3 +30,11 @@ export const JSONParse = (data: string) => { @@ -30,3 +30,11 @@ export const JSONParse = (data: string) => {
30 return v 30 return v
31 }) 31 })
32 } 32 }
  33 +
  34 +//解析web url 参数
  35 +export const parseWebUrl = (str = window.location.search) => {
  36 + const reg = /([^?&=]+)=([^&]+)/g
  37 + const params = {} as any
  38 + str.replace(reg, (_, k, v) => (params[k] = v))
  39 + return params
  40 +}
@@ -8,6 +8,7 @@ import { computed, onMounted, reactive, Ref, ref, unref } from "vue" @@ -8,6 +8,7 @@ import { computed, onMounted, reactive, Ref, ref, unref } from "vue"
8 import { DictEnum } from '@/enums/external/dictEnum' 8 import { DictEnum } from '@/enums/external/dictEnum'
9 import { SelectTimeAggregationFieldEnum, SelectTimeAggregationValueTypw } from "../SelectTImeAggregation" 9 import { SelectTimeAggregationFieldEnum, SelectTimeAggregationValueTypw } from "../SelectTImeAggregation"
10 import { isArray } from "@/utils" 10 import { isArray } from "@/utils"
  11 +import { parseWebUrl } from "@/utils/external/utils"
11 12
12 const GROUP_SEPARATOR = ',' 13 const GROUP_SEPARATOR = ','
13 14
@@ -102,9 +103,15 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => { @@ -102,9 +103,15 @@ export const useDynamicPublicForm = (paramsItemList: Ref<ParamsItemType[]>) => {
102 }, {} as BuiltInVariableRecord) 103 }, {} as BuiltInVariableRecord)
103 } 104 }
104 105
  106 +
  107 +
105 const getOrgOption = async () => { 108 const getOrgOption = async () => {
  109 + if( !window.location.href ) return
  110 + const { organizationId } = parseWebUrl(window.location.href)
  111 + if( !organizationId) return
106 if (!validIsExist(BuiltInVariable.ORGANIZATION_ID)) return 112 if (!validIsExist(BuiltInVariable.ORGANIZATION_ID)) return
107 - optionsSet[BuiltInVariable.ORGANIZATION_ID] = await getOrgList() 113 + optionsSet[BuiltInVariable.ORGANIZATION_ID] = await getOrgList({organizationId})
  114 + console.log(optionsSet[BuiltInVariable.ORGANIZATION_ID])
108 } 115 }
109 116
110 const getDeviceProfileOption = async () => { 117 const getDeviceProfileOption = async () => {