* Adjust for batchedit page.

This commit is contained in:
wangyidong
2023-08-17 10:10:08 +08:00
parent f49087bfba
commit 7a19e22ea9
3 changed files with 42 additions and 16 deletions
+15 -11
View File
@@ -41,18 +41,22 @@ window.setStatistics = function(element, checks)
return zui.formatString(element.options.defaultSummary);
}
window.generateHtml = function(event, options)
window.generateHtml = function(event)
{
const dtable = zui.DTable.query(event.target);
const checkedList = dtable.$.getChecks();
if(!checkedList.length) return;
try
{
const dtable = zui.DTable.query(event.target);
const checkedList = dtable.$.getChecks();
if(!checkedList.length) return;
let html = "<div class='toolbar input-group mr-2'>";
html += "<input class='form-control size-sm' type='date' autocomplete='off' id='formDate' name='date'>";
html += "<button class='btn secondary toolbar-item batch-btn ajax-btn size-sm' data-url='" + $.createLink('todo', 'import2Today') + "' id='changeDate'>";
html += "<span class='text'>" + changeDateLabel + "</span>";
html += "</button>";
html += "</div>";
let html = "<div class='toolbar input-group mr-2'>";
html += "<input class='form-control size-sm' type='date' autocomplete='off' id='formDate' name='date'>";
html += "<button class='btn secondary toolbar-item batch-btn ajax-btn size-sm' data-url='" + $.createLink('todo', 'import2Today') + "' id='changeDate'>";
html += "<span class='text'>" + changeDateLabel + "</span>";
html += "</button>";
html += "</div>";
return {html};
return {html};
}
catch(error){}
}
+25 -4
View File
@@ -15,9 +15,10 @@ window.renderRowData = function($row, index, row)
let $nameBox = $row.find('td[data-name="name"]');
$nameBox.html("<div class='picker-box' id='name'></div>");
data = {};
data.name = 'name';
data.items = nameItems[row.type];
data.defaultValue = row.objectID;
data.name = 'name';
data.multiple = false;
data.items = nameItems[row.type];
data.defaultValue = row.objectID;
$nameBox.find('#name').picker(data);
}
}
@@ -43,4 +44,24 @@ window.togglePending = function(e)
{
$(this).zui('picker').render({disabled: e.target.checked});
});
}
};
window.changeType = function(e)
{
const type = e.target.value;
const $tr = $(e.target).closest('tr');
const index = $tr.find('.form-control-static[data-name="id"]').text()
const $nameBox = $tr.find('[data-name="name"]');
if(moduleList.indexOf(type) !== -1)
{
items = nameItems[type];
$nameBox.html("<div class='picker-box' id='name'></div>");
$nameBox.find('#name').picker({items: items, name: 'name'});
}
else
{
$nameBox.html($('#nameInputBox').html());
$nameBox.find('input[name=name]').attr('name', 'name[' + index + ']').attr('id', 'name_' + index);
}
};
+2 -1
View File
@@ -33,6 +33,7 @@ $fnGenerateCustomizedFields = function() use ($showFields, $customFields)
jsVar('nameItems', $nameItems);
jsVar('timeItems', $timeItems);
jsVar('moduleList', $config->todo->moduleList);
div
(
@@ -71,7 +72,7 @@ formBatchPanel
set::mode('edit'),
set::data(array_values($editedTodos)),
set::onRenderRow(jsRaw('renderRowData')),
on::change('[data-name="type"]', 'setNameCell'),
on::change('[data-name="type"]', 'changeType'),
on::click('.time-check', "window.togglePending"),
formBatchItem
(