loulijun2021
2023-11-13 49d4281ebaba8a0d73b6669dcc13da0109a1b91f
pages/scgl/scbg.vue
@@ -104,8 +104,8 @@
                  </view>
                  <view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;"
                     v-if="reckway==='个人'">
                  <view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
                     <!-- v-if="reckway==='个人'" -->
                     <view style="display: flex;" class="titleFont">
                        <view style="color: red;margin-right: 6rpx;">*</view> 报工人员:
                     </view>
@@ -193,13 +193,13 @@
            </view>
            <!-- 报工人员信息 -->
            <u-gap height="15" v-if="reckway==='班组'" bgColor="#eff0f1"></u-gap>
            <!--          <u-gap height="15" v-if="reckway==='班组'" bgColor="#eff0f1"></u-gap>
            <view class="head marginLeft10 marginRight10" v-if="reckway==='班组'">
               <view class="head_block">
                  <view class="head_left">
                     <view class="head_bar"></view>
                     <view class="head_title">
                        报工人员信息
                        不良原因明细
                     </view>
                  </view>
               </view>
@@ -240,7 +240,7 @@
            </view>
            </view> -->
         </view>
@@ -250,17 +250,12 @@
            @click="submit" text="报工">
         </u-button>
         <!--          <u-action-sheet :actions="userGroupSheetList" :safeAreaInsetBottom='true' :closeOnClickOverlay="true"
            :closeOnClickAction="true" @close="userGroupSheetShow=false" :show="userGroupSheetShow"
            @select='userGroupSheetSelect'>
         </u-action-sheet> -->
         <u-picker v-if="topContent.length!==0" :show="userGroupSheetShow" :columns="userGroupColumns"
            :itemHeight='55' :closeOnClickOverlay='true' @close='userGroupSheetShow=false'
            @confirm='userGroupPickerConfirm' @cancel='userGroupSheetShow=false'>
         </u-picker>
         <!--       <u-action-sheet :actions="eqpSheetList" :safeAreaInsetBottom='true' :closeOnClickOverlay="true"
            :closeOnClickAction="true" @close="eqpSheetShow=false" :show="eqpSheetShow" @select='eqpSheetSelect'>
         </u-action-sheet> -->
         <u-picker v-if="topContent.length!==0" :show="eqpSheetShow" :columns="eqpColumns" :itemHeight='55'
            :closeOnClickOverlay='true' @close='eqpSheetShow=false' @confirm='eqpPickerConfirm'
            @cancel='eqpSheetShow=false'>
@@ -285,9 +280,26 @@
         </u-action-sheet>
         <!--       <u-action-sheet :actions="operSheetList" :safeAreaInsetBottom='true' :closeOnClickOverlay="true"
            :closeOnClickAction="true" @close="operSheetShow=false" :show="operSheetShow" @select='operSheetSelect'>
         </u-action-sheet> -->
         <u-action-sheet v-if="topContent.length!==0" :actions="userSelectArrAll" :safeAreaInsetBottom='true'
            :closeOnClickOverlay="true" :closeOnClickAction="true" @close="userSheetShow=false"
            :show="userSheetShow" @select='userSheetSelect'>
            <view style="min-height: 100rpx;padding: 20rpx 20rpx 30rpx 20rpx;">
               <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" :name='item.name'
                        :label="item.name">
                     </u-checkbox>
                     <u-divider :key="item.code"></u-divider>
                  </view>
               </u-checkbox-group>
            </view>
         </u-action-sheet>
         <u-picker v-if="topContent.length!==0" :show="operSheetShow" :columns="operColumns" :itemHeight='55'
            :closeOnClickOverlay='true' @close='operSheetShow=false' @confirm='operPickerConfirm'
            @cancel='operSheetShow=false'>
@@ -296,13 +308,36 @@
         <u-modal v-if="topContent.length!==0" :show="modalShow" :showCancelButton='true' cancelText='取消'
            @close="modalShow=false" :closeOnClickOverlay="true" style=" " @cancel="modalCancel"
            @confirm="modalConfirm" title="报工人员" :content='modalContent'>
            @confirm="modalConfirm" title="不良明细" :content='modalContent'>
            <uni-section style="width: 100%;" title=''>
            <!--       <uni-section style="width: 100%;" title=''>
               <uni-data-select v-model="userSelectValue" :clear='false' emptyText :localdata="userSelectArr"
                  @change="userChange">
               </uni-data-select>
            </uni-section>
            </uni-section> -->
            <!--    <view style="display: flex;flex-direction: column;">
               <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" @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> -->
         </u-modal>
