You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
54 lines
1.1 KiB
<template>
|
|
<!-- 子项目插件 -->
|
|
<view>
|
|
<view v-for="item in data.sonProject" :key="item.detailId">
|
|
<span class="text-xs text-blue-500" @click="openProject(item)">{{ item.name }}</span>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { onMounted } from 'vue';
|
|
import Config from '@/common/js/config.js';
|
|
|
|
const props = defineProps({
|
|
task: {
|
|
type: Object,
|
|
default: () => {},
|
|
},
|
|
});
|
|
|
|
const data = reactive({ sonProject: [] });
|
|
|
|
onMounted(() => {
|
|
getSonProject();
|
|
});
|
|
|
|
async function getSonProject() {
|
|
try {
|
|
const data = await uni.$u.api.findSonProject({ projectId: props.task.detailId });
|
|
data.sonProject = data;
|
|
} catch (error) {
|
|
console.error('p-subproject.vue getSonProject error: ', error);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 打开项目
|
|
* @param {object} project 所点击的项目的信息
|
|
*/
|
|
function openProject(project) {
|
|
const { name, id, url } = project;
|
|
const { apiUrl } = Config;
|
|
const defaultwbs = `${apiUrl}/defaultwbs`;
|
|
url && (defaultwbs = url);
|
|
uni.$u.route('pages/project/project', {
|
|
u: userId.value,
|
|
p: id,
|
|
pname: name,
|
|
url: encodeURIComponent(url),
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|
|
|