You've already forked guangan
回复用户
This commit is contained in:
@ -42,7 +42,7 @@ class Ticket extends Controller
|
|||||||
$query->like(['title|content|contact_name|ticket_address|contact_phone#keyword'])
|
$query->like(['title|content|contact_name|ticket_address|contact_phone#keyword'])
|
||||||
->dateBetween(['create_at'])
|
->dateBetween(['create_at'])
|
||||||
->equal(['status', 'type_id']);
|
->equal(['status', 'type_id']);
|
||||||
$query->append(['imgs_arr', 'source_type_name', 'type_name', 'last_reply'])->with(['views', 'repairs', 'verifys', 'view_process', 'repair_process', 'verify_process']);
|
$query->append(['imgs_arr', 'source_type_name', 'type_name', 'last_reply'])->with(['user_shares', 'views', 'repairs', 'verifys', 'view_process', 'repair_process', 'verify_process']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,4 +650,42 @@ class Ticket extends Controller
|
|||||||
TicketTicket::mk()->saveAll($sheetData);
|
TicketTicket::mk()->saveAll($sheetData);
|
||||||
$this->success("成功");
|
$this->success("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function comment()
|
||||||
|
{
|
||||||
|
$data = $this->_vali([
|
||||||
|
'id.require'=>'请指定工单ID!',
|
||||||
|
]);
|
||||||
|
$ticket = TicketTicket::query()->with(['user_shares'])->where('id', '=', $data['id'])->findOrEmpty();
|
||||||
|
if ($ticket->isEmpty()) {
|
||||||
|
$this->error('未找到工单信息');
|
||||||
|
}
|
||||||
|
if (!$ticket->user_shares || sizeof($ticket->user_shares) == 0) {
|
||||||
|
$this->error("该工单无需评论");
|
||||||
|
}
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$adminInfo = $this->request->session('user');
|
||||||
|
$comment_data = $this->_vali([
|
||||||
|
'content.require'=>'请输入评论内容!',
|
||||||
|
]);
|
||||||
|
TicketTicket::mk()->startTrans();
|
||||||
|
try {
|
||||||
|
foreach ($ticket->user_shares as $share) {
|
||||||
|
$share->logs()->save([
|
||||||
|
'op_name' => $adminInfo["username"],
|
||||||
|
'content' => $comment_data['content'],
|
||||||
|
'result' => "后台用户反馈",
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
TicketTicket::mk()->commit();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
TicketTicket::mk()->rollback();
|
||||||
|
$this->error("保存失败");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->vo = $ticket;
|
||||||
|
$this->ticket = $ticket;
|
||||||
|
$this->fetch();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -93,6 +93,11 @@ class TicketTicket extends Model
|
|||||||
return $this->hasMany(TicketUserShare::class, 'linked_ticket_id');
|
return $this->hasMany(TicketUserShare::class, 'linked_ticket_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function inspectionShares()
|
||||||
|
{
|
||||||
|
return $this->hasMany(TicketUserShare::class, 'linked_ticket_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function dept()
|
public function dept()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(TicketDept::class, 'dept_id');
|
return $this->belongsTo(TicketDept::class, 'dept_id');
|
||||||
|
18
plugs/think-plugs-ticket/src/view/ticket/comment.html
Normal file
18
plugs/think-plugs-ticket/src/view/ticket/comment.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<form class="layui-form layui-card margin-top-10 padding-10" action="{:sysuri()}" data-auto="true" method="post" autocomplete="off" data-table-id="ticketTable">
|
||||||
|
<input class="layui-input layui-hide" type='hidden' value="{:input('get.id')}" name='id'>
|
||||||
|
<input class="layui-input layui-hide" type='hidden' value='{:systoken("comment")}' name='_token_'>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">回复内容</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea data-textarea class="layui-textarea" name='content' required></textarea>
|
||||||
|
<div class="layui-word-aux">此回复对外可见,请认真回复。</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item text-center">
|
||||||
|
<button class="layui-btn layui-btn-normal" type='submit'>保存数据</button>
|
||||||
|
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<script>
|
||||||
|
</script>
|
||||||
|
{include file="ticket/detail"}
|
@ -26,6 +26,11 @@
|
|||||||
<!--{if auth("detail")}-->
|
<!--{if auth("detail")}-->
|
||||||
<a data-modal="{:url('detail')}?id={{ d.id }}" data-height="90%" data-width="60%" class="layui-btn layui-btn-xs layui-btn-normal" title="详情">详情</a>
|
<a data-modal="{:url('detail')}?id={{ d.id }}" data-height="90%" data-width="60%" class="layui-btn layui-btn-xs layui-btn-normal" title="详情">详情</a>
|
||||||
<!--{/if}-->
|
<!--{/if}-->
|
||||||
|
{{# if (d.user_shares && d.user_shares.length > 0) { }}
|
||||||
|
<!--{if auth("comment")}-->
|
||||||
|
<a data-modal="{:url('comment')}?id={{ d.id }}" data-height="80%" data-width="80%" class="layui-btn layui-btn-xs layui-btn-normal" title="反馈信息">反馈信息</a>
|
||||||
|
<!--{/if}-->
|
||||||
|
{{# } }}
|
||||||
<!--{if auth("edit")}-->
|
<!--{if auth("edit")}-->
|
||||||
<a data-modal="{:url('edit')}?id={{ d.id }}" data-height="80%" data-width="80%" class="layui-btn layui-btn-xs layui-btn-danger" title="修改工单">修改</a>
|
<a data-modal="{:url('edit')}?id={{ d.id }}" data-height="80%" data-width="80%" class="layui-btn layui-btn-xs layui-btn-danger" title="修改工单">修改</a>
|
||||||
<!--{/if}-->
|
<!--{/if}-->
|
||||||
|
Reference in New Issue
Block a user