From e26aade08228876d3c4ff1c6b46beedbba8d0ba0 Mon Sep 17 00:00:00 2001 From: jingrow Date: Fri, 1 Aug 2025 21:45:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=BB=BA=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E6=89=80=E6=9C=89=E8=80=85=E6=97=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=AE=B0=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src2/components/DomainOwnerDialog.vue | 8 +- dashboard/src2/pages/NewJsiteDomain.vue | 65 ++++++++-- jcloud/api/domain_west.py | 119 +++--------------- .../pagetype/domain_owner/domain_owner.json | 8 +- .../pagetype/domain_owner/domain_owner.py | 1 + 5 files changed, 82 insertions(+), 119 deletions(-) diff --git a/dashboard/src2/components/DomainOwnerDialog.vue b/dashboard/src2/components/DomainOwnerDialog.vue index a674a68..1a238fd 100644 --- a/dashboard/src2/components/DomainOwnerDialog.vue +++ b/dashboard/src2/components/DomainOwnerDialog.vue @@ -428,12 +428,12 @@ export default { getCertificateTypeOptions() { return this.formData.c_regtype === 'I' ? [ - { value: '身份证', label: '身份证' }, - { value: '护照', label: '护照' } + { value: 'SFZ', label: '身份证' }, + { value: 'HZ', label: '护照' } ] : [ - { value: '营业执照', label: '营业执照' }, - { value: '组织机构代码证', label: '组织机构代码证' } + { value: 'YYZZ', label: '营业执照' }, + { value: 'ORG', label: '组织机构代码证' } ]; } } diff --git a/dashboard/src2/pages/NewJsiteDomain.vue b/dashboard/src2/pages/NewJsiteDomain.vue index 4d7a3f4..765d421 100644 --- a/dashboard/src2/pages/NewJsiteDomain.vue +++ b/dashboard/src2/pages/NewJsiteDomain.vue @@ -959,32 +959,35 @@ export default { createDomainOwner() { return { url: 'jcloud.api.domain_west.create_domain_owner', - validate() { - if (!this.newOwnerForm.c_regtype) { + validate(data) { + // 调试:打印验证函数接收到的数据 + console.log('验证函数接收到的data:', data); + + if (!data.c_regtype) { 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('请输入姓名'); } - if (!this.newOwnerForm.c_st_m || !this.newOwnerForm.c_ct_m) { + if (!data.c_st_m || !data.c_ct_m) { throw new DashboardError('请选择所属区域'); } - if (!this.newOwnerForm.c_adr_m) { + if (!data.c_adr_m) { throw new DashboardError('请输入通讯地址'); } - if (!this.newOwnerForm.c_pc) { + if (!data.c_pc) { throw new DashboardError('请输入邮编'); } - if (!this.newOwnerForm.c_ph_num) { + if (!data.c_ph) { throw new DashboardError('请输入联系电话'); } - if (!this.newOwnerForm.c_em) { + if (!data.c_em) { throw new DashboardError('请输入电子邮箱'); } - if (!this.newOwnerForm.c_idtype_gswl) { + if (!data.c_idtype_gswl) { throw new DashboardError('请选择证件类型'); } - if (!this.newOwnerForm.c_idnum_gswl) { + if (!data.c_idnum_gswl) { throw new DashboardError('请输入证件号码'); } }, @@ -1115,7 +1118,47 @@ export default { }, handleOwnerSubmit(formData) { 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() { const yearlyPrice = this.domainPrice || 0; diff --git a/jcloud/api/domain_west.py b/jcloud/api/domain_west.py index cb87499..636806e 100644 --- a/jcloud/api/domain_west.py +++ b/jcloud/api/domain_west.py @@ -1071,19 +1071,30 @@ def get_domain_owners(): return {"status": "Error", "message": f"获取域名所有者列表失败: {str(e)}"} @jingrow.whitelist() -def create_domain_owner(data): +def create_domain_owner(**data): """创建新的域名所有者""" try: team = get_current_team() if not team: 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'] - for field in required_fields: + # 验证基本必填字段 + 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 basic_required_fields: if not data.get(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 @@ -1118,7 +1129,6 @@ def create_domain_owner(data): data['c_co'] = 'CN' # 中国 data['cocode'] = '+86' data['c_ph_type'] = '0' # 手机 - data['c_ph_code'] = '+86' data['reg_contact_type'] = 'cg' # 常规 # 生成标题 @@ -1132,7 +1142,7 @@ def create_domain_owner(data): "pagetype": "Domain Owner", **data }) - domain_owner.insert() + domain_owner.insert(ignore_permissions=True) return { "status": "Success", @@ -1146,100 +1156,3 @@ def create_domain_owner(data): jingrow.log_error("创建域名所有者失败", 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 - } - diff --git a/jcloud/jcloud/pagetype/domain_owner/domain_owner.json b/jcloud/jcloud/pagetype/domain_owner/domain_owner.json index ab959a5..e9994fa 100644 --- a/jcloud/jcloud/pagetype/domain_owner/domain_owner.json +++ b/jcloud/jcloud/pagetype/domain_owner/domain_owner.json @@ -20,6 +20,7 @@ "c_ph_num", "c_ph_fj", "c_pc", + "c_sysid", "team", "section_break_ssfs", "c_org_m", @@ -207,12 +208,17 @@ "fieldname": "c_idnum_gswl", "fieldtype": "Data", "label": "证件号码" + }, + { + "fieldname": "c_sysid", + "fieldtype": "Data", + "label": "模板标识" } ], "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-08-01 16:19:30.144351", + "modified": "2025-08-01 21:43:44.119231", "modified_by": "Administrator", "module": "Jcloud", "name": "Domain Owner", diff --git a/jcloud/jcloud/pagetype/domain_owner/domain_owner.py b/jcloud/jcloud/pagetype/domain_owner/domain_owner.py index dfc0b7a..36710fe 100644 --- a/jcloud/jcloud/pagetype/domain_owner/domain_owner.py +++ b/jcloud/jcloud/pagetype/domain_owner/domain_owner.py @@ -38,6 +38,7 @@ class DomainOwner(Document): c_regtype: DF.Literal["", "I", "E"] c_st: DF.Data | None c_st_m: DF.Data | None + c_sysid: DF.Data | None cocode: DF.Data | None fullname: DF.Data | None reg_contact_type: DF.Literal["", "cg", "hk", "tw", "jingwai"]