loulijun2021
2023-10-20 f9316355bf93eee5b897a267f8d4710410c7e667
pages/mjgl/mjdj.vue
@@ -64,9 +64,13 @@
                     <view class="marginRight20 marginBottom10">
                     <view class="marginRight20 marginBottom10" v-if='standardArr.length>0'>
                        <u-button @click="show = true" type='primary' size="small" plain
                           shape='circle'>请选择</u-button>
                     </view>
                     <view class="marginRight20 marginBottom10" v-if='standardArr.length===0'>
                        暂无关联标准,请先关联
                     </view>
                  </view>
@@ -159,7 +163,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 +209,6 @@
            selectValue: '',
            centerContent: [],
            resultValue: ''
         }
      },
      created() {
@@ -217,8 +221,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 +240,10 @@
               mouldcode: mouldcode
            })
            this.standardArr = res
            this.centerContent = []
            this.resultValue = ''
            this.selectValue = ''
         },
         async getSelectScanMouldQrCodeItem(mouldcode, checktempcode) {
            const {
@@ -285,7 +293,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 +309,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('2501', data)
            if (res.code === '200') {
               uni.$u.toast('提交成功!')
               this.isDisabledSubmitButton = false
               this.topContent = []
               this.selectValue = ''
               this.centerContent = []
               this.resultValue = ''
            }
         },
      }
   }