From f571cf0182abd65176fb1512c5cb5ddaea49c4a3 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期二, 24 六月 2025 09:00:14 +0800 Subject: [PATCH] feat(eims): 设备状态变更记录功能 --- eims-ui-mobile/src/pages/scan/index.vue | 145 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 126 insertions(+), 19 deletions(-) diff --git a/eims-ui-mobile/src/pages/scan/index.vue b/eims-ui-mobile/src/pages/scan/index.vue index d8fca76..55f889a 100644 --- a/eims-ui-mobile/src/pages/scan/index.vue +++ b/eims-ui-mobile/src/pages/scan/index.vue @@ -25,11 +25,11 @@ <wd-tag v-else-if="model.status === '2'" class="ml-2" type="danger">鍋滅敤</wd-tag> <wd-tag v-else-if="model.status === '3'" class="ml-2" bg-color="pink">鎶ュ簾</wd-tag> <wd-tag v-else-if="model.status === '4'" class="ml-2" type="warning">闂茬疆</wd-tag> - <wd-tag v-else-if="model.status === '5'" class="ml-2">鏂板</wd-tag> + <wd-tag v-else class="ml-2">鏂板</wd-tag> </view> <view @click="handleInfo"> - <text class="icon-color-base">璇︽儏</text> + <text class="icon-color-base">鐘舵�佸彉鏇�</text> <wd-icon name="arrow-right" custom-class="icon-color-base"></wd-icon> </view> </view> @@ -103,6 +103,33 @@ @select="select" cancel-text="鍙栨秷" /> + + <wd-popup v-model="showStatusDialog" position="center" round :close-on-click-modal="false"> + <view class="popup-container"> + <view class="popup-title">璁惧鐘舵�佸彉鏇�</view> + <view class="flex flex-wrap justify-between mb-4"> + <view + v-for="item in statusOptions" + :key="item.value" + :class="['status-option', selectedStatus === item.value ? 'active' : '']" + @click="selectStatus(item.value)" + > + {{ item.label }} + </view> + </view> + <wd-textarea + v-model="changeReason" + placeholder="璇疯緭鍏ュ彉鏇村師鍥�" + :maxlength="100" + show-word-limit + required + /> + <view class="popup-actions"> + <wd-button block @click="handleStatusChangeCancel">鍙栨秷</wd-button> + <wd-button type="primary" block class="ml-2" @click="handleStatusChangeConfirm">纭畾</wd-button> + </view> + </view> + </wd-popup> </view> <view v-else> <wd-status-tip image="search" tip="褰撳墠鎼滅储鏃犵粨鏋�" /> @@ -122,6 +149,8 @@ import ReqCard from '@/components/repair/req-card.vue' import ResCard from '@/components/repair/res-card.vue' import { useUserStore } from '@/store' +import { addEquStatu } from '@/service/equ_status' +import type { EimsEquStatuBo } from '@/service/equ_status.d' const tab = ref<number>(0) const message = useMessage() const toast = useToast() @@ -140,6 +169,17 @@ name: '鍘荤淮淇�', }, ]) +const showStatusDialog = ref(false) +const selectedStatus = ref<string>('') +const changeReason = ref<string>('') +const statusOptions = [ + { label: '璇曠敤', value: '0' }, + { label: '浣跨敤', value: '1' }, + { label: '鍋滅敤', value: '2' }, + { label: '鎶ュ簾', value: '3' }, + { label: '闂茬疆', value: '4' }, + { label: '鏂板', value: '5' }, +] function initData(assetNo: any) { getEquByAssetNo(assetNo) @@ -192,10 +232,14 @@ } function handleInfo() { - uni.showToast({ - title: '鍔熻兘寮�鍙戜腑', - icon: 'none', - }) + if (!model?.equId) { + uni.showToast({ title: '鏈煡璇㈠埌璁惧锛岃鑱旂郴绠$悊鍛橈紒', icon: 'none' }) + return + } + console.log("model::",model) + selectedStatus.value = model.status || '5' + changeReason.value = '' + showStatusDialog.value = true } function handleInsp() { @@ -273,20 +317,50 @@ break } } -;`/pages/repair/req-list`, - // 澶勭悊缁翠慨璇锋眰鐐瑰嚮浜嬩欢 - function handleReqClick(item) { - uni.navigateTo({ - url: `/pages/repair/req-detail?id=${item.id}`, - }) - } -// // 澶勭悊缁翠慨鍗曠偣鍑讳簨浠� -// function handleResClick(item) { -// uni.navigateTo({ -// url: `/pages/repair/res-detail?id=${item.id}`, -// }) -// } +// 澶勭悊缁翠慨璇锋眰鐐瑰嚮浜嬩欢 +function handleReqClick(item) { + uni.navigateTo({ + url: `/pages/repair/req-detail?id=${item.id}`, + }) +} + +defineExpose({ handleReqClick }) + +function selectStatus(val: string) { + selectedStatus.value = val +} + +function handleStatusChangeCancel() { + showStatusDialog.value = false +} + +async function handleStatusChangeConfirm() { + if (!selectedStatus.value) { + uni.showToast({ title: '璇烽�夋嫨璁惧鐘舵��', icon: 'none' }) + return + } + if (!changeReason.value.trim()) { + uni.showToast({ title: '璇峰~鍐欏彉鏇村師鍥�', icon: 'none' }) + return + } + const params: EimsEquStatuBo = { + equId: model.equId, + beforeChange: model.status, + afterChange: selectedStatus.value, + changeDesc: changeReason.value, + orderStatus: '0', + } + try { + await addEquStatu(params) + uni.showToast({ title: '鎻愪氦鎴愬姛锛屽緟绠$悊鍛樼‘璁�', icon: 'success' }) + showStatusDialog.value = false + // 鍙�夛細鍒锋柊璁惧淇℃伅 + initData(model.assetNo) + } catch (e) { + uni.showToast({ title: '鎻愪氦澶辫触', icon: 'none' }) + } +} onLoad((options) => { uni.$on('list-refresh', loadRepairData) @@ -324,4 +398,37 @@ :deep(.wd-card__title-content) { padding: 16rpx 0 !important; } +.status-option { + display: inline-block; + padding: 10rpx 24rpx; + margin: 8rpx 8rpx 8rpx 0; + border-radius: 8rpx; + border: 1px solid #eee; + background: #f7f7f7; + color: #666; + cursor: pointer; +} +.status-option.active { + background: $uni-color-primary; + color: #fff; + border-color: $uni-color-primary; +} +.popup-container { + width: 600rpx; + background: #fff; + border-radius: 16rpx; + padding: 32rpx 24rpx 24rpx 24rpx; +} +.popup-title { + font-size: 32rpx; + font-weight: bold; + text-align: center; + margin-bottom: 24rpx; +} +.popup-actions { + display: flex; + margin-top: 24rpx; + gap: 16rpx; + justify-content: space-around; +} </style> -- Gitblit v1.9.3