删除所有console.log输出,优化评查结果的表格的显示,添加新的页码获取逻辑
This commit is contained in:
@@ -3,25 +3,30 @@ interface ActionButtonsProps {
|
||||
onSave?: () => void;
|
||||
onSaveDraft?: () => void;
|
||||
isEditMode?: boolean;
|
||||
showButtons?: boolean;
|
||||
}
|
||||
|
||||
export function ActionButtons({ onSave, onSaveDraft, isEditMode }: ActionButtonsProps) {
|
||||
export function ActionButtons({ onSave, onSaveDraft, isEditMode, showButtons = true }: ActionButtonsProps) {
|
||||
return (
|
||||
<div className="flex justify-center space-x-4 mt-8 mb-4">
|
||||
<button
|
||||
type="button"
|
||||
className="ant-btn ant-btn-primary min-w-[120px]"
|
||||
onClick={onSave}
|
||||
>
|
||||
<i className="ri-save-line mr-1"></i> {isEditMode ? '保存修改' : '保存'}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="ant-btn ant-btn-default min-w-[120px] !hidden"
|
||||
onClick={onSaveDraft}
|
||||
>
|
||||
<i className="ri-draft-line mr-1"></i> {isEditMode ? '另存为草稿' : '保存草稿'}
|
||||
</button>
|
||||
{showButtons && (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className="ant-btn ant-btn-primary min-w-[120px]"
|
||||
onClick={onSave}
|
||||
>
|
||||
<i className="ri-save-line mr-1"></i> {isEditMode ? '保存修改' : '保存'}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="ant-btn ant-btn-default min-w-[120px] !hidden"
|
||||
onClick={onSaveDraft}
|
||||
>
|
||||
<i className="ri-draft-line mr-1"></i> {isEditMode ? '另存为草稿' : '保存草稿'}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
<Button
|
||||
type="default"
|
||||
className="min-w-[120px] focus:!ring-gray-300"
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
interface PageHeaderProps {
|
||||
title: string;
|
||||
onSave?: () => void;
|
||||
showSaveButton?: boolean;
|
||||
}
|
||||
|
||||
export function PageHeader({ title, onSave }: PageHeaderProps) {
|
||||
export function PageHeader({ title, onSave, showSaveButton = true }: PageHeaderProps) {
|
||||
return (
|
||||
<div className="flex justify-between items-center pb-2 mb-4 border-b border-gray-200">
|
||||
<h1 className="text-xl font-medium text-gray-800">{title}</h1>
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
className="ant-btn ant-btn-primary"
|
||||
onClick={onSave}
|
||||
>
|
||||
<i className="ri-save-line mr-1"></i> 保存
|
||||
</button>
|
||||
{showSaveButton && (
|
||||
<button
|
||||
type="button"
|
||||
className="ant-btn ant-btn-primary"
|
||||
onClick={onSave}
|
||||
>
|
||||
<i className="ri-save-line mr-1"></i> 保存
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -243,7 +243,7 @@ export function ReviewSettings({
|
||||
}
|
||||
|
||||
// 记录初始化处理
|
||||
console.log("ReviewSettings开始初始化,数据:", initialData);
|
||||
// console.log("ReviewSettings开始初始化,数据:", initialData);
|
||||
|
||||
// 保存初始数据引用,用于后续比较
|
||||
initialDataRef.current = JSON.parse(JSON.stringify(initialData));
|
||||
@@ -255,7 +255,7 @@ export function ReviewSettings({
|
||||
if (initialData) {
|
||||
// 处理初始规则数据
|
||||
if (initialData.rules && Array.isArray(initialData.rules) && initialData.rules.length > 0) {
|
||||
console.log("设置初始规则数据:", initialData.rules);
|
||||
// console.log("设置初始规则数据:", initialData.rules);
|
||||
|
||||
const validRules = initialData.rules.map(rule => {
|
||||
// 确保每个规则都有id
|
||||
@@ -394,7 +394,7 @@ export function ReviewSettings({
|
||||
const newFields = uniqueFields.filter((field: string) => !availableFields.includes(field));
|
||||
|
||||
if (newFields.length > 0 || deletedFields.length > 0) {
|
||||
console.log('Updating fields in checkAndUpdateFields - deleted:', deletedFields, 'new:', newFields);
|
||||
// console.log('Updating fields in checkAndUpdateFields - deleted:', deletedFields, 'new:', newFields);
|
||||
// 设置最新的可用字段列表
|
||||
setAvailableFields(uniqueFields);
|
||||
|
||||
@@ -420,7 +420,7 @@ export function ReviewSettings({
|
||||
|
||||
// 处理已删除字段的函数
|
||||
const handleDeletedFields = (deletedFields: string[]) => {
|
||||
console.log("处理已删除字段:", deletedFields);
|
||||
// console.log("处理已删除字段:", deletedFields);
|
||||
|
||||
// 如果没有删除的字段,则直接返回
|
||||
if (!deletedFields || deletedFields.length === 0) return;
|
||||
@@ -513,7 +513,7 @@ export function ReviewSettings({
|
||||
|
||||
// 如果配置有实质性修改,记录日志
|
||||
if (configModified) {
|
||||
console.log(`规则(ID: ${rule.id}, 类型: ${rule.type})已清除对已删除字段的引用`);
|
||||
// console.log(`规则(ID: ${rule.id}, 类型: ${rule.type})已清除对已删除字段的引用`);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -877,7 +877,7 @@ export function ReviewSettings({
|
||||
!(config.availableFields as string[]).every((field) => availableFields.includes(field))))) {
|
||||
// 延迟更新以避免在渲染过程中修改状态
|
||||
setTimeout(() => {
|
||||
console.log('Updating rule config with new available fields:', availableFields);
|
||||
// console.log('Updating rule config with new available fields:', availableFields);
|
||||
const updatedConfig = { ...config, availableFields: availableFields };
|
||||
handleRuleConfigChange(id, updatedConfig);
|
||||
}, 0);
|
||||
@@ -915,7 +915,7 @@ export function ReviewSettings({
|
||||
value="and"
|
||||
checked={!config.logic || config.logic === 'and'}
|
||||
onChange={(e) => {
|
||||
console.log(`[调试] 选择判断逻辑 and,规则ID: ${id}, 当前值: ${config.logic}`);
|
||||
// console.log(`[调试] 选择判断逻辑 and,规则ID: ${id}, 当前值: ${config.logic}`);
|
||||
handleRuleConfigChange(id, { logic: e.target.value });
|
||||
// 直接触发配置更新
|
||||
generateEvaluationConfig();
|
||||
@@ -932,7 +932,7 @@ export function ReviewSettings({
|
||||
value="or"
|
||||
checked={config.logic === 'or'}
|
||||
onChange={(e) => {
|
||||
console.log(`[调试] 选择判断逻辑 or,规则ID: ${id}, 当前值: ${config.logic}`);
|
||||
// console.log(`[调试] 选择判断逻辑 or,规则ID: ${id}, 当前值: ${config.logic}`);
|
||||
handleRuleConfigChange(id, { logic: e.target.value });
|
||||
// 直接触发配置更新
|
||||
generateEvaluationConfig();
|
||||
|
||||
Reference in New Issue
Block a user