소스 검색

修改新增

huangbin 4 년 전
부모
커밋
dc97bad4a4

+ 100 - 60
src/views/information/custom/compoments/add/index.vue

@@ -115,39 +115,101 @@
                        placeholder="请输入联系人" />
             </a-form-item>
           </a-col>
+          <a-col :span="12">
+            <a-form-item label="联系人手机号"
+                         name="mobilephone">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.mobilephone"
+                       placeholder="请输入联系人手机号" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="联系电话"
+                         name="telphone">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.telphone"
+                       placeholder="请输入联系电话" />
+            </a-form-item>
+          </a-col>
+        </template>
+        <template v-else>
+          <a-col :span="12">
+            <a-form-item label="姓名"
+                         name="username">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.username"
+                       placeholder="请输入姓名" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="身份证号码"
+                         name="cardnum">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.cardnum"
+                       placeholder="请输入身份证号码" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="手机号码"
+                         name="mobilephone">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.mobilephone"
+                       placeholder="请输入手机号码" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="身份证正面照"
+                         name="cardbackphotourl">
+              <div class="upload">
+                <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
+                          :transform-file="transformFile">
+                  <a-button class="uploadBtn">上传</a-button>
+                </a-upload>
+                <div class="look">查看附件</div>
+              </div>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="邮箱"
+                         name="email">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.email"
+                       placeholder="请输入邮箱" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-item label="身份证反面照"
+                         name="cardfrontphotourl">
+              <div class="upload">
+                <a-upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
+                          :transform-file="transformFile">
+                  <a-button class="uploadBtn">上传</a-button>
+                </a-upload>
+                <div class="look">查看附件</div>
+              </div>
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item label="联系电话"
+                         name="telphone">
+              <a-input class="dialogInput"
+                       style="width: 200px"
+                       v-model:value="formState.telphone"
+                       placeholder="请输入联系电话" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-item>
+              &nbsp;
+            </a-form-item>
+          </a-col>
         </template>
-        <a-col :span="12">
-          <a-form-item label="姓名"
-                       name="mobilephone">
-            <a-input class="dialogInput"
-                     style="width: 200px"
-                     v-model:value="formState.mobilephone"
-                     placeholder="请输入姓名" />
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="联系人手机号"
-                       name="mobilephone">
-            <a-input class="dialogInput"
-                     style="width: 200px"
-                     v-model:value="formState.mobilephone"
-                     placeholder="请输入联系人手机号" />
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item label="联系电话"
-                       name="telphone">
-            <a-input class="dialogInput"
-                     style="width: 200px"
-                     v-model:value="formState.telphone"
-                     placeholder="请输入联系电话" />
-          </a-form-item>
-        </a-col>
-        <a-col :span="12">
-          <a-form-item>
-            &nbsp;
-          </a-form-item>
-        </a-col>
         <a-col :span="24">
           <a-form-item label="通讯地址">
             <a-select class="inlineFormSelect"
@@ -209,7 +271,7 @@
 import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods/index';
 import { defineComponent, ref, reactive, toRaw, UnwrapRef } from 'vue';
-import { getCardType } from './setup';
+import { getCardType, initFormState, handleApply } from './setup';
 import { AllEnums } from '@/services/go/commonService/interface';
 import { FormState } from './interface';
 import { ValidateErrorEntity } from 'ant-design-vue/es/form/interface';
@@ -221,49 +283,27 @@ export default defineComponent({
         const { visible, cancel } = closeModal('custom_info_btn_add');
         const cardTypeList = ref<AllEnums[]>(getCardType());
         const formRef = ref();
-        const formState: UnwrapRef<FormState> = reactive({
-            userinfotype: '2',
-            customername: '',
-            nickname: '',
-            cardtype: undefined,
-            cardnum: '',
-            legalpersonname: '',
-            taxpayernum: '',
-            attachment1: '',
-            attachment2: '',
-            attachment3: '',
-            attachment4: '',
-            attachment5: '',
-            contactname: '',
-            mobilephone: '',
-            telphone: '',
-            provinceid: 0,
-            cityid: 0,
-            districtid: 0,
-            cardaddress: '',
-            remark: '',
-        });
+        const formState: UnwrapRef<FormState> = reactive(initFormState());
         const rules = {
             userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
             customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
             nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
             cardtype: [{ required: true, message: '请选择证件类型', trigger: 'change' }],
         };
-        const loading = ref<boolean>(false);
+        const { loading, applyAction } = handleApply();
         function isPersonal(): boolean {
             return formState.userinfotype === '1';
         }
         function submit() {
-            loading.value = true;
             formRef.value
                 .validate()
                 .then(() => {
-                    console.log('values', formState, toRaw(formState));
-                    loading.value = false;
+                    const param = toRaw(formState);
+                    applyAction(param);
+                    console.log('values', formState);
                 })
                 .catch((error: ValidateErrorEntity<FormState>) => {
                     console.log('error', error);
-                    loading.value = false;
                 });
         }
         initData(() => {});

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

@@ -20,4 +20,8 @@ export interface FormState {
     districtid: number; //地区
     remark: string; //备注
     cardaddress: string; //证件地址 (加密存储)
+    username: string;//用户姓名
+    cardbackphotourl: string;//背面证件照地址
+    cardfrontphotourl: string;//正面证件照地址
+    email: string;//Email地址(加密存储)
 }

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

@@ -1,6 +1,10 @@
 
 import { getItemEnum } from '@/services/bus/allEnum';
+import { QueryAddUserInfoApply } from '@/services/go/ermcp/customInfo';
 import { AddUserInfoApplyReq } from '@/services/go/ermcp/customInfo/interface';
+import { message } from 'ant-design-vue';
+import { ref } from 'vue';
+import { FormState } from './interface';
 
 /**
  * 获取证件类型
@@ -8,11 +12,52 @@ import { AddUserInfoApplyReq } from '@/services/go/ermcp/customInfo/interface';
  */
 export function getCardType() {
     const arr = [2, 4, 18, 21];
-    console.log('getCardType', getItemEnum('certificatetype').filter(e => arr.includes(e.enumitemname)));
-
     return getItemEnum('certificatetype').filter(e => arr.includes(e.enumitemname))
 }
 
-export function applyAction(param: AddUserInfoApplyReq) {
+/**
+ * 初始化表单数据
+ * @returns 
+ */
+export function initFormState(): FormState {
+    return {
+        userinfotype: '2',
+        customername: '',
+        nickname: '',
+        cardtype: undefined,
+        cardnum: '',
+        legalpersonname: '',
+        taxpayernum: '',
+        attachment1: '',
+        attachment2: '',
+        attachment3: '',
+        attachment4: '',
+        attachment5: '',
+        contactname: '',
+        mobilephone: '',
+        telphone: '',
+        provinceid: 0,
+        cityid: 0,
+        districtid: 0,
+        cardaddress: '',
+        remark: '',
+        username: '',
+        cardbackphotourl: '',
+        cardfrontphotourl: '',
+        email: '',
+    }
+}
 
+export function handleApply() {
+    const loading = ref<boolean>(false);
+    function applyAction(param: AddUserInfoApplyReq) {
+        QueryAddUserInfoApply(param).then(res => {
+            console.log('res', res);
+            loading.value = true;
+        }).catch(err => {
+            loading.value = false;
+            message.error(err)
+        })
+    }
+    return { loading, applyAction }
 }