From 05143990efdcad0e57341913480ab1fb112993bc Mon Sep 17 00:00:00 2001
From: Mr.Zhang <710666463@qq.com>
Date: 星期三, 30 八月 2023 10:57:17 +0800
Subject: [PATCH] 选择物料

---
 minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue |   87 +++++++++++++++++++++++++---
 minipro_standard/util/request/index.js                        |    8 +-
 minipro_standard/components/selectMaterial.vue                |   61 ++++++++++++++++++++
 minipro_standard/common/config.js                             |    8 ++
 4 files changed, 148 insertions(+), 16 deletions(-)

diff --git a/minipro_standard/common/config.js b/minipro_standard/common/config.js
index 15d4a4d..1ee7ea5 100644
--- a/minipro_standard/common/config.js
+++ b/minipro_standard/common/config.js
@@ -1,5 +1,11 @@
 module.exports = {
     // baseUrl: 'http://106.14.20.42/test_hfznzz/',
     // baseUrl: 'https://hefei.dtkey.cn/test_hfznzz/',
-    baseUrl: 'https://dmtest.ahapp.net/doumeeplant_api/'
+    baseUrl: 'https://dmtest.ahapp.net/doumeeplant_api/',
+		phoneRegular: /^1[3456789]\d{9}$/,
+		mailboxRegular: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
+		positiveInteger: /^[0-9]*[1-9][0-9]*$/,
+		decimal: /^0$|^[1-9]\d{0,15}$|^[1-9]\d{0,15}\.{1}\d{1,4}$|^0\.{1}\d{1,4}$/g,
+		positiveIntegerDecimal: /^([1-9][0-9]*|0)(\.[0-9]?[1-9][1-9][1-9])?$/,
+		number: /^\d+(?:\.\d{1,4})?$/
 }
