|
@ -1,6 +1,6 @@ |
|
|
<template> |
|
|
<template> |
|
|
<div class="navbar flex items-center justify-between"> |
|
|
<div class="navbar flex items-center justify-between"> |
|
|
<div class="project-name">项目名称</div> |
|
|
<div class="project-name">{{ projectObj.obj.pname }}</div> |
|
|
<div class="project-action"> |
|
|
<div class="project-action"> |
|
|
<img /> |
|
|
<img /> |
|
|
<img @click="toShowMask" /> |
|
|
<img @click="toShowMask" /> |
|
@ -8,26 +8,25 @@ |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="role-list flex items-center"> |
|
|
<div class="role-list flex items-center"> |
|
|
<div class="role-box relative"> |
|
|
<div class="role-box relative" v-for="(item, index) in roles.arr" :key="index"> |
|
|
<div class="role-name">角色名称</div> |
|
|
<div class="role-name" :class="{ mine: item.mine === 1 && currRoleId === item.id }">{{ item.name }}</div> |
|
|
<div class="line-box absolute flex justify-center"><div class="line"></div></div> |
|
|
<div class="line-box absolute flex justify-center" v-if="item.mine === 1 && currRoleId === item.id"><div class="line"></div></div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="global"> |
|
|
<div class="global"> |
|
|
<div class="global-box"> |
|
|
<div class="global-box" v-if="permanentObj.permanentList && permanentObj.permanentList.length > 0"> |
|
|
<div class="global-task">任务1</div> |
|
|
<div class="global-task cursor-pointer" v-for="(item, index) in permanentObj.permanentList" :key="index" @click="toDetail(item)"> |
|
|
<div class="global-task">任务1</div> |
|
|
{{ item.name }} |
|
|
<div class="global-task">任务1</div> |
|
|
</div> |
|
|
<div class="global-task">任务1</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="task-list"> |
|
|
<div class="task-list" :style="{ height: 'calc(100vh - 160px - (' + globalHeight + 'px))' }"> |
|
|
<div class="task-box"> |
|
|
<div class="task-box" v-for="(item, index) in taskObj.tasks" :key="index"> |
|
|
<div class="task-time flex items-center justify-between"> |
|
|
<div class="task-time flex items-center justify-between"> |
|
|
<div class="flex items-center"> |
|
|
<div class="flex items-center"> |
|
|
<img /> |
|
|
<img /> |
|
|
<span>10日 09:00</span> |
|
|
<span>{{ dayjs(item.planStart).format('D日 HH:mm') }}</span> |
|
|
</div> |
|
|
</div> |
|
|
<div class="task-action"></div> |
|
|
<div class="task-action"></div> |
|
|
</div> |
|
|
</div> |
|
@ -35,114 +34,150 @@ |
|
|
<div class="task-info"> |
|
|
<div class="task-info"> |
|
|
<div> |
|
|
<div> |
|
|
<div class="task-card"> |
|
|
<div class="task-card"> |
|
|
<div class="task-name">任务名</div> |
|
|
<div class="task-name cursor-pointer" @click="toDetail(item)">{{ item.name }}</div> |
|
|
<div class="task-con"> |
|
|
|
|
|
<div> |
|
|
<div class="task-con" v-if="item.sonList && item.sonList.length > 0"> |
|
|
<a-checkbox><span class="child-project-name">子课题负责人1 穿戴式运动捕获单元</span></a-checkbox> |
|
|
<div v-for="(val, key) in item.sonList" :key="key"> |
|
|
</div> |
|
|
<a-checkbox @change="handleChange">{{ val.name }}</a-checkbox> |
|
|
<div> |
|
|
|
|
|
<a-checkbox><span class="child-project-name">子课题负责人1 穿戴式运动捕获单元</span></a-checkbox> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div> |
|
|
|
|
|
<a-checkbox><span class="child-project-name">子课题负责人1 穿戴式运动捕获单元</span></a-checkbox> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div> |
|
|
|
|
|
<a-checkbox><span class="child-project-name">子课题负责人1 穿戴式运动捕获单元</span></a-checkbox> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div> |
|
|
|
|
|
<a-checkbox><span class="child-project-name">子课题负责人1 穿戴式运动捕获单元</span></a-checkbox> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="open-icon" @click="openCard"> |
|
|
<div class="open-icon" v-if="item.sonList" @click="openCard"> |
|
|
<img /> |
|
|
<img /> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="task-box"> |
|
|
|
|
|
<div class="task-time flex items-center justify-between"> |
|
|
|
|
|
<div class="flex items-center"> |
|
|
|
|
|
<img /> |
|
|
|
|
|
<span>10日 09:00</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="task-action"></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="task-info"> |
|
|
|
|
|
<div> |
|
|
|
|
|
<div class="task-card"> |
|
|
|
|
|
<div class="task-name">任务名</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup> |
|
|
<script setup> |
|
|
import { computed, watch } from 'vue'; |
|
|
import { computed, watch, reactive, ref } from 'vue'; |
|
|
import { useStore } from 'vuex'; |
|
|
import { useStore } from 'vuex'; |
|
|
// import { findShowRole } from 'apis'; |
|
|
import dayjs from 'dayjs'; |
|
|
|
|
|
import { findShowRole, getRegularTask, findSonTask } from 'apis'; |
|
|
|
|
|
|
|
|
const store = useStore(); |
|
|
const store = useStore(); |
|
|
// const project = ref(0) |
|
|
const projectObj = reactive({ obj: { u: '', p: '', pname: '', url: '' } }); |
|
|
const project = computed(() => store.state.projects.project); |
|
|
const project = computed(() => store.state.projects.project); // 项目信息 |
|
|
watch(project, (newVal, oldVal) => { |
|
|
const currRoleId = computed(() => store.state.role.roleId); // 当前角色 |
|
|
console.log(newVal.p, oldVal.p); |
|
|
const roles = reactive({ |
|
|
// clearTasksData(); |
|
|
// 角色信息 |
|
|
// getGlobalData(); // 查可变日常任务 |
|
|
arr: [ |
|
|
// initPlanTasks(); // 处理定期任务 |
|
|
{ id: 1, name: '项目经理', mine: 1, pm: 1, sequence: 1 }, |
|
|
|
|
|
{ id: 2, name: '运维', mine: 0, pm: 0, sequence: 2 }, |
|
|
|
|
|
], |
|
|
}); |
|
|
}); |
|
|
console.log('project', project.value.p); |
|
|
const permanents = computed(() => store.state.role.permanents); // 日常任务 |
|
|
|
|
|
const permanentObj = reactive({ permanentList: [] }); |
|
|
|
|
|
const tasks = computed(() => store.state.role.tasks); // 定期任务 |
|
|
|
|
|
const taskObj = reactive({ tasks: [] }); |
|
|
|
|
|
const globalHeight = ref(0); // 日常任务面板高度 |
|
|
|
|
|
|
|
|
// 设置 初始显示角色信息 |
|
|
// 设置 初始显示角色信息 |
|
|
// const setInitialRoleId = visibleList => { |
|
|
const setInitialRoleId = visibleList => { |
|
|
// if (!visibleList || !visibleList.length) return; |
|
|
if (!visibleList || !visibleList.length) return; |
|
|
// const index = visibleList.findIndex(item => +item.mine === 1); |
|
|
|
|
|
// const currentRole = index > 0 ? visibleList[index] : visibleList[0]; |
|
|
roles.arr = []; |
|
|
// // const storageRoleId = uni.getStorageSync('roleId'); |
|
|
visibleList.forEach(item => { |
|
|
// const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : ''; |
|
|
roles.arr.push(item); |
|
|
// store.commit('role/setRoleId', currentRoleId); |
|
|
}); |
|
|
// // 清空storage |
|
|
|
|
|
// // uni.setStorageSync('roleId', ''); |
|
|
const index = visibleList.findIndex(item => +item.mine === 1); |
|
|
// } |
|
|
const currentRole = index > 0 ? visibleList[index] : visibleList[0]; |
|
|
|
|
|
// const storageRoleId = this.$t.storage.getStorageSync('roleId'); |
|
|
// /** |
|
|
// const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : ''; |
|
|
// * 通过项目id获取角色信息 |
|
|
const currentRoleId = currentRole ? currentRole.id : ''; |
|
|
// * @param {string} projectId |
|
|
currRoleId.value = currentRoleId; |
|
|
// * @param {object} params 提交的参数 |
|
|
store.commit('role/setRoleId', currentRoleId); |
|
|
// */ |
|
|
// 清空storage |
|
|
// const getRoles = async params => { |
|
|
// this.$t.storage.setStorageSync('roleId', ''); |
|
|
// try { |
|
|
}; |
|
|
// let data = await findShowRole(params); |
|
|
|
|
|
// store.commit('role/setInvisibleRoles', data ? data.invisibleList : []); |
|
|
/** |
|
|
// store.commit('role/setVisibleRoles', data ? data.visibleList : []); |
|
|
* 通过项目id获取角色信息 |
|
|
// setInitialRoleId(data ? data.visibleList : []); |
|
|
* @param {string} projectId |
|
|
// } catch (error) { |
|
|
* @param {object} params 提交的参数 |
|
|
// throw new Error(error); |
|
|
*/ |
|
|
// } |
|
|
const getRoles = async projectId => { |
|
|
// } |
|
|
try { |
|
|
|
|
|
const data = await findShowRole(projectId); |
|
|
// // 清除已有的任务数据 |
|
|
store.commit('role/setInvisibleRoles', data ? data.invisibleList : []); |
|
|
// function clearTasksData() { |
|
|
store.commit('role/setVisibleRoles', data ? data.visibleList : []); |
|
|
// // 清空日常任务的数据 |
|
|
setInitialRoleId(data ? data.visibleList : []); |
|
|
// // setPermanents([]); |
|
|
} catch (error) { |
|
|
// // setDailyTasks([]); |
|
|
throw new Error(error); |
|
|
// // // 清空定期任务数据 |
|
|
} |
|
|
// // clearTasks(); |
|
|
}; |
|
|
// // 到顶的标志复位 |
|
|
|
|
|
// // 到底的标志复位 |
|
|
// 日常任务 |
|
|
// // clearEndFlag(); |
|
|
const getPermanentData = async roleId => { |
|
|
// } |
|
|
const params = { param: { roleId } }; |
|
|
|
|
|
try { |
|
|
// // 获取可变全局任务 |
|
|
const data = await store.dispatch('task/getPermanent', params); |
|
|
// function getGlobalData() { |
|
|
permanentObj.permanentList = data; |
|
|
// const { roleId, timeNode, timeUnit, projectId } = this; |
|
|
globalHeight.value = data.length * 38 + 26; |
|
|
// const param = { roleId, timeNode, timeUnit, projectId }; |
|
|
} catch (error) { |
|
|
// store.dispatch('task/getGlobal', param); |
|
|
throw new Error(error); |
|
|
// } |
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 根据id获取子任务 |
|
|
|
|
|
const getSonTask = async detailId => { |
|
|
|
|
|
const params = { param: { detailId } }; |
|
|
|
|
|
try { |
|
|
|
|
|
const data = await findSonTask(params); |
|
|
|
|
|
taskObj.tasks.forEach(item => { |
|
|
|
|
|
if (item.detailId === detailId) { |
|
|
|
|
|
item.sonList = data; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
throw new Error(error); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 根据时间基准点和角色查找定期任务 |
|
|
|
|
|
* @param {object} query |
|
|
|
|
|
* @param {string} query.roleId 角色id |
|
|
|
|
|
* @param {string} query.timeNode 时间基准点 默认当前 |
|
|
|
|
|
* @param {string} query.timeUnit 时间颗粒度 默认天 |
|
|
|
|
|
* @param {string} query.queryNum 查找颗粒度数量 默认3个 |
|
|
|
|
|
* @param {number} query.queryType 0向上查找 1向下查找(默认) 下查包含自己,上查不包含 |
|
|
|
|
|
*/ |
|
|
|
|
|
const getTasks = async query => { |
|
|
|
|
|
const params = { param: query }; |
|
|
|
|
|
try { |
|
|
|
|
|
const data = await getRegularTask(params); |
|
|
|
|
|
taskObj.tasks = data; |
|
|
|
|
|
|
|
|
|
|
|
data.forEach(item => { |
|
|
|
|
|
getSonTask(item.detailId); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
store.commit('task/setUpTasks', data); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
throw new Error(error); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// 监听项目信息 |
|
|
|
|
|
watch(project, async newVal => { |
|
|
|
|
|
projectObj.obj = newVal; |
|
|
|
|
|
store.commit('projects/setProject', newVal); |
|
|
|
|
|
|
|
|
|
|
|
permanentObj.permanentList = permanents.value; |
|
|
|
|
|
taskObj.tasks = tasks.value; |
|
|
|
|
|
|
|
|
|
|
|
await getRoles(projectObj.obj.p); // 通过项目id获取角色信息 |
|
|
|
|
|
await getPermanentData(currRoleId.value); // 根据角色查找永久的日常任务 |
|
|
|
|
|
await getTasks({ roleId: currRoleId.value }); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function toDetail(item) { |
|
|
|
|
|
store.commit('task/setTaskDetail', item); |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style scoped> |
|
|
<style scoped> |
|
@ -164,12 +199,17 @@ console.log('project', project.value.p); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.role-box { |
|
|
.role-box { |
|
|
|
|
|
margin-right: 16px; |
|
|
height: 36px; |
|
|
height: 36px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.role-name { |
|
|
.role-name { |
|
|
font-size: 14px; |
|
|
font-size: 14px; |
|
|
line-height: 36px; |
|
|
line-height: 36px; |
|
|
|
|
|
color: #333333; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.role-name.mine { |
|
|
font-weight: 600; |
|
|
font-weight: 600; |
|
|
color: #1890ff; |
|
|
color: #1890ff; |
|
|
} |
|
|
} |
|
@ -197,10 +237,12 @@ console.log('project', project.value.p); |
|
|
|
|
|
|
|
|
.global-task { |
|
|
.global-task { |
|
|
padding: 8px 0; |
|
|
padding: 8px 0; |
|
|
|
|
|
line-height: 22px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.task-list { |
|
|
.task-list { |
|
|
padding: 0 16px; |
|
|
padding: 0 16px 50px; |
|
|
|
|
|
overflow-y: auto; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.task-box { |
|
|
.task-box { |
|
@ -247,7 +289,11 @@ console.log('project', project.value.p); |
|
|
height: 30px; |
|
|
height: 30px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.child-project-name { |
|
|
::v-deep .ant-checkbox + span { |
|
|
color: #607d8b; |
|
|
color: #607d8b; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar { |
|
|
|
|
|
width: 0 !important; |
|
|
|
|
|
} |
|
|
</style> |
|
|
</style> |
|
|