Browse Source

Merge remote-tracking branch 'origin/lucky' into song

tall
song 4 years ago
parent
commit
037adb2575
  1. 10
      CHANGELOG.md
  2. 4
      src/apis/plugin.js
  3. 4
      src/components/Plugin/Plugin.vue
  4. 11
      src/components/Roles/Roles.vue
  5. 145
      src/components/TimeLine/TimeLine.vue
  6. 10
      src/components/TimeLine/component/TimeBox.vue
  7. 28
      src/components/TimeLine/component/TimeStatus.vue
  8. 44
      src/mixins/timeline.js
  9. 160
      src/pages/project/project.vue
  10. 50
      src/plugins/p-subproject/p-subproject.vue
  11. 32
      src/plugins/p-subtasks/p-subtasks.vue
  12. 3
      src/plugins/p-wbs-import/p-wbs-import.vue
  13. 11
      src/store/task/actions.js
  14. 158
      src/store/task/mutations.js
  15. 2
      src/store/task/state.js
  16. 12
      src/utils/time.js

10
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-08-19) # 0.1.0 (2021-08-18)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -82,6 +82,7 @@
### 🐛 Bug 修复 ### 🐛 Bug 修复
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | 1.时间轴数据渲染 2.时间基准线 | [d643af2](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/d643af2)
ID1000343 | 解决向下预加载查询参数时间没+1颗粒度;以及滚动加载颗粒度写死的问题 | [940603a](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/940603a), closes [#ID1000343](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/issues/ID1000343) ID1000343 | 解决向下预加载查询参数时间没+1颗粒度;以及滚动加载颗粒度写死的问题 | [940603a](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/940603a), closes [#ID1000343](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/issues/ID1000343)
plugin | 插件解析机制完善 | [0f5a27d](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/0f5a27d) plugin | 插件解析机制完善 | [0f5a27d](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/0f5a27d)
project title | 项目标题修改; 切换角色移除script | [5c20017](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/5c20017) project title | 项目标题修改; 切换角色移除script | [5c20017](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/5c20017)
@ -94,12 +95,14 @@
- | 下拉加载定期任务传参,时间格式化修改 | [0b95a0e](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/0b95a0e) - | 下拉加载定期任务传参,时间格式化修改 | [0b95a0e](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/0b95a0e)
- | 任务开始时间延迟插件 | [992a313](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/992a313) - | 任务开始时间延迟插件 | [992a313](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/992a313)
- | 修改main | [749ae9a](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/749ae9a) - | 修改main | [749ae9a](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/749ae9a)
- | 修改定期任务状态0和4时不加载圆圈 | [30e352f](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/30e352f)
- | 修改小红点传参 | [87b20fd](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/87b20fd) - | 修改小红点传参 | [87b20fd](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/87b20fd)
- | 修改报错 | [531c14d](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/531c14d) - | 修改报错 | [531c14d](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/531c14d)
- | 修改接口路径 | [df6acf2](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/df6acf2) - | 修改接口路径 | [df6acf2](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/df6acf2)
- | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/a54c601) - | 修改角色栏组件 | [a54c601](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/a54c601)
- | 切换到默认项目角色没有激活状态的bug | [438d448](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/438d448) - | 切换到默认项目角色没有激活状态的bug | [438d448](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/438d448)
- | 切换日历时查询小红点 | [7091789](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7091789) - | 切换日历时查询小红点 | [7091789](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7091789)
- | 初始展示角色修改 | [2ac4053](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/2ac4053)
- | 定期任务key值修改 | [c6688db](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/c6688db) - | 定期任务key值修改 | [c6688db](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/c6688db)
- | 定期任务接口 | [aa4981c](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/aa4981c) - | 定期任务接口 | [aa4981c](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/aa4981c)
- | 定期任务插件 | [92b3254](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/92b3254) - | 定期任务插件 | [92b3254](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/92b3254)
@ -118,11 +121,13 @@
- | 时间轴上下滚动数据加载bug修改 | [e82ede4](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/e82ede4) - | 时间轴上下滚动数据加载bug修改 | [e82ede4](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/e82ede4)
- | 时间轴插件 | [225d3cc](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/225d3cc) - | 时间轴插件 | [225d3cc](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/225d3cc)
- | 时间轴无任务时时间刻度加载修改 | [4921672](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/4921672) - | 时间轴无任务时时间刻度加载修改 | [4921672](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/4921672)
- | 时间轴滚动位置修改 | [551da63](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/551da63)
- | 时间轴骨架屏修改 | [ca78d02](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/ca78d02) - | 时间轴骨架屏修改 | [ca78d02](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/ca78d02)
- | 监听时间基本点 | [033fca0](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/033fca0) - | 监听时间基本点 | [033fca0](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/033fca0)
- | 角色显示状态修改 | [7d3b906](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7d3b906) - | 角色显示状态修改 | [7d3b906](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7d3b906)
- | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/19228d6) - | 角色栏修改 | [19228d6](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/19228d6)
- | 解决时间轴报错 | [da1eece](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/da1eece) - | 解决时间轴报错 | [da1eece](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/da1eece)
- | 设置时间轴自动滚动到当前位置 | [a3474f8](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/a3474f8)
- | 跳转详情页返回路径修改 | [c5e17c0](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/c5e17c0) - | 跳转详情页返回路径修改 | [c5e17c0](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/c5e17c0)
- | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/e9fdd71) - | 骨架屏替换 | [e9fdd71](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/e9fdd71)
@ -163,6 +168,8 @@
### 🚀 性能优化 ### 🚀 性能优化
范围|描述|commitId 范围|描述|commitId
--|--|-- --|--|--
- | 1.时间轴筛选相同的时间替换数据 2.整理代码 | [e082ccb](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/e082ccb)
- | 修改代码格式 | [14123d7](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/14123d7)
- | 修改定期任务骨架屏高度 | [909a734](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/909a734) - | 修改定期任务骨架屏高度 | [909a734](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/909a734)
- | 插件查询及展示 | [4dba770](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/4dba770) - | 插件查询及展示 | [4dba770](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/4dba770)
- | 整理代码 | [7a55315](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7a55315) - | 整理代码 | [7a55315](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/7a55315)
@ -197,4 +204,3 @@
- | style:index | [978f272](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/978f272) - | style:index | [978f272](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/978f272)
- | !2 基础模板v1.1.0 | [f5e61dd](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/f5e61dd) - | !2 基础模板v1.1.0 | [f5e61dd](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/f5e61dd)
- | init | [c0f1deb](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/c0f1deb) - | init | [c0f1deb](https://dd.tall.wiki/gitea/ccsens_fe/TALL-MUI-3/commits/c0f1deb)

4
src/apis/plugin.js

@ -5,6 +5,10 @@ const install = (Vue, vm) => {
vm.$u.api = { ...vm.$u.api } || {}; vm.$u.api = { ...vm.$u.api } || {};
// 获取插件信息 // 获取插件信息
vm.$u.api.getOtherPlugin = param => vm.$u.post(`${url}/pluginshop/plugin/query`, param); vm.$u.api.getOtherPlugin = param => vm.$u.post(`${url}/pluginshop/plugin/query`, param);
// 查询子任务
vm.$u.api.findSonTask = param => vm.$u.post(`${uni.$t.domain}/task/findSonTask`, param);
// 查询子项目
vm.$u.api.findSonProject = param => vm.$u.post(`${uni.$t.domain}/project/findSonProject`, param);
}; };
export default { install }; export default { install };

