小程序工单设备代码传入
This commit is contained in:
@@ -157,6 +157,7 @@ const roomId = ref<string>('')
|
||||
const workcaseId = ref<string>('')
|
||||
const roomName = ref<string>('聊天室')
|
||||
const guestId = ref<string>('') // 聊天室访客ID
|
||||
const deviceCode = ref<string>('') // 聊天室设备代码
|
||||
const commentLevel = ref<number>(0) // 已有评分
|
||||
const inputText = ref<string>('')
|
||||
const scrollTop = ref<number>(0)
|
||||
@@ -312,6 +313,7 @@ async function refreshChatRoomInfo() {
|
||||
roomName.value = roomRes.data.roomName || '聊天室'
|
||||
workcaseId.value = roomRes.data.workcaseId || ''
|
||||
guestId.value = roomRes.data.guestId || ''
|
||||
deviceCode.value = roomRes.data.deviceCode || ''
|
||||
commentLevel.value = roomRes.data.commentLevel || 0
|
||||
messageTotal.value = roomRes.data.messageCount || 0
|
||||
}
|
||||
@@ -345,6 +347,7 @@ async function loadChatRoom() {
|
||||
roomName.value = roomRes.data.roomName || '聊天室'
|
||||
workcaseId.value = roomRes.data.workcaseId || ''
|
||||
guestId.value = roomRes.data.guestId || ''
|
||||
deviceCode.value = roomRes.data.deviceCode || ''
|
||||
messageTotal.value = roomRes.data.messageCount || 0
|
||||
commentLevel.value = roomRes.data.commentLevel!
|
||||
}
|
||||
@@ -587,8 +590,8 @@ function handleWorkcaseAction() {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
// 跳转到创建工单页面
|
||||
const url = `/pages/workcase/workcaseDetail/workcaseDetail?mode=create&roomId=${roomId.value}`
|
||||
// 跳转到创建工单页面,携带 deviceCode
|
||||
const url = `/pages/workcase/workcaseDetail/workcaseDetail?mode=create&roomId=${roomId.value}&deviceCode=${encodeURIComponent(deviceCode.value || '')}`
|
||||
console.log('[handleWorkcaseAction] 创建工单,跳转URL:', url)
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user