From 3bdac82e0066f97307fc6a7177cecdf89a5ba7e1 Mon Sep 17 00:00:00 2001
From: whycq <whycq>
Date: 星期四, 07 四月 2022 09:23:39 +0800
Subject: [PATCH] #

---
 pages/basics/publish.vue |  481 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 459 insertions(+), 22 deletions(-)

diff --git a/pages/basics/publish.vue b/pages/basics/publish.vue
index 143a8b8..be21743 100644
--- a/pages/basics/publish.vue
+++ b/pages/basics/publish.vue
@@ -1,37 +1,73 @@
 <template>
 	<view>
-		<view>
+		<view class="margin-top">
+			<view class="app-list">
+				<view class="app-list-cell">
+					<view class="app-list-cell-left">涓婃灦璐т綅</view>
+					<view class="app-list-cell-db">
+						<picker mode="multiSelector" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray">
+							<view class="app-input">{{multiArray[0][multiIndex[0]]}}
+													,{{multiArray[1][multiIndex[1]]}}
+													,{{multiArray[2][multiIndex[2]]}}</view>
+						</picker>
+					</view>
+				</view>
+			</view>	
+		</view>
+		
+		<view class="margin-top">
 			<uni-table border stripe type="selection" emptyText="娌℃湁鏇村鏁版嵁">
 				<uni-tr>
-					<uni-th>鏁伴噺</uni-th>
-					<uni-th>鎵瑰彿</uni-th>
-					<uni-th>鍟嗗搧缂栧彿</uni-th>
-					<uni-th>鍟嗗搧鍚嶇О</uni-th>
-					<uni-th>瑙勬牸</uni-th>
-					<uni-th>鍗曚环</uni-th>
-					<uni-th>鎿嶄綔</uni-th>
+					<uni-th align="center">鏁伴噺</uni-th>
+					<uni-th align="center">鎵瑰彿</uni-th>
+					<uni-th align="center">鍟嗗搧缂栧彿</uni-th>
+					<uni-th align="center">鍟嗗搧鍚嶇О</uni-th>
+					<uni-th align="center">瑙勬牸</uni-th>
+					<uni-th align="center">鍗曚环</uni-th>
+					<uni-th align="center">鎿嶄綔</uni-th>
+				</uni-tr>
+				<uni-tr v-for="(item,index) in stockInData" :key="index">
+					<uni-td width="50">
+						<view class="flex justify-center">
+							<button class="cu-btn bg-orange sm" style="width: 60rpx;" @click="changeCount(index,item)">{{item.count}}</button>
+						</view>
+					</uni-td>
+					<uni-td align="center" width="50">{{item.batch}}</uni-td>
+					<uni-td align="center" width="100">{{item.matnr}}</uni-td>
+					<uni-td align="center" width="100">{{item.maktx}}</uni-td>
+					<uni-td align="center" width="50">{{item.specs}}</uni-td>
+					<uni-td align="center" width="50">{{item.price}}</uni-td>
+					<uni-td align="center" width="50">绌�</uni-td>
 				</uni-tr>
 			</uni-table>
 		</view>
 		<view class="cu-bar foot input justify-center" style="height: 150rpx;">
 			<view style="width: 80%;">
 				<button class="cu-btn bg-yellow lg shadow-blur" style="width: 250rpx;color: #fff;" @click="getMat()">鏂� 澧�</button>
-				<button class="cu-btn bg-orange lg shadow-blur" style="float: right;width: 250rpx;color: #fff;">纭鍏ュ簱</button>
+				<button class="cu-btn bg-orange lg shadow-blur" style="float: right;width: 250rpx;color: #fff;" @click="confirm()">纭鍏ュ簱</button>
 			</view>	
 		</view>
 		<!-- ******************************************************************************************* -->
 		<view>
