diff --git a/module/execution/js/batchedit.ui.js b/module/execution/js/batchedit.ui.js index 19e98162a9..61da8738e6 100644 --- a/module/execution/js/batchedit.ui.js +++ b/module/execution/js/batchedit.ui.js @@ -53,12 +53,22 @@ window.changeProject = function(e) } }; -window.changeAttribute = function(e) +window.changeAttribute = function(obj) { - const $attribute = $(e.target); - const attribute = $attribute.val(); + const $attribute = $(obj); const parentID = $attribute.closest('tr').find('input[name^=id]').val(); - $('[data-parent="' + parentID + '"]').each(function() + const attribute = $attribute.val(); + const $children = $('[data-parent="' + parentID + '"]'); + if($children.length == 0) return; + + if(attribute != 'mix') zui.Modal.alert(noticeChangeAttr.replace('%s', stageList[attribute])); + changeChildrenAttribute($children, attribute); +}; + +window.changeChildrenAttribute = function($children, attribute) +{ + if($children.length == 0) return; + $children.each(function() { const $attributePicker = $(this).find('input[name^=attribute]').zui('picker'); if(attribute == 'mix') @@ -70,5 +80,8 @@ window.changeAttribute = function(e) $attributePicker.render({disabled: true}); $attributePicker.$.setValue(attribute); } - }) + + const parentID = $(this).closest('tr').find('input[name^=id]').val(); + changeChildrenAttribute($('[data-parent="' + parentID + '"]'), attribute); + }); }; diff --git a/module/execution/ui/batchedit.html.php b/module/execution/ui/batchedit.html.php index fbded4bd6f..f82a043e4f 100644 --- a/module/execution/ui/batchedit.html.php +++ b/module/execution/ui/batchedit.html.php @@ -16,6 +16,7 @@ $showMethod = $app->tab == 'project' && isset($project) && ($project->model == ' jsVar('weekend', $config->execution->weekend); jsVar('stageList', $lang->stage->typeList); jsVar('confirmSync', $lang->execution->confirmSync); +jsVar('noticeChangeAttr', $lang->programplan->noticeChangeAttr); jsVar('parents', $parents); $items = array(); @@ -183,7 +184,7 @@ formBatchPanel on::change('[data-name="project"]', 'changeProject'), on::change('[data-name="begin"]', "computeWorkDays($(e.target).attr('name'))"), on::change('[data-name="end"]', "computeWorkDays($(e.target).attr('name'))"), - on::change('[data-name="attribute"]', 'changeAttribute'), + on::change('[data-name="attribute"]', 'changeAttribute(e.target)'), set::items($items) ); diff --git a/module/programplan/lang/de.php b/module/programplan/lang/de.php index 3351d8aa15..f56b8786d6 100644 --- a/module/programplan/lang/de.php +++ b/module/programplan/lang/de.php @@ -112,6 +112,7 @@ $lang->programplan->children = 'Sub Plan'; $lang->programplan->childrenAB = 'Child'; $lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; $lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; +$lang->programplan->noticeChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification'; $lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; $lang->programplan->stageCustom['date'] = 'Show Date'; diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index e7082e99c4..102b1ab61c 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -112,6 +112,7 @@ $lang->programplan->children = 'Sub Plan'; $lang->programplan->childrenAB = 'Child'; $lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; $lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; +$lang->programplan->noticeChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification.'; $lang->programplan->workloadTips = 'The workload of the sub stage is divided by 100%.'; $lang->programplan->stageCustom['date'] = 'Show Date'; diff --git a/module/programplan/lang/fr.php b/module/programplan/lang/fr.php index 3351d8aa15..0079dd7b39 100644 --- a/module/programplan/lang/fr.php +++ b/module/programplan/lang/fr.php @@ -112,6 +112,7 @@ $lang->programplan->children = 'Sub Plan'; $lang->programplan->childrenAB = 'Child'; $lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; $lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; +$lang->programplan->noticeChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification.'; $lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; $lang->programplan->stageCustom['date'] = 'Show Date'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index 88099c16bc..f9d37aec1b 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -112,6 +112,7 @@ $lang->programplan->children = '二级计划'; $lang->programplan->childrenAB = '子'; $lang->programplan->confirmDelete = '确定要删除当前计划吗?'; $lang->programplan->confirmChangeAttr = '修改后子阶段的类型将根据父阶段类型同步调整为“%s”,是否保存?'; +$lang->programplan->noticeChangeAttr = '修改后子阶段的类型将根据父阶段类型同步调整为“%s”'; $lang->programplan->workloadTips = '子阶段工作量占比按百分百的比例进行拆分'; $lang->programplan->stageCustom['date'] = '显示日期';