From 33c45ab67c74c387596a3a2fae26b314bebe1a4f Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期四, 07 八月 2025 18:05:59 +0800 Subject: [PATCH] Merge branch 'master' of http://120.26.58.240:8888/r/flexJobAdmin --- src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue | 119 ++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 68 insertions(+), 51 deletions(-) diff --git a/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue b/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue index 1a0be06..e462e86 100644 --- a/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue +++ b/src/views/EnterpriseManage/components/AddOrEditEnterpriseView.vue @@ -4,7 +4,7 @@ <ChunkCell title="浼佷笟鍩烘湰淇℃伅"> <ProForm :model="form" ref="formRef" label-width="140px" :is-read="isDetail"> <ProFormCol> - <ProFormColItem :span="12"> + <ProFormColItem :span="8"> <ProFormItemV2 label="浼佷笟鍚嶇О:" prop="enterpriseName" @@ -17,9 +17,7 @@ /> </ProFormItemV2> </ProFormColItem> - </ProFormCol> - <ProFormCol> - <ProFormColItem :span="12"> + <ProFormColItem :span="8"> <ProFormItemV2 label="娉曚汉濮撳悕:" prop="legalPerson"> <ProFormText v-model.trim="form.legalPerson" @@ -28,9 +26,7 @@ /> </ProFormItemV2> </ProFormColItem> - </ProFormCol> - <ProFormCol> - <ProFormColItem :span="12"> + <ProFormColItem :span="8"> <ProFormItemV2 label="娉曚汉韬唤璇佸彿:" prop="legalIdentity"> <ProFormText v-model.trim="form.legalIdentity" @@ -41,7 +37,7 @@ </ProFormColItem> </ProFormCol> <ProFormCol> - <ProFormColItem :span="12"> + <ProFormColItem :span="8"> <ProFormItemV2 label="缁熶竴绀句細淇$敤浠g爜:" prop="societyCreditCode" @@ -53,40 +49,32 @@ /> </ProFormItemV2> </ProFormColItem> - </ProFormCol> - <ProFormCol> - <ProFormColItem :span="12"> - <ProFormItemV2 label="鎵�鍦ㄧ渷浠�:" prop="proviceId"> - <ProFormText - v-model.trim="form.proviceId" - :maxlength="30" - placeholder="璇疯緭鍏ユ墍鍦ㄧ渷浠�" + <ProFormColItem :span="8"> + <ProFormItemV2 + label="鎵�鍦ㄥ湴鍖�:" + prop="areaList" + :check-rules="[ + { + type: 'array', + message: '璇烽�夋嫨', + }, + ]" + > + <ProFromAddressSelectV2 + v-model:areaList="form.areaList" + areaListPlaceholder="璇烽�夋嫨" + :layer="AreaType.City" /> </ProFormItemV2> </ProFormColItem> - </ProFormCol> - <ProFormCol> - <ProFormColItem :span="12"> + <ProFormColItem :span="8"> <ProFormItemV2 label="鎵�灞炶涓�:" prop="industryTypeId"> <ProFormSelect - v-model="form.industryTypeId" + v-model="form.industryTypeCode" placeholder="璇烽�夋嫨鎵�灞炶涓�" - :value-enum="typeList" - enum-value-key="id" - enum-label-key="name" + :value-enum="dictionaryDataList" clearable ></ProFormSelect> - </ProFormItemV2> - </ProFormColItem> - </ProFormCol> - <ProFormCol> - <ProFormColItem :span="12"> - <ProFormItemV2 label="鎵�鍦ㄥ煄甯�:" prop="cityId"> - <ProFormText - v-model.trim="form.cityId" - :maxlength="30" - placeholder="璇疯緭鍏ユ墍鍦ㄥ煄甯�" - /> </ProFormItemV2> </ProFormColItem> </ProFormCol> @@ -162,7 +150,7 @@ :is-read="isDetail" > <ProFormCol> - <ProFormColItem :span="12"> + <ProFormColItem :span="8"> <ProFormItemV2 label="璐﹀彿:" prop="userName" @@ -172,6 +160,19 @@ v-model.trim="form.userName" :maxlength="30" placeholder="璇疯緭鍏ヨ处鍙�" + /> + </ProFormItemV2> + </ProFormColItem> + <ProFormColItem :span="8" v-if="!isEdit"> + <ProFormItemV2 + label="瀵嗙爜:" + prop="password" + :check-rules="[{ message: '璇疯緭鍏ュ瘑鐮�' }]" + > + <ProFormText + v-model.trim="form.password" + :maxlength="30" + placeholder="璇疯緭鍏ュ瘑鐮�" /> </ProFormItemV2> </ProFormColItem> @@ -205,30 +206,31 @@ import { validateFormList, filterCN } from '@/utils'; import { Message, BoleRegExp } from '@bole-core/core'; import { useQuery } from '@tanstack/vue-query'; +import { AreaType } from '@/constants'; defineOptions({ name: 'AddOrEditEnterpriseView' }); type Props = { isDetail: boolean; - id?: string; emitAddEvent?: keyof GlobalEvent; emitEditEvent?: keyof GlobalEvent; backRouteName?: string; }; const props = withDefaults(defineProps<Props>(), { - id: '', emitAddEvent: 'enterprise:add', emitEditEvent: 'enterprise:edit', backRouteName: 'EnterpriseManageList', }); const route = useRoute(); -const isEdit = computed(() => !!props.id); +const id = route.params.id as string; +const isEdit = computed(() => !!id); +const { dictionaryDataList } = useDictionaryDataSelect({ + categoryCode: computed(() => CategoryCode.IndustryCategory), +}); const { closeViewPush } = useRouteView(); const eventContext = useGlobalEventContext(); - -const typeList = ref([]); const form = reactive({ id: '', @@ -236,30 +238,43 @@ legalPerson: '', legalIdentity: '', societyCreditCode: '', - industryTypeId: '', + industryTypeCode: '', mainBusiness: '', - proviceId: '', - cityId: '', + areaList: [] as string[], contacts: '', contactPhoneNumber: '', contactEmail: '', userName: '', + password: '', }); onMounted(async () => {}); const { isLoading } = useQuery({ - queryKey: ['enterpriseServices/getEnterprise', props.id], + queryKey: ['enterpriseServices/getEnterprise', id], queryFn: async () => { return await enterpriseServices.getEnterprise( - { id: props.id }, + { id: id }, { showLoading: false, } ); }, - onSuccess(data) {}, - enabled: computed(() => !!props.id), + onSuccess(data) { + form.id = data.id; + form.enterpriseName = data.enterpriseName; + form.legalPerson = data.legalPerson; + form.legalIdentity = data.legalIdentity; + form.societyCreditCode = data.societyCreditCode; + form.industryTypeCode = data.industryTypeCode; + form.mainBusiness = data.mainBusiness; + form.contacts = data.contacts; + form.contactPhoneNumber = data.contactPhoneNumber; + form.contactEmail = data.contactEmail; + form.userName = data.userName; + form.areaList = [data.provinceCode, data.cityCode].filter(Boolean); + }, + enabled: computed(() => !!id), }); const formRef = ref<FormInstance>(); @@ -281,22 +296,24 @@ async function handleCreateOrEditFlexEnterprise() { try { + console.log('form.areaList: ', form.areaList); let params: API.SaveEnterpriseCommand = { enterpriseName: form.enterpriseName, legalPerson: form.legalPerson, legalIdentity: form.legalIdentity, societyCreditCode: form.societyCreditCode, - provinceId: form.proviceId, - cityId: form.cityId, - industryTypeId: form.industryTypeId, + provinceCode: form.areaList[0], + cityCode: form.areaList[1], + industryTypeCode: form.industryTypeCode, mainBusiness: form.mainBusiness, contacts: form.contacts, contactPhoneNumber: form.contactPhoneNumber, contactEmail: form.contactEmail, userName: form.userName, + password: form.password, }; if (isEdit.value) { - params.id = props.id; + params.id = id; } let res = await enterpriseServices.saveEnterprise(params); if (res) { -- Gitblit v1.9.1