mao 1 年之前
父節點
當前提交
488cfd3281

+ 1 - 2
api/base/path.js

@@ -1,4 +1,3 @@
-const baseURL = 'http://192.168.31.126:8099'
-// const baseURL = 'http://192.168.1.181:8099'
+const baseURL = 'http://192.168.31.216:8099'
 
 
 export default baseURL
 export default baseURL

+ 8 - 0
api/business/dayWorkItem.js

@@ -28,4 +28,12 @@ export function saveDayWorkItem(data) {
 		method: 'POST',
 		method: 'POST',
 		data: data
 		data: data
 	})
 	})
+}
+
+export function saveDayWorkItemBatch(data) {
+	return req.request({
+		url:'/business/dayworkItem/saveBatch',
+		method: 'POST',
+		data: data
+	})
 }
 }

+ 9 - 0
api/process/process.js

@@ -0,0 +1,9 @@
+import req from '@/utils/request.js'
+
+
+export function getUserProcess() {
+	return req.request({
+		url:'/business/process/getUserProcess',
+		method: 'GET',
+	})
+}

+ 19 - 19
components/dialog-end-work/dialog-end-work.vue

@@ -3,7 +3,7 @@
 		<view class="list-container">
 		<view class="list-container">
 			<view class="list-title"><text class="label">合格量</text></view>
 			<view class="list-title"><text class="label">合格量</text></view>
 			<view class="table-item">
 			<view class="table-item">
-				<input class="input" v-model="workInfo.qualified" placeholder="请输入合格量" />
+				<input class="input" v-model="workInfo.qualifiedNum" placeholder="请输入合格量" />
 			</view>
 			</view>
 			<view class="list-title">
 			<view class="list-title">
 				<text class="label">废品量</text>
 				<text class="label">废品量</text>
@@ -12,19 +12,19 @@
 			<view class="list-title">
 			<view class="list-title">
 				<text class="label">废品原因</text>
 				<text class="label">废品原因</text>
 			</view>
 			</view>
-			<view class="table-item"><input class="input" v-model="workInfo.remark" placeholder="请输入废品原因" /></view>
+			<view class="table-item"><input class="input" v-model="workInfo.reason" placeholder="请输入废品原因" /></view>
 			<view class="list-title uni-row">
 			<view class="list-title uni-row">
 				<text class="label">当前序是否完成</text>
 				<text class="label">当前序是否完成</text>
 				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
 				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
 			</view>
 			</view>
-			<view class="list-title"><text class="label">请选择设备:</text></view>
+			<!-- <view class="list-title"><text class="label">请选择设备:</text></view> -->
 			<!-- <scroll-view class="scroll-container" scroll-y> -->
 			<!-- <scroll-view class="scroll-container" scroll-y> -->
-			<checkbox-group class="equipment-container uni-row" @change="checkboxChange">
+			<!-- 			<checkbox-group class="equipment-container uni-row" @change="checkboxChange">
 				<checkbox v-for="(item,index) in equiments" class="checkbox" style="transform:scale(0.8)" :key="index"
 				<checkbox v-for="(item,index) in equiments" class="checkbox" style="transform:scale(0.8)" :key="index"
 					:value="item" :checked="item.checked">
 					:value="item" :checked="item.checked">
 					{{item}}
 					{{item}}
 				</checkbox>
 				</checkbox>
-			</checkbox-group>
+			</checkbox-group> -->
 
 
 		</view>
 		</view>
 		<view class="add-btn-container uni-row">
 		<view class="add-btn-container uni-row">
@@ -43,11 +43,13 @@
 		updateDayWorkItem,
 		updateDayWorkItem,
 		saveDayWorkItem
 		saveDayWorkItem
 	} from "@/api/business/dayWorkItem.js"
 	} from "@/api/business/dayWorkItem.js"
-	import { timestampToTime } from '@/utils/common.js'
+	import {
+		timestampToTime
+	} from '@/utils/common.js'
 	const baseDialog = ref(null)
 	const baseDialog = ref(null)
-	const equiments = ref(['009-21', '009-22', '009-23', '009-24', '009-25', '009-26', '009-27', '009-28', '009-29',
-		'009-26', '009-27'
-	])
+	// const equiments = ref(['009-21', '009-22', '009-23', '009-24', '009-25', '009-26', '009-27', '009-28', '009-29',
+	// 	'009-26', '009-27'
+	// ])
 	const workInfo = ref({})
 	const workInfo = ref({})
 	const open = (data) => {
 	const open = (data) => {
 		workInfo.value.dayworkId = data.dayworkId;
 		workInfo.value.dayworkId = data.dayworkId;
@@ -62,20 +64,20 @@
 		}
 		}
 	}
 	}
 
 
