Browse Source

fix: 修改时间轴定期任务加载逻辑

wrr
song 4 years ago
parent
commit
1977c00f1d
  1. 3
      CHANGELOG.md
  2. 4
      rest/project.http
  3. 18
      src/components/TimeLine/TimeLine.vue
  4. 2
      src/components/TimeLine/component/TimeBox.vue
  5. 20
      src/pages/project/project.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-09-10)
# 0.1.0 (2021-09-13)
### 🌟 新功能
范围|描述|commitId
@ -154,6 +154,7 @@
- | 时间轴骨架屏修改 | [ca78d02](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/ca78d02)
- | 检查交付物传参修改 | [ebe0031](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/ebe0031)
- | 检查交付物传参修改 | [37b51bc](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/37b51bc)
- | 添加页面返回功能 解决角色滚动bug | [87ce0f7](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/87ce0f7)
- | 滚动id函数优化 | [b351b67](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/b351b67)
- | 监听时间基本点 | [033fca0](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/033fca0)
- | 角色显示状态修改 | [7d3b906](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7d3b906)

4
rest/project.http

@ -1,14 +1,14 @@
### login
# @name login
POST https://test.tall.wiki/gateway/tall/v1.0/users/signin
POST https://www.tall.wiki/gateway/tall/v1.0/users/signin
content-type: application/json;charset=utf-8
{
"client": 1,
"data": {
"credential": "123456",
"identifier": "mazhuang"
"identifier": "zy"
},
"scene": 0,
"type": 3

18
src/components/TimeLine/TimeLine.vue

@ -53,7 +53,7 @@ export default {
async handleScrollTop() {
if (!this.tasks || !this.tasks.length || this.showSkeleton) return;
const startTime = this.tasks[0].planStart - 0;
if ((this.tasks[0].plugins && this.tasks[0].plugins.length === 0) || this.topEnd) {
if (this.topEnd) {
//
console.warn('滚动到顶部没有数据时: ');
const addTasks = setPlaceholderTasks(startTime, true, this.timeGranularity);
@ -61,8 +61,10 @@ export default {
} else {
//
console.warn('滚动到顶部有数据时: ');
const detailId = this.tasks.findIndex(task => task.detailId);
const timeNode = this.tasks[detailId].planStart - 0;
const upQuery = {
timeNode: startTime,
timeNode,
queryType: 0,
queryNum: 6,
};
@ -75,7 +77,7 @@ export default {
if (!this.tasks || !this.tasks.length || this.showSkeleton) return;
const { tasks, timeGranularity } = this;
const startTime = tasks[tasks.length - 1].planStart - 0;
if ((tasks[0].plugins && tasks[0].plugins.length === 0) || this.bottomEnd) {
if (this.bottomEnd) {
//
console.warn('滚动到底部没有数据时: ');
const addTasks = setPlaceholderTasks(startTime, false, this.timeGranularity);
@ -83,9 +85,15 @@ export default {
} else {
// =+
console.warn('滚动到底部有数据时: ');
const timeNode = this.$t.time.add(startTime, 1, timeGranularity).valueOf();
const arr = [];
this.tasks.forEach(task => {
if (task.detailId) {
arr.push(task);
}
});
const nextQueryTime = +this.$t.time.add(+arr[arr.length - 1].planStart, 1, timeGranularity);
const downQuery = {
timeNode,
timeNode: nextQueryTime,
queryType: 1,
queryNum: 6,
};

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

@ -85,7 +85,7 @@ export default {
computed: {
...mapState('role', ['roleId']),
...mapState('task', ['timeUnit', 'tasks', 'taskLoading', 'topEnd', 'bottomEnd', 'showSkeleton']),
...mapState('task', ['timeUnit', 'tasks', 'taskLoading', 'showSkeleton']),
...mapGetters('task', ['startTimeFormat']),
},

20
src/pages/project/project.vue

@ -130,15 +130,21 @@ export default {
//
function preloadFn(that) {
const detailId = that.tasks.findIndex(task => task.detailId);
const arr = [];
that.tasks.forEach(task => {
if (task.detailId) {
arr.push(task);
}
});
if (detailId !== -1) {
// 1
const { pageCount } = that.$t.task;
that.$nextTick(() => {
//
const { tasks, timeGranularity } = that;
that.getTasks({ timeNode: +tasks[0].planStart, queryType: 0, queryNum: pageCount });
that.getTasks({ timeNode: +tasks[detailId].planStart, queryType: 0, queryNum: pageCount });
//
const nextQueryTime = +that.$t.time.add(+tasks[tasks.length - 1].planStart, 1, timeGranularity);
const nextQueryTime = +that.$t.time.add(+arr[arr.length - 1].planStart, 1, timeGranularity);
that.getTasks({ timeNode: nextQueryTime, queryType: 1, queryNum: pageCount });
});
} else {
@ -179,13 +185,11 @@ export default {
//
if (data && data.length) {
this.replacePrevData(data, params.queryType);
params.queryType === 0 ? this.setTopEnd(false) : this.setBottomEnd(false);
} else {
// TODO: 0 -> 1 ->
params.queryType === 0 ? this.setPrevPlaceholderTasks() : this.setNextPlaceholderTasks();
}
// else {
// TODO: 0 -> 1 ->
// params.queryType === 0 ? this.setPrevPlaceholderTasks() : this.setNextPlaceholderTasks();
// }
if (this.tasks.length && fn) {
fn(this);
}

Loading…
Cancel
Save