main #2

Merged
jingrow merged 250 commits from main into v1 2026-01-13 22:45:50 +08:00
2 changed files with 132 additions and 175 deletions
Showing only changes of commit 7c5fb46323 - Show all commits

View File

@ -1,148 +1,143 @@
<template>
<div class="space-y-4">
<!-- 页面头部 -->
<div class="flex items-center justify-between">
<div>
<h2 class="text-lg font-medium text-gray-900">域名所有者模板</h2>
<p class="text-sm text-gray-600">管理域名注册使用的所有者信息模板</p>
</div>
<Button
@click="createDomainOwner"
variant="solid"
>
新建模板
</Button>
</div>
<!-- 搜索和筛选 -->
<div class="flex flex-col sm:flex-row gap-4">
<div class="flex-1">
<TextInput
v-model="searchQuery"
placeholder="搜索所有者姓名、单位名称..."
class="w-full"
>
<template #prefix>
<SearchIcon class="h-4 w-4 text-gray-400" />
</template>
</TextInput>
</div>
<div class="flex gap-2">
<select
v-model="selectedStatus"
class="rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
>
<option value="">全部状态</option>
<option value="1">已实名认证</option>
<option value="0">未实名认证</option>
</select>
</div>
</div>
<!-- 列表内容 -->
<div class="rounded-lg border border-gray-200 bg-white">
<!-- 表头 -->
<div class="grid grid-cols-12 gap-4 border-b border-gray-200 bg-gray-50 px-6 py-3 text-sm font-medium text-gray-700">
<div class="col-span-4">名称</div>
<div class="col-span-3">实名状态</div>
<div class="col-span-3">联系信息</div>
<div class="col-span-2">操作</div>
</div>
<!-- 加载状态 -->
<div v-if="isLoading" class="flex items-center justify-center py-12">
<Loader2Icon class="h-6 w-6 animate-spin text-gray-400" />
<span class="ml-2 text-gray-600">加载中...</span>
</div>
<!-- 错误状态 -->
<div v-else-if="error" class="flex items-center justify-center py-12">
<AlertCircleIcon class="h-6 w-6 text-red-500" />
<span class="ml-2 text-red-600">{{ error }}</span>
</div>
<!-- 空状态 -->
<div v-else-if="filteredOwners.length === 0" class="flex flex-col items-center justify-center py-12 text-gray-500">
<UsersIcon class="mb-4 h-12 w-12 text-gray-300" />
<p class="text-lg font-medium">暂无域名所有者模板</p>
<p class="text-sm">点击上方按钮创建第一个模板</p>
</div>
<!-- 数据列表 -->
<div v-else class="divide-y divide-gray-200">
<div
v-for="owner in filteredOwners"
:key="owner.name"
class="grid grid-cols-12 gap-4 px-6 py-4 hover:bg-gray-50 transition-colors cursor-pointer"
@click="viewOwner(owner)"
>
<!-- 名称列 -->
<div class="col-span-4">
<div class="font-medium text-gray-900">{{ getDisplayName(owner) }}</div>
<div class="text-sm text-gray-500">{{ owner.title || owner.name }}</div>
</div>
<!-- 实名状态列 -->
<div class="col-span-3 flex items-center">
<span class="text-sm">{{ getRealNameStatusText(owner.r_status) }}</span>
</div>
<!-- 联系信息列 -->
<div class="col-span-3">
<div class="text-sm text-gray-900">{{ owner.c_em || '-' }}</div>
<div class="text-sm text-gray-500">{{ owner.c_ph || '-' }}</div>
<div class="text-sm text-gray-400">{{ getAddressInfo(owner) }}</div>
</div>
<!-- 操作列 -->
<div class="col-span-2 flex items-center gap-2" @click.stop>
<Button
@click="viewOwner(owner)"
variant="ghost"
size="sm"
class="text-blue-600 hover:text-blue-700"
title="查看详情"
<div class="mx-5 mt-5">
<div class="flex flex-col sm:flex-row gap-4 items-center">
<div class="w-full sm:w-1/2">
<div class="flex gap-2">
<TextInput
v-model="searchQuery"
placeholder="搜索所有者姓名、单位名称..."
class="flex-1"
>
<EyeIcon class="h-4 w-4" />
</Button>
<Button
@click="editOwner(owner)"
variant="ghost"
size="sm"
class="text-gray-600 hover:text-gray-700"
title="编辑"
<template #prefix>
<SearchIcon class="h-4 w-4 text-gray-400" />
</template>
</TextInput>
<select
v-model="selectedStatus"
class="rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
>
<EditIcon class="h-4 w-4" />
</Button>
<option value="">全部状态</option>
<option value="1">已实名认证</option>
<option value="0">未实名认证</option>
</select>
</div>
</div>
<div class="w-full sm:w-1/2 flex justify-end">
<Button
@click="createDomainOwner"
variant="solid"
iconLeft="plus"
label="新建所有者模板"
/>
</div>
</div>
<!-- 列表内容 -->
<div class="rounded-lg border border-gray-200 bg-white mt-4">
<!-- 表头 -->
<div class="grid grid-cols-12 gap-4 border-b border-gray-200 bg-gray-50 px-6 py-3 text-sm font-medium text-gray-700">
<div class="col-span-4">所有者名称</div>
<div class="col-span-3">实名状态</div>
<div class="col-span-3">联系信息</div>
<div class="col-span-2">操作</div>
</div>
<!-- 加载状态 -->
<div v-if="isLoading" class="flex items-center justify-center py-12">
<Loader2Icon class="h-6 w-6 animate-spin text-gray-400" />
<span class="ml-2 text-gray-600">加载中...</span>
</div>
<!-- 错误状态 -->
<div v-else-if="error" class="flex items-center justify-center py-12">
<AlertCircleIcon class="h-6 w-6 text-red-500" />
<span class="ml-2 text-red-600">{{ error }}</span>
</div>
<!-- 空状态 -->
<div v-else-if="filteredOwners.length === 0" class="flex flex-col items-center justify-center py-12 text-gray-500">
<UsersIcon class="mb-4 h-12 w-12 text-gray-300" />
<p class="text-lg font-medium">暂无域名所有者模板</p>
<p class="text-sm">点击上方按钮创建第一个模板</p>
</div>
<!-- 数据列表 -->
<div v-else class="divide-y divide-gray-200">
<div
v-for="owner in filteredOwners"
:key="owner.name"
class="grid grid-cols-12 gap-4 px-6 py-4 hover:bg-gray-50 transition-colors cursor-pointer"
@click="viewOwner(owner)"
>
<!-- 名称列 -->
<div class="col-span-4">
<div class="font-medium text-gray-900">{{ getDisplayName(owner) }}</div>
<div class="text-sm text-gray-500">{{ owner.title || owner.name }}</div>
</div>
<!-- 实名状态列 -->
<div class="col-span-3 flex items-center">
<span class="text-sm">{{ getRealNameStatusText(owner.r_status) }}</span>
</div>
<!-- 联系信息列 -->
<div class="col-span-3">
<div class="text-sm text-gray-900">{{ owner.c_em || '-' }}</div>
<div class="text-sm text-gray-500">{{ owner.c_ph || '-' }}</div>
<div class="text-sm text-gray-400">{{ getAddressInfo(owner) }}</div>
</div>
<!-- 操作列 -->
<div class="col-span-2 flex items-center gap-2" @click.stop>
<Button
@click="viewOwner(owner)"
variant="ghost"
size="sm"
class="text-blue-600 hover:text-blue-700"
title="查看详情"
>
<EyeIcon class="h-4 w-4" />
</Button>
<Button
@click="editOwner(owner)"
variant="ghost"
size="sm"
class="text-gray-600 hover:text-gray-700"
title="编辑"
>
<EditIcon class="h-4 w-4" />
</Button>
</div>
</div>
</div>
</div>
</div>
<!-- 分页 -->
<div v-if="pagination.total > pagination.limit" class="flex items-center justify-between">
<div class="text-sm text-gray-700">
显示 {{ (pagination.pageno - 1) * pagination.limit + 1 }}
{{ Math.min(pagination.pageno * pagination.limit, pagination.total) }}
{{ pagination.total }} 条记录
</div>
<div class="flex gap-2">
<Button
@click="previousPage"
:disabled="pagination.pageno <= 1"
variant="outline"
size="sm"
>
上一页
</Button>
<Button
@click="nextPage"
:disabled="pagination.pageno >= pagination.pagecount"
variant="outline"
size="sm"
>
下一页
</Button>
<!-- 分页 -->
<div v-if="pagination.total > pagination.limit" class="flex items-center justify-between mt-4">
<div class="text-sm text-gray-700">
显示 {{ (pagination.pageno - 1) * pagination.limit + 1 }}
{{ Math.min(pagination.pageno * pagination.limit, pagination.total) }}
{{ pagination.total }} 条记录
</div>
<div class="flex gap-2">
<Button
@click="previousPage"
:disabled="pagination.pageno <= 1"
variant="outline"
size="sm"
>
上一页
</Button>
<Button
@click="nextPage"
:disabled="pagination.pageno >= pagination.pagecount"
variant="outline"
size="sm"
>
下一页
</Button>
</div>
</div>
</div>
@ -222,10 +217,6 @@
<label class="block text-sm font-medium text-gray-700">通讯地址</label>
<p class="mt-1 text-sm text-gray-900">{{ selectedOwner.c_adr_m || '-' }}</p>
</div>
<div>
<label class="block text-sm font-medium text-gray-700">邮编</label>
<p class="mt-1 text-sm text-gray-900">{{ selectedOwner.c_pc || '-' }}</p>
</div>
</div>
</div>
@ -577,7 +568,6 @@ export default {
if (owner.c_st_m) addressParts.push(owner.c_st_m);
if (owner.c_ct_m) addressParts.push(owner.c_ct_m);
if (owner.c_adr_m) addressParts.push(owner.c_adr_m);
if (owner.c_pc) addressParts.push(owner.c_pc);
return addressParts.join(' ');
},

