ezhizao_zx 9 luni în urmă
părinte
comite
43599cf290
3 a modificat fișierele cu 145 adăugiri și 52 ștergeri
  1. 12 2
      api/business/workshop.js
  2. 10 7
      pages/drawingMenu/index.vue
  3. 123 43
      pages/handlingList/index.vue

+ 12 - 2
api/business/workshop.js

@@ -6,7 +6,7 @@ import req from '@/utils/request.js'
  */
 export function getTurnoverByWorkshop(data) {
 	return req.request({
-		url:'/business/workshop/turnover',
+		url: '/business/workshop/turnover',
 		method: 'POST',
 		data: data
 	})
@@ -17,8 +17,18 @@ export function getTurnoverByWorkshop(data) {
  */
 export function getOutsourceTurnoverByWorkshop(data) {
 	return req.request({
-		url:'/business/workshop/outsourceTurnover',
+		url: '/business/workshop/outsourceTurnover',
 		method: 'POST',
 		data: data
 	})
+}
+
+/**
+ * 获取车间和周转区
+ */
+export function getTreeData() {
+	return req.request({
+		url: '/business/workshop/getTreeData',
+		method: 'POST'
+	})
 }

+ 10 - 7
pages/drawingMenu/index.vue

@@ -1,13 +1,16 @@
 <template>
 	<view class="uni-column container">
 		<view style="margin: 12rpx;">
-			<view class="margenTop" style="font-size: 30rpx;font-weight: bold;">批次号:{{product.lotCode}}</view>
+			<view class="margenTop" style="font-size: 30rpx;font-weight: bold; flex-direction: row;">
+				批次号:{{product.lotCode}}
+				<view style="margin-left: 30px;">工艺版本:{{product.technologyVersion}}</view>
+			</view>
+
 			<view class="margenTop" style="font-size: 30rpx;font-weight: bold;">产品描述:{{product.productDescription}}
 			</view>
 			<view class="margenTop"
 				style="font-size: 30rpx;font-weight: bold;    flex-direction: row; display: inline-block; line-height: 35px; height: 35px;">
-				<view>工艺版本:{{product.technologyVersion}}</view>
-				<view style="margin-left: 10rpx;">工序:</view>
+				<view>工序:</view>
 				<uni-data-select v-model="curSelectedProcessCode" :localdata="selectedProcessList" :clear="false"
 					@change="handleSelectedChange" style="font-size: 20rpx;"></uni-data-select>
 			</view>
@@ -76,10 +79,10 @@
 				text: v.processAlias,
 				value: v.processCode
 			}))
