feat(工作报告、加班申请团队视角): 工作报告、加班申请现在可以查看团队视角了(查看下属)。
fix(工作报告): 修复周报在新增/编辑时,不能展示工作日志。
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
/* eslint-disable vue/no-mutating-props, unicorn/prefer-dom-node-text-content, no-useless-escape, no-nested-ternary */
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||
import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
import { RDMS_REQ_PRIORITY_DICT_CODE, RDMS_TASK_ITEM_TYPE_DICT_CODE } from '@/constants/dict';
|
||||
import { fetchGetMyParticipatedProjectPage } from '@/service/api';
|
||||
@@ -1065,6 +1065,34 @@ function blurEditField(key: string) {
|
||||
if (activeEditField.value === key) activeEditField.value = '';
|
||||
}
|
||||
|
||||
/** 编辑态下是否显示"具体工作内容"的结构化预览(含 ElPopover 工作日志) */
|
||||
function showContentStructuredView(index: number) {
|
||||
const item = reviewItems.value[index];
|
||||
if (!item?.contentSections?.length) return false;
|
||||
if (isReadonly.value) return true;
|
||||
// 编辑/新增模式下,仅在该字段未聚焦时显示结构化预览
|
||||
return activeEditField.value !== `content-${index}`;
|
||||
}
|
||||
|
||||
/** 编辑态下是否显示"具体目标"的结构化预览(含 ElPopover 工作日志) */
|
||||
function showTargetStructuredView(index: number) {
|
||||
const item = nextPlans.value[index];
|
||||
if (!item?.targetSections?.length) return false;
|
||||
if (isReadonly.value) return true;
|
||||
// 编辑/新增模式下,仅在该字段未聚焦时显示结构化预览
|
||||
return activeEditField.value !== `target-${index}`;
|
||||
}
|
||||
|
||||
/** 点击结构化预览区域时切换到编辑态并聚焦 */
|
||||
function handleStructuredViewClick(fieldKey: string) {
|
||||
if (isReadonly.value) return;
|
||||
activeEditField.value = fieldKey;
|
||||
nextTick(() => {
|
||||
const editor = document.querySelector(`[data-field-key="${fieldKey}"]`) as HTMLElement;
|
||||
editor?.focus();
|
||||
});
|
||||
}
|
||||
|
||||
function syncRichContent(item: ReviewItem, event: Event) {
|
||||
const target = event.currentTarget as HTMLElement;
|
||||
if (!item.source) return;
|
||||
@@ -1183,7 +1211,12 @@ function syncRichSupport(item: PlanItem, event: Event) {
|
||||
<div class="review-editor-grid">
|
||||
<div class="field">
|
||||
<label>具体工作内容及成果描述</label>
|
||||
<div v-if="isReadonly && item.contentSections?.length" class="rich-editor">
|
||||
<div
|
||||
v-if="showContentStructuredView(index)"
|
||||
class="rich-editor"
|
||||
:class="{ 'rich-editor--preview': !isReadonly }"
|
||||
@click="handleStructuredViewClick(`content-${index}`)"
|
||||
>
|
||||
<div
|
||||
v-for="(section, sectionIndex) in item.contentSections"
|
||||
:key="`${index}-${sectionIndex}`"
|
||||
@@ -1214,6 +1247,7 @@ function syncRichSupport(item: PlanItem, event: Event) {
|
||||
class="rich-editor"
|
||||
:contenteditable="!isReadonly"
|
||||
spellcheck="false"
|
||||
:data-field-key="`content-${index}`"
|
||||
:data-placeholder="isReadonly ? undefined : '请输入具体工作内容及成果描述'"
|
||||
@focus="focusEditField(`content-${index}`)"
|
||||
@blur="
|
||||
@@ -1282,7 +1316,12 @@ function syncRichSupport(item: PlanItem, event: Event) {
|
||||
<div class="plan-editor-grid">
|
||||
<div class="field">
|
||||
<label>具体目标</label>
|
||||
<div v-if="isReadonly && item.targetSections?.length" class="rich-editor">
|
||||
<div
|
||||
v-if="showTargetStructuredView(index)"
|
||||
class="rich-editor"
|
||||
:class="{ 'rich-editor--preview': !isReadonly }"
|
||||
@click="handleStructuredViewClick(`target-${index}`)"
|
||||
>
|
||||
<div
|
||||
v-for="(section, sectionIndex) in item.targetSections"
|
||||
:key="`${index}-${sectionIndex}`"
|
||||
@@ -1313,6 +1352,7 @@ function syncRichSupport(item: PlanItem, event: Event) {
|
||||
class="rich-editor"
|
||||
:contenteditable="!isReadonly"
|
||||
spellcheck="false"
|
||||
:data-field-key="`target-${index}`"
|
||||
:data-placeholder="isReadonly ? undefined : '请输入具体目标'"
|
||||
@focus="focusEditField(`target-${index}`)"
|
||||
@blur="
|
||||
@@ -2107,6 +2147,15 @@ function syncRichSupport(item: PlanItem, event: Event) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* 编辑态下结构化预览区域:点击可切换到编辑模式 */
|
||||
.rich-editor--preview {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.rich-editor--preview:hover {
|
||||
border-color: #0f766e;
|
||||
}
|
||||
|
||||
.structured-preview__popover {
|
||||
max-width: 100%;
|
||||
color: #334155;
|
||||
|
||||
Reference in New Issue
Block a user