From 65c7175a1d7d448f91ee61a8a9aa935263939d37 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期四, 17 四月 2025 10:10:22 +0800
Subject: [PATCH] feat: 接口对接

---
 src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue |  152 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 99 insertions(+), 53 deletions(-)

diff --git a/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue b/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue
index 2d5ee59..b5a01b5 100644
--- a/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue
+++ b/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue
@@ -2,23 +2,27 @@
   <LoadingLayout :loading="isEdit && isLoading">
     <AppScrollContainer>
       <ChunkCell title="浼佷笟鍩烘湰淇℃伅">
-        <ProForm :model="form" :rules="rules" ref="formRef" label-width="120px" :is-read="isDetail">
+        <ProForm :model="form" ref="formRef" label-width="140px" :is-read="isDetail">
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="浼佷笟鍚嶇О:" prop="name" required>
+              <ProFormItemV2
+                label="浼佷笟鍚嶇О:"
+                prop="enterpriseName"
+                :check-rules="[{ message: '璇疯緭鍏ヤ紒涓氬悕绉�' }]"
+              >
                 <ProFormText
-                  v-model.trim="form.name"
+                  v-model.trim="form.enterpriseName"
                   :maxlength="30"
-                  placeholder="璇疯緭鍏ヤ緵搴斿晢鍚嶇О"
+                  placeholder="璇疯緭鍏ヤ紒涓氬悕绉�"
                 />
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="娉曚汉濮撳悕:" prop="name" required>
+              <ProFormItemV2 label="娉曚汉濮撳悕:" prop="legalPersonName">
                 <ProFormText
-                  v-model.trim="form.name"
+                  v-model.trim="form.legalPersonName"
                   :maxlength="30"
                   placeholder="璇疯緭鍏ユ硶浜哄鍚�"
                 />
@@ -27,9 +31,9 @@
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="娉曚汉韬唤璇佸彿:" prop="name" required>
+              <ProFormItemV2 label="娉曚汉韬唤璇佸彿:" prop="legalPersonIdNumber">
                 <ProFormText
-                  v-model.trim="form.name"
+                  v-model.trim="form.legalPersonIdNumber"
                   :maxlength="30"
                   placeholder="璇疯緭鍏ユ硶浜鸿韩浠借瘉鍙�"
                 />
@@ -38,7 +42,11 @@
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="缁熶竴绀句細淇$敤浠g爜:" prop="societyCreditCode">
+              <ProFormItemV2
+                label="缁熶竴绀句細淇$敤浠g爜:"
+                prop="societyCreditCode"
+                :check-rules="[{ message: '璇疯緭鍏ョ粺涓�绀句細淇$敤浠g爜', type: 'societyCreditCode' }]"
+              >
                 <ProFormText
                   v-model.trim="form.societyCreditCode"
                   placeholder="璇疯緭鍏ョ粺涓�绀句細淇$敤浠g爜"
@@ -48,9 +56,9 @@
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="鎵�鍦ㄧ渷浠�:" prop="name" required>
+              <ProFormItemV2 label="鎵�鍦ㄧ渷浠�:" prop="proviceName">
                 <ProFormText
-                  v-model.trim="form.name"
+                  v-model.trim="form.proviceName"
                   :maxlength="30"
                   placeholder="璇疯緭鍏ユ墍鍦ㄧ渷浠�"
                 />
@@ -59,21 +67,23 @@
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="鎵�灞炶涓�:" prop="name" required>
+              <ProFormItemV2 label="鎵�灞炶涓�:" prop="belongIndustryType">
                 <ProFormSelect
                   placeholder="璇烽�夋嫨鎵�灞炶涓�"
                   :value-enum="typeList"
+                  enum-value-key="id"
+                  enum-label-key="name"
                   clearable
-                  v-model="form.name"
+                  v-model="form.belongIndustryType"
                 ></ProFormSelect>
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="鎵�鍦ㄥ煄甯�:" prop="name" required>
+              <ProFormItemV2 label="鎵�鍦ㄥ煄甯�:" prop="cityName">
                 <ProFormText
