diff --git a/dashboard/src2/components/DomainOwnerDialog.vue b/dashboard/src2/components/DomainOwnerDialog.vue index 22cdb0a..8a16001 100644 --- a/dashboard/src2/components/DomainOwnerDialog.vue +++ b/dashboard/src2/components/DomainOwnerDialog.vue @@ -357,17 +357,31 @@ export default { } try { - const submitData = { ...this.formData }; - submitData.c_co = this.selectedCountry; - submitData.cocode = this.selectedCountry === 'CN' ? '+86' : ''; - const response = await this.$resources.createDomainOwner.submit(submitData); - if (response.status === 'Success') { - alert('域名所有者创建成功!'); - this.$emit('submit', response.data); - this.closeDialog(); - } else { - alert(`创建失败: ${response.message}`); - } + // 准备提交数据,确保格式正确 + const submitData = { + c_regtype: this.formData.c_regtype, + c_org_m: this.formData.c_org_m || '', + c_ln_m: this.formData.c_ln_m, + c_fn_m: this.formData.c_fn_m, + c_st_m: this.formData.c_st_m, + c_ct_m: this.formData.c_ct_m, + c_dt_m: this.formData.c_dt_m || '', + c_adr_m: this.formData.c_adr_m, + c_pc: this.formData.c_pc, + c_ph_type: '0', + c_ph: this.formData.c_ph, + c_em: this.formData.c_em, + c_idtype_gswl: this.formData.c_idtype_gswl, + c_idnum_gswl: this.formData.c_idnum_gswl, + c_co: this.selectedCountry, + cocode: this.selectedCountry === 'CN' ? '+86' : '' + }; + + // 触发父组件的submit事件,传递数据 + this.$emit('submit', submitData); + + // 关闭对话框 + this.closeDialog(); } catch (error) { alert('创建失败,请检查网络连接或联系管理员'); } @@ -540,19 +554,6 @@ export default { } }, - }, - resources: { - createDomainOwner() { - return { - url: 'jcloud.api.domain_west.create_domain_owner_with_template', - onSuccess(response) { - return response; - }, - onError(error) { - throw error; - } - }; - } } }; \ No newline at end of file diff --git a/dashboard/src2/pages/NewJsiteDomain.vue b/dashboard/src2/pages/NewJsiteDomain.vue index 765d421..a38f919 100644 --- a/dashboard/src2/pages/NewJsiteDomain.vue +++ b/dashboard/src2/pages/NewJsiteDomain.vue @@ -960,9 +960,6 @@ export default { return { url: 'jcloud.api.domain_west.create_domain_owner', validate(data) { - // 调试:打印验证函数接收到的数据 - console.log('验证函数接收到的data:', data); - if (!data.c_regtype) { throw new DashboardError('请选择所有者类型'); } @@ -979,7 +976,7 @@ export default { throw new DashboardError('请输入邮编'); } if (!data.c_ph) { - throw new DashboardError('请输入联系电话'); + throw new DashboardError('请输入手机号码'); } if (!data.c_em) { throw new DashboardError('请输入电子邮箱'); @@ -990,6 +987,17 @@ export default { if (!data.c_idnum_gswl) { throw new DashboardError('请输入证件号码'); } + + // 验证身份证号码格式 + if (data.c_idtype_gswl === 'SFZ') { + const idNum = data.c_idnum_gswl; + if (idNum.length !== 18) { + throw new DashboardError('身份证号码必须是18位'); + } + if (!(idNum.slice(0, 17).match(/^\d+$/) && (idNum[17].match(/^\d$/) || idNum[17].toUpperCase() === 'X'))) { + throw new DashboardError('身份证号码格式不正确'); + } + } }, onSuccess(response) { if (response.status === "Success") { @@ -1118,11 +1126,6 @@ export default { }, handleOwnerSubmit(formData) { this.isCreatingOwner = true; - - // 调试:打印接收到的数据 - console.log('接收到的formData:', formData); - - // 转换数据格式以匹配API期望的参数 const apiData = { act: 'auditsub', c_regtype: formData.c_regtype, @@ -1130,34 +1133,31 @@ export default { fullname: formData.c_ln_m + formData.c_fn_m, c_ln_m: formData.c_ln_m, c_fn_m: formData.c_fn_m, - c_co: 'CN', // 默认中国 - cocode: '+86', // 默认中国区号 + c_co: formData.c_co || 'CN', + cocode: formData.cocode || '+86', c_st_m: formData.c_st_m, c_ct_m: formData.c_ct_m, c_dt_m: formData.c_dt_m || '', c_adr_m: formData.c_adr_m, c_pc: formData.c_pc, - c_ph_type: '0', // 默认手机 - c_ph: formData.c_ph_num, // 手机号码 - c_ph_code: '', // 座机区号,手机时为空 - c_ph_num: '', // 座机号码,手机时为空 - c_ph_fj: '', // 分机号 + c_ph_type: formData.c_ph_type || '0', + c_ph: formData.c_ph, + c_ph_code: '', + c_ph_num: '', + c_ph_fj: '', c_em: formData.c_em, - c_org: formData.c_org_m || '', // 英文单位名称,暂时用中文 - c_ln: formData.c_ln_m, // 英文姓,暂时用中文 - c_fn: formData.c_fn_m, // 英文名,暂时用中文 - c_st: formData.c_st_m, // 英文省份,暂时用中文 - c_ct: formData.c_ct_m, // 英文城市,暂时用中文 - c_adr: formData.c_adr_m, // 英文地址,暂时用中文 + c_org: formData.c_org_m || '', + c_ln: formData.c_ln_m, + c_fn: formData.c_fn_m, + c_st: formData.c_st_m, + c_ct: formData.c_ct_m, + c_adr: formData.c_adr_m, c_idtype_gswl: formData.c_idtype_gswl, c_idnum_gswl: formData.c_idnum_gswl, c_keyword: '', c_domain: '0' }; - // 调试:打印转换后的数据 - console.log('转换后的apiData:', apiData); - this.$resources.createDomainOwner.submit(apiData); }, getTotalAmount() {