From 01e122f8aef626c3ddd577e75ae7cac9507afcdb Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 16 Apr 2025 09:48:02 +0800 Subject: [PATCH] * [refac bug #61502] render attribute field for ipd. --- module/execution/js/batchedit.ui.js | 35 ++++++++++++++++---------- module/execution/ui/batchedit.html.php | 1 + 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/module/execution/js/batchedit.ui.js b/module/execution/js/batchedit.ui.js index b6a3b5ec97..797d40033c 100644 --- a/module/execution/js/batchedit.ui.js +++ b/module/execution/js/batchedit.ui.js @@ -1,26 +1,35 @@ window.renderRowData = function($row, index, row) { - if((row.type == 'stage' || row.attribute != '') && stageList[row.attribute]) + let options = {}; + options.required = true; + + if(row.type == 'stage' || row.attribute != '') { + let itemList = []; + let projectModel = 'stage'; + if(stageList[row.attribute] !== undefined) itemList = stageList; + if(ipdTypeList[row.attribute] !== undefined) + { + itemList = ipdTypeList; + projectModel = 'ipd'; + } + const parentType = row.grade > 1 && parents[row.parent] ? parents[row.parent].attribute : ''; /* If is stage, modify lifetime to attribute. */ let stageItems = []; - for(let key in stageList) stageItems.push({value: key, text: stageList[key]}); + for(let key in itemList) stageItems.push({value: key, text: itemList[key]}); - $row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info) + if(stageItems.length > 0) { - let $attribute = info[0]; - $attribute.render({items: stageItems, required: true, name: 'attribute[' + row.id + ']', disabled: row.grade > 1 && parentType != 'mix'}); - $row.attr('data-parent', row.parent); - }); + options.items = stageItems; + options.name = 'attribute[' + row.id + ']'; + options.disabled = row.grade > 1 && parentType != 'mix'; + if(projectModel == 'ipd') options.disabled = true; + } + $row.attr('data-parent', row.parent); } - $row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info) - { - let $lifetime = info[0]; - $lifetime.render({required: true}); - }); - + $row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info) { info[0].render(options); }); $row.find('[data-name="project"]').attr('data-lastselected', row.project).attr('data-execution', row.id); } diff --git a/module/execution/ui/batchedit.html.php b/module/execution/ui/batchedit.html.php index f82a043e4f..f77ec53086 100644 --- a/module/execution/ui/batchedit.html.php +++ b/module/execution/ui/batchedit.html.php @@ -15,6 +15,7 @@ $showMethod = $app->tab == 'project' && isset($project) && ($project->model == ' jsVar('weekend', $config->execution->weekend); jsVar('stageList', $lang->stage->typeList); +jsVar('ipdTypeList', $lang->stage->ipdTypeList); jsVar('confirmSync', $lang->execution->confirmSync); jsVar('noticeChangeAttr', $lang->programplan->noticeChangeAttr); jsVar('parents', $parents);