mao 1 年之前
父節點
當前提交
d923f23fa3

+ 11 - 8
components/dialog-end-work/dialog-end-work.vue

@@ -3,11 +3,11 @@
 		<view class="list-container">
 			<view class="list-title uni-row">
 				<text class="label">合格量</text>
-				<input class="input" v-model="workInfo.qualifiedNum" placeholder="请输入合格量" />
+				<input class="input" type="number" maxlength="5" v-model="workInfo.qualifiedNum" @input="handleInputQualifiedNum" placeholder="请输入合格量" />
 			</view>
 			<view class="list-title uni-row">
 				<text class="label">废品量</text>
-				<input class="input" v-model="workInfo.rejectNum" placeholder="请输入废品量" />
+				<input class="input" type="number" maxlength="5" v-model="workInfo.rejectNum" @input="handleInputRejectNum" placeholder="请输入废品量" />
 			</view>
 			<view class="list-title uni-row">
 				<text class="label">废品原因</text>
@@ -15,7 +15,7 @@
 			</view>
 			<view class="list-title uni-row" style="margin-top: 48rpx;">
 				<text class="label">当前序是否完成</text><text>否</text>
-				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
+				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" /> 
 				<text>是</text>
 			</view>
 			<!-- <view class="list-title"><text class="label">请选择设备:</text></view> -->
@@ -35,7 +35,7 @@
 </template>
 
 
-<script setup> 
+<script setup>
 	import {
 		ref,
 		getCurrentInstance
@@ -62,10 +62,13 @@
 		}
 	}
 
