guoyujia 3 mesi fa
parent
commit
7deff536a0
3 ha cambiato i file con 143 aggiunte e 39 eliminazioni
  1. 2 2
      manifest.json
  2. 62 0
      pages/sorting/form.vue
  3. 79 37
      pages/sorting/storageRetrieval.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "(测试)德迈仕数字生产管理平台",
     "appid" : "__UNI__54D8B02",
     "description" : "",
-    "versionName" : "1.0.33",
-    "versionCode" : 133,
+    "versionName" : "1.0.35",
+    "versionCode" : 135,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 62 - 0
pages/sorting/form.vue

@@ -111,6 +111,15 @@
 					placeholder="请输入" v-model="storageNum" />
 				<span style="margin-left: 56rpx;flex: 1;" v-else>{{ storageNum }}</span>
 			</view>
+			<view v-if="saveFlag" class="save uni-row">
+				<view class="label">选别类型</view>
+				<view v-if="!(storageInfo.status == 1 || Number(dayworkItem.status) >= 3 || storageInfo.id)"
+					style="width: 60%;align-items: center;">
+					<uni-data-select v-model="type" :localdata="selectTypeList" :clear="false"
+						style="outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
+				</view>
+				<span v-else style="margin-left: 56rpx;flex: 1;">{{ selectType(type) }}</span>
+			</view>
 		</view>
 
 		<!-- 报工部分 -->
@@ -188,6 +197,7 @@
 	const isEventTriggered = ref(false); // 创建一个标志位
 	const unfitInfos = ref([])
 	const consultations = ref([])
+	const selectTypeList = ref([])
 	const dayworkInfo = ref({})
 	const retrievalInfo = ref([])
 	// 创建一个引用来存储最后一次请求的时间戳
@@ -195,6 +205,7 @@
 	const dayworkItem = ref({})
 	const saveFlag = ref(false)
 	const storageNum = ref(null)
+	const type = ref(null)
 	const storageInfo = ref(null)
 	const qualifiedNumRatio = ref(0)
 	const isFinish = ref(false)
@@ -208,6 +219,11 @@
 			label: '数量',
 			align: 'center'
 		},
+		{
+			name: 'typeLabel',
+			label: '选别类型',
+			align: 'center'
+		},
 		{
 			name: 'operation',
 			type: 'operation',
@@ -231,6 +247,11 @@
 			label: '数量',
 			align: 'center'
 		},
+		{
+			name: 'typeLabel',
+			label: '选别类型',
+			align: 'center'
+		},
 	]
 
 	/***************************** 页面生命周期函数 *****************************/
@@ -270,6 +291,16 @@
 		// 	console.log(err)
 		// 	console.log('369 err')
 		// })
+		//获取选别类型
+		getDictInfoByType("select_type").then(res => {
+			console.log(res.data && res.data.length > 0)
+			selectTypeList.value = res.data.map(v => {
+				return {
+					value: v.dictValue,
+					text: v.dictLabel
+				};
+			});
+		})
 		console.log("dayworkInfo", dayworkInfo.value);
 		// 获取当前报工信息
 		getSortingDayworkItem(data).then(res => {
@@ -288,11 +319,21 @@
 					.rejectNum === 0) {
 					dayworkItem.value.qualifiedNum = res.data.prodNum
 				}
+				if (res.data.retrievalInfo != null) {
+					res.data.retrievalInfo = res.data.retrievalInfo.map(item => {
+						const typeLabelItem = selectTypeList.value.find(v => v.value == item.type);
+						return {
+							...item,
+							typeLabel: typeLabelItem.text
+						};
+					})
+				}
 				retrievalInfo.value = res.data.retrievalInfo
 				storageInfo.value = res.data.storageInfo
 				console.log(Object.keys(storageInfo.value).length === 0)
 				if (Object.keys(storageInfo.value).length !== 0) {
 					storageNum.value = storageInfo.value.storageNum
+					type.value = storageInfo.value.type
 				}
 				consultations.value = res.data.consults
 				unfitInfos.value = res.data.rejectList
@@ -588,6 +629,15 @@
 			})
 			return false;
 		}
