94 lines
3.2 KiB
Go Template
94 lines
3.2 KiB
Go Template
{{define "tasks"}}
|
||||
|
|
<!doctype html>
|
|||
|
|
<html lang="zh-CN">
|
|||
|
|
<head>
|
|||
|
|
<title>{{.Page.Title}} - 采购任务管理</title>
|
|||
|
|
{{template "document-head" .}}
|
|||
|
|
</head>
|
|||
|
|
<body>
|
|||
|
|
{{template "site-header" .}}
|
|||
|
|
<main id="main-content" class="page">
|
|||
|
|
<div class="title-row">
|
|||
|
|
<div>
|
|||
|
|
<h1>采购任务</h1>
|
|||
|
|
<p class="subtitle">按最近创建时间查看采购任务状态</p>
|
|||
|
|
</div>
|
|||
|
|
<a class="button primary" href="/tasks/new">新建任务</a>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<form class="filters" method="get" action="/tasks" data-loading-form>
|
|||
|
|
<div class="field compact">
|
|||
|
|
<label for="task-search">搜索</label>
|
|||
|
|
<input id="task-search" name="q" type="search" value="{{.Query}}"
|
|||
|
|
placeholder="任务编号、标题或 SKU">
|
|||
|
|
</div>
|
|||
|
|
<div class="field compact">
|
|||
|
|
<label for="task-status">状态</label>
|
|||
|
|
<select id="task-status" name="status">
|
|||
|
|
{{range .StatusOptions}}
|
|||
|
|
<option value="{{.Value}}" {{if .Selected}}selected{{end}}>{{.Label}}</option>
|
|||
|
|
{{end}}
|
|||
|
|
</select>
|
|||
|
|
</div>
|
|||
|
|
<button class="button filter-button" type="submit" data-loading-label="正在加载…">应用筛选</button>
|
|||
|
|
</form>
|
|||
|
|
|
|||
|
|
<section class="table-region" aria-labelledby="task-table-title" data-loading-region>
|
|||
|
|
<h2 id="task-table-title" class="visually-hidden">任务列表结果</h2>
|
|||
|
|
{{if .Items}}
|
|||
|
|
<table>
|
|||
|
|
<thead>
|
|||
|
|
<tr>
|
|||
|
|
<th scope="col">任务</th>
|
|||
|
|
<th scope="col">状态</th>
|
|||
|
|
<th scope="col">执行设备</th>
|
|||
|
|
<th scope="col">更新时间</th>
|
|||
|
|
<th scope="col"><span class="visually-hidden">操作</span></th>
|
|||
|
|
</tr>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
{{range .Items}}
|
|||
|
|
<tr>
|
|||
|
|
<td data-label="任务">
|
|||
|
|
<strong class="task-title">{{.Title}}</strong>
|
|||
|
|
<span class="secondary">SKU:{{.SKU}}</span>
|
|||
|
|
<span class="secondary">编号:{{.ID}}</span>
|
|||
|
|
</td>
|
|||
|
|
<td data-label="状态">
|
|||
|
|
<span class="status {{.StatusClass}}" title="状态码 {{.Status}}">{{.StatusLabel}}</span>
|
|||
|
|
</td>
|
|||
|
|
<td data-label="执行设备">{{.DeviceName}}</td>
|
|||
|
|
<td data-label="更新时间">
|
|||
|
|
<time datetime="{{machineTime .UpdatedAt}}">{{displayTime .UpdatedAt}}</time>
|
|||
|
|
</td>
|
|||
|
|
<td data-label="操作">
|
|||
|
|
<a class="detail-link" href="/tasks/{{pathPart .ID}}">查看详情</a>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
{{end}}
|
|||
|
|
</tbody>
|
|||
|
|
</table>
|
|||
|
|
{{else}}
|
|||
|
|
<div class="empty-state">
|
|||
|
|
<h2>没有符合条件的任务</h2>
|
|||
|
|
{{if or .Query .Status}}
|
|||
|
|
<p>请调整搜索或状态筛选后重试。</p>
|
|||
|
|
<a class="button" href="/tasks">清除筛选</a>
|
|||
|
|
{{else}}
|
|||
|
|
<p>创建第一条采购任务后,它会显示在这里。</p>
|
|||
|
|
<a class="button primary" href="/tasks/new">新建任务</a>
|
|||
|
|
{{end}}
|
|||
|
|
</div>
|
|||
|
|
{{end}}
|
|||
|
|
</section>
|
|||
|
|
|
|||
|
|
{{if .NextCursor}}
|
|||
|
|
<nav class="pagination" aria-label="任务分页">
|
|||
|
|
<a class="button" href="/tasks?q={{.Query}}&status={{.Status}}&cursor={{.NextCursor}}">下一页</a>
|
|||
|
|
</nav>
|
|||
|
|
{{end}}
|
|||
|
|
</main>
|
|||
|
|
</body>
|
|||
|
|
</html>
|
|||
|
|
{{end}}
|