完善卷宗和合同的数据隔离的效果
This commit is contained in:
@@ -73,7 +73,7 @@ export function Layout({ children, userRole = 'developer' }: LayoutProps) {
|
||||
if (typeof window !== 'undefined') {
|
||||
try {
|
||||
const reviewType = sessionStorage.getItem('reviewType');
|
||||
console.log('Layout 路由变化, reviewType:', reviewType, '路径:', location.pathname);
|
||||
// console.log('Layout 路由变化, reviewType:', reviewType, '路径:', location.pathname);
|
||||
if (reviewType && REVIEW_TYPE_TO_APP[reviewType]) {
|
||||
setSelectedApp(REVIEW_TYPE_TO_APP[reviewType]);
|
||||
}
|
||||
|
||||
@@ -147,13 +147,13 @@ export function Sidebar({ onToggle, collapsed, userRole, selectedApp = 'contract
|
||||
path: '/rules-files',
|
||||
icon: 'ri-list-check-2'
|
||||
},
|
||||
{
|
||||
id: 'rule-new',
|
||||
title: '新增评查点',
|
||||
path: '/rules-new',
|
||||
requiredRole: 'developer',
|
||||
icon: 'ri-add-circle-line'
|
||||
},
|
||||
// {
|
||||
// id: 'rule-new',
|
||||
// title: '新增评查点',
|
||||
// path: '/rules-new',
|
||||
// requiredRole: 'developer',
|
||||
// icon: 'ri-add-circle-line'
|
||||
// },
|
||||
// {
|
||||
// id: 'review-detail',
|
||||
// title: '评查详情',
|
||||
|
||||
@@ -78,6 +78,7 @@ export interface ReviewPoint {
|
||||
pointId?: string;
|
||||
editAuditStatusId?: string | number;
|
||||
editAuditStatus: number;
|
||||
editAuditStatusMessage?: string; // 添加审核意见字段
|
||||
pointName: string;
|
||||
title: string;
|
||||
groupName: string;
|
||||
@@ -354,19 +355,12 @@ export function ReviewPointsList({
|
||||
|
||||
// 初始化建议文本
|
||||
useEffect(() => {
|
||||
// 将所有评查点的建议文本存储到状态中
|
||||
const suggestions: Record<string, string> = {};
|
||||
|
||||
reviewPoints.forEach(point => {
|
||||
suggestions[point.id] = point.suggestion || '';
|
||||
});
|
||||
// setSuggestionTexts(suggestions);
|
||||
|
||||
// 使用函数式更新,不再需要外部 manualReviewNotes 变量
|
||||
setManualReviewNotes(prev => {
|
||||
const notes = { ...prev };
|
||||
reviewPoints.forEach(point => {
|
||||
notes[point.id] = point.actionContent || '';
|
||||
// 优先使用editAuditStatusMessage,如果为空则使用actionContent或suggestion
|
||||
notes[point.id] = point.editAuditStatusMessage || point.actionContent || point.suggestion || '';
|
||||
});
|
||||
return notes;
|
||||
});
|
||||
@@ -388,37 +382,33 @@ export function ReviewPointsList({
|
||||
* @param message 用户输入的审核内容
|
||||
*/
|
||||
const handleReviewAction = (reviewPointResultId: string, editAuditStatusId: string | number | undefined, action: 'approve' | 'reject' | 'review', message: string) => {
|
||||
// 更新评查点状态
|
||||
// console.log('handleReviewAction-------', reviewPointResultId, editAuditStatusId, action, message);
|
||||
if(message.trim() === ''){
|
||||
// 通过/不通过时,必须有输入内容
|
||||
if(action !== 'review' && message.trim() === ''){
|
||||
toastService.error('请输入审核意见');
|
||||
return;
|
||||
}
|
||||
|
||||
if (action === 'review') {
|
||||
// 重新审核时,不更新结果状态,只更新审核意见和审核状态
|
||||
// console.log('重新审核-------', reviewPointResultId, editAuditStatusId || '', 'review', message);
|
||||
// 重新审核时,不更新结果状态,也不更新审核意见和审核状态
|
||||
onStatusChange(reviewPointResultId, editAuditStatusId || '', 'review', message);
|
||||
|
||||
// 找到当前评查点并更新其editAuditStatus为0,使其立即显示通过/不通过按钮
|
||||
const updatedReviewPoint = reviewPoints.find(point => point.id === reviewPointResultId);
|
||||
if (updatedReviewPoint) {
|
||||
updatedReviewPoint.editAuditStatus = 0;
|
||||
// 重新审核时不更新输入框内容
|
||||
}
|
||||
} else {
|
||||
// 通过/不通过时,更新结果状态和审核意见
|
||||
// console.log('通过/不通过-------', reviewPointResultId, editAuditStatusId || '', action === 'approve' ? 'true' : 'false', message);
|
||||
onStatusChange(reviewPointResultId, editAuditStatusId || '', action === 'approve' ? 'true' : 'false', message);
|
||||
|
||||
// 找到当前评查点并立即更新其editAuditStatusMessage
|
||||
const updatedReviewPoint = reviewPoints.find(point => point.id === reviewPointResultId);
|
||||
if (updatedReviewPoint) {
|
||||
updatedReviewPoint.editAuditStatusMessage = message;
|
||||
}
|
||||
}
|
||||
|
||||
// 将参数输出到控制台
|
||||
// console.log('评查点审核操作', {
|
||||
// id: reviewPointResultId,
|
||||
// editAuditStatusId: editAuditStatusId,
|
||||
// action: action,
|
||||
// content: message,
|
||||
// status: action === 'approve' ? 'true' : (action === 'reject' ? 'false' : 'review')
|
||||
// });
|
||||
|
||||
// 清除编辑状态
|
||||
setEditingReviewPoint(null);
|
||||
};
|
||||
@@ -2008,10 +1998,11 @@ export function ReviewPointsList({
|
||||
<div className="mb-3">
|
||||
<textarea
|
||||
id={`manual-review-${reviewPoint.id}`}
|
||||
className="w-full p-2 border rounded bg-white text-xs min-h-[80px] focus:outline-none focus:border-primary"
|
||||
placeholder="请输入重新审核意见..."
|
||||
className={`w-full p-2 border rounded text-xs min-h-[80px] focus:outline-none ${reviewPoint.editAuditStatus !== 0 ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'} focus:border-[#00684a] focus:shadow-[0_0_0_2px_rgba(0,104,74,0.2)]`}
|
||||
placeholder="请输入审核意见..."
|
||||
value={manualReviewNotes[reviewPoint.id] || ''}
|
||||
onChange={(e) => handleNoteChange(reviewPoint.id, e.target.value)}
|
||||
disabled={reviewPoint.editAuditStatus !== 0}
|
||||
></textarea>
|
||||
</div>
|
||||
|
||||
@@ -2034,7 +2025,7 @@ export function ReviewPointsList({
|
||||
) : (
|
||||
<button
|
||||
className="bg-purple-600 hover:bg-purple-700 text-sm text-white py-1 px-2 rounded-md flex items-center justify-center"
|
||||
onClick={() => handleReviewAction(reviewPoint.id, reviewPoint.editAuditStatusId, 'review', note)}
|
||||
onClick={() => handleReviewAction(reviewPoint.id, reviewPoint.editAuditStatusId, 'review', '')}
|
||||
>
|
||||
<i className="ri-refresh-line mr-1"></i> 重新审核
|
||||
</button>
|
||||
@@ -2138,9 +2129,10 @@ export function ReviewPointsList({
|
||||
</div>
|
||||
<textarea
|
||||
value={manualReviewNotes[reviewPoint.id] || ''}
|
||||
placeholder={reviewPoint.postAction === 'manual' ? "请输入审核意见(可选)..." : "请输入建议修改内容..."}
|
||||
placeholder={reviewPoint.postAction === 'manual' ? "请输入审核意见..." : "请输入建议修改内容..."}
|
||||
onChange={(e) => handleManualReviewNotesChange(reviewPoint.id, e.target.value)}
|
||||
className="text-xs w-full p-2 border rounded bg-white min-h-[100px] focus:outline-none focus:border-[#00684a] focus:shadow-[0_0_0_2px_rgba(0,104,74,0.2)]"
|
||||
disabled={reviewPoint.editAuditStatus !== 0}
|
||||
className={`text-xs w-full p-2 border rounded ${reviewPoint.editAuditStatus !== 0 ? 'bg-gray-100 cursor-not-allowed' : 'bg-white'} min-h-[100px] focus:outline-none focus:border-[#00684a] focus:shadow-[0_0_0_2px_rgba(0,104,74,0.2)]`}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -2186,8 +2178,8 @@ export function ReviewPointsList({
|
||||
<button
|
||||
className="bg-purple-600 hover:bg-purple-700 text-white py-1 px-2 rounded-md text-sm"
|
||||
onClick={() => {
|
||||
const note = manualReviewNotes[reviewPoint.id] || '';
|
||||
handleReviewAction(reviewPoint.id, reviewPoint.editAuditStatusId, 'review', note);
|
||||
// 重新审核时不传递message
|
||||
handleReviewAction(reviewPoint.id, reviewPoint.editAuditStatusId, 'review', '');
|
||||
}}
|
||||
>
|
||||
<i className="ri-refresh-line mr-1"></i> 重新审核
|
||||
|
||||
Reference in New Issue
Block a user