Commit 2d6023c87f447479b261081d783be5133c255e9f

Authored by 温伟
2 parents a516d3ff ea180dd7

Merge branch 'local_dev_ft' into 'perf/main_dev'

fix: 组态,修改获取设备接口,新增传组织id

See merge request yunteng/thingskit-scada!153
... ... @@ -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 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 62 data: deviceProfileIds,
63 63 })
64 64 }
... ...
... ... @@ -65,9 +65,11 @@ const handleDeleteRow = (data: TableRecordItemType) => {
65 65 }
66 66
67 67 async function getDeviceList() {
  68 + const organizationId = window.useParseParams().organizationId
  69 + if (!organizationId) return
68 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 73 ...item,
72 74 label: item.alias || item.name,
73 75 value: item.tbDeviceId,
... ...
... ... @@ -42,10 +42,15 @@ export const formSchemas = (componentKey?: string): FormSchema[] => {
42 42 ifShow: !isTemplate,
43 43 required: !isTemplate,
44 44 componentProps: ({ formModel }) => {
  45 + const organizationId = window.useParseParams().organizationId
  46 + if (!organizationId) return
45 47 return {
46 48 showSearch: true,
47 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 54 labelField: ['alias', 'name'],
50 55 valueField: 'tbDeviceId',
51 56 onSelect(value: string, option: DeviceItemType) {
... ...
... ... @@ -111,11 +111,16 @@ export const formSchemas: FormSchema[] = [
111 111 component: ComponentEnum.API_SELECT,
112 112 required: true,
113 113 componentProps: ({ formModel }) => {
  114 + const organizationId = window.useParseParams().organizationId
  115 + if (!organizationId) return
114 116 return {
115 117 mode: 'multiple',
116 118 showSearch: true,
117 119 api: getListByDeviceProfileIds,
118   - params: unref(contentDataStore.getProductIds),
  120 + params: {
  121 + deviceProfileIds: unref(contentDataStore.getProductIds),
  122 + organizationId,
  123 + },
119 124 labelField: ['alias', 'name'],
120 125 valueField: 'id',
121 126 maxTagCount: 4,
... ...