-	function checkboxChange(event) {
-		console.log(event.detail.value)
-		workInfo.value.equiments = event.detail.value
-	}
+	// function checkboxChange(event) {
+	// 	console.log(event.detail.value)
+	// 	workInfo.value.equiments = event.detail.value
+	// }
 
 
 	function handleFinishReporting() {
 	function handleFinishReporting() {
 		console.log(workInfo.value)
 		console.log(workInfo.value)
-		if(workInfo.value.status != 2) {
+		if (workInfo.value.status != 2) {
 			workInfo.value.status = '1';
 			workInfo.value.status = '1';
 		}
 		}
 		workInfo.value.endTime = timestampToTime(new Date());
 		workInfo.value.endTime = timestampToTime(new Date());
 		console.log(workInfo.value)
 		console.log(workInfo.value)
 		saveDayWorkItem(workInfo.value).then(res => {
 		saveDayWorkItem(workInfo.value).then(res => {
-			if(res.code === 200){
+			if (res.code === 200) {
 				uni.showToast({
 				uni.showToast({
 					icon: 'success',
 					icon: 'success',
 					title: '操作成功',
 					title: '操作成功',
@@ -83,7 +85,7 @@
 				});
 				});
 				emit('reset');
 				emit('reset');
 				baseDialog.value.close();
 				baseDialog.value.close();
-			}else{
+			} else {
 				uni.showToast({
 				uni.showToast({
 					icon: 'error',
 					icon: 'error',
 					title: '操作失败',
 					title: '操作失败',
@@ -117,7 +119,7 @@
 			.switch {
 			.switch {
 				margin-top: -8rpx;
 				margin-top: -8rpx;
 				align-items: center;
 				align-items: center;
-				transform:scale(0.7);
+				transform: scale(0.7);
 			}
 			}
 
 
 			.equipment-container {
 			.equipment-container {
@@ -128,12 +130,10 @@
 				overflow: auto;
 				overflow: auto;
 
 
 				.checkbox {
 				.checkbox {
-
 					padding: 12rpx 0;
 					padding: 12rpx 0;
 					justify-content: center;
 					justify-content: center;
 					align-items: center;
 					align-items: center;
 				}
 				}
-
 			}
 			}
 
 
 			.table-item {
 			.table-item {

+ 8 - 6
components/dialog-login/dialog-login.vue

@@ -25,6 +25,7 @@
 	import {
 	import {
 		getUserInfo
 		getUserInfo
 	} from '@/api/login/index.js'
 	} from '@/api/login/index.js'
+	import { getUserProcess } from '@/api/process/process.js'
 	import baseURL from '@/api/base/path.js'
 	import baseURL from '@/api/base/path.js'
 	import { store } from '@/store/index.js'
 	import { store } from '@/store/index.js'
 	// 对话框
 	// 对话框
@@ -67,21 +68,23 @@
 					uni.setStorage({
 					uni.setStorage({
 						key: currentUser.value.userName,
 						key: currentUser.value.userName,
 						data: currentUser.value.password,
 						data: currentUser.value.password,
-						success: function() {
-
-						}
 					});
 					});
+					// 获取员工工序信息
+					getUserProcess().then(res => {
+						store.userProcessInfo = res.data;
+					})
+					// 获取员工信息存入store,并跳转到控制面板
 					getUserInfo(currentUser.value).then((res) => {
 					getUserInfo(currentUser.value).then((res) => {
 						if (res.code == 200) {
 						if (res.code == 200) {
 							userInfo.value = res.data;
 							userInfo.value = res.data;
 							user.value.push(userInfo.value);
 							user.value.push(userInfo.value);
-							store.userInfo = JSON.stringify(res.data)
+							store.userInfo = res.data
+							console.log(store.userInfo)
 							uni.redirectTo({
 							uni.redirectTo({
 								url: '/pages/dashboard/index'
 								url: '/pages/dashboard/index'
 							});
 							});
 						}
 						}
 					})
 					})
-
 				} else {
 				} else {
 					uni.showToast({
 					uni.showToast({
 						title: errorMsg.value,
 						title: errorMsg.value,
@@ -92,7 +95,6 @@
 				}
 				}
 			}
 			}
 		})
 		})
-
 	}
 	}
 
 
 	/** 暴露给父组件的方法 */
 	/** 暴露给父组件的方法 */

+ 10 - 36
components/dialog-selectEquipment/dialog-selectEquipment.vue

@@ -29,25 +29,24 @@
 	import {
 	import {
 		store
 		store
 	} from '@/store/index.js'
 	} from '@/store/index.js'
-
+	
 	const baseDialog = ref(null)
 	const baseDialog = ref(null)
 	const selection = ref([])
 	const selection = ref([])
 	const equiments = ref([])
 	const equiments = ref([])
-	const curSubDetails = ref({})
-	const dayWorkInfo = ref({})
-	const dayWorkItem = ref({})
-	const emit = defineEmits(['refportingForWorkRefresh'])
+	const emit = defineEmits(['handleAddDayWorkItem'])
+	const userId = ref(null)
 	
 	
 	onLoad(() => {
 	onLoad(() => {
+		userId.value = store.userInfo.userId || "";
 		init();
 		init();
 	}) 
 	}) 
 
 
 	function init() {
 	function init() {
-		let encodeData = encodeURIComponent(store.planSubDetails);
-		curSubDetails.value = JSON.parse(decodeURIComponent(encodeData));
-		encodeData = encodeURIComponent(store.dayworkInfo);
-		dayWorkInfo.value = JSON.parse(decodeURIComponent(encodeData));
-		getUserequipmentList(JSON.parse(store.userInfo).userId).then(res => {
+		let reqParam = {
+			userId: userId.value,
+			processId: store.dayworkInfo.currentProcess.id
+		}
+		getUserequipmentList(reqParam).then(res => {
 			equiments.value = res.rows
 			equiments.value = res.rows
 		})
 		})
 	}
 	}
@@ -79,32 +78,7 @@
 
 
 	function handleStart() {
 	function handleStart() {
 		console.log(selection.value)
 		console.log(selection.value)
-		dayWorkItem.value = {
-			dayworkId: dayWorkInfo.value.id,
-			lotId: dayWorkInfo.value.lotId,
-			productionPlanId: curSubDetails.value.productionPlanId,
-			productionPlanDetailId: curSubDetails.value.productionPlanDetailId,
-			productionPlanDetailSubDetailId: curSubDetails.value.id,
-			equipmentDetailId: selection.value[0].equipmentId,
-			equipmentDetailCode: selection.value[0].equipmentCode
-		} 
-		console.log(dayWorkItem) 
-		saveDayWorkItem(dayWorkItem.value).then(res => {
-			if (res.code === 200) {
-				uni.showToast({
-					icon: 'success',
-					title: '操作成功',
-					duration: 2000
-				});
-				emit('refportingForWorkRefresh')
-			} else {
-				uni.showToast({
-					icon: 'error',
-					title: '操作失败',
-					duration: 2000
-				});
-			}
-		})
+		emit('handleAddDayWorkItem',selection.value)
 		close();
 		close();
 	}
 	}
 </script>
 </script>

+ 9 - 9
pages/addNewBatch/index.vue

@@ -28,7 +28,7 @@
 				<view>
 				<view>
 					<button style='background-color: rgba(0, 226, 166,1);
 					<button style='background-color: rgba(0, 226, 166,1);
 						   color: white;margin: 20rpx auto;
 						   color: white;margin: 20rpx auto;
-						   width: 80%;' @click='handleScanCode()'>扫码</button>
+						   width: 80%;' @click='handleScanCode'>扫码</button>
 				</view>
 				</view>
 			</view>
 			</view>
 			<view class='middle'>
 			<view class='middle'>
@@ -101,23 +101,23 @@
 	const curSubPlan = ref({})
 	const curSubPlan = ref({})
 	const range = ref([{
 	const range = ref([{
 			value: 0,
 			value: 0,
-			text: "篮球"
+			text: "LNO001"
 		},
 		},
 		{
 		{
 			value: 1,
 			value: 1,
-			text: "足球"
+			text: "LNO002"
 		},
 		},
 		{
 		{
 			value: 2,
 			value: 2,
-			text: "游泳"
+			text: "LNO003"
 		},
 		},
 	])
 	])
+	const emit = defineEmits(['batchReporting-addBatch']);
 
 
-	onLoad((options) => {
+	onLoad(() => {
 		// 处理特殊字符JSON解析失败报错
 		// 处理特殊字符JSON解析失败报错
-		let encodeData = encodeURIComponent(store.planSubDetails);
-		curSubPlan.value = JSON.parse(decodeURIComponent(encodeData));
-		
+		curSubPlan.value = store.planSubDetails; 
+		console.log(curSubPlan.value)
 		dayWork.value = {
 		dayWork.value = {
 			productionPlanDetailSubDetailId: curSubPlan.value.id,
 			productionPlanDetailSubDetailId: curSubPlan.value.id,
 			productionPlanDetailId: curSubPlan.value.productionPlanDetailId,
 			productionPlanDetailId: curSubPlan.value.productionPlanDetailId,
@@ -185,7 +185,7 @@
 					icon: 'error',
 					icon: 'error',
 					title: '添加失败',
 					title: '添加失败',
 					duration: 2000
 					duration: 2000
-				});
+				}); 
 			}
 			}
 		})
 		})
 	}
 	}

+ 52 - 25
pages/batchReporting/index.vue

@@ -1,7 +1,8 @@
 <template>
 <template>
 	<view class="uni-column" style="height: 100%; background-color: #f5f5f5;">
 	<view class="uni-column" style="height: 100%; background-color: #f5f5f5;">
 		<scroll-view class="scroll-container" scroll-y>
 		<scroll-view class="scroll-container" scroll-y>
-			<view v-for="(item, index) in listData" :key="index" class="list-item" @click="handleToreportingForWork(item)">
+			<view v-for="(item, index) in listData" :key="index" class="list-item"
+				@click="handleToreportingForWork(item)">
 				<view class="title-container uni-row" style="justify-content: flex-start;">
 				<view class="title-container uni-row" style="justify-content: flex-start;">
 					<view class="title uni-row">
 					<view class="title uni-row">
 						<text class="label">批次号:</text>
 						<text class="label">批次号:</text>
@@ -18,8 +19,8 @@
 				</view>
 				</view>
 				<view class="item-info uni-row">
 				<view class="item-info uni-row">
 					<text class="label">箱号</text>
 					<text class="label">箱号</text>
-					<text class="label right">{{ item['caseNumber'] }}</text>
-				</view> 
+					<text class="label right">{{ item['carrierName'] }}</text>
+				</view>
 				<view class="item-info uni-row">
 				<view class="item-info uni-row">
 					<text class="label">总工时</text>
 					<text class="label">总工时</text>
 					<text class="label right">{{ item['totalWorkingHours']}}h</text>
 					<text class="label right">{{ item['totalWorkingHours']}}h</text>
@@ -34,31 +35,40 @@
 				</view>
 				</view>
 				<view class="item-info uni-row">
 				<view class="item-info uni-row">
 					<text class="label">当前工序</text>
 					<text class="label">当前工序</text>
-					<text class="label right">{{ item['currentProcess']}}</text>
+					<text class="label right">{{ item['currentProcess'].processAlias }}</text>
 				</view>
 				</view>
 				<view class="item-info uni-row">
 				<view class="item-info uni-row">
 					<text class="label">下道工序</text>
 					<text class="label">下道工序</text>
 					<text class="label right">{{ item['NextProcess'] }}</text>
 					<text class="label right">{{ item['NextProcess'] }}</text>
 				</view>
 				</view>
 				<view class="status-btn uni-row">
 				<view class="status-btn uni-row">
-					<view v-if="item['status'] == 1" class=" uni-row">
+					<view v-if="item['status'] == 2" class=" uni-row">
 						<button class="turnover-tag" size="mini"
 						<button class="turnover-tag" size="mini"
 							@click.stop="handleShowTurnoverApplication(null)">周转申请</button>
 							@click.stop="handleShowTurnoverApplication(null)">周转申请</button>
 						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
 						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
 					</view>
 					</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">取消周转</button>
 						<button class="turnover-tag" size="mini">取消周转</button>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
 		</scroll-view>
 		</scroll-view>
-		<view class="bottom uni-row">
-			<button class="start-batch-btn" type="primary" @click="handleShowLotDialog(listData)">开始新批次</button>
+		<view v-if="bottomStatus == 0" class="bottom uni-row">
+			<button class="start-batch-btn" type="primary" @click="handleStartNewBatch">开始新批次</button>
+		</view>
+		<view v-else-if="bottomStatus == 1" class="bottom uni-row">
+			<button class="start-batch-btn" type="primary" @click="handleStartNewBatch(listData)">扫一扫开始新批次</button>
+		</view>
+		<view v-else="bottomStatus == 2" class="bottom uni-row">
+			<button class="start-batch-btn" style="width: 40%;margin-right: 10rpx;" type="primary"
+				@click="handleStartNewBatch(listData)">开始新批次</button>
+			<button class="start-batch-btn" style="width: 40%;margin-left: 10rpx" type="primary"
+				@click="handleStartNewBatch(listData)">扫一扫开始新批次</button>
 		</view>
 		</view>
 		<dialog-lot ref="lotDialog" />
 		<dialog-lot ref="lotDialog" />
 		<dialog-turnoverApplication ref="turnoverApplicationDialog" />
 		<dialog-turnoverApplication ref="turnoverApplicationDialog" />
 	</view>
 	</view>
-
+ 
 </template>
 </template>
 
 
 <script setup>
 <script setup>
@@ -81,16 +91,37 @@
 	const lotDialog = ref(null)
 	const lotDialog = ref(null)
 	const listData = ref([])
 	const listData = ref([])
 	const bizDayworkObj = ref({})
 	const bizDayworkObj = ref({})
-	const curSubPlan = ref({})
+	const curSubPlan = ref({})  // 子计划单信息
+	const processInfo = ref([]) // 员工工序信息
+	const bottomStatus = ref(0) // 底部按钮显示
 
 
 	onLoad(() => {
 	onLoad(() => {
-		let encodeData = encodeURIComponent(store.planSubDetails);
-		curSubPlan.value = JSON.parse(decodeURIComponent(encodeData));
-		console.log(curSubPlan.value)
+		// let encodeData = encodeURIComponent(store.planSubDetails);
+		curSubPlan.value = store.planSubDetails || {
+			processSequence: []
+		};
+		console.log(store.planSubDetails)
+		processInfo.value = store.userProcessInfo || [];
+		let sunPlanProcesses = [];
+		let userProcesses = [];
+		for (let i = 0; i < curSubPlan.value.processSequence.length; i++) {
+			sunPlanProcesses.push(curSubPlan.value.processSequence[i].id)
+		}
+		for (let i = 0; i < processInfo.value.length; i++) {
+			userProcesses.push(processInfo.value[i].id)
+		}
+		// 判断员工开始批次按钮显示bottomStatus状态
+		if(userProcesses.includes(sunPlanProcesses[0]) && userProcesses.length == 1){
+			bottomStatus.value = 0;
+		}else if(userProcesses.includes(sunPlanProcesses[0]) && userProcesses.length > 1){
+			bottomStatus.value = 2;
+		}else {
+			bottomStatus.value = 1;
+		}
 		init(curSubPlan.value.id);
 		init(curSubPlan.value.id);
 		uni.$on('batchReporting-addBatch', () => {
 		uni.$on('batchReporting-addBatch', () => {
-			init(curSubPlan.value.id);
-		})
+			init(curSubPlan.value.id); 
+		}) 
 	})
 	})
 
 
 
 
@@ -99,14 +130,10 @@
 		// 调用子组件中的方法
 		// 调用子组件中的方法
 		turnoverApplicationDialog.value.open(_data)
 		turnoverApplicationDialog.value.open(_data)
 	}
 	}
