From 9e7bbd1a203c39c74b81624640a5ea8f6e247ba3 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 14 五月 2024 10:08:02 +0800
Subject: [PATCH] 1.外协收料不良数量可填多个

---
 pages/scgl/scbg.vue |  633 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 330 insertions(+), 303 deletions(-)

diff --git a/pages/scgl/scbg.vue b/pages/scgl/scbg.vue
index 1d05155..8f7247a 100644
--- a/pages/scgl/scbg.vue
+++ b/pages/scgl/scbg.vue
@@ -11,10 +11,10 @@
 		</view>
 
 		<view v-show="topContent.length!==0">
-			<view class="mainContent" :style="{maxHeight:'1200rpx',overflow: 'scroll'}">
+			<view class="mainContent" :style="{maxHeight:'1260rpx',overflow: 'scroll'}">
 
 				<!-- 鎶ュ伐淇℃伅 -->
-				<u-gap height="15" bgColor="#eff0f1"></u-gap>
+				<u-gap height="5" bgColor="#eff0f1"></u-gap>
 				<view class="head" style="padding-bottom: 10rpx;">
 					<view class="head_block">
 						<view class="head_left">
@@ -64,7 +64,7 @@
 				</view>
 
 				<!-- 鎶ュ伐鎿嶄綔 -->
-				<u-gap height="15" bgColor="#eff0f1"></u-gap>
+				<u-gap height="10" bgColor="#eff0f1"></u-gap>
 				<view class="head  marginLeft10 marginRight10" style="padding-bottom: 20rpx;">
 					<view class="head_block">
 						<view class="head_left">
@@ -81,7 +81,7 @@
 							<view style="display: flex;" class="titleFont">
 								<view style="color: red;margin-right: 6rpx;">*</view> 璁′欢鏂瑰紡锛�
 							</view>
-							<u-radio-group v-model="reckway">
+							<u-radio-group v-model="reckway" @change='radioGroupChange'>
 								<u-radio shape="circle" label="鐝粍" name="鐝粍" labelSize="16"></u-radio>
 								<u-radio shape="circle" label="涓汉" style="margin-left: 20rpx;" name="涓汉" labelSize="16">
 								</u-radio>
@@ -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>
@@ -122,7 +122,7 @@
 
 						<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
 							<view style="display: flex;" class="titleFont">
-								<view style="color: red;margin-right: 6rpx;">*</view> 璁惧鍚嶇О锛�
+								<view style="color: #fff;margin-right: 6rpx;">*</view> 璁惧鍚嶇О锛�
 							</view>
 							<view @click='epqSheetClick' class="custominputClass">
 
@@ -139,128 +139,98 @@
 						<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
 							<view style="color: red;margin-right: 6rpx;">*</view> 鎶ュ伐鏁伴噺锛�
 							<view class='inputClass'>
-								<u--input placeholder="璇疯緭鍏�" border="surround" type='number' v-model="reportqty">
+								<u--input placeholder="璇疯緭鍏�" :adjustPosition='false' border="surround" type='number'
+									v-model="reportqty">
 								</u--input>
 							</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" @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 class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
-							<view style="display: flex;">
-								<view style="color: red;margin-right: 6rpx;">*</view> 鎿嶄綔浜哄憳锛�
-							</view>
-							<view @click='operSheetClick' class="custominputClass">
-								<view v-show='operSheetValue===""' style="color: rgb(192, 196, 204);">璇烽�夋嫨</view>
-								<view v-show='operSheetValue!==""' class="ellipsis" style="width: 390rpx;">
-									{{operSheetValue}}
-								</view>
-
-								<u-icon :name="!operSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
-							</view>
-						</view> -->
-
-
-						<!-- 鍙兘涓婃媺鏄剧ず 瑕佹崲鎴愪笅鎷夋樉绀� -->
-						<!-- 		<uni-section style="width: 100%;" title=''>
-							<uni-data-select v-model="operSheetValue" :clear='false' emptyText :localdata="operSheetList">
-							</uni-data-select>
-						</uni-section>
-						 -->
-
-
-
-
 					</view>
 				</view>
 
-				<!-- 鎶ュ伐浜哄憳淇℃伅 -->
-				<u-gap height="15" v-if="reckway==='鐝粍'" bgColor="#eff0f1"></u-gap>
-				<view class="head marginLeft10 marginRight10" v-if="reckway==='鐝粍'">
+
+				<u-gap height="10" bgColor="#eff0f1"></u-gap>
+
+
+				<view class="head  marginLeft10 marginRight10" style="padding-bottom: 20rpx;">
 					<view class="head_block">
 						<view class="head_left">
 							<view class="head_bar"></view>
 							<view class="head_title">
