cuiqian2004
4 天以前 2af5f043b60c1f7ac38ecccc8f5bf44743134325
pages/task/infos/task-item.vue
@@ -44,7 +44,7 @@
      <view class="item-sub" v-if="showTaskRunning && taskIsRun">
         <view class="sub-item" v-for="(item,index) in taskStatusList" :key="item.taskID">
            <text class="text">{{getStatusText(item.status)}}</text>
            <text class="text">{{"目标点"+(index+ 1)}}</text>
            <text class="text">{{translate("target_point" ) + " "+(index+ 1)}}</text>
            <text class="text">{{getDestText(item)}}</text>
            <text class="text">{{getActionText(item)}}</text>
         </view>
@@ -105,13 +105,37 @@
         },
         taskCycleTime() {
            if (this.taskIsRun)
               return `第${this.taskStatus?.curCycleNumber || 0}/${this.taskStatus?.cycleTotalNumber || 0}次`
            if (this.taskIsRun) {
               const time = this.taskStatus?.curCycleNumber || 0
               let timeStr = `${time}${this.translate("the_th_suffix")}`
               if (time % 10 == 1) {
                  timeStr = `${time}${this.translate("the_st_suffix")}`
               } else if (time % 10 == 2) {
                  timeStr = `${time}${this.translate("the_nd_suffix")}`
               } else if (time % 10 == 3) {
                  timeStr = `${time}${this.translate("the_rd_suffix")}`
               }
               return this.translate("time_number", [timeStr,
                  `${this.taskStatus?.cycleTotalNumber || 0}`
               ])
            } else {
               const time = this.taskData.cycleTime || 0
               let timeStr = ""
               if(time == 1)
               {
                  timeStr = this.translate("repeat_once")
               }
               else if(time == 2)
               {
                  timeStr = this.translate("repeat_twice")
               }
            else
               return `重复${this.taskData.cycleTime || 0}次`
               {
                  timeStr = this.translate("repeat_times", [`${time}`])
               }
               return timeStr
            }
         },
         taskIsRun() {
            if (this.taskStatus?.taskGroupID == this.taskData.taskGroupID) {
@@ -197,19 +221,19 @@
         },
         getStatusText(status) {
            var statusText = "未知"
            var statusText = this.translate("unknown")
            if (!status) {
               statusText = "未开始"
               statusText = this.translate("not_started")
            } else if (status === 5) {
               statusText = "强制完成"
               statusText = this.translate("mandatory_completion")
            } else if (status === 4) {
               statusText = "异常结束"
               statusText = this.translate("abnormal_termination")
            } else if (status === 3) {
               statusText = "已取消"
               statusText = this.translate("canceled")
            } else if (status === 2) {
               statusText = "已完成"
               statusText = this.translate("completed")
            } else if (status === 1) {
               statusText = "执行中"
               statusText = this.translate("in_progress")
            }
            return statusText
         },
@@ -224,21 +248,35 @@
            const index = this.taskData.taskList.findIndex((a) => a.taskID == item.taskID)
            if (index > -1) {
               const task = this.taskData.taskList[index]
               var actionText = "未知"
               var actionText = this.translate("unknown")
               if (task.actionType === 1) {
                  actionText = "导航"
               } else if (task.actionType === 2) {
                  actionText = "取货"
               } else if (task.actionType === 3) {
                  actionText = `卸货 等待${task.wait || 0}秒`
               } else if (task.actionType === 4) {
                  actionText = "人工"
                  actionText = this.translate("navigation")
               }
               // else if (task.actionType === 2) {
               //    actionText = "取货"
               // }
               else if (task.actionType === 3) {
                  actionText =
                     `${this.translate("auto_unload")}:${this.translate("wait")}:${task.wait || 0}${this.translate("second")}`
               }
               // else if (task.actionType === 4) {
               //    actionText = "人工"
               // }
               return actionText
            }
            return ""
         },
         translate(t, values) {
            if (typeof this.$t == "function") {
               const message = this.$t(`page.${t}`)
               if (values) {
                  return message.replace(/{(\d+)}/g, (match, index) => {
                     const value = values[index]
                     return value !== undefined ? value : match
                  })
               } else return message
            } else return t;
         },
      }
   }
</script>
@@ -268,6 +306,7 @@
            border-bottom: 1px solid #ddd;
            display: flex;
            flex-direction: row;
            .text {
               color: gray;
               padding: 10rpx;