Browse Source

perf: 日常任务样式修改

wrr
song 4 years ago
parent
commit
4628301183
  1. 3
      CHANGELOG.md
  2. 13
      src/components/Globals/Globals.vue
  3. 11
      src/components/Plugin/Plugin.vue
  4. 3
      src/components/Title/Title.vue
  5. 46
      src/components/Title/components/CreateTask.vue
  6. 3
      src/pages/project/project.vue
  7. 45
      src/store/task/mutations.js

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-09-07) # 0.1.0 (2021-09-08)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -50,6 +50,7 @@
- | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/0500cb4) - | 标题栏角色栏全局任务组件新建 | [0500cb4](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/0500cb4)
- | 检查交付物 | [9d92be5](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/9d92be5) - | 检查交付物 | [9d92be5](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/9d92be5)
- | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/69e7931) - | 模拟接口测试 | [69e7931](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/69e7931)
- | 添加任务对接口 | [7fc959d](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7fc959d)
- | 添加内置插件-交付物 | [6e0bc46](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/6e0bc46) - | 添加内置插件-交付物 | [6e0bc46](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/6e0bc46)
- | 添加子任务插件 子项目插件 | [7bda7e2](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7bda7e2) - | 添加子任务插件 子项目插件 | [7bda7e2](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/7bda7e2)
- | 添加时间轴上下滚动 | [2b81bbc](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/2b81bbc) - | 添加时间轴上下滚动 | [2b81bbc](https://dd.tall.wiki/gitea/wally/tall-mui-3-project/commits/2b81bbc)

13
src/components/Globals/Globals.vue

@ -1,15 +1,10 @@
<template> <template>
<view class="m-2" v-if="globals && globals.length"> <view class="m-2" v-if="globals && globals.length">
<u-card <u-card @click="openCard" :show-foot="false" :show-head="false" style="max-height: 218rpx" border-radius="25" margin="0">
@click="openCard" <!-- :style="{ 'max-height': isShrink ? '106rpx' : '340rpx' }" -->
:show-foot="false"
:show-head="false"
:style="{ 'max-height': isShrink ? '106rpx' : '340rpx' }"
border-radius="25"
margin="0"
>
<view slot="body"> <view slot="body">
<scroll-view :scrollY="true" :style="{ 'max-height': isShrink ? '50rpx' : '280rpx' }"> <scroll-view :scrollY="true" style="max-height: 280rpx">
<!-- <scroll-view :scrollY="true" :style="{ 'max-height': isShrink ? '50rpx' : '280rpx' }"> -->
<skeleton :banner="false" :loading="!globals.length" :row="4" animate class="u-line-2 skeleton"></skeleton> <skeleton :banner="false" :loading="!globals.length" :row="4" animate class="u-line-2 skeleton"></skeleton>
<view class="grid gap-2"> <view class="grid gap-2">
<block v-for="item in globals" :key="item.id"> <block v-for="item in globals" :key="item.id">

11
src/components/Plugin/Plugin.vue

@ -42,7 +42,7 @@
</template> </template>
<script> <script>
import { mapGetters, mapState } from 'vuex'; import { mapGetters, mapState, mapActions } from 'vuex';
export default { export default {
name: 'Plugin', name: 'Plugin',
@ -73,11 +73,16 @@ export default {
// }, // },
}, },
created() { async created() {
this.getPlugin(); if (this.pluginId === '5') {
// id
await this.getAllMembers({ projectId: this.projectId });
}
await this.getPlugin();
}, },
methods: { methods: {
...mapActions('role', ['getAllMembers']),
// //
async getPlugin() { async getPlugin() {
const { pluginId, styleType } = this; const { pluginId, styleType } = this;

3
src/components/Title/Title.vue

@ -21,7 +21,8 @@
<view class="popup border shadow-md" v-if="show"> <view class="popup border shadow-md" v-if="show">
<view class="flex pb-3 border-b-1"> <view class="flex pb-3 border-b-1">
<u-icon name="plus-circle" size="36" style="margin: 0 15px 3px 0"></u-icon> <u-icon name="plus-circle" size="36" style="margin: 0 15px 3px 0"></u-icon>
<view @click="createTask">新建任务</view> <!-- <view @click="createTask">新建任务</view> -->
<view>新建任务</view>
</view> </view>
<view class="flex pt-3"> <view class="flex pt-3">
<u-icon name="share" size="32" style="margin: 0 15px 3px 0"></u-icon> <u-icon name="share" size="32" style="margin: 0 15px 3px 0"></u-icon>

46
src/components/Title/components/CreateTask.vue

@ -195,7 +195,7 @@ export default {
}, },
methods: { methods: {
...mapMutations('task', ['addNewTasks']), ...mapMutations('task', ['updateTasks']),
// //
change(index) { change(index) {
@ -366,6 +366,50 @@ export default {
console.error('error: ', error); console.error('error: ', error);
} }
}, },
// tasks
addNewTasks(data) {
const oldTasks = this.$u.deepClone(this.tasks);
let res = data.data;
//
if (data.processTaskId) {
const index = oldTasks.find(item => item.detailId === data.processTaskId);
if (index) {
oldTasks.splice(index + 1, 0, res);
}
} else {
this.setAddPosition(res, oldTasks);
}
},
//
setAddPosition(res, oldTasks) {
if (res.planStart - 0 < oldTasks[0].planStart - 0) {
//
oldTasks.splice(0, 0, res);
} else if (res.planStart - 0 === oldTasks[0].planStart - 0) {
//
oldTasks.splice(1, 0, res);
} else if (res.planStart - 0 >= oldTasks[oldTasks.length - 1].planStart - 0) {
//
oldTasks.splice(-1, 0, res);
} else {
//
for (let i = 0; i < oldTasks.length; i++) {
const item = oldTasks[i];
if (res.planStart - 0 > item.planStart - 0) {
if (res.planStart - 0 <= oldTasks[i + 1].planStart - 0) {
oldTasks.splice(i + 1, 0, res);
console.log('res: ', res);
return;
}
}
}
}
// TODO:
console.log('oldTasks: ', oldTasks);
this.updateTasks([...oldTasks]);
},
}, },
}; };
</script> </script>

3
src/pages/project/project.vue

@ -86,7 +86,6 @@ export default {
methods: { methods: {
...mapActions('user', ['getToken']), ...mapActions('user', ['getToken']),
...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']), ...mapActions('task', ['getRegulars', 'getPermanent', 'getGlobal']),
...mapActions('role', ['getAllMembers']),
...mapMutations('user', ['setToken']), ...mapMutations('user', ['setToken']),
...mapMutations('project', ['setProject', 'setProjectName']), ...mapMutations('project', ['setProject', 'setProjectName']),
...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']), ...mapMutations('role', ['setInvisibleRoles', 'setVisibleRoles', 'setRoleId']),
@ -335,8 +334,6 @@ export default {
this.setProject(data); this.setProject(data);
// id // id
this.getRoles(params); this.getRoles(params);
// id
this.getAllMembers(params);
} catch (error) { } catch (error) {
console.log('error: ', error || '获取项目信息失败'); console.log('error: ', error || '获取项目信息失败');
} }

45
src/store/task/mutations.js

@ -105,40 +105,17 @@ const mutations = {
* @param {Object} state * @param {Object} state
* @param {Array} data 新添加的task * @param {Array} data 新添加的task
*/ */
addNewTasks(state, data) { updateTasks(state, data) {
let res = data.data; state.tasks = [...data];
// 判断有没有选择上道工序 },
if (data.processTaskId) {
const index = state.tasks.find(item => item.detailId === data.processTaskId); /**
if (index) { * 设置添加任务的位置
state.tasks.splice(index + 1, 0, res); * @param {*} state
} * @param {*} data
} else { */
console.log('res.planStart: ', res.planStart); setAddPosition(state, data) {
console.log('state.tasks[0].planStart: ', state.tasks[0].planStart); console.log('data: ', data);
if (res.planStart - 0 < state.tasks[0].planStart - 0) {
// 开始时间小于列表的第一个 插入最前面
state.tasks.splice(0, 0, res);
} else if (res.planStart - 0 === state.tasks[0].planStart - 0) {
// 开始时间等于列表的第一个 插入第二
state.tasks.splice(1, 0, res);
} else if (res.planStart - 0 >= state.tasks[state.tasks.length - 1].planStart - 0) {
// 开始时间大等于列表的最后一个 插入最后
state.tasks.splice(-1, 0, res);
} else {
// 判断开始时间在列表中的哪个位置
for (let i = 0; i < state.tasks.length; i++) {
const item = state.tasks[i];
if (res.planStart - 0 > item.planStart - 0) {
if (res.planStart - 0 <= state.tasks[i + 1].planStart - 0) {
state.tasks.splice(i + 1, 0, res);
console.log('res: ', res);
return;
}
}
}
}
}
}, },
/** /**

Loading…
Cancel
Save