View File

@ -3214,40 +3214,26 @@ def modify_west_contact_template(**data):
def update_domain_owner(name, **data):
"""更新域名所有者信息"""
try:
jingrow.log_error("update_domain_owner", f"开始更新域名所有者 - name: {name}, data: {data}")
if not name:
jingrow.log_error("update_domain_owner", "域名所有者名称不能为空")
return {"status": "Error", "message": "域名所有者名称不能为空"}
# 获取指定的域名所有者
jingrow.log_error("update_domain_owner", f"正在获取域名所有者: {name}")
domain_owner = jingrow.get_pg("Domain Owner", name)
if not domain_owner:
jingrow.log_error("update_domain_owner", f"未找到指定的域名所有者: {name}")
return {"status": "Error", "message": "未找到指定的域名所有者"}
jingrow.log_error("update_domain_owner", f"找到域名所有者: {domain_owner.name}, team: {getattr(domain_owner, 'team', 'None')}")
# 检查权限(只能更新当前团队的所有者)
jingrow.log_error("update_domain_owner", "正在检查权限...")
team = get_current_team()
jingrow.log_error("update_domain_owner", f"当前团队: {team}")
if not team:
jingrow.log_error("update_domain_owner", "未找到当前团队")
return {"status": "Error", "message": "未找到当前团队"}
if domain_owner.team != team:
jingrow.log_error("update_domain_owner", f"权限检查失败 - 所有者团队: {domain_owner.team}, 当前团队: {team}")
return {"status": "Error", "message": "无权更新该域名所有者信息"}
jingrow.log_error("update_domain_owner", "权限检查通过,开始更新西部数码模板...")
# 检查是否有 c_sysid西部数码模板标识
c_sysid = getattr(domain_owner, 'c_sysid', None)
if not c_sysid:
jingrow.log_error("update_domain_owner", "域名所有者没有 c_sysid无法更新西部数码模板")
return {"status": "Error", "message": "域名所有者没有模板标识,无法更新"}
# 构建西部数码模板更新数据
@ -3287,23 +3273,15 @@ def update_domain_owner(name, **data):
if current_value:
template_data[template_field] = current_value
jingrow.log_error("update_domain_owner", f"准备调用 modify_west_contact_template参数: {template_data}")
# 调用西部数码模板更新接口
try:
west_result = modify_west_contact_template(**template_data)
jingrow.log_error("update_domain_owner", f"西部数码模板更新结果: {west_result}")
if west_result.get('status') != 'success':
error_msg = west_result.get('message', '西部数码模板更新失败')
jingrow.log_error("update_domain_owner", f"西部数码模板更新失败: {error_msg}")
return {"status": "Error", "message": f"西部数码模板更新失败: {error_msg}"}
jingrow.log_error("update_domain_owner", "西部数码模板更新成功,开始更新本地记录...")
except Exception as e:
jingrow.log_error("update_domain_owner", f"调用 modify_west_contact_template 失败: {str(e)}")
return {"status": "Error", "message": f"西部数码模板更新失败: {str(e)}"}
# 西部数码模板更新成功后,更新本地记录
@ -3313,17 +3291,10 @@ def update_domain_owner(name, **data):
old_value = getattr(domain_owner, key, None)
setattr(domain_owner, key, value)
updated_fields.append(f"{key}: {old_value} -> {value}")
jingrow.log_error("update_domain_owner", f"更新字段 {key}: {old_value} -> {value}")
else:
jingrow.log_error("update_domain_owner", f"字段 {key} 不存在于 Domain Owner 中")
jingrow.log_error("update_domain_owner", f"更新的字段: {updated_fields}")
# 保存更新,使用 ignore_permissions=True 忽略权限检查
jingrow.log_error("update_domain_owner", "正在保存本地更新...")
domain_owner.save(ignore_permissions=True)
jingrow.db.commit()
jingrow.log_error("update_domain_owner", "本地记录保存成功")
return {
"status": "Success",
@ -3334,10 +3305,6 @@ def update_domain_owner(name, **data):
}
}
except Exception as e:
jingrow.log_error("update_domain_owner", f"更新域名所有者信息失败: {str(e)}")
jingrow.log_error("update_domain_owner", f"异常详情: {type(e).__name__}: {str(e)}")
import traceback
jingrow.log_error("update_domain_owner", f"堆栈跟踪: {traceback.format_exc()}")
return {"status": "Error", "message": f"更新域名所有者信息失败: {str(e)}"}