loulijun2021
2024-05-14 9e7bbd1a203c39c74b81624640a5ea8f6e247ba3
pages/scgl/scbg.vue
@@ -145,29 +145,6 @@
                     </view>
                  </view>
                  <!--                <view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
                     <view style="color: #fff;margin-right: 6rpx;">*</view> 不良数量:
                     <view class='inputClass'>
                        <u--input placeholder="请输入" border="surround" :adjustPosition='false'
                           @change='ngqtyChange' type='number' v-model="ngqty"></u--input>
                     </view>
                  </view>
                  <view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
                     <view style="display: flex;" class="titleFont">
                        <view style="color: #fff;margin-right: 6rpx;">*</view> 不良原因:
                     </view>
                     <view @click='badSheetClick' class="custominputClass">
                        <view v-show='badSheetValue.length===0' style="color: rgb(192, 196, 204);">请选择</view>
                        <view v-show='badSheetValue.length!==0' class="ellipsis" style="width: 390rpx;">
                           {{badSheetValue}}
                        </view>
                        <u-icon :name="!badSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
                     </view>
                  </view> -->
               </view>
            </view>
@@ -190,13 +167,13 @@
                  <u-button type="primary" :plain="true" icon='plus-circle' text="添加"
                     style="width: 90%;margin: 20rpx auto;" @click="add"></u-button>
                  <!-- ngqtyArr -->
                  <view v-for='(item,index) in ngqtyArr' class="badSheetClass" :key="item.uid">
                     <!-- {{item.uid}} -->
                     <view class="badNumber">{{index+1}}</view>
                     <u-icon name="trash" size="20" class="trash" @click="trashDelete(index)"
                        color="rgb(0, 102, 255)"></u-icon>
                     <u-icon name="trash" size="20" class="trash" v-if="ngqtyArr.length!==1"
                        @click="trashDelete(index)" color="rgb(0, 102, 255)"></u-icon>
                     <view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
                        <view style="color: #fff;margin-right: 6rpx;">*</view> 不良数量:
@@ -204,7 +181,7 @@
                           <u--input placeholder="请输入" border="surround" :adjustPosition='false' type='number'
                              v-model="item.ngqty"></u--input>
                        </view>
                        <!-- @change='ngqtyChange(item)' -->
                     </view>
                     <view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
                        <view style="display: flex;" class="titleFont">
@@ -225,13 +202,6 @@
                  </view>
                  <!--
                  <u-button type="primary" :plain="true" icon='plus-circle' text="添加"
                     style="width: 90%;margin: 20rpx auto;" @click="add"></u-button> -->
               </view>
            </view>
@@ -300,22 +270,6 @@
               </u-checkbox-group>
            </view>
         </u-action-sheet>
         <!-- <u-popup :show="userSheetShow" @close="userSheetShow=false" customStyle='customPopupStyle'
            :safeAreaInsetTop='true' @open="open">
            <u-checkbox-group @change="userCheckboxChange" size='20px' v-model="userCheckBoxValue"
               iconPlacement="right" placement="column">
               <view v-for="(item,index) in userSelectArrAll">
                  <u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code+index"
                     :name='item.name' :label="item.name">
                  </u-checkbox>
               </view>
            </u-checkbox-group>
         </u-popup> -->
         <!-- 报工人员 -->
         <u-picker v-if="topContent.length!==0" :show="operSheetShow" :columns="operColumns" :itemHeight='55'
@@ -473,7 +427,7 @@
      mounted() {
         this.init()
         this.getMesOrderStepStart('MO-2024-01-0004_1;102')
         // this.getMesOrderStepStart('MO-2024-01-0004_1;102')
         this.getSellectAllApi()
      },
