From 2af5f043b60c1f7ac38ecccc8f5bf44743134325 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:08:00 +0800
Subject: [PATCH] test

---
 pages/task/update.vue |  133 +++++++++++++++++++++++++-------------------
 1 files changed, 76 insertions(+), 57 deletions(-)

diff --git a/pages/task/update.vue b/pages/task/update.vue
index d40a729..bafd66b 100644
--- a/pages/task/update.vue
+++ b/pages/task/update.vue
@@ -1,64 +1,67 @@
 <template>
 	<view class="pages-task-update">
-		<uni-nav-bar :fixed="true" status-bar right-text="" left-text="" leftWidth="72rpx" rightWidth="72rpx"
-			:title="navigationBarTitle">
+		<uni-nav-bar :fixed="true" status-bar :title="navigationBarTitle" @clickLeft="clickCancel"
+			@clickRight="clickSave">
 			<view class="uni-navbar-container-inner">
 				<text class="uni-nav-bar-text">{{navigationBarTitle }}</text>
 			</view>
 			<template v-slot:right>
-				<view class="uni-navbar-btn-text" @click="clickSave">
+				<view class="uni-navbar-btn-text">
 					<a class="uni-nav-bar-right-text">
-						淇濆瓨
+						{{translate('save')}}
 					</a>
 				</view>
 
 			</template>
 			<template v-slot:left>
 				<view class="uni-navbar-btn-text">
-					<a @click="clickCancel" class="uni-nav-bar-left-text">
-						鍙栨秷
+					<a class="uni-nav-bar-left-text">
+						{{translate('cancel')}}
 					</a>
 				</view>
 
 			</template>
 		</uni-nav-bar>
 		<view class="content">
-			<view class="header">浠诲姟灞炴�</view>
+			<view class="header">{{translate("task_properties")}}</view>
 			<view class="group">
 				<view class="item">
-					<view>鍚嶇О锛�/view>
-					<input class="right-input" placeholder="杈撳叆浠诲姟鍚嶇О" v-model="form.taskGroupName" />
+					<view>{{translate("name")}}</view>
+					<input class="right-input" :placeholder="translate('input_task_name')"
+						v-model="form.taskGroupName" />
 				</view>
 				<view class="item">
-					<view>灞炴�锛�/view>
-					<view class="right" v-if="form.tasktype > 0">{{form.tasktype ==1 ? '鍥哄畾':'涓存椂'}}</view>
-					<view class="right" v-else>閫夋嫨灞炴�</view>
+					<view>{{translate("properties")}}</view>
+					<view class="right" v-if="form.tasktype > 0">
+						{{form.tasktype ==1 ? translate("fixed"):translate("temporary")}}
+					</view>
+					<view class="right" v-else>{{translate("select_properties")}}</view>
 					<a @click="clickType">
 						<uni-icons class="icon" type="right" size="20"></uni-icons>
 					</a>
 				</view>
 				<view class="item" v-if="form.tasktype == 1">
-					<view>閲嶅娆℃暟锛�/view>
+					<view>{{translate("number_repetitions")}}</view>
 					<input class="right-input" type="number" :value="form.cycleTime" :maxlength="4"
 						@input="onInputCycleTime" />
 				</view>
 				<view class="item">
-					<view>鎸夐挳鍙凤細</view>
-					<view class="right">{{form.taskButton ?form.taskButton:""}}</view>
+					<view>{{translate("button_number")}}</view>
+					<view class="right">{{form.taskButton ?form.taskButton:translate("select_button_number")}}</view>
 					<a @click="clickTaskButton">
 						<uni-icons class="icon" type="right" size="20"></uni-icons>
 					</a>
 				</view>
 			</view>
-			<view class="header">浠诲姟璺嚎</view>
+			<view class="header">{{translate("task_route")}}</view>
 			<view class="group">
 				<view class="list">
 					<view class="list-item" v-for="(item,index) in pathwayList" :key="index" :auto-close="true">
 						<view class="item">
-							<view>鐩爣鐐箋{index+1}}锛�/view>
+							<view>{{translate("target_point") + " "}}{{index+1}}锛�/view>
 							<view class="right"></view>
 							<a @click.stop="(e)=>{ this.clickPathwayPoint(e,index,'stationID')}">