-                  v-model.trim="form.name"
+                  v-model.trim="form.cityName"
                   :maxlength="30"
                   placeholder="璇疯緭鍏ユ墍鍦ㄥ煄甯�"
                 />
@@ -82,9 +92,9 @@
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="24">
-              <ProFormItemV2 label="涓昏惀涓氬姟:" prop="name">
+              <ProFormItemV2 label="涓昏惀涓氬姟:" prop="cityName">
                 <ProFormTextArea
-                  v-model="form.name"
+                  v-model="form.cityName"
                   maxlength="200"
                   :rows="6"
                   show-word-limit
@@ -98,7 +108,6 @@
       <ChunkCell title="鑱旂郴淇℃伅">
         <ProForm
           :model="form"
-          :rules="rules"
           ref="settingFormRef"
           label-width="140px"
           :scroll-to-error="false"
@@ -106,7 +115,11 @@
         >
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="鑱旂郴浜�:" prop="contact">
+              <ProFormItemV2
+                label="鑱旂郴浜�:"
+                prop="contact"
+                :check-rules="[{ message: '璇疯緭鍏ヨ仈绯讳汉' }]"
+              >
                 <ProFormText
                   v-model.trim="form.contact"
                   :maxlength="30"
@@ -117,7 +130,11 @@
           </ProFormCol>
           <ProFormCol>
             <ProFormColItem :span="12">
-              <ProFormItemV2 label="鑱旂郴鐢佃瘽:" prop="contactPhone">
+              <ProFormItemV2
+                label="鑱旂郴鐢佃瘽:"
+                prop="contactPhone"
+                :check-rules="[{ message: '璇疯緭鍏ヨ仈绯荤數璇�', type: 'phone' }]"
+              >
                 <ProFormText v-model.trim="form.contactPhone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" />
               </ProFormItemV2>
             </ProFormColItem>
@@ -134,6 +151,31 @@
               </ProFormItemV2>
             </ProFormColItem>
           </ProFormCol>
+        </ProForm>
+      </ChunkCell>
+      <ChunkCell title="璐﹀彿淇℃伅">
+        <ProForm
+          :model="form"
+          ref="accountFormRef"
+          label-width="140px"
+          :scroll-to-error="false"
+          :is-read="isDetail"
+        >
+          <ProFormCol>
+            <ProFormColItem :span="12">
+              <ProFormItemV2
+                label="璐﹀彿:"
+                prop="contact"
+                :check-rules="[{ message: '璇疯緭鍏ヨ处鍙�' }]"
+              >
+                <ProFormText v-model.trim="form.contact" :maxlength="30" placeholder="璇疯緭鍏ヨ处鍙�" />
+              </ProFormItemV2>
+            </ProFormColItem>
+          </ProFormCol>
+          <div class="chuck-add-or-edit-actions">
+            <el-button @click="handleBack">杩斿洖</el-button>
+            <el-button v-if="!isDetail" type="primary" @click="handleSubmit">纭</el-button>
+          </div>
         </ProForm>
       </ChunkCell>
     </AppScrollContainer>
@@ -154,7 +196,7 @@
 } from '@bole-core/components';
 import { FormRules, FormInstance } from 'element-plus';
 import { SearchType } from '@/constants';
-import * as searchSettingServices from '@/services/api/SearchSetting';
+import * as flexEnterpriseServices from '@/services/api/FlexEnterprise';
 import { useRouteView, useGlobalEventContext, GlobalEvent, useSearchSettingType } from '@/hooks';
 import _ from 'lodash';
 import { validateFormList, filterCN } from '@/utils';
@@ -175,7 +217,7 @@
   id: '',
   emitAddEvent: 'enterprise:add',
   emitEditEvent: 'enterprise:edit',
-  backRouteName: '',
+  backRouteName: 'EnterpriseManageList',
 });
 
 const route = useRoute();
