ScoreRecordShow.php 4.6 KB
<?php
/**
+-----------------------------------------------------------------------------------------------------------------------
 * 管理端详情show trait层:渲染生成 Order 详情
+-----------------------------------------------------------------------------------------------------------------------
 *
 * PHP version 7
 *
 * @category  App\Admin\Shows
 * @package   App\Admin\Shows
 * @author    Richer <yangzi1028@163.com>
 * @date      2023年2月21日10:04:39
 * @copyright 2020-2022 Richer (http://www.Richer.com/)
 * @license   http://www.Richer.com/ License
 * @link      http://www.Richer.com/
 */
namespace App\Admin\Shows;

use App\Models\Score\TaskDetail;
use App\Models\User\Role;
use Illuminate\Support\Arr;

/**
 * Trait ScoreRecordShow.
 *
 * @category  App\Admin\Shows
 * @package   App\Admin\Shows
 * @author    Richer <yangzi1028@163.com>
 * @date      2022年4月2日17:10:10
 * @copyright 2020-2022 Richer (http://www.Richer.com/)
 * @license   http://www.Richer.com/ License
 * @link      http://www.Richer.com/
 */
trait ScoreRecordShow
{
    /**
     * 为详情show渲染字段
     *
     * @return void
     */
    protected function renderShowFields()
    {
        $this->showTextField('id');
        $this->showTextField('year' );
        $this->showTextField('month');
        $this->showTextField('user_name', '户主姓名');
        $this->showTextField('user_mobile', '户主手机');
        $this->showTextField('family_name', '农户名称');
        $this->showTextField('family_number', '农户门牌号');
        $this->showTextField('family_address', '农户地址');
        $this->showTextField('farmer_group_name', '农户小组名称');
        $this->showTextField('scorer_name', '评分员姓名');
        $this->showTextField('scorer_mobile', '评分员手机');
        $this->showTextField('scorer_group_name', '评分小组名称');
        $this->showTextField('score');
        $this->showTextField('star_show', '星级');

        $this->show->divider();
        $this->show->projects('评分明细')->as(function ($projects) {
//            $html = '<div style="width: 100%">';
//            $html .= '<table class="table1 table-hover grid-table" style="overflow: scroll;width: 500px!important;max-width: 500px!important;">';
            $html = '<table class="show-table" style="overflow: scroll;">';
            $html .= '<thead><tr>';
            $html .= '<th>#</th>';
            $html .= '<th>评分项目</th>';
            $html .= '<th style="width: 80px;">原始分数</th>';
            $html .= '<th style="width: 80px;">得分</th>';
            $html .= '<th style="width: 80px;">是否一票否决</th>';
            $html .= '<th>相关图片</th>';
            $html .= '<th>评分描述</th>';
            $html .= '<th style="width: 90px;">评分时间</th>';
            $html .= '<th style="width: 90px;">确认时间</th>';
            $html .= '<th style="width: 80px;">是否确认</th>';
            $html .= '<th style="width: 80px;">评分状态</th>';
            $html .= '</tr></thead>';

            $projects->each(function ($project, $index) use (&$html) {
                $html .= '<tr>';
                $html .= '<td>'.($index+1).'</td>';
                $html .= '<td>'.$project->project_title.'</td>';
                $html .= '<td>'.format_money($project->project_score).'</td>';
                $html .= '<td>'.format_money($project->score).'</td>';
                $html .= '<td>'.$project->is_vetoed_show .'</td>';
                $img = '';
                foreach ($project->images as $image) {
                    $img .= '<img src="'.$image.'" style="max-width:35px;max-height:35px" class="img img-rounded">';
                }
                $html .= '<td>'.$img .'</td>';
                $html .= '<td>'.$project->body .'</td>';
                $html .= '<td>'.format_date($project->created_at) .'</td>';
                $html .= '<td>'.format_date($project->confirmed_at) .'</td>';
                $html .= '<td>'.$project->confirmed_status_show .'</td>';
                $html .= '<td>'.$project->status_show .'</td>';
                $html .= '</tr>';
            });
            $html .= "</table>";
            return $html;
        })->setGroupClass('col-sm-12 clear-both')
            ->setWidth(11, 1);


//        $this->show->projects('评分明细', function ($comments) {
//
//            $comments->resource('/admin/comments');
//
//            $comments->id();
//            $comments->content()->limit(10);
//
//            $comments->filter(function ($filter) {
//                $filter->like('content');
//            });
//        });
    }
}