jiangping
2025-06-06 a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea
h5/pages/operation/device.vue
@@ -6,7 +6,7 @@
            <view class="line">
               <view class="sel_wrap" @click="showModal = true">
                  <view class="left" :class="(param.deviceName || param.deviceCode) ? '' : 'placeholder9'">
                     {{ (param.deviceName || param.deviceCode) ? `[${param.deviceCode}] ` + param.deviceName : '请选择设备' }}
                     {{ (param.deviceName || param.deviceCode) ? param.deviceName ? `[${param.deviceCode}] ` + param.deviceName : `[${param.deviceCode}]` : '请选择设备' }}
                  </view>
                  <u-icon name="arrow-right" color="#999999" size="17"></u-icon>
               </view>
@@ -83,7 +83,8 @@
   import {
      uploadUrl,
      ywDevicePost,
      ywDeviceCreate
      ywDeviceCreate,
      getFindByCode
   } from '@/api'
   import dayjs from 'dayjs';
   import {
@@ -118,14 +119,40 @@
            } = this
            if (!param.deviceId) return this.showToast('请先选择要维护的设备')
            this.handleP()
         },
         handleP() {
            const {
               param,
               fileList
            } = this
            ywDeviceCreate({
               ...param,
               userId: uni.getStorageSync('userInfo').id,
               dealDate: dayjs().format('YYYY-MM-DD HH:mm:ss'),
               multifileList: fileList
            }).then(res => {
               this.showToast('提交成功')
               uni.navigateBack()
               if (res && res.code == 200) {
                  if (param.status != 0) {
                     uni.showModal({
                        title: '温馨提示',
                        content: '设备运维结果异常,是否前往提交工单?',
                        success: function(res) {
                           if (res.confirm) {
                              uni.redirectTo({
                                 url: '/pages/workOrder/edit'
                              })
                           } else if (res.cancel) {
                              uni.navigateBack()
                           }
                        }
                     });
                  } else {
                     this.showToast('提交成功')
                     uni.navigateBack()
                  }
               }
            })
         },
         getDevice() {
@@ -144,7 +171,7 @@
               activeDevice
            } = this
            if (!activeDevice.id) return this.showToast('请先选择设备')
            this.$set(this.param, 'deviceId', activeDevice.id)
            this.$set(this.param, 'deviceId', activeDevice.id)
            this.$set(this.param, 'deviceCode', activeDevice.code)
            this.$set(this.param, 'deviceName', activeDevice.name)
            this.showModal = false
@@ -262,8 +289,18 @@
                     },
                     (decodeText, decodeResult) => {
                        if (decodeText) { //这里decodeText就是通过扫描二维码得到的内容
                           this.$set(this.param, 'deviceCode', decodeText)
                           this.stopScan(); //关闭扫码功能
                           getFindByCode(decodeText).then(ress => {
                              if (ress.data) {
                                 console.log('ress', ress.data);
                                 this.$set(this.param, 'deviceCode', ress.data.code)
                                 this.$set(this.param, 'deviceId', ress.data.id)
                                 this.$set(this.param, 'deviceName', ress.data.name)
                              } else {
                                 this.showToast('未匹配到巡检点,请重新扫描')
                              }
                           })
                        }
                     },
                     (err) => {
@@ -413,7 +450,7 @@
      // bottom: 68rpx;
      // left: 40rpx;
      width: 670rpx;
      height: 88rpx;
      height: 88rpx;
      margin-top: 80rpx;
      background: $primaryColor;
      box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 104, 255, 0.3);
@@ -458,8 +495,9 @@
      }
      .modal_list {
         height: calc(100% - 360rpx);
         height: calc(100% - 360rpx);
         margin-bottom: -20rpx;
         .item {
            display: flex;
            align-items: center;