From 68ce9382090846dc3a03a057a18a7d09f30e45e5 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 17 十月 2025 17:39:03 +0800
Subject: [PATCH] test

---
 pages/task/add.vue |   68 ++++++++++++++++++++-------------
 1 files changed, 41 insertions(+), 27 deletions(-)

diff --git a/pages/task/add.vue b/pages/task/add.vue
index 4214475..88067f0 100644
--- a/pages/task/add.vue
+++ b/pages/task/add.vue
@@ -37,7 +37,7 @@
 					</a>
 				</view>
 				<view class="item" v-if="info.tasktype == 1">
-					<view>寰幆娆℃暟锛�/view>
+					<view>閲嶅娆℃暟锛�/view>
 					<input class="right-input" type="number" :value="info.cycleTime" :maxlength="4"
 						@input="onInputCycleTime" />
 				</view>
@@ -65,13 +65,15 @@
 							<a @click.stop="(e)=>{ clickPathwayPoint(e,index,'actionType')}">
 								{{actionTypeText(item.actionType)}}
 							</a>
-							<view v-if="item.actionType === 3">
+							<template class="time" v-if="item.actionType === 3">
 								<a @click.stop="()=>{item.wait = 0}" v-if="item.wait===undefined">
 									绛夊緟鏃堕棿
 								</a>
-								<view v-else class="time"> <input class="input" type="number" v-model="item.wait"
-										:maxlength="4" />绉�/view>
-							</view>
+								<input v-else class="input" type="number" v-model="item.wait" :maxlength="4" />
+							</template>
+							<span v-if="item.actionType === 3 && item.wait!==undefined">
+								绉�+							</span>
 						</view>
 						<template v-slot:right>
 							<view class="btn-del" @click="clickDelPathWay(index)">鍒犻櫎</view>
@@ -103,7 +105,9 @@
 <script>
 	import {
 		showToast,
-		showModal
+		showModal,
+		showError,
+		showInfo
 	} from "@/comm/utils.js"
 	import {
 		Button
@@ -131,6 +135,7 @@
 					taskGroupName: "",
 					cycleTime: 1,
 					taskButton: 0,
+					tasktype: 1
 				},
 				pathwayList: [{}],
 				pickerView: {
@@ -203,7 +208,7 @@
 					const info = await stations(this.ip)
 					this.stationList = info.station_list || []
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
 				}
 			},
 			async clickSave() {
@@ -217,6 +222,13 @@
 						showToast("鏈�鎷╀换鍔″睘鎬э紒")
 						return
 					}
+					if (!this.info.taskButton) {
+						showToast("鏈�鎷╂寜閽彿锛�)
+						return
+					}
+					uni.showLoading({
+						title: "浠诲姟鏂板涓�
+					})
 					const taskList = []
 					const task = {
 						taskGroupID: uuidv4(),
@@ -228,8 +240,13 @@
 					}
 					const taskStartTimeStamp = `${new Date().getTime()}`
 
-					this.pathwayList.forEach((item) => {
+					for (let i in this.pathwayList) {
+						const item = this.pathwayList[i]
 						if (item.stationID) {
+							if (!item.actionType) {
+								showToast("鐩爣鐐规湭閫夋嫨鎿嶄綔绫诲瀷锛�)
+								return
+							}
 							task.taskList.push({
 								stationID: item.stationID,
 								actionType: item.actionType || 0,
@@ -245,12 +262,15 @@
 
 							})
 						}
-					})
+
+					}
+
 					if (taskList.length == 0) {
-						showToast("鐩爣鐐规湭閫夋嫨绔欏彴锛�)
+						showToast("蹇呴』娣诲姞鑷冲皯涓�釜鐩爣鐐癸紒")
 						return
 					}
 					await addTask(this.ip, task)
+
 					task.taskList = taskList
 					const eventChannel = this.getOpenerEventChannel();
 					eventChannel.emit('add_task', task);
@@ -258,7 +278,9 @@
 						delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
 					})
 				} catch (ex) {
-					this.showError(ex)
+					showError(ex)
+				} finally {
+					uni.hideLoading()
 				}
 			},
 			clickCancel() {
@@ -280,7 +302,7 @@
 				}
 				if (flag) {
 
-					showModal(`褰撳墠缂栬緫鐨勫唴瀹瑰皢涓嶄細琚繚瀛榒, "纭畾瑕侀�鍑虹紪杈戝悧?").then((res) => {
+					showModal(`褰撳墠缂栬緫鐨勫唴瀹瑰皢涓嶄細琚繚瀛榒, "纭畾瑕侀�鍑虹紪杈戝悧?", true, "纭畾", "鍙栨秷").then((res) => {
 						if (res) {
 							uni.navigateBack({
 								delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
@@ -349,7 +371,7 @@
 				const item = this.pathwayList[index]
 				if (type == "stationID") {
 
-					const list = this.stationLst(item.stationID)
+					const list = this.stationList
 					let index2 = 0
 					if (list.length > 0) {
 						if (item.stationID) {
@@ -468,13 +490,7 @@
 			closeMenu() {
 				this.$refs.refPopupMenu.close()
 			},
-			showError(ex) {
-				let exStr = JSON.stringify(ex)
-				if (exStr == "{}")
-					exStr = ex
-				let tip = typeof ex.msg == "string" ? ex.msg : exStr
-				showModal(tip, "閿欒", false)
-			},
+
 
 		}
 	}
@@ -515,6 +531,7 @@
 				padding: 20rpx 10rpx;
 				display: flex;
 				flex-direction: row;
+				align-items: center;
 
 				.right {
 					flex: 1;
@@ -545,15 +562,12 @@
 					margin-left: 20rpx;
 				}
 
-				.time {
-					display: flex;
-					flex-direction: row;
+				.input {
 					margin-left: 20rpx;
-
-					.input {
-						width: 75rpx;
-					}
+					margin-right: 10rpx;
+					width: 75rpx;
 				}
+
 			}
 
 			.btn-del {

--
Gitblit v1.9.1