4
src/components/Plugin/Plugin.vue

@ -27,8 +27,8 @@
<p-task-duration-delay :task="task" v-if="pluginId === '3'" /> <p-task-duration-delay :task="task" v-if="pluginId === '3'" />
<p-task-start-time-delay :task="task" v-if="pluginId === '4'" /> <p-task-start-time-delay :task="task" v-if="pluginId === '4'" />
<!-- <p-deliverable :task="task" v-if="pluginId === '5'" /> --> <!-- <p-deliverable :task="task" v-if="pluginId === '5'" /> -->
<!-- <p-subtasks :task="task" v-if="pluginId === '6'" /> --> <p-subtasks :task="task" v-if="pluginId === '6'" />
<!-- <p-subproject :task="task" v-if="pluginId === '7'" /> --> <p-subproject :task="task" v-if="pluginId === '7'" />
<!-- <p-task-countdown :task="task" v-if="pluginId === '8'" /> --> <!-- <p-task-countdown :task="task" v-if="pluginId === '8'" /> -->
<p-manage-project :task="task" v-if="pluginId === '9'" /> <p-manage-project :task="task" v-if="pluginId === '9'" />
<p-manage-role :task="task" v-if="pluginId === '10'" /> <p-manage-role :task="task" v-if="pluginId === '10'" />

11
src/components/Roles/Roles.vue

