From 3a4e552e789a149ee004e40d0a42dc28456a8009 Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Thu, 18 Apr 2024 15:22:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=B7=A5=E5=8D=95=E5=8A=9F?= =?UTF-8?q?=E8=83=BD(4/10)=20*=E5=89=8D=E7=AB=AF=E6=94=B9=E8=BF=9B=20*?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=B0=83=E6=95=B4=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/tickets/index.php | 2 +- views/tickets/view.php | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/views/tickets/index.php b/views/tickets/index.php index 04aeb64..e94ff50 100644 --- a/views/tickets/index.php +++ b/views/tickets/index.php @@ -83,7 +83,7 @@ FontAwesomeAsset::register($this); }, 'delete' => function ($url, $model, $key) { if ($model->status !== Tickets::STATUS_CLOSED) { - return Html::a('', $url, [ + return Html::a('', ['delete', 'id' => $model->id, 'from' => 'index'], [ 'title' => '关闭工单', 'data-pjax' => '0', 'data-confirm' => '你确定要关闭这个工单吗?', diff --git a/views/tickets/view.php b/views/tickets/view.php index 81179e8..b3a1dd7 100644 --- a/views/tickets/view.php +++ b/views/tickets/view.php @@ -72,10 +72,10 @@ $this->registerCssFile('@web/css/tickets.css'); ], ]) ?>

- $model->id], [ + status===Tickets::STATUS_CLOSED)?'':Html::a('关闭工单', ['delete', 'id' => $model->id], [ 'class' => 'btn btn-danger', 'data' => [ - 'confirm' => 'Are you sure you want to delete this item?', + 'confirm' => '您确定要关闭这个工单吗?问题已经解决了吗?', 'method' => 'post', ], ]) ?> @@ -103,7 +103,36 @@ $core_js = <<id; // 你需要在这里设置正确的工单ID + + $.ajax({ + url: 'index.php?r=tickets%2Freply', + type: 'POST', + data: { + ticketId: ticketId, + content: JSON.stringify(content) + }, + success: function(response) { + // 处理服务器的响应 + console.log(response); + // 如果服务器返回的状态是成功,刷新页面 + if (response.status === 'success') { + location.reload(); + } + }, + error: function(jqXHR, textStatus, errorThrown) { + // 处理错误 + console.error(textStatus, errorThrown); + } + }); + }); function quillGetHTML(inputDelta,skipParse=false) { var delta = skipParse?inputDelta:JSON.parse(inputDelta); var tempQuill=new Quill(document.createElement("div"));