Commit 0a8196d9dd8d87c4b2c2438e083428e35479f7fd

Authored by sqy
1 parent b16b7e2b

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

1 1 <template>
2 2 <BasicModal
3 3 v-bind="$attrs"
4   - width="55rem"
  4 + width="50rem"
5 5 :title="getTitle"
6 6 @register="register"
7 7 @cancel="handleCancel"
... ... @@ -19,7 +19,6 @@
19 19 <DeviceStep1
20 20 @next="handleStep1Next"
21 21 ref="DeviceStep1Ref"
22   - :deviceInfo="deviceInfo"
23 22 v-show="current === 0"
24 23 :isUpdate="!isUpdate"
25 24 />
... ... @@ -77,13 +76,12 @@
77 76 profile: record.deviceProfile.name,
78 77 profileId: record.profileId,
79 78 deviceType: record.deviceType,
  79 + deviceInfo: record.deviceInfo,
80 80 });
81   - deviceInfo.value = record.deviceInfo;
82 81 unref(DeviceStep1Ref)?.disabledDeviceType(true);
83 82 } else {
84 83 unref(DeviceStep1Ref)?.disabledDeviceType(false);
85 84 unref(DeviceStep1Ref)?.parentResetPositionState();
86   - deviceInfo.value = {};
87 85 }
88 86 setModalProps({ loading: false });
89 87 });
... ...
... ... @@ -74,7 +74,7 @@
74 74 </div>
75 75 </template>
76 76 <script lang="ts">
77   - import { defineComponent, ref, nextTick, unref, reactive, watch } from 'vue';
  77 + import { defineComponent, ref, nextTick, unref, reactive } from 'vue';
78 78 import { BasicForm, useForm } from '/@/components/Form';
79 79 import { step1Schemas } from '../../config/data';
80 80 import { useScript } from '/@/hooks/web/useScript';
... ... @@ -101,10 +101,6 @@
101 101 Col,
102 102 },
103 103 props: {
104   - deviceInfo: {
105   - type: Object,
106   - default: () => ({}),
107   - },
108 104 isUpdate: {
109 105 type: Boolean,
110 106 },
... ... @@ -298,6 +294,11 @@
298 294 };
299 295 // 父组件调用更新字段值的方法
300 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 302 setFieldsValue(data);
302 303 }
303 304 // 父组件调用获取字段值的方法
... ... @@ -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 334 return {
345 335 resetFields,
346 336 positionState,
... ... @@ -370,36 +360,8 @@
370 360 });
371 361 </script>
372 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 367 </style>
... ...