-	// function checkboxChange(event) {
-	// 	console.log(event.detail.value)
-	// 	workInfo.value.equiments = event.detail.value
-	// }
+	function handleInputQualifiedNum() {
+		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-|[^\d]/g, '');
+	}
+	
+	function handleInputRejectNum() {
+		workInfo.value.rejectNum = workInfo.value.rejectNum.replace(/^0+|^-|[^\d]/g, '');
+	}
 
 	function handleFinishReporting() {
 		console.log(workInfo.value)

+ 35 - 13
components/dialog-lot/dialog-lot.vue

@@ -1,22 +1,23 @@
 <template>
 	<dialog-base ref="baseDialog" title="添加新批次">
-		<view class="list-title"><text class="label">批次号:{{form['daywork'].lotCode}}</text></view>
-		<view class="list-container">
+		
+		<view :class="{'list-container':true, 'selected':isSelected(item)}" @click="handleSelection(item,index)" v-for="(item, index) in form" :key="item.id">
+			<view class="list-title"><text class="label">批次号:{{item.lotCode}}</text></view>
 			<view class="list-container-item uni-row">
 				<text class="label">产品描述</text>
-				<text class="label value">{{form['productDescription']}}</text>
+				<text class="label value">{{item['productDescription']}}</text>
 			</view>
 			<view class="list-container-item uni-row">
 				<text class="label">关联箱号</text>
-				<text class="label value">{{form['carrierName']}}</text>
+				<text class="label value">{{item['carrierName']}}</text>
 			</view>
 			<view class="list-container-item uni-row">
 				<text class="label">当前工序</text>
-				<text class="label value">{{form['daywork'].currentProcess.processAlias}}</text>
+				<text class="label value">{{item['daywork'].currentProcess.processAlias}}</text>
 			</view>
 			<view class="list-container-item uni-row" style="border-bottom: 1px solid #999999;">
 				<text class="label">投产数量</text>
-				<text class="label value">{{form['qualifiedQuantity']}}</text>
+				<text class="label value">{{item['qualifiedQuantity']}}</text>
 			</view>
 		</view>
 <!-- 		<view class="list-title"><text class="label">请选择设备:</text></view>
@@ -40,10 +41,8 @@
 	const selectedButton = ref(null)
 	const form = ref({})
 	const emit = defineEmits(['submit'])
-	// const equiments = ref(['009-21','009-22','009-23','009-24','009-25','009-26','009-27','009-28','009-29'])
- //    const selectButton = (data) => {
-	// 	 selectedButton.value = data;
-	// }
+	const selection = ref([])
+
 	const open = (data) => {
 		// console.log(dialog.value)
 		form.value = data
@@ -67,12 +66,31 @@
 	}
 	
 	function handleConfirm(){
-		emit('submit',form.value);
+		emit('submit',selection.value);
+		uni.$emit('dayworkItemUpdate');
 		close();
 	}
+	
+	function isSelected(item) {
+		return selection.value.includes(item);
+	}
+	
+	function handleSelection(item, index) {
+		const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
+		if (buttonIndex > -1) {
+			selection.value.splice(buttonIndex, 1); // 取消选中
+		} else {
+			selection.value.push(item); // 选中
+		}
+		console.log(selection.value, "selection");
+	}
 </script>
 
 <style lang="scss">
+	.selected {
+		border: 2px solid #1684fc;
+	}
+	
 	.dialog-body {
 		.list-title {
 			margin: 40rpx 0 20rpx 0;
@@ -87,13 +105,17 @@
 			width: 100%;
 			display: flex;
 			align-items: flex-start;
-			padding: 0 4rpx;
-
+			// padding: 0 4rpx;
+			margin: 10rpx 0;
+			border-radius: 6rpx;
+			overflow: auto;
+			
 			.list-container-item {
 				width: 100%;
 				border: 1px solid #999999;
 				border-bottom: none;
 				padding: 12rpx 8rpx;
+				box-sizing: border-box;
 				
 
 				.label {

+ 20 - 18
components/dialog-turnoverApplication/dialog-turnoverApplication.vue

@@ -18,7 +18,7 @@
 			</view>
 			<view v-if="curDayworkItem.turnoverType == '2'" class="" style="margin: 0 20rpx 20rpx 0;width: 96%;">
 				<uni-section title="请选择周转工段" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;">
-					<uni-data-select  v-model="curDayworkItem.deptId" :localdata="deptList" @change="handleChange"
+					<uni-data-select v-model="curDayworkItem.deptId" :localdata="deptList" @change="handleChange"
 						style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
 				</uni-section>
 			</view>
@@ -63,7 +63,7 @@
 	const curDayworkItem = ref({})
 	const dayworkInfo = ref(null)
 	const deptList = ref([]) // 工段列表
-	const emit = defineEmits('confirm')    // 自定义调用父组件方法
+	// const emit = defineEmits('confirm') // 自定义调用父组件方法
 
 	onLoad(() => {
 
@@ -121,14 +121,17 @@
 		curDayworkItem.value.turnoverArea = item.dictValue;
 	}
 
-	function handleValidate(data){
+	function handleValidate(data) {
 		console.log(data)
-       if(data.turnoverType === "0" || data.turnoverArea === "" || data.deptId === "0") {
-		   return false;
-	   }
-	   else {
-		   return true;
-	   }
+		if(data.turnoverType == '1'){
+			return true;
+		}else{
+			if (data.turnoverType === "0" || data.turnoverArea === "" || data.deptId === "0") {
+				return false;
+			} else {
+				return true;
+			}
+		}
 	}
 
 	function handleConfirm() {
@@ -144,19 +147,18 @@
 		console.log(deptList.value)
 		// 设置周转下一个车间名
 		for (let i = 0; i < deptList.value.length; i++) {
-			if(deptList.value[i].value == curDayworkItem.value.deptId){
+			if (deptList.value[i].value == curDayworkItem.value.deptId) {
 				curDayworkItem.value.deptName = deptList.value[i].text;
 			}
 		}
 		console.log(curDayworkItem.value);
-		if(!handleValidate(curDayworkItem.value)) {
+		if (!handleValidate(curDayworkItem.value)) {
 			uni.showToast({
-						icon: 'error',
-						title: '请选择完整信息',
-						duration: 2000
-					});
-		}
-		else {
+				icon: "error",
+				title: '请选择完整信息',
+				duration: 2000
+			});
+		} else {
 			saveDayWorkItem(curDayworkItem.value).then(res => {
 				if (res.code === 200) {
 					uni.showToast({
@@ -175,7 +177,7 @@
 				}
 			})
 		}
-		emit('confirm');
+		// emit('confirm');
 		uni.$emit('dayworkItemUpdate');
 	}
 

+ 3 - 2
components/dialog-turnoverTask/dialog-turnoverTask.vue

@@ -80,7 +80,8 @@
 					title: '操作成功',
 					duration: 2000
 				});
-				uni.$emit('confirmDelivery')
+				uni.$emit('confirmDelivery');
+				uni.$emit('dayworkItemUpdate');
 			} else {
 				uni.showToast({
 					icon: 'error',
@@ -106,7 +107,7 @@
 		}
 
 		.list-item {
-			overflow: scroll-y;
+			overflow: auto;
 			height: 700rpx;
 		}
 

+ 9 - 3
pages/addNewBatch/index.vue

@@ -89,6 +89,9 @@
 	import {
 		store
 	} from '@/store/index.js'
+	import {
+		getCarrierById
+	} from '@/api/business/carrier.js'
 
 	const batchNoCheck = ref(null) // 批次号是否选中
 	const batchNoList = ref([]) // 批次号列表
@@ -161,8 +164,7 @@
 			success: function(res) {
 				let vehicleObj = JSON.parse(res.result);
 				for (let i = 0; i < vehicleList.value.length; i++) {
-					if (Object.entries(vehicleList.value[i]).toString() === Object.entries(vehicleObj)
-						.toString()) {
+					if (vehicleList.value[i].carrierId == vehicleObj.carrierId) {
 						uni.showToast({
 							icon: "error",
 							title: "载具已存在"
@@ -170,6 +172,9 @@
 						return;
 					}
 				}
+				getCarrierById(vehicleObj.carrierId).then(response => {
+						
+				})
 				vehicleList.value.push(vehicleObj);
 			}
 		});
@@ -189,7 +194,8 @@
 						title: '添加成功',
 						duration: 2000
 					});
-					uni.$emit('batchReporting-addBatch')
+					uni.$emit('batchReporting-addBatch');
+					uni.$emit('dayworkItemUpdate');
 					uni.navigateBack({
 						url: '/pages/batchReporting/index'
 					})

+ 12 - 7
pages/batchReporting/index.vue

@@ -52,7 +52,7 @@
 							@click.stop="handleShowTurnoverApplication(item)">周转申请</button>
 						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
 					</view>
-					<view v-else-if="item['status'] == 2" class=" uni-row">
+					<view v-else-if="item['status'] == 3" class=" uni-row">
 						<button class="turnover-tag" size="mini" @click.stop="handleCancelTurnover(item)">取消周转</button>
 					</view>
 				</view>
@@ -132,7 +132,7 @@
 		uni.$once('batchReporting-addBatch', () => {
 			init(curSubPlan.value.id);
 		})
-		uni.$once('dayworkItemUpdate', () => {
+		uni.$on('dayworkItemUpdate', () => {
 			init(curSubPlan.value.id);
 		})
 	})
@@ -154,6 +154,9 @@
 		uni.showLoading({
 			title: '加载中'
 		});
+		setTimeout(function(){
+			uni.hideLoading();
+		},2000)
 		let reqData = {};
 		reqData.productionPlanDetailSubDetailId = id;
 		console.log(reqData)
@@ -172,9 +175,6 @@
 			}
 			console.log(listData.value)
 		})
-		setTimeout(function(){
-			uni.hideLoading();
-		},2000)
 	}
 
 	function handleToreportingForWork(item) {
@@ -196,6 +196,7 @@
 					status: 7
 				}).then(response => {
 					if(response.code == 200){
+						console.log(response)
 						lotDialog.value.open(response.data);
 						// reqParam.value = response.data
 					}
@@ -205,7 +206,11 @@
 	}
 
 	function handleAddDaywork(data) {
-		// console.log(data)
+		console.log(data)
+		let reqParam = [];
+		for (var i = 0; i < data.length; i++) {
+			reqParam.push(data[i].daywork)
+		}
 		// for (let i = 0; i < listData.value.length; i++) {
 		// 	if (Object.entries(listData.value[i]).toString() === Object.entries(data).toString()) {
 		// 		uni.showToast({
@@ -222,7 +227,7 @@
 		// }
 		// console.log(listData.value)
 		// console.log(data)
-		showDayworkSave(data.daywork).then(res => {
+		showDayworkSave(reqParam).then(res => {
 			console.log(res)
 			init(curSubPlan.value.id);
 		})

+ 7 - 8
pages/handlingList/index.vue

@@ -16,8 +16,7 @@
 							<text class="label">{{ item['dictDataLabel'] }}</text>
 							<text class="label code">{{ item['deptName'] }}</text>
 							<text class="label code" style="margin-left: 16rpx;">→</text>
-							<text class="label code"
-								style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
+							<text class="label code" style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
 						</view>
 
 						<view class="right-info uni-row">
@@ -47,7 +46,7 @@
 						<text class="label right">{{ item['nickName']}}</text>
 					</view>
 				</view>
-			</view> 
+			</view>
 			<view class="bottom-btn-container uni-row">
 				<button class="bottom-btn" @click="handleStartTurn">开始周转</button>
 			</view>
@@ -65,7 +64,7 @@
 						<view><text class="label">周转中</text></view>
 					</view>
 					<view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in products"
-						:key='index'>
+						@click="handleSelection(item)" :key='index'>
 						<!-- @click="handleSelection(item)" -->
 						<view class="list-container-item product-description uni-row">
 							<text class="label left-value">产品描述</text>
@@ -136,7 +135,7 @@
 	const turnoverTask = ref(null) // 弹窗组件
 
 	onLoad(() => {
-		uni.$once('confirmDelivery',function(){
+		uni.$once('confirmDelivery', function() {
 			init();
 		})
 		init()
@@ -167,8 +166,8 @@
 					turnoverSecondTitle.value = 'A' + " → " + products.value[i].deptName;
 				}
 				// 设置总数和目标
-	
-				
+
+
 				console.log(res)
 			}
 		})
@@ -194,7 +193,7 @@
 	}
 
 	function handleConfirmDelivery() {
-		if(products.value.length > 0){
+		if (products.value.length > 0) {
 			let msg = '是否确认送达?';
 			confirm.value.open(msg);
 		}

+ 4 - 2
pages/productionPlan/index.vue

@@ -86,7 +86,7 @@
 		}
 		init(initReqParam.value);
 		// dayworkItem数据更改后刷新数据
-		uni.$once('dayworkItemUpdate', () => {
+		uni.$on('dayworkItemUpdate', () => {
 			init(initReqParam.value);
 		})
 	})
@@ -105,11 +105,13 @@
 		uni.showLoading({
 			title: '加载中'
 		});
+		setTimeout(function(){
+			uni.hideLoading();
+		},2000)
 		getListByUserEquipment(data).then((res) => {
 			console.log(data)
 			if (res.code === 200) {
 				listData.value = res.rows;
-				uni.hideLoading()
 			} else if (res.code === 401) {
 				uni.showToast({
 					icon: 'none',

+ 53 - 22
pages/recerptSfprod/index.vue

@@ -2,8 +2,9 @@
 
 	<view class='container '>
 		<view class='content'>
-			<view class='item-table' scroll-y v-for="(item,index) in products" :key='index'>
-				<text class='title'>{{title}}</text>
+			<text class='title'>{{title}}</text>
+			<view :class="{'item-table':true, 'selected':isSelected(item)}" scroll-y v-for="(item,index) in products"
+				@click="handleSelection(item,index)">
 				<view class="uni-row table-layout">
 					<text class='tbhead left'>产品描述</text>
 					<text class='tbhead right'>{{item['productDescription']}}</text>
@@ -45,15 +46,19 @@
 		store
 	} from '@/store/index.js'
 
-	const title = ref('热处理')
+	const title = ref(null)
 	const sum = ref(0)
 	const products = ref([])
 	const confirm = ref(null)
+	const flag = ref(false)
+	const selection = ref([])
 
 	onLoad(() => {
-
 	})
 
+	function init() {
+	}
+
 	function handleScanCode() {
 		uni.scanCode({
 			scanType: ['qrCode'],
@@ -65,19 +70,24 @@
 					carrierId: vehicleObj.carrierId,
 					status: 6
 				}).then(response => {
-					for (let i = 0; i < products.value.length; i++) {
-						if (Object.entries(products.value[i]).toString() === Object.entries(res
-								.data)
-							.toString()) {
-							uni.showToast({
-								icon: "error",
-								title: "该批次已存在"
-							})
-							console.log("该批次已存在")
-							return;
-						}
+					console.log(response)
+					// for (let i = 0; i < products.value.length; i++) {
+					// 	if (products.value[i].lotCode === res.data[0].lotCode) {
+					// 		console.log(products.value[i].lotCode);
+					// 		console.log(res.data[0].lotCode)
+					// 		uni.showToast({
+					// 			icon: "error",
+					// 			title: "该批次已存在"
+					// 		})
+					// 		console.log("该批次已存在")
+					// 		return;
+					// 	}
+					// }
+					for (let i = 0; i < response.data.length; i++) {
+						products.value.push(response.data[i]);
+						console.log(products.value)
 					}
-					products.value.push(response.data);
+					console.log(products.value)
 					let sum = 0; //总箱数
 					for (let i = 0; i < products.value.length; i++) {
 						products.value[i].carriers = products.value[i].carrierName.split('、').length;
@@ -85,25 +95,40 @@
 					}
 					title.value = products.value[0].deptName + ' (' + sum + '箱)';
 					console.log(products.value)
+					init();
 				})
 			}
 		});
 	}
 
 	function handleConfirmReceipt() {
-		if (products.value.length > 0) {
+		if (selection.value.length > 0) {
 			let msg = "是否确认接收";
 			confirm.value.open(msg);
 		}
 	}
 
+	function isSelected(item) {
+		return selection.value.includes(item);
+	}
+
+	function handleSelection(item, index) {
+		const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
+		if (buttonIndex > -1) {
+			selection.value.splice(buttonIndex, 1); // 取消选中
+		} else {
+			selection.value.push(item); // 选中
+		}
+		console.log(selection.value, "selection");
+	}
+
 	function handleDoReceipt() {
 		// 设置周转状态
-		for (var i = 0; i < products.value.length; i++) {
-			products.value[i].status = '7';
-			products.value[i].recipientId = store.userInfo.userId;
+		for (var i = 0; i < selection.value.length; i++) {
+			selection.value[i].status = '7';
+			selection.value[i].recipientId = store.userInfo.userId;
 		}
-		updateDayWorkItemBatch(products.value).then(res => {
+		updateDayWorkItemBatch(selection.value).then(res => {
 			if (res.code === 200) {
 				uni.showToast({
 					icon: 'success',
@@ -120,6 +145,8 @@
 			}
 		})
 		products.value = [];
+		selection.value = [];
+		title.value = null;
 	}
 
 	function handleDoIt() {
@@ -140,8 +167,12 @@
 			margin: 50rpx auto;
 			border-radius: 12rpx;
 
+			.selected {
+				border: 1px solid #1684fc;
+			}
+
 			.title {
-				margin: 10rpx auto;
+				margin-left: 10rpx;
 				width: 90%;
 				font-size: 36rpx;
 				font-weight: bold;

+ 2 - 1
pages/reportingForWork/index.vue

@@ -108,7 +108,8 @@
 			title: '加载中'
 		});
 		getDayWorkItemList({
-			dayworkId: dayWorkInfo.value.id
+			dayworkId: dayWorkInfo.value.id,
+			type: '1'
 		}).then(res => {
 			listData.value = res.rows || [];
 			console.log(listData)

+ 31 - 19
pages/startTurnover/index.vue

@@ -1,7 +1,8 @@
 <template>
-	<view class="uni-column container" >
+	<view class="uni-column container">
 		<scroll-view class="scroll-container" scroll-y>
-			<view v-for="(item, index) in listData" :key="index" :class="{'list-item':true,'selected':isSelected(item)}">
+			<view v-for="(item, index) in listData" :key="index"
+				:class="{'list-item':true,'selected':isSelected(item)}">
 				<!-- @click="handleSelection(item,index)" -->
 				<view class="title-container uni-row">
 					<view class="title uni-row">
@@ -34,7 +35,7 @@
 		</scroll-view>
 		<view class="bottom uni-row">
 			<button class="bottom-btn left-btn" @click="HandleScanCode">扫码添加</button>
-			<button class="bottom-btn right-btn" @click="handleStartTurnover">确认周转</button>
+			<button class="bottom-btn right-btn" @click="handleStartTurnover" :disabled="flag">确认周转</button>
 		</view>
 		<dialog-turnoverTask ref="turnoverTaskDialog" />
 	</view>
@@ -49,23 +50,29 @@
 	import {
 		onLoad,
 	} from '@dcloudio/uni-app'
-	import { getDayworkItemByCarrierId } from '@/api/business/dayWorkItem.js'
+	import {
+		getDayworkItemByCarrierId
+	} from '@/api/business/dayWorkItem.js'
 
 	const active = ref(false)
 	const selection = ref([])
 	const turnoverTaskDialog = ref(null)
 	const listData = ref([])
 	const turnoverTask = ref(null)
-	
+	const flag = ref(false);
+
 	onLoad(() => {
-	
+		init();
+		uni.$on('dayworkItemUpdate', () => {
+			init(curSubPlan.value.id);
+		})
 	})
-	
-	function init(){
-	
+
+	function init() {
+		flag.value = listData.value.length > 0 ? false : true; 
 	}
-	
-	function HandleScanCode(){
+
+	function HandleScanCode() {
 		uni.scanCode({
 			scanType: ['qrCode'],
 			onlyFromCamera: true, // 只允许相机扫码
@@ -76,31 +83,35 @@
 					carrierId: vehicleObj.carrierId,
 					status: 4
 				}).then(response => {
+					console.log(response)
 					for (let i = 0; i < listData.value.length; i++) {
-						if (Object.entries(listData.value[i]).toString() === Object.entries(res.data).toString()) {
+						if (listData.value[i].lotCode === response.data[0].lotCode) {
 							uni.showToast({
 								icon: "error",
-								title: "该批次已存在" 
+								title: "该批次已存在"
 							})
 							console.log("该批次已存在")
-							return;  
+							return;
 						}
 					}
-					listData.value.push(response.data);
+					for (let i = 0; i < response.data.length; i++) {
+						listData.value.push(response.data[i]);
+					}
 					for (let i = 0; i < listData.value.length; i++) {
 						listData.value[i].carriers = listData.value[i].carrierName.split('、').length;
 					}
-					console.log(listData.value)
+					console.log(listData.value);
+					init();
 				})
 			}
 		});
 	}
-	
+
 	function handleStartTurnover() {
 		// 调用子组件中的方法
 		turnoverTask.value.open(listData.value);
 	}
-	
+
 	function isSelected(item) {
 		return selection.value.includes(item);
 	}
@@ -137,9 +148,10 @@
 
 <style lang="scss">
 	.container {
-		height: 100%; 
+		height: 100%;
 		background-color: #f5f5f5;
 	}
+
 	.scroll-container {
 		position: absolute;
 		top: 24rpx;