|
|
@@ -5,6 +5,8 @@ import dayjs from 'dayjs'
|
|
|
import { getTaskContentConfigByTaskTypeIdApi } from '@/services/modules/task/taskFrom'
|
|
|
import type { TaskFieldConfigItem, TaskFieldDictMap } from '@/services/modules/task/taskFrom/type'
|
|
|
|
|
|
+import { useUserStore } from '@/stores/modules/user'
|
|
|
+
|
|
|
export type FieldValue = string | number | undefined
|
|
|
|
|
|
/**
|
|
|
@@ -12,6 +14,8 @@ export type FieldValue = string | number | undefined
|
|
|
*/
|
|
|
export const TASK_DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm'
|
|
|
|
|
|
+export const HIDE_FIELD_DEPT_ID = ['1611890693', '1611890565']
|
|
|
+
|
|
|
/**
|
|
|
* 这些 taskTypeId 的 datetime 字段不自动初始化当前时间。
|
|
|
*/
|
|
|
@@ -30,6 +34,7 @@ export interface TaskFieldOption {
|
|
|
|
|
|
export type TaskFieldConfigViewItem = Omit<TaskFieldConfigItem, 'id'> & {
|
|
|
id: string
|
|
|
+ show: boolean
|
|
|
options: TaskFieldOption[] | null
|
|
|
}
|
|
|
|
|
|
@@ -188,6 +193,7 @@ const serializeTaskFieldConfig = (
|
|
|
return config.map((field) => ({
|
|
|
...field,
|
|
|
id: String(field.id),
|
|
|
+ show: true,
|
|
|
options: getFieldDictOptions(field, dict),
|
|
|
}))
|
|
|
}
|
|
|
@@ -204,6 +210,9 @@ const serializeTaskFieldConfig = (
|
|
|
* 由页面的 beforeOpen 自行请求并覆盖 field.options。
|
|
|
*/
|
|
|
export const useTaskForm = () => {
|
|
|
+ const userStore = useUserStore()
|
|
|
+
|
|
|
+ const deptId = userStore.currentUserInfo?.deptId ?? ''
|
|
|
const form = ref<DynamicFormState>(createEmptyFormState())
|
|
|
|
|
|
const taskFieldConfigList = ref<TaskFieldConfigViewItem[]>([])
|
|
|
@@ -218,6 +227,9 @@ export const useTaskForm = () => {
|
|
|
const initialDateTime = dayjs()
|
|
|
|
|
|
for (const field of config) {
|
|
|
+ if (field.taskTypeId === '18' && HIDE_FIELD_DEPT_ID.includes(deptId)) {
|
|
|
+ field.show = false
|
|
|
+ }
|
|
|
formValue[field.id] = createInitialFieldValue(field, initialDateTime)
|
|
|
}
|
|
|
|