-			<!-- 鏅�氬脊绐� -->
-			<uni-popup ref="popup" background-color="#fff" style="position: fixed; border-radius: 5px;" >
-				<view class="popup-content " :class="{ 'popup-height': type === 'left' || type === 'right' }">
-					<view style="height: 800rpx;">
-						<uni-table border stripe type="selection" emptyText="娌℃湁鏇村鏁版嵁">
-							<uni-tr>
-								<uni-th>1</uni-th>
-							</uni-tr>
-						</uni-table>
-					</view>
-				</view>
+			<!-- 淇敼鏁伴噺寮规 -->
+			<uni-popup ref="inputDialog" type="dialog">
+				<uni-popup-dialog ref="inputClose" mode="input" title="鐗╂枡鏁伴噺" @confirm="dialogInputConfirm">
+						<uni-number-box  :max="999" v-model="value" />
+				</uni-popup-dialog>
+			</uni-popup>
+		</view>
+		<view>
+			<!-- 鎻愮ず淇℃伅寮圭獥 -->
+			<uni-popup ref="message" type="message">
+				<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
+			</uni-popup>
+		</view>
+		<view>
+			<!-- 鏄剧ず琛ㄥ崟寮圭獥 -->
+			<uni-popup ref="showNodeSelect" type="dialog">
+				<uni-popup-dialog ref="inputClose" mode="input" title="閫夋嫨鍏ュ簱璐т綅" @confirm="aabbcc()">
+					
+				</uni-popup-dialog>
 			</uni-popup>
 		</view>
 	</view>
@@ -42,8 +78,50 @@
 		data() {
 			return {
 				type:'bottom',
+				stockInData: [],
+				value:'',
+				rowNum:'',
+				msgType: '',
+				messageText: '',
+				selectData: "",
+				index: 0,
+				multiArray: [
+					['璇烽�夋嫨'],
+					['璇烽�夋嫨'],
+					['璇烽�夋嫨']
+				],
+				multiIndex: [0, 0, 0],
+				date: getDate({
+					format: true
+				}),
+				startDate:getDate('start'),
+				endDate:getDate('end'),
+				sum: '',
+				nodeSel: '',
 			}
+		},
+		onLoad() {
 			
+		},
+		mounted(){
+			const UIP = uni.getStorageSync('UIP');
+			this.baseIP = UIP;
+			const UPORT = uni.getStorageSync('UPORT');
+			this.basePORT = UPORT
+			let that = this
+			uni.request({
+				url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/node/tree/auth",
+				header: { 'token':uni.getStorageSync('token') },
+				data: {},
+				method:'POST',
+				success(res) {
+					var res = res.data
+					if (res.code === 200 ) {
+						that.selectData = res.data
+						that.multiArray[0] = [res.data[0].title,res.data[0].children[0].title]
+					}
+				}
+			})
 		},
 		methods: {
 			// 寮瑰嚭灞�
@@ -52,13 +130,372 @@
 				// open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦� uni-popup 缁勪欢涓婄粦瀹� type灞炴��
 				this.$refs.popup.open(type)
 			},