diff --git a/minipro_standard/components/selectMaterial.vue b/minipro_standard/components/selectMaterial.vue
new file mode 100644
index 0000000..18d3d35
--- /dev/null
+++ b/minipro_standard/components/selectMaterial.vue
@@ -0,0 +1,61 @@
+<template>
+	<u-popup :show="show" :round="10" closeable @close="show=false">
+		<view class="material-content">
+			<u-list @scrolltoupper="scrolltoupper" @scrolltolower="scrolltolower">
+				<u-list-item v-for="(item, index) in list" :key="index">
+					<view class="" style="height: 20px;">{{item}}</view>
+				</u-list-item>
+			</u-list>
+		</view>
+	</u-popup>
+</template>
+
+<script>
+	export default {
+		name: "selectMaterial",
+		data() {
+			return {
+				show: false,
+				pages: {
+					size: 10,
+					index: 1,
+					total: 0
+				},
+				list: [
+					1,2,3,4,5,6,7,8
+				]
+			};
+		},
+		methods: {
+			open(target) {
+				this.show = true
+				this.workorderId = target.workorderId
+				this.deviceId = target.deviceId
+				this.list = []
+				this.pages = {
+					size: 10,
+					index: 1,
+					total: 0
+				}
+				this.loadData()
+			},
+			loadData() {
+				this.list = [1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6,1,2,3,4,5,6]
+			},
+			scrolltoupper() {
+				console.log('scrolltoupper');
+				this.loadData()
+			},
+			scrolltolower() {
+				console.log('scrolltolower');
+				this.loadData()
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.material-content {
+		height: 800rpx;
+	}
+</style>
diff --git a/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue b/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
index f08f604..82a4bb2 100644
--- a/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
+++ b/minipro_standard/pages_adjust/pages/manualFeed/manualFeed.vue
@@ -5,7 +5,8 @@
 			<div class="tl_title_left">
 				<div class="tl_title_left_x"></div>
 				<span>鎶曟枡淇℃伅</span>
-				<span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span>
+				<!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
+				<!-- <span>{{total == 0 ? '' : total}}{{formList[formList.length - 1].dw ? formList[formList.length - 1].dw : ''}}</span> -->
 			</div>
 			<div class="tl_title_right" @click="add">
 				<image src="../../static/gongdan_ic_shoudong@2x.png" class="add-img" mode=""></image>
@@ -19,7 +20,7 @@
 					<div class="tl_list_item" @click="open1(index)">
 						<div class="tl_list_item_label">閫夋嫨鐗╂枡</div>
 						<div class="tl_list_item_go" v-if="!item.materialName">
-							<span>鐐瑰嚮璺宠浆鍒扮墿鏂欏垪琛�</span>
+							<span>鐐瑰嚮璺宠浆鍒扮墿鏂欏垪琛�</span>
 							<u-icon name="arrow-right"></u-icon>
 						</div>
 						<div class="tl_list_item_wl" v-else>
@@ -46,24 +47,48 @@
 					</div>
 				</div>
 			</u-swipe-action-item>
-		</u-swipe-action>
+		</u-swipe-action>
+		<SelectMaterial ref="selectMaterial" />
 	</view>
 </template>
 
 <script>
-	import workOrderInfo from '@/components/workOrderInfo.vue'
+	import workOrderInfo from '@/components/workOrderInfo.vue'
+	import SelectMaterial from '@/components/selectMaterial.vue'
+	
+	import {
+		positiveInteger,
+		number
+	} from '@/common/config'
 	export default {
 		components: {
-			workOrderInfo
+			workOrderInfo,
+			SelectMaterial
 		},
 		data() {
 			return {
-				total: 3,
-				formList: [{
-					dw: 'dasda' 
-				}],
+				// formList: [{
+				// 	id: Date.now(),
+				// 	toolingTypeId: '', // 宸ヨ绫诲瀷
+				// 	toolingTypeName: '', // 宸ヨ绫诲瀷鍚嶇О
+				// 	workClothesId: '', // 宸ヨ
+				// 	workClothesName: '', // 宸ヨ鍚嶇О
+				// 	num: '', // 鏁伴噺
+				// 	attribute: '', // 宸ヨ灞炴��
+				// 	attributeType: '', // 宸ヨ灞炴�х被鍨�
+				// 	dw: '', // 鐗╂枡鍗曚綅
+				// 	unitAttribute: ''
+				// }],
 				materialList: [{
-
+					id: '',
+					materialName: '',
+					materialCode: '',
+					qualityType: '',
+					procedureName: '',
+					locationName: '',
+					batch: '',
+					num: '',
+					unitAttribute: ''
 				}],
 				options: [{
 					text: '鍒犻櫎',
@@ -72,14 +97,54 @@
 					}
 				}],
 			};
-		},
+		},
 		methods: {
+			open1(index) {
+				this.$refs.selectMaterial.open({})
+			},
 			deleItem(index) {
 				if (this.materialList.length === 1) {
 					uni.$u.toast('鑷冲皯淇濈暀涓�鏉℃姇鏂欎俊鎭�')
 					return
 				}
 				this.materialList.splice(index, 1)
+			},
+			add() {
+				this.total += 1
+				this.materialList.unshift({
+					id: '',
+					materialName: '',
+					materialCode: '',
+					qualityType: '',
+					procedureName: '',
+					locationName: '',
+					batch: '',
+					num: '',
+					unitAttribute: ''
+				})
+			},
+			changeNumber(num, index, unitAttribute) {
+				if (unitAttribute === 0 && num !== '') {
+					if (!positiveInteger.test(num)) {
+						uni.$u.toast({
+							message: '鍙兘杈撳叆姝f暣鏁�'
+						})
+						this.materialList[index].num = ''
+					}
+				} else if (unitAttribute === 1 && num !== '') {
+					if (!number.test(num)) {
+						uni.$u.toast({
+							message: '鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級'
+						})
+						this.materialList[index].num = ''
+					}
+				}
+				if (num <= 0) {
+					uni.$u.toast({
+						message: '鎶曟枡鏁伴噺涓嶈兘灏忎簬绛変簬0'
+					})
+					this.materialList[index].num = ''
+				}
 			}
 		}
 	}
diff --git a/minipro_standard/util/request/index.js b/minipro_standard/util/request/index.js
index 8cc78b7..eb2f57a 100644
--- a/minipro_standard/util/request/index.js
+++ b/minipro_standard/util/request/index.js
@@ -1,13 +1,13 @@
 // 寮曞叆閰嶇疆
-import config from '@/common/config'
+import { baseUrl } from '@/common/config'
 // 鍒濆鍖栬姹傞厤缃�
 uni.$u.http.setConfig((defaultConfig) => {
     /* defaultConfig 涓洪粯璁ゅ叏灞�閰嶇疆 */
-    defaultConfig.baseURL = config.baseUrl /* 鏍瑰煙鍚� */
-		config.header = {
+    defaultConfig.baseURL = baseUrl /* 鏍瑰煙鍚� */
+		defaultConfig.header = {
 			'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
 		}
-		config.dataType = 'json'
+		defaultConfig.dataType = 'json'
     return defaultConfig
 })
 

--
Gitblit v1.9.3