Browse Source

feat: 新建任务

tall
xuesinan 4 years ago
parent
commit
59897c2a7b
  1. 3
      CHANGELOG.md
  2. 4
      src/components/Title/Title.vue
  3. 12
      src/components/Title/components/CreateTask.vue
  4. 65
      src/pages/project/project.vue

3
CHANGELOG.md

@ -1,4 +1,4 @@
# 0.1.0 (2021-11-10) # 0.1.0 (2021-11-17)
### 🌟 新功能 ### 🌟 新功能
范围|描述|commitId 范围|描述|commitId
@ -85,6 +85,7 @@
- | 删除插件携带的多余文件 | 0f392bb - | 删除插件携带的多余文件 | 0f392bb
- | 删除多余字段 | 5ae3973 - | 删除多余字段 | 5ae3973
- | 删除没用代码 | 34b20e1 - | 删除没用代码 | 34b20e1
- | 删除无用代码 | ae3675b
- | 删除calendar中多余的console | e339eec - | 删除calendar中多余的console | e339eec
- | 删除console.log | a9ead1a - | 删除console.log | a9ead1a
- | 删除console.log | 5064a38 - | 删除console.log | 5064a38

4
src/components/Title/Title.vue

@ -22,8 +22,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> </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>

12
src/components/Title/components/CreateTask.vue