@@ -189,8 +231,13 @@
 
 const form = reactive({
   id: '',
-  name: '',
+  enterpriseName: '',
+  legalPersonName: '',
+  legalPersonIdNumber: '',
   societyCreditCode: '',
+  proviceName: '',
+  cityName: '',
+  belongIndustryType: '',
   contact: '',
   contactPhone: '',
   email: '',
@@ -214,45 +261,44 @@
 
 const formRef = ref<FormInstance>();
 const settingFormRef = ref<FormInstance>();
-
-const rules = reactive<FormRules>({
-  name: [{ required: true, message: '璇疯緭鍏ヤ緵搴斿晢鍚嶇О', trigger: 'blur' }],
-  societyCreditCode: [{ required: true, message: '璇疯緭鍏ョ粺涓�淇$敤浠g爜', trigger: 'blur' }],
-  categoryType: [{ required: true, message: '璇烽�夋嫨琛屼笟閰嶅', trigger: 'change' }],
-  areaList: [{ required: true, message: '璇烽�夋嫨鎵�鍦ㄥ湴鍖�', trigger: 'change', type: 'array' }],
-  companyAddress: [{ required: true, message: '璇疯緭鍏ュ叕鍙稿湴鍧�', trigger: 'blur' }],
-  contact: [{ required: true, message: '璇疯緭鍏ヨ仈绯讳汉', trigger: 'blur' }],
-  suppierLevel: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟嗙瓑绾�', trigger: 'change' }],
-  // suppierType: [{ required: true, message: '璇烽�夋嫨渚涘簲鍟嗙被鍨�', trigger: 'change' }],
-  contactPhone: [
-    { required: true, message: '璇疯緭鍏ヨ仈绯荤數璇�', trigger: 'blur' },
-    { message: '璇疯緭鍏ユ纭殑鑱旂郴鐢佃瘽', trigger: 'blur', pattern: BoleRegExp.RegPhoneNumber },
-  ],
-});
+const accountFormRef = ref<FormInstance>();
 
 async function handleSubmit() {
   try {
-    const valid = await validateFormList([formRef.value, settingFormRef.value]);
+    const valid = await validateFormList([
+      formRef.value,
+      settingFormRef.value,
+      accountFormRef.value,
+    ]);
     if (valid) {
-      handleCreateOrEditInsureSupplier();
+      handleCreateOrEditFlexEnterprise();
     }
   } catch (error) {}
 }
 
-async function handleCreateOrEditInsureSupplier() {
+async function handleCreateOrEditFlexEnterprise() {
   try {
-    // let params: API.CreateOrEditSearchInput = {
-    //   name: form.name,
-    // };
-    // if (isEdit.value) {
-    //   params.id = props.id;
-    // }
-    // let res = await searchSettingServices.createOrEditSearchSetting(params);
-    // if (res) {
-    //   Message.successMessage(isEdit ? '缂栬緫鎴愬姛' : '鍙戝竷鎴愬姛');
-    //   eventContext.emit(isEdit ? 'enterprise:edit' : 'enterprise:add');
-    //   handleBack();
-    // }
+    let params: API.CreateOrEditFlexEnterpriseInput = {
+      enterpriseName: form.enterpriseName,
+      legalPersonName: form.legalPersonName,
+      legalPersonIdNumber: form.legalPersonIdNumber,
+      societyCreditCode: form.societyCreditCode,
+      proviceName: form.proviceName,
+      cityName: form.cityName,
+      belongIndustryType: form.belongIndustryType,
+      contact: form.contact,
+      contactPhone: form.contactPhone,
+      // email: form.email,
+    };
+    if (isEdit.value) {
+      params.id = props.id;
+    }
+    let res = await flexEnterpriseServices.createOrEditFlexEnterprise(params);
+    if (res) {
+      Message.successMessage(isEdit ? '缂栬緫鎴愬姛' : '鍙戝竷鎴愬姛');
+      eventContext.emit(isEdit ? 'enterprise:edit' : 'enterprise:add');
+      handleBack();
+    }
   } catch (error) {}
 }
 

--
Gitblit v1.9.1