diff --git a/views/admin/collection_manage.php b/views/admin/collection_manage.php new file mode 100644 index 0000000..9a01b0e --- /dev/null +++ b/views/admin/collection_manage.php @@ -0,0 +1,63 @@ +title = '文件收集管理'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ + 'attribute' => 'id', + 'headerOptions' => ['style' => 'width:6%;'], + ], + [ + 'attribute' => 'user_id', + 'label' => '收集者', + 'value' => function ($model) { + return $model->user->username . ' (ID:' . $model->user_id . ')'; + }, + ], + 'folder_path', + 'created_at', + 'secret', + [ + 'attribute' => 'status', + 'label' => '收集状态', + 'value' => function ($model) { + return $model->status == 1 ? '有效' : '失效'; + }, + 'filter' => [1 => '有效', 0 => '失效'], + ], + [ + 'class' => ActionColumn::class, + 'template' => '{view} {delete}', + 'urlCreator' => function ($action, CollectionTasks $model, $key, $index, $column) { + if ($action === 'view') { + // 返回查看按钮的链接 + return Url::toRoute(['collection-manage-view', 'id' => $model->id]); + } else { + // 如果 status 为 0,禁用删除按钮 + return $model->status != 0 ? Url::toRoute(['collection-manage-delete', 'id' => $model->id]) : null; + } + } + ], + ], + ]); ?> + + +
diff --git a/views/admin/collection_manage_view.php b/views/admin/collection_manage_view.php new file mode 100644 index 0000000..e7fcdfc --- /dev/null +++ b/views/admin/collection_manage_view.php @@ -0,0 +1,73 @@ +title = '文件收集ID ' . $model->id; +$this->params['breadcrumbs'][] = ['label' => '文件收集管理', 'url' => ['collection-manage']]; +$this->params['breadcrumbs'][] = $this->title; +YiiAsset::register($this); + +$searchModel = new CollectionUploadedSearch(); +$dataProvider = $searchModel->search(Yii::$app->request->queryParams); +$dataProvider->query->andWhere(['task_id' => $model->id]); +?> +
+ +

title) ?>

+ +

+ status != 0): ?> + 'btn btn-primary', 'id' => 'copy-link-button']) ?> + $model->id, 'secret' => $model->secret], ['class' => 'btn btn-primary', 'target' => '_blank']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => '你确定要取消这个收集任务吗?已收集的文件不会被删除', + 'method' => 'post', + ], + ]) ?> + + 'btn btn-primary disabled', 'id' => 'copy-link-button', 'aria-disabled' => 'true']) ?> + 'btn btn-primary disabled', 'target' => '_blank', 'aria-disabled' => 'true']) ?> + 'btn btn-danger disabled', + 'aria-disabled' => 'true' + ]) ?> + +

+ + $model, + 'attributes' => [ + 'id', + 'folder_path', + 'created_at', + 'secret', + ], + ]) ?> + +

文件收集情况:

+ $dataProvider, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + 'id', + 'uploader_ip', + 'uploaded_at', + 'subfolder_name' + ], + ]); ?> +
+registerJsFile('@web/js/collection_view.js', ['depends' => [JqueryAsset::class], 'position' => View::POS_END]); +?>