-	const handleShowLotDialog = (data) => {
-		if (data.length > 0) {
-			lotDialog.value.open(data)
-		} else {
-			uni.navigateTo({
-				url: "/pages/addNewBatch/index?currentSubPlan=" + JSON.stringify(curSubPlan.value)
-			})
-		}
+	const handleStartNewBatch = () => {
+		uni.navigateTo({
+			url: "/pages/addNewBatch/index"
+		})
 	}
 	}
 
 
 	function init(id) {
 	function init(id) {
@@ -125,9 +152,9 @@
 	}
 	}
 
 
 	function handleToreportingForWork(item) {
 	function handleToreportingForWork(item) {
-		store.dayworkInfo = JSON.stringify(item)
+		store.dayworkInfo = item
 		uni.navigateTo({
 		uni.navigateTo({
-			url: "/pages/reportingForWork/index?"
+			url: "/pages/reportingForWork/index"
 		})
 		})
 	}
 	}
 </script>
 </script>

+ 32 - 20
pages/changeBox/index.vue

@@ -1,21 +1,21 @@
 <template>
 <template>
-	<view class='container' >
+	<view class='container'>
 		<view class='content'>
 		<view class='content'>
-			<view >
+			<view>
 				<text class='title'>当前箱号</text>
 				<text class='title'>当前箱号</text>
 				<view class="vehicleList uni-row" style="height: 100%;">
 				<view class="vehicleList uni-row" style="height: 100%;">
 					<view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
 					<view class="vehicleNo uni-row" v-for="(item,index) in vehicleList">
 						<text>{{item.carrierCode}}</text>
 						<text>{{item.carrierCode}}</text>
 						<text @click="handleDelVehicleNo(item)">×</text>
 						<text @click="handleDelVehicleNo(item)">×</text>
 					</view>
 					</view>
