Browse Source

ADD:添加修改交付审核状态菜单

zoie 3 months ago
parent
commit
1f7d470d2e
5 changed files with 63 additions and 5 deletions
  1. 9 0
      controllers/DeviceClass.go
  2. 33 0
      controllers/Task.go
  3. 19 4
      controllers/TaskData.go
  4. 1 1
      models/Task/Task.go
  5. 1 0
      routers/Task.go

+ 9 - 0
controllers/DeviceClass.go

@@ -443,6 +443,15 @@ func (c *DeviceClassController) List_Add() {
 			continue
 		}
 
+		if  !is {
+			_, is = Device.Read_DeviceClassList_T_class_T_id(T_class, T_id)
+			if is {
+				errList2 = append(errList2, sn_id)
+				continue
+			}
+		}
+
+
 		var pdf Certificate.CertificatePdf
 		//pdfList, _ := Certificate.Read_CertificatePdf_Newest(T_sn)
 		pdfList, _ := Certificate.Read_CertificatePdf_T_layout_no(T_id, "")

+ 33 - 0
controllers/Task.go

@@ -289,6 +289,39 @@ func (c *TaskController) UpCollectionState() {
 	c.ServeJSON()
 	return
 }
+func (c *TaskController) UpDeliveryState() {
+	// 验证登录 User_is, User_r
+	User_r, User_is := Account.Verification_Admin(c.Ctx.GetCookie("User_tokey"), c.GetString("User_tokey"))
+	if !User_is {
+		c.Data["json"] = lib.JSONS{Code: 201, Msg: "请重新登录!"}
+		c.ServeJSON()
+		return
+	}
+
+	T_delivery_state, _ := c.GetInt("T_delivery_state")
+
+	T_task_id := c.GetString("T_task_id")
+	r, is := Task.Read_Task(T_task_id)
+	if !is {
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "Id 错误!"}
+		c.ServeJSON()
+		return
+	}
+
+	r.T_delivery_state = T_delivery_state
+
+	if !Task.Update_Task(r, "T_delivery_state") {
+		c.Data["json"] = lib.JSONS{Code: 202, Msg: "修改失败!"}
+		c.ServeJSON()
+		return
+	}
+	// 添加任务操作日志
+	Task.Add_TaskLogs_T(User_r.T_uuid, T_task_id, "任务管理", "修改交付审核状态", r)
+	System.Add_UserLogs_T(User_r.T_uuid, "任务管理", "修改交付审核状态", r)
+	c.Data["json"] = lib.JSONS{Code: 200, Msg: "ok!"}
+	c.ServeJSON()
+	return
+}
 
 // 修改-
 func (c *TaskController) Up() {

+ 19 - 4
controllers/TaskData.go

@@ -161,6 +161,10 @@ func (c *TaskDataController) TaskData_List() {
 	Time_end := c.GetString("Time_end")
 	T_sn := c.GetString("T_sn")
 	T_id := c.GetString("T_id")
+	T_layout_no := c.GetString("T_layout_no") // 替换之前的T_id
+	if len(T_layout_no) > 0 {
+		T_id = T_layout_no
+	}
 
 	T_task_id := c.GetString("T_task_id")
 	Task_r, is := Task.Read_Task(T_task_id)
@@ -223,6 +227,10 @@ func (c *TaskDataController) UserTaskData_List() {
 	Time_end := c.GetString("Time_end")
 	T_sn := c.GetString("T_sn")
 	T_id := c.GetString("T_id")
+	T_layout_no := c.GetString("T_layout_no") // 替换之前的T_id
+	if len(T_layout_no) > 0 {
+		T_id = T_layout_no
+	}
 
 	T_task_id := c.GetString("T_task_id")
 	Task_r, is := Task.Read_Task(T_task_id)
@@ -1096,7 +1104,7 @@ func (c *TaskDataController) TaskData_Pdf(Time_start, Time_end, T_task_id, T_sn,
 		y += 30
 
 		var textH float64 = 20 // if text height is 25px.
-		if y > 790 {
+		if y >= 790 {
 			addStampImage(pdf, 455, y-150)
 			pdf.AddPage()
 			y = 30
@@ -1237,13 +1245,13 @@ func (c *TaskDataController) TaskData_Pdf(Time_start, Time_end, T_task_id, T_sn,
 			y = 20
 		}
 
-		var StampImageX float64
+		StampImageX := x
 		for j, t := range timeList2 {
 			if j > 0 {
 				y += 20
 			}
-			x = 10
-			if y > 790 {
+
+			if y >= 790 {
 				addStampImage(pdf, StampImageX-130, y-130)
 				pdf.AddPage()
 				y = pdf.GetY()
@@ -1260,6 +1268,7 @@ func (c *TaskDataController) TaskData_Pdf(Time_start, Time_end, T_task_id, T_sn,
 				y += 20
 				x = 10
 			}
+			x = 10
 			if y == 20 {
 				w = 120.7
 				lib.RectFillColor(pdf, "时间", 12, x, y, w, 20, 255, 255, 255, lib.AlignCenter, lib.ValignMiddle)
@@ -1339,6 +1348,12 @@ func (c *TaskDataController) TaskData_Pdf(Time_start, Time_end, T_task_id, T_sn,
 }
 func addStampImage(pdf *gopdf.GoPdf, x, y float64) {
 	imagePath := "./static/commonSeal.jpg"
+	if x < 10 {
+		x = 10
+	}
+	if y < 20 {
+		y = 20
+	}
 	err := pdf.Image(imagePath, x, y, &gopdf.Rect{W: 123, H: 128.6})
 	if err != nil {
 		log.Print(err.Error())

+ 1 - 1
models/Task/Task.go

@@ -428,7 +428,7 @@ func Read_Task_List(T_uuid, T_admin string, T_name string, userMap, adminMap map
 	}
 	cond := orm.NewCondition()
 	//cond1 := cond.And("T_name__icontains", T_name).And("T_State", 1)
-	cond1 := cond.And("T_name__icontains", T_name).And("T_State", 1)
+	cond1 := cond.AndCond(cond.Or("T_name__icontains", T_name).Or("T_task_id", T_name)).And("T_State", 1)
 	if len(T_uuid) > 0 {
 		cond1 = cond1.And("T_uuid", T_uuid)
 

+ 1 - 0
routers/Task.go

@@ -15,6 +15,7 @@ func init() {
 	beego.Router("/Task/Up", &controllers.TaskController{}, "*:Up")                               // 编辑任务
 	beego.Router("/Task/Del", &controllers.TaskController{}, "*:Del")                             // 删除任务
 	beego.Router("/Task/UpCollectionState", &controllers.TaskController{}, "*:UpCollectionState") // 修改任务状态
+	beego.Router("/Task/UpDeliveryState", &controllers.TaskController{}, "*:UpDeliveryState") // 修改交付审核状态
 	beego.Router("/Task/AddData_Tool", &controllers.TaskController{}, "*:AddData_Tool")           // 1.0 添加任务数据
 
 	// 日志