diff --git a/dashboard/src2/components/DomainOwnerDialog.vue b/dashboard/src2/components/DomainOwnerDialog.vue index 8a16001..0d0e89c 100644 --- a/dashboard/src2/components/DomainOwnerDialog.vue +++ b/dashboard/src2/components/DomainOwnerDialog.vue @@ -189,7 +189,11 @@ type="text" class="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="请输入详细地址" + @input="validateAddress" > +
+ {{ addressError }} +
@@ -340,7 +344,8 @@ export default { selectedDistrict: '', countryList: getCountryList(), chinaRegions: getChinaRegions(), - idNumberError: '' + idNumberError: '', + addressError: '' }; }, methods: { @@ -380,8 +385,7 @@ export default { // 触发父组件的submit事件,传递数据 this.$emit('submit', submitData); - // 关闭对话框 - this.closeDialog(); + // 不在这里关闭对话框,等待父组件处理成功后再关闭 } catch (error) { alert('创建失败,请检查网络连接或联系管理员'); } @@ -406,6 +410,22 @@ export default { } if (!this.formData.c_adr_m) { errors.push('请输入通讯地址'); + } else { + // 验证通讯地址长度 + if (this.formData.c_adr_m.length < 4) { + errors.push('通讯地址长度至少需要4个字符'); + } else if (this.formData.c_adr_m.length > 64) { + errors.push('通讯地址长度不能超过64个字符'); + } else { + // 验证特殊字符 + const specialChars = [',', '、', ';', ':', '。', '!', '?', ' ', '\t', '\n']; + for (const char of specialChars) { + if (this.formData.c_adr_m.includes(char)) { + errors.push('通讯地址不能包含特殊字符'); + break; + } + } + } } if (!this.formData.c_pc) { errors.push('请输入邮编'); @@ -428,11 +448,19 @@ export default { if (!this.formData.c_idnum_gswl) { errors.push('请输入证件号码'); } else if (this.formData.c_idtype_gswl === 'SFZ') { - const idNum = this.formData.c_idnum_gswl; + const idNum = this.formData.c_idnum_gswl.trim(); if (idNum.length !== 18) { errors.push('身份证号码必须是18位'); - } else if (!(idNum.slice(0, 17).match(/^\d+$/) && (idNum[17].match(/^\d$/) || idNum[17].toUpperCase() === 'X'))) { - errors.push('身份证号码格式不正确'); + } else { + // 验证格式:前17位为数字,最后一位可能是数字或X + const first17 = idNum.slice(0, 17); + const lastChar = idNum[17].toUpperCase(); + + if (!first17.match(/^\d+$/)) { + errors.push('身份证号码前17位必须是数字'); + } else if (!(lastChar.match(/^\d$/) || lastChar === 'X')) { + errors.push('身份证号码最后一位必须是数字或X'); + } } } @@ -460,6 +488,7 @@ export default { this.selectedCity = ''; this.selectedDistrict = ''; this.idNumberError = ''; + this.addressError = ''; }, onCountryChange() { // 重置省市区选择 @@ -540,19 +569,55 @@ export default { } if (this.formData.c_idtype_gswl === 'SFZ') { - const idNum = this.formData.c_idnum_gswl; + const idNum = this.formData.c_idnum_gswl.trim(); if (idNum.length !== 18) { this.idNumberError = `身份证号码必须是18位,当前为${idNum.length}位`; return; } // 验证格式:前17位为数字,最后一位可能是数字或X - if (!(idNum.slice(0, 17).match(/^\d+$/) && (idNum[17].match(/^\d$/) || idNum[17].toUpperCase() === 'X'))) { - this.idNumberError = '身份证号码格式不正确'; + const first17 = idNum.slice(0, 17); + const lastChar = idNum[17].toUpperCase(); + + if (!first17.match(/^\d+$/)) { + this.idNumberError = '身份证号码前17位必须是数字'; + return; + } + + if (!(lastChar.match(/^\d$/) || lastChar === 'X')) { + this.idNumberError = '身份证号码最后一位必须是数字或X'; return; } } }, + validateAddress() { + this.addressError = ''; + const address = this.formData.c_adr_m; + + if (!address) { + return; // 空值时不显示错误,只在提交时验证 + } + + // 检查长度 + if (address.length < 4) { + this.addressError = '通讯地址长度至少需要4个字符'; + return; + } + + if (address.length > 64) { + this.addressError = '通讯地址长度不能超过64个字符'; + return; + } + + // 检查特殊字符 + const specialChars = [',', '、', ';', ':', '。', '!', '?', ' ', '\t', '\n']; + for (const char of specialChars) { + if (address.includes(char)) { + this.addressError = '通讯地址不能包含特殊字符'; + return; + } + } + } } }; diff --git a/dashboard/src2/pages/NewJsiteDomain.vue b/dashboard/src2/pages/NewJsiteDomain.vue index a38f919..659336e 100644 --- a/dashboard/src2/pages/NewJsiteDomain.vue +++ b/dashboard/src2/pages/NewJsiteDomain.vue @@ -958,47 +958,7 @@ export default { // 创建域名所有者 createDomainOwner() { return { - url: 'jcloud.api.domain_west.create_domain_owner', - validate(data) { - if (!data.c_regtype) { - throw new DashboardError('请选择所有者类型'); - } - if (!data.c_ln_m || !data.c_fn_m) { - throw new DashboardError('请输入姓名'); - } - if (!data.c_st_m || !data.c_ct_m) { - throw new DashboardError('请选择所属区域'); - } - if (!data.c_adr_m) { - throw new DashboardError('请输入通讯地址'); - } - if (!data.c_pc) { - throw new DashboardError('请输入邮编'); - } - if (!data.c_ph) { - throw new DashboardError('请输入手机号码'); - } - if (!data.c_em) { - throw new DashboardError('请输入电子邮箱'); - } - if (!data.c_idtype_gswl) { - throw new DashboardError('请选择证件类型'); - } - 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('身份证号码格式不正确'); - } - } - }, + url: 'jcloud.api.domain_west.create_domain_owner_with_template', onSuccess(response) { if (response.status === "Success") { toast.success('域名所有者创建成功'); @@ -1126,39 +1086,9 @@ export default { }, handleOwnerSubmit(formData) { this.isCreatingOwner = true; - const apiData = { - act: 'auditsub', - c_regtype: formData.c_regtype, - c_org_m: formData.c_org_m || '', - 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: 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: 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_idtype_gswl: formData.c_idtype_gswl, - c_idnum_gswl: formData.c_idnum_gswl, - c_keyword: '', - c_domain: '0' - }; - this.$resources.createDomainOwner.submit(apiData); + // 直接提交数据,验证由对话框组件负责 + this.$resources.createDomainOwner.submit(formData); }, getTotalAmount() { const yearlyPrice = this.domainPrice || 0; diff --git a/jcloud/jcloud/pagetype/domain_owner/domain_owner.json b/jcloud/jcloud/pagetype/domain_owner/domain_owner.json index c032251..fb9fe55 100644 --- a/jcloud/jcloud/pagetype/domain_owner/domain_owner.json +++ b/jcloud/jcloud/pagetype/domain_owner/domain_owner.json @@ -5,6 +5,7 @@ "engine": "InnoDB", "field_order": [ "title", + "c_sysid", "fullname", "c_co", "cocode", @@ -20,7 +21,6 @@ "c_ph_num", "c_ph_fj", "c_pc", - "c_sysid", "team", "section_break_ssfs", "c_org_m", @@ -53,37 +53,36 @@ { "fieldname": "c_regtype", "fieldtype": "Select", - "in_list_view": 1, "label": "所有者类型", - "options": "\nI\nE", - "reqd": 1 + "options": "\nI\nE" }, { "fieldname": "c_org_m", "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, "label": "(中文)所有者单位名称" }, { "fieldname": "fullname", "fieldtype": "Data", + "in_list_view": 1, + "in_standard_filter": 1, "label": "姓名" }, { "fieldname": "c_ln_m", "fieldtype": "Data", - "in_list_view": 1, "label": "(中文)联系人姓" }, { "fieldname": "c_fn_m", "fieldtype": "Data", - "in_list_view": 1, "label": "(中文)联系人名" }, { "fieldname": "c_co", "fieldtype": "Data", - "in_list_view": 1, "label": "所属国家或地区简称" }, { @@ -228,7 +227,7 @@ "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-08-01 22:27:42.613190", + "modified": "2025-08-02 16:32:15.038006", "modified_by": "Administrator", "module": "Jcloud", "name": "Domain Owner",