Commit 2d6023c87f447479b261081d783be5133c255e9f
Merge branch 'local_dev_ft' into 'perf/main_dev'
fix: 组态,修改获取设备接口,新增传组织id See merge request yunteng/thingskit-scada!153
Showing
4 changed files
with
18 additions
and
6 deletions
@@ -56,9 +56,9 @@ export const getDeviceAttributes = (deviceProfileId: string) => { | @@ -56,9 +56,9 @@ export const getDeviceAttributes = (deviceProfileId: string) => { | ||
56 | }) | 56 | }) |
57 | } | 57 | } |
58 | 58 | ||
59 | -export const getListByDeviceProfileIds = (deviceProfileIds: string[]) => { | 59 | +export const getListByDeviceProfileIds = ({ deviceProfileIds, organizationId }: Recordable) => { |
60 | return defHttp.post<DeviceItemType[]>({ | 60 | return defHttp.post<DeviceItemType[]>({ |
61 | - url: Api.GET_DEVICE_BY_DEVICE_PROFILED_IDS, | 61 | + url: `${Api.GET_DEVICE_BY_DEVICE_PROFILED_IDS}?organizationId=${organizationId}`, |
62 | data: deviceProfileIds, | 62 | data: deviceProfileIds, |
63 | }) | 63 | }) |
64 | } | 64 | } |
@@ -65,9 +65,11 @@ const handleDeleteRow = (data: TableRecordItemType) => { | @@ -65,9 +65,11 @@ const handleDeleteRow = (data: TableRecordItemType) => { | ||
65 | } | 65 | } |
66 | 66 | ||
67 | async function getDeviceList() { | 67 | async function getDeviceList() { |
68 | + const organizationId = window.useParseParams().organizationId | ||
69 | + if (!organizationId) return | ||
68 | const productIds = unref(contentDataStore.getProductIds) | 70 | const productIds = unref(contentDataStore.getProductIds) |
69 | - const result = await getListByDeviceProfileIds(productIds || []) | ||
70 | - deviceList.value = result.map(item => ({ | 71 | + const result = await getListByDeviceProfileIds({ deviceProfileIds: productIds || [], organizationId }) |
72 | + deviceList.value = result.map((item: Recordable) => ({ | ||
71 | ...item, | 73 | ...item, |
72 | label: item.alias || item.name, | 74 | label: item.alias || item.name, |
73 | value: item.tbDeviceId, | 75 | value: item.tbDeviceId, |
@@ -42,10 +42,15 @@ export const formSchemas = (componentKey?: string): FormSchema[] => { | @@ -42,10 +42,15 @@ export const formSchemas = (componentKey?: string): FormSchema[] => { | ||
42 | ifShow: !isTemplate, | 42 | ifShow: !isTemplate, |
43 | required: !isTemplate, | 43 | required: !isTemplate, |
44 | componentProps: ({ formModel }) => { | 44 | componentProps: ({ formModel }) => { |
45 | + const organizationId = window.useParseParams().organizationId | ||
46 | + if (!organizationId) return | ||
45 | return { | 47 | return { |
46 | showSearch: true, | 48 | showSearch: true, |
47 | api: getListByDeviceProfileIds, | 49 | api: getListByDeviceProfileIds, |
48 | - params: (unref(contentDataStore.getProductAndDevice) || []).map((item: ProductAndDevice) => item?.profileId), | 50 | + params: { |
51 | + deviceProfileIds: (unref(contentDataStore.getProductAndDevice) || []).map((item: ProductAndDevice) => item?.profileId), | ||
52 | + organizationId, | ||
53 | + }, | ||
49 | labelField: ['alias', 'name'], | 54 | labelField: ['alias', 'name'], |
50 | valueField: 'tbDeviceId', | 55 | valueField: 'tbDeviceId', |
51 | onSelect(value: string, option: DeviceItemType) { | 56 | onSelect(value: string, option: DeviceItemType) { |
@@ -111,11 +111,16 @@ export const formSchemas: FormSchema[] = [ | @@ -111,11 +111,16 @@ export const formSchemas: FormSchema[] = [ | ||
111 | component: ComponentEnum.API_SELECT, | 111 | component: ComponentEnum.API_SELECT, |
112 | required: true, | 112 | required: true, |
113 | componentProps: ({ formModel }) => { | 113 | componentProps: ({ formModel }) => { |
114 | + const organizationId = window.useParseParams().organizationId | ||
115 | + if (!organizationId) return | ||
114 | return { | 116 | return { |
115 | mode: 'multiple', | 117 | mode: 'multiple', |
116 | showSearch: true, | 118 | showSearch: true, |
117 | api: getListByDeviceProfileIds, | 119 | api: getListByDeviceProfileIds, |
118 | - params: unref(contentDataStore.getProductIds), | 120 | + params: { |
121 | + deviceProfileIds: unref(contentDataStore.getProductIds), | ||
122 | + organizationId, | ||
123 | + }, | ||
119 | labelField: ['alias', 'name'], | 124 | labelField: ['alias', 'name'], |
120 | valueField: 'id', | 125 | valueField: 'id', |
121 | maxTagCount: 4, | 126 | maxTagCount: 4, |