小程序工单设备代码传入

This commit is contained in:
2025-12-31 12:06:21 +08:00
parent 1c207c2439
commit 1ef1b32f5f
5 changed files with 193 additions and 125 deletions

View File

@@ -95,14 +95,14 @@
<!-- 设备铭牌 -->
<view class="form-item">
<text class="form-label">设备铭牌</text>
<text class="form-label">设备铭牌<text class="required" v-if="mode === 'create'">*</text></text>
<input v-if="mode === 'create'" class="form-input" v-model="workcase.deviceNamePlate" placeholder="请输入设备铭牌"/>
<text v-else class="form-value">{{ workcase.deviceNamePlate || '-' }}</text>
</view>
<!-- 铭牌照片 -->
<view class="form-item">
<text class="form-label">铭牌照片<text class="required" v-if="mode === 'create'">*</text></text>
<text class="form-label">铭牌照片</text>
<!-- 创建模式:上传铭牌 -->
<view v-if="mode === 'create'" class="nameplate-upload">
<view v-if="workcase.deviceNamePlateImg" class="nameplate-preview" @tap="previewNameplateImage">
@@ -457,6 +457,7 @@ onLoad((options: any) => {
mode.value = 'create'
// create 模式必须从上一页带入 roomId前端先建 room 的策略)
const roomId = options.roomId || ''
const deviceCodeParam = decodeURIComponent(options.deviceCode || '')
if (!roomId) {
uni.showToast({ title: '缺少roomId无法创建工单', icon: 'none' })
// 直接退出,避免后续提交失败
@@ -485,6 +486,8 @@ onLoad((options: any) => {
phone,
userId,
roomId,
deviceCode: deviceCodeParam,
deviceNamePlate: deviceCodeParam,
device: '',
type: '',
address: '',
@@ -1102,8 +1105,8 @@ async function submitWorkcase() {
uni.showToast({ title: '请输入故障描述', icon: 'none' })
return
}
if (!workcase.deviceNamePlateImg) {
uni.showToast({ title: '请上传设备铭牌照片', icon: 'none' })
if (!workcase.deviceNamePlate) {
uni.showToast({ title: '请输入设备铭牌', icon: 'none' })
return
}
if (!workcase.imgs || workcase.imgs.length === 0) {