|
|
@@ -44,6 +44,9 @@
|
|
|
:disabled="isActionPending"
|
|
|
@derived-change="handleDerivedFieldChange"
|
|
|
@uploading-change="handleFieldUploadingChange"
|
|
|
+ @long-text-keyboard-focus="handleLongTextKeyboardFocus"
|
|
|
+ @long-text-keyboard-blur="handleLongTextKeyboardBlur"
|
|
|
+ @long-text-keyboard-height-change="handleLongTextKeyboardHeightChange"
|
|
|
/>
|
|
|
</template>
|
|
|
</view>
|
|
|
@@ -58,6 +61,7 @@
|
|
|
|
|
|
<view
|
|
|
v-if="!isQuestionnaireTask && taskFieldConfigList.length"
|
|
|
+ v-show="!longTextKeyboardVisible"
|
|
|
class="task-form-footer"
|
|
|
:style="footerStyle"
|
|
|
>
|
|
|
@@ -87,10 +91,14 @@ import { computed, ref } from 'vue'
|
|
|
|
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
|
|
|
|
+import { getDraftTaskContentApi } from '@/services/modules/task/taskFrom'
|
|
|
+import type { DraftTaskContentResponse } from '@/services/modules/task/taskFrom/type'
|
|
|
+
|
|
|
import DuplicateImageDialog from './components/DuplicateImageDialog.vue'
|
|
|
import DynamicTaskFormFields from './components/DynamicTaskFormFields.vue'
|
|
|
import QuestionnaireTask from './components/QuestionnaireTask.vue'
|
|
|
import TaskFormSkeleton from './components/TaskFormSkeleton.vue'
|
|
|
+import { useLongTextKeyboardVisibility } from './composables/useLongTextKeyboardVisibility'
|
|
|
import { useTaskForm } from './composables/useTaskForm'
|
|
|
import { useTaskFormAction } from './composables/useTaskFormAction'
|
|
|
import { useTaskFormPageFeatures } from './composables/useTaskFormPageFeatures'
|
|
|
@@ -112,6 +120,7 @@ const {
|
|
|
activeTaskTypeId,
|
|
|
taskTypes,
|
|
|
loadTaskForm,
|
|
|
+ fillFormFromDraft,
|
|
|
handleDerivedFieldChange,
|
|
|
} = useTaskForm()
|
|
|
|
|
|
@@ -130,6 +139,12 @@ const {
|
|
|
const { showNotice, noticeText, selectLevel, initializeTaskFormPage } = useTaskFormPageFeatures()
|
|
|
|
|
|
const { contentStyle, footerStyle, initSafeArea } = useTaskFormSafeArea()
|
|
|
+const {
|
|
|
+ longTextKeyboardVisible,
|
|
|
+ handleLongTextKeyboardFocus,
|
|
|
+ handleLongTextKeyboardBlur,
|
|
|
+ handleLongTextKeyboardHeightChange,
|
|
|
+} = useLongTextKeyboardVisibility()
|
|
|
|
|
|
const isQuestionnaireTask = computed(() => taskTypeId.value === '801')
|
|
|
const isAttachmentUploading = computed(() => uploadingFieldIds.value.size > 0)
|
|
|
@@ -159,6 +174,18 @@ const decodeRouteParam = (value?: string): string => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const loadDraftTaskContent = async (): Promise<DraftTaskContentResponse | null> => {
|
|
|
+ try {
|
|
|
+ const response = await getDraftTaskContentApi(taskTypeId.value)
|
|
|
+
|
|
|
+ console.log('[task-form] 当前保存的表单内容', response.data)
|
|
|
+ return response.data
|
|
|
+ } catch (error) {
|
|
|
+ console.error('[task-form] 获取当前保存的表单内容失败', error)
|
|
|
+ return null
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
const loadDynamicTaskForm = async (pageInitialization?: Promise<void>): Promise<void> => {
|
|
|
if (!taskTypeId.value || formLoading.value) return
|
|
|
|
|
|
@@ -167,7 +194,17 @@ const loadDynamicTaskForm = async (pageInitialization?: Promise<void>): Promise<
|
|
|
uploadingFieldIds.value = new Set()
|
|
|
|
|
|
try {
|
|
|
- await Promise.all([pageInitialization ?? Promise.resolve(), loadTaskForm(taskTypeId.value)])
|
|
|
+ const [, , draftTaskContent] = await Promise.all([
|
|
|
+ pageInitialization ?? Promise.resolve(),
|
|
|
+ loadTaskForm(taskTypeId.value),
|
|
|
+ loadDraftTaskContent(),
|
|
|
+ ])
|
|
|
+
|
|
|
+ if (draftTaskContent) {
|
|
|
+ const filledFieldCount = fillFormFromDraft(draftTaskContent)
|
|
|
+
|
|
|
+ console.log(`[task-form] 已回填 ${filledFieldCount} 个草稿字段`)
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.error('[task-form] 表单配置加载失败', error)
|
|
|
formErrorMessage.value = '表单加载失败,请稍后重试'
|