Commit fc683030734c7addaf362d28dd8404af25223af6
Merge branch 'ww' into 'main'
perf: add a deviceProfileId filed on create device in device list page See merge request huang/yun-teng-iot-front!401
Showing
3 changed files
with
17 additions
and
8 deletions
| @@ -49,6 +49,12 @@ export const step1Schemas: FormSchema[] = [ | @@ -49,6 +49,12 @@ export const step1Schemas: FormSchema[] = [ | ||
| 49 | show: false, | 49 | show: false, |
| 50 | }, | 50 | }, |
| 51 | { | 51 | { |
| 52 | + field: 'deviceProfileId', | ||
| 53 | + label: '', | ||
| 54 | + component: 'Input', | ||
| 55 | + show: false, | ||
| 56 | + }, | ||
| 57 | + { | ||
| 52 | field: 'profileId', | 58 | field: 'profileId', |
| 53 | label: '所属产品', | 59 | label: '所属产品', |
| 54 | required: true, | 60 | required: true, |
| @@ -59,9 +65,12 @@ export const step1Schemas: FormSchema[] = [ | @@ -59,9 +65,12 @@ export const step1Schemas: FormSchema[] = [ | ||
| 59 | api: deviceProfile, | 65 | api: deviceProfile, |
| 60 | labelField: 'name', | 66 | labelField: 'name', |
| 61 | valueField: 'tbProfileId', | 67 | valueField: 'tbProfileId', |
| 62 | - onChange(_value: string, option: { deviceType: string; transportType: string }) { | ||
| 63 | - const { deviceType, transportType } = option; | ||
| 64 | - setFieldsValue({ deviceType: deviceType, transportType }); | 68 | + onChange( |
| 69 | + _value: string, | ||
| 70 | + option: { deviceType: string; transportType: string; id: string } | ||
| 71 | + ) { | ||
| 72 | + const { deviceType, transportType, id } = option; | ||
| 73 | + setFieldsValue({ deviceType: deviceType, transportType, deviceProfileId: id }); | ||
| 65 | }, | 74 | }, |
| 66 | }; | 75 | }; |
| 67 | }, | 76 | }, |
| @@ -32,7 +32,7 @@ | @@ -32,7 +32,7 @@ | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | const props = defineProps<{ | 34 | const props = defineProps<{ |
| 35 | - deviceDetail: Record<'tbDeviceId' | 'profileId' | 'id', string>; | 35 | + deviceDetail: Record<'tbDeviceId' | 'profileId' | 'id' | 'deviceProfileId', string>; |
| 36 | }>(); | 36 | }>(); |
| 37 | 37 | ||
| 38 | const grid = { | 38 | const grid = { |
| @@ -137,8 +137,8 @@ | @@ -137,8 +137,8 @@ | ||
| 137 | 137 | ||
| 138 | const { send, close, data } = useWebSocket(socketInfo.origin, { | 138 | const { send, close, data } = useWebSocket(socketInfo.origin, { |
| 139 | async onConnected() { | 139 | async onConnected() { |
| 140 | - const { id, profileId } = props.deviceDetail; | ||
| 141 | - const value = await getDeviceAttrs(profileId, id); | 140 | + const { id, deviceProfileId } = props.deviceDetail; |
| 141 | + const value = await getDeviceAttrs(deviceProfileId, id); | ||
| 142 | socketInfo.attrKeys = value; | 142 | socketInfo.attrKeys = value; |
| 143 | send(JSON.stringify(unref(getSendValue))); | 143 | send(JSON.stringify(unref(getSendValue))); |
| 144 | }, | 144 | }, |
| @@ -28,14 +28,14 @@ export const formSchema: FormSchema[] = [ | @@ -28,14 +28,14 @@ export const formSchema: FormSchema[] = [ | ||
| 28 | }, | 28 | }, |
| 29 | }, | 29 | }, |
| 30 | { | 30 | { |
| 31 | - field: 'profileId', | 31 | + field: 'deviceProfileId', |
| 32 | label: '', | 32 | label: '', |
| 33 | component: 'ApiSelect', | 33 | component: 'ApiSelect', |
| 34 | componentProps: { | 34 | componentProps: { |
| 35 | api: getDeviceProfile, | 35 | api: getDeviceProfile, |
| 36 | placeholder: '请选择产品', | 36 | placeholder: '请选择产品', |
| 37 | labelField: 'name', | 37 | labelField: 'name', |
| 38 | - valueField: 'tbProfileId', | 38 | + valueField: 'id', |
| 39 | }, | 39 | }, |
| 40 | }, | 40 | }, |
| 41 | { | 41 | { |