mao 1 年之前
父节点
当前提交
895e335fe2

+ 51 - 32
components/dialog-end-work/dialog-end-work.vue

@@ -3,16 +3,22 @@
 		<view class="list-container">
 			<view class="list-title uni-row">
 				<text class="label">合格量</text>
-				<input class="input" style="width: 70%;" v-model="workInfo.qualifiedNum" placeholder="请输入合格量" />
+				<input class="input" @input="handleInputQualifiedNum" style="width: 70%;"
+					v-model="workInfo.qualifiedNum" placeholder="请输入合格量" />
 			</view>
 			<view class="list-title uni-row">
 				<text class="label">废品信息</text>
-		        <view class="uni-row" style="justify-content: flex-end;"><text class="label" style="color: blue;" @click="handleAddWasteInfo">+添加</text></view>
+				<view class="uni-row" style="justify-content: flex-end;"><text class="label" style="color: blue;"
+						@click="handleAddWasteInfo">+添加</text></view>
 			</view>
 			<view class="list-title uni-row" v-for="(item, index) in wasteInfo">
 				<input class="input" style="width: 20%;" v-model="item.rejectNum" placeholder="废品量" />
-				<input class="input" style="margin-left: 24rpx;width: 70%;" v-model="item.reason" placeholder="请输入废品原因" />
-				<uni-icons class="icon-gear" type="close" size="60" color="red"  @click="handleDeleteWasteInfo(index)"></uni-icons>
+				<!-- <input class="input" v-model="item.reason" placeholder="请输入废品原因" /> -->
+				<uni-data-select style="margin-left: 40rpx;width: 70%;" v-model="item.reason" :localdata="reasonList"
+					@change="handleTenantChange"></uni-data-select>
+
+				<uni-icons class="icon-gear" type="close" size="60" color="red"
+					@click="handleDeleteWasteInfo(index)"></uni-icons>
 			</view>
 
 			<view class="list-title uni-row" style="margin-top: 48rpx;">
@@ -20,15 +26,6 @@
 				<switch class="switch" @change="switchChange" color="rgba(255,85,85,1)" />
 				<text>是</text>
 			</view>
-			<!-- <view class="list-title"><text class="label">请选择设备:</text></view> -->
-			<!-- <scroll-view class="scroll-container" scroll-y> -->
-			<!-- 			<checkbox-group class="equipment-container uni-row" @change="checkboxChange">
-				<checkbox v-for="(item,index) in equiments" class="checkbox" style="transform:scale(0.8)" :key="index"
-					:value="item" :checked="item.checked">
-					{{item}}
-				</checkbox>
-			</checkbox-group> -->
-
 		</view>
 		<view class="add-btn-container uni-row">
 			<button type="default" class="btn" @click="handleFinishReporting">结束报工</button>
@@ -42,23 +39,38 @@
 		ref,
 		getCurrentInstance
 	} from 'vue'
+	import {
+		onLoad
+	} from '@dcloudio/uni-app'
 	import {
 		updateDayWorkItem,
 		saveDayWorkItem
 	} from "@/api/business/dayWorkItem.js"
 	import {
-		timestampToTime
+		timestampToTime,
+		toHHmmss
 	} from '@/utils/common.js'
 	const baseDialog = ref(null)
 	const workInfo = ref({})
 	const wasteInfo = ref([])
-	const open = (data) => {
+	const reasonList = ref([])
+	const emit = defineEmits(['reset'])
+
+	onLoad(() => {
+
+	})
+
+	function open(data) {
 		workInfo.value = data;
+		workInfo.value.qualifiedNum = null;
 		console.log(data)
-		wasteInfo.value =[]
+		wasteInfo.value = []
 		baseDialog.value.open()
 	}
-	const emit = defineEmits(['reset'])
+
+	function close() {
+		baseDialog.value.close()
+	}
 
 	function switchChange(event) {
 		if (event.detail.value) {
@@ -67,20 +79,19 @@
 	}
 
 	function handleInputQualifiedNum() {
-		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-|[^\d]/g, '');
+		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-+|[^\d]/g, '');
 	}
