forked from ccsens_fe/tall-mui-3
7 changed files with 66 additions and 110 deletions
@ -1,44 +0,0 @@ |
|||||
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; |
|
@ -0,0 +1,23 @@ |
|||||
|
/** |
||||
|
* 设置时间轴空数据 |
||||
|
* @param {number} startTime |
||||
|
* @param {boolean} isUp true 向上加载,false 向下加载 |
||||
|
* @param {string} timeGranularity 颗粒度 |
||||
|
*/ |
||||
|
export const setPlaceholderTasks = (startTime, isUp, timeGranularity) => { |
||||
|
let result = []; |
||||
|
for (let i = 0; i < 10; i++) { |
||||
|
const delta = isUp ? `-${i + 1}` - 0 : i + 1; |
||||
|
let item = { |
||||
|
id: uni.$u.guid(20, false, 10), |
||||
|
panel: {}, |
||||
|
plugins: [], |
||||
|
process: 4, |
||||
|
planStart: uni.$moment(startTime).add(delta, timeGranularity).valueOf(), |
||||
|
}; |
||||
|
// console.log('isup: ', isUp, 'result:', new Date(item.planStart).toLocaleDateString());
|
||||
|
|
||||
|
isUp ? result.unshift(item) : result.push(item); |
||||
|
} |
||||
|
return result; |
||||
|
}; |
Loading…
Reference in new issue