+			// 鎻愰啋寮圭獥
+			messageToggle(type) {
+				this.msgType = type
+				this.messageText = '鎻愬彇澶辫触'
+				this.$refs.message.open()
+			},
 			getMat() {
-				this.toggle('top')
+				let that = this
+				uni.navigateTo({
+				    url: 'stockIn?baseIP=' + that.baseIP + '&basePORT=' + that.basePORT
+				});
+			},
+			// 鍒濆鍖栦笂鏋舵暟閲�
+			initCount() {
+				this.stockInData.forEach(function(element){
+					element.count = 0
+				})
+			},
+			otherFun(object){ // 鎺ユ敹涓婁釜椤甸潰鐨勪紶鍊�
+				let that = this
+				if(!!object){
+					if ( that.stockInData.length == 0 ) {
+						that.stockInData = object
+					} else {
+						that.addSotokInData(object)
+					}
+				}
+				that.initCount()
+			},
+			addSotokInData(object) {
+				let that = this
+				for (var i = 1; i < object.length; i++) {
+					var toPush = true
+					for (var j = 0; j < that.stockInData.length; j++) {
+						if (object[i].matnr == that.stockInData[j].matnr) {
+							toPush = false
+						}
+					}
+					if (toPush) {
+						that.stockInData.push(object[i])
+					}
+				}
+			},
+			// 淇敼鏁伴噺
+			changeCount(index,item) {
+				this.$refs.inputDialog.open()
+				this.rowNum = index
+				this.value = 0
+			},
+			// 淇敼鏁伴噺寮圭獥
+			dialogInputConfirm() {
+				this.stockInData[this.rowNum].count = this.value
+			},
+			// 纭鍏ュ簱
+			confirm() {
+				let that = this
+				if (that.stockInData.length == 0) {
+					that.messageToggle('error')
+					that.messageText = '璇峰厛娣诲姞鐗╂枡'
+					return;
+				}
+				for (var i = 0; i < that.stockInData.length; i++) {
+					if (that.stockInData[i].count === 0){
+					    that.messageToggle('error')
+					    that.messageText = '鏁伴噺涓嶈兘涓洪浂'
+					    return;
+					}
+				}
+				uni.request({
+					url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "//work/stock/pakin",
+					header: {
+						'content-type':'application/json',
+						'token':uni.getStorageSync('token') 
+						},
+					data: { 
+						nodeId: this.nodeSel,
+						mats: this.stockInData,
+					},
+					method:'POST',
+					success(res) {
+						console.log(res)
+						var res = res.data
+						if (res.code === 200 ) {
+							console.log(res)
+						}
+					}
+				})
+			},
+			bindMultiPickerColumnChange: function(e) {
+				var selectData = this.selectData
+				var selectData2 = this.selectData[0].children[0].children[0].children
+				var	selectData3 = this.selectData[0].children[0].children[1].children
+				this.multiIndex[e.detail.column] = e.detail.value
+				switch (e.detail.column) {
+					case 0: //鎷栧姩绗�1鍒�
+						
+						switch (this.multiIndex[0]) {
+							case 0:
+								this.multiArray[1] = [selectData[0].title]
+								this.multiArray[2] = [selectData[0].title]
+								break
+							case 1:
+								this.multiArray[1] = [selectData[0].children[0].children[0].title, 
+														selectData[0].children[0].children[1].title]
+								this.multiArray[2] = [selectData2[0].title,
+															selectData2[1].title, 
+															selectData2[2].title, 
+															selectData2[3].title, 
+															selectData2[4].title,
+															selectData2[5].title, 
+															selectData2[6].title, 
+															selectData2[7].title, 
+															selectData2[8].title, 
+															selectData2[9].title, 
+															selectData2[10].title, 
+															selectData2[11].title, 
+															selectData2[12].title, 
+															selectData2[13].title, 
+															selectData2[14].title, 
+															selectData2[15].title, ]
+								break
+						}
+						this.multiIndex.splice(1, 1, 0)
+						this.multiIndex.splice(2, 1, 0)
+						break
+					case 1: //鎷栧姩绗�2鍒�
+						
+						switch (this.multiIndex[0]) { //鍒ゆ柇绗竴鍒楁槸浠�涔�
+							case 0:
+								switch (this.multiIndex[1]) {
+									case 0:
+										
+										break
+									case 1:
+										this.multiArray[2] = ['涓滀含','鍖楁捣閬�']
+										break
+								}
+								break
+							case 1:
+								switch (this.multiIndex[1]) {
+									case 0:
+										this.multiArray[2] = [selectData2[0].title,
+															selectData2[1].title, 
+															selectData2[2].title, 
+															selectData2[3].title, 
+															selectData2[4].title,
+															selectData2[5].title, 
+															selectData2[6].title, 
+															selectData2[7].title, 
+															selectData2[8].title, 
+															selectData2[9].title, 
+															selectData2[10].title, 
+															selectData2[11].title, 
+															selectData2[12].title, 
+															selectData2[13].title, 
+															selectData2[14].title, 
+															selectData2[15].title, ]
+										break
+									case 1:
+										this.multiArray[2] = [selectData3[0].title,
+															selectData3[1].title, 
+															selectData3[2].title, 
+															selectData3[3].title, 
+															selectData3[4].title,
+															selectData3[5].title, 
+															selectData3[6].title, 
+															selectData3[7].title, 
+															selectData3[8].title, 
+															selectData3[9].title, 
+															selectData3[10].title, 
+															selectData3[11].title, 
+															selectData3[12].title, 
+															selectData3[13].title, 
+															selectData3[14].title, 
+															selectData3[15].title, ]
+										break
+								}
+								break
+						}
+						this.multiIndex.splice(2, 1, 0)
+						break
+				}
+				this.$forceUpdate()
+				var num1 = this.multiIndex[0]
+				var num2 = this.multiIndex[1]
+				var num3 = this.multiIndex[2]
+				this.sum = num1 + "-" + num2 + "-" + num3
+				this.changeNum(this.sum)
+			},
+			changeNum() {
+				switch (this.sum) {
+					case "0-0-0":
+						this.nodeSel = 1
+						break;
+					case "1-0-0":
+						this.nodeSel = 4
+						break;
+					case "1-0-1":
+						this.nodeSel = 5
+						break;
+					case "1-0-2":
+						this.nodeSel = 6
+						break;
+					case "1-0-3":
+						this.nodeSel = 7
+						break;
+					case "1-0-4":
+						this.nodeSel = 8
+						break;
+					case "1-0-5":
+						this.nodeSel = 9
+						break;
+					case "1-0-6":
+						this.nodeSel = 10
+						break;
+					case "1-0-7":
+						this.nodeSel = 11
+						break;
+					case "1-0-8":
+						this.nodeSel = 12
+						break;
+					case "1-0-9":
+						this.nodeSel = 13
+						break;
+					case "1-0-10":
+						this.nodeSel = 14
+						break;
+					case "1-0-11":
+						this.nodeSel = 15
+						break;
+					case "1-0-12":
+						this.nodeSel = 16
+						break;
+					case "1-0-13":
+						this.nodeSel = 17
+						break;
+					case "1-0-14":
+						this.nodeSel = 18
+						break;
+					case "1-0-15":
+						this.nodeSel = 19
+						break;
+					case "1-1-0":
+						this.nodeSel = 21
+						break;
+					case "1-1-1":
+						this.nodeSel = 22
+						break;
+					case "1-1-2":
+						this.nodeSel = 23
+						break;
+					case "1-1-3":
+						this.nodeSel = 24
+						break;
+					case "1-1-4":
+						this.nodeSel = 25
+						break;
+					case "1-1-5":
+						this.nodeSel = 26
+						break;
+					case "1-1-6":
+						this.nodeSel = 27
+						break;
+					case "1-1-7":
+						this.nodeSel = 28
+						break;
+					case "1-1-8":
+						this.nodeSel = 29
+						break;
+					case "1-1-9":
+						this.nodeSel = 30
+						break;
+					case "1-1-10":
+						this.nodeSel = 31
+						break;
+					case "1-1-11":
+						this.nodeSel = 32
+						break;
+					case "1-1-12":
+						this.nodeSel = 33
+						break;
+					case "1-1-13":
+						this.nodeSel = 34
+						break;
+					case "1-1-14":
+						this.nodeSel = 35
+						break;
+					case "1-1-15":
+						this.nodeSel = 36
+						break;
+					
+				}
+			},
+			aabbcc(e) {
+				console.log(e)
 			}
 		}
 	}
 </script>
 
 <style>
