JhHardwareWRS/pages/deviceQr/deviceQr.wxml
2026-06-24 15:19:14 +08:00

192 lines
8.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<view class="page safe-bottom">
<view class="header">
<text class="title">模具二维码</text>
<text class="subtitle">选择产品名称、工序和冲压方式生成扫码报工入口</text>
</view>
<view class="card qr-work-card">
<view class="form-item">
<view class="field-head">
<text class="label">产品名称 / 工序 / 冲压方式</text>
<button class="btn mini secondary batch-entry-btn" bindtap="openBatchModal">批量生成</button>
</view>
<input
class="input"
value="{{keyword}}"
placeholder="输入产品、工序或冲压方式搜索模具"
bindfocus="showDropdown"
bindinput="onInput"
/>
<view wx:if="{{dropdownVisible}}" class="mold-dropdown">
<view
wx:for="{{filteredMoldOptions}}"
wx:key="uniqueKey"
class="mold-option"
data-index="{{index}}"
bindtap="selectMold"
>
<text class="mold-option-name">{{item.moldName || item.name}}</text>
<text wx:if="{{item.isMultiPerson}}" class="mold-option-tag">多人协作</text>
<text wx:if="{{item.isContinuousDie}}" class="mold-option-tag continuous-tag">连续模</text>
<text class="mold-option-process">考勤点 {{item.attendancePointName || '-'}}</text>
<text class="mold-option-process">工序 {{item.processName || '-'}} · {{item.stampingMethod || '未填冲压方式'}}</text>
</view>
<view wx:if="{{!filteredMoldOptions.length}}" class="mold-empty">未找到模具</view>
</view>
</view>
<button class="btn primary full" bindtap="generate">生成二维码</button>
<view wx:if="{{qrUrl}}" class="qr-result">
<view class="qr-frame" bindtap="preview">
<image
class="qr-image"
src="{{qrImageUrl || qrUrl}}"
mode="widthFix"
show-menu-by-longpress="{{true}}"
bindload="onQrLoad"
binderror="onQrError"
></image>
</view>
<text wx:if="{{qrLoadError}}" class="qr-error">{{qrLoadError}}</text>
<text class="value">模具 {{generatedMoldName}}</text>
<text wx:if="{{selectedMold && selectedMold.attendancePointName}}" class="subtitle">考勤点 {{selectedMold.attendancePointName}}</text>
<text class="subtitle">{{qrPath}}</text>
</view>
</view>
<view class="card batch-task-card">
<view class="task-head">
<view>
<text class="task-title">ZIP任务列表</text>
<text class="subtitle">批量二维码后台生成完成后可转发ZIP</text>
</view>
<button class="btn mini secondary" loading="{{taskLoading}}" bindtap="refreshBatchTasks">刷新</button>
</view>
<view wx:if="{{!taskRows.length}}" class="mold-empty">暂无ZIP任务</view>
<view
wx:for="{{taskRows}}"
wx:key="id"
wx:for-index="taskIndex"
class="task-swipe-wrap"
data-id="{{item.id}}"
bindtouchstart="onTaskTouchStart"
bindtouchmove="onTaskTouchMove"
bindtouchend="onTaskTouchEnd"
>
<view
class="task-delete-btn"
data-index="{{taskIndex}}"
catchtap="deleteBatchTask"
>
<text>删除</text>
</view>
<view class="task-item {{swipedTaskId == item.id ? 'swiped' : ''}}">
<view class="task-row">
<view class="task-main">
<text class="task-file">{{item.fileName}}</text>
<text class="task-meta">二维码数量 {{item.itemCount}} · {{item.statusName}}</text>
</view>
<view class="task-side">
<text class="task-status {{item.isCompleted ? 'success' : ''}} {{item.isPaused ? 'paused' : ''}} {{item.isFailed ? 'danger' : ''}}">{{item.progressPercent}}%</text>
<button
wx:if="{{item.isPending || item.isRunning}}"
class="btn mini secondary task-small-btn"
data-index="{{taskIndex}}"
catchtap="stopBatchTask"
>停止</button>
<button
wx:if="{{item.isPaused}}"
class="btn mini primary task-small-btn"
data-index="{{taskIndex}}"
catchtap="resumeBatchTask"
>继续</button>
</view>
</view>
<view class="progress-track">
<view class="progress-fill {{item.isPaused ? 'paused' : ''}} {{item.isFailed ? 'failed' : ''}}" style="width: {{item.progressPercent}}%;"></view>
</view>
<view class="task-time-grid">
<view>
<text class="label">开始时间</text>
<text class="value">{{item.startedAtText || '-'}}</text>
</view>
<view>
<text class="label">完成时间</text>
<text class="value">{{item.finishedAtText || '-'}}</text>
</view>
</view>
<text wx:if="{{item.errorMessage}}" class="task-error">{{item.errorMessage}}</text>
<view class="task-actions-row">
<button
wx:if="{{item.isCompleted && item.zipUrl}}"
class="btn primary full task-action-btn"
data-index="{{taskIndex}}"
catchtap="shareBatchTask"
>转发ZIP</button>
</view>
</view>
</view>
<view wx:if="{{taskRows.length}}" class="button-row pager-row task-pager">
<button class="btn secondary pager-nav" data-direction="-1" bindtap="changeTaskPage" disabled="{{taskPage <= 1}}">上一页</button>
<view class="page-jump-control">
<input class="page-jump-input" type="number" confirm-type="done" value="{{taskPageInput}}" bindinput="onTaskPageInput" bindconfirm="jumpTaskPage" />
<text class="page-total-label">/ {{taskTotalPages}}</text>
<text class="page-jump-action" bindtap="jumpTaskPage">跳</text>
</view>
<button class="btn secondary pager-nav" data-direction="1" bindtap="changeTaskPage" disabled="{{taskPage >= taskTotalPages}}">下一页</button>
</view>
</view>
<view wx:if="{{batchModalVisible}}" class="modal-mask batch-modal-mask" catchtap="closeBatchModal">
<view class="modal-panel batch-modal-panel" catchtap="noop">
<view class="batch-head">
<view>
<text class="batch-title">批量生成二维码</text>
<text class="subtitle">已选择 {{selectedMoldCount}} 个模具</text>
</view>
<button class="btn mini secondary batch-select-btn" bindtap="toggleSelectAll">
{{allFilteredSelected ? '取消全选' : '全选'}}
</button>
</view>
<view class="batch-search">
<input
class="input"
value="{{batchKeyword}}"
placeholder="筛选产品、工序、冲压方式或考勤点"
bindinput="onBatchInput"
/>
</view>
<checkbox-group bindchange="onBatchSelectionChange">
<scroll-view class="batch-list" scroll-y>
<label
wx:for="{{batchMoldOptions}}"
wx:key="uniqueKey"
class="batch-option {{item.checked ? 'checked' : ''}}"
>
<checkbox value="{{item.uniqueKey}}" checked="{{item.checked}}" />
<view class="batch-option-text">
<text class="mold-option-name">{{item.moldName || item.name}}</text>
<text wx:if="{{item.isMultiPerson}}" class="mold-option-tag">多人协作</text>
<text wx:if="{{item.isContinuousDie}}" class="mold-option-tag continuous-tag">连续模</text>
<text class="mold-option-process">考勤点 {{item.attendancePointName || '-'}}</text>
<text class="mold-option-process">工序 {{item.processName || '-'}} · {{item.stampingMethod || '未填冲压方式'}}</text>
</view>
</label>
<view wx:if="{{!batchMoldOptions.length}}" class="mold-empty">未找到模具</view>
</scroll-view>
</checkbox-group>
<view class="batch-actions">
<button class="btn secondary full" bindtap="closeBatchModal">取消</button>
<button
class="btn primary full"
loading="{{batchGenerating}}"
bindtap="createBatchTask"
>生成ZIP任务</button>
</view>
</view>
</view>
</view>