¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <view class="container"> |
| | | <!-- æ é¢ + è¾å
¥æ¡ --> |
| | | <view class="input-section"> |
| | | <text class="label">设å¤ç¼ç ï¼</text> |
| | | <input |
| | | ref="scannerInput" |
| | | type="text" |
| | | v-model="scanResult" |
| | | class="input-box" |
| | | placeholder="è¯·æ«æäºç»´ç " |
| | | :focus="inputFocus" |
| | | @confirm="handleScan" |
| | | /> |
| | | </view> |
| | | |
| | | <!-- 表ååºå --> |
| | | <view class="form-section"> |
| | | <view class="form-item"> |
| | | <text class="form-label">设å¤åç§°ï¼</text> |
| | | <input v-model="deviceName" class="form-input" placeholder="请è¾å
¥è®¾å¤åç§°" /> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="form-label">ç¹æ£ç¼å·ï¼</text> |
| | | <input v-model="planNo" class="form-input" placeholder="请è¾å
¥ç¹æ£ç¼å·" /> |
| | | </view> |
| | | <view class="form-item"> |
| | | <text class="form-label">ç¹æ£äººï¼</text> |
| | | <input v-model="inspector" class="form-input" placeholder="ç¹æ£äºº" readonly /> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- ç¹æ£å
容åç¹æ£ç»æè¡¨æ ¼ --> |
| | | <view class="list-container" style="margin-top: 40rpx;"> |
| | | <uni-table ref="table" border emptyText="ææ ç¹æ£è®°å½"> |
| | | <uni-tr> |
| | | <uni-th align="center" style="color: #FFFFFF; background-color: lightskyblue;">åºå·</uni-th> |
| | | <uni-th align="center" style="color: #FFFFFF; background-color: lightskyblue;">ç¹æ£å
容</uni-th> |
| | | <uni-th align="center" style="color: #FFFFFF; background-color: lightskyblue;">ç¹æ£ç»æ</uni-th> |
| | | </uni-tr> |
| | | <uni-tr v-for="(item, index) in inspectionItems" :key="index"> |
| | | <uni-td align="center">{{ index + 1 }}</uni-td> |
| | | <uni-td align="center"> |
| | | <input class="form-input" v-model="item.content" placeholder="请è¾å
¥ç¹æ£å
容" /> |
| | | </uni-td> |
| | | <uni-td align="center"> |
| | | <picker :range="['åæ ¼','ä¸åæ ¼']" :value="getPickerIndex(item.result)" @change="e => onPickerChange(index, e)"> |
| | | <view class="form-input">{{ item.result || 'è¯·éæ©ç»æ' }}</view> |
| | | </picker> |
| | | </uni-td> |
| | | </uni-tr> |
| | | </uni-table> |
| | | </view> |
| | | |
| | | <!-- æäº¤å¹¶æ¸
é¤æé® --> |
| | | <button class="submit-button" @click="submitData">æäº¤æ°æ®</button> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | data() { |
| | | return { |
| | | scanResult: '', |
| | | inputFocus: true, |
| | | deviceName: '', |
| | | deviceNo: '', |
| | | inspector: '', |
| | | inspectionItems: [] |
| | | }; |
| | | }, |
| | | mounted() { |
| | | const username = this.$loginInfo?.account; |
| | | if (username) { |
| | | this.inspector = username; |
| | | } else { |
| | | console.warn('æªè·åå°ç»å½ç¨æ·ä¿¡æ¯'); |
| | | } |
| | | }, |
| | | methods: { |
| | | handleScan() { |
| | | this.refreshResult(); |
| | | }, |
| | | refreshResult() { |
| | | if (!this.scanResult) { |
| | | uni.showToast({ title: '请å
æ«ææ¡ç ', icon: 'none' }); |
| | | return; |
| | | } |
| | | |
| | | this.$post({ |
| | | url: "/MesEqMaintain/getDjDetail", |
| | | data: { eqNo: this.scanResult } |
| | | }).then(res => { |
| | | if (res && res.status === 0 && res.data?.tbBillList?.result) { |
| | | const result = res.data.tbBillList.result; |
| | | const eqList = result.eqInfoList || []; |
| | | |
| | | if (eqList.length > 0) { |
| | | this.deviceName = eqList[0].eqName; |
| | | this.planNo = eqList[0].planNo; |
| | | } |
| | | |
| | | this.inspectionItems = (result.mesEqKeepsType02List || []).map(item => ({ |
| | | id: item.id || '', |
| | | content: item.eqMain || '', |
| | | result: item.eqEnd || '', |
| | | eqEnd: item.eqEnd || '' |
| | | })); |
| | | |
| | | } else { |
| | | this.inspectionItems = []; |
| | | this.deviceName = ''; |
| | | this.planNo = ''; |
| | | uni.showToast({ title: 'æ ç¸å
³ç¹æ£è®°å½', icon: 'none' }); |
| | | } |
| | | }).catch(err => { |
| | | console.error('æ¥å£è¯·æ±å¤±è´¥:', err); |
| | | uni.showToast({ title: '请æ±å¤±è´¥', icon: 'none' }); |
| | | }); |
| | | }, |
| | | getPickerIndex(val) { |
| | | return ['åæ ¼', 'ä¸åæ ¼'].indexOf(val); |
| | | }, |
| | | onPickerChange(index, e) { |
| | | const options = ['åæ ¼', 'ä¸åæ ¼']; |
| | | this.inspectionItems[index].result = options[e.detail.value]; |
| | | }, |
| | | submitData() { |
| | | const dataToSend = this.inspectionItems.map(item => ({ |
| | | id: item.id, |
| | | content: item.content, |
| | | result: item.result |
| | | })); |
| | | |
| | | console.log('å³å°åéçç¹æ£ç»ææ°æ®:', dataToSend); |
| | | |
| | | this.$post({ |
| | | url: "/MesEqMaintain/UpDateDjDetail", |
| | | data: { |
| | | userNo: this.$loginInfo?.account, |
| | | releaseNo: this.planNo, |
| | | inspectionItems: dataToSend |
| | | } |
| | | }).then(res => { |
| | | if (res && res.status === 0) { |
| | | this.scanResult = ''; |
| | | this.inspectionItems = []; |
| | | this.inputFocus = false; |
| | | this.$nextTick(() => { this.inputFocus = true; }); |
| | | this.deviceName = ''; |
| | | this.planNo = ''; |
| | | uni.showToast({ title: 'æ°æ®æäº¤æå', icon: 'success' }); |
| | | } else { |
| | | uni.showToast({ title: 'æ°æ®æäº¤å¤±è´¥', icon: 'none' }); |
| | | } |
| | | }).catch(err => { |
| | | console.error('æ°æ®æäº¤æ¥å£è¯·æ±å¤±è´¥:', err); |
| | | uni.showToast({ title: 'æ°æ®æäº¤å¤±è´¥', icon: 'none' }); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .container { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | padding: 80rpx 40rpx; |
| | | background-color: #f9f9f9; |
| | | min-height: 100vh; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .input-section { |
| | | display: flex; |
| | | flex-direction: row; |
| | | align-items: center; |
| | | width: 100%; |
| | | justify-content: center; |
| | | margin-bottom: 40rpx; |
| | | } |
| | | |
| | | .label { |
| | | font-weight: bold; |
| | | font-size: 34rpx; |
| | | margin-right: 20rpx; |
| | | } |
| | | |
| | | .input-box { |
| | | flex: 1; |
| | | height: 90rpx; |
| | | font-size: 30rpx; |
| | | border: 1px solid #ccc; |
| | | border-radius: 16rpx; |
| | | padding-left: 20rpx; |
| | | background-color: #fff; |
| | | box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); |
| | | } |
| | | |
| | | .result { |
| | | font-size: 30rpx; |
| | | color: #2c7; |
| | | margin-bottom: 40rpx; |
| | | text-align: center; |
| | | } |
| | | |
| | | .clear-button { |
| | | width: 100%; |
| | | height: 90rpx; |
| | | line-height: 90rpx; |
| | | font-size: 32rpx; |
| | | border-radius: 16rpx; |
| | | background-color: #ff4d4f; |
| | | color: #fff; |
| | | margin-bottom: 40rpx; |
| | | } |
| | | |
| | | .submit-button { |
| | | width: 100%; |
| | | height: 90rpx; |
| | | line-height: 90rpx; |
| | | font-size: 32rpx; |
| | | border-radius: 16rpx; |
| | | background-color: #ff4d4f; |
| | | color: #fff; |
| | | margin-bottom: 40rpx; |
| | | } |
| | | |
| | | .form-section { |
| | | width: 100%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 30rpx; |
| | | } |
| | | |
| | | .form-item { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 0 20rpx; |
| | | } |
| | | |
| | | .form-label { |
| | | width: 180rpx; |
| | | font-size: 30rpx; |
| | | font-weight: bold; |
| | | } |
| | | |
| | | .form-input { |
| | | flex: 1; |
| | | height: 80rpx; |
| | | border: 1px solid #ccc; |
| | | border-radius: 12rpx; |
| | | padding-left: 20rpx; |
| | | font-size: 28rpx; |
| | | background-color: #fff; |
| | | } |
| | | </style> |