-			selectedProcessList.value.push({
-				text: '分选-直径Φ13.04(杠杆千',
-				value: '30492'
-			})
+			// selectedProcessList.value.push({
+			// 	text: '分选-直径Φ13.04(杠杆千',
+			// 	value: '30492'
+			// })
 			if (!selectedProcessList.value.some(v => v.value == processCode.value)) {
 				selectedProcessList.value.push({
 					text: processAlias.value,

+ 123 - 43
pages/handlingList/index.vue

@@ -8,6 +8,20 @@
 		<!-- 待周转页面 -->
 		<view class="padding-container" v-if='selectedInfo.id == 4'>
 			<view class="scroll-container">
+				<!-- <uni-section title="本地数据" type="line" padding style="height: calc(100vh - 100px);"> -->
+				<!-- <uni-data-picker placeholder="请选车间与周转区" popup-title="请选择所在车间与周转区" :localdata="dataTree"
+					v-model="classes" @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
+					@popupclosed="onpopupclosed">
+				</uni-data-picker> -->
+				<view
+					style="font-size: 30rpx;font-weight: bold; flex-direction: row; display: inline-block; line-height: 35px; height: 38px;">
+					<uni-data-select v-model="workshopId" :localdata="dataTree" :clear="true" placeholder="请选择车间"
+						@change="handleSelectedWorkshopChange" style="background-color: #ffffff;"></uni-data-select>
+					<uni-data-select v-model="turnoverId" :localdata="dataChildren" :clear="true" plac
+						placeholder="请选择周转区" @change="handleSelectedTurnoverIdChange"
+						style="background-color: #ffffff;"></uni-data-select>
+				</view>
+				<!-- </uni-section> -->
 				<view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
 					<text>暂无待周转批次</text>
 				</view>
@@ -199,10 +213,15 @@
 	import {
 		getDictInfoByType
 	} from '@/api/dict/dict.js'
+	import {
+		getTreeData
+	} from '@/api/business/workshop.js'
 	import {
 		store
 	} from '../../store'
-
+	const classes = ref(null)
+	const dataTree = ref([])
+	const dataChildren = ref([])
 
 	const sum = ref(0)
 	const pendingClass = ref({
@@ -224,6 +243,8 @@
 	const lotList = ref([])
 	const deliveredList = ref([])
 	const showRight = ref(null) // 抽屉
+	const workshopId = ref(null)
+	const turnoverId = ref(null)
 	const statusList = ref([{
 			"id": 4,
 			"name": "待周转"
@@ -244,8 +265,19 @@
 
 	onShow(() => {
 		init();
+		getWorkShops()
 	})
 
+	function getWorkShops() {
+		console.log('getWorkShops')
+		getTreeData().then(res => {
+			console.log(res)
+			if (res.code === 200) {
+				dataTree.value = res.data
+			}
+		})
+	}
+
 	function init() {
 		uni.showLoading({
 			title: '加载中'
@@ -253,14 +285,16 @@
 		Promise.all([getItemList({
 				status: 4,
 				//turnoverType设置值是为了筛选掉车间内周转
-				turnoverType:1
+				workshopId: workshopId.value,
+				turnoverId: turnoverId.value,
+				turnoverType: 1
 			}), getItemList({
 				status: 5,
-				turnoverType:1,
+				turnoverType: 1,
 				updaterId: store.userInfo.userId
 			}), getItemList({
 				status: 7,
-				turnoverType:1,
+				turnoverType: 1,
 				updaterId: store.userInfo.userId
 			})])
 			.then(([res1, res2, res3]) => {
@@ -398,48 +432,48 @@
 					duration: 2000
 				})
 			} else {
-		// 设置周转状态
-		for (let i = 0; i < selection.value.length; i++) {
-			selection.value[i].status = status;
-		}
-		if (isBack) {
-			updateBatchBack(selection.value).then(res => {
-				if (res.code === 200) {
-					uni.showToast({
-						icon: 'success',
-						title: '操作成功',
-						duration: 2000
-					});
-					reflush();
-				} else {
-					uni.showToast({
-						icon: 'none',
-						title: '操作失败',
-						duration: 2000
-					});
+				// 设置周转状态
+				for (let i = 0; i < selection.value.length; i++) {
+					selection.value[i].status = status;
 				}
-			})
-		} else {
-			updateDayWorkItemBatch(selection.value).then(res => {
-				if (res.code === 200) {
-					uni.showToast({
-						icon: 'success',
-						title: '操作成功',
-						duration: 2000
-					});
-					reflush();
+				if (isBack) {
+					updateBatchBack(selection.value).then(res => {
+						if (res.code === 200) {
+							uni.showToast({
+								icon: 'success',
+								title: '操作成功',
+								duration: 2000
+							});
+							reflush();
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: '操作失败',
+								duration: 2000
+							});
+						}
+					})
 				} else {
-					uni.showToast({
-						icon: 'none',
-						title: '操作失败',
-						duration: 2000
-					});
+					updateDayWorkItemBatch(selection.value).then(res => {
+						if (res.code === 200) {
+							uni.showToast({
+								icon: 'success',
+								title: '操作成功',
+								duration: 2000
+							});
+							reflush();
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: '操作失败',
+								duration: 2000
+							});
+						}
+					})
 				}
-			})
-		}
-		// 清空选中数组
-		selection.value = [];
-		}
+				// 清空选中数组
+				selection.value = [];
+			}
 		})
 	}
 
@@ -499,6 +533,52 @@
 	function singleSelectd(item) {
 		return selectedInfo.value == item
 	}
+
+	function onchange(e) {
+		// console.log(e)
+		// console.log(classes.value)
+		if (e.detail.value.length == 0) {
+			workshopId.value = null
+			turnoverId.value = null
+		} else if (e.detail.value.length == 1) {
+			workshopId.value = classes.value
+			turnoverId.value = null
+		} else if (e.detail.value.length == 2) {
+			turnoverId.value = classes.value
+		}
+		console.log(workshopId.value)
+		console.log(turnoverId.value)
+		reflush()
+	}
+
+	function onpopupopened(e) {
+		// console.log('popupopend', e)
+	}
+
+	function onpopupclosed(e) {
+		// console.log('onpopupclosed', e)
+	}
+
+	function onnodeclick(e) {
+		// console.log('nodeclick', e)
+	}
+
+	function handleSelectedWorkshopChange() {
+		const item = dataTree.value.find(e => e.value == workshopId.value)
+		if (item != null) {
+			dataChildren.value = item.children
+			const currentItem = dataChildren.value.find(e => e.value == turnoverId.value)
+			turnoverId.value = currentItem != null ? turnoverId.value : null
+		} else {
+			turnoverId.value = null
+			dataChildren.value = []
+		}
+		reflush()
+	}
+
+	function handleSelectedTurnoverIdChange() {
+		reflush()
+	}
 </script>
 
 <style lang="scss">