-	
+
 	// function handleInputRejectNum() {
 	// 	workInfo.value.rejectNum = workInfo.value.rejectNum.replace(/^0+|^-|[^\d]/g, '');
 	// }
 
 	function handleFinishReporting() {
-		console.log(workInfo.value)
+		close();
 		if (workInfo.value.status != '3') {
 			workInfo.value.status = '2';
 		}
 		workInfo.value.endTime = timestampToTime(new Date());
-		console.log(workInfo.value)
 		saveDayWorkItem(workInfo.value).then(res => {
 			if (res.code === 200) {
 				uni.showToast({
@@ -88,9 +99,9 @@
 					title: '操作成功',
 					duration: 2000
 				});
-				emit('reset');
 				uni.$emit('dayworkItemUpdate');
 				baseDialog.value.close();
+				workInfo.value.qualifiedNum = null;
 			} else {
 				uni.showToast({
 					icon: 'error',
@@ -100,13 +111,21 @@
 			}
 		})
 	}
-	 function handleAddWasteInfo() {
-		 wasteInfo.value.push({ rejectNum: '', reason: '' })
-	 }
 
-	 function handleDeleteWasteInfo(index) {
-		 wasteInfo.value.splice(index,1)
-	 }
+	function handleAddWasteInfo() {
+		wasteInfo.value.push({
+			rejectNum: '',
+			reason: ''
+		})
+	}
+
+	function handleDeleteWasteInfo(index) {
+		wasteInfo.value.splice(index, 1)
+	}
+
+	function handleTenantChange() {
+
+	}
 
 	defineExpose({
 		open
@@ -134,13 +153,13 @@
 
 				.input {
 					width: 40%;
-
-					height: 60rpx;
+					height: 66rpx;
 					padding-left: 10rpx;
-
 					font-size: 22rpx;
-					border: 1px solid #808080;
+					border: 1rpx solid #e1e1e1;
+					border-radius: 8rpx;
 				}
+
 				.icon-gear {
 					font-size: 56rpx;
 				}

+ 3 - 2
components/dialog-login/dialog-login.vue

@@ -13,7 +13,7 @@
 			<input class="input-control" v-model="currentUser.userName" placeholder="员工编码" />
 		</template>
 		<input class="input-control" :password="true" v-model="currentUser.password" placeholder='密码' />
-		<view class="login-btn uni-row" @click="handleLogin"><text class="label">登录</text></view>
+		<view class="login-btn uni-row" @click="debounce(handleLogin,300)"><text class="label">登录</text></view>
 	</dialog-base>
 </template>
 
@@ -35,6 +35,7 @@
 	import {
 		store
 	} from '@/store/index.js'
+	import { debounce } from '@/utils/common.js'
 	// 对话框
 	const baseDialog = ref(null)
 	const currentUser = ref({})
@@ -103,7 +104,7 @@
 					uni.showToast({
 						title: successMsg.value,
 						icon: 'success',
-						duration: 2000
+						duration: 1000
 					});
 					// 保存token
 					uni.setStorageSync('token', res.data.token);

+ 1 - 1
components/dialog-selectEquipment/dialog-selectEquipment.vue

@@ -86,6 +86,7 @@
 
 	function handleStart() {
 		console.log(selection.value)
+		close();
 		if (firstItem.value) {
 			for (var i = 0; i < selection.value.length; i++) {
 				sendReqParam.value.push(firstItem.value);
@@ -104,7 +105,6 @@
 			emit('handleAddDayWorkItem', selection.value);
 			selection.value = [];
 		}
-		close();
 	}
 </script>
 

+ 2 - 1
components/dialog-turnoverTask/dialog-turnoverTask.vue

@@ -68,6 +68,7 @@
 	})
 
 	function handleConfirmDelivery() {
+		close();
 		// 设置周转状态
 		for (let i = 0; i < confirmTurnoverList.value.length; i++) {
 			confirmTurnoverList.value[i].status = confirmTurnoverList.value[i].status ='5';
@@ -90,7 +91,7 @@
 				});
 			}
 		})
-		close();
+		uni.$emit('clearListData')
 	}
 </script>
 

+ 4 - 4
pages/addNewBatch/index.vue

@@ -172,9 +172,9 @@
 						return;
 					}
 				}
-				getCarrierById(vehicleObj.carrierId).then(response => {
+				// getCarrierById(vehicleObj.carrierId).then(response => {
 						
-				})
+				// })
 				vehicleList.value.push(vehicleObj);
 			}
 		});
@@ -202,7 +202,7 @@
 				} else {
 					uni.showToast({
 						icon: 'error',
-						title: '添加失败',
+						title: res.msg,
 						duration: 2000
 					});
 				}
@@ -220,7 +220,7 @@
 
 <style lang="scss">
 	.container {
-		height: 100%;
+		height: calc(100% - 10%);
 		background-color: #f5f5f5;
 	}
 

+ 12 - 8
pages/batchReporting/index.vue

@@ -87,7 +87,8 @@
 	} from 'vue'
 	import {
 		onLoad,
-		onReady
+		onReady,
+		onUnload
 	} from '@dcloudio/uni-app'
 	import {
 		getDayWorkList,
@@ -136,11 +137,16 @@
 		uni.$once('batchReporting-addBatch', () => {
 			init(curSubPlan.value.id);
 		})
-		uni.$on('dayworkItemUpdate', () => {
-			init(curSubPlan.value.id);
-		})
+		uni.$on('dayworkItemUpdate', reflush)
 	})
