From d7fe8ae3888c8e2b1eea3c1e3769be0d42a21cc9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 16 十月 2023 09:03:47 +0800
Subject: [PATCH] Merge branch '1.0.3' of http://139.186.142.91:10010/r/productDev/dmMes into 1.0.3

---
 minipro_standard/pages/allocation/allocation.vue |  180 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 131 insertions(+), 49 deletions(-)

diff --git a/minipro_standard/pages/allocation/allocation.vue b/minipro_standard/pages/allocation/allocation.vue
index 9d214a0..43ad353 100644
--- a/minipro_standard/pages/allocation/allocation.vue
+++ b/minipro_standard/pages/allocation/allocation.vue
@@ -7,21 +7,21 @@
 					<text>璁″垝鐢熶骇鏁伴噺锛�</text>
 				</view>
 				<view class="fp_list_item_right">
-					<input type="number" v-model="form.num" placeholder="璇疯緭鍏�" />
+					<u--input placeholder="璇疯緭鍏�" :customStyle="{width: '180rpx'}" inputAlign="right" type="number" border="surround" v-model="form.num"></u--input>
 				</view>
 			</view>
-			<view class="fp_list_item" @click="timeShow = true">
+			<view class="fp_list_item">
 				<view class="fp_list_item_left">
 					<text style="color: #f00;">*</text>
 					<text>璁″垝寮�宸ユ棩鏈燂細</text>
 				</view>
-				<view class="fp_list_item_right">
+				<view class="fp_list_item_right" @click="timeShow = true">
 					<text class="black" v-if="form.startTime">{{form.startTime}}</text>
 					<text v-else>骞� / 鏈� / 鏃�</text>
 					<u-icon name="arrow-right" color="#999999"></u-icon>
 				</view>
 			</view>
-			<view class="fp_list_item" @click="openSB">
+			<view class="fp_list_item" @click="show1 = true">
 				<view class="fp_list_item_left">
 					<text>鐢熶骇璁惧</text>
 				</view>
@@ -36,10 +36,20 @@
 					<text>鐢熶骇浜哄憳</text>
 				</view>
 				<view class="fp_list_item_right">
-					<u-checkbox-group v-model="form.personnelId" direction="horizontal" v-show="personnelData.length > 0">
-						<u-checkbox :name="item.id" v-for="(item, index) in personnelData" :key="index" checked-color="#4275FC">{{item.text}}</u-checkbox>
-					</u-checkbox-group>
-					<view class="wu" v-show="personnelData.length === 0">
+					<template v-if="personnelData.length > 0">
+						<u-checkbox-group
+							placement="column"
+							@change="checkboxChange">
+							<u-checkbox
+								:customStyle="{marginBottom: '16rpx'}"
+								v-for="(item, index) in personnelData"
+								:key="index"
+								:label="item.text"
+								:name="item.id">
+							</u-checkbox>
+						</u-checkbox-group>
+					</template>
+					<view class="wu" v-else>
 						<text>鏆傛棤鏁版嵁</text>
 					</view>
 				</view>
@@ -50,32 +60,102 @@
 			<button class="fp_footer_submit" @click="submit">纭</button>
 		</view>
 		<!-- 閫夋嫨鏃ユ湡 -->
-		<u-calendar :show="timeShow" mode="range" @confirm="timeConfirm"></u-calendar>
+		<u-calendar :show="timeShow" @close="timeShow = false" @confirm="timeConfirm"></u-calendar>
+		<!-- 閫夋嫨璁惧 -->
+		<u-picker :show="show1" :columns="equipment" @confirm="confirm" @cancel="show1 = false" keyName="text"></u-picker>
 	</view>
 </template>
 
 <script>
 	import { gsdate } from '@/util/utils.js'
