Browse Source

Merge branch 'feature/mockApi' of http://192.168.0.115:3000/zhangyupeng/zfb_mp into feature/mockApi

gemercheung 3 years ago
parent
commit
edae315ff2
2 changed files with 14 additions and 9 deletions
  1. 1 1
      src/api/corporation/model.ts
  2. 13 8
      src/views/dashboard/corporation/deviceModal.vue

+ 1 - 1
src/api/corporation/model.ts

@@ -4,7 +4,7 @@ import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel';
  */
  */
 export type PageParams = BasicPageParams;
 export type PageParams = BasicPageParams;
 export interface addDeiceParam {
 export interface addDeiceParam {
-  childName: string | null;
+  childNames: string | null;
   id: number;
   id: number;
   subNum: number;
   subNum: number;
   userName: string;
   userName: string;

+ 13 - 8
src/views/dashboard/corporation/deviceModal.vue

@@ -3,7 +3,7 @@
     v-bind="$attrs"
     v-bind="$attrs"
     @register="register"
     @register="register"
     title="新增设备"
     title="新增设备"
-    @ok="submitMolad"
+    @ok="submitModal"
     @visible-change="handleVisibleChange"
     @visible-change="handleVisibleChange"
   >
   >
     <div class="pt-3px pr-3px">
     <div class="pt-3px pr-3px">
@@ -114,7 +114,7 @@
           span: 24,
           span: 24,
         },
         },
       });
       });
-      async function submitMolad() {
+      async function submitModal() {
         let formData = {
         let formData = {
           ...getFieldsValue(),
           ...getFieldsValue(),
         };
         };
@@ -128,17 +128,22 @@
         }
         }
         if (validate) {
         if (validate) {
           const { subNum, id, userName } = modelRef.value;
           const { subNum, id, userName } = modelRef.value;
+          let childNameList = [];
+          Object.keys(formData).map((ele) => {
+            if (ele.includes('ID')) {
+              childNameList.push(formData[ele]);
+            }
+          });
+          console.log('modelRef.value', Object.keys(formData), childNameList);
           try {
           try {
             const res = await AddDevice({
             const res = await AddDevice({
-              childName: null,
+              childNames: childNameList,
               id,
               id,
               subNum,
               subNum,
               userName,
               userName,
             });
             });
-            if (res.code == 200) {
-              success(res.message);
-              closeModal();
-            }
+            success(res);
+            closeModal();
           } catch (errors) {
           } catch (errors) {
             error('errors');
             error('errors');
             console.log('not passing', error);
             console.log('not passing', error);
@@ -217,7 +222,7 @@
       }
       }
       return {
       return {
         register,
         register,
-        submitMolad,
+        submitModal,
         schemas,
         schemas,
         registerForm,
         registerForm,
         numOnChange,
         numOnChange,