فهرست منبع

feat(api): update api 11

gemercheung 3 سال پیش
والد
کامیت
413b1d6125

+ 12 - 7
src/api/corporation/modal.ts

@@ -37,14 +37,19 @@ export const AddDevice = (params: addDeiceParam) =>
   });
 
 export const checkDevice = (params: checkDeiceParam) =>
-  defHttp.post<Result>({
-    url: Api.checkDevice,
-    params,
-    headers: {
-      // @ts-ignore
-      ignoreCancelToken: true,
+  defHttp.post<Result>(
+    {
+      url: Api.checkDevice,
+      params,
+      headers: {
+        // @ts-ignore
+        ignoreCancelToken: true,
+      },
     },
-  });
+    {
+      errorMessageMode: 'none',
+    },
+  );
 export const auditCompany = (params: auditParam) =>
   defHttp.post<Result>({
     url: Api.auditCompany,

+ 5 - 4
src/api/corporation/model.ts

@@ -10,10 +10,11 @@ export interface UpdateCompanyParam {
   bgMusic?: string;
 }
 export interface addDeiceParam {
-  childNames: string | null;
-  id: number;
-  subNum: number;
-  userName: string;
+  childNames?: string;
+  id?: number;
+  companyId: string;
+  subNum?: string;
+  userName?: string;
 }
 export interface checkDeiceParam {
   childName: string | null;

+ 2 - 1
src/utils/http/axios/index.ts

@@ -83,7 +83,8 @@ const transform: AxiosTransform = {
         userStore.logout(true);
         break;
       case ResultEnum.JAVA_ERROR:
-        timeoutMsg = t('sys.api.errMsg500');
+        // timeoutMsg = t('sys.api.errMsg500');
+        timeoutMsg = msg;
         break;
       default:
         if (message) {

+ 12 - 2
src/views/corporation/SubaccountModal.vue

@@ -32,6 +32,7 @@
           :dataSource="myData.TableData"
           :bordered="true"
           :pagination="false"
+          @register="registerSubtable"
           :beforeEditSubmit="beforeEditSubmit"
         >
           <template #action="{ record }">
@@ -51,7 +52,7 @@
             />
           </template>
         </BasicTable>
-        <AddModal @register="register4" @addtable="addTabledata" />
+        <AddModal @register="register4" @addtable="addTabledata" @update="reloadSubtable" />
       </div>
     </div>
     <EditModal @register="registerEdit" />
@@ -71,7 +72,13 @@
     // inject,
   } from 'vue';
   import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
-  import { BasicTable, BasicColumn, TableAction, TableActionType } from '/@/components/Table';
+  import {
+    BasicTable,
+    useTable,
+    BasicColumn,
+    TableAction,
+    TableActionType,
+  } from '/@/components/Table';
   import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
   import { selectUserList, saveSubUsers } from '/@/api/corporation/modal';
   import { useMessage } from '/@/hooks/web/useMessage';
@@ -91,6 +98,7 @@
       const currentModal = shallowRef<Nullable<ComponentOptions>>(null);
       const tableRef = ref<Nullable<TableActionType>>(null);
       const [register4, { openModal: addopenModal }] = useModal();
+      const [registerSubtable, { reloadSubtable }] = useTable();
       const modelRef = ref({});
       // const reload = inject('tablereload');
       // const editList = ref({
@@ -314,6 +322,8 @@
         closeModal,
         addTabledata,
         t,
+        registerSubtable,
+        reloadSubtable,
       };
     },
   });

+ 18 - 7
src/views/corporation/deviceModal.vue

@@ -32,7 +32,11 @@
     },
     emits: ['register'],
     setup(props) {
-      const modelRef = ref({});
+      const modelRef = ref({
+        subNum: 0,
+        id: '',
+        userName: '',
+      });
       const num = ref(0);
       const { t } = useI18n();
       const { createMessage } = useMessage();
@@ -141,16 +145,16 @@
           console.log('modelRef.value', Object.keys(formData), childNameList);
           try {
             const res = await AddDevice({
-              childNames: childNameList,
-              id,
-              subNum,
+              childNames: childNameList.join(','),
+              companyId: id,
+              subNum: String(subNum),
               userName,
             });
             success(res);
             closeModal();
           } catch (errors) {
-            error('errors');
-            console.log('not passing', error);
+            // error('errors');
+            // console.log('not passing', error);
           }
         }
       }
@@ -159,10 +163,17 @@
         resetFields();
         setFieldsValue({
           ...data.record,
+          subNum: 0,
         });
 
         // // 方式2
-        modelRef.value = { ...data.record };
+        modelRef.value = {
+          ...data.record,
+        };
+        num.value = 0;
+        // Reflect.set(modelRef, {
+        //   ...data.record,
+        // });
 
         // setProps({
         //   ...data.record,