wupengfei
9 天以前 5ceeed41b099bd638075c6fa284241d545037573
src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue
@@ -20,9 +20,9 @@
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="法人姓名:" prop="legalPersonName">
              <ProFormItemV2 label="法人姓名:" prop="legalPerson">
                <ProFormText
                  v-model.trim="form.legalPersonName"
                  v-model.trim="form.legalPerson"
                  :maxlength="30"
                  placeholder="请输入法人姓名"
                />
@@ -31,9 +31,9 @@
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="法人身份证号:" prop="legalPersonIdNumber">
              <ProFormItemV2 label="法人身份证号:" prop="legalIdentity">
                <ProFormText
                  v-model.trim="form.legalPersonIdNumber"
                  v-model.trim="form.legalIdentity"
                  :maxlength="30"
                  placeholder="请输入法人身份证号"
                />
@@ -56,9 +56,9 @@
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="所在省份:" prop="proviceName">
              <ProFormItemV2 label="所在省份:" prop="proviceId">
                <ProFormText
                  v-model.trim="form.proviceName"
                  v-model.trim="form.proviceId"
                  :maxlength="30"
                  placeholder="请输入所在省份"
                />
@@ -67,23 +67,23 @@
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="所属行业:" prop="belongIndustryType">
              <ProFormItemV2 label="所属行业:" prop="industryTypeId">
                <ProFormSelect
                  v-model="form.industryTypeId"
                  placeholder="请选择所属行业"
                  :value-enum="typeList"
                  enum-value-key="id"
                  enum-label-key="name"
                  clearable
                  v-model="form.belongIndustryType"
                ></ProFormSelect>
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="所在城市:" prop="cityName">
              <ProFormItemV2 label="所在城市:" prop="cityId">
                <ProFormText
                  v-model.trim="form.cityName"
                  v-model.trim="form.cityId"
                  :maxlength="30"
                  placeholder="请输入所在城市"
                />
@@ -92,9 +92,9 @@
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="24">
              <ProFormItemV2 label="主营业务:" prop="cityName">
              <ProFormItemV2 label="主营业务:" prop="mainBusiness">
                <ProFormTextArea
                  v-model="form.cityName"
                  v-model="form.mainBusiness"
                  maxlength="200"
                  :rows="6"
                  show-word-limit
@@ -117,11 +117,11 @@
            <ProFormColItem :span="12">
              <ProFormItemV2
                label="联系人:"
                prop="contact"
                prop="contacts"
                :check-rules="[{ message: '请输入联系人' }]"
              >
                <ProFormText
                  v-model.trim="form.contact"
                  v-model.trim="form.contacts"
                  :maxlength="30"
                  placeholder="请输入联系人"
                />
@@ -132,18 +132,18 @@
            <ProFormColItem :span="12">
              <ProFormItemV2
                label="联系电话:"
                prop="contactPhone"
                prop="contactPhoneNumber"
                :check-rules="[{ message: '请输入联系电话', type: 'phone' }]"
              >
                <ProFormText v-model.trim="form.contactPhone" placeholder="请输入联系电话" />
                <ProFormText v-model.trim="form.contactPhoneNumber" placeholder="请输入联系电话" />
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
          <ProFormCol>
            <ProFormColItem :span="12">
              <ProFormItemV2 label="邮箱:" prop="email">
              <ProFormItemV2 label="邮箱:" prop="contactEmail">
                <ProFormText
                  v-model.trim="form.email"
                  v-model.trim="form.contactEmail"
                  :maxlength="30"
                  placeholder="请输入邮箱"
                  :formatter="filterCN"
@@ -165,10 +165,14 @@
            <ProFormColItem :span="12">
              <ProFormItemV2
                label="账号:"
                prop="contact"
                prop="userName"
                :check-rules="[{ message: '请输入账号' }]"
              >
                <ProFormText v-model.trim="form.contact" :maxlength="30" placeholder="请输入账号" />
                <ProFormText
                  v-model.trim="form.userName"
                  :maxlength="30"
                  placeholder="请输入账号"
                />
              </ProFormItemV2>
            </ProFormColItem>
          </ProFormCol>
@@ -195,7 +199,7 @@
  ProFormColItem,
} from '@bole-core/components';
import { FormRules, FormInstance } from 'element-plus';
import { SearchType } from '@/constants';
import * as enterpriseServices from '@/services/api/enterprise';
import { useRouteView, useGlobalEventContext, GlobalEvent } from '@/hooks';
import _ from 'lodash';
import { validateFormList, filterCN } from '@/utils';
@@ -229,29 +233,31 @@
const form = reactive({
  id: '',
  enterpriseName: '',
  legalPersonName: '',
  legalPersonIdNumber: '',
  legalPerson: '',
  legalIdentity: '',
  societyCreditCode: '',
  proviceName: '',
  cityName: '',
  belongIndustryType: '',
  contact: '',
  contactPhone: '',
  email: '',
  industryTypeId: '',
  mainBusiness: '',
  proviceId: '',
  cityId: '',
  contacts: '',
  contactPhoneNumber: '',
  contactEmail: '',
  userName: '',
});
onMounted(async () => {});
const { isLoading } = useQuery({
  //   queryKey: ['insureSupplierService/getInsureSupplierInfoById', props.id],
  //   queryFn: async () => {
  //     return await insureSupplierService.getInsureSupplierInfoById(
  //       { id: props.id },
  //       {
  //         showLoading: false,
  //       }
  //     );
  //   },
  queryKey: ['enterpriseServices/getEnterprise', props.id],
  queryFn: async () => {
    return await enterpriseServices.getEnterprise(
      { id: props.id },
      {
        showLoading: false,
      }
    );
  },
  onSuccess(data) {},
  enabled: computed(() => !!props.id),
});
@@ -275,22 +281,24 @@
async function handleCreateOrEditFlexEnterprise() {
  try {
    let params: API.CreateOrEditFlexEnterpriseInput = {
    let params: API.SaveEnterpriseCommand = {
      enterpriseName: form.enterpriseName,
      legalPersonName: form.legalPersonName,
      legalPersonIdNumber: form.legalPersonIdNumber,
      legalPerson: form.legalPerson,
      legalIdentity: form.legalIdentity,
      societyCreditCode: form.societyCreditCode,
      proviceName: form.proviceName,
      cityName: form.cityName,
      belongIndustryType: form.belongIndustryType,
      contact: form.contact,
      contactPhone: form.contactPhone,
      // email: form.email,
      provinceId: form.proviceId,
      cityId: form.cityId,
      industryTypeId: form.industryTypeId,
      mainBusiness: form.mainBusiness,
      contacts: form.contacts,
      contactPhoneNumber: form.contactPhoneNumber,
      contactEmail: form.contactEmail,
      userName: form.userName,
    };
    if (isEdit.value) {
      params.id = props.id;
    }
    let res = await flexEnterpriseServices.createOrEditFlexEnterprise(params);
    let res = await enterpriseServices.saveEnterprise(params);
    if (res) {
      Message.successMessage(isEdit ? '编辑成功' : '发布成功');
      eventContext.emit(isEdit ? 'enterprise:edit' : 'enterprise:add');