This commit is contained in:
tianshujie
2024-01-31 08:42:37 +08:00
parent 67417c6a12
commit cb822b5b4b
3 changed files with 36 additions and 5 deletions
+8
View File
@@ -1264,6 +1264,13 @@ class execution extends control
$customFields[$field] = $field == 'lifetime' ? $this->lang->execution->type : str_replace($this->lang->executionCommon, $this->lang->execution->common, $this->lang->execution->$field);
}
$parentIdList = array();
foreach($executions as $execution)
{
if($execution->parent == 0) continue;
$parentIdList[] = $execution->parent;
}
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->execution->custom->batchEditFields;
$this->view->title = $this->lang->execution->batchEdit;
@@ -1275,6 +1282,7 @@ class execution extends control
$this->view->qdUsers = $qdUsers;
$this->view->rdUsers = $rdUsers;
$this->view->from = $this->app->tab;
$this->view->parents = $this->execution->getByIdList($parentIdList);
$this->display();
}
+24 -3
View File
@@ -1,16 +1,17 @@
window.renderRowData = function($row, index, row)
{
if(row.type == 'stage')
if(row.type == 'stage' || row.attribute != '')
{
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]});
$row.find('[data-name="lifetime"]').find('.picker-box').on('inited', function(e, info)
{
let $attribute = info[0];
$attribute.render({items: stageItems, required: true, name: 'attribute'});
$attribute.render({items: stageItems, required: true, name: 'attribute', disabled: row.grade > 1 && parentType != 'mix'});
$(e.target).attr('data-parent', row.parent);
});
}
@@ -51,3 +52,23 @@ window.changeProject = function(e)
});
}
}
window.changeAttribute = function(e)
{
const $attribute = $(e.target);
const attribute = $attribute.val();
const parentID = $attribute.closest('tr').find('input[name^=id]').val();
$('[data-parent="' + parentID + '"]').each(function()
{
const $attributePicker = $(this).find('input[name^=attribute]').zui('picker');
if(attribute == 'mix')
{
$attributePicker.render({disabled: false});
}
else
{
$attributePicker.render({disabled: true});
$attributePicker.$.setValue(attribute);
}
})
}
+4 -2
View File
@@ -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('parents', $parents);
formBatchPanel
(
@@ -28,6 +29,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'),
formBatchItem
(
set::name('id'),
@@ -62,10 +64,10 @@ formBatchPanel
(
set::name('type'),
set::label($lang->execution->method),
set::control('picker'),
set::control(array('type' => 'picker', 'required' => true)),
set::items($lang->execution->typeList),
set::disabled(true),
set::width('80px')
set::width('100px')
) : null,
$setCode ? formBatchItem
(