mao 1 жил өмнө
parent
commit
83c51fb00c

+ 14 - 0
api/dept/dept.js

@@ -0,0 +1,14 @@
+import req from '@/utils/request.js'
+
+/**
+ * 获取生产子计划列表
+ * @param {Object} data
+ */
+export function getDeptList(data) {
+	return req.request({
+		url:'/system/dept/list',
+		method: 'GET',
+		data: data
+	})
+}
+

+ 76 - 45
components/dialog-turnoverApplication/dialog-turnoverApplication.vue

@@ -3,23 +3,25 @@
 		<view class="list-container">
 			<view class="list-title"><text class="label">请选择周转类型</text></view>
 			<view class="btn uni-row">
-				<view v-for="(item,index) in turnoverType" :class="{ 'middle-btn': true, 'active': item == turnoverTypeChecked }"
+				<view v-for="(item,index) in turnoverType"
+					:class="{ 'middle-btn': true, 'active': item == turnoverTypeChecked }"
 					@click="selectTurnoverType(item)"><text class="label">{{item.dictLabel}}</text></view>
-				<!-- <view :class="{ 'middle-btn': true, 'active': isRightTurnoverType }"
-					@click="selectTurnoverType('rightType')"><text class="label">车间外周转</text></view> -->
 			</view>
-			<view class="list-title">
+			<view v-if="curDayworkItem.turnoverType == '2'" class="list-title">
 				<text class="label">请选择周转位置</text>
 			</view>
-			<view  v-if="curDayworkItem.turnoverType == '2'" v-for="(item,index) in turnoverArea" class="list-container">
-				<view class="btn uni-row">
+			<view class="uni-row">
+				<view v-if="curDayworkItem.turnoverType == '2'" v-for="(item,index) in turnoverArea" class="btn">
 					<view :class="{ 'middle-btn': true, 'active': item == turnoverDoorChecked }"
 						@click="selectTurnoverDoor(item)"><text class="label">{{item.dictLabel}}</text></view>
-					<!-- <view :class="{ 'middle-btn': true, 'active': isRightTurnoverDoor }"
-						@click="selectTurnoverDoor('rightDoor')"><text class="label">B门</text></view> -->
-
 				</view>
 			</view>
+			<view v-if="curDayworkItem.turnoverType == '2'" class="" style="margin: 0 20rpx 20rpx 0;width: 96%;">
+				<uni-section title="请选择周转工段" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;">
+					<uni-data-select  v-model="curDayworkItem.deptId" :localdata="deptList" @change="handleChange"
+						style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
+				</uni-section>
+			</view>
 		</view>
 		<view class="add-btn-container uni-row">
 			<button type="default" class="btn" @click="handleConfirm">确认</button>
@@ -34,18 +36,24 @@
 		onMounted
 	} from 'vue'
 	import {
-		onLoad 
+		onLoad
 	} from '@dcloudio/uni-app'
 	import {
 		getDictInfoByType
 	} from '@/api/dict/dict.js'
 	import {
-		getDayWorkItemList,saveDayWorkItem
+		getDayWorkItemList,
+		saveDayWorkItem
 	} from '@/api/business/dayWorkItem.js'
+	import {
+		getDeptList
+	} from '@/api/dept/dept.js'
 	import {
 		store
 	} from '@/store/index.js'
-	import { timestampToTime } from '@/utils/common.js'
+	import {
+		timestampToTime
+	} from '@/utils/common.js'
 
 	const baseDialog = ref(null)
 	const turnoverTypeChecked = ref({})
@@ -53,26 +61,27 @@
 	const turnoverType = ref([])
 	const turnoverArea = ref([])
 	const curDayworkItem = ref({})
-	const dayworkInfo = ref(null);
+	const dayworkInfo = ref(null)
+	const deptList = ref([]) // 工段列表
 
 	onLoad(() => {
-		
+
 	})