@ -114,7 +114,7 @@
</template> </template>
<script> <script>
import { mapState, mapGetters, mapMutations } from 'vuex'; import { mapState, mapGetters, mapMutations, mapActions } from 'vuex';
export default { export default {
props: { props: {
@ -196,6 +196,7 @@ export default {
methods: { methods: {
...mapMutations('task', ['updateTasks']), ...mapMutations('task', ['updateTasks']),
...mapActions('task', ['getPermanent']),
// //
change(index) { change(index) {
@ -371,6 +372,7 @@ export default {
addNewTasks(data) { addNewTasks(data) {
const oldTasks = this.$u.deepClone(this.tasks); const oldTasks = this.$u.deepClone(this.tasks);
let res = data.data; let res = data.data;
console.log('添加任务后更新tasks', data);
// //
if (data.processTaskId) { if (data.processTaskId) {
const index = oldTasks.find(item => item.detailId === data.processTaskId); const index = oldTasks.find(item => item.detailId === data.processTaskId);
@ -384,6 +386,8 @@ export default {
// //
setAddPosition(res, oldTasks) { setAddPosition(res, oldTasks) {
console.log('设置添加位置', res, oldTasks);
if (res.planStart - 0 < oldTasks[0].planStart - 0) { if (res.planStart - 0 < oldTasks[0].planStart - 0) {
// //
oldTasks.splice(0, 0, res); oldTasks.splice(0, 0, res);
@ -400,8 +404,8 @@ export default {
if (res.planStart - 0 > item.planStart - 0) { if (res.planStart - 0 > item.planStart - 0) {
if (res.planStart - 0 <= oldTasks[i + 1].planStart - 0) { if (res.planStart - 0 <= oldTasks[i + 1].planStart - 0) {
oldTasks.splice(i + 1, 0, res); oldTasks.splice(i + 1, 0, res);
console.log('res: ', res); // console.log('res: ', res);
return; // return;
} }
} }
} }
@ -409,6 +413,8 @@ export default {
// TODO: // TODO:
console.log('oldTasks: ', oldTasks); console.log('oldTasks: ', oldTasks);
this.updateTasks([...oldTasks]); this.updateTasks([...oldTasks]);
const params = { roleId: this.roleId, projectId: this.projectId };
this.getPermanent(params);
}, },
}, },
}; };

65
src/pages/project/project.vue

@ -14,7 +14,7 @@
<TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="timeLine" /> <TimeLine @getTasks="getTasks" class="flex-1 overflow-hidden" ref="timeLine" />
<!-- 医院项目的问卷悬浮按钮 --> <!-- 医院项目的问卷悬浮按钮 -->
<view class="absolute bottom-10 right-5" v-if="showQuestion"> <!-- <view class="absolute bottom-10 right-5" v-if="showQuestion">
<view <view
@click="openQuestionnaire(false)" @click="openQuestionnaire(false)"
class="relative text-white bg-blue-400 flex justify-center items-center w-12 h-12 rounded-full shadow-2xl" class="relative text-white bg-blue-400 flex justify-center items-center w-12 h-12 rounded-full shadow-2xl"
@ -40,7 +40,7 @@
<view class="fixed bottom-0 bg-white h-6 w-full"></view> <view class="fixed bottom-0 bg-white h-6 w-full"></view>
</view> </view>
</u-popup> </u-popup>
</view> </view> -->
</view> </view>
</view> </view>
</template> </template>
@ -52,7 +52,15 @@ import { flatten } from 'lodash';
export default { export default {
data() { data() {
return { height: '', show: false, showQuestion: false, questionnaires: [], count: 0, showQuestionList: false, chooseItem: false }; return {
height: '',
// show: false,
// showQuestion: false,
// questionnaires: [],
// count: 0,
// showQuestionList: false,
// chooseItem: false,
};
}, },
computed: { computed: {
@ -81,6 +89,7 @@ export default {
* 永久日常任务不发生改变 * 永久日常任务不发生改变
*/ */
timeNode(val) { timeNode(val) {
console.log('切换角色', val);
if (val && this.roleId) { if (val && this.roleId) {
this.clearTasksData(); this.clearTasksData();
this.getGlobalData(); // this.getGlobalData(); //
@ -115,16 +124,16 @@ export default {
}, },
// //
questionnaires(val) { // questionnaires(val) {
if (val && val.length) { // if (val && val.length) {
this.showQuestion = true; // this.showQuestion = true;
val.forEach(item => { // val.forEach(item => {
if (item.isWrite === 0 || item.isWrite === -1) { // if (item.isWrite === 0 || item.isWrite === -1) {
this.count += 1; // this.count += 1;
} // }
}); // });
} // }
}, // },
}, },
mounted() { mounted() {
@ -176,9 +185,12 @@ export default {
// || // ||
getInitTasks() { getInitTasks() {
console.log('切换角色');
// //
function preloadFn(that) { function preloadFn(that) {
const detailId = that.tasks.findIndex(task => task.detailId); const detailId = that.tasks.findIndex(task => task.detailId);
console.log('预加载', that, detailId);
const arr = []; const arr = [];
that.tasks.forEach(task => { that.tasks.forEach(task => {
if (task.detailId) { if (task.detailId) {
@ -221,7 +233,8 @@ export default {
* @param {number} query.queryType 0向上查找 1向下查找(默认) 下查包含自己上查不包含 * @param {number} query.queryType 0向上查找 1向下查找(默认) 下查包含自己上查不包含
*/ */
getTasks(query, fn) { getTasks(query, fn) {
this.setShowSkeleton(true); console.log('根据时间基准点和角色查找定期任务', query, fn);
this.setShowSkeleton(false);
const params = this.generateGetTaskParam(query); const params = this.generateGetTaskParam(query);
this.$t.$q.getRegularTask(params, (err, data) => { this.$t.$q.getRegularTask(params, (err, data) => {
@ -424,9 +437,17 @@ export default {
if (err) { if (err) {
console.error('err: ', err || '获取角色信息失败'); console.error('err: ', err || '获取角色信息失败');
} else { } else {
console.log('data', data, params);
this.setInvisibleRoles(data ? data.invisibleList : []); this.setInvisibleRoles(data ? data.invisibleList : []);
this.setVisibleRoles(data ? data.visibleList : []); this.setVisibleRoles(data ? data.visibleList : []);
this.setInitialRoleId(data ? data.visibleList : []); this.setInitialRoleId(data ? data.visibleList : []);
let obj = {};
obj.visible = data.visibleList;
obj.invisible = data ? data.invisibleList : [];
this.$t.storage.setStorageSync('roles_' + params.projectId, obj);
let roles = this.$t.storage.getStorageSync('roles_' + params.projectId);
console.log(JSON.parse(roles));
} }
}); });
}, },
@ -478,14 +499,14 @@ export default {
// }, // },
// //
openQuestionnaire(value) { // openQuestionnaire(value) {
this.chooseItem = value; // this.chooseItem = value;
if (this.count === 1 || this.chooseItem) { // if (this.count === 1 || this.chooseItem) {
window.location.href = 'https://www.baidu.com/'; // window.location.href = 'https://www.baidu.com/';
} else { // } else {
this.showQuestionList = true; // this.showQuestionList = true;
} // }
}, // },
}, },
}; };
</script> </script>

Loading…
Cancel
Save