mao 1 년 전
부모
커밋
d54bdd6337

+ 1 - 2
components/dialog-login/dialog-login.vue

@@ -77,8 +77,7 @@
 							user.value.push(userInfo.value);
 							store.userInfo = JSON.stringify(res.data)
 							uni.redirectTo({
-								url: '/pages/dashboard/index?userName=' + userInfo.value
-									.userName + '&userId=' + userInfo.value.userId
+								url: '/pages/dashboard/index'
 							});
 						}
 					})

+ 22 - 4
components/dialog-selectEquipment/dialog-selectEquipment.vue

@@ -33,14 +33,20 @@
 	const baseDialog = ref(null)
 	const selection = ref([])
 	const equiments = ref([])
+	const curSubDetails = ref({})
+	const dayWorkInfo = ref({})
 	const dayWorkItem = ref({})
-	const userInfo = ref({})
-
+	const emit = defineEmits(['refportingForWorkRefresh'])
+	
 	onLoad(() => {
 		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 => {
 			equiments.value = res.rows
 		})
@@ -72,13 +78,25 @@
 	}
 
 	function handleStart() {
-		saveDayWorkItem().then(res => {
+		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',

+ 7 - 2
pages/addNewBatch/index.vue

@@ -86,6 +86,7 @@
 	import {
 		saveDayWork
 	} from '@/api/business/dayWork.js'
+	import { store } from '@/store/index.js'
 
 	const batchNoCheck = ref(null) // 批次号是否选中
 	const batchNoList = ref([]) // 批次号列表
@@ -113,11 +114,15 @@
 	])
 
 	onLoad((options) => {
-		curSubPlan.value = JSON.parse(options.currentSubPlan);
+		// 处理特殊字符JSON解析失败报错
+		let encodeData = encodeURIComponent(store.planSubDetails);
+		curSubPlan.value = JSON.parse(decodeURIComponent(encodeData));
+		
 		dayWork.value = {
 			productionPlanDetailSubDetailId: curSubPlan.value.id,
 			productionPlanDetailId: curSubPlan.value.productionPlanDetailId,
-			productionPlanId: curSubPlan.value.productionDetailId
+			productionPlanId: curSubPlan.value.productionDetailId,
+			technologicalProcessId: curSubPlan.value.technologicalProcessId
 		}
 		init();
 	})

+ 19 - 14
pages/batchReporting/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="uni-column" style="height: 100%; background-color: #f5f5f5;">
 		<scroll-view class="scroll-container" scroll-y>
-			<view v-for="(item, index) in listData" :key="index" class="list-item" @click="handleToreportingForWork">
+			<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 uni-row">
 						<text class="label">批次号:</text>
@@ -19,7 +19,7 @@
 				<view class="item-info uni-row">
 					<text class="label">箱号</text>
 					<text class="label right">{{ item['caseNumber'] }}</text>
-				</view>
+				</view> 
 				<view class="item-info uni-row">
 					<text class="label">总工时</text>
 					<text class="label right">{{ item['totalWorkingHours']}}h</text>
@@ -42,7 +42,8 @@
 				</view>
 				<view class="status-btn uni-row">
 					<view v-if="item['status'] == 1" class=" uni-row">
-						<button class="turnover-tag" size="mini" @click.stop="handleShowTurnoverApplication(null)">周转申请</button>
+						<button class="turnover-tag" size="mini"
+							@click.stop="handleShowTurnoverApplication(null)">周转申请</button>
 						<!-- <button class="reporting-tag" size="mini" @click="handleToreportingForWork">去报工</button> -->
 					</view>
 					<view v-else-if="item['status'] == 2" class=" uni-row">
@@ -72,6 +73,9 @@
 	import {
 		getDayWorkList
 	} from '@/api/business/dayWork.js'
+	import {
+		store
+	} from '@/store/index.js'
 
 	const turnoverApplicationDialog = ref(null)
 	const lotDialog = ref(null)
@@ -79,21 +83,22 @@
 	const bizDayworkObj = ref({})
 	const curSubPlan = ref({})
 
-	onLoad((options) => {
-		curSubPlan.value = JSON.parse(options?.currentSubPlan || {});
+	onLoad(() => {
+		let encodeData = encodeURIComponent(store.planSubDetails);
+		curSubPlan.value = JSON.parse(decodeURIComponent(encodeData));
 		console.log(curSubPlan.value)
-		init(curSubPlan.value.id);  
-		uni.$on('batchReporting-addBatch',() =>{
+		init(curSubPlan.value.id);
+		uni.$on('batchReporting-addBatch', () => {
 			init(curSubPlan.value.id);
 		})
 	})
-	
-	
+
+
 	const handleShowTurnoverApplication = (data) => {
 		let _data = data ?? {}
 		// 调用子组件中的方法
 		turnoverApplicationDialog.value.open(_data)
-	} 
+	}
 	const handleShowLotDialog = (data) => {
 		if (data.length > 0) {
 			lotDialog.value.open(data)
@@ -113,16 +118,16 @@
 		// console.log(reqData)
 		getDayWorkList(reqData).then(res => {
 			console.log(reqData)
-			console.log(res)
 			listData.value = res.rows;
+			console.log(res)
 			uni.hideLoading();
 		})
 	}
 
-	function handleToreportingForWork() {
-		console.log(curSubPlan.value)
+	function handleToreportingForWork(item) {
+		store.dayworkInfo = JSON.stringify(item)
 		uni.navigateTo({
-			url: "/pages/reportingForWork/index?currentSubPlan=" + JSON.stringify(curSubPlan.value)
+			url: "/pages/reportingForWork/index?"
 		})
 	}
 </script>

+ 9 - 5
pages/dashboard/index.vue

@@ -40,16 +40,20 @@
 	import {
 		getDeptName
 	} from '@/api/login/index.js'
+	import { store } from '@/store/index.js'
+
 
-	onLoad((options) => {
-		userName.value = options.userName
-		userId.value = options.userId
-		getDepartmentName()
-	})
 	const deptName = ref('')
 	const name = ref('')
 	const userName = ref('')
 	const userId = ref(null)
+	
+	onLoad((options) => {
+		userName.value = JSON.parse(store.userInfo).userName
+		userId.value = JSON.parse(store.userInfo).userId
+		getDepartmentName()
+	})
+	
 	const handleToRecerptSfprod = () => {
 		uni.navigateTo({
 			url: '/pages/recerptSfprod/index'

+ 5 - 4
pages/productionPlan/index.vue

@@ -65,7 +65,8 @@
 	import {
 		getToken
 	} from '@/utils/auth'
-
+	import { store } from '@/store/index.js'
+	
 	const listData = ref([])
 	const keywords = ref('')
 
@@ -110,14 +111,14 @@
 					title: res.msg,
 					duration: 1500
 				})
-			}
+			} 
 		})
 	}
 
 	function handleToBatchReporting(item) {
+		store.planSubDetails = JSON.stringify(item)
 		uni.navigateTo({
-			// url: '/pages/batchReporting/index?id=' + item.id
-			url: '/pages/batchReporting/index?currentSubPlan=' + JSON.stringify(item)
+			url: '/pages/batchReporting/index' 
 		})
 	}
 	

+ 11 - 6
pages/reportingForWork/index.vue

@@ -49,12 +49,12 @@
 			<button class="bottom-btn right-btn" @click="handleStartProcessing"><text class="label">开始加工</text></button>
 		</view>
 		<dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset"/>
-		<dialog-selectEquipment ref='selectEquipment'></dialog-selectEquipment>
+		<dialog-selectEquipment ref='selectEquipment' @refportingForWorkRefresh='reset'></dialog-selectEquipment>
 	</view>
 </template>
 
 <script setup>
-	import {
+	import { 
 		ref
 	} from 'vue'
 	import {
@@ -62,17 +62,22 @@
 		onReady
 	} 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([])
 	
-	onLoad((options) => {
-		curSubDetails.value = options.currentSubPlan;
-		console.log(JSON.parse(curSubDetails.value))
+	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);
 		init();
 	})
 	

+ 1 - 1
store/index.js

@@ -2,6 +2,6 @@ import { reactive } from 'vue'
 
 export const store = reactive({
   userInfo: '',
-  planDetails: '',
+  planSubDetails: '',
   dayworkInfo: ''
 })