Forráskód Böngészése

修改新增客户资料

huangbin 4 éve
szülő
commit
bc7c63c1b5

+ 27 - 17
src/views/information/custom/compoments/add/index.vue

@@ -214,32 +214,34 @@
           <a-form-item label="通讯地址">
           <a-form-item label="通讯地址">
             <a-select class="inlineFormSelect"
             <a-select class="inlineFormSelect"
                       style="width: 205px"
                       style="width: 205px"
+                      v-model:value="formState.provinceid"
+                      @change="getCityList"
                       placeholder="请选择省">
                       placeholder="请选择省">
-              <a-select-option value="1">
-                客户一
-              </a-select-option>
-              <a-select-option value="2">
-                客户二
+              <a-select-option v-for="item in provinceList"
+                               :key="item.autoid"
+                               :value="item.autoid">
+                {{item.divisionname}}
               </a-select-option>
               </a-select-option>
             </a-select>
             </a-select>
-            <a-select class="inlineFormSelect ml10"
+            <a-select class="inlineFormSelect ml9"
                       style="width: 205px"
                       style="width: 205px"
+                      v-model:value="formState.cityid"
+                      @change="getDistrictList"
                       placeholder="请选择市">
                       placeholder="请选择市">
-              <a-select-option value="1">
-                客户一
-              </a-select-option>
-              <a-select-option value="2">
-                客户二
+              <a-select-option v-for="item in cityList"
+                               :key="item.autoid"
+                               :value="item.autoid">
+                {{item.divisionname}}
               </a-select-option>
               </a-select-option>
             </a-select>
             </a-select>
-            <a-select class="inlineFormSelect ml10"
+            <a-select class="inlineFormSelect ml9"
+                      v-model:value="formState.districtid"
                       style="width: 205px"
                       style="width: 205px"
                       placeholder="请选择县(区)">
                       placeholder="请选择县(区)">
-              <a-select-option value="1">
-                客户一
-              </a-select-option>
-              <a-select-option value="2">
-                客户二
+              <a-select-option v-for="item in districtList"
+                               :key="item.autoid"
+                               :value="item.autoid">
+                {{item.divisionname}}
               </a-select-option>
               </a-select-option>
             </a-select>
             </a-select>
           </a-form-item>
           </a-form-item>
@@ -275,6 +277,7 @@ import { getCardType, initFormState, handleApply, handleForm } from './setup';
 import { AllEnums } from '@/services/go/commonService/interface';
 import { AllEnums } from '@/services/go/commonService/interface';
 import { FormState } from './interface';
 import { FormState } from './interface';
 import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
 import { RuleObject, ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
+import { getAddress } from '@/services/go/adress';
 
 
 export default defineComponent({
 export default defineComponent({
     name: 'add-custom',
     name: 'add-custom',
@@ -288,6 +291,8 @@ export default defineComponent({
         const { formRef, formState, rules } = handleForm();
         const { formRef, formState, rules } = handleForm();
         // 下单方法
         // 下单方法
         const { loading, applyAction } = handleApply();
         const { loading, applyAction } = handleApply();
+        // 地址
+        const { cityList, districtList, provinceList, getCityList, getDistrictList } = getAddress();
         function isPersonal(): boolean {
         function isPersonal(): boolean {
             return formState.userinfotype === '1';
             return formState.userinfotype === '1';
         }
         }
@@ -314,6 +319,11 @@ export default defineComponent({
             cancel,
             cancel,
             submit,
             submit,
             loading,
             loading,
+            cityList,
+            districtList,
+            provinceList,
+            getCityList,
+            getDistrictList,
         };
         };
     },
     },
 });
 });

+ 3 - 3
src/views/information/custom/compoments/add/interface.ts

@@ -15,9 +15,9 @@ export interface FormState {
     contactname: string; //联系人
     contactname: string; //联系人
     mobilephone: string; //手机号码 (加密存储)
     mobilephone: string; //手机号码 (加密存储)
     telphone: string; //联系电话(加密存储)
     telphone: string; //联系电话(加密存储)
-    provinceid: number; //省
-    cityid: number; //市
-    districtid: number; //地区
+    provinceid: number | null; //省
+    cityid: number | null; //市
+    districtid: number | null; //地区
     remark: string; //备注
     remark: string; //备注
     cardaddress: string; //证件地址 (加密存储)
     cardaddress: string; //证件地址 (加密存储)
     username: string;//用户姓名
     username: string;//用户姓名

+ 7 - 1
src/views/information/custom/compoments/add/setup.ts

@@ -1,8 +1,10 @@
 
 
 import { getCardTypeEnumList } from '@/common/constants/enumsList';
 import { getCardTypeEnumList } from '@/common/constants/enumsList';
+import { validateCommon } from '@/common/setup/validate';
 import { QueryAddUserInfoApply } from '@/services/go/ermcp/customInfo';
 import { QueryAddUserInfoApply } from '@/services/go/ermcp/customInfo';
 import { AddUserInfoApplyReq } from '@/services/go/ermcp/customInfo/interface';
 import { AddUserInfoApplyReq } from '@/services/go/ermcp/customInfo/interface';
 import { message } from 'ant-design-vue';
 import { message } from 'ant-design-vue';
+import { RuleObject } from 'ant-design-vue/lib/form/interface';
 import { reactive, ref, UnwrapRef } from 'vue';
 import { reactive, ref, UnwrapRef } from 'vue';
 import { FormState } from './interface';
 import { FormState } from './interface';
 
 
@@ -18,11 +20,15 @@ export function getCardType() {
 export function handleForm() {
 export function handleForm() {
     const formRef = ref();
     const formRef = ref();
     const formState: UnwrapRef<FormState> = reactive(initFormState());
     const formState: UnwrapRef<FormState> = reactive(initFormState());
+    // 验证仓库类型
+    async function v_cardtype(rule: RuleObject, value: number) {
+        return validateCommon(value, '请选择证件类型')
+    }
     const rules = {
     const rules = {
         userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
         userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
         customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
         customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
         nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
         nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
-        cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
+        cardtype: [{ required: true, validator: v_cardtype, trigger: 'change' }],
     };
     };
     return { formRef, formState, rules }
     return { formRef, formState, rules }
 }
 }