修复新建域名所有者时无法创建记录的问题

This commit is contained in:
jingrow 2025-08-01 21:45:43 +08:00
parent 185becf5a8
commit e26aade082
5 changed files with 82 additions and 119 deletions

View File

@ -428,12 +428,12 @@ export default {
getCertificateTypeOptions() { getCertificateTypeOptions() {
return this.formData.c_regtype === 'I' return this.formData.c_regtype === 'I'
? [ ? [
{ value: '身份证', label: '身份证' }, { value: 'SFZ', label: '身份证' },
{ value: '护照', label: '护照' } { value: 'HZ', label: '护照' }
] ]
: [ : [
{ value: '营业执照', label: '营业执照' }, { value: 'YYZZ', label: '营业执照' },
{ value: '组织机构代码证', label: '组织机构代码证' } { value: 'ORG', label: '组织机构代码证' }
]; ];
} }
} }

View File

@ -959,32 +959,35 @@ export default {
createDomainOwner() { createDomainOwner() {
return { return {
url: 'jcloud.api.domain_west.create_domain_owner', url: 'jcloud.api.domain_west.create_domain_owner',
validate() { validate(data) {
if (!this.newOwnerForm.c_regtype) { //
console.log('验证函数接收到的data:', data);
if (!data.c_regtype) {
throw new DashboardError('请选择所有者类型'); throw new DashboardError('请选择所有者类型');
} }
if (!this.newOwnerForm.c_ln_m || !this.newOwnerForm.c_fn_m) { if (!data.c_ln_m || !data.c_fn_m) {
throw new DashboardError('请输入姓名'); throw new DashboardError('请输入姓名');
} }
if (!this.newOwnerForm.c_st_m || !this.newOwnerForm.c_ct_m) { if (!data.c_st_m || !data.c_ct_m) {
throw new DashboardError('请选择所属区域'); throw new DashboardError('请选择所属区域');
} }
if (!this.newOwnerForm.c_adr_m) { if (!data.c_adr_m) {
throw new DashboardError('请输入通讯地址'); throw new DashboardError('请输入通讯地址');
} }
if (!this.newOwnerForm.c_pc) { if (!data.c_pc) {
throw new DashboardError('请输入邮编'); throw new DashboardError('请输入邮编');
} }
if (!this.newOwnerForm.c_ph_num) { if (!data.c_ph) {
throw new DashboardError('请输入联系电话'); throw new DashboardError('请输入联系电话');
} }
if (!this.newOwnerForm.c_em) { if (!data.c_em) {
throw new DashboardError('请输入电子邮箱'); throw new DashboardError('请输入电子邮箱');
} }
if (!this.newOwnerForm.c_idtype_gswl) { if (!data.c_idtype_gswl) {
throw new DashboardError('请选择证件类型'); throw new DashboardError('请选择证件类型');
} }
if (!this.newOwnerForm.c_idnum_gswl) { if (!data.c_idnum_gswl) {
throw new DashboardError('请输入证件号码'); throw new DashboardError('请输入证件号码');
} }
}, },
@ -1115,7 +1118,47 @@ export default {
}, },
handleOwnerSubmit(formData) { handleOwnerSubmit(formData) {
this.isCreatingOwner = true; this.isCreatingOwner = true;
this.$resources.createDomainOwner.submit(formData);
//
console.log('接收到的formData:', formData);
// API
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: 'CN', //
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_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'
};
//
console.log('转换后的apiData:', apiData);
this.$resources.createDomainOwner.submit(apiData);
}, },
getTotalAmount() { getTotalAmount() {
const yearlyPrice = this.domainPrice || 0; const yearlyPrice = this.domainPrice || 0;

View File

@ -1071,19 +1071,30 @@ def get_domain_owners():
return {"status": "Error", "message": f"获取域名所有者列表失败: {str(e)}"} return {"status": "Error", "message": f"获取域名所有者列表失败: {str(e)}"}
@jingrow.whitelist() @jingrow.whitelist()
def create_domain_owner(data): def create_domain_owner(**data):
"""创建新的域名所有者""" """创建新的域名所有者"""
try: try:
team = get_current_team() team = get_current_team()
if not team: if not team:
return {"status": "Error", "message": "未找到当前团队"} return {"status": "Error", "message": "未找到当前团队"}
# 验证必填字段 # 验证基本必填字段
required_fields = ['c_regtype', 'c_ln_m', 'c_fn_m', 'c_st_m', 'c_ct_m', 'c_adr_m', 'c_pc', 'c_ph_num', 'c_em'] basic_required_fields = ['c_regtype', 'c_ln_m', 'c_fn_m', 'c_st_m', 'c_ct_m', 'c_adr_m', 'c_pc', 'c_em']
for field in required_fields: for field in basic_required_fields:
if not data.get(field): if not data.get(field):
return {"status": "Error", "message": f"字段 {field} 是必填项"} return {"status": "Error", "message": f"字段 {field} 是必填项"}
# 验证电话号码字段根据c_ph_type判断
c_ph_type = data.get('c_ph_type', '0') # 默认为手机
if c_ph_type == '0': # 手机
if not data.get('c_ph'):
return {"status": "Error", "message": "手机号码 c_ph 是必填项"}
elif c_ph_type == '1': # 座机
if not data.get('c_ph_code'):
return {"status": "Error", "message": "座机区号 c_ph_code 是必填项"}
if not data.get('c_ph_num'):
return {"status": "Error", "message": "座机号码 c_ph_num 是必填项"}
# 生成英文信息 # 生成英文信息
from pypinyin import lazy_pinyin from pypinyin import lazy_pinyin
@ -1118,7 +1129,6 @@ def create_domain_owner(data):
data['c_co'] = 'CN' # 中国 data['c_co'] = 'CN' # 中国
data['cocode'] = '+86' data['cocode'] = '+86'
data['c_ph_type'] = '0' # 手机 data['c_ph_type'] = '0' # 手机
data['c_ph_code'] = '+86'
data['reg_contact_type'] = 'cg' # 常规 data['reg_contact_type'] = 'cg' # 常规
# 生成标题 # 生成标题
@ -1132,7 +1142,7 @@ def create_domain_owner(data):
"pagetype": "Domain Owner", "pagetype": "Domain Owner",
**data **data
}) })
domain_owner.insert() domain_owner.insert(ignore_permissions=True)
return { return {
"status": "Success", "status": "Success",
@ -1146,100 +1156,3 @@ def create_domain_owner(data):
jingrow.log_error("创建域名所有者失败", str(e)) jingrow.log_error("创建域名所有者失败", str(e))
return {"status": "Error", "message": f"创建域名所有者失败: {str(e)}"} return {"status": "Error", "message": f"创建域名所有者失败: {str(e)}"}
@jingrow.whitelist()
def get_china_regions():
"""获取中国省市县数据"""
provinces = [
{'code': '11', 'name': '北京市', 'cities': [
{'code': '1101', 'name': '北京市', 'districts': [
{'code': '110101', 'name': '东城区'},
{'code': '110102', 'name': '西城区'},
{'code': '110105', 'name': '朝阳区'},
{'code': '110106', 'name': '丰台区'},
{'code': '110107', 'name': '石景山区'},
{'code': '110108', 'name': '海淀区'},
{'code': '110109', 'name': '门头沟区'},
{'code': '110111', 'name': '房山区'},
{'code': '110112', 'name': '通州区'},
{'code': '110113', 'name': '顺义区'},
{'code': '110114', 'name': '昌平区'},
{'code': '110115', 'name': '大兴区'},
{'code': '110116', 'name': '怀柔区'},
{'code': '110117', 'name': '平谷区'},
{'code': '110118', 'name': '密云区'},
{'code': '110119', 'name': '延庆区'}
]}
]},
{'code': '12', 'name': '天津市', 'cities': [
{'code': '1201', 'name': '天津市', 'districts': [
{'code': '120101', 'name': '和平区'},
{'code': '120102', 'name': '河东区'},
{'code': '120103', 'name': '河西区'},
{'code': '120104', 'name': '南开区'},
{'code': '120105', 'name': '河北区'},
{'code': '120106', 'name': '红桥区'},
{'code': '120110', 'name': '东丽区'},
{'code': '120111', 'name': '西青区'},
{'code': '120112', 'name': '津南区'},
{'code': '120113', 'name': '北辰区'},
{'code': '120114', 'name': '武清区'},
{'code': '120115', 'name': '宝坻区'},
{'code': '120116', 'name': '滨海新区'},
{'code': '120117', 'name': '宁河区'},
{'code': '120118', 'name': '静海区'},
{'code': '120119', 'name': '蓟州区'}
]}
]},
{'code': '31', 'name': '上海市', 'cities': [
{'code': '3101', 'name': '上海市', 'districts': [
{'code': '310101', 'name': '黄浦区'},
{'code': '310104', 'name': '徐汇区'},
{'code': '310105', 'name': '长宁区'},
{'code': '310106', 'name': '静安区'},
{'code': '310107', 'name': '普陀区'},
{'code': '310109', 'name': '虹口区'},
{'code': '310110', 'name': '杨浦区'},
{'code': '310112', 'name': '闵行区'},
{'code': '310113', 'name': '宝山区'},
{'code': '310114', 'name': '嘉定区'},
{'code': '310115', 'name': '浦东新区'},
{'code': '310116', 'name': '金山区'},
{'code': '310117', 'name': '松江区'},
{'code': '310118', 'name': '青浦区'},
{'code': '310120', 'name': '奉贤区'},
{'code': '310151', 'name': '崇明区'}
]}
]},
{'code': '44', 'name': '广东省', 'cities': [
{'code': '4401', 'name': '广州市', 'districts': [
{'code': '440103', 'name': '荔湾区'},
{'code': '440104', 'name': '越秀区'},
{'code': '440105', 'name': '海珠区'},
{'code': '440106', 'name': '天河区'},
{'code': '440111', 'name': '白云区'},
{'code': '440112', 'name': '黄埔区'},
{'code': '440113', 'name': '番禺区'},
{'code': '440114', 'name': '花都区'},
{'code': '440115', 'name': '南沙区'},
{'code': '440117', 'name': '从化区'},
{'code': '440118', 'name': '增城区'}
]},
{'code': '4403', 'name': '深圳市', 'districts': [
{'code': '440303', 'name': '罗湖区'},
{'code': '440304', 'name': '福田区'},
{'code': '440305', 'name': '南山区'},
{'code': '440306', 'name': '宝安区'},
{'code': '440307', 'name': '龙岗区'},
{'code': '440308', 'name': '盐田区'},
{'code': '440309', 'name': '龙华区'},
{'code': '440310', 'name': '坪山区'},
{'code': '440311', 'name': '光明区'}
]}
]}
]
return {
"status": "Success",
"data": provinces
}

View File

@ -20,6 +20,7 @@
"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",
@ -207,12 +208,17 @@
"fieldname": "c_idnum_gswl", "fieldname": "c_idnum_gswl",
"fieldtype": "Data", "fieldtype": "Data",
"label": "证件号码" "label": "证件号码"
},
{
"fieldname": "c_sysid",
"fieldtype": "Data",
"label": "模板标识"
} }
], ],
"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 16:19:30.144351", "modified": "2025-08-01 21:43:44.119231",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Jcloud", "module": "Jcloud",
"name": "Domain Owner", "name": "Domain Owner",

View File

@ -38,6 +38,7 @@ class DomainOwner(Document):
c_regtype: DF.Literal["", "I", "E"] c_regtype: DF.Literal["", "I", "E"]
c_st: DF.Data | None c_st: DF.Data | None
c_st_m: DF.Data | None c_st_m: DF.Data | None
c_sysid: DF.Data | None
cocode: DF.Data | None cocode: DF.Data | None
fullname: DF.Data | None fullname: DF.Data | None
reg_contact_type: DF.Literal["", "cg", "hk", "tw", "jingwai"] reg_contact_type: DF.Literal["", "cg", "hk", "tw", "jingwai"]