mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-30 20:09:24 +03:00
многие изменения
This commit is contained in:
@@ -4,39 +4,44 @@
|
||||
export let deviceList;
|
||||
export let showInput;
|
||||
|
||||
let newDevice = {};
|
||||
export let newDevice = {};
|
||||
|
||||
export let devListSave = () => {};
|
||||
export let deleteLineFromDevlist = (num) => {};
|
||||
</script>
|
||||
|
||||
<Card title={"Список устройств"}>
|
||||
<table class="table-fixed gap-4 w-full">
|
||||
<thead class="bg-gray-50 ">
|
||||
<tr class="tbl-txt-sz tbl-txt-p">
|
||||
<th class="tbl-hd">Название устройства</th>
|
||||
<th class="tbl-hd">IP адрес</th>
|
||||
<th class="tbl-hd">Идентификатор</th>
|
||||
<th class="tbl-hd">Состояние</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white">
|
||||
{#each deviceList as device}
|
||||
<div class="grd-1cols">
|
||||
<Card title={"Список устройств"}>
|
||||
<table class="tbl">
|
||||
<thead class="bg-gray-100">
|
||||
<tr class="tbl-txt-sz tbl-txt-p">
|
||||
<td class="tbl-bdy">{device.name}</td>
|
||||
<td class="tbl-bdy"><a href={"http://" + device.ip}>{device.ip}</a></td>
|
||||
<td class="tbl-bdy">{device.id}</td>
|
||||
<td class="tbl-bdy {device.status ? 'bg-green-50' : 'bg-red-50'}">{device.status ? "online" : "offline"}</td>
|
||||
<th class="tbl-hd">Название устройства</th>
|
||||
<th class="tbl-hd">IP адрес</th>
|
||||
<th class="tbl-hd">Идентификатор</th>
|
||||
<th class="tbl-hd">Состояние</th>
|
||||
<th class="tbl-hd w-7" />
|
||||
</tr>
|
||||
{/each}
|
||||
{#if showInput}
|
||||
<tr class="tbl-txt-sz tbl-txt-p">
|
||||
<td class="tbl-bdy"><input bind:value={newDevice.name} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy"><input bind:value={newDevice.ip} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy"><input bind:value={newDevice.id} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy" />
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
<button class="btn-lg" on:click={() => ((showInput = !showInput), devListSave())}>{showInput ? "Сохранить" : "Добавить устройство"}</button>
|
||||
</Card>
|
||||
</thead>
|
||||
<tbody class="bg-white">
|
||||
{#each deviceList as device, i}
|
||||
<tr class="tbl-txt-sz tbl-txt-p">
|
||||
<td class="tbl-bdy tbl-ipt w-full">{device.name}</td>
|
||||
<td class="tbl-bdy tbl-ipt w-full"><a href={"http://" + device.ip}>{device.ip}</a></td>
|
||||
<td class="tbl-bdy tbl-ipt w-full">{device.id}</td>
|
||||
<td class="tbl-bdy tbl-ipt w-full {device.status ? 'bg-green-50' : 'bg-red-50'}">{device.status ? "online" : "offline"}</td>
|
||||
<td class="tbl-bdy"><svg on:click={() => deleteLineFromDevlist(i)} class="h-6 w-6 text-red-400 cursor-pointer" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <line x1="18" y1="6" x2="6" y2="18" /> <line x1="6" y1="6" x2="18" y2="18" /></svg></td>
|
||||
</tr>
|
||||
{/each}
|
||||
{#if showInput}
|
||||
<tr class="tbl-txt-sz tbl-txt-p">
|
||||
<td class="tbl-bdy"><input bind:value={newDevice.name} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy"><input bind:value={newDevice.ip} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy"><input bind:value={newDevice.id} class="tbl-ipt w-full" type="text" /></td>
|
||||
<td class="tbl-bdy" />
|
||||
</tr>
|
||||
{/if}
|
||||
</tbody>
|
||||
</table>
|
||||
<button class="btn-lg" on:click={() => ((showInput = !showInput), devListSave())}>{showInput ? "Сохранить" : "Добавить устройство"}</button>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user