ysy 1 год назад
Родитель
Сommit
02d077e63e

+ 79 - 6
pages/pda/components/bottomOperate.vue

@@ -72,6 +72,14 @@
 								dataValue='id' dataKey="name" filterable format='{name}'></zxz-uni-data-select>
 						</u-form-item>
 
+						<u-form-item label="委外到:" borderBottom prop="">
+							<zxz-uni-data-select :localdata="newStepsList" v-model="endTaskId" @change="changeOut"
+								dataValue='taskId' format='{taskTypeName}' dataKey="taskId" filterable
+								:clear='true'></zxz-uni-data-select>
+						</u-form-item>
+
+
+
 
 						<u-form-item label="完成时间:" borderBottom prop="requireDeliveryTime">
 							<picker mode="date" :value="outsourceForm.requireDeliveryTime" @change="onDateChange">
@@ -141,6 +149,11 @@
 
 			controlReportMethod: String | Number,
 
+			stepsList: {
+				type: Array,
+				default: () => []
+			},
+
 		},
 
 		watch: {
@@ -176,7 +189,7 @@
 				immediate: true,
 				deep: true,
 				handler(newVal) {
-				
+
 					this.btnControlReportMethod = newVal
 				}
 			},
@@ -185,7 +198,18 @@
 				immediate: true,
 				deep: true,
 				handler(newVal) {
+					console.log(newVal)
 					this.newTaskObj = newVal
+				}
+			},
+
+
+			stepsList: {
+				immediate: true,
+				deep: true,
+				handler(newVal) {
+
+
 				}
 			}
 		},
@@ -302,7 +326,10 @@
 						name: '半成品'
 					},
 				],
-				
+
+				newStepsList: [],
+				endTaskId: null,
+
 				clientEnvironmentId: uni.getStorageSync("userInfo") && uni.getStorageSync("userInfo")
 					.clientEnvironmentId, // *1 主环境-601环境   2 soll-索尔环境    3 tg-碳谷环境
 
@@ -363,7 +390,7 @@
 
 					this.outsourceForm = {
 						...res,
-					
+
 					}
 					this.outsourceForm.name = this.taskObj.currentTaskName + '委外'
 
@@ -371,6 +398,7 @@
 
 
 					if (res.outsource) {
+						this.getNewSteps()
 						this.outsourceShow = true
 						this.produceFn()
 						this.getWarehouseFn()
@@ -414,9 +442,9 @@
 				}
 
 			},
-			
+
 			handTerminate() {
-				
+
 				uni.showModal({
 					title: '提示',
 					content: '确定该工单终止?',
@@ -433,6 +461,51 @@
 				this.outsourceShow = false
 			},
 
+			getNewSteps() {
+				this.activeIndex = this.getIndexOfElementInArray(this.stepsList, this.newTaskObj.currentTaskId)
+
+				this.newStepsList = []
+				this.stepsList.forEach((f, i) => {
+					if (f.taskId != '-1' && f.taskId != '-2' && f.taskTypeName != '包装' && i > this.activeIndex && f
+						.type == 1) {
+						this.newStepsList.push(f)
+					}
+				})
+
+
+
+			},
+
+			getIndexOfElementInArray(array, target) {
+				for (let i = 0; i < array.length; i++) {
+					if (array[i].taskId === target) {
+						return i; // 返回第一次出现target的索引位置
+					}
+				}
+				return -1; // 未找到目标值时返回-1
+			},
+
+			changeOut() {
+				if (this.endTaskId) {
+					const index = this.newStepsList.findIndex(item => item.taskId === this.endTaskId) + 1;
+					if (index !== -1) {
+					    // 使用slice截取目标元素之前的部分,并通过map提取id
+					    const previousIds = this.newStepsList.slice(0, index).map(item => item.taskId);
+						this.outsourceForm.taskIds = previousIds.join(',')
+					
+					
+					} else {
+					  this.outsourceForm.taskIds = ''
+					}
+					
+				} else {
+					this.outsourceForm.taskIds = ''
+				}
+				console.log(this.endTaskId)
+			},
+
+
+
 			onDateChange(e) {
 				this.$set(this.outsourceForm, 'requireDeliveryTime', e.detail.value)
 				this.$forceUpdate()
@@ -495,7 +568,7 @@
 					})
 					return false
 				}
-
+				// this.outsourceForm.requireDeliveryTime = '2055-01-18'
 				if (!this.outsourceForm.requireDeliveryTime) {
 					uni.showToast({
 						title: '请选择委外完成时间',

+ 1 - 1
pages/pda/workOrder/extrusionMolding/index.vue

@@ -161,7 +161,7 @@
 
 			<bottomOperate @operate='operate' @refresh='refresh'
 				:taskObj="{'currentTaskName': currentTaskName || info.taskName, 'currentTaskId': currentTaskId || info.taskId, 'workOrderId' : id }"
-				:state='currentType' :gdStatus='info.status' :controlReportMethod='controlReportMethod'></bottomOperate>
+				:state='currentType' :gdStatus='info.status' :controlReportMethod='controlReportMethod' :stepsList="stepsList"></bottomOperate>
 		</view>
 
 	</view>