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;