Browse Source

feat: 进入腐蚀仪项目默认打开第一个任务

disable-role
song 4 years ago
parent
commit
f822f1e199
  1. 3
      CHANGELOG.md
  2. 8
      src/pages/project/project.vue
  3. 16
      src/plugins/p-task-title/p-task-title.vue
  4. 9
      src/store/project/mutations.js
  5. 1
      src/store/project/state.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-10-26)
# 0.1.0 (2021-10-29)
### 🌟 新功能
范围|描述|commitId
@ -226,6 +226,7 @@
--|--|--
- | 1.时间轴筛选相同的时间替换数据 2.整理代码 | e082ccb
- | 修改代码格式 | 14123d7
- | 修改内置插件任务名 | 1191396
- | 修改定期任务骨架屏高度 | 909a734
- | 修改样式 | 322b0fb
- | 务,分享项目样框样式修改式弹框 | dab3d44

8
src/pages/project/project.vue

@ -141,7 +141,7 @@ export default {
...mapActions('user', ['getToken']),
...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']),
...mapMutations('user', ['setToken']),
...mapMutations('project', ['setProject', 'setProjectName']),
...mapMutations('project', ['setProject', 'setProjectName', 'setOpenFirstTask']),
...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']),
...mapMutations('task', [
'setPermanents',
@ -161,7 +161,6 @@ export default {
async initPlanTasks() {
this.setPrevPlaceholderTasks(); //
this.setNextPlaceholderTasks(); //
// // this.$nextTick(() => this.$refs.timeLine.setScrollPosition()); //
await this.getInitTasks(); //
//
@ -170,6 +169,11 @@ export default {
if (this.showScrollTo) {
clearInterval(timer);
this.$nextTick(() => this.$refs.timeLine.setScrollPosition());
//
if (this.project.name === '智能大气腐蚀检测平台') {
this.setOpenFirstTask(true);
}
}
}, 500);
},

16
src/plugins/p-task-title/p-task-title.vue

@ -8,7 +8,7 @@
</template>
<script>
import { mapGetters } from 'vuex';
import { mapState, mapGetters } from 'vuex';
export default {
name: 'p-task-title',
@ -23,6 +23,19 @@ export default {
computed: {
...mapGetters('user', ['userId']),
...mapGetters('project', ['projectId']),
...mapState('project', ['openFirstTask']),
...mapState('task', ['permanents']),
},
watch: {
//
openFirstTask(val) {
if (val) {
if (this.permanents.length && this.permanents[0].name === this.task.name) {
this.postMsg(this.param);
}
}
},
},
methods: {
@ -33,6 +46,7 @@ export default {
const data = JSON.parse(param);
if (data && data.url) {
const url = `${data.url}?u=${this.userId}&p=${this.projectId}&t=${this.task.id}`;
console.log('发消息: ', url);
const msg = {
event: 'openDetail',
data: url,

9
src/store/project/mutations.js

@ -38,6 +38,15 @@ const mutations = {
setDotList(state, data) {
state.dotList = data;
},
/**
* 设置是否自动打开第一个任务
* @param { object } state
* @param { string } show
*/
setOpenFirstTask(state, show) {
state.openFirstTask = show;
},
};
export default mutations;

1
src/store/project/state.js

@ -3,6 +3,7 @@ const state = {
project: { name: '加载中...' }, // 当前项目信息
projects: [], // 项目列表
dotList: [], // 小红点
openFirstTask: false, // 是否自动打开第一个任务
};
export default state;

Loading…
Cancel
Save