feat: xxbb
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
|
||||
@section('content')
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header" style="display:flex;align-items:center;justify-content:space-between;">
|
||||
<span>设备详情</span>
|
||||
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" id="LAY-device-destroy">删除设备</button>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<table class="layui-table" style="margin-bottom: 16px;">
|
||||
<tr>
|
||||
@@ -12,6 +16,10 @@
|
||||
<th width="140">渠道 ID</th>
|
||||
<td><code>{{ $device->channel_id ?: '—' }}</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>来源域名</th>
|
||||
<td colspan="3"><code>{{ $device->source_domain ?: '—' }}</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>设备型号</th>
|
||||
<td>{{ $device->device_model ?: '—' }}</td>
|
||||
@@ -24,6 +32,21 @@
|
||||
<th>IP</th>
|
||||
<td>{{ $device->ip ?: '—' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>钱包</th>
|
||||
<td colspan="3">
|
||||
@if ((int) $device->has_wallet === \App\Models\Device::WALLET_YES)
|
||||
<span style="color:#d97706;font-weight:600;">有</span>
|
||||
@foreach ($device->walletNameList() as $name)
|
||||
<span class="tag-wallet">{{ $name }}</span>
|
||||
@endforeach
|
||||
@elseif ((int) $device->has_wallet === \App\Models\Device::WALLET_NONE)
|
||||
无
|
||||
@else
|
||||
未知
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>相册存储</th>
|
||||
<td colspan="3">
|
||||
@@ -137,6 +160,8 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
var tabDataUrl = @json(route(($portal ?? 'admin').'.devices.tabData', $device));
|
||||
var updateUrl = @json(route(($portal ?? 'admin').'.devices.update', $device));
|
||||
var clearPhotosUrl = @json(route(($portal ?? 'admin').'.devices.photos.clear', $device));
|
||||
var destroyUrl = @json(route(($portal ?? 'admin').'.devices.destroy', $device));
|
||||
var listUrl = @json(route(($portal ?? 'admin').'.devices.index'));
|
||||
var token = @json(csrf_token());
|
||||
var dash = function (v) { return v ? v : '—'; };
|
||||
var esc = function (v) {
|
||||
@@ -170,8 +195,43 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
});
|
||||
form.render('checkbox');
|
||||
|
||||
$('#LAY-device-destroy').on('click', function () {
|
||||
layer.confirm('确认删除该设备?将同时删除相册、钱包、助记词、APP、备忘录、日志等全部关联数据,且不可恢复。', {
|
||||
icon: 3,
|
||||
title: '删除设备'
|
||||
}, function (index) {
|
||||
layer.close(index);
|
||||
var loading = layer.load(1, { shade: 0.2 });
|
||||
$.ajax({
|
||||
url: destroyUrl,
|
||||
method: 'POST',
|
||||
data: { _method: 'DELETE', _token: token },
|
||||
success: function (res) {
|
||||
layer.close(loading);
|
||||
if (!res || res.code !== 0) return layer.msg((res && res.msg) || '删除失败');
|
||||
layer.msg('已删除', { time: 800 }, function () {
|
||||
var next = (res.data && res.data.list_url) ? res.data.list_url : listUrl;
|
||||
try {
|
||||
if (parent && parent.layui && parent.layui.index && parent.layui.index.closeThisTabs) {
|
||||
parent.layui.index.closeThisTabs();
|
||||
parent.layui.index.openTabsPage(next, '设备管理');
|
||||
return;
|
||||
}
|
||||
} catch (e) {}
|
||||
location.href = next;
|
||||
});
|
||||
},
|
||||
error: function (xhr) {
|
||||
layer.close(loading);
|
||||
var msg = (xhr.responseJSON && xhr.responseJSON.msg) ? xhr.responseJSON.msg : '删除失败';
|
||||
layer.msg(msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
if (tab === 'photos') {
|
||||
var photoState = { page: 1, limit: 15, sensitive: '' };
|
||||
var photoState = { page: 1, limit: 20, sensitive: '' };
|
||||
|
||||
var renderPhotos = function () {
|
||||
$.getJSON(tabDataUrl, {
|
||||
@@ -225,7 +285,7 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
count: (res && res.count) ? res.count : 0,
|
||||
curr: photoState.page,
|
||||
limit: photoState.limit,
|
||||
limits: [10, 15, 20, 30, 50],
|
||||
limits: [10, 20, 30, 50],
|
||||
layout: ['count', 'prev', 'page', 'next', 'limit'],
|
||||
jump: function (obj, first) {
|
||||
if (first) return;
|
||||
@@ -349,8 +409,8 @@ layui.use(['table', 'form', 'laypage', 'layer'], function () {
|
||||
defaultToolbar: ['filter', 'exports', 'print'],
|
||||
cols: colsMap[tab] || colsMap.wallets,
|
||||
page: true,
|
||||
limit: 15,
|
||||
limits: [10, 15, 20, 30, 50],
|
||||
limit: 20,
|
||||
limits: [10, 20, 30, 50],
|
||||
text: { none: emptyMap[tab] || '暂无数据' },
|
||||
request: { pageName: 'page', limitName: 'limit' },
|
||||
response: { statusName: 'code', statusCode: 0, msgName: 'msg', countName: 'count', dataName: 'data' }
|
||||
|
||||
Reference in New Issue
Block a user