李旭东
2023-11-03 10686c5e51ef98ca459ab000462c0701e0bb17ea
sz_app/pages/spotCheck/deviceSpot.vue
@@ -8,15 +8,15 @@
            </view>
            <view class="device_item_value">
               <span class="label">设备名称:</span>
               <span>混凝土搅拌机</span>
               <span>{{deviceData.bigDeviceName}}</span>
            </view>
            <view class="device_item_value">
               <span class="label">型号规格:</span>
               <span>混凝土搅拌机</span>
               <span>{{deviceData.bigDeviceModel}}</span>
            </view>
            <view class="device_item_value">
               <span class="label">设备类型:</span>
               <span>混凝土搅拌机</span>
               <span>{{deviceData.bigType === 1 ? '特种设备' : '一般设备'}}</span>
            </view>
         </view>
         <view class="device_form">
@@ -106,16 +106,16 @@
         :columns="checkTypeData" 
         keyName="dictName"
         closeOnClickOverlay
         @cancel="cancelCheckType()"
         @confirm="confirmCheckType()"
         @cancel="cancelCheckType"
         @confirm="confirmCheckType"
         @close="showCheckType = false"
         ></u-picker>
   </view>
</template>
<script>
   import baseUrl from '../../api/http.js';
import { changeTime, throttle } from '../../plugins/public.js';
   import { baseUrl } from '../../api/http.js';
   import { changeTime, throttle } from '../../plugins/public.js';
   export default {
      data() {
         return {
@@ -144,7 +144,10 @@
            colorStyle: 'linear-gradient(to right, rgb(79, 142, 244), rgb(85, 109, 254))',
            showTime: false,
            defaultTime: Number(new Date()),
            deviceId: ''
            deviceId: '',
            deviceData: {},
            showCheckType: false,
            checkTypeData: [],
         }
      },
      onReady() {
@@ -152,7 +155,13 @@
      },
      onLoad(option) {
         this.deviceId = option.deviceId;
         console.log(option,'option')
         this.getChackAllTypes();
         this.$api.spot.getDeviceDetails({
            bigDeviceId: option.deviceId
         }).then((res) => {
            this.deviceData = res.data;
         })
      },
      methods: {
         // 获取点检类型
@@ -162,11 +171,11 @@
            pageSize: 100000000,
            dictType: 'check_type'
            });
            this.checkTypeData = data.list;
            this.checkTypeData.push(data.list);
      },
         // 读取图片后
         afterRead(event) {
            console.log(event);
            console.log(event,'event', `${baseUrl}/file/file/upload`);
            this.fileList.push({
               status: 'loading',
               message: '上传中',
@@ -178,15 +187,17 @@
               name: 'file',
               success: (res) => {
                  const data = JSON.parse(res.data);
                  console.log(data,'?????');
                  this.$set(this.fileList, this.fileList.length - 1, {
                     id: this.fileList.length + 1,
                     status: 'success',
                     message: '',
                     data: data.data,
                     url: `http://filemanage.thhy-tj.com:8888/${data.data}`
                     url: `http://filemanage.thhy-tj.com:8888/suapi/${data.data}`
                  })
               },
               fail: (error) => {
                  console.log(error,'error');
                  uni.$u.toast('上传失败!');
               }
            })
@@ -224,14 +235,15 @@
         },
         // 点击选择点检类型
         confirmCheckType({ value }) {
            this.$set(this.formSpot, 'checkTypeName', value[0].dictName);
            this.$set(this.formSpot, 'checkType', value[0].dictId);
            this.showCheckType = false;
            this.$set(this.formSpot, 'checkTypeName', value[0].checkTypeName);
            this.$set(this.formSpot, 'checkType', value[0].checkType);
         },
         // 提交点检信息
         submitForm: throttle(function() {
            this.$refs.form.validate().then((valid) => {
               if(valid) {
                  console.log(valid,'valid');
                  const params = Object.assign({}, this.formSpot);
                  delete params.checkTypeName;
                  params.deviceId = this.deviceId;
@@ -241,7 +253,10 @@
                           file: item.data
                        }
                     })
                  } else {
                     params.fileList = [];
                  }
                  console.log(params,'params');
                  this.$api.spot.insertSpotCheckInfo(params).then(res => {
                     if(res.success) {
                        uni.$u.toast('添加成功!');