Commit 0a8196d9dd8d87c4b2c2438e083428e35479f7fd

Authored by sqy
1 parent b16b7e2b

fix:[DEFECT-331]修复设备闲置位置为空问题

1 <template> 1 <template>
2 <BasicModal 2 <BasicModal
3 v-bind="$attrs" 3 v-bind="$attrs"
4 - width="55rem" 4 + width="50rem"
5 :title="getTitle" 5 :title="getTitle"
6 @register="register" 6 @register="register"
7 @cancel="handleCancel" 7 @cancel="handleCancel"
@@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
19 <DeviceStep1 19 <DeviceStep1
20 @next="handleStep1Next" 20 @next="handleStep1Next"
21 ref="DeviceStep1Ref" 21 ref="DeviceStep1Ref"
22 - :deviceInfo="deviceInfo"  
23 v-show="current === 0" 22 v-show="current === 0"
24 :isUpdate="!isUpdate" 23 :isUpdate="!isUpdate"
25 /> 24 />
@@ -77,13 +76,12 @@ @@ -77,13 +76,12 @@
77 profile: record.deviceProfile.name, 76 profile: record.deviceProfile.name,
78 profileId: record.profileId, 77 profileId: record.profileId,
79 deviceType: record.deviceType, 78 deviceType: record.deviceType,
  79 + deviceInfo: record.deviceInfo,
80 }); 80 });
81 - deviceInfo.value = record.deviceInfo;  
82 unref(DeviceStep1Ref)?.disabledDeviceType(true); 81 unref(DeviceStep1Ref)?.disabledDeviceType(true);
83 } else { 82 } else {
84 unref(DeviceStep1Ref)?.disabledDeviceType(false); 83 unref(DeviceStep1Ref)?.disabledDeviceType(false);
85 unref(DeviceStep1Ref)?.parentResetPositionState(); 84 unref(DeviceStep1Ref)?.parentResetPositionState();
86 - deviceInfo.value = {};  
87 } 85 }
88 setModalProps({ loading: false }); 86 setModalProps({ loading: false });
89 }); 87 });
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 </div> 74 </div>
75 </template> 75 </template>
76 <script lang="ts"> 76 <script lang="ts">
77 - import { defineComponent, ref, nextTick, unref, reactive, watch } from 'vue'; 77 + import { defineComponent, ref, nextTick, unref, reactive } from 'vue';
78 import { BasicForm, useForm } from '/@/components/Form'; 78 import { BasicForm, useForm } from '/@/components/Form';
79 import { step1Schemas } from '../../config/data'; 79 import { step1Schemas } from '../../config/data';
80 import { useScript } from '/@/hooks/web/useScript'; 80 import { useScript } from '/@/hooks/web/useScript';
@@ -101,10 +101,6 @@ @@ -101,10 +101,6 @@
101 Col, 101 Col,
102 }, 102 },
103 props: { 103 props: {
104 - deviceInfo: {  
105 - type: Object,  
106 - default: () => ({}),  
107 - },  
108 isUpdate: { 104 isUpdate: {
109 type: Boolean, 105 type: Boolean,
110 }, 106 },
@@ -298,6 +294,11 @@ @@ -298,6 +294,11 @@
298 }; 294 };
299 // 父组件调用更新字段值的方法 295 // 父组件调用更新字段值的方法
300 function parentSetFieldsValue(data) { 296 function parentSetFieldsValue(data) {
  297 + const { deviceInfo } = data;
  298 + positionState.longitude = deviceInfo.longitude;
  299 + positionState.latitude = deviceInfo.latitude;
  300 + positionState.address = deviceInfo.address;
  301 + devicePic.value = deviceInfo.avatar;
301 setFieldsValue(data); 302 setFieldsValue(data);
302 } 303 }
303 // 父组件调用获取字段值的方法 304 // 父组件调用获取字段值的方法
@@ -330,17 +331,6 @@ @@ -330,17 +331,6 @@
330 }, 331 },
331 }); 332 });
332 } 333 }
333 -  
334 - watch(  
335 - () => props.deviceInfo,  
336 - (newValue) => {  
337 - positionState.longitude = newValue.longitude;  
338 - positionState.latitude = newValue.latitude;  
339 - positionState.address = newValue.address;  
340 - devicePic.value = newValue.avatar;  
341 - }  
342 - );  
343 -  
344 return { 334 return {
345 resetFields, 335 resetFields,
346 positionState, 336 positionState,
@@ -370,36 +360,8 @@ @@ -370,36 +360,8 @@
370 }); 360 });
371 </script> 361 </script>
372 <style lang="less" scoped> 362 <style lang="less" scoped>
373 - .step1 {  
374 - &-form {  
375 - width: 450px;  
376 - margin: 0 auto;  
377 - }  
378 -  
379 - h3 {  
380 - margin: 0 0 12px;  
381 - font-size: 16px;  
382 - line-height: 32px;  
383 - color: @text-color;  
384 - }  
385 -  
386 - h4 {  
387 - margin: 0 0 4px;  
388 - font-size: 14px;  
389 - line-height: 22px;  
390 - color: @text-color;  
391 - }  
392 -  
393 - p {  
394 - color: @text-color;  
395 - }  
396 - }  
397 -  
398 - .pay-select {  
399 - width: 20%;  
400 - }  
401 -  
402 - .pay-input {  
403 - width: 70%; 363 + .step1-form {
  364 + width: 450px;
  365 + margin: 0 auto;
404 } 366 }
405 </style> 367 </style>