@@ -570,14 +524,7 @@
         },
         userCheckboxChange(val) {
            this.userCheckBoxValue = val.join(',')
            // this.userCheckBoxValue = ['001']
            // this.$forceUpdate()
            // console.log(this.userCheckBoxValue);
         },
         //获取开工信息
         async getMesOrderStepStart(orderstepqrcode) {
@@ -592,12 +539,6 @@
            if (res.code === '200' && res.count === 1) {
               this.formData = res.data
               this.topContent.unshift(res.data)
               // this.getGroupsPermissions(res.data.wkshopcode)
               // let o = res.data.wo_code + ';' + res.data.stepcode
               // this.getEqpPermissionsPlus(o)
               // this.getDefectPermissions(o)
               // this.getPersonPermissions()
            } else if (res.code === '200' && res.count !== 1) {
               this.$u.toast('此工序已报工!')
            }
@@ -632,17 +573,6 @@
            });
         },
         // 步进器值改变时
         numberBoxChange(val) {
            this.userArr.find(i => i.usercode === val.name).ratio = parseFloat(val.value).toFixed(2)
         },
         ngqtyChange(val) {
            if (!parseFloat(val)) {
               this.badSheetValue = ''
               this.checkBoxValue = ''
            }
         },
         async submit() {
            // 下午写生产报工提交
@@ -660,16 +590,9 @@
               return uni.$u.toast('报工数量不能为空!')
            }
            // if (parseFloat(this.reportqty) + parseFloat(this.ngqty) > parseFloat(this.topContent[0].noreportqty)) {
            //    return uni.$u.toast('报工数量加不良数量不能大于未报数量!')
            // }
            if (this.reckway === '班组' && this.operSheetValue.length === 0) {
               return uni.$u.toast('报工人员信息不能为空!')
            }
            let badcode = []
@@ -681,14 +604,6 @@
               })
            }
            // if (this.ngqty !== '') {
            //    if (badcode.length === 0) {
            //       return uni.$u.toast('不良原因未选择!')
            //    }
            // }
            let reportuser = []
            if (this.operSheetValue.length > 0) {
@@ -699,28 +614,30 @@
               })
            }
            console.log(this.userSelectValue);
            // reportuser = this.userArr.map(i => i.usercode).join(';') //报工人员
            // 不良原因
            const defectlist = []
            //不良数量
            let ngqtyNumber = 0
            this.ngqtyArr.forEach(i => {
               if (i.badSheetValue.toString().length > 0) {
                  let codeArr = []
                  ngqtyNumber += parseFloat(i.ngqty)
                  i.badSheetValue.split(',').forEach(j => {
                     codeArr.push(this.badSelectArr.find(i => i.name === j).code)
                  })
                  defectlist.push({
                     badqty: i.ngqty,
                     defect_code: codeArr.join(',')
                  })
               }
            })
            if (parseFloat(this.reportqty) + parseFloat(ngqtyNumber) > parseFloat(this.topContent[0]
                  .noreportqty)) {
               return uni.$u.toast('报工数量加不良数量不能大于未报数量!')
            }
@@ -763,7 +680,7 @@
               remarks: ''
            }
            console.log(JSON.parse(JSON.stringify(data)), 7777)
            // console.log(JSON.parse(JSON.stringify(data)), 7777)
            this.isDisabledSubmitButton = true
            const res = await SavaMesOrderStepReport(data)
            if (res.code === '200') {
@@ -829,8 +746,6 @@
            // console.log(val,9999999)
         },
         badSheetClick(item) {
            // console.log(item, 1)
            if (!item.ngqty) {
               return uni.$u.toast('请先填写不良数量!')
            }
@@ -843,19 +758,15 @@
         badSelectClose() {
            let index = this.ngqtyArr.findIndex(i => !i.arrowDown)
            this.ngqtyArr[index].badSheetValue = this.checkBoxValue.join(',')
            this.ngqtyArr[index].arrowDown = true
            this.checkBoxValue = []
            this.badSheetShow = false
         },
         checkboxChange(val) {
            this.badSheetValue = val.join(',')
            console.log(this.badSheetValue, 5);
         },
         operSheetClick() {
            if (this.reckway === '个人') {
@@ -969,19 +880,6 @@
      max-height: 600rpx !important;
      overflow: auto !important;
   }
   ::v-deep .u-number-box__minus {
      height: 50rpx !important;
   }
   ::v-deep .u-number-box__input {
      height: 50rpx !important;
   }
   ::v-deep .u-number-box__plus {
      height: 50rpx !important;
   }
   ::v-deep .u-checkbox-label--right {
      padding: 30rpx;