-	
-	function open(data){
-		dayworkInfo.value = data; 
+
+	function open(data) {
+		dayworkInfo.value = data;
 		baseDialog.value.open()
 		init();
 	}
-	
+
 	defineExpose({
 		open
-	}) 
-	
+	})
+
 	function close() {
 		baseDialog.value.close()
 	}
-	
+
 	function init() {
 		getDictInfoByType('daywork_turnover_type').then(res => {
 			turnoverType.value = res.data;
@@ -80,38 +89,66 @@
 				turnoverArea.value = res.data;
 			})
 		})
-		getDayWorkItemList(dayworkInfo.value.id).then(res => {
-			curDayworkItem.value = res.rows[0]
-		}) 
+		getDayWorkItemList({
+			dayworkId: dayworkInfo.value.id,
+			userId: store.userInfo.userId
+		}).then(res => {
+			console.log(res.rows[0])
+			curDayworkItem.value = res.rows[0];
+		})
+		getDeptList({
+			isWorkSection: 1
+		}).then(res => {
+			console.log(res.data)
+			for (var i = 0; i < res.data.length; i++) {
+				deptList.value[i] = {
+					text: res.data[i].deptName,
+					value: res.data[i].deptId,
+					data: res.data[i]
+				}
+			}
+		})
 	}
 
