域名详情页所有者显示为个人姓名或公司名称,状态显示为正常或已到期

This commit is contained in:
jingrow 2025-08-02 20:38:42 +08:00
parent e9fb158101
commit d9b3edb7ae
4 changed files with 123 additions and 22 deletions

View File

@ -59,7 +59,7 @@
</div>
<div class="flex justify-between items-center">
<span class="text-gray-600">所有者:</span>
<span class="text-lg font-semibold text-purple-600">{{ $domain.pg.domain_owner || '未知' }}</span>
<span class="text-lg font-semibold text-purple-600">{{ getOwnerDisplayName() || '未知' }}</span>
</div>
<div class="flex justify-between items-center">
<span class="text-gray-600">购买时长:</span>
@ -208,29 +208,70 @@ export default {
autoRenewLoading: false,
whoisProtectionLoading: false,
deleteLoading: false,
domainOwner: null,
};
},
methods: {
getStatusText(status) {
const statusMap = {
'Pending': '待处理',
'Active': '活跃',
'Expired': '已过期',
'Suspended': '已暂停',
'Cancelled': '已取消'
'Active': '正常',
'Expired': '已过期'
};
return statusMap[status] || status;
},
getStatusVariant(status) {
const variantMap = {
'Pending': 'warning',
'Active': 'success',
'Expired': 'danger',
'Suspended': 'danger',
'Cancelled': 'danger'
'Expired': 'danger'
};
return variantMap[status] || 'default';
},
//
getOwnerDisplayName() {
if (!this.domainOwner) {
return null;
}
// fullnametitle
if (this.domainOwner.c_regtype === 'I') {
return this.domainOwner.fullname || this.domainOwner.title;
}
// c_org_mtitle
else if (this.domainOwner.c_regtype === 'E') {
return this.domainOwner.c_org_m || this.domainOwner.title;
}
// title
return this.domainOwner.title;
},
//
async getDomainOwner() {
if (!this.$domain.pg?.domain_owner) {
this.domainOwner = null;
return;
}
try {
const getOwnerRequest = createResource({
url: 'jcloud.api.domain_west.get_domain_owner',
params: {
name: this.$domain.pg.domain_owner
},
onSuccess: (response) => {
if (response && response.status === "Success" && response.data) {
this.domainOwner = response.data;
}
},
onError: (error) => {
console.error('获取域名所有者信息失败:', error);
this.domainOwner = null;
}
});
getOwnerRequest.submit();
} catch (error) {
console.error('获取域名所有者信息失败:', error);
this.domainOwner = null;
}
},
renewDomain() {
const JsiteDomainRenewalDialog = defineAsyncComponent(() => import('./JsiteDomainRenewalDialog.vue'));
@ -273,12 +314,12 @@ export default {
primaryAction: {
label: '确定',
onClick: ({ hide }) => {
toast.success(`${actionText}自动续费请求已提交`);
toast.success(`${actionText}自动续费已开通`);
hide();
this.autoRenewLoading = true;
const toggleRequest = createResource({
url: '/api/action/jcloud.api.domain_west.toggle_domain_auto_renew',
url: 'jcloud.api.domain_west.toggle_domain_auto_renew',
params: {
pagetype: 'Jsite Domain',
name: this.$domain.pg.name,
@ -313,12 +354,12 @@ export default {
primaryAction: {
label: '确定',
onClick: ({ hide }) => {
toast.success(`${actionText}隐私保护请求已提交`);
toast.success(`${actionText}隐私保护已开启`);
hide();
this.whoisProtectionLoading = true;
const toggleRequest = createResource({
url: '/api/action/jcloud.api.domain_west.toggle_domain_whois_protection',
url: 'jcloud.api.domain_west.toggle_domain_whois_protection',
params: {
pagetype: 'Jsite Domain',
name: this.$domain.pg.name,
@ -355,7 +396,7 @@ export default {
this.deleteLoading = true;
const deleteRequest = createResource({
url: '/api/action/jcloud.api.domain_west.delete_domain',
url: 'jcloud.api.domain_west.delete_domain',
params: {
pagetype: 'Jsite Domain',
name: this.$domain.pg.name
@ -384,6 +425,19 @@ export default {
this.$domain.reload();
},
},
watch: {
//
'$domain.pg.domain_owner': {
handler(newVal) {
if (newVal) {
this.getDomainOwner();
} else {
this.domainOwner = null;
}
},
immediate: true
}
},
computed: {
domainInformation() {
return [
@ -405,7 +459,7 @@ export default {
},
{
label: '所有者',
value: this.$domain.pg?.domain_owner || '未知',
value: this.getOwnerDisplayName() || '未知',
},
];
},
@ -413,5 +467,11 @@ export default {
return getCachedDocumentResource('Jsite Domain', this.domain);
},
},
mounted() {
//
if (this.$domain.pg?.domain_owner) {
this.getDomainOwner();
}
},
};
</script>

View File

@ -1094,6 +1094,48 @@ def get_domain_owners():
jingrow.log_error("获取域名所有者列表失败", str(e))
return {"status": "Error", "message": f"获取域名所有者列表失败: {str(e)}"}
@jingrow.whitelist()
def get_domain_owner(name):
"""获取单个域名所有者信息"""
try:
if not name:
return {"status": "Error", "message": "域名所有者名称不能为空"}
# 获取指定的域名所有者
domain_owner = jingrow.get_pg("Domain Owner", name)
if not domain_owner:
return {"status": "Error", "message": "未找到指定的域名所有者"}
# 检查权限(只能查看当前团队的所有者)
team = get_current_team()
if not team or domain_owner.team != team:
return {"status": "Error", "message": "无权访问该域名所有者信息"}
# 返回所有者信息
owner_data = {
"name": domain_owner.name,
"title": domain_owner.title,
"fullname": domain_owner.fullname,
"c_regtype": domain_owner.c_regtype,
"c_org_m": domain_owner.c_org_m,
"c_ln_m": domain_owner.c_ln_m,
"c_fn_m": domain_owner.c_fn_m,
"c_em": domain_owner.c_em,
"c_ph": domain_owner.c_ph,
"c_st_m": domain_owner.c_st_m,
"c_ct_m": domain_owner.c_ct_m,
"c_adr_m": domain_owner.c_adr_m,
"c_pc": domain_owner.c_pc
}
return {
"status": "Success",
"data": owner_data
}
except Exception as e:
jingrow.log_error("获取域名所有者信息失败", str(e))
return {"status": "Error", "message": f"获取域名所有者信息失败: {str(e)}"}
@jingrow.whitelist()
def create_domain_template(**data):
"""创建域名模板"""

View File

@ -40,14 +40,13 @@
"options": "Team"
},
{
"default": "Pending",
"default": "Active",
"fieldname": "status",
"fieldtype": "Select",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "状态",
"options": "Pending\nActive\nExpired\nSuspended\nCancelled",
"read_only": 1
"options": "Active\nExpired"
},
{
"fieldname": "order_id",
@ -197,7 +196,7 @@
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-08-01 04:11:35.696328",
"modified": "2025-08-02 20:35:58.740670",
"modified_by": "Administrator",
"module": "Jcloud",
"name": "Jsite Domain",

View File

@ -26,7 +26,7 @@ class JsiteDomain(Document):
dns_host6: DF.Data | None
dns_resolution: DF.Table[DnsResolution]
domain: DF.Data
domain_owner: DF.Data | None
domain_owner: DF.Link | None
domain_registrar: DF.Data | None
end_date: DF.Datetime | None
group: DF.Data | None
@ -34,7 +34,7 @@ class JsiteDomain(Document):
period: DF.Int
price: DF.Int
registration_date: DF.Datetime | None
status: DF.Literal["Pending", "Active", "Expired", "Suspended", "Cancelled"]
status: DF.Literal["Active", "Expired"]
team: DF.Link | None
whois_protection: DF.Check
# end: auto-generated types