+		if (storageNum.value != null && storageNum.value != "" && storageNum.value > 0 && storageNum.value > 0 && type
+			.value == null) {
+			uni.showToast({
+				icon: 'none',
+				title: "选别类型不能为空",
+				duration: 2000
+			})
+			return false;
+		}
 		for (let i = 0; i < unfitInfos.value.length; i++) {
 			const e = unfitInfos.value[i]
 			if (e.rejectNum == null || e.rejectNum == 0) {
@@ -659,6 +709,14 @@
 		// 如果不是最后一道工序或盘点已结束,返回 true
 		return true;
 	}
+	//状态文本
+	function selectType(item) {
+		for (var i = 0; i < selectTypeList.value.length; i++) {
+			if (item == selectTypeList.value[i].value) {
+				return selectTypeList.value[i].text
+			}
+		}
+	}
 
 
 	async function handleFinishDaywork() {
@@ -686,9 +744,11 @@
 					technologyVersion: dayworkItem.value.technologyVersion,
 					storageNum: storageNum.value,
 					storagerId: store.userInfo.userId,
+					type: type.value
 				}
 			} else {
 				storageInfo.value.storageNum = storageNum.value
+				storageInfo.value.type = type.value
 			}
 		} else {
 			storageInfo.value = null
@@ -759,9 +819,11 @@
 					technologyVersion: dayworkItem.value.technologyVersion,
 					storageNum: storageNum.value,
 					storagerId: store.userInfo.userId,
+					type: type.value
 				}
 			} else {
 				storageInfo.value.storageNum = storageNum.value
+				storageInfo.value.type = type.value
 			}
 		} else {
 			storageInfo.value = null

+ 79 - 37
pages/sorting/storageRetrieval.vue

@@ -1,20 +1,15 @@
 <template>
-	<view class="page-container uni-column" >
+	<view class="page-container uni-column">
 		<!-- 零存库部分 -->
 		<view class="title unfit-title uni-row">
 			<view class="title">零取</view>
 		</view>
 		<view class="consultation-container uni-column" style="margin-bottom: 200rpx;padding-bottom: 140rpx">
-			
+
 			<view style="width: 100%;">
-				<zb-table 
-				    :columns="column1"
-				    :stripe="true"
-					:fit="true"
-					@toggleRowSelection="selectionChange"
-					 @toggleAllSelection="toggleAllSelection"
-				    :data="listData"></zb-table>
-<!-- 				<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
+				<zb-table :columns="column1" :stripe="true" :fit="true" @toggleRowSelection="selectionChange"
+					@toggleAllSelection="toggleAllSelection" :data="listData"></zb-table>
+				<!-- 				<uni-table ref="table" :loading="loading" border stripe type="selection" emptyText="暂无更多数据"
 					@selection-change="selectionChange">
 					<uni-tr>
 						<uni-th style="font-size: 25rpx;" width="100" align="center">批次号</uni-th>
@@ -28,14 +23,14 @@
 
 					</uni-tr>
 				</uni-table> -->
-				</view>
-				</view>
-				<view class="bottom uni-row">
-					<button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
-					  :disabled="selections.length == 0"	@click="handleAdd">确认取出</button>
-				</view>
 			</view>
-			
+		</view>
+		<view class="bottom uni-row">
+			<button class="start-batch-btn" style="margin-right: 10rpx;" type="primary"
+				:disabled="selections.length == 0" @click="handleAdd">确认取出</button>
+		</view>
+	</view>
+
 </template>
 
 <script setup>
@@ -50,6 +45,9 @@
 	import {
 		getStorageRetrievalList
 	} from '@/api/business/storageRetrieval.js'
+	import {
+		getDictInfoByType
+	} from '@/api/dict/dict.js'
 	import {
 		onLoad,
 		onReady,
@@ -62,57 +60,99 @@
 
 	const selections = ref([])
 	const listData = ref([])
-	const column1 = [
-		{ type:'selection', width:50 },
-	    { name: 'lotCode', label: '批次号',align:'center'},
-	    { name: 'storagerName', label: '操作者',align:'center' },
-{ name: 'storageNum', label: '数量',align:'center' },
+	const selectTypeList = ref([])
+	const column1 = [{
+			type: 'selection',
+			width: 50
+		},
+		{
+			name: 'lotCode',
+			label: '批次号',
+			align: 'center'
+		},
+		{
+			name: 'storagerName',
+			label: '操作者',
+			align: 'center'
+		},
+		{
+			name: 'storageNum',
+			label: '数量',
+			align: 'center'
+		},
+		{
+			name: 'typeLabel',
+			label: '选别类型',
+			align: 'center'
+		},
 	]
 
 	/***************************** 页面生命周期函数 *****************************/
 
 	onLoad((options) => {
-		 const data = decodeURIComponent(options.data);
-		
-		  // 将解码后的字符串转换回对象
-		  const lotInfo = JSON.parse(data);
+		const data = decodeURIComponent(options.data);
+
+		// 将解码后的字符串转换回对象
+		const lotInfo = JSON.parse(data);
+		//获取选别类型
+		getDictInfoByType("select_type").then(res => {
+			console.log(res.data && res.data.length > 0)
+			selectTypeList.value = res.data.map(v => {
+				return {
+					value: v.dictValue,
+					text: v.dictLabel
+				};
+			});
+		})
 		console.log(lotInfo)
 		init(lotInfo)
-		})
+	})
 
 	/***************************** 定义了一些方法 *****************************/
 	const init = (data) => {
 		console.log(data)
-		getStorageRetrievalList(data).then(res =>{
-			listData.value = res.rows
-		})
+		getStorageRetrievalList(data).then(res => {
+			const processedRows = res.rows.map(item => {
+				// 查找匹配的 typeLabel
+				const typeLabelItem = selectTypeList.value.find(v => v.value == item.type);
+				return {
+					...item,
+					typeLabel: typeLabelItem.text
+				};
+			});
+			listData.value = processedRows;
+		});
 	}
-	function selectionChange(checked,arr) {
-		console.log(checked,arr)
-		 getSelectionList(arr)
+
+	function selectionChange(checked, arr) {
+		console.log(checked, arr)
+		getSelectionList(arr)
 	}
+
 	function getSelectionList(data) {
 		selections.value = data
 		console.log(selections.value)
 	}
-	function toggleAllSelection(checked,arr) {
+
+	function toggleAllSelection(checked, arr) {
 		getSelectionList(arr)
 	}
 	//选择带回
 	function handleAdd() {
 		uni.$emit('addInfoEvent', {
-			data:selections.value
+			data: selections.value
 		})
 		uni.navigateBack()
 	}
 </script>
 
 <style lang="scss">
-	.unfit-title{
+	.unfit-title {
 		height: 30rpx;
 		position: fixed;
 		top: 30rpx;
 	}
+
 	.page-container {
 		height: 90%;
 		background-color: #ffffff;
@@ -161,13 +201,15 @@
 			font-size: 28rpx;
 		}
 	}
+
 	.consultation-container {
 		margin: 0 16rpx;
 		padding: 24rpx;
 		background-color: #ffffff;
 		border-radius: 8rpx;
-	
+
 	}
+
 	.zb-table .item-tr {
 		flex-direction: row;
 	}