Commit ff4e005a78101e5feeac142184417eaf3dad7cfc

Authored by ww
1 parent c3c429ae

pref: 优化设备导入子设备时需根据网关设备协议过滤

@@ -20,6 +20,7 @@ export enum FieldsEnum { @@ -20,6 +20,7 @@ export enum FieldsEnum {
20 GATEWAY_TB_DEVICE_ID = 'gateWayTbDeviceId', 20 GATEWAY_TB_DEVICE_ID = 'gateWayTbDeviceId',
21 TB_DEVICE_PROFILE_ID = 'tbDeviceProfileId', 21 TB_DEVICE_PROFILE_ID = 'tbDeviceProfileId',
22 IS_TCP_DEVICE_PROFILE = 'isTcpDeviceProfile', 22 IS_TCP_DEVICE_PROFILE = 'isTcpDeviceProfile',
  23 + TRANSPORT_TYPE = 'transportType',
23 } 24 }
24 25
25 export enum DelimiterEnum { 26 export enum DelimiterEnum {
@@ -150,6 +151,7 @@ export const basicInfoForm: FormSchema[] = [ @@ -150,6 +151,7 @@ export const basicInfoForm: FormSchema[] = [
150 }); 151 });
151 clearValidate(); 152 clearValidate();
152 }, 153 },
  154 + placeholder: '请选择设备类型',
153 }; 155 };
154 }, 156 },
155 }, 157 },
@@ -174,6 +176,8 @@ export const basicInfoForm: FormSchema[] = [ @@ -174,6 +176,8 @@ export const basicInfoForm: FormSchema[] = [
174 ? options.transportType === TransportTypeEnum.TCP 176 ? options.transportType === TransportTypeEnum.TCP
175 : false, 177 : false,
176 [FieldsEnum.TB_DEVICE_PROFILE_ID]: value ? options.tbProfileId : null, 178 [FieldsEnum.TB_DEVICE_PROFILE_ID]: value ? options.tbProfileId : null,
  179 + [FieldsEnum.GATEWAY_TB_DEVICE_ID]: null,
  180 + [FieldsEnum.TRANSPORT_TYPE]: options?.transportType,
177 }); 181 });
178 }, 182 },
179 showSearch: true, 183 showSearch: true,
@@ -191,6 +195,7 @@ export const basicInfoForm: FormSchema[] = [ @@ -191,6 +195,7 @@ export const basicInfoForm: FormSchema[] = [
191 required: true, 195 required: true,
192 componentProps: ({ formModel }) => { 196 componentProps: ({ formModel }) => {
193 const organizationId = formModel[FieldsEnum.ORGANIZATION_ID]; 197 const organizationId = formModel[FieldsEnum.ORGANIZATION_ID];
  198 + const transportType = formModel[FieldsEnum.TRANSPORT_TYPE];
194 return { 199 return {
195 api: async () => { 200 api: async () => {
196 try { 201 try {
@@ -199,12 +204,14 @@ export const basicInfoForm: FormSchema[] = [ @@ -199,12 +204,14 @@ export const basicInfoForm: FormSchema[] = [
199 deviceType: DeviceTypeEnum.GATEWAY, 204 deviceType: DeviceTypeEnum.GATEWAY,
200 organizationId, 205 organizationId,
201 }); 206 });
202 - return result.map((item) => {  
203 - return {  
204 - ...item,  
205 - name: item.alias || item.name,  
206 - };  
207 - }); 207 + return result
  208 + .map((item) => {
  209 + return {
  210 + ...item,
  211 + name: item.alias || item.name,
  212 + };
  213 + })
  214 + .filter((item) => item.transportType === transportType);
208 } catch (error) { 215 } catch (error) {
209 return []; 216 return [];
210 } 217 }
@@ -216,6 +223,7 @@ export const basicInfoForm: FormSchema[] = [ @@ -216,6 +223,7 @@ export const basicInfoForm: FormSchema[] = [
216 filterOption: (inputValue: string, options: Record<'label', string>) => { 223 filterOption: (inputValue: string, options: Record<'label', string>) => {
217 return options.label.includes(inputValue); 224 return options.label.includes(inputValue);
218 }, 225 },
  226 + placeholder: '请选择网关设备',
219 }; 227 };
220 }, 228 },
221 }, 229 },