loulijun2021
2023-10-18 639073fd37ec8aaeed4334114da26051c83ae556
pages/mjgl/mjdj.vue
@@ -159,7 +159,8 @@
         <view class="footer" v-show='centerContent.length!==0'>
            <u-button size="large" :loading="isDisabledSubmitButton" loadingText="正在提交,请稍等..." type="primary"
               @click="submit" :disabled="resultValue===''" text="确认提交">
               :disabled="centerContent.filter(i=>i.isOK==='OK'||i.isOK==='NG').length!==centerContent.length"
               @click="submit" text="确认提交">
            </u-button>
         </view>
@@ -204,7 +205,6 @@
            selectValue: '',
            centerContent: [],
            resultValue: ''
         }
      },
      created() {
@@ -217,8 +217,8 @@
         init() {
            uni.stopPullDownRefresh();
            this.getCheckScanMouldQrCodeData('001')
            this.getCheckScanMouldTemp('001')
            // this.getCheckScanMouldQrCodeData('001')
            // this.getCheckScanMouldTemp('001')
            // this.getSelectScanMouldQrCodeItem('001', '001')
         },
         async getCheckScanMouldQrCodeData(mouldcode) {
@@ -236,6 +236,10 @@
               mouldcode: mouldcode
            })
            this.standardArr = res
            this.centerContent = []
            this.resultValue = ''
            this.selectValue = ''
         },
         async getSelectScanMouldQrCodeItem(mouldcode, checktempcode) {
            const {
@@ -285,7 +289,7 @@
         selectClick(val) {
            this.resultValue = ''
            this.selectValue = val.name
            this.getSelectScanMouldQrCodeItem('001', val.code)
            this.getSelectScanMouldQrCodeItem(this.topContent[0].code, val.code)
         },
         bwClick(item, val) {
@@ -301,18 +305,40 @@
         },
         resultClick(val) {
            this.resultValue = val
            console.log(val)
            // this.centerContent.forEach(i => {
            //    i.isOK = val
            // })
            this.$forceUpdate() //强制视图更新
         },
         submit() {
         async submit() {
            const children = []
            this.centerContent.forEach((i, index) => {
               children.push({
                  seq: index + 1,
                  itemcode: i.code,
                  cycle: '',
                  value: i.inputValue,
                  result: i.isOK
               })
            })
            const data = {
               code: this.topContent[0].code,
               name: this.topContent[0].name,
               standcode: this.selectValue,
               result: this.resultValue,
               children
            }
            // console.log(JSON.stringify(data))
            this.isDisabledSubmitButton = true
            const res = await MouldCheckSave('2050', data)
            if (res.code === '200') {
               uni.$u.toast('提交成功!')
               this.isDisabledSubmitButton = false
               this.topContent = []
               this.selectValue = ''
               this.centerContent = []
               this.resultValue = ''
            }
         },
      }
   }