dd/resources/views/nasa/v1/_lists/list.blade.php
2026-07-04 19:01:35 +08:00

81 lines
3.6 KiB
PHP

<table class="mac-table">
<thead>
<tr>
@foreach ($aData["aListField"] as $k => $v)
@if (is_array($v))
<th>{{$k}}</th>
@else
<th>{{$v}}</th>
@endif
@endforeach
<th>操作</th>
</tr>
</thead>
<tbody>
@php
function showValue($id, $k, $v, $aData, $sFieldNick = '')
{
// echo "<pre>";var_dump($aData["aMap"]);exit;
$sValueType = $aData["aFieldTypes"][$k] ?? '';
$sMapValue = $aData["aMap"][$k][$v] ?? $v;
$sShowValue = $aData["aValueStyle"][$sMapValue] ?? $sMapValue;
if ($sMapValue != $v) {
$sShowValue = $sShowValue." <span class='text-muted'>(".$v.")</span>";
}
if ($sValueType == 'article') {
$sShowValue = "<a class='text-info js-tom-modal-open-article' tom-modal-field='".$k."' tom-modal-save-id='".$id."'>文章 <span class='text-muted'>(".strlen($v).")</span></a>";
} else if ($sValueType == 'json') {
$sShowValue = "<a class='text-info js-tom-modal-open-json' tom-modal-field='".$k."' tom-modal-save-id='".$id."'>json <span class='text-muted'>(".strlen($v).")</span></a>";
} else if ($sValueType == 'byte') {
$sShowValue = "<span class=''>".(int)($v / 1024 / 1024 / 1204)."g <span class='text-muted'>(".$v.")</span></span>";
} else if ($sValueType == 'text') {
$sShowValue = "<a class='text-info js-tom-modal-open-text' tom-modal-field='".$k."' tom-modal-save-id='".$id."'>文本 <span class='text-muted'>(".strlen($v).")</span></a>";
} else if ($sValueType == 'text-full') {
$sShowValue = "<a class='text-info js-tom-modal-open-text' tom-modal-field='".$k."' tom-modal-save-id='".$id."'>".$v."</a>";
} else if ($sValueType == 'copy') {
$sShowValue = "<a class='text-info js-copy' data-text='".$v."' tom-modal-field='".$k."' tom-modal-save-id='".$id."'>".$v."</a>";
} else if ($sValueType == 'copy-nick') {
$sShowValue = "<a class='text-info js-copy' data-text='".$v."' tom-modal-field='".$k."' tom-modal-save-id='".$id."'>".
$sFieldNick." <span class='text-muted'>(".strlen($v).")</span>".
"<span class='text-muted' style='width:100px; display:inline-block; vertical-align: middle; word-break: break-all; max-height: 20px;'>&nbsp;".$v."</span>".
"</a>";
}
return $sShowValue;
}
@endphp
@foreach ($aData["cList"] as $aRow)
<tr>
@foreach ($aData['aListField'] as $sField => $sFieldV)
@if (is_array($sFieldV))
@php $sShowValue = ''; @endphp
@foreach ($sFieldV as $kk => $vv)
@php
$sShowValue .= '<p>'.showValue($aRow['id'], $kk, $aRow[$kk], $aData, $vv).'</p>';
@endphp
@endforeach
@else
@php
$sShowValue = showValue($aRow['id'], $sField, $aRow[$sField], $aData, $sFieldV);
@endphp
@endif
<td>{!! $sShowValue !!}</td>
@endforeach
<td>
<a class="mac-table-operation-btn text-muted js-open-detail" open-detail-id="{{ $aRow['id'] }}"><i class="ri-article-line"></i></a>
<a class="text-muted js-tom-modal-open" tom-modal-open="tool" tom-modal-data-id="{{ $aRow['id'] }}"><i class="ri-tools-fill"></i></a>
</td>
</tr>
@endforeach
</tbody>
</table>