mao před 1 rokem
rodič
revize
575bda7aa7

+ 59 - 56
components/dialog-base/dialog-base.vue

@@ -15,85 +15,88 @@
 </template>
 
 <script setup>
-	import { ref } from 'vue'
-	
+	import {
+		ref
+	} from 'vue'
+
 	const visible = ref(false)
-	
+
 	const props = defineProps({
-	  title: {
-		  type: String,
-		  default: '对话框'
-	  }
+		title: {
+			type: String,
+			default: '对话框'
+		}
 	})
-	
+
 	const open = () => {
 		visible.value = true
 	}
-	
+
 	const close = () => {
 		visible.value = false
 	}
-	
+
 	/** 暴露给父组件的方法 */
 	defineExpose({
-	  open, 
-	  close
+		open,
+		close
 	})
 </script>
 
 <style lang="scss">
-.dialog-container {
-	position: fixed;
-	top: 0;
-	right: 0;
-	bottom: 0;
-	left: 0;
-	z-index: 1000;
-
-	.bg {
-		position: absolute;
+	.dialog-container {
+		position: fixed;
 		top: 0;
 		right: 0;
 		bottom: 0;
 		left: 0;
-		background-color: #333333;
-		opacity: 0.3;
-		z-index: 1001;
-	}
-	.dialog-body {
-		border-radius: 18rpx;
-		// position: absolute;
-		// top: 400rpx;
-		// right: 64rpx;
-		// left: 64rpx;
-		width: 70%;
-		margin: auto auto;
-		padding: 0 48rpx 48rpx 48rpx;
-		background-color: #FFFFFF;
-		z-index: 1002;
-	
-		.close-btn {
+		z-index: 1000;
+
+		.bg {
 			position: absolute;
-			right: 24rpx;
-			top: 24rpx;
-			width: 40rpx;
-			height: 40rpx;
-			z-index: 1003;
-	
-			.close-btn-icon {
+			top: 0;
+			right: 0;
+			bottom: 0;
+			left: 0;
+			background-color: #333333;
+			opacity: 0.3;
+			z-index: 1001;
+		}
+
+		.dialog-body {
+			border-radius: 18rpx;
+			// position: absolute;
+			// top: 400rpx;
+			// right: 64rpx;
+			// left: 64rpx;
+			width: 70%;
+			margin: auto auto;
+			padding: 0 48rpx 48rpx 48rpx;
+			background-color: #FFFFFF;
+			z-index: 1002;
+
+			.close-btn {
+				position: absolute;
+				right: 24rpx;
+				top: 24rpx;
 				width: 40rpx;
+				height: 40rpx;
+				z-index: 1003;
+
+				.close-btn-icon {
+					width: 40rpx;
+				}
 			}
-		}
-	
-		.dialog-title {
-			align-items: center;
-			margin-top: 40rpx;
-	
-			.label {
-				font-weight: bold;
-				font-size: 40rpx;
+
+			.dialog-title {
+				align-items: center;
+				margin-top: 40rpx;
+
+				.label {
+					font-weight: bold;
+					font-size: 40rpx;
+				}
 			}
 		}
 	}
-}
 </style>

+ 38 - 7
components/dialog-end-work/dialog-end-work.vue

@@ -12,7 +12,7 @@
 						@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" @input="handleInputRejectNum" style="width: 20%;" v-model="item.rejectNum" placeholder="废品量" />
 				<!-- <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>
@@ -50,6 +50,9 @@
 		timestampToTime,
 		toHHmmss
 	} from '@/utils/common.js'
+	import {
+		getDictInfoByType
+	} from '@/api/dict/dict.js'
 	const baseDialog = ref(null)
 	const workInfo = ref({})
 	const wasteInfo = ref([])
@@ -57,9 +60,22 @@
 	const emit = defineEmits(['reset'])
 
 	onLoad(() => {
-
+		init();
 	})
 
+	function init() {
+		getDictInfoByType("waste_causes").then(res => {
+			for (let i = 0; i < res.data.length; i++) {
+				reasonList.value[i] = {
+					value: res.data[i].dictValue,
+					text: res.data[i].dictLabel
+				}
+			}
+			console.log(res);
+			console.log(reasonList.value);
+		})
+	}
+
 	function open(data) {
 		workInfo.value = data;
 		workInfo.value.qualifiedNum = null;
@@ -82,22 +98,37 @@
 		workInfo.value.qualifiedNum = workInfo.value.qualifiedNum.replace(/^0+|^-+|[^\d]/g, '');
 	}
 
-	// function handleInputRejectNum() {
-	// 	workInfo.value.rejectNum = workInfo.value.rejectNum.replace(/^0+|^-|[^\d]/g, '');
-	// }
+	function handleInputRejectNum() {
+		for (let i = 0; i < wasteInfo.value.length; i++) {
+			wasteInfo.value[i].rejectNum = wasteInfo.value[i].rejectNum.replace(/^0+|^-|[^\d]/g, '');
+		}
+	}
 
 	function handleFinishReporting() {
+		for (let i = 0; i < wasteInfo.value.length; i++) {
+			if ((!wasteInfo.value[i].rejectNum && wasteInfo.value[i].reason) ||
+			 (wasteInfo.value[i].rejectNum && !wasteInfo.value[i].reason)) {
+				uni.showToast({
+					icon: "error",
+					title: "请输入废弃数或废弃原因",
+					duration: 2000
+				})
+				return;
+			}
+		}
 		close();
 		if (workInfo.value.status != '3') {
 			workInfo.value.status = '2';
 		}
 		workInfo.value.endTime = timestampToTime(new Date());
+		workInfo.value.wasteInfo = wasteInfo.value;
+		console.log(workInfo.value)
 		saveDayWorkItem(workInfo.value).then(res => {
 			if (res.code === 200) {
 				uni.showToast({
 					icon: 'success',
 					title: '操作成功',
-					duration: 2000
+					duration: 1000
 				});
 				uni.$emit('dayworkItemUpdate');
 				baseDialog.value.close();
@@ -106,7 +137,7 @@
 				uni.showToast({
 					icon: 'error',
 					title: '操作失败',
-					duration: 2000
+					duration: 1000
 				});
 			}
 		})

+ 21 - 24
components/dialog-lot/dialog-lot.vue

@@ -1,7 +1,7 @@
 <template>
-	<dialog-base ref="baseDialog" title="添加新批次">
-		
-		<view :class="{'list-container':true, 'selected':isSelected(item)}" @click="handleSelection(item,index)" v-for="(item, index) in form" :key="item.id">
+	<dialog-base class="dialog-body" ref="baseDialog" title="添加新批次">
+		<view :class="{'list-container':true, 'selected':isSelected(item)}" @click="handleSelection(item,index)"
+			v-for="(item, index) in form" :key="item.id">
 			<view class="list-title"><text class="label">批次号:{{item.lotCode}}</text></view>
 			<view class="list-container-item uni-row">
 				<text class="label">产品描述</text>
@@ -20,11 +20,6 @@
 				<text class="label value">{{item['qualifiedQuantity']}}</text>
 			</view>
 		</view>
-<!-- 		<view class="list-title"><text class="label">请选择设备:</text></view>
-		<view class="equipment-container uni-row ">
-			<view v-for="(item, index) in equiments" :class="{'item':true,'selected': selectedButton === item}" :key="index" @click="selectButton(item)"><text class="label" >{{item}}</text></view>
-		</view> -->
-		<!-- </scroll-view> -->
 		<view class="add-btn-container uni-row">
 			<button type="primary" class="btn" @click="handleConfirm">确认</button>
 		</view>
@@ -36,7 +31,7 @@
 		ref,
 		getCurrentInstance
 	} from 'vue'
-	
+
 	const baseDialog = ref(null)
 	const selectedButton = ref(null)
 	const form = ref({})
@@ -48,33 +43,32 @@
 		form.value = data
 		baseDialog.value.open()
 	}
-	
+
 	const close = () => {
 		baseDialog.value.close()
 	}
-	
+
 	defineExpose({
 		open
 	})
-	
-	function handleScanCode(){
+
+	function handleScanCode() {
 		uni.scanCode({
 			onlyFromCamera: true,
-			success: function (res) {
-			}
+			success: function(res) {}
 		});
 	}
-	
-	function handleConfirm(){
-		emit('submit',selection.value);
-		uni.$emit('dayworkItemUpdate');
+
+	function handleConfirm() {
 		close();
+		emit('submit', selection.value);
+		uni.$emit('dayworkItemUpdate');
 	}
-	
+
 	function isSelected(item) {
 		return selection.value.includes(item);
 	}
-	
+
 	function handleSelection(item, index) {
 		const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
 		if (buttonIndex > -1) {
@@ -90,8 +84,9 @@
 	.selected {
 		border: 2px solid #1684fc;
 	}
-	
+
 	.dialog-body {
+		overflow: auto;
 		.list-title {
 			margin: 40rpx 0 20rpx 0;
 
@@ -109,14 +104,14 @@
 			margin: 10rpx 0;
 			border-radius: 6rpx;
 			overflow: auto;
-			
+
 			.list-container-item {
 				width: 100%;
 				border: 1px solid #999999;
 				border-bottom: none;
 				padding: 12rpx 8rpx;
 				box-sizing: border-box;
-				
+
 
 				.label {
 					font-size: 28rpx;
@@ -130,8 +125,10 @@
 			}
 
 		}
+
 		.add-btn-container {
 			margin-top: 32rpx;
+
 			.btn {
 				flex: 1;
 			}

+ 1 - 1
pages/reportingForWork/index.vue

@@ -127,7 +127,7 @@
 			console.log(listData)
 			// 时间戳转工时
 			for (var i = 0; i < listData.value.length; i++) {
-				let timeStamp = Date.parse(listData.value[i].endTime) - Date.parse(listData.value[i].startTime);
+				let timeStamp = listData.value[i].workingHours;
 				console.log(timeStamp)
 				listData.value[i].taskTime = toHHmmss(timeStamp);
 			}