This commit is contained in:
Pang 2021-06-17 01:06:05 +08:00
parent 7c6dcc3daa
commit b417020b9d
4 changed files with 119 additions and 26 deletions

View File

@ -38,7 +38,7 @@
"echarts": "^5.1.1",
"element-ui": "^2.15.2",
"tinymce": "^5.8.1",
"tui-calendar-hi": "^1.13.0-3",
"tui-calendar-hi": "^1.13.0-5",
"view-design-hi": "^4.6.1-1",
"vue-clipboard2": "^0.3.1",
"vue-emoji-picker": "^1.0.1",

View File

@ -22,7 +22,9 @@
<Calendar
ref="cal"
:view="calendarView"
:calendars="calendarLists"
:theme="calendarTheme"
:template="calendarTemplate"
:calendars="calendarList"
:schedules="scheduleLists"
@beforeClickSchedule="onBeforeClickSchedule"
@beforeUpdateSchedule="onBeforeUpdateSchedule"/>
@ -64,6 +66,9 @@ export default {
rangeTime: [],
calendarView: 'month',
calendarTheme: {},
calendarTemplate: {},
calendarList: [],
scheduleLoad: 0,
scheduleList: [],
@ -74,21 +79,13 @@ export default {
this.setRenderRange();
},
activated() {
this.$refs.cal.resetRender();
},
computed: {
...mapState(['projectList']),
calendarLists() {
const {projectList} = this;
return projectList.map((project) => {
return {
id: project.id,
name: project.name,
bgColor: '#F2F3F5',
borderColor: '#F2F3F5'
}
});
},
scheduleLists() {
return this.scheduleList.filter(({complete_at}) => !complete_at)
}
@ -97,10 +94,42 @@ export default {
watch: {
rangeTime(time) {
this.getTask(time);
},
projectList(data) {
const list = data.map((project) => {
return {
id: project.id,
name: project.name,
}
});
if (JSON.stringify(list) != JSON.stringify(this.calendarList)) {
this.calendarList = list;
}
}
},
methods: {
initLanguage() {
this.calendarTheme = {
'common.border': '1px solid #f4f5f5',
'month.dayname.fontSize': '14px',
'month.dayname.borderLeft': '1px solid #f4f5f5',
'month.dayname.height': '50px',
}
this.calendarTemplate = {
titlePlaceholder: () => {
return this.$L("任务描述")
},
popupEdit: () => {
return this.$L("详情");
},
popupDelete: () => {
return this.$L("删除");
}
}
},
getTask(time) {
if (this.scheduleLoad > 0) {
setTimeout(() => {
@ -134,6 +163,7 @@ export default {
if (task.overdue) {
schedule.color = "#f56c6c"
schedule.bgColor = "#fef0f0"
schedule.priority+= '<span class="overdue">' + this.$L('超期未完成') + '</span>';
}
let index = this.scheduleList.findIndex(({id}) => id === task.id);
if (index > -1) {
@ -195,13 +225,48 @@ export default {
},
onBeforeClickSchedule({type, schedule}) {
let data = this.scheduleList.find(({id}) => id === schedule.id);
if (!data) {
return;
}
switch (type) {
case "check":
this.$set(data, 'complete_at', $A.formatDate("Y-m-d H:i:s"))
this.$store.dispatch("taskUpdate", {
task_id: data.id,
complete_at: $A.formatDate("Y-m-d H:i:s"),
}).then(({msg}) => {
$A.messageSuccess(msg);
}).catch(({msg}) => {
this.$set(data, 'complete_at', null)
$A.modalError(msg);
});
break;
case "edit":
this.$store.dispatch("openTask", schedule.id)
break;
case "delete":
$A.modalConfirm({
title: '删除任务',
content: '你确定要删除任务【' + data.title + '】吗?',
loading: true,
onOk: () => {
this.scheduleList = this.scheduleList.filter(({id}) => id !== data.id);
this.$store.dispatch("taskArchivedOrRemove", {
task_id: data.id,
type: 'delete',
}).then(({msg}) => {
$A.messageSuccess(msg);
this.$Modal.remove();
}).catch(({msg}) => {
$A.modalError(msg, 301);
this.$Modal.remove();
this.setRenderRange();
});
}
});
break;
}
},

View File

@ -48,22 +48,13 @@ export default {
theme: {
type: Object,
default() {
return {
'common.border': '1px solid #f4f5f5',
'month.dayname.fontSize': '14px',
'month.dayname.borderLeft': '1px solid #f4f5f5',
'month.dayname.height': '50px',
};
return {};
}
},
template: {
type: Object,
default() {
return {
titlePlaceholder: function () {
return "Task Description"
}
};
return {};
}
},
week: {
@ -209,6 +200,10 @@ export default {
getInstance() {
return this.calendarInstance;
},
resetRender() {
this.calendarInstance.clear();
this.reflectSchedules();
},
invoke(methodName, ...args) {
let result;

View File

@ -57,6 +57,19 @@
z-index: 1;
}
.tui-full-calendar-popup-creation {
.tui-full-calendar-icon {
&.tui-full-calendar-ic-title,
&.tui-full-calendar-calendar-dot {
display: none;
}
&.tui-full-calendar-ic-date {
background-image: url("data:image/svg+xml;base64,PHN2ZyB0PSIxNjIzODU5NjcwNjA3IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE2Mzg4IiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTk2MCAxMjhIODMzYzAtNTMtNDMtOTYtOTYtOTZoLTE2Yy01MyAwLTk2IDQzLTk2IDk2SDQwMGMwLTI2LjUtMTAuNy01MC41LTI4LjEtNjcuOUMzNTQuNSA0Mi43IDMzMC41IDMyIDMwNCAzMmgtMTZjLTUzIDAtOTYgNDMtOTYgOTZINjRjLTM1LjMgMC02NCAyOC42LTY0IDY0djczNmMwIDM1LjMgMjguNyA2NCA2NCA2NGg4OTZjMzUuMyAwIDY0LTI4LjcgNjQtNjRWMTkyYzAtMzUuNC0yOC43LTY0LTY0LTY0eiBtLTI3MSA4YzAtMjIuMSAxNy45LTQwIDQwLTQwczQwIDE3LjkgNDAgNDB2ODBjMCAyMi4xLTE3LjkgNDAtNDAgNDAtMTEgMC0yMS00LjUtMjguMy0xMS43QzY5My41IDIzNyA2ODkgMjI3IDY4OSAyMTZ2LTgweiBtLTQzMyAwYzAtMjIuMSAxNy45LTQwIDQwLTQwczQwIDE3LjkgNDAgNDB2ODBjMCAyMi4xLTE3LjkgNDAtNDAgNDAtMTEgMC0yMS00LjUtMjguMy0xMS43QzI2MC41IDIzNyAyNTYgMjI3IDI1NiAyMTZ2LTgweiBtNzA0IDc2MGMwIDE3LjctMTQuMyAzMi0zMiAzMkg5NmMtMTcuNyAwLTMyLTE0LjMtMzItMzJWNDQ4aDg5NnY0NDh6IiBwLWlkPSIxNjM4OSIgZmlsbD0iIzUxNTE1MSI+PC9wYXRoPjwvc3ZnPg==");
background-size: contain;
}
}
.tui-full-calendar-content {
padding-left: 0;
}
.tui-full-calendar-popup-section {
display: flex;
justify-content: space-between;
@ -68,6 +81,9 @@
.tui-full-calendar-section-start-date,
.tui-full-calendar-section-end-date {
width: 210px;
.tui-full-calendar-content {
padding-left: 8px;
}
}
.tui-full-calendar-popup-location,
.tui-full-calendar-section-private,
@ -79,13 +95,30 @@
.tui-full-calendar-popup-task {
.priority {
color: #ffffff;
padding: 2px 3px;
padding: 2px 4px;
border-radius: 4px;
margin-right: 6px;
}
.overdue {
color: #f5222d;
background: #fff1f0;
border: 1px solid #ffa39e;
padding: 1px 3px;
border-radius: 4px;
margin-right: 6px;
}
.tui-full-calendar-calendar-dot,
.tui-full-calendar-ic-priority {
opacity: 0;
}
.tui-full-calendar-ic-edit {
top: -2px;
background-image: url("data:image/svg+xml;base64,PHN2ZyB0PSIxNjIzODU5MzY4MTg5IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjExMTkiIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cGF0aCBkPSJNODMzLjQyODU3MTY4IDYySDE5MC41NzE0MjgzMmExMjguNTcxNDI4MzIgMTI4LjU3MTQyODMyIDAgMCAwLTEyOC41NzE0MjgzMiAxMjguNTcxNDI4MzJ2NjQyLjg1NzE0MzM2YTEyOC41NzE0MjgzMiAxMjguNTcxNDI4MzIgMCAwIDAgMTI4LjU3MTQyODMyIDEyOC41NzE0MjgzMmg2NDIuODU3MTQzMzZhMTI4LjU3MTQyODMyIDEyOC41NzE0MjgzMiAwIDAgMCAxMjguNTcxNDI4MzItMTI4LjU3MTQyODMyVjE5MC41NzE0MjgzMmExMjguNTcxNDI4MzIgMTI4LjU3MTQyODMyIDAgMCAwLTEyOC41NzE0MjgzMi0xMjguNTcxNDI4MzJ6IG02NC4yODU3MTQxNiA3NzEuNDI4NTcxNj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