Browse Source

fix: 时间轴插件

develop
lucky 4 years ago
parent
commit
225d3cc5d1
  1. 1
      CHANGELOG.md
  2. 4
      src/components/Plugin/Plugin.vue
  3. 13
      src/components/TimeLine/TimeLine.vue
  4. 36
      src/components/TimeLine/component/TimeBox.vue
  5. 9
      src/pages/project/project.vue
  6. 21
      src/store/home/state.js

1
CHANGELOG.md

@ -12,6 +12,7 @@
- | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671) - | 角色栏实现 | [94cd671](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/94cd671)
- | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931) - | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/69e7931)
- | 配置默认插件接口 | [f0c177d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f0c177d) - | 配置默认插件接口 | [f0c177d](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/f0c177d)
- | 全局插件及默认插件位置修改 | [6c80d08](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/6c80d08)
- | 时间基准线,默认插件 | [a33ba1e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a33ba1e) - | 时间基准线,默认插件 | [a33ba1e](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/a33ba1e)
- | 时间轴界面 | [33927e9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/33927e9) - | 时间轴界面 | [33927e9](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/33927e9)
- | 时间轴修改状态时提示框增加 | [e841392](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e841392) - | 时间轴修改状态时提示框增加 | [e841392](https://dd.tall.wiki/gitea/wally/TALL-MUI-3/commits/e841392)

4
src/components/Plugin/Plugin.vue

@ -1,5 +1,5 @@
<template> <template>
<view v-if="pluginContent && pluginContent.html" style="height: 100%"> <view style="height: 100%" v-if="pluginContent && pluginContent.html">
<!-- <view> {{ pluginContent.html }} </view> --> <!-- <view> {{ pluginContent.html }} </view> -->
<view v-if="item && item.name"> <view v-if="item && item.name">
<p-task-title :item="item" v-if="pluginId === '1'" /> <p-task-title :item="item" v-if="pluginId === '1'" />
@ -11,7 +11,7 @@
<p-subproject :item="item" v-if="pluginId === '7'" /> <p-subproject :item="item" v-if="pluginId === '7'" />
<p-task-countdown :item="item" v-if="pluginId === '8'" /> <p-task-countdown :item="item" v-if="pluginId === '8'" />
</view> </view>
<view v-html="pluginContent.html" style="height: 100%"> </view> <view style="height: 100%" v-html="pluginContent.html"></view>
<!-- <u-parse :html="pluginContent.html" ref="ht-box"></u-parse> --> <!-- <u-parse :html="pluginContent.html" ref="ht-box"></u-parse> -->
</view> </view>
</template> </template>

13
src/components/TimeLine/TimeLine.vue

@ -84,12 +84,13 @@ export default {
if (tasks && tasks.length) { if (tasks && tasks.length) {
let tasksHeight = 0; let tasksHeight = 0;
const scrollHeight = document.getElementById('scroll').clientHeight; const scrollHeight = document.getElementById('scroll').clientHeight;
for (let i = 0; i < 3; i++) { // for (let i = 0; i < 3; i++) {
// TODO: // if (tasks[i].panel && tasks[i].panel.height) {
// if (tasks[i].panel && tasks[i].panel.height) { // tasksHeight += +tasks[i].panel.height + 42;
// tasksHeight += +tasks[i].panel.height + 42; // } else {
// } // tasksHeight += (width / 20) * 4 + 42;
} // }
// }
this.top = tasksHeight - scrollHeight / 2; this.top = tasksHeight - scrollHeight / 2;
console.log('this.top: ', this.top); console.log('this.top: ', this.top);
} }

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

@ -28,28 +28,19 @@
<view slot="body"> <view slot="body">
<skeleton :banner="false" :loading="!item.plugins.length" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton> <skeleton :banner="false" :loading="!item.plugins.length" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton>
<view class="p-0 u-col-between"> <view class="p-0 u-col-between">
<view class="grid grid-cols-3 gap-2 h-36" v-if="item.plugins.length"> <view :key="pIndex" v-for="(p, pIndex) in item.plugins">
<Plugin <view class="grid grid-cols-3 gap-2 h-36" v-if="p.length">
:class="getClass(plugin.col, plugin.row)" <Plugin
:key="pluginIndex" :class="getClass(plugin.col, plugin.row)"
:pluginId="plugin.pluginId" :item="item"
:styleType="styleType" :key="pluginIndex"
v-for="(plugin, pluginIndex) in item.plugins" :pluginId="plugin.pluginId"
/> :styleType="styleType"
v-for="(plugin, pluginIndex) in p"
/>
</view>
</view> </view>
</view> </view>
<!-- <view :key="pluginIndex" class="p-0 u-col-between u-skeleton" v-for="(plugin, pluginIndex) in item.plugins">
<view :key="p.pluginId" v-for="p in plugin">
<p-task-title :item="item" v-if="p.pluginId === 1" />
<p-task-description :item="item" v-if="p.pluginId === 2" />
<p-task-duration-delay :item="item" v-if="p.pluginId === 3" />
<p-task-start-time-delay :item="item" v-if="p.pluginId === 4" />
<p-deliverable :item="item" v-if="p.pluginId === 5" />
<p-subtasks :item="item" v-if="p.pluginId === 6" />
<p-subproject :item="item" v-if="p.pluginId === 7" />
<p-task-countdown :item="item" v-if="p.pluginId === 8" />
</view>
</view>-->
</view> </view>
</u-card> </u-card>
</view> </view>
@ -91,6 +82,11 @@ export default {
changeTimeNode(time) { changeTimeNode(time) {
this.setTimeNode(time); this.setTimeNode(time);
}, },
//
getClass(col, row) {
return [`row-span-${row}`, `col-span-${col}`];
},
}, },
}; };
</script> </script>

9
src/pages/project/project.vue

@ -173,15 +173,20 @@ export default {
try { try {
await this.getTasks({ queryType: 0 }); await this.getTasks({ queryType: 0 });
await this.getTasks({ queryType: 1 }); await this.getTasks({ queryType: 1 });
// //
const upQuery = { const upQuery = {
timeNode: +this.tasks[0].planStart, timeNode: +this.tasks[0].planStart,
queryType: 0, queryType: 0,
queryNum: 6, queryNum: 6,
}; };
await this.getTasks(upQuery); await this.getTasks(upQuery);
//
// =+
const cycle = this.$t.time.computeCycle('天');
const timeNode = this.$t.time.add(+this.tasks[this.tasks.length - 1].planStart, 1, cycle).valueOf();
const downQuery = { const downQuery = {
timeNode: +this.tasks[this.tasks.length - 1].planStart, timeNode,
queryType: 1, queryType: 1,
queryNum: 6, queryNum: 6,
}; };

21
src/store/home/state.js

@ -14,7 +14,26 @@ const state = {
roleId: '', // 当前展示查看的角色id roleId: '', // 当前展示查看的角色id
timeNode: new Date().getTime(), // 时间基准点 timeNode: new Date().getTime(), // 时间基准点
timeUnit: 4, // // 时间颗粒度 timeUnit: 4, // // 时间颗粒度
tasks: [], // 定期任务 tasks: [
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planDuration: 0,
},
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planDuration: 0,
},
{
panel: {},
plugins: [],
planStart: new Date().getTime(),
planDuration: 0,
},
], // 定期任务
topEnd: false, // 时间轴向上查任务到顶了 topEnd: false, // 时间轴向上查任务到顶了
bottomEnd: false, // 时间轴向下查任务到底了 bottomEnd: false, // 时间轴向下查任务到底了
dailyTasks: [], // 日常任务 dailyTasks: [], // 日常任务

Loading…
Cancel
Save