-								鎶ュ伐浜哄憳淇℃伅
+								涓嶈壇缁熻
 							</view>
 						</view>
+
 					</view>
-
-					<u-button type="primary" icon='plus-circle' plain
-						style="height: 100rpx;width: 98%;margin-top: 10rpx;" @click="addUser" class='addClass'
-						text="娣诲姞">
-					</u-button>
-
-					<view class="flex_between titleFont" style="margin: 20rpx 40rpx 30rpx;">
-						<view>搴忓彿</view>
-						<view :style="{width:'200rpx'}">浜哄憳鍚嶇О</view>
-						<view style="width: 184rpx;">鍒嗛厤姣斾緥(%)</view>
-						<view>鎿嶄綔</view>
-					</view>
+					<view class="flex_column ">
 
 
-					<view class="flex_column marginLeft20 marginRight20" :key="item.usercode"
-						v-for="(item,index) in userArr">
-						<view class="flex_between marginLeft20 marginRight20 contentFont">
-							<view style="width: 60rpx;text-align: center;">{{(index+1)}}</view>
-							<view style="width: 200rpx;text-align: center;">{{item.username}}</view>
-							<view style="width: 240rpx; text-align: center;color: rgb(41, 121, 255);">
-								<u-number-box @focus='isAsyncChange=true' @blur='isAsyncChange=false'
-									:key="item.usercode" :asyncChange='isAsyncChange' step="0.01" :name='item.usercode'
-									@change='numberBoxChange' decimal-length="2" :value="item.ratio" inputWidth='110'>
-								</u-number-box>
+						<u-button type="primary" :plain="true" icon='plus-circle' text="娣诲姞"
+							style="width: 90%;margin: 20rpx auto;" @click="add"></u-button>
+
+
+						<view v-for='(item,index) in ngqtyArr' class="badSheetClass" :key="item.uid">
+
+							<view class="badNumber">{{index+1}}</view>
+							<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> 涓嶈壇鏁伴噺锛�
+								<view class='inputClass'>
+									<u--input placeholder="璇疯緭鍏�" border="surround" :adjustPosition='false' type='number'
+										v-model="item.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(item)' class="custominputClass">
+									<view v-show='item.badSheetValue.length===0' style="color: rgb(192, 196, 204);">璇烽�夋嫨
+									</view>
+									<view v-show='item.badSheetValue.length!==0' class="ellipsis"
+										style="width: 390rpx;">
+										{{item.badSheetValue}}
+									</view>
+									<u-icon :name="item.arrowDown?'arrow-down-fill':'arrow-up-fill'"></u-icon>
+								</view>
 							</view>
 
-							<u-icon @click="deleteUser(item)" style="width: 50rpx;text-align: center;" name="trash"
-								min='0' max='100' color="#2979ff" size="24">
-							</u-icon>
+							<u-divider></u-divider>
+
 
 						</view>
-						<u-divider></u-divider>
+
 					</view>
-
-
-
-
 				</view>
+
+
+
 
 			</view>
 
-			<u-gap height="20" bgColor="#eff0f1"></u-gap>
+
+
+
+			<u-gap height="10" bgColor="#eff0f1"></u-gap>
+
+
+
 
 			<u-button size="large" :loading="isDisabledSubmitButton" loadingText="姝e湪鎻愪氦,璇风◢绛�..." type="primary"
 				@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'>
@@ -268,43 +238,47 @@
 
 
 
+			<!-- 涓嶈壇鍘熷洜 -->
 			<u-action-sheet v-if="topContent.length!==0" :actions="badSelectArr" :safeAreaInsetBottom='true'
-				:closeOnClickOverlay="true" :closeOnClickAction="true" @close="badSheetShow=false" :show="badSheetShow"
+				:closeOnClickOverlay="true" :closeOnClickAction="true" @close="badSelectClose" :show="badSheetShow"
 				@select='badSheetSelect'>
-				<view style="min-height: 100rpx;padding: 20rpx 20rpx 30rpx 20rpx;">
+				<view style="min-height: 100rpx;">
 					<u-checkbox-group @change="checkboxChange" size='20px' v-model="checkBoxValue" iconPlacement="right"
 						placement="column">
 						<view v-for="(item,index) in badSelectArr">