-				</view>		
+				</view>
 			</view>
 			</view>
 			<view class="btn">
 			<view class="btn">
-				<button class='submit code' @click="handleScanCode()" >扫码</button>
+				<button class='submit code' @click="handleScanCode()">扫码</button>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class='bottom uni-row'>
 		<view class='bottom uni-row'>
-			<button class='submit' type=primary>提交</button>
+			<button class='submit' type=primary @click="handleSubmit">提交</button>
 		</view>
 		</view>
 	</view>
 	</view>
 </template>
 </template>
@@ -27,10 +27,7 @@
 		onLoad,
 		onLoad,
 		onReady
 		onReady
 	} from '@dcloudio/uni-app'
 	} from '@dcloudio/uni-app'
-
-
-	onLoad(() => {
-	})
+	
 	const vehicleList = ref([{ // 载具列表
 	const vehicleList = ref([{ // 载具列表
 			carrierId: '1731475038666575873',
 			carrierId: '1731475038666575873',
 			carrierCode: '000001'
 			carrierCode: '000001'
@@ -40,9 +37,17 @@
 			carrierCode: '000002'
 			carrierCode: '000002'
 		}
 		}
 	])
 	])
+
+	onLoad(() => {})
+
+	function init(){
+		
+	}
+
 	function handleDelVehicleNo(item) {
 	function handleDelVehicleNo(item) {
-		vehicleList.value.splice(item,1);
+		vehicleList.value.splice(item, 1);
 	}
 	}
