guoyujia 3 months ago
parent
commit
ee55af675f
4 changed files with 147 additions and 43 deletions
  1. 2 2
      manifest.json
  2. 3 3
      pages/sortProductionPlan/index.vue
  3. 62 0
      pages/sorting/form.vue
  4. 80 38
      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": {

+ 3 - 3
pages/sortProductionPlan/index.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="uni-column" style="position: absolute;left: 12px;right: 12px;height: 100%;">
+	<view class="uni-column" style="position: absolute;left: 0px;right: 0px;height: 100%;">
 		<view class="box-bg uni-row" style="height: 6%;">
 			<view class="input-view uni-row">
 				<uni-icons class="input-uni-icon" type="search" size="18" color="#999" />
@@ -15,7 +15,7 @@
 		right: 0;">
 			<text>暂无批次</text>
 		</view>
-		<view v-else style="height: 76%; overflow: auto;">
+		<view v-else style="height: 82%; overflow: auto;padding-left: 12px;padding-right: 12px;">
 			<view v-for="(item, index) in listData" :key="index" @click="handleToBatchReporting(item)"
 				class="list-item">
 				<view class="title-container uni-row">
@@ -310,7 +310,7 @@
 	.box-bg {
 		width: 100%;
 		background-color: #F5F5F5;
-		padding: 5rpx 0;
+		padding: 10rpx 0;
 		justify-content: space-around;
 		align-items: center;
 

+ 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>
 
 		<!-- 报工部分 -->
@@ -192,6 +201,8 @@
 	const retrievalInfo = ref([])
 	// 创建一个引用来存储最后一次请求的时间戳
 	const lastRequestTimestamp = ref(0);
+	const selectTypeList = ref([])
+	const type = ref(null)
 	const dayworkItem = ref({})
 	const saveFlag = ref(false)
 	const storageNum = ref('')
@@ -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
 				}
 				console.log(storageNum.value)
 				consultations.value = res.data.consults
@@ -589,6 +630,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) {
@@ -638,6 +688,14 @@
 		// 	if (e.name)
 		// })
 	}
+	//状态文本
+	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 handleCheckStock() {
 		let currentProcessStepNumber = dayworkInfo.value.currentProcess.processStepNumber;
 		let lastProcess = dayworkInfo.value.processSequence[dayworkInfo.value.processSequence.length - 1];
@@ -687,9 +745,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
@@ -760,9 +820,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

+ 80 - 38
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 >
-				<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="暂无更多数据"
+
+			<view>
+				<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>
@@ -59,60 +54,105 @@
 	import {
 		store
 	} from '@/store/index.js'
+	import {
+		getDictInfoByType
+	} from '@/api/dict/dict.js'
 
 	const selections = ref([])
+	const selectTypeList = 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 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;
 	}