diff --git a/components/TimeLine/TimeLine.vue b/components/TimeLine/TimeLine.vue
new file mode 100644
index 0000000..e09077c
--- /dev/null
+++ b/components/TimeLine/TimeLine.vue
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/TimeLine/component/Barrier.vue b/components/TimeLine/component/Barrier.vue
new file mode 100644
index 0000000..95f5f9b
--- /dev/null
+++ b/components/TimeLine/component/Barrier.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+ 2021年30周
+
+
+
+
+
+
diff --git a/components/TimeLine/component/TaskTools.vue b/components/TimeLine/component/TaskTools.vue
new file mode 100644
index 0000000..32023c6
--- /dev/null
+++ b/components/TimeLine/component/TaskTools.vue
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 新建任务
+
+
+ 克隆任务
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/TimeLine/component/TimeBox.vue b/components/TimeLine/component/TimeBox.vue
new file mode 100644
index 0000000..d1ed8a7
--- /dev/null
+++ b/components/TimeLine/component/TimeBox.vue
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+ {{ $moment(+task.planStart).format(startTimeFormat) }}
+ {{ $moment(+task.planStart).format('D日') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/TimeLine/component/TimeStatus.vue b/components/TimeLine/component/TimeStatus.vue
new file mode 100644
index 0000000..c05fced
--- /dev/null
+++ b/components/TimeLine/component/TimeStatus.vue
@@ -0,0 +1,316 @@
+
+
+
+
+
+
+
+
+
+ {{ data.durationText }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ data.durationText }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/TimeLine/component/Title.vue b/components/TimeLine/component/Title.vue
new file mode 100644
index 0000000..fafec0b
--- /dev/null
+++ b/components/TimeLine/component/Title.vue
@@ -0,0 +1,7 @@
+
diff --git a/hooks/project/useGetTasks.js b/hooks/project/useGetTasks.js
index 81a276d..9435dbd 100644
--- a/hooks/project/useGetTasks.js
+++ b/hooks/project/useGetTasks.js
@@ -1,28 +1,32 @@
-import { computed, nextTick } from 'vue';
+import { ref, computed, nextTick } from 'vue';
import { useStore } from 'vuex';
export default function useGetTasks() {
+ const timeLine = ref(null);
const store = useStore();
+ const tasks = computed(() => store.state.task.tasks);
const showScrollTo = computed(() => store.state.task.showScrollTo);
const roleId = computed(() => store.state.role.roleId);
- const projectId = computed(() => store.getters['project/projectId']);
const timeNode = computed(() => store.state.task.timeNode);
const timeUnit = computed(() => store.state.task.timeUnit);
+ const projectId = computed(() => store.getters['project/projectId']);
+ const timeGranularity = computed(() => store.getters['task/timeGranularity']);
// 初始化 定期任务
async function initPlanTasks() {
- // setPrevPlaceholderTasks(); // 向上加载空数据
- // setNextPlaceholderTasks(); // 向下加载空数据
+ setPrevPlaceholderTasks(); // 向上加载空数据
+ setNextPlaceholderTasks(); // 向下加载空数据
await getInitTasks(); // 获取初始数据
// 滚动到对应位置
- let timer = null;
- timer = setInterval(() => {
- if (showScrollTo.value) {
- clearInterval(timer);
- // nextTick(() => timeLine.setScrollPosition());
- }
- }, 500);
+ // let timer = null;
+ // timer = setInterval(() => {
+ // if (showScrollTo.value) {
+ // clearInterval(timer);
+ // console.log('timeLine',timeLine)
+ // nextTick(() => timeLine.setScrollPosition());
+ // }
+ // }, 500);
}
// 切换了 颗粒度 || 角色时候 获取初始定期任务
@@ -127,6 +131,32 @@ export default function useGetTasks() {
});
}
+ // 设置时间轴向上的空数据
+ function setPrevPlaceholderTasks() {
+ store.commit('task/setTopEnd', true);
+ let startTime = '';
+ if (!tasks.value || !tasks.value.length) {
+ startTime = Date.now(); // 没有任务就应该是时间基准点
+ } else {
+ startTime = tasks[0].planStart - 0; // 有任务就是第一个任务的计划开始时间
+ }
+ const placeholderTasks = uni.$task.setPlaceholderTasks(startTime, true, timeGranularity.value);
+ store.commit('task/setUpTasks', placeholderTasks);
+ }
+
+ // 设置时间轴向下的空数据
+ function setNextPlaceholderTasks() {
+ store.commit('task/setBottomEnd', true);
+ let startTime = '';
+ if (!tasks.value || !tasks.value.length) {
+ startTime = Date.now();
+ } else {
+ startTime = +tasks.value[tasks.value.length - 1].planStart;
+ }
+ const initData = uni.$task.setPlaceholderTasks(startTime, false, timeGranularity.value);
+ store.commit('task/setDownTasks', initData);
+ }
+
return {
initPlanTasks
}
diff --git a/pages/project/project.vue b/pages/project/project.vue
index 20bb7c5..e2b96aa 100644
--- a/pages/project/project.vue
+++ b/pages/project/project.vue
@@ -32,6 +32,29 @@ const projectId = computed(() => store.getters['project/projectId']);
const userId = computed(() => store.getters['user/userId']);
const newProjectInfo = computed(() => store.state.task.newProjectInfo);
+// 获取可变全局任务
+function getGlobalData() {
+ const param = {
+ roleId: roleId.value,
+ timeNode: timeNode.value,
+ timeUnit: timeUnit.value,
+ projectId: projectId.value,
+ };
+ store.dispatch('task/getGlobal', param);
+}
+
+// 清除已有的任务数据
+function clearTasksData() {
+ // 清空日常任务的数据
+ store.commit('task/setPermanents', []);
+ store.commit('task/setDailyTasks', []);
+ // 清空定期任务数据
+ store.commit('task/clearTasks');
+ // 到顶的标志复位
+ // 到底的标志复位
+ store.commit('task/clearEndFlag');
+}
+
/**
* 当时间基准点发生变化时
* 重新根据时间和角色查询普通日常任务
@@ -86,29 +109,6 @@ watch(newProjectInfo, newValue => {
initHook.init(options);
}
});
-
-// 获取可变全局任务
-function getGlobalData() {
- const param = {
- roleId: roleId.value,
- timeNode: timeNode.value,
- timeUnit: timeUnit.value,
- projectId: projectId.value,
- };
- store.dispatch('task/getGlobal', param);
-}
-
-// 清除已有的任务数据
-function clearTasksData() {
- // 清空日常任务的数据
- store.commit('task/setPermanents', []);
- store.commit('task/setDailyTasks', []);
- // 清空定期任务数据
- store.commit('task/clearTasks');
- // 到顶的标志复位
- // 到底的标志复位
- store.commit('task/clearEndFlag');
-}