| | |
| | | <view class="th name">元器件名称</view> |
| | | <view class="th spec">规格</view> |
| | | <view class="th manufacturer">制造商</view> |
| | | <view class="th operation">上传图片</view> |
| | | |
| | | </view> |
| | | |
| | |
| | | </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'"> |
| | |
| | | <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> |
| | |
| | | @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> |
| | |
| | | item.selectedSpec = index |
| | | } |
| | | }, |
| | | uploadImages() { |
| | | uploadImages(id) { |
| | | // 上传/查看图片的逻辑 |
| | | uni.navigateTo({ |
| | | url: 'ImageItem?id=888' + this.formid |
| | | url: 'ImageItem?id=888' + id.sort()[0] |
| | | }); |
| | | }, |
| | | async handleSubmit() { |
| | |
| | | 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) { |
| | |
| | | |
| | | .name { width: 20%; } |
| | | .spec { width: 30%; } |
| | | .manufacturer { width: 35%; } |
| | | .operation { width: 15%; } |
| | | .manufacturer { width: 30%; } |
| | | .operation { width: 20%; } |
| | | |
| | | /* 选项样式 */ |
| | | .option-item { |