@ -58,10 +58,11 @@ export default {
methods: { methods: {
...mapActions('task', ['handleRegularTask', 'getPermanent']), ...mapActions('task', ['handleRegularTask', 'getPermanent']),
...mapMutations('role', ['setRoleId']), ...mapMutations('role', ['setRoleId']),
...mapMutations('task', ['setPermanents', 'setDailyTasks', 'clearEndFlag', 'setTimeNode']), ...mapMutations('task', ['setPermanents', 'clearEndFlag']),
// //
setCurrentRole(index) { setCurrentRole(index) {
console.log('index: ', index);
const data = document.getElementsByClassName('tab-children'); const data = document.getElementsByClassName('tab-children');
// tabList // tabList
data.forEach(item => { data.forEach(item => {
@ -85,20 +86,12 @@ export default {
// projectroleId // projectroleId
changeRole(id, index) { changeRole(id, index) {
try { try {
console.log('切换角色');
// script // script
this.clearPluginScript(); this.clearPluginScript();
this.$nextTick(() => { this.$nextTick(() => {
this.setRoleId(id); this.setRoleId(id);
//index //index
this.setCurrentRole(index); this.setCurrentRole(index);
//
this.setPermanents([]);
this.setDailyTasks([]);
//
//
//
this.clearEndFlag();
}); });
} catch (error) { } catch (error) {
console.error('role.vue changeRole error: ', error); console.error('role.vue changeRole error: ', error);

145
src/components/TimeLine/TimeLine.vue

@ -4,9 +4,9 @@
<scroll-view <scroll-view
:lower-threshold="300" :lower-threshold="300"
:scrollTop="top" scroll-y="true"
:scrollY="true"
:upper-threshold="300" :upper-threshold="300"
:scroll-into-view="viewId"
@scroll="scroll" @scroll="scroll"
@scrolltolower="handleScrollBottom" @scrolltolower="handleScrollBottom"
@scrolltoupper="handleScrollTop" @scrolltoupper="handleScrollTop"
@ -23,10 +23,12 @@
// import Barrier from './component/Barrier.vue'; // import Barrier from './component/Barrier.vue';
import { mapState, mapMutations, mapGetters } from 'vuex'; import { mapState, mapMutations, mapGetters } from 'vuex';
import TimeBox from './component/TimeBox.vue'; import TimeBox from './component/TimeBox.vue';
import mixin from '@/mixins/timeline';
export default { export default {
name: 'TimeLine', name: 'TimeLine',
components: { TimeBox }, components: { TimeBox },
mixins: [mixin],
data() { data() {
return { top: 0 }; return { top: 0 };
@ -34,16 +36,12 @@ export default {
computed: { computed: {
...mapState('role', ['visibleRoles']), ...mapState('role', ['visibleRoles']),
...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd', 'showSkeleton', 'randomId']), ...mapState('task', ['scrollTop', 'showTips', 'tasks', 'topEnd', 'bottomEnd', 'showSkeleton', 'timeNode', 'viewId']),
...mapGetters('task', ['timeGranularity']), ...mapGetters('task', ['timeGranularity']),
}, },
mounted() {
this.setDatumPoint();
},
methods: { methods: {
...mapMutations('task', ['setScrollTop', 'setShrink', 'setUpTasks', 'setDownTasks']), ...mapMutations('task', ['setScrollTop', 'setShrink', 'setUpTasks', 'setDownTasks', 'setViewId']),
// //
scroll(e) { scroll(e) {
@ -58,52 +56,8 @@ export default {
const startTime = this.tasks[0].planStart - 0; const startTime = this.tasks[0].planStart - 0;
if ((this.tasks[0].plugins && this.tasks[0].plugins.length === 0) || this.topEnd) { if ((this.tasks[0].plugins && this.tasks[0].plugins.length === 0) || this.topEnd) {
// //
// console.warn(': '); console.warn('滚动到顶部没有数据时: ');
const addTasks = [ const addTasks = this.setTime(startTime, true);
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, -6, 'day').valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, -5, 'day').valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, -4, 'day').valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, -3, 'day').valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, -2, 'day').valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, -1, 'day').valueOf(),
},
];
this.setUpTasks(addTasks); this.setUpTasks(addTasks);
} else { } else {
// //
@ -124,54 +78,12 @@ export default {
const startTime = tasks[tasks.length - 1].planStart - 0; const startTime = tasks[tasks.length - 1].planStart - 0;
if ((tasks[0].plugins && tasks[0].plugins.length === 0) || this.bottomEnd) { if ((tasks[0].plugins && tasks[0].plugins.length === 0) || this.bottomEnd) {
// //
// console.warn(': '); console.warn('滚动到底部没有数据时: ');
const addTasks = [ const addTasks = this.setTime(startTime, false);
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, 1, timeGranularity).valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, 2, timeGranularity).valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, 3, timeGranularity).valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, 4, timeGranularity).valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, 5, timeGranularity).valueOf(),
},
{
id: this.randomId,
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, 6, timeGranularity).valueOf(),
},
];
this.setDownTasks(addTasks); this.setDownTasks(addTasks);
} else { } else {
// =+ // =+
console.warn('滚动到底部有数据时: ');
const timeNode = this.$t.time.add(startTime, 1, timeGranularity).valueOf(); const timeNode = this.$t.time.add(startTime, 1, timeGranularity).valueOf();
const downQuery = { const downQuery = {
timeNode, timeNode,
@ -182,25 +94,24 @@ export default {
} }
}, },
// //
setDatumPoint() { setScrollPosition() {
const { tasks } = this; const { tasks, timeNode } = this;
if (tasks && tasks.length) { for (let i = 0; i < tasks.length; i++) {
let tasksHeight = 0; const item = tasks[i];
const scrollHeight = document.getElementById('scroll').clientHeight; const show = this.$t.time.isSame(+item.planStart, +timeNode, this.timeGranularity);
let width = document.documentElement.clientWidth; // storagetimeNode,storetimeNode
for (let i = 0; i < 3; i++) { const taskId = this.$t.storage.getStorageSync('taskId');
if (tasks[i].panel && tasks[i].panel.height) { // storage
// + 42 if (taskId) {
tasksHeight += +tasks[i].panel.height + 42; this.setViewId(`a${taskId}`);
} else { this.$t.storage.setStorageSync('taskId', '');
// rem + 42 return;
// u-card h-16 = 4rem }
// += 1rem + 42 = width / 20 + 42 if (show) {
tasksHeight += (width / 20) * 4 + 42; this.setViewId(`a${item.id}`);
} return;
} }
this.top = tasksHeight - scrollHeight / 2;
} }
}, },
}, },

10
src/components/TimeLine/component/TimeBox.vue

@ -2,12 +2,13 @@
<view class="column"> <view class="column">
<!-- v-if="tasks && tasks.length" --> <!-- v-if="tasks && tasks.length" -->
<view> <view>
<view :key="task.id" v-for="task in tasks"> <view :key="task.id" v-for="task in tasks" class="ssssss" :id="`a${task.id}`">
<view class="flex"> <view class="flex">
<TimeStatus :task="task" /> <TimeStatus :task="task" />
<view class="flex items-center justify-between flex-1 ml-2 task-column"> <view class="flex items-center justify-between flex-1 ml-2 task-column">
<view v-if="task.process !== 4">{{ $moment(+task.planStart).format(startTimeFormat) }}</view> <view v-if="task.process !== 4">{{ $moment(+task.planStart).format(startTimeFormat) }}</view>
<view v-else>{{ $moment(+task.planStart).format('D日') }}</view> <view v-else>{{ $moment(+task.planStart).format('D日') }}</view>
<!-- 任务功能菜单 --> <!-- 任务功能菜单 -->
<TaskTools v-if="task.process !== 4" /> <TaskTools v-if="task.process !== 4" />
</view> </view>
@ -37,7 +38,7 @@
class="h-16" class="h-16"
margin="0" margin="0"
v-if="tasks && tasks.length && task.process !== 4 && !showSkeleton" v-if="tasks && tasks.length && task.process !== 4 && !showSkeleton"
@click="onClickTask(+task.planStart)" @click="onClickTask(+task.planStart, task.id)"
> >
<!-- 任务面板插件 --> <!-- 任务面板插件 -->
<view slot="body"> <view slot="body">
@ -104,11 +105,12 @@ export default {
/** /**
* 点击了定期任务的面板 更新可变的日常任务 * 点击了定期任务的面板 更新可变的日常任务
* @param {number} planStart 任务计划开始时间 * @param {number} planStart 任务计划开始时间
* @param {string} taskId 任务id
*/ */
onClickTask(planStart) { onClickTask(planStart, taskId) {
const param = { roleId: this.roleId, timeNode: planStart, timeUnit: this.timeUnit }; const param = { roleId: this.roleId, timeNode: planStart, timeUnit: this.timeUnit };
this.getGlobal(param); this.getGlobal(param);
this.$t.storage.setStorageSync('timeNode', planStart); this.$t.storage.setStorageSync('taskId', taskId);
this.$t.storage.setStorageSync('roleId', this.roleId); this.$t.storage.setStorageSync('roleId', this.roleId);
}, },

28
src/components/TimeLine/component/TimeStatus.vue

@ -5,13 +5,25 @@
:style="{ color: orderStyle.color }" :style="{ color: orderStyle.color }"
@tap="changeStatus($event, task.process)" @tap="changeStatus($event, task.process)"
> >
<!-- 1进行中 2暂停中 3已完成 -->
<u-circle-progress <u-circle-progress
:percent="+orderStyle.persent" :percent="+orderStyle.persent"
:active-color="orderStyle.color" :active-color="orderStyle.color"
bg-color="rgba(255,255,255,0)" bg-color="rgba(255,255,255,0)"
border-width="4" border-width="4"
:width="task.process !== 4 ? 66 : 50" :width="task.process !== 4 ? 66 : 50"
v-if="task.process === 1 || task.process === 2 || task.process === 3"
> >
<view class="u-progress-content">
<view class="u-progress-dot"></view>
<view class="u-progress-info">
<u-icon :name="orderStyle.icon" v-if="orderStyle.icon" size="15px"></u-icon>
<template v-else>{{ computeDurationText() }}</template>
</view>
</view>
</u-circle-progress>
<!-- 0未开始 4添加任务 -->
<view class="progress-box flex justify-center items-center rounded-full" v-else :class="task.process === 4 ? 'progress-box-4' : ''">
<view class="u-progress-content"> <view class="u-progress-content">
<view class="u-progress-dot"></view> <view class="u-progress-dot"></view>
<view class="u-progress-info"> <view class="u-progress-info">
@ -22,7 +34,7 @@
<template v-else>{{ computeDurationText() }}</template> <template v-else>{{ computeDurationText() }}</template>
</view> </view>
</view> </view>
</u-circle-progress> </view>
</view> </view>
</view> </view>
</template> </template>
@ -106,7 +118,6 @@ export default {
* @param {object} event * @param {object} event
*/ */
changeStatus(event, process) { changeStatus(event, process) {
console.log('event, process: ', event, process);
if (process === 4) { if (process === 4) {
this.addTask(); this.addTask();
return; return;
@ -184,4 +195,17 @@ export default {
height: 33px; height: 33px;
width: 33px; width: 33px;
} }
.progress-box {
background: rgba(255, 255, 255, 0);
width: 33px;
height: 33px;
border: 2px solid #9ca3af;
}
.progress-box-4 {
width: 25px;
height: 25px;
border: 2px solid #60a5fa;
}
</style> </style>

44
src/mixins/timeline.js

@ -0,0 +1,44 @@
import { mapGetters } from 'vuex';
const mixin = {
computed: mapGetters('task', ['timeGranularity']),
methods: {
/**
* 设置时间轴空数据
* @param {*} startTime
* @param {*} show true 向上加载,false 向下加载
*/
setTime(startTime, show) {
let { timeGranularity } = this;
let arr = [];
let str = {};
if (show) {
for (let i = 10; i > 0; i--) {
str = {
id: this.$u.guid(20, false, 10),
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, `-${i}` - 0, timeGranularity).valueOf(),
};
arr.push(str);
}
} else {
for (let i = 0; i < 10; i++) {
str = {
id: this.$u.guid(20, false, 10),
panel: {},
plugins: [],
process: 4,
planStart: this.$t.time.add(startTime, i + 1, timeGranularity).valueOf(),
};
arr.push(str);
}
}
return arr;
},
},
};
export default mixin;

160
src/pages/project/project.vue

@ -18,8 +18,10 @@
<script> <script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'; import { mapState, mapGetters, mapMutations, mapActions } from 'vuex';
import mixin from '@/mixins/timeline';
export default { export default {
mixins: [mixin],
data() { data() {
return { height: '' }; return { height: '' };
}, },
@ -41,12 +43,10 @@ export default {
* 重新根据时间和角色查询普通日常任务 * 重新根据时间和角色查询普通日常任务
* 永久日常任务不发生改变 * 永久日常任务不发生改变
*/ */
timeNode(val) { async timeNode(val) {
console.log('val: ', val);
if (val && this.roleId) { if (val && this.roleId) {
// //
this.getGlobalData(); await this.initTasks();
this.getInitTasks();
} }
}, },
@ -58,13 +58,7 @@ export default {
*/ */
roleId(val) { roleId(val) {
if (val) { if (val) {
// storagetimeNode,storetimeNode this.setTimeNode(Date.now());
this.setTimeNode(
+this.$t.storage.getStorageSync('timeNode') !== 0 ? +this.$t.storage.getStorageSync('timeNode') !== 0 : Date.now(),
);
// storage
this.$t.storage.setStorageSync('timeNode', '');
console.log('当角色发生变化时: ', this.timeNode);
// //
this.getPermanent(val); this.getPermanent(val);
} }
@ -77,6 +71,7 @@ export default {
onUnload() { onUnload() {
this.clearEndFlag(); this.clearEndFlag();
this.clearTasks();
}, },
methods: { methods: {
@ -87,7 +82,18 @@ export default {
...mapMutations('user', ['setToken']), ...mapMutations('user', ['setToken']),
...mapMutations('project', ['setProject', 'setProjectName']), ...mapMutations('project', ['setProject', 'setProjectName']),
...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']), ...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']),
...mapMutations('task', ['setUpTasks', 'setDownTasks', 'setDailyTasks', 'setTimeNode', 'clearEndFlag', 'setShowSkeleton']), ...mapMutations('task', [
'setPermanents',
'setUpTasks',
'setDownTasks',
'setDailyTasks',
'setTimeNode',
'clearTasks',
'clearEndFlag',
'setShowSkeleton',
'setTopEnd',
'setBottomEnd',
]),
/** /**
* 初始化 * 初始化
@ -113,11 +119,6 @@ export default {
// id // id
this.$t.ui.showToast('缺少项目信息参数'); this.$t.ui.showToast('缺少项目信息参数');
} else { } else {
// storagetimeNode,storetimeNode
this.setTimeNode(this.$t.storage.getStorageSync('timeNode') - 0);
// storage
this.$t.storage.setStorageSync('timeNode', '');
console.log('timeNode: ', this.$t.storage.getStorageSync('timeNode'), this.timeNode);
// id // id
await this.getProjectById({ projectId: options.p }); await this.getProjectById({ projectId: options.p });
// id // id
@ -129,6 +130,38 @@ export default {
} }
}, },
//
async initTasks() {
//
this.setPermanents([]);
this.setDailyTasks([]);
//
this.clearTasks();
//
//
this.clearEndFlag();
//
this.getGlobalData();
//
this.setPrevTasks();
// storage
const storageTaskId = this.$t.storage.getStorageSync('taskId');
this.$nextTick(() => {
if (!storageTaskId) {
this.$refs.child.setScrollPosition();
}
});
//
this.setNextTasks();
await this.getInitTasks();
// storage
this.$nextTick(() => {
if (storageTaskId) {
this.$refs.child.setScrollPosition();
}
});
},
// || // ||
async getInitTasks() { async getInitTasks() {
// //
@ -136,26 +169,27 @@ export default {
await this.getTasks({ queryType: 1 }); await this.getTasks({ queryType: 1 });
// //
if (this.tasks && this.tasks.length && this.tasks[0].detailId) { const detailId = this.tasks.findIndex(task => task.detailId);
this.$nextTick(() => { if (detailId !== -1) {
this.$nextTick(async () => {
const { tasks, timeGranularity } = this; const { tasks, timeGranularity } = this;
this.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: 6 }); // await this.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: 6 }); //
// //
const nextQueryTime = +this.$t.time.add(+tasks[tasks.length - 1].planStart, 1, timeGranularity); const nextQueryTime = +this.$t.time.add(+tasks[tasks.length - 1].planStart, 1, timeGranularity);
this.getTasks({ timeNode: nextQueryTime, queryType: 1, queryNum: 6 }); // await this.getTasks({ timeNode: nextQueryTime, queryType: 1, queryNum: 6 }); //
}); });
} else { } else {
// //
// //
this.setUpTasks(); this.setPrevTasks();
// //
this.setDownTasks(); this.setNextTasks();
} }
}, },
// //
setInitialRoleId(visibleList) { setInitialRoleId(visibleList) {
const index = visibleList.findIndex(item => item.mine === '1'); const index = visibleList.findIndex(item => +item.mine === 1);
const currentRole = index > 0 ? visibleList[index] : visibleList[0]; const currentRole = index > 0 ? visibleList[index] : visibleList[0];
const storageRoleId = this.$t.storage.getStorageSync('roleId'); const storageRoleId = this.$t.storage.getStorageSync('roleId');
const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : ''; const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : '';
@ -184,9 +218,14 @@ export default {
queryNum: query.queryNum || 3, queryNum: query.queryNum || 3,
queryType: query.queryType, queryType: query.queryType,
}; };
console.log('params: ', params); const res = await this.getRegulars(params);
await this.getRegulars(params);
this.setShowSkeleton(false); this.setShowSkeleton(false);
// 0 -> 1 ->
if (res && res.length) {
this.replacePrevData(res, params.queryType);
} else {
params.queryType === 0 ? this.setPrevTasks() : this.setNextTasks();
}
} catch (error) { } catch (error) {
this.setShowSkeleton(false); this.setShowSkeleton(false);
console.error('error: ', error); console.error('error: ', error);
@ -199,6 +238,75 @@ export default {
const param = { roleId, timeNode, timeUnit }; const param = { roleId, timeNode, timeUnit };
this.getGlobal(param); this.getGlobal(param);
}, },
//
setPrevTasks() {
this.setTopEnd(true);
let sTime = '';
if (!this.tasks || !this.tasks.length) {
sTime = +new Date().getTime();
} else {
sTime = +this.tasks[0].planStart - 0;
}
const initData = this.setTime(sTime, true);
this.setUpTasks(initData);
},
//
setNextTasks() {
this.setBottomEnd(true);
let sTime = '';
if (!this.tasks || !this.tasks.length) {
sTime = +new Date().getTime();
} else {
sTime = +this.tasks[this.tasks.length - 1].planStart - 0;
}
const initData = this.setTime(sTime, false);
this.setDownTasks(initData);
},
//
replacePrevData(data, type) {
let newTasks = [...this.tasks];
for (let i = 0; i < newTasks.length; i++) {
const task = newTasks[i];
let arr = [];
for (let j = 0; j < data.length; j++) {
const item = data[j];
//
if (+newTasks[0].planStart > +data[0].planStart) {
this.setPrevTasks();
newTasks = [...this.tasks];
i--;
break;
} else if (+data[data.length - 1].planStart > +newTasks[newTasks.length - 1].planStart) {
this.setNextTasks();
newTasks = [...this.tasks];
i--;
break;
} else {
//
const taskItem = this.$t.time.isSame(+task.planStart, +item.planStart, this.timeGranularity);
if (taskItem) {
arr.push(item);
if (task.detailId) {
newTasks.splice(i, 0, item);
} else {
if (arr.length === 1) {
newTasks.splice(i, 1, item);
}
if (arr.length > 1) {
newTasks.splice(i, 0, item);
}
}
i++;
}
}
}
}
this.clearTasks();
type === 0 ? this.setUpTasks(newTasks) : this.setDownTasks(newTasks);
},
}, },
}; };
</script> </script>

50
src/plugins/p-subproject/p-subproject.vue

@ -1,18 +1,58 @@
<template> <template>
<!-- 子项目插件 --> <!-- 子项目插件 -->
<view>子项目插件显示子项目</view> <view>
<view v-for="item in sonProject" :key="item.detailId">
<span class="text-xs text-blue-500" @click="openProject(item)">{{ item.name }}</span>
</view>
</view>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex';
export default { export default {
name: 'p-subproject', name: 'p-subproject',
props: { item: { type: Object, default: null } }, props: {
task: {
type: Object,
default: () => {},
},
},
data() { data() {
return {}; return { sonProject: [] };
}, },
computed: {}, computed: mapGetters('project', ['projectId']),
methods: {},
mounted() {
this.getSonProject();
},
methods: {
async getSonProject() {
try {
const data = await this.$u.api.findSonProject({ projectId: this.task.detailId });
this.sonProject = data;
} catch (error) {
console.error('p-subproject.vue getSonProject error: ', error);
}
},
/**
* 打开项目
* @param {object} project 所点击的项目的信息
*/
openProject(project) {
const { name, id, url } = project;
url && (uni.$t.domain = url);
this.$u.route('pages/project/project', {
u: this.userId,
p: id,
pname: name,
url: encodeURIComponent(url),
});
},
},
watch: {}, watch: {},
}; };
</script> </script>

32
src/plugins/p-subtasks/p-subtasks.vue

@ -1,18 +1,38 @@
<template> <template>
<view>子任务插件显示子任务</view> <view>
<view v-for="item in sonTask" :key="item.detailId">
<span class="text-xs text-gray-500">{{ item.name }}</span>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
name: 'p-subtasks', name: 'p-subtasks',
props: { item: { type: Object, default: null } }, props: {
task: {
type: Object,
default: () => {},
},
},
data() { data() {
return {}; return { sonTask: [] };
},
created() {
this.getSonTask();
}, },
computed: {}, methods: {
methods: {}, async getSonTask() {
watch: {}, try {
const data = await this.$u.api.findSonTask({ detailId: this.task.detailId });
this.sonTask = data;
} catch (error) {
console.error('p-subtasks.vue getSonTask error: ', error);
}
},
},
}; };
</script> </script>

3
src/plugins/p-wbs-import/p-wbs-import.vue

@ -54,8 +54,7 @@ export default {
// TODO: // TODO:
async handleUpdate() { async handleUpdate() {
try { try {
const data = await this.$u.api.import({ projectId: this.projectId }); await this.$u.api.import({ projectId: this.projectId });
console.log('data: ', data);
// WBS // WBS
// //
this.onUploadSuccess(); this.onUploadSuccess();

11
src/store/task/actions.js

@ -33,16 +33,9 @@ const actions = {
* @param {number} param.queryType 必填 0 -> 向上 1 -> 向下 * @param {number} param.queryType 必填 0 -> 向上 1 -> 向下
*/ */
// eslint-disable-next-line // eslint-disable-next-line
async getRegulars({ commit, state }, param) { async getRegulars({ commit }, param) {
try { try {
// 向上查 且 上边没数据了 不查 return await uni.$u.api.getRegularTask(param);
// if (param.queryType === 0) return;
// 向下查 且 下边美术家了 不查
// if (param.queryType === 1) return;
const data = await uni.$u.api.getRegularTask(param);
// 0 -> 向上 1 -> 向下
// data 有无的判断在mutations里
param.queryType === 0 ? commit('setUpTasks', data) : commit('setDownTasks', data);
} catch (error) { } catch (error) {
throw error || '获取定期任务失败'; throw error || '获取定期任务失败';
} }

158
src/store/task/mutations.js

@ -8,6 +8,15 @@ const mutations = {
state.scrollTop = num; state.scrollTop = num;
}, },
/**
* 记录时间轴向上滚动的距离
* @param { object } state
* @param { string } data
*/
setViewId(state, data) {
state.viewId = data;
},
/** /**
* 设置日常任务当前是否应该处于收缩状态 * 设置日常任务当前是否应该处于收缩状态
* @param { object } state * @param { object } state
@ -52,7 +61,6 @@ const mutations = {
*/ */
setTimeNode(state, data) { setTimeNode(state, data) {
state.timeNode = data; state.timeNode = data;
console.log('state.timeNode : ', state.timeNode);
}, },
/** /**
@ -70,65 +78,10 @@ const mutations = {
* @param {Array} data 服务端返回的模板数组 * @param {Array} data 服务端返回的模板数组
*/ */
setUpTasks(state, data) { setUpTasks(state, data) {
if (!data || !data.length) { if (!state.tasks.length) {
state.topEnd = true; state.tasks = [...data];
let sTime = '';
if (!state.tasks || !state.tasks.length) {
sTime = +new Date().getTime();
} else {
sTime = +state.tasks[0].planStart - 0;
}
const initData = [
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, -6, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, -5, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, -4, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, -3, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, -2, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, -1, 'day').valueOf(),
},
];
state.tasks = [...initData.concat(state.tasks)];
} else { } else {
if (!state.tasks && !state.tasks.length) { state.tasks = [...data.concat(state.tasks)];
state.tasks = [...data];
} else {
state.tasks = [...data.concat(state.tasks)];
}
} }
}, },
@ -138,65 +91,10 @@ const mutations = {
* @param {Array} data 服务端返回的模板数组 * @param {Array} data 服务端返回的模板数组
*/ */
setDownTasks(state, data) { setDownTasks(state, data) {
if (!data || !data.length) { if (!state.tasks && !state.tasks.length) {
state.bottomEnd = true; state.tasks = [...data];
let sTime = '';
if (!state.tasks || !state.tasks.length) {
sTime = +new Date().getTime();
} else {
sTime = +state.tasks[state.tasks.length - 1].planStart - 0;
}
const initData = [
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, 1, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, 2, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, 3, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, 4, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, 5, 'day').valueOf(),
},
{
id: state.randomId,
panel: {},
plugins: [],
process: 4,
planStart: uni.$t.time.add(sTime, 6, 'day').valueOf(),
},
];
state.tasks = [...state.tasks.concat(initData)];
} else { } else {
if (!state.tasks && !state.tasks.length) { state.tasks = [...state.tasks.concat(data)];
state.tasks = [...data];
} else {
state.tasks = [...state.tasks.concat(data)];
}
} }
}, },
@ -218,13 +116,35 @@ const mutations = {
state.permanents = tasks || []; state.permanents = tasks || [];
}, },
// 清空标志位 任务 如切换角色等使用 /**
* 设置时间轴是否继续向上查任务
* @param {Object} state
* @param {Boolean} show
*/
setTopEnd(state, show) {
state.topEnd = show;
},
/**
* 设置时间轴是否继续向下查任务
* @param {Object} state
* @param {Boolean} show
*/
setBottomEnd(state, show) {
state.bottomEnd = show;
},
// 清空标志位 如切换角色等使用
clearEndFlag(state) { clearEndFlag(state) {
state.tasks = [];
state.topEnd = false; state.topEnd = false;
state.bottomEnd = false; state.bottomEnd = false;
}, },
// 清空定期任务
clearTasks(state) {
state.tasks = [];
},
/** /**
* 收到消息设置任务状态 * 收到消息设置任务状态
* @param {Object} state * @param {Object} state

2
src/store/task/state.js

@ -1,5 +1,6 @@
const state = { const state = {
scrollTop: 0, scrollTop: 0,
viewId: '', // 时间轴自动滚动的位置
isShrink: false, // true: 收起, false:展开 isShrink: false, // true: 收起, false:展开
tip: { tip: {
taskId: '', // 当前正在修改状态的任务的id taskId: '', // 当前正在修改状态的任务的id
@ -18,7 +19,6 @@ const state = {
// 定期任务 // 定期任务
tasks: [], tasks: [],
showSkeleton: false, // 定期任务骨架屏 showSkeleton: false, // 定期任务骨架屏
randomId: Math.floor(Math.random() * 100000000000000000000), // 随机id
}; };
export default state; export default state;

12
src/utils/time.js

@ -100,6 +100,17 @@ const validateTimeIsToday = time => {
return timeDate.getFullYear() === date.getFullYear() && timeDate.getMonth() === date.getMonth() && timeDate.getDate() === date.getDate(); return timeDate.getFullYear() === date.getFullYear() && timeDate.getMonth() === date.getMonth() && timeDate.getDate() === date.getDate();
}; };
/**
* 检测两个日期是否相同
* @param {number | date} time
* @param {number | date} value
* @param {string} cycle 传入 day 将会比较 day month和 year
*/
const isSame = (time, value, cycle) => {
const str = dayjs(time).isSame(value, cycle);
return str;
};
/** /**
* 格式化开始时间 * 格式化开始时间
* @param {Number} timestamp 时间戳 * @param {Number} timestamp 时间戳
@ -344,6 +355,7 @@ export default {
convertTime, convertTime,
secondToMinute, secondToMinute,
setTimestampToStr, setTimestampToStr,
isSame,
formatBeginTime, formatBeginTime,
formatDuration, formatDuration,
formatDurationToObject, formatDurationToObject,

Loading…
Cancel
Save