+
+ createLink('custom', 'ajaxSaveCustomFields', 'module=programplan§ion=ganttCustom&key=ganttFields')?> + +
programplan->full, 'id="fullScreenBtn"', 'btn btn-primary btn-sm')?> @@ -498,24 +503,23 @@ $(function() gantt.config.scale_height = 18 * gantt.config.scales.length; gantt.config.duration_unit = "day"; - gantt.config.columns = [ - {name: 'text', width: '*', tree: true, resize: true, width:200}, - {name: 'owner_id', align: 'center', resize: true, width: 80, template: function(task){return getByIdForGantt(gantt.serverList('userList'), task.owner_id)}}, - {name: 'status', align: 'center', resize: true, width: 80}, - {name: 'start_date', align: 'center', resize: true, width: 80}, - {name: 'end_date', align: 'center', resize: true, width: 80}, - {name: 'duration', align: 'center', resize: true, width: 60}, - {name: 'estimate', align: 'center', resize: true, width: 60}, - {name: 'percent', align: 'center', resize: true, width:70, template: function(plan) - { - if(plan.percent) return Math.round(plan.percent) + '%'; - } - }, - {name: 'taskProgress', align: 'center', resize: true, width: 60}, - {name: 'realBegan', align: 'center', resize: true, width: 60}, - {name: 'realEnd', align: 'center', resize: true, width: 60}, - {name: 'consumed', align: 'center', resize: false, width: 60}, - ]; + gantt.config.columns = []; + gantt.config.columns.push({name: 'text', width: '*', tree: true, resize: true, width:200}); + if(showFields.indexOf('PM') != -1) gantt.config.columns.push({name: 'owner_id', align: 'center', resize: true, width: 80, template: function(task){return getByIdForGantt(gantt.serverList('userList'), task.owner_id)}}) + if(showFields.indexOf('status') != -1) gantt.config.columns.push({name: 'status', align: 'center', resize: true, width: 80}); + gantt.config.columns.push({name: 'start_date', align: 'center', resize: true, width: 80}); + if(showFields.indexOf('deadline') != -1) gantt.config.columns.push({name: 'end_date', align: 'center', resize: true, width: 80}); + gantt.config.columns.push({name: 'duration', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('estimate') != -1) gantt.config.columns.push({name: 'estimate', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('progress') != -1) gantt.config.columns.push({name: 'percent', align: 'center', resize: true, width:70, template: function(plan) + { + if(plan.percent) return Math.round(plan.percent) + '%'; + } + }); + if(showFields.indexOf('taskProgress') != -1) gantt.config.columns.push({name: 'taskProgress', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('realBegan') != -1) gantt.config.columns.push({name: 'realBegan', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('realEnd') != -1) gantt.config.columns.push({name: 'realEnd', align: 'center', resize: true, width: 60}); + if(showFields.indexOf('consumed') != -1) gantt.config.columns.push({name: 'consumed', align: 'center', resize: false, width: 60}); gantt.locale.labels.column_text = ; gantt.locale.labels.column_owner_id = "programplan->PMAB;?>"; @@ -684,7 +688,7 @@ $(function() if(task) gantt[task.$open ? 'close' : 'open'](task.id); }); - $(".checkbox-primary").on('click', function() + $(".example .checkbox-primary").on('click', function() { var stageCustom = []; $("input[name='stageCustom[]']:checked").each(function() From 8f39557d0bb23c2a6e3f3c5e099257b0e2d85fa4 Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 10 Aug 2022 14:37:17 +0800 Subject: [PATCH 2/2] * Optimize code. --- module/programplan/view/gantt.html.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index d1a4628e35..9b9cf6984d 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -511,11 +511,7 @@ $(function() if(showFields.indexOf('deadline') != -1) gantt.config.columns.push({name: 'end_date', align: 'center', resize: true, width: 80}); gantt.config.columns.push({name: 'duration', align: 'center', resize: true, width: 60}); if(showFields.indexOf('estimate') != -1) gantt.config.columns.push({name: 'estimate', align: 'center', resize: true, width: 60}); - if(showFields.indexOf('progress') != -1) gantt.config.columns.push({name: 'percent', align: 'center', resize: true, width:70, template: function(plan) - { - if(plan.percent) return Math.round(plan.percent) + '%'; - } - }); + if(showFields.indexOf('progress') != -1) gantt.config.columns.push({name: 'percent', align: 'center', resize: true, width:70, template: function(plan){ if(plan.percent) return Math.round(plan.percent) + '%';}}); if(showFields.indexOf('taskProgress') != -1) gantt.config.columns.push({name: 'taskProgress', align: 'center', resize: true, width: 60}); if(showFields.indexOf('realBegan') != -1) gantt.config.columns.push({name: 'realBegan', align: 'center', resize: true, width: 60}); if(showFields.indexOf('realEnd') != -1) gantt.config.columns.push({name: 'realEnd', align: 'center', resize: true, width: 60});