Эх сурвалжийг харах

perf(views): 修复"创建组织"步骤设备类型查询异常问题

wangshun 1 долоо хоног өмнө
parent
commit
a922ff0331

+ 25 - 7
src/views/create-customer/EstablishOrganization.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { inject, onMounted, ref } from 'vue';
+import { inject, onMounted, ref, watch } from 'vue';
 import { ColorPicker } from 'vue-color-kit';
 import { message } from 'ant-design-vue';
 
@@ -57,7 +57,7 @@ const colorStyle: ColorStyle[] = [
   {
     background: 'background:#32bac0',
     border: 'border:1px solid #32bac0',
-    color: '#32bac0',
+    color: '#32BAC0',
     index: 0,
   },
   {
@@ -197,16 +197,15 @@ defineExpose<UseGuideStepItemExpose>({
   finish,
 });
 
-onMounted(() => {
+const getInfoListByOrg = () => {
   handleRequest(async () => {
-    await getDataValidityPeriod();
-    equipmentType.value = await groupList({
-      dataType: 1,
-    });
     if (props.form.id) {
       equipmentLimitationsList.value = [];
       const data = await getInfoListByOrgId(props.form.id);
       data.forEach((item) => {
+        if (item.deviceGlobalId === -1) {
+          props.form.stationsNumber = item.upperLimit;
+        }
         if (item.deviceGlobalId !== -1) {
           equipmentLimitationsList.value.push({
             deviceGlobalId: item.deviceGlobalId,
@@ -216,6 +215,25 @@ onMounted(() => {
       });
     }
   });
+};
+
+watch(
+  () => props.form.id,
+  (count) => {
+    if (count) {
+      getInfoListByOrg();
+    }
+  },
+);
+
+onMounted(() => {
+  handleRequest(async () => {
+    await getDataValidityPeriod();
+    equipmentType.value = await groupList({
+      dataType: 1,
+    });
+    getInfoListByOrg();
+  });
 });
 </script>