-								{{item.dest?.stationID ?item.dest?.name : "鐩爣鐐�}}
+								{{item.dest?.stationID ?item.dest?.name : translate("target_point")}}
 
 							</a>
 							<a @click.stop="(e)=>{ clickPathwayPoint(e,index,'actionType')}">
@@ -66,12 +69,12 @@
 							</a>
 							<template class="time" v-if="item.actionType === 3">
 								<a @click.stop="()=>{item.wait = 0}" v-if="item.wait===undefined">
-									绛夊緟鏃堕棿
+									{{translate("wait_time")}}
 								</a>
 								<input v-else class="input" type="number" v-model="item.wait" :maxlength="4" />
 							</template>
 							<span v-if="item.actionType === 3 && item.wait!==undefined">
-								绉�+								{{translate("second")}}
 							</span>
 						</view>
 					</view>
@@ -123,7 +126,7 @@
 			return {
 				indicatorStyle: `height: 75rpx;`,
 				ip: '',
-				navigationBarTitle: '鏇存柊浠诲姟',
+				navigationBarTitle: this.translate("update_task"),
 				info: {
 
 				},
@@ -132,7 +135,7 @@
 					taskGroupName: "",
 					cycleTime: 1,
 					taskButton: 0,
-					tasktype: 0,
+					tasktype: 1,
 					taskList: []
 				},
 				pathwayList: [],
@@ -146,18 +149,22 @@
 				windowSize: {},
 				isEditContent: false,
 				actionList: [{
-					name: "瀵艰埅",
-					type: 1,
-				}, {
-					name: "鍙栬揣",
-					type: 2,
-				}, {
-					name: "鍗歌揣",
-					type: 3,
-				}, {
-					name: "浜哄伐",
-					type: 4,
-				}]
+						name: this.translate("navigation"),
+						type: 1,
+					},
+					// {
+					// 	name: "鍙栬揣",
+					// 	type: 2,
+					// }, 
+					{
+						name: this.translate("auto_unload"),
+						type: 3,
+					},
+					// {
+					// 	name: "浜哄伐",
+					// 	type: 4,
+					// },
+				],
 			}
 		},
 		computed: {
@@ -167,7 +174,7 @@
 		onLoad(option) {
 
 			const _this = this
-			this.navigationBarTitle = option.title || "鏇存柊浠诲姟"
+			this.navigationBarTitle = option.title || this.translate("update_task")
 			this.ip = option.ip || ""
 			if (option.task) {
 				const info = JSON.parse(option.task)
@@ -186,7 +193,7 @@
 					this.pathwayList.push({
 						actionType: item.actionType,
 						dest: item.dest || {},
-						wait:  parseInt(item.wait) || 0,
+						wait: parseInt(item.wait) || 0,
 						taskID: item.taskID,
 						taskStartTimeStamp: item.taskStartTimeStamp,
 					})
@@ -232,22 +239,22 @@
 					const info = await stations(this.ip)
 					this.stationList = info.station_list || []
 				} catch (ex) {
-					showError(ex)
+					showError(ex, this.translate('error'))
 				}
 			},
 			async clickSave() {
 				try {
 					const name = this.form.taskGroupName.trim()
 					if (!name) {
-						showToast("鏈緭鍏ヤ换鍔″悕绉帮紒")
+						showToast(this.translate("input_task_name"))
 						return
 					}
 					if (!this.form.tasktype) {
-						showToast("鏈�鎷╀换鍔″睘鎬э紒")
+						showToast(this.translate("select_task_properties"))
 						return
 					}
 					uni.showLoading({
-						title: "浠诲姟鏇存柊涓�
+						title: this.translate("updating_task")
 					})
 					const task = {
 						taskGroupID: this.form.taskGroupID,
@@ -263,7 +270,7 @@
 						const item2 = this.info.taskList[i]
 						const item = this.pathwayList[i]
 						let flag = false
-						
+
 						if (item?.actionType != item2.actionType) {
 							flag = true
 						} else if (item?.dest?.stationID != item2.dest?.stationID) {
@@ -305,7 +312,7 @@
 						delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
 					})
 				} catch (ex) {
-					showError(ex)
+					showError(ex, this.translate('error'))
 				} finally {
 					uni.hideLoading()
 				}
@@ -343,7 +350,13 @@
 
 
 				if (flag) {
-					showModal(`褰撳墠缂栬緫鐨勫唴瀹瑰皢涓嶄細琚繚瀛榒, "纭畾瑕侀�鍑虹紪杈戝悧?", true, "纭畾", "鍙栨秷").then((res) => {
+					showModal({
+						title: this.translate(
+							"ask_exit_task_edit"),
+						content: `${this.translate('current_edited_content_will_be_deleted')}`,
+						confirmText: this.translate('ok'),
+						cancelText: this.translate('cancel'),
+					}).then((res) => {
 						if (res) {
 							uni.navigateBack({
 								delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
@@ -396,10 +409,10 @@
 					if (curIndex > -1) {
 						return this.actionList[curIndex].name
 					} else {
-						return "鎿嶄綔"
+						return this.translate("task_action")
 					}
 				} else {
-					return "鎿嶄綔"
+					return this.translate("task_action")
 				}
 			},
 
@@ -471,10 +484,12 @@
 				this.pickerView = {
 					type: "type",
 					list: [{
-						name: "鍥哄畾"
-					}, {
-						name: "涓存椂"
-					}],
+							name: this.translate("fixed")
+						},
+						// {
+						// 	name: this.translate("temporary")
+						// },
+					],
 					value: [this.form.tasktype - 1],
 					top: e.target.offsetTop + 30,
 					right: 0,
@@ -507,7 +522,7 @@
 				try {
 					if (this.pathwayList.length == 1) {
 
-						showToast("蹇呴』鏈変竴涓洰鏍囩偣")
+						showToast(this.translate("at_least_one_target_point_added"))
 						return
 					}
 					if (item.taskID) {
@@ -528,7 +543,7 @@
 					})
 
 				} catch (ex) {
-					showError(ex)
+					showError(ex, this.translate('error'))
 				}
 
 			},
@@ -559,7 +574,10 @@
 			closeMenu() {
 				this.$refs.refPopupMenu.close()
 			},
-
+			translate(t) {
+				if (typeof this.$t == "function") return this.$t(`page.${t}`)
+				else return t;
+			},
 
 		}
 	}
@@ -609,6 +627,7 @@
 					padding-right: 5px;
 
 				}
+
 				.right-input {
 					text-align: right;
 					flex: 1;
@@ -628,11 +647,11 @@
 					margin-left: 20rpx;
 				}
 
-					.input {
-									margin-left: 20rpx;
-									width: 75rpx;
-									margin-right: 10rpx;
-								}
+				.input {
+					margin-left: 20rpx;
+					width: 75rpx;
+					margin-right: 10rpx;
+				}
 			}
 
 			.btn-del {

--
Gitblit v1.9.1