ezhizao_zx 1 年間 前
コミット
f5594cce35
3 ファイル変更70 行追加6 行削除
  1. 21 0
      api/business/sortDaywork.js
  2. 7 4
      pages/sortBatchReporting/index.vue
  3. 42 2
      pages/sorting/form.vue

+ 21 - 0
api/business/sortDaywork.js

@@ -0,0 +1,21 @@
+import req from '@/utils/request.js'
+
+/**
+ * 获取分选报工信息
+ * @param {Object} data
+ */
+export function getSortingDayworkItem(data) {
+	return req.request({
+		url:'/business/sortDaywork/start',
+		method: 'POST',
+		data: data
+	})
+}
+
+export function getListByUserEquipment(data) {
+	return req.request({
+		url:'/business/planDetailSubDetail/getListByUserEquipment',
+		method: 'GET',
+		data: data
+	})
+}

+ 7 - 4
pages/sortBatchReporting/index.vue

@@ -117,8 +117,6 @@
 			<button class="start-batch-btn" type="primary" @click="handleScanCode">扫一扫开始新批次</button>
 		</view> -->
 		<view class="bottom uni-row">
-			<button v-if="bottomStatus" class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
-				@click="handleStartNewBatch">开始新批次</button>
 			<button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
 				@click="handleScanCode">扫码开始批次</button>
 			<button class="start-batch-btn" type="primary" @click="handleSearchCode">查箱号</button>
@@ -276,9 +274,14 @@
 	}
 
 	function handleToreportingForWork(item) {
-		store.dayworkInfo = item
 		uni.navigateTo({
-			url: "/pages/reportingForWork/index"
+			url: "/pages/sorting/form",
+			success: function(res) {
+				// 通过eventChannel向被打开页面传送数据
+				res.eventChannel.emit('acceptDataFromOpenerPage', {
+					data: item
+				})
+			}
 		})
 	}
 

+ 42 - 2
pages/sorting/form.vue

@@ -3,10 +3,10 @@
 		<view class="lot-info uni-column">
 			<view class="lot-code uni-row">
 				<text>批次号</text>
-				<text style="margin-left: 24rpx;">D2423156000691</text>
+				<text style="margin-left: 24rpx;">{{ dayworkItem.lotCode }}</text>
 			</view>
 			<view class="product-info">
-				产品描述
+				产品描述: {{ dayworkItem.productDescription }}
 			</view>
 		</view>
 		
@@ -75,17 +75,57 @@
 
 <script setup>
 	import { ref } from 'vue'
+	import {
+		onMounted,
+		getCurrentInstance
+	} from 'vue';
+	import { getSortingDayworkItem } from '@/api/business/sortDaywork.js'
 	import { onLoad, onReady, onUnload, onShow } from '@dcloudio/uni-app'
 	
 	const unfitInfos = ref([])
 	const consultations = ref([])
+	const dayworkInfo = ref({})
+	const dayworkItem = ref({})
 	
 	/***************************** 页面生命周期函数 *****************************/
 	onShow(() => {
 		
 	})
+	onMounted(() => {
+		const instance = getCurrentInstance().proxy
+		const eventChannel = instance.getOpenerEventChannel();
+	
+		eventChannel.on('acceptDataFromOpenerPage', function(data) {
+			console.log('acceptDataFromOpenerPage', data)
+			if (data && data.data) {
+				dayworkInfo.value = data.data
+				init({
+					id: data.data.id
+				})
+			} else {
+				let reqParam = {
+					id: dayworkInfo.value.id
+				}
+				init(reqParam);
+			}
+		})
+	})
 	
 	/***************************** 定义了一些方法 *****************************/
+	const init = (data) => {
+		// 获取当前报工信息
+		getSortingDayworkItem(data).then(res => {
+			console.log(res)
+			if (res.code === 200) {
+				dayworkItem.value = res.data
+			} else {
+				uni.showToast({
+					icon: none,
+					title: res.message
+				})
+			}
+		})
+	}
 	const addUnfitInfo = (data) => {
 		const info = {
 			title: data.title,