Browse Source

test: 解决error

develop
song 4 years ago
parent
commit
c5bd659eda
  1. 3
      CHANGELOG.md
  2. 13
      src/components/Evaluated/components/EvaluatedDetail.vue
  3. 9
      src/components/Evaluated/components/ProcessRestore.vue
  4. 26
      src/components/Evaluated/components/ResultLevel.vue
  5. 14
      src/components/TimeLine/TimeLine.vue
  6. 113
      src/components/TimeLine/component/TimeBox.vue
  7. 6
      src/components/UCharts/UCharts.vue
  8. 439
      src/pagesProject/project/project copy.vue
  9. 30
      src/pagesProject/project/project.vue
  10. 2
      src/store/task/mutations.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-18)
# 0.1.0 (2021-11-19)
### 🌟 新功能
范围|描述|commitId
@ -60,6 +60,7 @@
- | 添加引导页 | [4293f5a](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/4293f5a)
- | 添加时间轴上下滚动 | [2b81bbc](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/2b81bbc)
- | 添加药物使用记录界面 | [425cb63](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/425cb63)
- | 添加训练计划详情 | [49f64ca](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/49f64ca)
- | 添加设置界面 | [7ca0c59](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/7ca0c59)
- | 添加输入工具码界面 | [8c120bc](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/8c120bc)
- | 添加项目排序 | [a0b491b](https://dd.tall.wiki/gitea/binbin0314/yanyuan_js/commits/a0b491b)

13
src/components/Evaluated/components/EvaluatedDetail.vue

@ -29,8 +29,14 @@
<!-- 训练结果 -->
<view v-if="purpose.trains.length">
<view v-for="(trainResult, resultIndex) in purpose.trains" :key="trainResult.trainRecordId">
<ResultLevel :trains="trainResult" :resultIndex="resultIndex" v-if="trainResult.resultType === 0" />
<view v-if="trainResult.resultType === 1">过程记录</view>
<view v-if="trainResult.resultType === 0">
<view class="font-bold text-xs">训练结果</view>
<ResultLevel :trains="trainResult" :resultIndex="resultIndex" />
</view>
<view v-if="trainResult.resultType === 1">
<view class="font-bold text-xs">过程还原</view>
<ProcessRestore />
</view>
</view>
</view>
</view>
@ -38,9 +44,10 @@
<script>
import ResultLevel from './ResultLevel';
import ProcessRestore from './ProcessRestore';
export default {
components: { ResultLevel },
components: { ResultLevel, ProcessRestore },
props: { train: { type: Object, default: null } },
};
</script>

9
src/components/Evaluated/components/ProcessRestore.vue

@ -0,0 +1,9 @@
<template>
<view class="my-2">过程还原</view>
</template>
<script>
export default {};
</script>
<style></style>

26
src/components/Evaluated/components/ResultLevel.vue

@ -1,6 +1,6 @@
<template>
<view>
<view class="flex flex-nowrap mt-10 rounded-3xl relative">
<view v-if="trains">
<view class="flex flex-nowrap mt-12 rounded-3xl relative" v-if="trains.finishResult">
<view
class="bubble"
:style="{
@ -18,9 +18,9 @@
</view>
</view>
<!-- 时间 -->
<view class="text-sm text-gray-400 flex flex-nowrap items-center">
<view class="num mr-2">{{ resultIndex + 1 }}</view>
1分钟50秒
<view class="text-sm text-gray-400 flex flex-nowrap items-center mt-2" v-if="trains.finishTime">
<view class="num mr-2 u-font-12">{{ resultIndex + 1 }}</view>
{{ $moment(trains.finishTime - 0).format('m分钟ss秒') }}
</view>
</view>
</template>
@ -31,10 +31,6 @@ export default {
data() {
return {
// trains: {
// finishResult: 3,
// finishTime: 15,
// },
levels: [
{
value: 0.5,
@ -74,8 +70,10 @@ export default {
query
.selectAll('.box')
.boundingClientRect(data => {
this.width = data[0].width;
this.setLevel();
if (data && data.length) {
this.width = data[0].width;
this.setLevel();
}
})
.exec();
});
@ -160,10 +158,10 @@ export default {
}
.num {
width: 40rpx;
height: 40rpx;
width: 30rpx;
height: 30rpx;
text-align: center;
line-height: 40rpx;
line-height: 30rpx;
border-radius: 50%;
border: 1px solid $uni-bg-color-blue;
color: $uni-bg-color-blue;

14
src/components/TimeLine/TimeLine.vue

@ -45,6 +45,7 @@ export default {
//
scroll(e) {
console.log('e: ', e);
this.top = e.detail.scrollTop;
this.setShrink(this.top > this.scrollTop);
this.setScrollTop(this.top);
@ -55,7 +56,7 @@ export default {
if (!this.tasks || !this.tasks.length || this.showSkeleton) return;
let startTime = null;
if (this.tasks[0].length) {
startTime = this.tasks[0][0].planStart - 0;
startTime = this.tasks[0].array[0].planStart - 0;
} else {
startTime = this.tasks[0].planStart - 0;
}
@ -77,7 +78,7 @@ export default {
let index = null;
let itemIndex = null;
for (let i = 0; i < this.tasks.length; i++) {
const task = this.tasks[i];
const task = this.tasks[i].array;
if (task && task.length) {
index = i;
itemIndex = task.findIndex(item => item.detailId);
@ -86,7 +87,7 @@ export default {
}
}
}
timeNode = this.tasks[index][itemIndex].planStart - 0;
timeNode = this.tasks[index].array[itemIndex].planStart - 0;
}
const upQuery = {
timeNode,
@ -102,8 +103,8 @@ export default {
if (!this.tasks || !this.tasks.length || this.showSkeleton) return;
const { tasks, timeGranularity } = this;
let startTime = null;
if (tasks[tasks.length - 1].length) {
startTime = tasks[tasks.length - 1][0].planStart - 0;
if (tasks[tasks.length - 1].array && tasks[tasks.length - 1].array.length) {
startTime = tasks[tasks.length - 1].array[0].planStart - 0;
} else {
startTime = tasks[tasks.length - 1].planStart - 0;
}
@ -157,7 +158,7 @@ export default {
// taskId
// 线id 线
for (let i = 0; i < this.tasks.length; i++) {
const task = this.tasks[i];
const task = this.tasks[i].array;
if (task && task.length) {
item = task.find(item => this.$moment(+item.planStart).isSame(this.timeNode, this.timeGranularity));
if (item) {
@ -165,6 +166,7 @@ export default {
}
}
}
console.log('跳转: ', `a${item.id}`);
item && this.setScrollToTaskId(`a${item.id}`); // task id
// const task = this.tasks.find(item => this.$moment(+item.planStart).isSame(this.timeNode, this.timeGranularity));
// task && this.setScrollToTaskId(`a${task.id}`); // task id

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

@ -3,12 +3,65 @@
<!-- v-if="tasks && tasks.length" -->
<view>
<view :key="task.id" v-for="(task, taskIndex) in tasks" :id="`a${task.id}`">
<view v-if="scrollToTaskId === `a${task.id}`">AAA</view>
<!-- 内层 -->
<view v-if="task.array && task.array.length">
<view class="flex">
<TimeStatus :task="task.array[0]" />
<view class="flex items-center justify-between flex-1 ml-2 task-column">
<view v-if="task.array[0].process !== 4">{{ $moment(+task.array[0].planStart).format(startTimeFormat) }}</view>
<view v-else>{{ $moment(+task.array[0].planStart).format('D日') }}</view>
</view>
</view>
<view v-for="(item, itemIndex) in task.array" :key="item.id">
<view class="border-l-2 border-gray-300 plugin">
<view class="h-3" v-if="item.process === 4"></view>
<view class="ml-3 overflow-hidden shadow-lg task-box">
<u-card
:show-foot="false"
:show-head="false"
:style="{ height: setHeight(item.panel) }"
class="h-16"
margin="0"
v-if="showSkeleton"
>
<view slot="body">
<view>
<skeleton :banner="false" :loading="true" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton>
</view>
</view>
</u-card>
<u-card
@click="onClickTask(item.planStart - 0, item.id)"
:show-foot="false"
:show-head="false"
:style="{ height: setHeight(item.panel) }"
class="h-16"
margin="0"
v-if="task.array && task.array.length && item.process !== 4 && !showSkeleton"
>
<view slot="body">
<!-- 脑力测评 -->
<view class="p-0 u-col-between">
<NotEvaluated :task="item" v-if="item.data.mentalTest.finishStatus === 0" />
<view v-else>
<EvaluatedNLCP :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 0" />
<EvaluatedXLJH :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 1" />
</view>
</view>
</view>
</u-card>
</view>
</view>
</view>
</view>
<!-- 外层 -->
<view v-if="task.id">
<view v-else>
<view class="flex">
<TimeStatus :task="task" />
<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.process2 !== 4">{{ $moment(+task.planStart).format(startTimeFormat) }}</view>
<view v-else>{{ $moment(+task.planStart).format('D日') }}</view>
</view>
</view>
@ -53,58 +106,6 @@
</view>
</view>
</view>
<!-- 内层 -->
<view v-else>
<view class="flex">
<TimeStatus :task="task[0]" />
<view class="flex items-center justify-between flex-1 ml-2 task-column">
<view v-if="task[0].process !== 4">{{ $moment(+task[0].planStart).format(startTimeFormat) }}</view>
<view v-else>{{ $moment(+task[0].planStart).format('D日') }}</view>
</view>
</view>
<view v-for="(item, itemIndex) in task" :key="item.id">
<view class="border-l-2 border-gray-300 plugin">
<view class="h-3" v-if="item.process === 4"></view>
<view class="ml-3 overflow-hidden shadow-lg task-box">
<u-card
:show-foot="false"
:show-head="false"
:style="{ height: setHeight(item.panel) }"
class="h-16"
margin="0"
v-if="showSkeleton"
>
<view slot="body">
<view>
<skeleton :banner="false" :loading="true" :row="4" animate class="mt-2 u-line-2 skeleton"></skeleton>
</view>
</view>
</u-card>
<u-card
@click="onClickTask(item.planStart - 0, item.id)"
:show-foot="false"
:show-head="false"
:style="{ height: setHeight(item.panel) }"
class="h-16"
margin="0"
v-if="task && task.length && item.process !== 4 && !showSkeleton"
>
<view slot="body">
<!-- 脑力测评 -->
<view class="p-0 u-col-between">
<NotEvaluated :task="item" v-if="item.data.mentalTest.finishStatus === 0" />
<view v-else>
<EvaluatedNLCP :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 0" />
<EvaluatedXLJH :task="item" :taskIndex="taskIndex" :itemIndex="itemIndex" v-if="item.data.type === 1" />
</view>
</view>
</view>
</u-card>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 局部弹框操作栏 -->
@ -131,11 +132,9 @@ export default {
};
},
watch: {},
computed: {
...mapState('role', ['roleId']),
...mapState('task', ['timeUnit', 'tasks', 'taskLoading', 'showSkeleton', 'isEvaluated']),
...mapState('task', ['timeUnit', 'tasks', 'taskLoading', 'showSkeleton', 'isEvaluated', 'scrollToTaskId']),
...mapGetters('task', ['startTimeFormat']),
},

6
src/components/UCharts/UCharts.vue

@ -101,8 +101,8 @@ export default {
},
touchStart(e) {
canvases[this.canvasId].showToolTip(e, {
format: function (item, category) {
return category + ' ' + item.name + ':' + item.data;
format: function (item) {
return item.data;
},
});
canvases[this.canvasId].scrollStart(e);
@ -114,7 +114,7 @@ export default {
canvases[this.canvasId].scrollEnd(e);
},
error(e) {
console.log(e);
console.log('e: ', e);
},
},
};

439
src/pagesProject/project/project copy.vue

@ -1,439 +0,0 @@
<template>
<view :style="{ height: height }" class="flex flex-col overflow-hidden u-font-16">
<!-- 标题栏 -->
<Title />
<view class="container flex flex-col flex-1 overflow-hidden bg-gray-100">
<!-- 角色栏 -->
<Roles @changeIsSetting="changeIsSetting" />
<!-- 日常任务面板 -->
<!-- <Globals /> -->
<!-- 定期任务面板 -->
<!-- <ConfigInfo class="flex-1 overflow-hidden" style="background-color: #f3f3f3" /> -->
<ConfigInfo class="flex-1 overflow-hidden" style="background-color: #f3f3f3" v-if="isSetting" />
<TimeLine @getTasks="getTasks" style="background-color: #f3f3f3" class="flex-1 overflow-hidden" ref="timeLine" v-else />
</view>
<!-- 引导语 -->
<!-- <GuidePage class="w-full h-full" v-if="showGuide" @quitGuide="quitGuide" /> -->
</view>
</template>
<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex';
import { setPlaceholderTasks, computeFillPlaceholderTaskCount } from '@/utils/task';
import { flatten } from 'lodash';
export default {
data() {
return {
height: '',
show: false,
questionnaires: [],
count: 0,
chooseItem: false,
showGuide: false,
isSetting: false, //
};
},
computed: {
...mapState('user', ['user', 'token']),
...mapState('role', ['visibleRoles', 'roleId']),
...mapState('task', ['timeNode', 'timeUnit', 'tasks', 'regularTask', 'newProjectInfo', 'showSkeleton', 'showScrollTo']),
...mapState('project', ['project']),
...mapGetters('task', ['timeGranularity']),
...mapGetters('project', ['projectId']),
...mapGetters('user', ['userId']),
},
onLoad(options) {
if (options.share && options.share === '1') {
this.shareInit(options);
} else {
this.init(options);
}
},
watch: {
/**
* 当时间基准点发生变化时
* 重新根据时间和角色查询普通日常任务
* 永久日常任务不发生改变
*/
timeNode(val) {
if (val && this.roleId) {
this.clearTasksData();
this.getGlobalData(); //
this.initPlanTasks(); //
}
},
/**
* 当角色发生变化时
* 重新查询永久日常任务和普通日常任务
* 注意: 切换角色后 重新设置了时间基准点 时间基准点一定会变
* 所以监听时间基准点获取 可变日常任务即可 这里不用获取 避免重复获取
*/
roleId(val) {
if (val) {
if (this.isSetting) return;
this.setTimeNode(Date.now());
//
const params = { roleId: val, projectId: this.projectId, templateCode: this.project.templateCode };
this.getPermanent(params);
}
},
//
newProjectInfo(val) {
if (val && val.projectId && val.url) {
this.$u.route('/', { u: this.userId, p: val.projectId, url: val.url });
this.clearTasksData();
this.setRoleId('');
const options = this.$route.query;
this.init(options);
}
},
},
mounted() {
const system = uni.getSystemInfoSync();
this.height = system.windowHeight + 'px';
// TODO:
setTimeout(() => {
this.showGuide = true;
}, 1000);
},
onUnload() {
this.clearTasksData();
this.setRoleId('');
},
methods: {
...mapActions('user', ['getToken']),
...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']),
...mapMutations('user', ['setToken']),
...mapMutations('project', ['setProject', 'setProjectName']),
...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']),
...mapMutations('task', [
'setPermanents',
'setUpTasks',
'setDownTasks',
'setDailyTasks',
'setTimeNode',
'clearTasks',
'clearEndFlag',
'setShowSkeleton',
'setTopEnd',
'setBottomEnd',
'setShowScrollTo',
]),
back() {
uni.navigateBack();
},
changeIsSetting(show) {
this.isSetting = show;
},
//
async initPlanTasks() {
this.setPrevPlaceholderTasks(); //
this.setNextPlaceholderTasks(); //
// // this.$nextTick(() => this.$refs.timeLine.setScrollPosition()); //
await this.getInitTasks(); //
//
let timer = null;
timer = setInterval(() => {
if (this.showScrollTo) {
clearInterval(timer);
this.$nextTick(() => this.$refs.timeLine.setScrollPosition());
}
}, 500);
},
// ||
getInitTasks() {
// id
// this.getTasks({ queryType: 1 }, preloadFn); //
//
this.getTasks({ queryType: 0 }); //
},
/**
* 根据时间基准点和角色查找定期任务
* @param {object} query
* @param {string} query.roleId 角色id
* @param {string} query.timeNode 时间基准点 默认当前
* @param {string} query.timeUnit 时间颗粒度 默认天
* @param {string} query.queryNum 查找颗粒度数量 默认3个
* @param {number} query.queryType 0向上查找 1向下查找(默认) 下查包含自己上查不包含
*/
getTasks(query) {
this.setShowSkeleton(true);
const params = this.generateGetTaskParam(query);
this.$t.$q.getRegularTask(params, (err, data) => {
this.setShowSkeleton(false);
if (err) {
// TODO:
console.error('err: ', err);
} else {
this.setShowScrollTo(true);
//
//
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();
}
}
});
},
/**
* 生成getTasks所用的参数
* @param {object} query getTasks传递的参数
*/
generateGetTaskParam(query) {
const { roleId, timeNode, timeUnit, projectId, project } = this;
return {
roleId,
timeNode: query.timeNode || timeNode,
timeUnit: query.timeUnit || timeUnit,
// queryNum: query.queryNum || 3,
queryNum: 1,
queryType: query.queryType,
projectId,
templateCode: project.templateCode,
};
},
//
setPrevPlaceholderTasks() {
this.setTopEnd(true);
let startTime = '';
const { tasks } = this;
if (!tasks || !tasks.length) {
startTime = Date.now(); //
} else {
startTime = tasks[0].planStart - 0; //
}
const placeholderTasks = setPlaceholderTasks(startTime, true, this.timeGranularity);
this.setUpTasks(placeholderTasks);
},
//
setNextPlaceholderTasks() {
this.setBottomEnd(true);
let startTime = '';
if (!this.tasks || !this.tasks.length) {
startTime = Date.now();
} else {
startTime = +this.tasks[this.tasks.length - 1].planStart;
}
const initData = setPlaceholderTasks(startTime, false, this.timeGranularity);
this.setDownTasks(initData);
},
/**
* 用拿到的新数据 替换 时间刻度/旧数据
* 先对比 新旧数据的 始末时间 补齐刻度
* 再遍历对比 用任务替换刻度
* @param {array} data 服务端返回的新数据 上边已经处理过空值
* @param {number} type 0 -> 向上 1->向下
*/
replacePrevData(data, type) {
const { timeGranularity } = this;
let oldTasks = this.fillPlaceholderTask({ tasks: this.tasks, data, timeGranularity }); //
//
// TODO: tasks
oldTasks.forEach((taskItem, index) => {
const arr = data.filter(dataItem => this.$moment(+dataItem.planStart).isSame(+taskItem.planStart, timeGranularity));
console.log('arr: ', arr);
if (arr && arr.length) {
oldTasks.splice(index, 1, [...arr]); // array, [{},{},[],[],{}]
}
});
oldTasks = flatten(oldTasks); // 1
console.log('oldTasks: ', oldTasks);
this.clearTasks(); // setUpTasks setUpTasks
type === 0 ? this.setUpTasks(oldTasks) : this.setDownTasks(oldTasks);
},
/**
* 超出旧数据上下限 补齐时间刻度到新数据的起始时间颗粒度
*/
fillPlaceholderTask({ tasks, data, timeGranularity }) {
const { prev, next } = computeFillPlaceholderTaskCount({ tasks, data, timeGranularity });
if (prev) {
const newTasks = setPlaceholderTasks(+tasks[0].planStart, true, timeGranularity, prev);
this.setUpTasks(newTasks);
}
if (next) {
const newTasks = setPlaceholderTasks(+tasks[tasks.length - 1].planStart, false, timeGranularity, next);
this.setDownTasks(newTasks);
}
return this.tasks;
},
/**
* 初始化
* @param {object | null} options
*/
init(options) {
if (!this.token) {
// tokenuserIdtoken
// token userId
if (!options || !options.u) {
this.$t.ui.showToast('缺少用户信息参数'); // u (userId)
} else {
this.getToken(options.u);
}
}
//
options && options.pname && this.setProjectName(options.pname);
if (!options || !options.p) {
this.$t.ui.showToast('缺少项目信息参数'); // id
} else {
if (options.p !== this.$t.storage.getStorageSync('projectId')) {
this.$t.storage.setStorageSync('roleId', '');
}
// TODO
// this.getProjectById({ projectId: options.p, num: 0 }); // id
// id
this.getRoles({ projectId: options.p, num: 0, templateCode: this.project.templateCode });
}
},
//
async shareInit(options) {
const storageUser = this.$t.storage.getStorageSync('user');
const user = storageUser ? JSON.parse(storageUser) : null;
if (user && user.id) {
await this.getToken(user.id);
const res = await this.clickShare({ code: options.shareId });
if (res && res.projectId) {
let query = { ...this.$route.query };
query = {
u: user.id,
p: res.projectId,
};
this.$router.push({ path: this.$route.path, query });
this.init(query);
}
} else {
this.$t.ui.showToast('缺少用户信息参数,请登录');
}
},
/**
* 点击分享连接
* @param {any} commit
* @param {object} param 请求参数
*/
async clickShare(param) {
try {
const data = await this.$u.api.clickShare(param);
return data;
} catch (error) {
this.$t.ui.showToast(error.msg || '获取失败');
}
},
/**
* 通过项目id获取项目信息
* @param {object} params 提交的参数
*/
async getProjectById(params) {
try {
const data = await uni.$u.api.findProjectById(params);
this.setProject(data);
// id
this.getRoles(params);
} catch (error) {
console.error('error: ', error || '获取项目信息失败');
}
},
/**
* 通过项目id获取角色信息
* @param {string} projectId
* @param {object} params 提交的参数
*/
getRoles(params) {
this.$t.$q.findShowRole(params, (err, data) => {
if (err) {
console.error('err: ', err || '获取角色信息失败');
} else {
this.setInvisibleRoles(data ? data.invisibleList : []);
this.setVisibleRoles(data ? data.visibleList : []);
this.setInitialRoleId(data ? data.visibleList : []);
}
});
},
//
setInitialRoleId(visibleList) {
if (!visibleList || !visibleList.length) return;
const index = visibleList.findIndex(item => +item.mine === 1);
const currentRole = index > 0 ? visibleList[index] : visibleList[0];
const storageRoleId = this.$t.storage.getStorageSync('roleId');
const currentRoleId = storageRoleId ? storageRoleId : currentRole ? currentRole.id : '';
this.setRoleId(currentRoleId);
// storage
this.$t.storage.setStorageSync('roleId', '');
},
//
getGlobalData() {
const { roleId, timeNode, timeUnit, projectId } = this;
const param = { roleId, timeNode, timeUnit, projectId };
this.getGlobal(param);
},
//
clearTasksData() {
//
this.setPermanents([]);
this.setDailyTasks([]);
//
this.clearTasks();
//
//
this.clearEndFlag();
},
// 退
quitGuide() {
this.showGuide = false;
},
},
};
</script>
<style lang="scss" scoped>
.img-box {
width: 750rpx;
height: 100vh;
position: fixed;
top: 0;
left: 0;
z-index: 999;
}
.border-b {
border-bottom: 1px solid #e4e7ed;
}
</style>

30
src/pagesProject/project/project.vue

@ -42,7 +42,16 @@ export default {
computed: {
...mapState('user', ['user', 'token']),
...mapState('role', ['visibleRoles', 'roleId']),
...mapState('task', ['timeNode', 'timeUnit', 'tasks', 'regularTask', 'newProjectInfo', 'showSkeleton', 'showScrollTo']),
...mapState('task', [
'timeNode',
'timeUnit',
'tasks',
'regularTask',
'newProjectInfo',
'showSkeleton',
'showScrollTo',
'scrollToTaskId',
]),
...mapState('project', ['project']),
...mapGetters('task', ['timeGranularity']),
...mapGetters('project', ['projectId']),
@ -239,7 +248,6 @@ export default {
} else {
startTime = +this.tasks[this.tasks.length - 1].planStart;
}
console.log('startTime设置时间轴向下的空数据: ', startTime);
const initData = setPlaceholderTasks(startTime, false, this.timeGranularity);
this.setDownTasks(initData);
},
@ -255,12 +263,15 @@ export default {
const { timeGranularity } = this;
let oldTasks = this.fillPlaceholderTask({ tasks: this.tasks, data, timeGranularity }); //
//
// TODO: tasks
// TODO: tasks .
oldTasks.forEach((taskItem, index) => {
let item = {};
const arr = data.filter(dataItem => this.$moment(+dataItem.planStart).isSame(+taskItem.planStart, timeGranularity));
if (arr && arr.length) {
oldTasks.splice(index, 1, [...arr]); // array, [{},{},[],[],{}]
item.id = arr[0].id;
item.array = [...arr];
// oldTasks.splice(index, 1, [...arr]); // array, [{},{},[],[],{}]
oldTasks.splice(index, 1, item); // array, [{},{},[],[],{}]
}
});
@ -269,6 +280,15 @@ export default {
type === 0 ? this.setUpTasks(oldTasks) : this.setDownTasks(oldTasks);
},
//
randomNum(n) {
var t = '';
for (var i = 0; i < n; i++) {
t += Math.floor(Math.random() * 10);
}
return t;
},
/**
* 超出旧数据上下限 补齐时间刻度到新数据的起始时间颗粒度
*/

2
src/store/task/mutations.js

@ -217,7 +217,7 @@ const mutations = {
* @param {Boolean} data
*/
setShowDetail(state, data) {
state.tasks[data.taskIndex][data.itemIndex].data.showDetail = !state.tasks[data.taskIndex][data.itemIndex].data.showDetail;
state.tasks[data.taskIndex].array[data.itemIndex].data.showDetail = !state.tasks[data.taskIndex].array[data.itemIndex].data.showDetail;
},
};

Loading…
Cancel
Save