-	
+	.app-list {
+		background-color: #ffffff;
+		position: relative;
+		width: 100%;
+		display: flex;
+		flex-direction: column;
+	}
+	.app-list:after {
+		position: absolute;
+		z-index: 10;
+		right: 0;
+		bottom: 0;
+		left: 0;
+		height: 1px;
+		content: '';
+		-webkit-transform: scaleY(.5);
+		transform: scaleY(.5);
+		background-color: #c8c7cc;
+	}
+	.app-list::before {
+		position: absolute;
+		z-index: 10;
+		right: 0;
+		top: 0;
+		left: 0;
+		height: 1px;
+		content: '';
+		-webkit-transform: scaleY(.5);
+		transform: scaleY(.5);
+		background-color: #c8c7cc;
+	}
+	.app-list-cell {
+		position: relative;
+		display: flex;
+		flex-direction: row;
+		justify-content: space-between;
+		align-items: center;
+	}
+	.app-list-cell-left {
+	    white-space: nowrap;
+		font-size:28rpx;
+		padding: 0 30rpx;
+	}
+	.app-list-cell-db,
+	.app-list-cell-right {
+		flex: 1;
+	}
+	.app-input {
+		height: 80rpx;
+		padding: 15rpx 25rpx;
+		line-height:50rpx;
+		font-size:28rpx;
+		background:#FFF;
+		flex: 1;
+	}
+	.app-list-cell::after {
+		position: absolute;
+		z-index: 3;
+		right: 0;
+		bottom: 0;
+		left: 30rpx;
+		height: 1px;
+		content: '';
+		-webkit-transform: scaleY(.5);
+		transform: scaleY(.5);
+		background-color: #c8c7cc;
+	}
 </style>

--
Gitblit v1.9.1