+	import { distributeById, getFindAll, getDeviceByCondition } from '@/util/api/PlanningAPI'
 	export default {
 		data() {
 			return {
+				id: null,
+				show1: false,
+				checkboxValue1: [],
 				form: {
-					num: $route.query.num,        // 鐢熶骇鏁伴噺
+					num: '',        // 鐢熶骇鏁伴噺
 					startTime: gsdate(new Date()),      // 寮�濮嬫椂闂�
 					equipmentId: '',    // 璁惧id
 					equipmentName: '',    // 璁惧鍚嶇О 
 					personnelId: []    // 浜哄憳id
 				},
+				isOpenDate: false,
+				equipment: [],	// 璁惧鏁版嵁
+				personnelData: [],    // 浜哄憳鏁版嵁
 				timeShow: false
 			};
 		},
+		onLoad(option) {
+			this.form.num = option.num
+			this.id = option.jhid
+			this.getDeviceByConditions()
+		},
 		methods: {
+			checkboxChange(ids) {
+				this.form.personnelId = ids;
+			},
 			go() {
 				uni.navigateBack({ delta: 1 });
 			},
+			// 纭閫夋嫨璁惧
+			confirm(val) {
+				this.form.equipmentId = val.value[0].id
+				this.form.equipmentName = val.value[0].text
+				this.personnelData = []
+				getFindAll({
+					deviceId: this.form.equipmentId
+				}).then(res => {
+					if (res.code === 200 && res.data && res.data.length !== 0) {
+						this.form.personnelId = []
+						let arr = []
+						res.data.forEach((item) => {
+							arr.push({ text: item.dmodel.name + '-' + item.umodel.name, id: item.userId })
+						})
+						this.personnelData = arr
+					}
+					this.show1 = false
+				})	
+			},
 			timeConfirm(val) {
-				console.log(val)
+				this.form.startTime = val[0]
 				this.timeShow = false
+			},
+			// 鎻愪氦鍒嗛厤
+			submit() {
+				if (!this.form.num) return uni.showToast({ title: '璁″垝鐢熶骇鏁伴噺涓嶈兘涓虹┖锛�', icon: 'none', duration: 2000 });
+				if (!this.form.startTime) return uni.showToast({ title: '璁″垝寮�濮嬫棩鏈熶笉鑳戒负绌猴紒', icon: 'none', duration: 2000 });
+				distributeById({
+					planId: this.id,
+					planNum: this.form.num,
+					planDate: this.form.startTime,
+					proGroupId: this.form.equipmentId,
+					proUserList: this.form.personnelId
+				}).then(res => {
+					if (res.code === 200) {
+						uni.showToast({ title: '鍒嗛厤鎴愬姛', icon: 'success', duration: 2000, mask: true });
+						setTimeout(() => {
+							uni.$emit('update', { msg:'鍒锋柊鍒楄〃' })
+							uni.navigateBack({ delta: 1 });
+						}, 2000)
+					}
+				})
+			},
+			// 鏌ヨ璁惧
+			getDeviceByConditions() {
+				getDeviceByCondition({})
+					.then(res => {
+						if (res.code === 200) {
+							this.equipment = []
+							let arr = []
+							res.data.forEach((element) => {
+								arr.push({ text: element.code + '-' + element.name, id: element.id, checked: false })
+							})
+							this.equipment.push(arr)
+						}
+					})
 			}
 		}
 	}
@@ -100,7 +180,7 @@
             border-bottom: 1rpx solid #ececec;
             .fp_list_item_left {
                 flex-shrink: 0;
-                margin-bottom: 20rpx;
+                margin-bottom: 40rpx;
 				display: flex;
 				align-items: center;
                 text {
@@ -109,9 +189,24 @@
 					font-weight: 400;
                 }
             }
-            .fp_list_item_right v-deep {
+            .fp_list_item_right::v-deep {
                 display: flex;
-                align-items: center;
+				flex-direction: column;
+				.u-checkbox-group--row {
+					display: flex;
+					flex-direction: column;
+				}
+				.u-icon__icon {
+					margin-right: 0 !important;
+				}
+				.fp_list_item_right_dis {
+					display: flex;
+					align-items: center;
+					margin-bottom: 20rpx;
+					&:last-child {
+						margin-bottom: 0 !important;
+					}
+				}
                 .wu {
                     width: 100%;
                     margin: 30rpx 0;
@@ -123,34 +218,18 @@
                         color: black;
                     }
                 }
-                .van-checkbox {
-                    margin-right: 5rpx !important;
-                    margin-top: 10rpx !important;
-                    &:nth-child(1) {
-                        margin-top: 0 !important;
-                    }
-                    &:nth-child(2) {
-                        margin-top: 0 !important;
-                    }
-                    &:nth-child(3) {
-                        margin-top: 0 !important;
-                    }
-                    .van-checkbox__label {
-                        color: black !important;
-                    }
-                }
                 .black {
                     color: black !important;
                 }
-                input {
-                    width: 180rpx;
-                    height: 60rpx;
-                    border-radius: 8rpx;
-                    border: 1rpx solid #E5E5E5;
-                    padding: 0 30rpx;
-                    text-align: right;
-                    font-size: 25rpx;
-                }
+                // input {
+                //     width: 180rpx;
+                //     height: 60rpx;
+                //     border-radius: 8rpx;
+                //     border: 2rpx solid #E5E5E5;
+                //     padding: 0 30rpx;
+                //     text-align: right;
+                //     font-size: 25rpx;
+                // }
                 text {
                     font-size: 28rpx;
                     font-weight: 400;
@@ -181,9 +260,12 @@
                     font-weight: 400;
                 }
             }
-            .fp_list_item_right {
+            .fp_list_item_right::v-deep {
                 display: flex;
                 align-items: center;
+				.u-icon__icon {
+					margin-right: 0 !important;
+				}
                 .wu {
                     text-align: center;
                     text {
@@ -194,15 +276,15 @@
                 .black {
                     color: black !important;
                 }
-                input {
-                    width: 180rpx;
-                    height: 60rpx;
-                    border-radius: 8rpx;
-                    border: 1rpx solid #E5E5E5;
-                    padding: 0 30rpx;
-                    text-align: right;
-                    font-size: 25rpx;
-                }
+                // input {
+                //     width: 180rpx;
+                //     height: 60rpx;
+                //     border-radius: 8rpx;
+                //     border: 1rpx solid #E5E5E5;
+                //     padding: 0 30rpx;
+                //     text-align: right;
+                //     font-size: 25rpx;
+                // }
                 text {
                     font-size: 28rpx;
                     font-weight: 400;

--
Gitblit v1.9.3