|
|
@@ -33,6 +33,7 @@ const EXCLUDED_AUTO_DATETIME_BASE_TYPE_IDS = new Set(['81', '85', '86', '87'])
|
|
|
const ON_SITE_VISIT_TASK_TYPE_ID = '85'
|
|
|
const ON_SITE_VISIT_TYPE = '现场拜访'
|
|
|
const ON_SITE_VISIT_READONLY_FIELD_ALIASES = new Set(['level', 'visitType'])
|
|
|
+const PRESERVED_MULTIPLE_FORM_FIELD_ALIAS = 'scorePackage'
|
|
|
|
|
|
export const MULTIPLE_SELECT_DRUG_TASK_TYPE_IDS = new Set([
|
|
|
'1',
|
|
|
@@ -415,6 +416,7 @@ export const useTaskForm = () => {
|
|
|
const taskFormConfigMap = new Map<string, RegisteredTaskForm>()
|
|
|
|
|
|
let deriveFrom: TaskContentConfigDeriveFrom | null = null
|
|
|
+ let preservedScorePackageValue: DynamicFormFieldValue | null = null
|
|
|
let loadRequestVersion = 0
|
|
|
|
|
|
const createFormState = (config: TaskFieldConfigViewItem[]): DynamicFormState => {
|
|
|
@@ -442,6 +444,7 @@ export const useTaskForm = () => {
|
|
|
taskTypes.value = []
|
|
|
taskFormConfigMap.clear()
|
|
|
deriveFrom = null
|
|
|
+ preservedScorePackageValue = null
|
|
|
}
|
|
|
|
|
|
const resetTaskForm = (): void => {
|
|
|
@@ -481,14 +484,38 @@ export const useTaskForm = () => {
|
|
|
|
|
|
const { fields: targetConfig, taskTypes: targetTaskTypes } = targetTaskForm
|
|
|
|
|
|
+ if (deriveFrom) {
|
|
|
+ const currentScorePackageField = taskFieldConfigList.value.find(
|
|
|
+ (field) => field.alias?.trim() === PRESERVED_MULTIPLE_FORM_FIELD_ALIAS
|
|
|
+ )
|
|
|
+ const currentScorePackageValue = currentScorePackageField
|
|
|
+ ? form.value.value[currentScorePackageField.id]
|
|
|
+ : undefined
|
|
|
+
|
|
|
+ if (currentScorePackageValue) {
|
|
|
+ preservedScorePackageValue = { ...currentScorePackageValue }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 每次切换都重新创建目标表单状态:
|
|
|
* - 不保留当前表单已经输入的内容
|
|
|
* - 不恢复目标表单上一次输入的内容
|
|
|
+ * - 仅保留 scorePackage 字段已选择的内容
|
|
|
* - datetime 等字段继续使用原有初始化规则
|
|
|
*/
|
|
|
const targetFormState = createFormState(targetConfig)
|
|
|
|
|
|
+ if (deriveFrom && preservedScorePackageValue) {
|
|
|
+ const targetScorePackageField = targetConfig.find(
|
|
|
+ (field) => field.alias?.trim() === PRESERVED_MULTIPLE_FORM_FIELD_ALIAS
|
|
|
+ )
|
|
|
+
|
|
|
+ if (targetScorePackageField) {
|
|
|
+ targetFormState.value[targetScorePackageField.id] = { ...preservedScorePackageValue }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (deriveFrom && derivedFieldValue) {
|
|
|
const derivedFieldName = deriveFrom.field
|
|
|
const targetDerivedField = targetConfig.find(
|