文件收集功能(3/10)

在文件管理前端增加文件收集按钮和表单
This commit is contained in:
Chenx221 2024-02-25 10:30:17 +08:00
parent e29f1e8b11
commit c22b132070
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021
2 changed files with 20 additions and 0 deletions

View File

@ -9,6 +9,7 @@
use app\assets\AceAsset;
use app\assets\PlyrAsset;
use app\assets\ViewerJsAsset;
use app\models\CollectionTasks;
use app\models\NewFolderForm;
use app\models\RenameForm;
use app\models\Share;
@ -46,6 +47,7 @@ $this->registerCssFile('@web/css/home_style.css');
<?= Html::button('计算校验', ['class' => 'btn btn-outline-primary calc-sum-btn']) ?>
<?= Html::button('分享', ['class' => 'btn btn-outline-primary single-share-btn']) ?>
<?= Html::button('删除', ['class' => 'btn btn-outline-danger batch-delete-btn']) ?>
<?= Html::button('收集文件', ['class' => 'btn btn-outline-primary create-collection-btn']) ?>
<?= Html::button('刷新', ['class' => 'btn btn-outline-primary refresh-btn']) ?>
<?= Html::button('新建文件夹', ['class' => 'btn btn-outline-primary new-folder-btn', 'value' => $directory]) ?>
<div class="dropdown d-inline-block">
@ -318,6 +320,17 @@ Modal::begin([
'size' => 'modal-xl',
]);
Modal::end();
Modal::begin([
'title' => '<h4>创建文件收集</h4>',
'id' => 'collectionModal',
]);
$collectionTasks = new CollectionTasks();
$collectionTasks->scenario = 'create';
echo $this->render('../collection/create', [
'model' => $collectionTasks,
]);
Modal::end();
$this->registerJsFile('@web/js/home_script.js', ['depends' => [JqueryAsset::class], 'position' => View::POS_END]);
?>

View File

@ -367,6 +367,7 @@ function updateButtons() {
$('.calc-sum-btn').toggle(isSingleFile);
$('.single-share-btn').toggle(count === 1);
$('.batch-delete-btn').toggle(count >= 1);
$('.create-collection-btn').toggle(count === 1 && !isSingleFile);
}
// 当checkbox的状态改变时调用updateButtons函数
@ -529,3 +530,9 @@ pdfModal.on('hidden.bs.modal', function () {
pdfObject.remove();
}
});
//create collection task
$(document).on('click', '.create-collection-btn', function () {
document.getElementById('collectiontasks-folder_path').value = $('.select-item:checked').first().data('relativePath');
$('#collectionModal').modal('show');
});