From 0c60efae9749f308af33b10b0572b510d554893d Mon Sep 17 00:00:00 2001
From: sven <121642038@qq.com>
Date: Wed, 19 Jan 2022 16:56:31 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=98=E7=89=B9=E5=9B=BE=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=8B=E9=A1=B9=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/view/twig/project/gantt.twig | 2 +-
config.tpl.yml | 2 +-
config.travis.yml | 2 +-
config.yml | 2 +-
public/dev/js/project/gantt_ajax.js | 22 ++++++-
public/dev/lib/jQueryGantt/ganttMaster.js | 79 ++++++++++++++++++++++-
resource/bt/config.bt.yml | 2 +-
7 files changed, 103 insertions(+), 8 deletions(-)
diff --git a/app/view/twig/project/gantt.twig b/app/view/twig/project/gantt.twig
index 0fa7e15c..b2c562a6 100644
--- a/app/view/twig/project/gantt.twig
+++ b/app/view/twig/project/gantt.twig
@@ -126,7 +126,7 @@
-
+
{% if (projectPermArr['ADMIN_GANTT'] is defined and projectPermArr['ADMIN_GANTT'] =='1') %} {% endif %}
diff --git a/config.tpl.yml b/config.tpl.yml
index 247c3be8..6b5777a5 100644
--- a/config.tpl.yml
+++ b/config.tpl.yml
@@ -1,6 +1,6 @@
# Masterlab主配置文件
app_url: ''
-version: '3.2.1'
+version: '3.3'
error_reporting: 'E_ERROR'
xdebug: false
trace: false
diff --git a/config.travis.yml b/config.travis.yml
index f2d43956..a4fc4fd9 100644
--- a/config.travis.yml
+++ b/config.travis.yml
@@ -1,6 +1,6 @@
# Masterlab主配置文件
app_url: ''
-version: '3.2.1'
+version: '3.3'
error_reporting: 'E_ERROR'
xdebug: false
trace: false
diff --git a/config.yml b/config.yml
index 4cce783a..472d37d4 100644
--- a/config.yml
+++ b/config.yml
@@ -1,6 +1,6 @@
# Masterlab主配置文件
app_url: ''
-version: '3.2.1'
+version: '3.3'
error_reporting: 'E_ERROR'
xdebug: false
trace: false
diff --git a/public/dev/js/project/gantt_ajax.js b/public/dev/js/project/gantt_ajax.js
index bce22ea2..5c7e8156 100644
--- a/public/dev/js/project/gantt_ajax.js
+++ b/public/dev/js/project/gantt_ajax.js
@@ -617,8 +617,28 @@ var Gantt = (function () {
});
};
- Gantt.prototype.deleteTask = function(taskId, params ) {
+ Gantt.prototype.deleteTask = function(issue_id ) {
+ $.ajax({
+ type: 'post',
+ dataType: "json",
+ async: true,
+ url: root_url + "issue/main/delete",
+ data: { issue_id: issue_id },
+ success: function (resp) {
+ auth_check(resp);
+ if (resp.ret != '200') {
+ notify_error('删除失败:' + resp.msg);
+ return;
+ }
+ notify_success('操作成功');
+ },
+ error: function (res) {
+ notify_error("请求数据错误" + res);
+ }
+ });
+ };
+ Gantt.prototype.hideTask = function(taskId, params ) {
$.ajax({
type: 'post',
dataType: "json",
diff --git a/public/dev/lib/jQueryGantt/ganttMaster.js b/public/dev/lib/jQueryGantt/ganttMaster.js
index 8b4b967e..281e72d3 100644
--- a/public/dev/lib/jQueryGantt/ganttMaster.js
+++ b/public/dev/lib/jQueryGantt/ganttMaster.js
@@ -124,12 +124,39 @@ GanttMaster.prototype.init = function (workSpace) {
//bindings
workSpace.bind("deleteFocused.gantt", function (e) {
+ //delete task or link?
+ swal({
+ title: "您确定删除该事项吗?",
+ text: "你将无法恢复它",
+ html: true,
+ type: "warning",
+ showCancelButton: true,
+ confirmButtonColor: "#DD6B55",
+ confirmButtonText: "确 定",
+ cancelButtonText: "取 消!",
+ closeOnConfirm: false,
+ closeOnCancel: false
+ },
+ function (isConfirm) {
+ if (isConfirm) {
+ swal.close();
+ var focusedSVGElement=self.gantt.element.find(".focused.focused.linkGroup");
+ if (focusedSVGElement.size()>0)
+ self.removeLink(focusedSVGElement.data("from"), focusedSVGElement.data("to"));
+ else
+ self.deleteCurrentTask();
+ } else {
+ swal.close();
+ }
+ });
+
+ }).bind("hideFocused.gantt", function (e) {
//delete task or link?
var focusedSVGElement=self.gantt.element.find(".focused.focused.linkGroup");
if (focusedSVGElement.size()>0)
self.removeLink(focusedSVGElement.data("from"), focusedSVGElement.data("to"));
else
- self.deleteCurrentTask();
+ self.hideCurrentTask();
}).bind("showAddAboveCurrentTask.gantt", function () {
self.showAddAboveCurrentTask();
}).bind("showAddBelowCurrentTask.gantt", function () {
@@ -1212,7 +1239,7 @@ GanttMaster.prototype.deleteCurrentTask = function (taskId) {
var row = task.getRow();
if (task && (row > 0 || self.isMultiRoot || task.isNew()) ) {
if(!task.isNew() && task.name!=''){
- window.$_gantAjax.deleteTask(task.id, {gant_hide:1});
+ window.$_gantAjax.deleteTask(task.id);
}
var par = task.getParent();
@@ -1243,6 +1270,54 @@ GanttMaster.prototype.deleteCurrentTask = function (taskId) {
};
+GanttMaster.prototype.hideCurrentTask = function (taskId) {
+ //console.debug("hideCurrentTask",this.currentTask , this.isMultiRoot)
+ var self = this;
+
+ var task;
+ if (taskId)
+ task=self.getTask(taskId);
+ else
+ task=self.currentTask;
+
+ if (!task || !self.permissions.canDelete && !task.canDelete)
+ return;
+
+ var taskIsEmpty=task.name=="";
+
+ var row = task.getRow();
+ if (task && (row > 0 || self.isMultiRoot || task.isNew()) ) {
+ if(!task.isNew() && task.name!=''){
+ window.$_gantAjax.hideTask(task.id, {gant_hide:1});
+ }
+
+ var par = task.getParent();
+ self.beginTransaction();
+ task.deleteTask();
+ task = undefined;
+
+ //recompute depends string
+ self.updateDependsStrings();
+
+ //redraw
+ self.taskIsChanged();
+
+ //[expand]
+ if (par)
+ self.editor.refreshExpandStatus(par);
+
+
+ //focus next row
+ row = row > self.tasks.length - 1 ? self.tasks.length - 1 : row;
+ if (!taskIsEmpty && row >= 0) {
+ task = self.tasks[row];
+ task.rowElement.click();
+ task.rowElement.find("[name=name]").focus();
+ }
+ self.endTransaction();
+ }
+};
+
GanttMaster.prototype.collapseAll = function () {
diff --git a/resource/bt/config.bt.yml b/resource/bt/config.bt.yml
index 9503932f..32018330 100644
--- a/resource/bt/config.bt.yml
+++ b/resource/bt/config.bt.yml
@@ -1,6 +1,6 @@
# Masterlab主配置文件
app_url: ''
-version: '3.2.1'
+version: '3.3'
error_reporting: 'E_ERROR'
xdebug: false
trace: false