新建域名所有者成功后才自动关闭对话框

This commit is contained in:
jingrow 2025-08-02 17:20:59 +08:00
parent 3b7b620a52
commit 68b9c75ac1
3 changed files with 84 additions and 90 deletions

View File

@ -189,7 +189,11 @@
type="text" type="text"
class="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500" class="w-full border rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
placeholder="请输入详细地址" placeholder="请输入详细地址"
@input="validateAddress"
> >
<div v-if="addressError" class="text-red-500 text-xs mt-1">
{{ addressError }}
</div>
</div> </div>
<!-- 联系信息 --> <!-- 联系信息 -->
@ -340,7 +344,8 @@ export default {
selectedDistrict: '', selectedDistrict: '',
countryList: getCountryList(), countryList: getCountryList(),
chinaRegions: getChinaRegions(), chinaRegions: getChinaRegions(),
idNumberError: '' idNumberError: '',
addressError: ''
}; };
}, },
methods: { methods: {
@ -380,8 +385,7 @@ export default {
// submit // submit
this.$emit('submit', submitData); this.$emit('submit', submitData);
// //
this.closeDialog();
} catch (error) { } catch (error) {
alert('创建失败,请检查网络连接或联系管理员'); alert('创建失败,请检查网络连接或联系管理员');
} }
@ -406,6 +410,22 @@ export default {
} }
if (!this.formData.c_adr_m) { if (!this.formData.c_adr_m) {
errors.push('请输入通讯地址'); 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) { if (!this.formData.c_pc) {
errors.push('请输入邮编'); errors.push('请输入邮编');
@ -428,11 +448,19 @@ export default {
if (!this.formData.c_idnum_gswl) { if (!this.formData.c_idnum_gswl) {
errors.push('请输入证件号码'); errors.push('请输入证件号码');
} else if (this.formData.c_idtype_gswl === 'SFZ') { } 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) { if (idNum.length !== 18) {
errors.push('身份证号码必须是18位'); errors.push('身份证号码必须是18位');
} else if (!(idNum.slice(0, 17).match(/^\d+$/) && (idNum[17].match(/^\d$/) || idNum[17].toUpperCase() === 'X'))) { } else {
errors.push('身份证号码格式不正确'); // 17X
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.selectedCity = '';
this.selectedDistrict = ''; this.selectedDistrict = '';
this.idNumberError = ''; this.idNumberError = '';
this.addressError = '';
}, },
onCountryChange() { onCountryChange() {
// //
@ -540,19 +569,55 @@ export default {
} }
if (this.formData.c_idtype_gswl === 'SFZ') { 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) { if (idNum.length !== 18) {
this.idNumberError = `身份证号码必须是18位当前为${idNum.length}`; this.idNumberError = `身份证号码必须是18位当前为${idNum.length}`;
return; return;
} }
// 17X // 17X
if (!(idNum.slice(0, 17).match(/^\d+$/) && (idNum[17].match(/^\d$/) || idNum[17].toUpperCase() === 'X'))) { const first17 = idNum.slice(0, 17);
this.idNumberError = '身份证号码格式不正确'; const lastChar = idNum[17].toUpperCase();
if (!first17.match(/^\d+$/)) {
this.idNumberError = '身份证号码前17位必须是数字';
return;
}
if (!(lastChar.match(/^\d$/) || lastChar === 'X')) {
this.idNumberError = '身份证号码最后一位必须是数字或X';
return; 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;
}
}
}
} }
}; };

View File

@ -958,47 +958,7 @@ export default {
// //
createDomainOwner() { createDomainOwner() {
return { return {
url: 'jcloud.api.domain_west.create_domain_owner', url: 'jcloud.api.domain_west.create_domain_owner_with_template',
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('身份证号码格式不正确');
}
}
},
onSuccess(response) { onSuccess(response) {
if (response.status === "Success") { if (response.status === "Success") {
toast.success('域名所有者创建成功'); toast.success('域名所有者创建成功');
@ -1126,39 +1086,9 @@ export default {
}, },
handleOwnerSubmit(formData) { handleOwnerSubmit(formData) {
this.isCreatingOwner = true; 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() { getTotalAmount() {
const yearlyPrice = this.domainPrice || 0; const yearlyPrice = this.domainPrice || 0;

View File

@ -5,6 +5,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"title", "title",
"c_sysid",
"fullname", "fullname",
"c_co", "c_co",
"cocode", "cocode",
@ -20,7 +21,6 @@
"c_ph_num", "c_ph_num",
"c_ph_fj", "c_ph_fj",
"c_pc", "c_pc",
"c_sysid",
"team", "team",
"section_break_ssfs", "section_break_ssfs",
"c_org_m", "c_org_m",
@ -53,37 +53,36 @@
{ {
"fieldname": "c_regtype", "fieldname": "c_regtype",
"fieldtype": "Select", "fieldtype": "Select",
"in_list_view": 1,
"label": "所有者类型", "label": "所有者类型",
"options": "\nI\nE", "options": "\nI\nE"
"reqd": 1
}, },
{ {
"fieldname": "c_org_m", "fieldname": "c_org_m",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "(中文)所有者单位名称" "label": "(中文)所有者单位名称"
}, },
{ {
"fieldname": "fullname", "fieldname": "fullname",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "姓名" "label": "姓名"
}, },
{ {
"fieldname": "c_ln_m", "fieldname": "c_ln_m",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1,
"label": "(中文)联系人姓" "label": "(中文)联系人姓"
}, },
{ {
"fieldname": "c_fn_m", "fieldname": "c_fn_m",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1,
"label": "(中文)联系人名" "label": "(中文)联系人名"
}, },
{ {
"fieldname": "c_co", "fieldname": "c_co",
"fieldtype": "Data", "fieldtype": "Data",
"in_list_view": 1,
"label": "所属国家或地区简称" "label": "所属国家或地区简称"
}, },
{ {
@ -228,7 +227,7 @@
"grid_page_length": 50, "grid_page_length": 50,
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2025-08-01 22:27:42.613190", "modified": "2025-08-02 16:32:15.038006",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Jcloud", "module": "Jcloud",
"name": "Domain Owner", "name": "Domain Owner",