-
+	
+	onUnload(() => {
+		uni.$off('dayworkItemUpdate', reflush)
+	})
+	
+	function reflush(){
+		init(curSubPlan.value.id);
+	}
 
 	function handleShowTurnoverApplication(data) {
 		let _data = data ?? {}
@@ -158,9 +164,6 @@
 		uni.showLoading({
 			title: '加载中'
 		});
-		setTimeout(function(){
-			uni.hideLoading();
-		},2000)
 		let reqData = {};
 		reqData.productionPlanDetailSubDetailId = id;
 		console.log(reqData)
@@ -178,6 +181,7 @@
 				}
 			}
 			console.log(listData.value)
+			uni.hideLoading();
 		})
 	}
 

+ 1 - 2
pages/dashboard/index.vue

@@ -205,10 +205,9 @@
 		background-color: #fff;
 		height: 200rpx;
 		width: 94%;
-		border-radius: 4;
 		align-items: center;
 		justify-content: center;
-		border: 1px solid #e1e1e1;
+		border: 1rpx solid #e1e1e1;
 		border-radius: 8rpx;
 
 		.label {

+ 1 - 1
pages/handlingList/index.vue

@@ -3,7 +3,7 @@
 		<view class='nav uni-row'>
 			<text :class='pendingClass' @click='selectPending'>{{pendingTitle}}</text>
 			<text :class='turnoverClass' @click='selectTurnover'>{{turnoverTitle}}</text>
-			<image class='img' src="../../static/screen.png"></image>
+			<!-- <image class='img' src="../../static/screen.png"></image> -->
 		</view>
 		<!-- 待周转页面 -->
 		<view class="padding-container" v-if='pendingShow'>

+ 19 - 19
pages/productionPlan/index.vue

@@ -18,10 +18,6 @@
 				<view v-if="item['dayWorkList'].length > 0" class="tag"><text class="label">进行中</text></view>
 				<view v-else type="default" class="tag not-start"><text class="label">未开始</text></view>
 			</view>
-			<!-- 			<view class="item-info uni-row">
-				<text class="label">当前工序</text>
-				<text class="label right">{{ item['process'] }}</text>
-			</view> -->
 			<view class="item-info uni-row">
 				<text class="label">产品描述</text>
 				<text class="label right">{{ item['productDescription'] }}</text>
@@ -35,17 +31,13 @@
 				<text class="label right">{{ item['equiment'] }}</text>
 			</view>
 			<view class="item-info uni-row">
-				<text class="label">投产数/合格数</text>
-				<text class="label right">{{ item['productionQuantity'] }}/{{ item['invest'] }}</text>
+				<text class="label">投产数</text>
+				<text class="label right">{{ item['productionQuantity'] }}</text>
 			</view>
 			<view class="item-info uni-row">
 				<text class="label">设备</text>
 				<text class="label right">{{ item['equipmentName'] }}</text>
 			</view>
-			<!-- 			<view class="item-info uni-row">
-				<text class="label">操作人</text>
-				<text class="label right">{{ item['operator'] }}</text>
-			</view> -->
 		</view>
 	</view>
 </template>
@@ -60,6 +52,7 @@
 	import {
 		onReady,
 		onLoad,
+		onUnload,
 		onPullDownRefresh
 	} from '@dcloudio/uni-app'
 	import {
@@ -79,16 +72,18 @@
 			initReqParam.value = {
 				tenantId: store.userInfo.tenantId
 			}
-		}else {
+		} else {
 			initReqParam.value = {
 				tenantId: store.tenantId
 			}
 		}
 		init(initReqParam.value);
 		// dayworkItem数据更改后刷新数据
-		uni.$on('dayworkItemUpdate', () => {
-			init(initReqParam.value);
-		})
+		uni.$on('dayworkItemUpdate', reflush);
+	})
+
+	onUnload(() => {
+		uni.$off('dayworkItemUpdate', reflush)
 	})
 
 	/**
@@ -101,35 +96,40 @@
 		}, 3000);
 	})
 
+	function reflush() {
+		init(initReqParam.value);
+	}
+
 	function init(data = {}) {
 		uni.showLoading({
 			title: '加载中'
 		});
-		setTimeout(function(){
-			uni.hideLoading();
-		},2000)
 		getListByUserEquipment(data).then((res) => {
 			console.log(data)
 			if (res.code === 200) {
 				listData.value = res.rows;
+				uni.hideLoading();
 			} else if (res.code === 401) {
 				uni.showToast({
 					icon: 'none',
 					title: '未登录或登录状态已超时',
 					duration: 1500
 				})
+				uni.hideLoading();
 			} else if (res.code === 500) {
 				uni.showToast({
 					icon: 'none',
 					title: '系统错误,请联系管理员',
 					duration: 1500
 				})
+				uni.hideLoading();
 			} else {
 				uni.showToast({
 					icon: 'none',
 					title: res.msg,
 					duration: 1500
 				})
+				uni.hideLoading();
 			}
 		})
 	}
@@ -140,7 +140,7 @@
 			url: '/pages/batchReporting/index'
 		})
 	}
- 
+
 	function handleSearch() {
 		let reqParam = {
 			keywords: keywords.value
@@ -149,7 +149,7 @@
 			reqParam = {
 				tenantId: store.userInfo.tenantId
 			}
-		}else {
+		} else {
 			reqParam = {
 				tenantId: store.tenantId
 			}

+ 20 - 10
pages/reportingForWork/index.vue

@@ -52,7 +52,7 @@
 				</view>
 				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false"
 					class="status-btn uni-row ">
-					<button class="finished-turnover-tag" size="mini" type="primary"
+					<button class="start-turnover-tag" size="mini" type="primary"
 						@click.stop="handleStartProcessing(item)">开始报工</button>
 				</view>
 			</view>
@@ -62,7 +62,7 @@
 			<button class="bottom-btn right-btn" type="primary" @click="handleStartProcessing(null)"
 				:disabled="flag"><text class="label">开始加工</text></button>
 		</view>
-		<dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment' @reset="reset" />
+		<dialog-end-work ref="endWorkDialog" @sendEquipment='getEquipment'/>
 		<dialog-selectEquipment ref='selectEquipment'
 			@handleAddDayWorkItem='handleAddDayWorkItem'></dialog-selectEquipment>
 	</view>
@@ -74,7 +74,8 @@
 	} from 'vue'
 	import {
 		onLoad,
-		onReady
+		onReady,
+		onUnload
 	} from '@dcloudio/uni-app'
 	import {
 		getDayWorkItemList,
@@ -106,6 +107,11 @@
 		dayWorkInfo.value = store.dayworkInfo;
 		console.log(dayWorkInfo.value)
 		init();
+		uni.$on('dayworkItemUpdate', reflush)
+	})
+	
+	onUnload(() => {
+		uni.$off('dayworkItemUpdate', reflush)
 	})
 
 	function init() {
@@ -123,8 +129,6 @@
 			for (var i = 0; i < listData.value.length; i++) {
 				let timeStamp = Date.parse(listData.value[i].endTime) - Date.parse(listData.value[i].startTime);
 				console.log(timeStamp)
-				// listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000)
-				// 	.toFixed(2);
 				listData.value[i].taskTime = toHHmmss(timeStamp);
 			}
 			// 判断是否是新批次默认生成的第一条,下面的开始加工按钮不能点(有一个为0就不能点)
@@ -136,11 +140,11 @@
 			flag.value = arr.includes('0');
 			// flag.value = listData.value.some(value => {value.status == '0'|| value.status == '3'})
 			console.log(flag.value)
+			uni.hideLoading();
 		})
-		uni.hideLoading();
 	}
-
-	function reset() {
+	
+	function reflush(){
 		init();
 	}
 
@@ -265,7 +269,7 @@
 		border-radius: 8rpx;
 
 		.title-container {
-			margin-top: 8rpx;
+			margin: 8rpx 0;
 			width: 100%;
 
 			.title {
@@ -354,7 +358,13 @@
 		.finished-turnover-tag {
 			margin: unset;
 			border-radius: 8rpx;
-			// background-color: rgb(255, 85, 85);
+			background-color: rgb(255, 85, 85);
+			font-size: 28rpx;
+			color: #FFFFFF;
+		}
+		.start-turnover-tag {
+			margin: unset;
+			border-radius: 8rpx;
 			font-size: 28rpx;
 			color: #FFFFFF;
 		}

+ 3 - 0
pages/startTurnover/index.vue

@@ -66,6 +66,9 @@
 		uni.$on('dayworkItemUpdate', () => {
 			init(curSubPlan.value.id);
 		})
+		uni.$once('clearListData',() => {
+			listData.value = [];
+		})
 	})
 
 	function init() {

+ 3 - 1
utils/common.js

@@ -71,7 +71,7 @@ export function timestampToTime(timestamp) {
 
 
 
-var duration = 3000;
+// var duration = 3000;
 var timer = null;
 /**
  * 函数防抖
@@ -92,6 +92,8 @@ export function debounce(fn, duration) {
  * @param {Object} data 时间戳
  * @param {Object} flag 是否返回 HH:mm:ss 格式
  */
+// listData.value[i].taskTime = (timeStamp / 3600000).toFixed(2) === 'NaN' ? 0 : (timeStamp / 3600000)
+// 	.toFixed(2);
 export function toHHmmss(data, flag = true) {
 	var time;
 	var hours = parseInt((data % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));