itemId == id)
+ }
+ }
+ parent = parent.parentNode
+ }
+ if (!item) {
+ this.onDateMove(e.touches[0].clientX);
return
}
- if (this.dateMove != null) {
- let moveX = (this.dateMove.clientX - e.touches[0].clientX) * 5;
- this.dateMove.clientX = e.touches[0].clientX;
- this.mouseWidth+= moveX;
- this.mouseScaleWidth+= moveX * (100 / this.dateWidth);
- }
+ this.onItemMove(item, e.target, e.touches[0].clientX);
+ },
+ dateTouchmove(e) {
+ this.onMoving(e.touches[0].clientX)
},
dateTouchend() {
- if (this.dateMove != null) {
- this.dateMove = null;
- }
+ this.onMoveOver(null);
},
dateMouseDown(e) {
e.preventDefault();
- this.mouseItem = null;
- this.dateMove = {
- clientX: e.clientX
- };
+ this.onDateMove(e.clientX);
},
itemMouseDown(e, item) {
e.preventDefault();
+ this.onItemMove(item, e.target, e.clientX);
+ },
+ itemMouseMove(e) {
+ if (this.mouseItem != null || this.dateMove != null) {
+ e.preventDefault();
+ this.onMoving(e.clientX);
+ }
+ },
+ itemMouseUp(e) {
+ this.onMoveOver(e.target);
+ },
+ onDateMove(clientX) {
+ this.mouseItem = null;
+ this.dateMove = {
+ clientX
+ };
+ },
+ onItemMove(item, target, clientX) {
let type = 'moveX';
- if (e.target.className == 'timeline-resizer') {
+ if (target.classList.contains('timeline-resizer')) {
type = 'moveW';
}
if (typeof item[type] !== "number") {
@@ -338,16 +359,15 @@ export default {
}
this.mouseBak = {
type: type,
- clientX: e.clientX,
+ clientX: clientX,
value: item[type],
};
this.mouseItem = item;
this.dateMove = null;
},
- itemMouseMove(e) {
+ onMoving(clientX) {
if (this.mouseItem != null) {
- e.preventDefault();
- const diff = this.mouseBak.value + (e.clientX - this.mouseBak.clientX);
+ const diff = this.mouseBak.value + (clientX - this.mouseBak.clientX);
if (this.mouseBak.type === 'moveW') {
const oneWidthTime = 86400000 / this.dateWidth;
const {start, end} = this.mouseItem.time;
@@ -360,14 +380,13 @@ export default {
return;
}
if (this.dateMove != null) {
- e.preventDefault();
- let moveX = (this.dateMove.clientX - e.clientX) * 5;
- this.dateMove.clientX = e.clientX;
+ let moveX = (this.dateMove.clientX - clientX) * 5;
+ this.dateMove.clientX = clientX;
this.mouseWidth+= moveX;
this.mouseScaleWidth+= moveX * (100 / this.dateWidth);
}
},
- itemMouseUp(e) {
+ onMoveOver(target) {
if (this.mouseItem != null) {
const {start, end} = this.mouseItem.time;
let isM = false;
@@ -391,7 +410,7 @@ export default {
//
if (isM) {
this.$emit("on-change", this.mouseItem)
- } else if (e.target.className == 'timeline-title') {
+ } else if (target && target.className == 'timeline-title') {
this.clickItem(this.mouseItem);
}
this.mouseItem = null;
diff --git a/resources/assets/js/pages/manage/components/ProjectGantt.vue b/resources/assets/js/pages/manage/components/ProjectGantt.vue
index a92f7b00d..c3f00023b 100644
--- a/resources/assets/js/pages/manage/components/ProjectGantt.vue
+++ b/resources/assets/js/pages/manage/components/ProjectGantt.vue
@@ -27,8 +27,8 @@
-
-
+
+
@@ -67,11 +67,11 @@ export default {
{
title: this.$L('任务名称'),
key: 'label',
- minWidth: 150,
+ minWidth: 100,
ellipsis: true,
}, {
title: this.$L('原计划时间'),
- minWidth: 135,
+ width: 140,
align: 'center',
render: (h, {row}) => {
if (row.notime === true) {
@@ -86,7 +86,7 @@ export default {
}
}, {
title: this.$L('新计划时间'),
- minWidth: 135,
+ width: 140,
align: 'center',
render: (h, {row}) => {
return h('div', {
diff --git a/resources/assets/sass/pages/components/project-gantt.scss b/resources/assets/sass/pages/components/project-gantt.scss
index 149afe22d..72d7337ce 100644
--- a/resources/assets/sass/pages/components/project-gantt.scss
+++ b/resources/assets/sass/pages/components/project-gantt.scss
@@ -48,6 +48,7 @@
position: absolute;
bottom: 6px;
right: 6px;
+ max-width: calc(100% - 6px);
background: #ffffff;
border-radius: 4px;
opacity: 0;
@@ -76,6 +77,7 @@
padding: 6px;
border-radius: 4px;
width: 500px;
+ max-width: 100%;
.project-gstc-edit-btns {
margin: 12px 6px 4px;