fix(personal-item): 个人事项&任务添加type类型字段

This commit is contained in:
caozehui
2026-05-21 14:06:05 +08:00
parent fe29fde564
commit 28d597d91e
11 changed files with 151 additions and 15 deletions

View File

@@ -2,6 +2,7 @@
import { computed, nextTick, reactive, ref, watch } from 'vue';
import { useResizeObserver } from '@vueuse/core';
import dayjs from 'dayjs';
import { RDMS_TASK_ITEM_TYPE_DICT_CODE } from '@/constants/dict';
import { fetchCreatePersonalItem, fetchGetPersonalItemDetail, fetchUpdatePersonalItem } from '@/service/api';
import { useAuthStore } from '@/store/modules/auth';
import { useForm, useFormRules } from '@/hooks/common/form';
@@ -9,6 +10,7 @@ import BusinessAttachmentUploader from '@/components/custom/business-attachment-
import BusinessFormDialog from '@/components/custom/business-form-dialog.vue';
import BusinessFormSection from '@/components/custom/business-form-section.vue';
import BusinessRichTextEditor from '@/components/custom/business-rich-text-editor.vue';
import DictSelect from '@/components/custom/dict-select.vue';
import { isEmptyRichText } from './personal-item-shared';
defineOptions({ name: 'PersonalItemOperateDialog' });
@@ -57,6 +59,7 @@ const submitting = ref(false);
interface Model {
taskTitle: string;
type: string;
plannedStartDate: string | null;
plannedEndDate: string | null;
taskDesc: string | null;
@@ -76,6 +79,7 @@ const title = computed(() => {
function createDefaultModel(): Model {
return {
taskTitle: '',
type: '',
plannedStartDate: null,
plannedEndDate: null,
taskDesc: null,
@@ -108,6 +112,7 @@ const rules = computed(
trigger: 'blur'
}
],
type: [createRequiredRule('请选择事项类型')],
plannedStartDate: [createRequiredRule('请选择计划开始日期')],
plannedEndDate: [
createRequiredRule('请选择计划结束日期'),
@@ -136,6 +141,7 @@ async function initModel() {
if (!error && data) {
model.taskTitle = data.taskTitle;
model.type = data.type;
model.plannedStartDate = data.plannedStartDate;
model.plannedEndDate = data.plannedEndDate;
model.taskDesc = data.taskDesc;
@@ -166,6 +172,7 @@ async function handleSubmit() {
const payload: Api.PersonalItem.SavePersonalItemParams = {
taskTitle: model.taskTitle.trim(),
type: model.type,
ownerId: currentUserId.value,
plannedStartDate: model.plannedStartDate,
plannedEndDate: model.plannedEndDate,
@@ -235,6 +242,16 @@ watch(
/>
</ElFormItem>
<ElFormItem label="事项类型" prop="type">
<DictSelect
v-model="model.type"
:dict-code="RDMS_TASK_ITEM_TYPE_DICT_CODE"
:clearable="!isView"
:disabled="isView"
placeholder="请选择事项类型"
/>
</ElFormItem>
<ElFormItem label="计划开始日期" prop="plannedStartDate">
<ElDatePicker
v-model="model.plannedStartDate"