mao 1 year ago
parent
commit
4bf87e0bdb

+ 22 - 13
components/dialog-lot/dialog-lot.vue

@@ -1,7 +1,7 @@
 <template>
 	<dialog-base class="dialog-body" ref="baseDialog" title="添加新批次">
 		<view class="prompt">
-			<text>请选择批次再确认</text>
+			<text>请选择工序、批次再确认</text>
 		</view>
 		<uni-section title="请选择当前工序" type="square">
 			<uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
@@ -28,7 +28,7 @@
 			</view>
 		</view>
 		<view class="add-btn-container uni-row">
-			<button type="primary" class="btn" @click="handleConfirm" :disabled="flag">确认</button>
+			<button type="primary" class="btn" @click="handleConfirm">确认</button>
 		</view>
 	</dialog-base>
 </template>
@@ -41,16 +41,17 @@
 	import {
 		getProcessList
 	} from '@/api/business/deptProcess.js'
+	import { store } from '@/store/index.js'
 
 	const baseDialog = ref(null)
 	const selectedButton = ref(null)
 	const form = ref({})
 	const emit = defineEmits(['submit'])
 	const selection = ref([])
-	const flag = ref(true)
 	const selectedProcess = ref(null)
 	const processList = ref([])
 
+	
 	const open = (data) => {
 		// console.log(dialog.value)
 		form.value = data;
@@ -67,7 +68,6 @@
 	})
 
 	function getProcesses() {
-		console.log("11111111111111111111111")
 		getProcessList({
 			deptId: store.curDeptDetails.deptId,
 		}).then(res => {
@@ -82,21 +82,31 @@
 						value: filteredData[i].processId
 					}
 				}
-				selectedProcess.value = filteredData[0].processId;
-				console.log(processList.value)
+				// selectedProcess.value = filteredData[0].processId;
 			}
 		})
 	}
 
 	function handleProcessChange(){
-		
+	
 	}
 
 	function handleConfirm() {
-		console.log(selection.value)
-		// close();
-		// emit('submit', selection.value);
-		// uni.$emit('dayworkItemUpdate');
+		// 添加选择的工序
+		for (let i = 0; i < selection.value.length; i++) {
+			selection.value[i].daywork.processId = selectedProcess.value;
+		}
+		// 执行确认
+		if(selectedProcess.value && selection.value.length > 0){
+			close();
+			emit('submit', selection.value);
+			uni.$emit('dayworkItemUpdate');
+		}else {
+			uni.showToast({
+				icon: 'none',
+				title: '请选择工序、批次后再确认'
+			})
+		}
 	}
 
 	function isSelected(item) {
@@ -111,7 +121,6 @@
 			selection.value.push(item); // 选中
 		}
 		console.log(selection.value, "selection");
-		flag.value = selection.value.length > 0 ? false : true;
 	}
 </script>
 
@@ -133,7 +142,7 @@
 		}
 
 		.prompt {
-			color: #999;
+			color: red;
 			margin: 8rpx auto 0;
 		}
 

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

@@ -4,7 +4,7 @@
 			<view v-for="(item, index) in equipments" :class="{'item':true,'selected': isSelected(item)}" :key="index"
 				@click="handleSelection(item)"><text class="label">{{item['equipmentDetailCode']}}</text></view>
 		</view> -->
-		<view>
+		<view v-if="showProcessList">
 			<uni-section title="工序" type="line">
 				<uni-data-select v-model="selectedProcess" :localdata="processList" :clear="false"
 					@change="handleProcessChange"></uni-data-select>
@@ -96,6 +96,7 @@
 	const userName = ref(null)
 	const userList = ref([])
 	const selectedUserList = ref([])
+	const showProcessList = ref(true)
 
 
 	onLoad(() => {
@@ -109,6 +110,7 @@
 		selectedUserList.value = []; 
 		selectedProcess.value = null;
 		processList.value = [];
+		showProcessList.value = true;	
 	}
 
 	function init() {
@@ -131,6 +133,7 @@
 				}
 				console.log(processList.value)
 				selectedProcess.value = filteredData[0].processId;
+				isDefaultitem(firstItem.value);
 			} 
 		})
 		
@@ -165,6 +168,13 @@
 		userList.value = [];
 		init();
 	}
+	
+	function isDefaultitem(item){
+		if(item){
+			showProcessList.value = false;	
+			selectedProcess.value = null;
+		}
+	}
 
 	function close() {
 		baseDialog.value.close()
@@ -227,15 +237,15 @@
 	}
 
 	function handleDoStart() {
-		if (!selectedProcess.value || !selectedEquipment.value) {
-			uni.showToast({
-				icon: "none",
-				title: "未选择工序或设备"
-			})
-			selectedProcess.value = null;
-			selectedEquipment.value = null;
-			return;
-		}
+		// if (!selectedProcess.value || !selectedEquipment.value) {
+		// 	uni.showToast({
+		// 		icon: "none",
+		// 		title: "未选择工序或设备"
+		// 	})
+		// 	selectedProcess.value = null;
+		// 	selectedEquipment.value = null;
+		// 	return;
+		// }
 		close();
 		if (firstItem.value) {
 			sendReqParam.value = {
@@ -247,6 +257,7 @@
 				status: 1,
 				collaborationList: selectedUserList.value
 			};
+			console.log(sendReqParam.value)
 			emit('handleAddDayWorkItem', sendReqParam.value);
 		} else {
 			emit('handleAddDayWorkItem', {

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "德迈仕数字生产管理平台",
     "appid" : "__UNI__B065984",
     "description" : "",
-    "versionName" : "1.0.9",
-    "versionCode" : 108,
+    "versionName" : "1.0.10",
+    "versionCode" : 109,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 1 - 0
pages/batchReporting/index.vue

@@ -257,6 +257,7 @@
 		for (var i = 0; i < data.length; i++) {
 			reqParam.push(data[i].daywork)
 		}
+		console.log(data)
 		showDayworkSave(reqParam).then(res => {
 			console.log(res)
 			init(store.planDetails.id);