diff --git a/views/tickets/index.php b/views/tickets/index.php
index e94ff50..0e843b0 100644
--- a/views/tickets/index.php
+++ b/views/tickets/index.php
@@ -28,6 +28,7 @@ FontAwesomeAsset::register($this);
= GridView::widget([
'dataProvider' => $dataProvider,
+ 'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'id',
@@ -44,32 +45,35 @@ FontAwesomeAsset::register($this);
[
'attribute' => 'created_at',
'label' => '创建时间',
+ 'filter' => false
],
[
'attribute' => 'updated_at',
'label' => '最近更新时间',
'value' => function (Tickets $model) {
return Yii::$app->formatter->asRelativeTime(new DateTime($model->updated_at, new DateTimeZone('GMT+8')));
- }
+ },
+ 'filter' => false
],
[
'attribute' => 'status',
'label' => '状态',
'format' => 'raw', // 使用 raw 格式,这样 Yii2 不会对 value 的返回值进行 HTML 编码
'value' => function (Tickets $model) {
- switch ($model->status) {
- case Tickets::STATUS_OPEN:
- return '工单已开启';
- case Tickets::STATUS_ADMIN_REPLY:
- return '管理员已回复';
- case Tickets::STATUS_USER_REPLY:
- return '用户已回复';
- case Tickets::STATUS_CLOSED:
- return '工单已关闭';
- default:
- return '未知状态';
- }
- }
+ return match ($model->status) {
+ Tickets::STATUS_OPEN => '工单已开启',
+ Tickets::STATUS_ADMIN_REPLY => '管理员已回复',
+ Tickets::STATUS_USER_REPLY => '用户已回复',
+ Tickets::STATUS_CLOSED => '工单已关闭',
+ default => '未知状态',
+ };
+ },
+ 'filter' => [
+ Tickets::STATUS_OPEN => '工单已开启',
+ Tickets::STATUS_ADMIN_REPLY => '管理员已回复',
+ Tickets::STATUS_USER_REPLY => '用户已回复',
+ Tickets::STATUS_CLOSED => '工单已关闭',
+ ]
],
[
'class' => ActionColumn::class,
diff --git a/views/tickets/view.php b/views/tickets/view.php
index b3a1dd7..4961170 100644
--- a/views/tickets/view.php
+++ b/views/tickets/view.php
@@ -37,18 +37,13 @@ $this->registerCssFile('@web/css/tickets.css');
'label' => '状态',
'format' => 'raw', // 使用 raw 格式,这样 Yii2 不会对 value 的返回值进行 HTML 编码
'value' => function (Tickets $model) {
- switch ($model->status) {
- case Tickets::STATUS_OPEN:
- return '工单已开启';
- case Tickets::STATUS_ADMIN_REPLY:
- return '管理员已回复';
- case Tickets::STATUS_USER_REPLY:
- return '用户已回复';
- case Tickets::STATUS_CLOSED:
- return '工单已关闭';
- default:
- return '未知状态';
- }
+ return match ($model->status) {
+ Tickets::STATUS_OPEN => '工单已开启',
+ Tickets::STATUS_ADMIN_REPLY => '管理员已回复',
+ Tickets::STATUS_USER_REPLY => '用户已回复',
+ Tickets::STATUS_CLOSED => '工单已关闭',
+ default => '未知状态',
+ };
}
],
[
diff --git a/web/css/tickets.css b/web/css/tickets.css
index 309b147..9246594 100644
--- a/web/css/tickets.css
+++ b/web/css/tickets.css
@@ -3,17 +3,17 @@
}
.ticket-reply {
margin-bottom: 24px;
- border: 1px solid #e6e8ec;
- background: #fff;
+ border: 1px solid var(--bs-border-color);
+ background: var(--bs-body-bg);
border-radius: 4px;
}
.ticket-reply-top {
- border-bottom: 1px solid #e6e8ec;
- background: #f6f7f8;
+ border-bottom: 1px solid var(--bs-border-color);
+ background: var(--bs-secondary-bg);
padding: 10px 15px;
}
.ticket-reply .user i {
- color: #b9bdc5;
+ color: var(--bs-secondary-color);
margin-right: 6px;
}
.ticket-reply .info {
@@ -21,18 +21,18 @@
justify-content: space-between;
font-size: 12px;
line-height: 18px;
- color: #7c8088;
+ color: var(--bs-tertiary-color);
}
.ticket-reply .ticket-message {
padding: 25px 15px;
}
.ticket-reply.admin {
- border-color: #d5e7fb;
+ border-color: var(--bs-primary-border-subtle);
}
.ticket-reply.admin .ticket-reply-top {
- background-color: #e3effc;
- border-color: #d5e7fb;
+ background-color: var(--bs-primary-bg-subtle);
+ border-color: var(--bs-primary-border-subtle);
}
.ticket-reply.admin .user i {
- color: #1062fe;
+ color: var(--bs-primary);
}
\ No newline at end of file