* zin: add method description of thinktableinput.

This commit is contained in:
Zhangyu
2024-05-27 06:13:02 +00:00
parent 38b2cdeb44
commit 6b88df29ff
2 changed files with 40 additions and 0 deletions
+39
View File
@@ -1,18 +1,43 @@
/**
* 处理是否支持添加行值的变化。
* Does it support adding changes to row values.
*
* @param event $e
* @returns void
*/
window.changeSupportAdd = function(e)
{
$('.can-add-rows').toggleClass('hidden', e.target.value == 0);
}
/**
* 处理是否必填值的变化。
* Handling changes in mandatory values.
*
* @param event $e
* @returns void
*/
window.changeIsRequired = function(e)
{
$('.required-rows').toggleClass('hidden', e.target.value == 0);
}
/**
* 处理输入框值变化。
* Handling input box value changes.
*
* @param Event e Event object
* @returns void
*/
window.changeInput = function(e)
{
const value = $(this).val();
const intValue = value < 1 ? 1 : parseInt(value, 10);
$(this).val(intValue);
}
/**
* 设置行号。
* Set line number.
*
* @access public
@@ -31,6 +56,13 @@ function setLineIndex()
});
}
/**
* 添加行。
* Add rows.
*
* @param event $e
* @returns void
*/
window.addRow = function(e)
{
if($('.rows-group').length >= canAddRows) return;
@@ -44,6 +76,13 @@ window.addRow = function(e)
setLineIndex();
}
/**
* 删除行。
* Delete rows.
*
* @access public
* @return void
*/
$(document).on('click', '.btn-delete', function() {
zui.Modal.confirm({message: deleteTip}).then((res) => {
if(res)
+1
View File
@@ -87,6 +87,7 @@ class thinkTableInput extends thinkQuestion
{
foreach($customFields as $index => $item)
{
/* 结果的索引是后台设置问题数加用户添加问题行的索引。Result index is number of backend setting issues plus custom add problem index.*/
$resultIndex = count($fields) + $index;
$tableInputItems[] = formGroup
(