Browse Source

修改新增客户资料

huangbin 4 năm trước cách đây
mục cha
commit
afda2ba89c

+ 34 - 0
src/services/bus/allEnum.ts

@@ -0,0 +1,34 @@
+import { AllEnums } from '@/services/go/commonService/interface';
+import { localStorageUtil } from '@/utils/storage';
+
+/**
+ * 是否有所有枚举数据
+ * @returns 
+ */
+export function isAllEnum(): boolean {
+    return localStorageUtil.getItem('allEnums') ? true : false;
+}
+
+/**
+ * 获取所有枚举数据
+ * @returns 
+ */
+export function getAllEnum(): AllEnums[] {
+    return isAllEnum() ? localStorageUtil.getItem('allEnums') : []
+}
+
+/**
+ * 缓存所有枚举数据
+ * @param value 
+ */
+export function setAllEnum(value: AllEnums[]) {
+    localStorageUtil.setItem('allEnums', value);
+}
+
+/**
+ * 获取具体某个枚举
+ * @param enumdiccode: string; //所属枚举代码
+ */
+export function getItemEnum(enumdiccode: string) {
+    return getAllEnum().filter(e => e.enumdiccode === enumdiccode)
+}

+ 7 - 2
src/services/bus/index.ts

@@ -1,7 +1,7 @@
 import APP from '@/services';
 import { isLogin } from '@/services/bus/login';
 import { checkTokenLoop, handleTokenCheck } from '@/services/bus/token';
-import { GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
+import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
 import { getAppConfig, getCommonApiUrl } from '@/services/go/config';
 import { LoginQuery } from '@/services/go/useInfo/index';
 import { setServiceURL } from '@/services/request/serviceURL';
@@ -42,10 +42,15 @@ export async function globalDataRefresh(): Promise<string> {
             APP.reset();
         }
 
+        // 获取错误信息
         if (!localStorageUtil.getItem('errorCodeInfos')) {
             await queryErrorInfos();
         }
-
+        // 获取枚举
+        // if (!isAllEnum()) {
+        //     await getAllEnums();
+        // }
+        await getAllEnums();
         // await queryGoodsList();
         return Promise.resolve('ok');
     } catch (error) {

+ 11 - 3
src/services/bus/login.ts

@@ -1,7 +1,9 @@
 import APP from '@/services';
+import { isAllEnum } from '@/services/bus/allEnum';
 import { checkTokenLoop } from '@/services/bus/token';
-import { GetPCMenus, getServerTime, QueryTableDefine } from '@/services/go/commonService/index';
+import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
 import { GetLoginID, LoginQuery } from '@/services/go/useInfo/index';
+import { localStorageUtil } from '@/utils/storage';
 import { sessionStorageUtil } from '@/utils/storage/index';
 import Long from 'long';
 import { logoutResponse } from '../socket/login';
@@ -26,8 +28,14 @@ export const login = async (logidCode: string, password: String, byteArr: Uint8A
         await QueryTableDefine();
         // 获取服务时间
         await getServerTime();
-        // getAllEnums();/
-        // queryErrorInfos();
+        // 获取错误信息
+        if (!localStorageUtil.getItem('errorCodeInfos')) {
+            await queryErrorInfos();
+        }
+        // 获取枚举
+        if (!isAllEnum()) {
+            await getAllEnums();
+        }
         // 校验token
         checkTokenLoop();
         await LoginQuery();

+ 11 - 4
src/services/go/commonService/index.ts

@@ -1,4 +1,5 @@
 import APP from '@/services';
+import { setAllEnum } from '@/services/bus/allEnum';
 import { getLongTypeLoginID } from '@/services/bus/login';
 import { localStorageUtil } from '@/utils/storage';
 import moment from 'moment';
@@ -26,11 +27,17 @@ export function getServerTime(): Promise<string> {
  * 获取所有枚举信息
  * @param autoid autoid传入后则返回这个ID之后的数据;如不传则返回所有
  */
-export function getAllEnums(autoid?: number): Promise<type.AllEnums[]> {
+export function getAllEnums(autoid?: number): Promise<string> {
     const param = autoid ? { autoid } : {};
-    return commonSearch_go('/Common/GetAllEnums', param).catch((err: Error) => {
-        throw new Error('查询获取所有枚举信息:' + err.message);
-    });
+    return commonSearch_go('/Common/GetAllEnums', param)
+        .then((res) => {
+            console.log('所有枚举信息', res);
+            setAllEnum(res)
+            return 'ok';
+        })
+        .catch((err: Error) => {
+            throw new Error('查询获取所有枚举信息:' + err.message);
+        });
 }
 
 /**

+ 7 - 6
src/utils/storage/localStorage.ts

@@ -1,11 +1,12 @@
-import { toBase64, parseBase64 } from './base64/index';
 import { ErrorCodeList } from '@/services/dataCenter/interafce/error';
-interface storageKeyName {
+import { parseBase64, toBase64 } from './base64/index';
+interface StorageKeyName {
     loginData: string; // 账号登录返回信息 token等
     loginAccount: string; // 登录账号信息 用来多窗口
     bankSignDetail: string; // 银行签约信息详情
     cusBank: string; // 托管银行
     ErrorInfos: string; // 数据库错误信息
+    allEnums: string; // 所有枚举信息
     errorCodeInfos: ErrorCodeList[];
 }
 
@@ -19,7 +20,7 @@ class LocalStorage {
      * @param key 数据项名
      * @param value 数据项值
      */
-    setItem(key: keyof storageKeyName, value: any): void {
+    setItem(key: keyof StorageKeyName, value: any): void {
         localStorage.setItem(toBase64(key), toBase64(value));
         if (!this.cacheKey.includes(key)) {
             this.cacheKey.push(key);
@@ -29,14 +30,14 @@ class LocalStorage {
      * 移除 localStorage 项
      * @param key 移除项名
      */
-    removeItem(key: keyof storageKeyName): void {
+    removeItem(key: keyof StorageKeyName): void {
         localStorage.removeItem(toBase64(key));
     }
     /**
      * 读取 localStorage 项
      * @param key 读取项名
      */
-    getItem(key: keyof storageKeyName): any {
+    getItem(key: keyof StorageKeyName): any {
         const value = localStorage.getItem(toBase64(key)) as string;
         return value && parseBase64(value);
     }
@@ -44,7 +45,7 @@ class LocalStorage {
      * 清空本项目LocalStorage中所有成员
      */
     clear(): void {
-        this.cacheKey.forEach((e) => this.removeItem(e as keyof storageKeyName));
+        this.cacheKey.forEach((e) => this.removeItem(e as keyof StorageKeyName));
         this.cacheKey.length = 0;
     }
 }

+ 1 - 0
src/views/information/custom/compoments/add/index.vue

@@ -53,6 +53,7 @@
         <a-col :span="12">
           <a-form-item label="证件类型">
             <a-select class="inlineFormSelect"
+                      v-model:value="formState.cardtype"
                       style="width: 200px"
                       placeholder="请选择证件类型">
               <a-select-option value="1">

+ 4 - 0
src/views/information/custom/compoments/add/setup.ts

@@ -0,0 +1,4 @@
+
+export function getCardType() {
+
+}