-							<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code" :name='item.name'
-								:label="item.name">
+							<u-checkbox activeColor="rgb(0, 102, 255)" labelSize='18' :key="item.code+index"
+								:name='item.name' :label="item.name">
 							</u-checkbox>
-							<u-divider :key="item.code"></u-divider>
 						</view>
 					</u-checkbox-group>
 				</view>
 			</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+index"
+								:name='item.name' :label="item.name">
+							</u-checkbox>
+						</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'>
 			</u-picker>
 
 
-			<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'>
 
-				<uni-section style="width: 100%;" title=''>
-					<uni-data-select v-model="userSelectValue" :clear='false' emptyText :localdata="userSelectArr"
-						@change="userChange">
-					</uni-data-select>
-				</uni-section>
-
-			</u-modal>
 
 
 		</view>
@@ -317,7 +291,7 @@
 
 		<!-- 鎮诞鐞� -->
 		<!-- 	<view
-			v-show="topContent.length!==0&&!modalShow&&!userGroupSheetShow&&!eqpSheetShow&&!operSheetShow&&!badSheetShow"
+			v-show="topContent.length!==0&&!userGroupSheetShow&&!eqpSheetShow&&!operSheetShow&&!badSheetShow"
 			@click="topScanClick">
 			<drag-ball :x='$DeviceInformation.screenWidth*0.8' :y="$DeviceInformation.screenHeight*0.7"></drag-ball>
 		</view> -->
@@ -334,7 +308,9 @@
 		EqpPermissionsPlus,
 		GroupsPermissions,
 		GroupsPersonPermissions,
-		DefectPermissions
+		DefectPermissions,
+		SavaMesOrderStepReport,
+		LabelBarCode
 	} from '../../config/api.js';
 	// import scanCode from '@/components/scan-code/scan-code.vue'
 	export default {
@@ -399,7 +375,25 @@
 				],
 
 				reportqty: '', //鎶ュ伐鏁伴噺
+
 				ngqty: '', //涓嶈壇鏁伴噺
+
+				ngqtyArr: [{
+						uid: new Date().getTime(),
+						ngqty: '',
+						badSheetValue: '',
+						arrowDown: true //鍚戜笅绠ご
+					},
+					// {
+					// 	ngqty: '',
+					// 	badSheetValue: '',
+					// 	arrowDown: true //鍚戜笅绠ご
+					// },
+				], //涓嶈壇鏁伴噺銆佷笉鑹師鍥犳暟缁�
+
+
+
+
 				badSelectArr: [], //涓嶈壇鍘熷洜涓嬫媺鏁扮粍
 				badSheetValue: '', //涓嶈壇鍘熷洜閫変腑鍊�
 				badSheetShow: false,
@@ -408,8 +402,8 @@
 				operSheetShow: false,
 				operSheetList: [], //鎿嶄綔浜哄憳鏁扮粍
 				userArr: [], //鎶ュ伐浜哄憳淇℃伅鏁扮粍
-				modalShow: false,
-				modalContent: '', //妯℃�佹鏁�
+
+
 				userSelectValue: '', //涓嬫媺閫夐」鍊�
 				userSelectArrAll: [], //鎵�鏈変汉鍛樹笅鎷夋暟缁�
 				userSelectArr: [
@@ -421,7 +415,10 @@
 				userGroupColumns: [], //
 				eqpColumns: [], //
 				operColumns: [], //
-				isAsyncChange: false
+				isAsyncChange: false,
+
+				userCheckBoxValue: [],
+				userSheetShow: false
 			}
 		},
 		created() {
@@ -430,18 +427,21 @@
 		mounted() {
 			this.init()
 
+			// this.getMesOrderStepStart('MO-2024-01-0004_1;102')
 
-			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 +475,7 @@
 					this.badSelectArr = res.data
 				}
 			},
-			// 鑾峰彇鎿嶄綔浜哄憳
+			// 鑾峰彇鎶ュ伐浜哄憳
 			async getPersonPermissions() {
 				const res = await PersonPermissions()
 				if (res.code === '200') {
@@ -492,25 +492,38 @@
 				}
 			},
 			// 鏍规嵁鐢熶骇鐝粍鑾峰彇浜哄憳