+
 	function handleScanCode() {
 	function handleScanCode() {
 		uni.scanCode({
 		uni.scanCode({
 			scanType: ['qrCode'], // 条形码扫描
 			scanType: ['qrCode'], // 条形码扫描
@@ -50,9 +55,10 @@
 			success: function(res) {
 			success: function(res) {
 				let vehicleObj = JSON.parse(res.result);
 				let vehicleObj = JSON.parse(res.result);
 				for (let i = 0; i < vehicleList.value.length; i++) {
 				for (let i = 0; i < vehicleList.value.length; i++) {
-					if(Object.entries(vehicleList.value[i]).toString() === Object.entries(vehicleObj).toString()){
+					if (Object.entries(vehicleList.value[i]).toString() === Object.entries(vehicleObj)
+						.toString()) {
 						uni.showToast({
 						uni.showToast({
-							icon:"error",
+							icon: "error",
 							title: "载具已存在"
 							title: "载具已存在"
 						})
 						})
 						return;
 						return;
@@ -62,6 +68,10 @@
 			}
 			}
 		});
 		});
 	}
 	}
+
+	function handleSubmit() {
+
+	}
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
@@ -87,8 +97,9 @@
 		line-height: 80rpx;
 		line-height: 80rpx;
 		padding-left: 0;
 		padding-left: 0;
 	}
 	}
+
 	.code {
 	.code {
-		background-color: rgba(0, 226, 166,1);
+		background-color: rgba(0, 226, 166, 1);
 		color: white;
 		color: white;
 	}
 	}
 
 
@@ -99,6 +110,7 @@
 		margin: 50rpx auto;
 		margin: 50rpx auto;
 		padding-bottom: 50rpx;
 		padding-bottom: 50rpx;
 		border-radius: 12rpx;
 		border-radius: 12rpx;
+
 		.vehicleList {
 		.vehicleList {
 			justify-content: flex-start;
 			justify-content: flex-start;
 			flex-wrap: wrap;
 			flex-wrap: wrap;
@@ -106,7 +118,7 @@
 			height: 120rpx;
 			height: 120rpx;
 			overflow: auto;
 			overflow: auto;
 			padding: 0 80rpx;
 			padding: 0 80rpx;
-		
+
 			.vehicleNo {
 			.vehicleNo {
 				padding: 0 10rpx;
 				padding: 0 10rpx;
 				margin: 10rpx;
 				margin: 10rpx;
@@ -127,12 +139,12 @@
 		font-weight: bold;
 		font-weight: bold;
 	}
 	}
 
 
-.btn {
-	position: fixed;
-	top: 940rpx;
-	left: 0;
-	right: 0;
-}
+	.btn {
+		position: fixed;
+		top: 940rpx;
+		left: 0;
+		right: 0;
+	}
 
 
 	.segment {
 	.segment {
 		width: 280rpx;
 		width: 280rpx;

+ 9 - 9
pages/dashboard/index.vue

@@ -5,11 +5,11 @@
 		</view>
 		</view>
 		<view class="title"><text class="label">德迈仕数字生产线管理平台</text></view>
 		<view class="title"><text class="label">德迈仕数字生产线管理平台</text></view>
 		<view class="user-info-container uni-row">
 		<view class="user-info-container uni-row">
-			<view class="icon"><text class="label">{{ userName.charAt(0) }}</text></view>
+			<view class="icon"><text class="label">{{ userInfo.nickName.charAt(0) }}</text></view>
 			<view class="user-info uni-column">
 			<view class="user-info uni-column">
-				<view class="nickname uni-row"><text class="label">{{ userName }}</text><text class="label"
+				<view class="nickname uni-row"><text class="label">{{ userInfo.userName }}</text><text class="label"
 						style="margin-left: 12rpx">ID</text><text class="label"
 						style="margin-left: 12rpx">ID</text><text class="label"
-						style="margin-left: 8rpx">{{ userId }}</text>
+						style="margin-left: 8rpx">{{ userInfo.userId }}</text>
 				</view>
 				</view>
 				<view class="process uni-row"><text class="label">当前工段:</text><text class="label">{{ deptName }}</text>
 				<view class="process uni-row"><text class="label">当前工段:</text><text class="label">{{ deptName }}</text>
 				</view>
 				</view>
@@ -47,10 +47,13 @@
 	const name = ref('')
 	const name = ref('')
 	const userName = ref('')
 	const userName = ref('')
 	const userId = ref(null)
 	const userId = ref(null)
+	const userInfo = ref({})
 	
 	
 	onLoad((options) => {
 	onLoad((options) => {
-		userName.value = JSON.parse(store.userInfo).userName
-		userId.value = JSON.parse(store.userInfo).userId
+		userInfo.value = store.userInfo || {
+			nickName: ""
+		};
+		console.log(userInfo.value)
 		getDepartmentName()
 		getDepartmentName()
 	})
 	})
 	
 	
@@ -63,9 +66,6 @@
 		uni.navigateTo({
 		uni.navigateTo({
 			url: '/pages/productionPlan/index'
 			url: '/pages/productionPlan/index'
 		})
 		})
-		// getSubPlanDetailsList().then((res) => {
-		//   console.log(res)
-		// })
 	}
 	}
 	const handleToHandlingList = () => {
 	const handleToHandlingList = () => {
 		uni.navigateTo({
 		uni.navigateTo({
@@ -85,7 +85,7 @@
 	}
 	}
 
 
 	function getDepartmentName() {
 	function getDepartmentName() {
-		getDeptName(userId.value).then((res) => {
+		getDeptName(userInfo.value.userId).then((res) => {
 			if (res.code == 200) {
 			if (res.code == 200) {
 				deptName.value = res.msg
 				deptName.value = res.msg
 			}
 			}

+ 3 - 2
pages/equipmentList/index.vue

@@ -59,7 +59,7 @@
 			getEquipmentUserList(data).then(res => {
 			getEquipmentUserList(data).then(res => {
 				curBindDetails.value = res.rows;
 				curBindDetails.value = res.rows;
 				for (var i = 0; i < curBindDetails.value.length; i++) {
 				for (var i = 0; i < curBindDetails.value.length; i++) {
-					curBindEquipmentIds?.value.push(curBindDetails.value[i].equipmentDetailId)
+					curBindEquipmentIds.value.push(curBindDetails.value[i].equipmentDetailId)
 				}
 				}
 			})
 			})
 		})
 		})
@@ -112,7 +112,7 @@
 					if (equipmentList.value[i].equipmentId == equipment.equipmentId) {
 					if (equipmentList.value[i].equipmentId == equipment.equipmentId) {
 						uni.showToast({
 						uni.showToast({
 							icon: "error",
 							icon: "error",
-							title: "载具已存在"
+							title: "设备已绑定"
 						})
 						})
 						return;
 						return;
 					}
 					}
@@ -125,6 +125,7 @@
 				}
 				}
 				// 判断该设备是否分配给改员工
 				// 判断该设备是否分配给改员工
 				if (!curBindEquipmentIds.value.includes(equipment.equipmentId)) {
 				if (!curBindEquipmentIds.value.includes(equipment.equipmentId)) {
+					console.log(equipment.equipmentId)
 					let msg = '当前员工没有分配到该设备,确定继续绑定吗?';		 
 					let msg = '当前员工没有分配到该设备,确定继续绑定吗?';		 
 					confirm.value.open(msg);
 					confirm.value.open(msg);
 				}else{
 				}else{

+ 3 - 9
pages/index/index.vue

@@ -6,7 +6,7 @@
 
 
 		<view v-for="(item, index) in loggedUsers" class="item-user uni-row" @click="handleSelectUser(item)"
 		<view v-for="(item, index) in loggedUsers" class="item-user uni-row" @click="handleSelectUser(item)"
 			@longpress="handleLongPressUser(item)">
 			@longpress="handleLongPressUser(item)">
-			<view class="user-avatar uni-row"><text class="label">{{item.userName.charAt(0)}}</text></view>
+			<view class="user-avatar uni-row"><text class="label">{{item.nickName.charAt(0)}}</text></view>
 			<view class="user-info">
 			<view class="user-info">
 				<view class="nickname">
 				<view class="nickname">
 					<text class="label">{{item.nickName}}</text>
 					<text class="label">{{item.nickName}}</text>
@@ -39,7 +39,8 @@
 		onReady
 		onReady
 	} from '@dcloudio/uni-app'
 	} from '@dcloudio/uni-app'
 	import {
 	import {
-		getUserInfo,getNickNameByUserName
+		getUserInfo,
+		getNickNameByUserName
 	} from '@/api/login/index.js'
 	} from '@/api/login/index.js'
 	// 登录过的用户
 	// 登录过的用户
 	const loggedUsers = ref([])
 	const loggedUsers = ref([])
@@ -55,29 +56,22 @@
 	function init() {
 	function init() {
 		uni.getStorageInfo({
 		uni.getStorageInfo({
 			success: function(res) {
 			success: function(res) {
-				console.log(res.keys)
 				for (let i = 0; i < res.keys.length; i++) {
 				for (let i = 0; i < res.keys.length; i++) {
 					let storagekey = res.keys[i];
 					let storagekey = res.keys[i];
-					console.log(storagekey)
 					uni.getStorage({
 					uni.getStorage({
 						key: storagekey,
 						key: storagekey,
 						success: function(res) {
 						success: function(res) {
 							if (storagekey !== 'token' && storagekey !== '__DC_STAT_UUID') {
 							if (storagekey !== 'token' && storagekey !== '__DC_STAT_UUID') {
-								console.log(storagekey)
 								getNickNameByUserName(storagekey).then((response) => {
 								getNickNameByUserName(storagekey).then((response) => {
 									if (response.code == 200) {
 									if (response.code == 200) {
-										console.log(response)
 										loggedUsers.value.push({
 										loggedUsers.value.push({
 											userName: storagekey,
 											userName: storagekey,
 											password: res.data,
 											password: res.data,
 											nickName: response.msg
 											nickName: response.msg
 										})
 										})
-										console.log(loggedUsers.value, "888")
 									}
 									}
 								})
 								})
 							}
 							}
-
-
 						}
 						}
 					});
 					});
 				}
 				}

+ 3 - 1
pages/productionPlan/index.vue

@@ -116,7 +116,7 @@
 	}
 	}
 
 
 	function handleToBatchReporting(item) {
 	function handleToBatchReporting(item) {
-		store.planSubDetails = JSON.stringify(item)
+		store.planSubDetails = item
 		uni.navigateTo({
 		uni.navigateTo({
 			url: '/pages/batchReporting/index' 
 			url: '/pages/batchReporting/index' 
 		})
 		})
@@ -173,6 +173,8 @@
 	}
 	}
 	.uni-column {
 	.uni-column {
 		background-color: rgba(245, 245, 245, 1);
 		background-color: rgba(245, 245, 245, 1);
+		height: 100%;
+		overflow: auto;
 	}
 	}
 
 
 	.list-item {
 	.list-item {

+ 117 - 87
pages/reportingForWork/index.vue

@@ -1,19 +1,18 @@
 <template>
 <template>
-	<view class="uni-column container" >
+	<view class="uni-column container">
 		<scroll-view class="scroll-container" scroll-y>
 		<scroll-view class="scroll-container" scroll-y>
-			<view v-for="(item, index) in listData" :key="index"
-				class="list-item">
+			<view v-for="(item, index) in listData" :key="index" class="list-item">
 				<view class="title-container uni-row">
 				<view class="title-container uni-row">
 					<view class="title uni-row">
 					<view class="title uni-row">
-						<text class="label">批次号</text>
-						<text class="label code">{{ curSubDetails['lotCode'] }}</text>
+						<text class="label">批次号:</text>
+						<text class="label code"> {{ item['lotCode'] }}</text>
 					</view>
 					</view>
 					<view class="right-info uni-row">
 					<view class="right-info uni-row">
 						<view class="right-info uni-row"> <text class="label ">工时</text>
 						<view class="right-info uni-row"> <text class="label ">工时</text>
 							<text class="label time">{{ item['taskTime'] }}h</text>
 							<text class="label time">{{ item['taskTime'] }}h</text>
 						</view>
 						</view>
 						<view class="right-info uni-row" style="margin-left:32px;"> <text class="label">合格数</text>
 						<view class="right-info uni-row" style="margin-left:32px;"> <text class="label">合格数</text>
-							<text class="label number ">{{ item['qualifiedQuantity'] }}</text>
+							<text class="label number ">{{ item['qualifiedNum'] }}</text>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -35,10 +34,10 @@
 				</view>
 				</view>
 				<view class="item-info uni-row">
 				<view class="item-info uni-row">
 					<text class="label">废品原因</text>
 					<text class="label">废品原因</text>
-					<text class="label right">{{ (item['remark'] != "")?item['remark']:'-'}}</text>
+					<text class="label right">{{ (item['reason'] != "")?item['reason']:'-'}}</text>
 				</view>
 				</view>
 
 
-				<view v-if="item['status'] == 0" class="status-btn uni-row ">
+				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
 					<button class="finished-turnover-tag" size="mini"
 					<button class="finished-turnover-tag" size="mini"
 						@click.stop="handleShowEndWorkDialog(item)">结束报工</button>
 						@click.stop="handleShowEndWorkDialog(item)">结束报工</button>
 				</view>
 				</view>
@@ -46,99 +45,140 @@
 		</scroll-view>
 		</scroll-view>
 		<view class="bottom uni-row">
 		<view class="bottom uni-row">
 			<button class="bottom-btn left-btn" @click="HandleChangevehicle"><text class="label">更换载具</text></button>
 			<button class="bottom-btn left-btn" @click="HandleChangevehicle"><text class="label">更换载具</text></button>
-			<button class="bottom-btn right-btn" @click="handleStartProcessing"><text class="label">开始加工</text></button>
+			<button class="bottom-btn right-btn" type="primary" @click="handleStartProcessing"><text
+					class="label">开始加工</text></button>
 		</view>
 		</view>
-		<dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset"/>
-		<dialog-selectEquipment ref='selectEquipment' @refportingForWorkRefresh='reset'></dialog-selectEquipment>
+		<dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset" />
+		<dialog-selectEquipment ref='selectEquipment'
+			@handleAddDayWorkItem='handleAddDayWorkItem'></dialog-selectEquipment>
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script setup>
 <script setup>
-	import { 
+	import {
 		ref
 		ref
 	} from 'vue'
 	} from 'vue'
 	import {
 	import {
 		onLoad,
 		onLoad,
 		onReady
 		onReady
 	} from '@dcloudio/uni-app'
 	} from '@dcloudio/uni-app'
-	import { getDayWorkItemList,saveDayWorkItem } from "@/api/business/dayWorkItem.js"
-	import { store } from '@/store/index.js'
-	
-	const listData = ref([])
-	const curSubDetails = ref({})
-	const dayWorkInfo = ref({})
-	const endWorkDialog = ref(null)
-	const selectEquipment = ref(null)
-	const equipmentList = ref([])
+	import {
+		getDayWorkItemList,
+		saveDayWorkItemBatch
+	} from "@/api/business/dayWorkItem.js"
+	import {
+		store
+	} from '@/store/index.js'
+	import {
+		timestampToTime
+	} from '@/utils/common.js'
+
+	const listData = ref([])        // 回显 
+	const curSubDetails = ref({})   // 接收生产计划单信息 
+	const dayWorkInfo = ref({})     // 接收daywork信息
+	const equipmentList = ref([])   // 设备列表
+	const endWorkDialog = ref(null) // 组件
+	const selectEquipment = ref(null)// 组件   
+	const dayWorkItem = ref({})     // 添加传输对象
+	const reqParam = ref([])        // 请求参数
+	const userInfo = ref(null)      // 登录员工信息
 	
 	
 	onLoad(() => {
 	onLoad(() => {
-		let encodeData = encodeURIComponent(store.planSubDetails);
-		curSubDetails.value = JSON.parse(decodeURIComponent(encodeData));
-		console.log(curSubDetails.value)
-		encodeData = encodeURIComponent(store.dayworkInfo);
-		dayWorkInfo.value = JSON.parse(decodeURIComponent(encodeData));
-		console.log(dayWorkInfo.value);
+		curSubDetails.value = store.planSubDetails;
+		dayWorkInfo.value = store.dayworkInfo;
+		console.log(dayWorkInfo.value)
 		init();
 		init();
 	})
 	})
-	
-	function init(){
-		getDayWorkItemList().then(res => {
-			listData.value = res.rows;
+
+	function init() {
+		userInfo.value = store.userInfo;
+		uni.showLoading({
+			title: '加载中'
+		});
+		getDayWorkItemList({
+			dayworkId: dayWorkInfo.value.id
+		}).then(res => {
+			listData.value = res.rows || [];
 			console.log(listData)
 			console.log(listData)
+			// 时间戳转工时
+			for (var i = 0; i < listData.value.length; i++) {
+				let timeStamp = Date.parse(listData.value[i].endTime) - Date.parse(listData.value[i].startTime);
+				listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000).toFixed(2);
+				console.log(typeof(listData.value[i].taskTime),listData.value[i].taskTime)
+			}
+			uni.hideLoading()
 		})
 		})
 	}
 	}
-	
-	function reset(){
+
+	function reset() {
 		init();
 		init();
 	}
 	}
 
 
-	function handleShowEndWorkDialog(data){
+	function handleShowEndWorkDialog(data) {
 		// 调用子组件中的方法
 		// 调用子组件中的方法
 		endWorkDialog.value.open(data)
 		endWorkDialog.value.open(data)
 	}
 	}
-	
-	function HandleChangevehicle(){
-		uni.navigateTo({ 
-			url:"/pages/changeBox/index"
+
+	function HandleChangevehicle() {
+		uni.navigateTo({
+			url: "/pages/changeBox/index"
 		})
 		})
 	}
 	}
-	
-	function getEquipment(data){
+
+	function getEquipment(data) {
 		console.log(data);
 		console.log(data);
 		equipmentList.value = data;
 		equipmentList.value = data;
 	}
 	}
-	
-	function handleStartProcessing(){
+
+	function handleStartProcessing() {
 		selectEquipment.value.open();
 		selectEquipment.value.open();
-		let date = new Date()
-		// saveDayWorkItem({
-		// 	dayworkId: '1',
-		// 	startTime: date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate()
-		// }).then(res => {
-		// 	if(res.code === 200){
-		// 		uni.showToast({
-		// 			icon: 'success',
-		// 			title: '操作成功',
-		// 			duration: 2000
-		// 		});
-		// 		init();
-		// 	}else{
-		// 		uni.showToast({
-		// 			icon: 'error',
-		// 			title: '操作失败',
-		// 			duration: 2000
-		// 		});
-		// 	}
-		// })
+	}
+
+	function handleAddDayWorkItem(data) {
+		equipmentList.value = data;
+		dayWorkItem.value = {
+			dayworkId: dayWorkInfo.value.id,
+			lotId: dayWorkInfo.value.lotId,
+			productionPlanId: curSubDetails.value.productionPlanId,
+			productionPlanDetailId: curSubDetails.value.productionPlanDetailId,
+			productionPlanDetailSubDetailId: curSubDetails.value.id,
+			processId: store.dayworkInfo.currentProcess.id,
+			startTime: timestampToTime(new Date())
+		}
+		
+		for (var i = 0; i < equipmentList.value.length; i++) {
+			reqParam.value.push(dayWorkItem.value);
+			reqParam.value[i].equipmentDetailId = equipmentList.value[i].equipmentId;
+			reqParam.value[i].equipmentDetailCode = equipmentList.value[i].equipmentCode;
+			console.log(reqParam.value[i])
+		}
+		console.log(reqParam.value)
+		saveDayWorkItemBatch(reqParam.value).then(res => {
+			if (res.code === 200) {
+				uni.showToast({
+					icon: 'success',
+					title: '操作成功',
+					duration: 2000
+				});
+				init();
+			} else {
+				uni.showToast({
+					icon: 'error',
+					title: '操作失败',
+					duration: 2000
+				});
+			}
+		})
 	}
 	}
 </script>
 </script>
 
 
 <style lang="scss">
 <style lang="scss">
 	.container {
 	.container {
-		height: 2000rpx; 
+		height: 2000rpx;
 		background-color: #f5f5f5;
 		background-color: #f5f5f5;
 		overflow: auto;
 		overflow: auto;
 	}
 	}
+
 	.scroll-container {
 	.scroll-container {
 		position: absolute;
 		position: absolute;
 		top: 24rpx;
 		top: 24rpx;
@@ -172,10 +212,9 @@
 				.label {
 				.label {
 					font-size: 32rpx;
 					font-size: 32rpx;
 					font-weight: bold;
 					font-weight: bold;
-
-					&.code {
-						margin-left: 8rpx;
-					}
+				}
+				.code {
+					margin-left: 8rpx;
 				}
 				}
 			}
 			}
 		}
 		}
@@ -197,25 +236,20 @@
 
 
 		.right-info {
 		.right-info {
 			justify-content: flex-end;
 			justify-content: flex-end;
+			width: 45%;
 			margin-top: 5rpx;
 			margin-top: 5rpx;
-
 			.label {
 			.label {
 				font-size: 28rpx;
 				font-size: 28rpx;
-
-				color: #000000;
-
-				&.time {
-					margin-left: 8rpx;
-					color: #1684fc;
-
-				}
-
-				&.number {
-					margin-left: 8rpx;
-					color: rgba(0, 226, 166, 1);
-				}
-
 			}
 			}
+			.time {
+				margin-left: 8rpx;
+				color: #1684fc;
+			}
+			.number {
+				margin-left: 8rpx;
+				color: #1684fc;			
+			}
+			
 		}
 		}
 	}
 	}
 
 
@@ -236,13 +270,11 @@
 			color: #FFFFFF;
 			color: #FFFFFF;
 
 
 			&.left-btn {
 			&.left-btn {
-				background-color: #1684fc;
+				background-color: rgba(0, 226, 166, 1);
 			}
 			}
 
 
 			&.right-btn {
 			&.right-btn {
-				background-color: rgb(255, 121, 1);
 				margin-left: 24rpx;
 				margin-left: 24rpx;
-
 			}
 			}
 		}
 		}
 	}
 	}
@@ -253,12 +285,10 @@
 
 
 		.finished-turnover-tag {
 		.finished-turnover-tag {
 			margin: unset;
 			margin: unset;
-
 			border-radius: 8rpx;
 			border-radius: 8rpx;
 			background-color: rgb(255, 85, 85);
 			background-color: rgb(255, 85, 85);
 			font-size: 28rpx;
 			font-size: 28rpx;
 			color: #FFFFFF;
 			color: #FFFFFF;
-
 		}
 		}
 	}
 	}
 </style>
 </style>

+ 4 - 3
store/index.js

@@ -1,7 +1,8 @@
 import { reactive } from 'vue'
 import { reactive } from 'vue'
 
 
 export const store = reactive({
 export const store = reactive({
-  userInfo: '',
-  planSubDetails: '',
-  dayworkInfo: ''
+  userInfo: null,
+  planSubDetails: null,
+  dayworkInfo: null,
+  userProcessInfo: null
 })
 })