TaskShow.php
5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/**
+-----------------------------------------------------------------------------------------------------------------------
* 管理端详情show trait层:渲染生成 ScoreTask 详情
+-----------------------------------------------------------------------------------------------------------------------
*
* PHP version 7
*
* @category App\Admin\Shows\Score
* @package App\Admin\Shows\Score
* @author Richer <yangzi1028@163.com>
* @date 2023年2月23日14:41:10
* @copyright 2020-2022 Richer (http://www.Richer.com/)
* @license http://www.Richer.com/ License
* @link http://www.Richer.com/
*/
namespace App\Admin\Shows\Score;
/**
* Trait TaskShow
*
* @package App\Admin\Shows\Score
*/
trait TaskShow
{
/**
* 为详情show渲染字段
*
* @return void
*/
protected function renderShowFields()
{
$this->showTextField('id', __('ID'));
$this->showTextField('year');
$this->showTextField('month');
$this->showTextField('description');
$this->showTextField('family_count', '农户数量');
// $this->showTextField('details_count', '已评分农户数量');
$this->showTextField('status_color_show', __('status'));
$this->showTextField('created_at', __('created_at'));
$this->showTextField('updated_at', __('updated_at'));
$this->show->divider();
$this->show->details('评分记录明细')->as(function ($records) {
$group_name = __('group_name');
$house_number = __('house_number');
$score = __('score');
$star = __('star');
$scored_at = __('scored_at');
$confirmed_at = __('confirmed_at');
$is_vetoed = __('is_vetoed');
$html = '<table class="table grid-table" style="overflow: scroll;">';
$html .= '<thead><tr>';
$html .= '<th>#</th>';
$html .= "<th>$group_name </th>";
$html .= '<th>户主姓名</th>';
$html .= '<th>户主手机</th>';
$html .= "<th>$score </th>";
$html .= "<th>$star </th>";
$html .= "<th>$scored_at </th>";
$html .= "<th>$confirmed_at </th>";
$html .= "<th>$is_vetoed </th>";
$html .= '</tr></thead>';
$records->each(function ($record, $index) use (&$html) {
$html .= '<tr>';
$html .= '<td>'.($index+1).'</td>';
$html .= '<td>'.optional($record->group)->name.'</td>';
$html .= '<td>'.optional($record->user)->name.'</td>';
$html .= '<td>'.optional($record->user)->mobile.'</td>';
$html .= '<td>'.$record->score.'</td>';
$html .= '<td>'.$record->star_show .'</td>';
$html .= '<td>'.format_date($record->scored_at).'</td>';
$html .= '<td>'.format_date($record->confirmed_at).'</td>';
$html .= '<td>'.$record->vetoed_show .'</td>';
$html .= '</tr>';
});
$html .= "</table>";
return $html;
})->setGroupClass('col-sm-12 clear-both')->setWidth(11, 1);
$this->show->divider();
$this->show->auditRecords('审核记录明细')->as(function ($records) {
$html = '<div class="track-list track-list-date"><ul>';
$records->each(function ($record, $index) use (&$html) {
if ($index === 0) {
$html .= '<li class="afterdate node-to-change track-node-0008 first">';
} else {
$html .= '<li class="">';
}
$html .= '<i class="node-icon"><i class="dot"></i><i class="state-icon"></i></i>';
$html .= ' <span class="date">' .$record->created_at . '</span>';
$html .= ' <span class="auditor">' .optional($record->user)->name . '</span>';
$html .= ' <span class="status">' .$record->audited_status_show_color . '</span>';
$html .= ' <span class="txt">' .$record->audited_opinion . '</span>';
});
return $html;
$html .= '</ul></div>';
$html = '<table class="table grid-table" style="overflow: scroll;">';
$html .= '<thead><tr>';
$html .= '<th>#</th>';
$html .= '<th>审核用户</th>';
$html .= '<th>审核结论</th>';
$html .= '<th>审核意见</th>';
$html .= '<th>审核时间</th>';
$html .= '</tr></thead>';
$records->each(function ($record, $index) use (&$html) {
$html .= '<tr>';
$html .= '<td>'.($index+1).'</td>';
$html .= '<td>'.optional($record->user)->name.'</td>';
$html .= '<td>'.$record->audited_status_show_color.'</td>';
$html .= '<td>'.$record->audited_opinion ?? "--".'</td>';
$html .= '<td>'.format_date($record->created_at).'</td>';
$html .= '</tr>';
});
$html .= "</table>";
return $html;
})->setGroupClass('col-sm-12 clear-both')->setWidth(11, 1);
}
}