feat(personal-center): 将加班申请功能重构为业务学习功能。
fix(week-report): 修复周报中工作日志的显示问题。 feat(work-report): 点击编辑时,自动刷新出最新的内容。
This commit is contained in:
@@ -388,7 +388,7 @@ async function pullDefaultDraft(confirmOverwrite = false) {
|
||||
}
|
||||
}
|
||||
|
||||
async function refreshDraft() {
|
||||
async function refreshDraft(showSuccess = true) {
|
||||
if (props.mode !== 'edit') {
|
||||
await pullDefaultDraft(true);
|
||||
return;
|
||||
@@ -433,7 +433,9 @@ async function refreshDraft() {
|
||||
applyProjectEditableFields(result.data as Api.WorkReport.Project.ProjectReport);
|
||||
}
|
||||
|
||||
window.$message?.success('最新数据已刷新');
|
||||
if (showSuccess) {
|
||||
window.$message?.success('最新数据已刷新');
|
||||
}
|
||||
}
|
||||
|
||||
async function loadInitData() {
|
||||
@@ -479,6 +481,9 @@ watch(visible, async isVisible => {
|
||||
|
||||
if (props.rowData?.id) {
|
||||
await loadDetail(props.rowData.id);
|
||||
if (props.mode === 'edit') {
|
||||
await refreshDraft(false);
|
||||
}
|
||||
await fillMonthlyPerformanceResult();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ const activeEditField = ref('');
|
||||
const travelDialogVisible = ref(false);
|
||||
const isReadonly = computed(() => props.mode === 'detail' || props.scene === 'approval');
|
||||
const { dictData: priorityDictData, getLabel: getPriorityLabel } = useDict(RDMS_REQ_PRIORITY_DICT_CODE);
|
||||
const { getLabel: getTaskItemTypeLabel } = useDict(RDMS_TASK_ITEM_TYPE_DICT_CODE);
|
||||
const { dictData: taskItemTypeDictData, getLabel: getTaskItemTypeLabel } = useDict(RDMS_TASK_ITEM_TYPE_DICT_CODE);
|
||||
const DEFAULT_SECTION_CATEGORY = '工作内容';
|
||||
const TRAVEL_SECTION_CATEGORY = '差旅';
|
||||
|
||||
@@ -613,6 +613,41 @@ function createStructuredSectionsFromTextV2(
|
||||
const legacyTaskLineRe =
|
||||
/^(?!(?:(?:\d+[..、])|(?:\d+\s+)|(?:[一二三四五六七八九十百千万]+[、..]))\s*)(.+?)\s*[--]\s*(.+)$/u;
|
||||
|
||||
const isKnownSectionCategory = (category: string) => {
|
||||
const normalizedCategory = category.trim();
|
||||
if (!normalizedCategory) return false;
|
||||
if ([DEFAULT_SECTION_CATEGORY, TRAVEL_SECTION_CATEGORY, MY_AFFAIRS_TITLE].includes(normalizedCategory)) return true;
|
||||
return taskItemTypeDictData.value.some(item => item.label === normalizedCategory);
|
||||
};
|
||||
|
||||
const isLegacyStructuredTaskLine = (line: string, strict = false) => {
|
||||
const legacyMatch = line.match(legacyTaskLineRe);
|
||||
if (!legacyMatch) return false;
|
||||
|
||||
const [, rawCategory, rawTaskText] = legacyMatch;
|
||||
const category = rawCategory.trim();
|
||||
const normalizedTaskText = rawTaskText.trim();
|
||||
if (!category || !normalizedTaskText) return false;
|
||||
|
||||
const { rawTitle, metricsText, detail } = extractStructuredTaskParts(normalizedTaskText);
|
||||
const title = stripStructuredTaskSuffix(rawTitle);
|
||||
if (!title) return false;
|
||||
|
||||
const hasTaskStructureHint =
|
||||
Boolean(detail) ||
|
||||
isStructuredMetricsText(metricsText) ||
|
||||
normalizedTaskText.includes('(') ||
|
||||
normalizedTaskText.includes('(') ||
|
||||
normalizedTaskText.includes(':') ||
|
||||
normalizedTaskText.includes(':');
|
||||
|
||||
if (isKnownSectionCategory(category) || hasTaskStructureHint) return true;
|
||||
|
||||
if (strict) return false;
|
||||
|
||||
return category.length <= 12;
|
||||
};
|
||||
|
||||
const isExplicitStructuredTaskLine = (line: string) => {
|
||||
if (!STRUCTURED_TASK_PREFIX_RE.test(line)) return false;
|
||||
const normalizedLine = stripStructuredTaskPrefix(line);
|
||||
@@ -623,7 +658,7 @@ function createStructuredSectionsFromTextV2(
|
||||
const shouldAppendToPreviousTaskDetail = (line: string) => {
|
||||
if (!previousTask?.detail) return false;
|
||||
if (line.startsWith('#')) return false;
|
||||
if (legacyTaskLineRe.test(line)) return false;
|
||||
if (isLegacyStructuredTaskLine(line, true)) return false;
|
||||
if (isExplicitStructuredTaskLine(line)) return false;
|
||||
return true;
|
||||
};
|
||||
@@ -641,7 +676,9 @@ function createStructuredSectionsFromTextV2(
|
||||
|
||||
// 仅当行首不是结构化任务前缀(如 "3、")时,才按旧式 "<分类> - <事项>" 解析;
|
||||
// 否则会把 "2026-06-12 - 2026-06-19" 这种含 " - " 的出差行误判为分类。
|
||||
const legacyMatch = trimmedLine.match(legacyTaskLineRe);
|
||||
const legacyMatch = isLegacyStructuredTaskLine(trimmedLine, Boolean(previousTask?.detail))
|
||||
? trimmedLine.match(legacyTaskLineRe)
|
||||
: null;
|
||||
if (legacyMatch) {
|
||||
const [, rawCategory, rawTaskText] = legacyMatch;
|
||||
const category = rawCategory.trim();
|
||||
|
||||
Reference in New Issue
Block a user