优化所有者模板列表页及删除相关调试日志
This commit is contained in:
parent
cc5f449dd9
commit
7c5fb46323
@ -1,148 +1,143 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<!-- 页面头部 -->
|
<div class="mx-5 mt-5">
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex flex-col sm:flex-row gap-4 items-center">
|
||||||
<div>
|
<div class="w-full sm:w-1/2">
|
||||||
<h2 class="text-lg font-medium text-gray-900">域名所有者模板</h2>
|
<div class="flex gap-2">
|
||||||
<p class="text-sm text-gray-600">管理域名注册使用的所有者信息模板</p>
|
<TextInput
|
||||||
</div>
|
v-model="searchQuery"
|
||||||
<Button
|
placeholder="搜索所有者姓名、单位名称..."
|
||||||
@click="createDomainOwner"
|
class="flex-1"
|
||||||
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="查看详情"
|
|
||||||
>
|
>
|
||||||
<EyeIcon class="h-4 w-4" />
|
<template #prefix>
|
||||||
</Button>
|
<SearchIcon class="h-4 w-4 text-gray-400" />
|
||||||
<Button
|
</template>
|
||||||
@click="editOwner(owner)"
|
</TextInput>
|
||||||
variant="ghost"
|
<select
|
||||||
size="sm"
|
v-model="selectedStatus"
|
||||||
class="text-gray-600 hover:text-gray-700"
|
class="rounded-lg border border-gray-300 px-3 py-2 text-sm focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
|
||||||
title="编辑"
|
|
||||||
>
|
>
|
||||||
<EditIcon class="h-4 w-4" />
|
<option value="">全部状态</option>
|
||||||
</Button>
|
<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>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 分页 -->
|
<!-- 分页 -->
|
||||||
<div v-if="pagination.total > pagination.limit" class="flex items-center justify-between">
|
<div v-if="pagination.total > pagination.limit" class="flex items-center justify-between mt-4">
|
||||||
<div class="text-sm text-gray-700">
|
<div class="text-sm text-gray-700">
|
||||||
显示 {{ (pagination.pageno - 1) * pagination.limit + 1 }} 到
|
显示 {{ (pagination.pageno - 1) * pagination.limit + 1 }} 到
|
||||||
{{ Math.min(pagination.pageno * pagination.limit, pagination.total) }} 条,
|
{{ Math.min(pagination.pageno * pagination.limit, pagination.total) }} 条,
|
||||||
共 {{ pagination.total }} 条记录
|
共 {{ pagination.total }} 条记录
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<Button
|
<Button
|
||||||
@click="previousPage"
|
@click="previousPage"
|
||||||
:disabled="pagination.pageno <= 1"
|
:disabled="pagination.pageno <= 1"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
上一页
|
上一页
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
@click="nextPage"
|
@click="nextPage"
|
||||||
:disabled="pagination.pageno >= pagination.pagecount"
|
:disabled="pagination.pageno >= pagination.pagecount"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
下一页
|
下一页
|
||||||
</Button>
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -222,10 +217,6 @@
|
|||||||
<label class="block text-sm font-medium text-gray-700">通讯地址</label>
|
<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>
|
<p class="mt-1 text-sm text-gray-900">{{ selectedOwner.c_adr_m || '-' }}</p>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -577,7 +568,6 @@ export default {
|
|||||||
if (owner.c_st_m) addressParts.push(owner.c_st_m);
|
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_ct_m) addressParts.push(owner.c_ct_m);
|
||||||
if (owner.c_adr_m) addressParts.push(owner.c_adr_m);
|
if (owner.c_adr_m) addressParts.push(owner.c_adr_m);
|
||||||
if (owner.c_pc) addressParts.push(owner.c_pc);
|
|
||||||
return addressParts.join(' ');
|
return addressParts.join(' ');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -3214,40 +3214,26 @@ def modify_west_contact_template(**data):
|
|||||||
def update_domain_owner(name, **data):
|
def update_domain_owner(name, **data):
|
||||||
"""更新域名所有者信息"""
|
"""更新域名所有者信息"""
|
||||||
try:
|
try:
|
||||||
jingrow.log_error("update_domain_owner", f"开始更新域名所有者 - name: {name}, data: {data}")
|
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
jingrow.log_error("update_domain_owner", "域名所有者名称不能为空")
|
|
||||||
return {"status": "Error", "message": "域名所有者名称不能为空"}
|
return {"status": "Error", "message": "域名所有者名称不能为空"}
|
||||||
|
|
||||||
# 获取指定的域名所有者
|
# 获取指定的域名所有者
|
||||||
jingrow.log_error("update_domain_owner", f"正在获取域名所有者: {name}")
|
|
||||||
domain_owner = jingrow.get_pg("Domain Owner", name)
|
domain_owner = jingrow.get_pg("Domain Owner", name)
|
||||||
if not domain_owner:
|
if not domain_owner:
|
||||||
jingrow.log_error("update_domain_owner", f"未找到指定的域名所有者: {name}")
|
|
||||||
return {"status": "Error", "message": "未找到指定的域名所有者"}
|
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()
|
team = get_current_team()
|
||||||
jingrow.log_error("update_domain_owner", f"当前团队: {team}")
|
|
||||||
|
|
||||||
if not team:
|
if not team:
|
||||||
jingrow.log_error("update_domain_owner", "未找到当前团队")
|
|
||||||
return {"status": "Error", "message": "未找到当前团队"}
|
return {"status": "Error", "message": "未找到当前团队"}
|
||||||
|
|
||||||
if domain_owner.team != team:
|
if domain_owner.team != team:
|
||||||
jingrow.log_error("update_domain_owner", f"权限检查失败 - 所有者团队: {domain_owner.team}, 当前团队: {team}")
|
|
||||||
return {"status": "Error", "message": "无权更新该域名所有者信息"}
|
return {"status": "Error", "message": "无权更新该域名所有者信息"}
|
||||||
|
|
||||||
jingrow.log_error("update_domain_owner", "权限检查通过,开始更新西部数码模板...")
|
|
||||||
|
|
||||||
# 检查是否有 c_sysid(西部数码模板标识)
|
# 检查是否有 c_sysid(西部数码模板标识)
|
||||||
c_sysid = getattr(domain_owner, 'c_sysid', None)
|
c_sysid = getattr(domain_owner, 'c_sysid', None)
|
||||||
if not c_sysid:
|
if not c_sysid:
|
||||||
jingrow.log_error("update_domain_owner", "域名所有者没有 c_sysid,无法更新西部数码模板")
|
|
||||||
return {"status": "Error", "message": "域名所有者没有模板标识,无法更新"}
|
return {"status": "Error", "message": "域名所有者没有模板标识,无法更新"}
|
||||||
|
|
||||||
# 构建西部数码模板更新数据
|
# 构建西部数码模板更新数据
|
||||||
@ -3287,23 +3273,15 @@ def update_domain_owner(name, **data):
|
|||||||
if current_value:
|
if current_value:
|
||||||
template_data[template_field] = current_value
|
template_data[template_field] = current_value
|
||||||
|
|
||||||
jingrow.log_error("update_domain_owner", f"准备调用 modify_west_contact_template,参数: {template_data}")
|
|
||||||
|
|
||||||
# 调用西部数码模板更新接口
|
# 调用西部数码模板更新接口
|
||||||
try:
|
try:
|
||||||
west_result = modify_west_contact_template(**template_data)
|
west_result = modify_west_contact_template(**template_data)
|
||||||
|
|
||||||
jingrow.log_error("update_domain_owner", f"西部数码模板更新结果: {west_result}")
|
|
||||||
|
|
||||||
if west_result.get('status') != 'success':
|
if west_result.get('status') != 'success':
|
||||||
error_msg = west_result.get('message', '西部数码模板更新失败')
|
error_msg = west_result.get('message', '西部数码模板更新失败')
|
||||||
jingrow.log_error("update_domain_owner", f"西部数码模板更新失败: {error_msg}")
|
|
||||||
return {"status": "Error", "message": f"西部数码模板更新失败: {error_msg}"}
|
return {"status": "Error", "message": f"西部数码模板更新失败: {error_msg}"}
|
||||||
|
|
||||||
jingrow.log_error("update_domain_owner", "西部数码模板更新成功,开始更新本地记录...")
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
jingrow.log_error("update_domain_owner", f"调用 modify_west_contact_template 失败: {str(e)}")
|
|
||||||
return {"status": "Error", "message": f"西部数码模板更新失败: {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)
|
old_value = getattr(domain_owner, key, None)
|
||||||
setattr(domain_owner, key, value)
|
setattr(domain_owner, key, value)
|
||||||
updated_fields.append(f"{key}: {old_value} -> {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 忽略权限检查
|
# 保存更新,使用 ignore_permissions=True 忽略权限检查
|
||||||
jingrow.log_error("update_domain_owner", "正在保存本地更新...")
|
|
||||||
domain_owner.save(ignore_permissions=True)
|
domain_owner.save(ignore_permissions=True)
|
||||||
jingrow.db.commit()
|
jingrow.db.commit()
|
||||||
jingrow.log_error("update_domain_owner", "本地记录保存成功")
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"status": "Success",
|
"status": "Success",
|
||||||
@ -3334,10 +3305,6 @@ def update_domain_owner(name, **data):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
except Exception as e:
|
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)}"}
|
return {"status": "Error", "message": f"更新域名所有者信息失败: {str(e)}"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user