-			async getGroupsPersonPermissions(usergroupcode) {
-				const res = await GroupsPersonPermissions()
+			async getGroupsPersonPermissions(groupcode) {
+
+				const res = await GroupsPersonPermissions({
+					groupcode
+				})
 				if (res.code === '200') {
-					this.userArr = res.data
-					this.calculatedValue()
+					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(',')
+
+
 				}
 			},
-			// 璁$畻鍒嗛厤姣斾緥鐨勫��
-			calculatedValue() {
-				const total = 100;
-				let value = 0
-				this.userArr.forEach(item => {
-					item.ratio = parseFloat((100 / this.userArr.length).toFixed(2))
-					value += item.ratio
-				})
-				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))
-				}
+
+
+
+			userSheetSelect() {
+
+			},
+			userCheckboxChange(val) {
+				this.userCheckBoxValue = val.join(',')
 			},
 
 			//鑾峰彇寮�宸ヤ俊鎭�
@@ -526,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('姝ゅ伐搴忓凡鎶ュ伐锛�')
 				}
@@ -566,19 +573,9 @@
 
 				});
 			},
-			// 姝ヨ繘鍣ㄥ�兼敼鍙樻椂
-			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() {
+				// 涓嬪崍鍐欑敓浜ф姤宸ユ彁浜�
 
 				if (this.reckway === '鐝粍' && this.userGroupSheetValue === "") {
 					return uni.$u.toast('鐢熶骇鐝粍涓嶈兘涓虹┖锛�')
@@ -593,38 +590,11 @@
 					return uni.$u.toast('鎶ュ伐鏁伴噺涓嶈兘涓虹┖锛�')
 				}
 
-				if (this.reckway === '鐝粍' && this.userArr.length === 0) {
+				if (this.reckway === '鐝粍' && this.operSheetValue.length === 0) {
 					return uni.$u.toast('鎶ュ伐浜哄憳淇℃伅涓嶈兘涓虹┖锛�')
 				}
 
-				if (this.reckway === '鐝粍') {
-					let sum = 0
-					this.userArr.forEach(item => {
-						console.log(item.ratio, 'item.ratio')
-						sum += parseFloat(item.ratio)
-					})
-					sum = parseFloat(sum)
-					console.log(sum, 'sum44')
-					if (Math.round(sum * 100) / 100 !== 100) {
-						return uni.$u.toast('鍒嗛厤姣斾緥鎬诲拰蹇呴』涓�100锛�')
-					}
-				}
-
-
-				const header = {
-					// 'Content-Type': 'multipart/form-data',
-					'Content-Type': 'application/x-www-form-urlencoded',
-					'rediskey': uni.getStorageSync('rediskey'),
-					'admin': uni.getStorageSync('usercode'),
-					'username': encodeURIComponent(uni.getStorageSync('username')),
-					'navTabId': uni.getStorageSync('usercode'),
-					'userid': uni.getStorageSync('userid'),
-					'guid': uni.getStorageSync('guid'),
-					'usertype': 'APP'
-				}
-
 				let badcode = []
-
 
 				if (this.badSheetValue.length > 0) {
 					this.badSelectArr.forEach(i => {
@@ -634,92 +604,128 @@
 					})
 				}
 
-				if (this.ngqty !== '') {
-					if (badcode.length === 0) {
-						return uni.$u.toast('涓嶈壇鍘熷洜鏈�夋嫨锛�')
+				let reportuser = []
+
+				if (this.operSheetValue.length > 0) {
+					this.userSelectArrAll.forEach(i => {
+						if (this.operSheetValue.split(',').includes(i.name)) {
+							reportuser.push(i.code)
+						}
+					})
+				}
+
+				// 涓嶈壇鍘熷洜
+				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('鎶ュ伐鏁伴噺鍔犱笉鑹暟閲忎笉鑳藉ぇ浜庢湭鎶ユ暟閲忥紒')
 				}
 
 
 
-				let reportuser = ''
 
-				// if (this.$company === 'A') {
-				// 	reportuser = this.reckway === '鐝粍' ? JSON.stringify(this.userArr) : JSON.stringify([{
-				// 		usercode: this.operSheetValue,
-				// 		ratio: 100
-				// 	}])
-				// } else {
-				reportuser = this.userArr.map(i => i.usercode).join(';') //鎶ュ伐浜哄憳
-				// }
+				const D = {
+					rightcode: '0601',
+					partcode: this.topContent[0].partnumber,
+					qty: parseFloat(this.reportqty),
+					onelabqty: parseFloat(this.reportqty)
+				}
+				const {
+					data: R
+				} = await LabelBarCode(D)
 
 
 				const data = {
-					admin: uni.getStorageSync('usercode'),
-					mesordercode: this.formData.wo_code, // 宸ュ崟缂栧彿
-					partcode: this.formData.partnumber, // 浜у搧缂栫爜
-					stepseq: this.formData.seq, // 宸ュ簭搴忓彿
-					stepcode: this.formData.stepcode, // 宸ュ簭缂栫爜
-					eqpcode: this.eqpSheetList.find(i => i.name === this.eqpSheetValue).code, // 璁惧缂栫爜
-					taskqty: this.formData.planqty, // 浠诲姟鏁伴噺
-					startqty: this.formData.reportqty, // 寮�宸ユ暟閲�
+					mesordercode: this.topContent[0].wo_code,
+					partcode: this.topContent[0].partnumber,
+					stepseq: this.topContent[0].seq,
+					stepcode: this.topContent[0].stepcode,
+					stepprice: this.topContent[0].stepprice,
+
+					eqpcode: this.eqpSheetList.find(i => i.name === this.eqpSheetValue).code,
+
+					reckway: this.reckway === '鐝粍' ? 'group' : 'person',
+
 					usergroupcode: this.userGroupSheetValue ? this.userGroupSheetList.find(i => i.name === this
 						.userGroupSheetValue).code : '', // 鐝粍缂栫爜
-					reportqty: parseFloat(this.reportqty), // 鎶ュ伐鏁伴噺
-					// reportuser: this.userArr.map(i => i.usercode).join(';'), //鎶ュ伐浜哄憳
-					reportuser,
-
-					//鎶ュ伐浜哄憳
-					remarks: '', // 澶囨敞
-					reckway: this.reckway === '鐝粍' ? 'group' : 'person', //
-					ngqty: this.ngqty === '' ? 0 : this.ngqty, //涓嶈壇鏁伴噺
-					badcode: badcode.join(';'), //涓嶈壇鍘熷洜
-
-					inbarcode: '', //鎵爜鍏ュ簱
+					reportuser: this.reckway === '鐝粍' ? reportuser.join(',') : this.userSelectArrAll.find(i => i
+						.name === this.operSheetValue).code,
+					taskqty: this.topContent[0].planqty,
+					startqty: parseFloat(this.reportqty),
+					reportqty: parseFloat(this.reportqty),
+					inbarcode: R[0].labcode, //鍏ュ簱鏉$爜
+					defectlist,
+					// defectlist: badcode.length > 0 ? [{
+					// 	defect_code: badcode.join(','),
+					// 	badqty: this.ngqty
+					// }] : [],
+					remarks: ''
 				}
 
-				console.log(data, 7777)
-
+				// console.log(JSON.parse(JSON.stringify(data)), 7777)
 				this.isDisabledSubmitButton = true
-				uni.uploadFile({
-					url: this.$baseUrl + '/AppProductionManagement/SavaMesOrderStepReport',
-					files: [{
-						"uri": "/"
-					}],
-					header: header,
-					formData: data,
-					success: (res) => {
-						uni.$u.toast('鎶ュ伐鎴愬姛锛�')
-						this.topContent = []
-						this.formData = {}
-						this.reportqty = ''
-						this.ngqty = ''
-						this.reckway = '涓汉'
-						this.userGroupSheetValue = ''
-						this.eqpSheetValue = ''
-						this.userGroupSheetList = []
-						this.eqpSheetList = []
-						this.badSelectArr = []
-						this.badSheetValue = []
-						this.checkBoxValue = []
-						this.operSheetValue = ''
-						this.operSheetList = []
-						this.userArr = []
-						this.userSelectValue = ''
-						this.userSelectArrAll = []
-						this.userSelectArr = []
-						this.userGroupColumns = []
-						this.eqpColumns = []
-						this.operColumns = []
+				const res = await SavaMesOrderStepReport(data)
+				if (res.code === '200') {
+					uni.$u.toast('鎶ュ伐鎴愬姛锛�')
+					this.topContent = []
+					this.formData = {}
+					this.reportqty = ''
+					// this.ngqty = ''
+					this.reckway = '涓汉'
+					this.userGroupSheetValue = ''
+					this.eqpSheetValue = ''
 
 
-						this.isDisabledSubmitButton = false
-					},
-					fail(res) {
-						uni.$u.toast('鎶ュ伐澶辫触锛�')
-						this.isDisabledSubmitButton = false
-					},
-				})
+					this.ngqtyArr = [{
+						uid: new Date().getTime(),
+						ngqty: '',
+						badSheetValue: '',
+						arrowDown: true //鍚戜笅绠ご
+					}]
+
+					// this.userGroupSheetList = []
+					// this.eqpSheetList = []
+					// this.badSelectArr = []
+					this.badSheetValue = []
+					this.checkBoxValue = []
+					this.operSheetValue = ''
+					// this.operSheetList = []
+					// this.userArr = []
+					this.userSelectValue = ''
+					// this.userSelectArrAll = []
+					// this.userSelectArr = []
+					// this.userGroupColumns = []
+					// this.eqpColumns = []
+					// this.operColumns = []
+
+					this.userCheckBoxValue = []
+					this.userSheetShow = false
+
+
+					this.isDisabledSubmitButton = false
+				}
+
+
+
+
 
 			},
 			userGroupSheetSelect(val) {
@@ -739,61 +745,68 @@
 			badSheetSelect(val) {
 				// console.log(val,9999999)
 			},
-			badSheetClick() {
-				if (!this.ngqty) {
+			badSheetClick(item) {
+				if (!item.ngqty) {
 					return uni.$u.toast('璇峰厛濉啓涓嶈壇鏁伴噺锛�')
 				}
+				item.arrowDown = !item.arrowDown
+
+				this.checkBoxValue = item.badSheetValue.split(',')
 				this.badSheetShow = true
 			},
+
+			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() {
-				this.operSheetShow = true
+				if (this.reckway === '涓汉') {
+					this.operSheetShow = true
+				}
+
+				if (this.reckway === '鐝粍') {
+					this.userSheetShow = true
+				}
 			},
-			operSheetSelect(val) {
-				this.operSheetValue = val.name
-				this.operSheetShow = false
+			//鍗曢�夋鍊兼敼鍙樻椂
+			radioGroupChange(val) {
+				this.userGroupSheetValue = ''
+				this.operSheetValue = ''
 			},
-			// 娣诲姞浜哄憳鎸夐挳
-			addUser() {
-				this.userSelectArr = []
-				this.userSelectArrAll.forEach(i => {
-					if (!this.userArr.map(j => j.usercode).includes(i.code)) {
-						this.userSelectArr.push({
-							value: i.code,
-							text: i.name
-						})
-					}
+
+			// 娣诲姞
+			add() {
+
+				if (this.ngqtyArr.find(i => i.badSheetValue === '')) {
+					return uni.$u.toast('璇峰厛瀹屽杽鍓嶉潰涓嶈壇閫夐」锛�')
+				}
+
+				this.ngqtyArr.unshift({
+					uid: new Date().getTime(),
+					ngqty: '',
+					badSheetValue: '',
+					arrowDown: true //鍚戜笅绠ご
 				})
-				this.modalShow = true
 
 			},
-			// 鍒犻櫎浜哄憳鎸夐挳
-			deleteUser(item) {
-				this.userArr = this.userArr.filter(i => i.usercode !== item.usercode)
-				this.calculatedValue()
+
+			//鍒犻櫎
+			trashDelete(index) {
+				console.log(index)
+				this.ngqtyArr.splice(index, 1)
+
 			},
-			// 妯℃�佹鍙栨秷鎸夐挳
-			modalCancel() {
-				this.modalShow = false
-				this.userSelectValue = ''
-			},
-			// 妯℃�佹纭鎸夐挳
-			modalConfirm() {
-				if (this.userSelectValue) {
-					this.userArr.unshift({
-						usercode: this.userSelectValue,
-						username: this.userSelectArrAll.find(i => i.code === this.userSelectValue).name
-					})
-					this.userSelectValue = ''
-				} else {
-					uni.$u.toast('璇烽�夋嫨鎶ュ伐浜哄憳锛�')
-				}
-				this.modalShow = false
-				this.calculatedValue()
-			},
+
+
 			userChange(val) {
 				this.userSelectValue = val
 			},
@@ -868,15 +881,29 @@
 		overflow: auto !important;
 	}
 
-	::v-deep .u-number-box__minus {
-		height: 50rpx !important;
+	::v-deep .u-checkbox-label--right {
+		padding: 30rpx;
+		border-bottom: 1rpx solid #eee;
 	}
 
-	::v-deep .u-number-box__input {
-		height: 50rpx !important;
+
+
+	.badSheetClass {
+		position: relative;
 	}
 
-	::v-deep .u-number-box__plus {
-		height: 50rpx !important;
+	.badNumber {
+		position: absolute;
+		top: 20rpx;
+		left: 20rpx;
+		font-size: 26rpx;
+		color: rgb(0, 102, 255)
+	}
+
+	.trash {
+		position: absolute;
+		top: 20rpx;
+		right: 30rpx;
+		font-size: 26rpx;
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3