修改各模块ts接口规范
This commit is contained in:
@ -10,15 +10,16 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, defineProps, watch } from 'vue';
|
||||
import { defineProps, onMounted, ref, watch } from 'vue';
|
||||
import { listProject } from '@/api/project/project';
|
||||
import { listUserProjects, addNewProjectRelevancy, removeNewProjectRelevancy } from '@/api/project/projectRelevancy';
|
||||
import { addNewProjectRelevancy, listUserProjects, removeNewProjectRelevancy } from '@/api/project/projectRelevancy';
|
||||
import { ProjectRelevancyVO } from '@/api/project/projectRelevancy/types';
|
||||
|
||||
// **从父组件接收 `userId`**
|
||||
const props = defineProps<{ userId: number }>();
|
||||
const props = defineProps<{ userId: number | string }>();
|
||||
|
||||
// **所有项目列表**
|
||||
const allProjects = ref<{ key: number; label: string }[]>([]);
|
||||
const allProjects = ref<{ key: number | string; label: string }[]>([]);
|
||||
|
||||
// **已关联的项目 ID 列表**
|
||||
const selectedProjects = ref<number[]>([]);
|
||||
@ -41,9 +42,7 @@ const getUserProjects = async () => {
|
||||
const res = await listUserProjects({ userId: props.userId });
|
||||
|
||||
// 修改这里,使用 res.records 而不是 res.rows
|
||||
selectedProjects.value = Array.isArray(res.data.records)
|
||||
? res.data.records.map((item) => item.projectId)
|
||||
: [];
|
||||
selectedProjects.value = Array.isArray(res.data.records) ? res.data.records.map((item: ProjectRelevancyVO) => item.projectId) : [];
|
||||
|
||||
console.log('已加载用户关联项目:', selectedProjects.value);
|
||||
} catch (error) {
|
||||
@ -64,7 +63,7 @@ watch(
|
||||
);
|
||||
|
||||
// **处理穿梭框变更**
|
||||
const handleTransferChange = async (newValue: number[], direction: 'left' | 'right', movedKeys: number[]) => {
|
||||
const handleTransferChange = async (_: number[], direction: 'left' | 'right', movedKeys: number[]) => {
|
||||
try {
|
||||
if (direction === 'right') {
|
||||
// **添加关联**
|
||||
|
Reference in New Issue
Block a user