| | |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="注册资本:" |
| | | prop="societyCreditCode" |
| | | :check-rules="[{ message: '请输入注册资本', type: 'societyCreditCode' }]" |
| | | > |
| | | <ProFormText v-model.trim="form.societyCreditCode" placeholder="请输入注册资本" /> |
| | | <ProFormItemV2 label="注册资本:" prop="registeredCapital"> |
| | | <ProFormText v-model.trim="form.registeredCapital" placeholder="请输入注册资本" /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="企业类型:" |
| | | prop="societyCreditCode" |
| | | :check-rules="[{ message: '请输入企业类型', type: 'societyCreditCode' }]" |
| | | > |
| | | <ProFormText v-model.trim="form.societyCreditCode" placeholder="请输入企业类型" /> |
| | | <ProFormItemV2 label="企业类型:" prop="enterpriseType"> |
| | | <ProFormText v-model.trim="form.enterpriseType" placeholder="请输入企业类型" /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | | <ProFormCol> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="成立日期:" |
| | | prop="date" |
| | | :check-rules="[{ message: '请选择成立日期' }]" |
| | | > |
| | | <ProFormDatePicker v-model="form.date" type="date" placeholder="请选择成立日期" /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="所在省份:" |
| | | prop="areaList" |
| | | :check-rules="[ |
| | | { |
| | | type: 'array', |
| | | message: '请选择', |
| | | }, |
| | | ]" |
| | | > |
| | | <ProFromAddressSelectV2 |
| | | v-model:areaList="form.areaList" |
| | | areaListPlaceholder="请选择" |
| | | :layer="AreaType.City" |
| | | <ProFormItemV2 label="成立日期:" prop="establishmentDate"> |
| | | <ProFormDatePicker |
| | | v-model="form.establishmentDate" |
| | | type="date" |
| | | placeholder="请选择成立日期" |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="所在城市:" |
| | | prop="areaList" |
| | | :check-rules="[ |
| | | { |
| | | type: 'array', |
| | | message: '请选择', |
| | | }, |
| | | ]" |
| | | > |
| | | <ProFormItemV2 label="所在地区:" prop="areaList"> |
| | | <ProFromAddressSelectV2 |
| | | v-model:areaList="form.areaList" |
| | | areaListPlaceholder="请选择" |
| | | areaListPlaceholder="请选择所在地区" |
| | | :layer="AreaType.City" |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> </ProFormColItem> |
| | | </ProFormCol> |
| | | <ProFormCol> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="详细地址:" |
| | | prop="societyCreditCode" |
| | | :check-rules="[{ message: '请输入详细地址' }]" |
| | | > |
| | | <ProFormText v-model.trim="form.societyCreditCode" placeholder="请输入详细地址" /> |
| | | <ProFormItemV2 label="详细地址:" prop="address"> |
| | | <ProFormText v-model.trim="form.address" placeholder="请输入详细地址" /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | | <ProFormItemV2 |
| | | label="经营范围:" |
| | | prop="mainBusiness" |
| | | :check-rules="[{ message: '请输入经营范围' }]" |
| | | > |
| | | <ProFormItemV2 label="经营范围:" prop="mainBusiness"> |
| | | <ProFormTextArea |
| | | v-model="form.mainBusiness" |
| | | maxlength="200" |
| | |
| | | </ProFormCol> |
| | | <ProFormCol> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 label="合作状态:" prop="contacts"> </ProFormItemV2> |
| | | <ProFormItemV2 label="合作状态:" prop="cooperationStatus"> |
| | | <ProFormRadio |
| | | v-model="form.cooperationStatus" |
| | | :value-enum="EnumEnterpriseCooperationStatusText" |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 label="签约状态:" prop="contacts"> </ProFormItemV2> |
| | | <ProFormItemV2 label="签约状态:" prop="signStatus"> |
| | | <ProFormRadio |
| | | v-model="form.signStatus" |
| | | :value-enum="EnumEnterpriseCooperationSignStatusText" |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 label="合作协议:" prop="contacts"> </ProFormItemV2> |
| | | <ProFormItemV2 label="合作协议:" prop="cooperationAgreementUrl"> |
| | | <ProFormUpload |
| | | v-model:file-url="form.cooperationAgreementUrl" |
| | | :limit="1" |
| | | :limitFileSize="10" |
| | | accept="jpg/jpeg,png,pdf" |
| | | ></ProFormUpload> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | | <ProFormCol> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 label="服务费收取方式:" prop="serviceFeeCollectType"> |
| | | <ProFormSelect |
| | | v-model="form.serviceFeeCollectType" |
| | | :valueEnum="EnumEnterpriseCooperationServiceFeeCollectTypeText" |
| | | placeholder="请选择服务费收取方式" |
| | | > |
| | | </ProFormSelect> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 label="服务费:" prop="serviceFeeRate"> |
| | | <ProFormInputNumber |
| | | v-model="form.serviceFeeRate" |
| | | :controls="false" |
| | | :min="0" |
| | | :precision="2" |
| | | placeholder="请输入" |
| | | :unit="serviceFeeCollectTypeUnit" |
| | | :showReadContent="!!form.serviceFeeRate" |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | | <ProFormCol> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 label="发票税点:" prop="invoiceTaxPointRate"> |
| | | <ProFormInputNumber |
| | | v-model="form.invoiceTaxPointRate" |
| | | :controls="false" |
| | | :min="0" |
| | | :precision="2" |
| | | placeholder="请输入" |
| | | unit="%" |
| | | :showReadContent="!!form.invoiceTaxPointRate" |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | | </ProForm> |
| | |
| | | /> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | <ProFormColItem :span="8" v-if="!isEdit"> |
| | | </ProFormCol> |
| | | <ProFormCol v-if="!isDetail"> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="密码:" |
| | | prop="password" |
| | | :check-rules="[{ message: '请输入密码' }]" |
| | | :check-rules="[{ required: !isEdit, message: '请输入密码' }]" |
| | | > |
| | | <ProFormText |
| | | v-model.trim="form.password" |
| | | :maxlength="30" |
| | | placeholder="请输入密码" |
| | | /> |
| | | <div class="password-input"> |
| | | <ProFormText |
| | | v-if="!isEdit" |
| | | v-model.trim="form.password" |
| | | :maxlength="30" |
| | | placeholder="请输入密码" |
| | | /> |
| | | <el-button v-else type="primary" link @click="openResetPasswordDialog" |
| | | >修改密码</el-button |
| | | > |
| | | </div> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | | <ProFormCol v-if="!isDetail"> |
| | | <ProFormColItem :span="8"> |
| | | <ProFormItemV2 |
| | | label="操作密码:" |
| | | prop="operatorPassword" |
| | | :check-rules="[ |
| | | { |
| | | required: false, |
| | | message: '请输入6位数字', |
| | | pattern: /\b\d{6}\b/, |
| | | }, |
| | | ]" |
| | | > |
| | | <div class="password-input"> |
| | | <ProFormText |
| | | v-if="!isEdit" |
| | | v-model.trim="form.operatorPassword" |
| | | :maxlength="6" |
| | | placeholder="请输入操作密码(6位数字)" |
| | | /> |
| | | <el-button type="primary" v-else link @click="openResetOperatorPasswordDialog" |
| | | >修改密码</el-button |
| | | > |
| | | </div> |
| | | </ProFormItemV2> |
| | | </ProFormColItem> |
| | | </ProFormCol> |
| | |
| | | </ProForm> |
| | | </ChunkCell> |
| | | </AppScrollContainer> |
| | | <ResetPasswordDialog v-bind="resetPasswordDialogProps"></ResetPasswordDialog> |
| | | <ResetOperatorPasswordDialog |
| | | v-bind="resetOperatorPasswordDialogProps" |
| | | ></ResetOperatorPasswordDialog> |
| | | </LoadingLayout> |
| | | </template> |
| | | |
| | |
| | | ProFormItemV2, |
| | | ChunkCell, |
| | | ProFormText, |
| | | ProFormSelect, |
| | | ProFormUpload, |
| | | ProFormTextArea, |
| | | ProFormCol, |
| | | ProFormColItem, |
| | | ProFormDatePicker, |
| | | ProFormRadio, |
| | | UploadUserFile, |
| | | useFormDialog, |
| | | ProFormSelect, |
| | | ProFormInputNumber, |
| | | } from '@bole-core/components'; |
| | | import { FormRules, FormInstance } from 'element-plus'; |
| | | import { FormInstance } from 'element-plus'; |
| | | import * as enterpriseServices from '@/services/api/enterprise'; |
| | | import { useRouteView, useGlobalEventContext, GlobalEvent } from '@/hooks'; |
| | | import * as userServices from '@/services/api/user'; |
| | | import { useRouteView, useGlobalEventContext } from '@/hooks'; |
| | | import _ from 'lodash'; |
| | | import { validateFormList, filterCN, removeEmptyKeys } from '@/utils'; |
| | | import { Message, BoleRegExp } from '@bole-core/core'; |
| | | import { |
| | | EnumEnterpriseCooperationStatusText, |
| | | EnumEnterpriseCooperationSignStatusText, |
| | | EnumEnterpriseCooperationServiceFeeCollectTypeText, |
| | | EnumEnterpriseCooperationServiceFeeCollectType, |
| | | } from '@/constants'; |
| | | import { |
| | | validateFormList, |
| | | filterCN, |
| | | removeEmptyKeys, |
| | | format, |
| | | convertApi2FormUrlOnlyOne, |
| | | } from '@/utils'; |
| | | import { Message } from '@bole-core/core'; |
| | | import { useQuery } from '@tanstack/vue-query'; |
| | | import { AreaType } from '@/constants'; |
| | | import ResetPasswordDialog from './ResetPasswordDialog.vue'; |
| | | import ResetOperatorPasswordDialog from './ResetOperatorPasswordDialog.vue'; |
| | | |
| | | defineOptions({ |
| | | name: 'AddOrEditCustomerView', |
| | |
| | | legalPerson: '', |
| | | legalIdentity: '', |
| | | societyCreditCode: '', |
| | | industryTypeCode: '', |
| | | mainBusiness: '', |
| | | registeredCapital: '', |
| | | enterpriseType: '', |
| | | establishmentDate: '', |
| | | areaList: [] as string[], |
| | | address: '', |
| | | mainBusiness: '', |
| | | contacts: '', |
| | | contactPhoneNumber: '', |
| | | contactEmail: '', |
| | | cooperationStatus: EnumEnterpriseCooperationStatus.None, |
| | | signStatus: EnumEnterpriseCooperationSignStatus.None, |
| | | cooperationAgreementUrl: [] as UploadUserFile[], |
| | | userName: '', |
| | | password: '', |
| | | date: '', |
| | | operatorPassword: '', |
| | | |
| | | userId: '', |
| | | |
| | | serviceFeeCollectType: '' as any as EnumEnterpriseCooperationServiceFeeCollectType, |
| | | serviceFeeRate: null as any as number, |
| | | invoiceTaxPointRate: null as any as number, |
| | | }); |
| | | |
| | | const { isLoading } = useQuery({ |
| | | queryKey: ['enterpriseServices/getEnterprise', id], |
| | | const { isLoading, refetch } = useQuery({ |
| | | queryKey: ['enterpriseServices/getPartyAEnterprise', id], |
| | | queryFn: async () => { |
| | | return await enterpriseServices.getEnterprise( |
| | | return await enterpriseServices.getPartyAEnterprise( |
| | | { id: id }, |
| | | { |
| | | showLoading: false, |
| | |
| | | form.legalPerson = data.legalPerson; |
| | | form.legalIdentity = data.legalIdentity; |
| | | form.societyCreditCode = data.societyCreditCode; |
| | | form.industryTypeCode = data.industryTypeCode ?? ''; |
| | | form.registeredCapital = data.registeredCapital; |
| | | form.enterpriseType = data.enterpriseType; |
| | | form.establishmentDate = data.establishmentDate; |
| | | form.areaList = [data.provinceCode, data.cityCode].filter(Boolean); |
| | | form.address = data.address; |
| | | form.mainBusiness = data.mainBusiness; |
| | | form.contacts = data.contacts; |
| | | form.contactPhoneNumber = data.contactPhoneNumber; |
| | | form.contactEmail = data.contactEmail; |
| | | form.cooperationStatus = data.cooperationStatus; |
| | | form.signStatus = data.signStatus; |
| | | form.cooperationAgreementUrl = convertApi2FormUrlOnlyOne(data.cooperationAgreementUrl); |
| | | form.userName = data.userName; |
| | | form.areaList = [data.provinceCode, data.cityCode].filter(Boolean); |
| | | |
| | | form.userId = data.userId; |
| | | form.serviceFeeCollectType = data.serviceFeeCollectType; |
| | | form.serviceFeeRate = data.serviceFeeRate; |
| | | form.invoiceTaxPointRate = data.invoiceTaxPointRate; |
| | | }, |
| | | enabled: computed(() => !!id), |
| | | }); |
| | | |
| | | const serviceFeeCollectTypeUnit = computed(() => { |
| | | if (!form.serviceFeeCollectType) { |
| | | return ''; |
| | | } else { |
| | | return form.serviceFeeCollectType === EnumEnterpriseCooperationServiceFeeCollectType.Rate |
| | | ? '%' |
| | | : '元/人'; |
| | | } |
| | | }); |
| | | |
| | | const { |
| | | dialogProps: resetPasswordDialogProps, |
| | | handleAdd: handleResetPasswordAdd, |
| | | editForm: resetPasswordEditForm, |
| | | } = useFormDialog({ |
| | | onConfirm: resetPassword, |
| | | defaultFormParams: { |
| | | ids: '', |
| | | password: '', |
| | | }, |
| | | }); |
| | | |
| | | function openResetPasswordDialog() { |
| | | handleResetPasswordAdd({ |
| | | ids: form.userId, |
| | | password: '', |
| | | }); |
| | | } |
| | | |
| | | async function resetPassword() { |
| | | try { |
| | | let params: API.ResetUserPasswordsCommand = { |
| | | ids: [resetPasswordEditForm.ids], |
| | | password: resetPasswordEditForm.password, |
| | | }; |
| | | let res = await userServices.resetUserPasswords(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | refetch(); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | const { |
| | | dialogProps: resetOperatorPasswordDialogProps, |
| | | handleAdd: handleResetOperatorPasswordAdd, |
| | | editForm: resetOperatorPasswordEditForm, |
| | | } = useFormDialog({ |
| | | onConfirm: resetOperatorPassword, |
| | | defaultFormParams: { |
| | | ids: '', |
| | | operatorPassword: '', |
| | | }, |
| | | }); |
| | | |
| | | function openResetOperatorPasswordDialog() { |
| | | handleResetOperatorPasswordAdd({ |
| | | ids: form.userId, |
| | | operatorPassword: '', |
| | | }); |
| | | } |
| | | |
| | | async function resetOperatorPassword() { |
| | | try { |
| | | let params: API.ResetUserOperatorPasswordsCommand = { |
| | | ids: [resetOperatorPasswordEditForm.ids], |
| | | operatorPassword: resetOperatorPasswordEditForm.operatorPassword, |
| | | }; |
| | | let res = await userServices.resetUserOperatorPasswords(params); |
| | | if (res) { |
| | | Message.successMessage('操作成功'); |
| | | refetch(); |
| | | } |
| | | } catch (error) {} |
| | | } |
| | | |
| | | const formRef = ref<FormInstance>(); |
| | | const settingFormRef = ref<FormInstance>(); |
| | |
| | | |
| | | async function handleCreateOrEditFlexEnterprise() { |
| | | try { |
| | | let params: API.SaveEnterpriseCommand = { |
| | | let params: API.SavePartyAEnterpriseCommand = { |
| | | enterpriseName: form.enterpriseName, |
| | | legalPerson: form.legalPerson, |
| | | legalIdentity: form.legalIdentity, |
| | | societyCreditCode: form.societyCreditCode, |
| | | registeredCapital: form.registeredCapital, |
| | | enterpriseType: form.enterpriseType, |
| | | establishmentDate: format(form.establishmentDate, 'YYYY-MM-DD'), |
| | | provinceCode: form.areaList[0], |
| | | cityCode: form.areaList[1], |
| | | industryTypeCode: form.industryTypeCode, |
| | | address: form.address, |
| | | mainBusiness: form.mainBusiness, |
| | | contacts: form.contacts, |
| | | contactPhoneNumber: form.contactPhoneNumber, |
| | | contactEmail: form.contactEmail, |
| | | cooperationStatus: form.cooperationStatus, |
| | | signStatus: form.signStatus, |
| | | cooperationAgreementUrl: form.cooperationAgreementUrl[0]?.path, |
| | | userName: form.userName, |
| | | password: form.password, |
| | | operatorPassword: form.operatorPassword, |
| | | serviceFeeCollectType: form.serviceFeeCollectType, |
| | | invoiceTaxPointRate: form.invoiceTaxPointRate, |
| | | }; |
| | | if (form.serviceFeeCollectType === EnumEnterpriseCooperationServiceFeeCollectType.Rate) { |
| | | params.serviceFeeRate = form.serviceFeeRate; |
| | | } |
| | | if (isEdit) { |
| | | params.id = id; |
| | | } |
| | | let res = await enterpriseServices.saveEnterprise(removeEmptyKeys(params)); |
| | | let res = await enterpriseServices.savePartyAEnterprise(removeEmptyKeys(params)); |
| | | if (res) { |
| | | Message.successMessage(isEdit ? '编辑成功' : '发布成功'); |
| | | eventContext.emit(isEdit ? 'customerManage:edit' : 'customerManage:add'); |
| | |
| | | |
| | | function handleBack() { |
| | | closeViewPush(route, { |
| | | name: 'EnterpriseManageList', |
| | | name: 'CustomerManage', |
| | | }); |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | @use '@/style/common.scss' as *; |
| | | |
| | | .password-input { |
| | | display: flex; |
| | | flex: 1; |
| | | min-width: 0; |
| | | } |
| | | </style> |