@@ -421,7 +456,10 @@
            userGroupColumns: [], //
            eqpColumns: [], //
            operColumns: [], //
            isAsyncChange: false
            isAsyncChange: false,
            userCheckBoxValue: [],
            userSheetShow: false
         }
      },
      created() {
@@ -432,16 +470,25 @@
         this.getMesOrderStepStart('SGPO20231110_1;101')
         this.getGroupsPermissions() //获取生产班组
         this.getEqpPermissionsPlus() //获取设备名称
         this.getDefectPermissions() //获取缺陷下拉
         this.getPersonPermissions() //获取操作人员
         // this.getGroupsPersonPermissions('BZ001') //根据班组获取人员
         this.getSellectAllApi()
      },
      methods: {
         init() {
            uni.stopPullDownRefresh();
         },
         async getSellectAllApi() {
            await this.getGroupsPermissions() //获取生产班组
            await this.getEqpPermissionsPlus() //获取设备名称
            await this.getDefectPermissions() //获取缺陷下拉
            await this.getPersonPermissions() //获取操作人员
         },
         //获取生产班组
         async getGroupsPermissions(wkshopcode) {
@@ -475,7 +522,7 @@
               this.badSelectArr = res.data
            }
         },
         // 获取操作人员
         // 获取报工人员
         async getPersonPermissions() {
            const res = await PersonPermissions()
            if (res.code === '200') {
@@ -492,26 +539,46 @@
            }
         },
         // 根据生产班组获取人员
         async getGroupsPersonPermissions(usergroupcode) {
            const res = await GroupsPersonPermissions()
            if (res.code === '200') {
               this.userArr = res.data
               this.calculatedValue()
            }
         },
         // 计算分配比例的值
         calculatedValue() {
            const total = 100;
            let value = 0
            this.userArr.forEach(item => {
               item.ratio = parseFloat((100 / this.userArr.length).toFixed(2))
               value += item.ratio
         async getGroupsPersonPermissions(groupcode) {
            const res = await GroupsPersonPermissions({
               groupcode
            })
            if (Math.round(value * 100) / 100 !== total) {
               this.userArr[this.userArr.length - 1].ratio = parseFloat((this.userArr[this.userArr.length - 1].ratio +
                  (total - value)).toFixed(2))
            if (res.code === '200') {
               this.userCheckBoxValue = []
               if (res.data[0].usercode_list && res.data[0].usercode_list.length > 0) {
                  this.userSelectArrAll.forEach(i => {
                     if (res.data[0].usercode_list.split(',').includes(i.code)) {
                        this.userCheckBoxValue.push(i.name)
                     }
                  })
               }
               this.operSheetValue = this.userCheckBoxValue.join(',')
            }
         },
         userSheetSelect() {
         },
         userCheckboxChange(val) {
            this.userCheckBoxValue = val.join(',')
            // this.userCheckBoxValue = ['001']
            // this.$forceUpdate()
            // console.log(this.userCheckBoxValue);
         },
         //获取开工信息
         async getMesOrderStepStart(orderstepqrcode) {
@@ -750,7 +817,16 @@
            console.log(this.badSheetValue, 5);
         },
         operSheetClick() {
            this.operSheetShow = true
            if (this.reckway === '个人') {
               this.operSheetShow = true
            }
            if (this.reckway === '班组') {
               this.userSheetShow = true
            }
         },
         operSheetSelect(val) {
            this.operSheetValue = val.name
@@ -773,7 +849,7 @@
         // 删除人员按钮
         deleteUser(item) {
            this.userArr = this.userArr.filter(i => i.usercode !== item.usercode)
            this.calculatedValue()
         },
         // 模态框取消按钮
         modalCancel() {
@@ -792,7 +868,7 @@
               uni.$u.toast('请选择报工人员!')
            }
            this.modalShow = false
            this.calculatedValue()
         },
         userChange(val) {
            this.userSelectValue = val