-	function selectTurnoverType(item){
-		turnoverTypeChecked.value = item; 
+	function selectTurnoverType(item) {
+		turnoverTypeChecked.value = item;
 		curDayworkItem.value.turnoverType = item.dictValue;
 	}
-	
-	function selectTurnoverDoor(item){
+
+	function selectTurnoverDoor(item) {
 		turnoverDoorChecked.value = item;
 		curDayworkItem.value.turnoverArea = item.dictValue;
 	}
-	
-	function handleConfirm(){
+
+	function handleValidate(data){
+
+	}
+
+	function handleConfirm() {
 		curDayworkItem.value.id = null;
 		curDayworkItem.value.status = '4';
 		curDayworkItem.value.startTime = timestampToTime(new Date());
 		curDayworkItem.value.technologicalProcessId = dayworkInfo.value.technologicalProcessId;
-		if(!store.tenantId){
+		if (!store.tenantId) {
 			curDayworkItem.value.tenantId = store.userInfo.tenantId;
-		}else{
+		} else {
 			curDayworkItem.value.tenantId = store.tenantId;
-		} 
+		}
+		console.log(deptList.value)
+		// 设置周转下一个车间名
+		for (let i = 0; i < deptList.value.length; i++) {
+			if(deptList.value[i].deptId == curDayworkItem.value.value){
+				curDayworkItem.value.deptName = deptList.value[i].text;
+			}
+		}
+		console.log(curDayworkItem.value)
 		saveDayWorkItem(curDayworkItem.value).then(res => {
 			if (res.code === 200) {
 				uni.showToast({
 					icon: 'success',
 					title: '操作成功',
 					duration: 2000
-				}); 
+				});
 				close();
 			} else {
 				uni.showToast({
@@ -123,17 +160,16 @@
 			}
 		})
 	}
-	
-	
+
+	function handleChange() {
+		console.log(curDayworkItem.value)
+	}
 </script>
 
 <style lang="scss">
 	.dialog-body {
 		.list-container {
 			width: 100%;
-			display: flex;
-			align-items: flex-start;
-			padding: 0 4rpx;
 
 			.list-title {
 				margin-top: 24rpx;
@@ -144,8 +180,6 @@
 			}
 
 			.btn {
-				justify-content: space-between;
-
 				margin-top: 24rpx;
 
 				.middle-btn {
@@ -154,7 +188,7 @@
 					justify-content: center;
 					padding-left: 0;
 					height: 80rpx;
-					width: 240rpx;
+					width: 220rpx;
 					border-radius: 8rpx;
 					background-color: #FFFFFF;
 					border: 1px solid #999999;
@@ -175,10 +209,7 @@
 						color: #1684fc;
 					}
 				}
-
-
 			}
-
 		}
 
 		.add-btn-container {

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

@@ -70,7 +70,7 @@
 	function handleConfirmDelivery() {
 		// 设置周转状态
 		for (let i = 0; i < confirmTurnoverList.value.length; i++) {
-			confirmTurnoverList.value[i].status = confirmTurnoverList.value[i].status ='4';
+			confirmTurnoverList.value[i].status = confirmTurnoverList.value[i].status ='5';
 		}
 		console.log(confirmTurnoverList.value)
 		updateDayWorkItemBatch(confirmTurnoverList.value).then(res => {
@@ -80,6 +80,7 @@
 					title: '操作成功',
 					duration: 2000
 				});
+				uni.$emit('confirmDelivery')
 			} else {
 				uni.showToast({
 					icon: 'error',

+ 11 - 3
pages/batchReporting/index.vue

@@ -32,7 +32,7 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">上道工序</text>
-					<text class="label right">{{ item['previousProcess'] }}</text>
+					<text class="label right">{{ item.prevProcess.length > 0 ? item.prevProcess[item.prevProcess.length - 1].processAlias : '无'}}</text>
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">当前工序</text>
@@ -40,7 +40,7 @@
 				</view>
 				<view class="item-info uni-row">
 					<text class="label">下道工序</text>
-					<text class="label right">{{ item['NextProcess'] }}</text>
+					<text class="label right">{{ item.nextProcess.length > 0 ? item.nextProcess[0].processAlias : null }}</text>
 				</view>
 				<view class="status-btn uni-row">
 					<view v-if="item['status'] == 1" class=" uni-row">
@@ -152,7 +152,15 @@
 		getDayWorkList(reqData).then(res => {
 			console.log(reqData)
 			listData.value = res.rows;
-			console.log(res)
+			// 设置下道序
+			for (let i = 0; i < listData.value.length; i++) {
+				for (let j = 0; j < listData.value[i].processSequence.length; j++) {
+					if(listData.value[i].currentProcess.processCode === listData.value[i].processSequence[j].processCode){
+						listData.value[i].nextProcess = (j + 1) < listData.value[i].processSequence.length ? listData.value[i].processSequence.slice(j + 1) : [];
+					}
+				}
+			}
+			console.log(listData.value)
 			uni.hideLoading();
 		})
 	}

+ 6 - 3
pages/handlingList/index.vue

@@ -18,7 +18,7 @@
 							<text class="label code">{{ item['process'].processAlias }}</text>
 							<text class="label code" style="margin-left: 16rpx;">→</text>
 							<text class="label code"
-								style="margin-left: 16rpx;">{{ item['nextProcess'].processAlias }}</text>
+								style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
 						</view>
 
 						<view class="right-info uni-row">
@@ -137,6 +137,9 @@
 	const turnoverTask = ref(null) // 弹窗组件
 
 	onLoad(() => {
+		uni.$once('confirmDelivery',function(){
+			init();
+		})
 		init()
 	})
 
@@ -164,8 +167,8 @@
 					turnoverContentTitle.value += products.value[i].carriers;
 				}
 				// 设置总数和目标
-				turnoverSecondTitle.value = products.value[0].process.processAlias + " → " + products.value[0]
-					.nextProcess.processAlias
+				if(products.value.length > 0)
+				turnoverSecondTitle.value = 'A' + " → " + 'B';
 				console.log(res)
 			}
 		})

+ 5 - 1
pages/reportingForWork/index.vue

@@ -40,10 +40,14 @@
 		<!-- 		<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
 					<button class="finished-turnover-tag" size="mini">开始加工</button>
 				</view> -->
-				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
+				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 1 : false" class="status-btn uni-row ">
 					<button class="finished-turnover-tag" size="mini"
 						@click.stop="handleShowEndWorkDialog(item)">结束报工</button>
 				</view>
+				<view v-if="item['userId'] == userInfo['userId'] ? item['status'] == 0 : false" class="status-btn uni-row ">
+					<button class="finished-turnover-tag" size="mini"
+						@click.stop="handleShowEndWorkDialog(item)">开始报工</button>
+				</view>
 			</view>
 		</scroll-view>
 		<view class="bottom uni-row">