zjh
7 天以前 d123ca35bb3ec4982af44aeb1ffffa8a3569a21b
pages/QC/LLJ/yzxFrom.vue
@@ -5,6 +5,7 @@
      <view class="th name">元器件名称</view>
      <view class="th spec">规格</view>
      <view class="th manufacturer">制造商</view>
     <view class="th operation">上传图片</view>
      
    </view>
@@ -34,6 +35,9 @@
          </view>
        </view>
      
      <view class="td operation" v-if="current=='true'">
         <button class="secondary-btn" @click="uploadImages(item.id)">上传/查看图片</button>
      </view>
 
 <!-- 规格列 -->
 <view class="td spec" v-if="current!='true'">
@@ -56,7 +60,9 @@
     <text class="option-text">{{ mfg }}</text>
   </view>
 </view>
 <view class="td operation" v-if="current!='true'">
    <button class="secondary-btn" @click="uploadImages(item.id)">上传/查看图片</button>
 </view>
 
 
      </view>
@@ -69,7 +75,7 @@
              @tap="handleSubmit">
        {{ isSubmitting ? '提交中...' : '保存清单' }}
      </button>
     <button class="secondary-btn" @click="uploadImages">上传/查看图片</button>
     <!-- <button class="secondary-btn" @click="uploadImages">上传/查看图片</button> -->
    </view>
   <view class="submit-container" v-if="components.length==0">
     <h1>温馨提示:</h1>
@@ -103,10 +109,10 @@
        item.selectedSpec = index
      }
    },
   uploadImages() {
   uploadImages(id) {
     // 上传/查看图片的逻辑
    uni.navigateTo({
       url: 'ImageItem?id=888' + this.formid
       url: 'ImageItem?id=888' + id.sort()[0]
    });
   },
    async handleSubmit() {
@@ -147,30 +153,42 @@
            data: submitData
         }
      }).then(res => {
         if(res.status==0){
            uni.showToast({
              title: '保存成功',
              icon: 'success',
              duration: 2000
            })
         }else{
            uni.showModal({
               title: "提示",
               content: res.message,
               confirmText: "确定",
               showCancel: false,
               success: (res) => {
               }
            })
         }
      }).catch(() => {
         this.isLoading = false; // 出现错误时结束加载
      });
        uni.showToast({
          title: '保存成功',
          icon: 'success',
          duration: 2000
        })
        
      } finally {
        this.isSubmitting = false
      }
    },
    validateForm() {
      for (const item of this.components) {
        if (item.selectedSpec === -1 || item.selectedMfg === -1) {
          return {
            valid: false,
            msg: `${item.name} 未完成选择`
          }
        }
      }
      // for (const item of this.components) {
      //   if (item.selectedSpec === -1 || item.selectedMfg === -1) {
      //     return {
      //       valid: false,
      //       msg: `${item.name} 未完成选择`
      //     }
      //   }
      // }
      return { valid: true }
    },
         onLoad(options) {
@@ -223,8 +241,8 @@
.name { width: 20%; }
.spec { width: 30%; }
.manufacturer { width: 35%; }
.operation { width: 15%; }
.manufacturer { width: 30%; }
.operation { width: 20%; }
/* 选项样式 */
.option-item {