|
@@ -2256,6 +2256,61 @@ func (c *TaskDataController) DataGeometricScale() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// DataBatchDelete 批量删除
|
|
|
+func (c *TaskDataController) DataBatchDelete() {
|
|
|
+ T_uuid, _ := lib.GetAdminT_Uuid(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
|
|
|
+ //if !b_ {
|
|
|
+ // c.Data["json"] = lib.JSONS{Code: 201, Msg: "User_tokey Err!"}
|
|
|
+ // c.ServeJSON()
|
|
|
+ // return
|
|
|
+ //}
|
|
|
+
|
|
|
+ StartTime := c.GetString("StartTime")
|
|
|
+ _, ok := lib.TimeStrToTime(StartTime)
|
|
|
+ if !ok {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "时间格式错误!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ EndTime := c.GetString("EndTime")
|
|
|
+ _, ok = lib.TimeStrToTime(EndTime)
|
|
|
+ if !ok {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "时间格式错误!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ SN_List := strings.Split(strings.Trim(c.GetString("SN_List"), "|"), "|")
|
|
|
+
|
|
|
+ T_task_id := c.GetString("T_task_id")
|
|
|
+ Task_r, err := NatsServer.Read_Task(T_task_id)
|
|
|
+ if err != nil {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "T_task_id 错误!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if Task_r.T_collection_state == 2 {
|
|
|
+ c.Data["json"] = lib.JSONS{Code: 202, Msg: "数据采集中,请稍后!"}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range SN_List {
|
|
|
+ sn_id := strings.Split(v, ",")
|
|
|
+ if len(sn_id) != 2 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ sn, id_str := sn_id[0], sn_id[1]
|
|
|
+
|
|
|
+ Task.DeleteTaskDataByTimeRange(Task_r.T_task_id, sn, id_str, StartTime, EndTime)
|
|
|
+ }
|
|
|
+ System.Add_UserLogs_T(T_uuid, "批量删除", fmt.Sprintf("批量删除(%s)[%s|%s]", T_task_id, StartTime, EndTime), SN_List)
|
|
|
+
|
|
|
+ c.Data["json"] = lib.JSONS{200, "批量删除操作成功", nil}
|
|
|
+ c.ServeJSON()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// 存档列表
|
|
|
func (c *TaskDataController) TaskDataCopy_List() {
|
|
|
|