Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master' into master

zangkai před 5 roky
rodič
revize
f9f2bc2b4d
37 změnil soubory, kde provedl 1612 přidání a 582 odebrání
  1. 14 0
      backend/src/dashoo.cn/modi_webapi/app/api/course/detail/detail.go
  2. 117 0
      backend/src/dashoo.cn/modi_webapi/app/api/duty/detail.go
  3. 114 99
      backend/src/dashoo.cn/modi_webapi/app/api/duty/duty.go
  4. 26 0
      backend/src/dashoo.cn/modi_webapi/app/common/utils.go
  5. 1 14
      backend/src/dashoo.cn/modi_webapi/app/model/course/detail/detail.go
  6. 1 1
      backend/src/dashoo.cn/modi_webapi/app/model/course/detail/detail_entity.go
  7. 14 0
      backend/src/dashoo.cn/modi_webapi/app/model/duty/detail/detail.go
  8. 71 0
      backend/src/dashoo.cn/modi_webapi/app/model/duty/detail/detail_entity.go
  9. 369 0
      backend/src/dashoo.cn/modi_webapi/app/model/duty/detail/detail_model.go
  10. 15 0
      backend/src/dashoo.cn/modi_webapi/app/model/duty/duty.go
  11. 11 22
      backend/src/dashoo.cn/modi_webapi/app/model/duty/duty_entity.go
  12. 1 1
      backend/src/dashoo.cn/modi_webapi/app/model/duty/duty_model.go
  13. 7 16
      backend/src/dashoo.cn/modi_webapi/app/service/course/detail/detail.go
  14. 88 0
      backend/src/dashoo.cn/modi_webapi/app/service/duty/detail.go
  15. 90 14
      backend/src/dashoo.cn/modi_webapi/app/service/duty/duty.go
  16. 4 4
      backend/src/dashoo.cn/modi_webapi/router/router.go
  17. 125 15
      doc/系统设计/数据库设计/data.pdman.json
  18. 2 1
      frontend_web/.env.development
  19. 5 10
      frontend_web/src/router/routes.js
  20. 15 33
      frontend_web/src/views/course/components/courseInfoDialog.vue
  21. 26 26
      frontend_web/src/views/course/detail/components/command.vue
  22. 71 35
      frontend_web/src/views/course/detail/editForm.vue
  23. 280 216
      frontend_web/src/views/course/detail/index.vue
  24. 82 28
      frontend_web/src/views/course/index.vue
  25. binární
      frontend_web/src/views/demo/page1/image/backg.png
  26. binární
      frontend_web/src/views/demo/page1/image/background.png
  27. binární
      frontend_web/src/views/demo/page1/image/button.png
  28. binární
      frontend_web/src/views/demo/page1/image/footer_logo.png
  29. binární
      frontend_web/src/views/demo/page1/image/logo.png
  30. binární
      frontend_web/src/views/demo/page1/image/title.png
  31. 49 7
      frontend_web/src/views/demo/page1/index.vue
  32. 2 2
      frontend_web/src/views/instrument/components/instrumentadd.vue
  33. 2 2
      frontend_web/src/views/instrument/components/instrumentedit.vue
  34. 0 13
      frontend_web/src/views/instrument/index.vue
  35. 0 12
      frontend_web/src/views/instrument/maintainlog/index.vue
  36. 10 11
      frontend_web/src/views/sysadmin/item/index.vue
  37. binární
      frontend_web/src/views/system/index/image/logo_nmg.png

+ 14 - 0
backend/src/dashoo.cn/modi_webapi/app/api/course/detail/detail.go

@@ -7,6 +7,8 @@ import (
 	"dashoo.cn/modi_webapi/library/request"
 	"github.com/gogf/gf/net/ghttp"
 	"github.com/gogf/gf/os/glog"
+	"strconv"
+	"strings"
 )
 
 // 课程详情管理API
@@ -71,6 +73,18 @@ func (c CourseDetailController) Save(r *ghttp.Request) {
 	if err != nil {
 		response.Json(r, -1, err.Error())
 	}
+	Time := ""
+	// 多选节次转存为字符串
+	timeIds := r.GetInts("Time")
+	if len(timeIds) > 0 {
+		TimeArray := make([]string, len(timeIds))
+		for i, arg := range timeIds {
+			TimeArray[i] = strconv.Itoa(arg)
+		}
+
+		Time = strings.Join(TimeArray, ",")
+	}
+	entity.Time = Time
 	// 获取操作人
 	realName := r.GetParamVar("realname").String()
 

+ 117 - 0
backend/src/dashoo.cn/modi_webapi/app/api/duty/detail.go

@@ -0,0 +1,117 @@
+package duty
+
+import (
+	"dashoo.cn/modi_webapi/app/common"
+	"dashoo.cn/modi_webapi/app/model/duty/detail"
+	detailService "dashoo.cn/modi_webapi/app/service/duty"
+	"dashoo.cn/modi_webapi/library/request"
+	"dashoo.cn/modi_webapi/library/response"
+	"github.com/gogf/gf/net/ghttp"
+)
+
+// 值周详情控制器
+type DetailController struct {
+}
+
+// 分页查询
+func (c *DetailController) GetPageList(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	page := request.GetPageInfo(r)
+	// 初始化service
+	service, err := detailService.NewDetailService(tenant)
+	if err != nil {
+		response.Json(r, 1, err.Error())
+	}
+
+	pageInfo := common.PageInfo{
+		Current:   page.Current,
+		PagesSize: page.Size,
+	}
+
+	selectPageReq := common.SelectPageReq{
+		Tenant: tenant,
+		Page:   &pageInfo,
+		Order:  r.GetString("order"),
+	}
+
+	if dutyList, total, err := service.GetPageList(&selectPageReq); err != nil {
+		response.Json(r, -1, err.Error())
+	} else {
+		var records response.PagedRecords
+		records.Current = page.Current
+		records.Size = page.Size
+		records.Total = total
+		records.Records = dutyList
+		response.Json(r, 0, "ok", records)
+	}
+}
+
+// 添加值班
+func (c *DetailController) AddDetail(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	var entity *detail.Entity
+	// 赋值并校验参数
+	if err := r.Parse(&entity); err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	// 初始化课程详情service
+	service, err := detailService.NewDetailService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	// 获取操作人
+	realName := r.GetParamVar("realname").String()
+	entity.CreatedBy = realName
+	if newId, err := service.Add(entity); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		response.Json(r, 0, "新增成功", newId)
+	}
+
+}
+
+// 获取详情
+func (c *DetailController) GetDetailById(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	Id := r.GetInt("Id")
+	// 初始化课程详情service
+	service, err := detailService.NewDetailService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	if duty, err := service.GetDetailById(Id); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		response.Json(r, 0, "ok", duty)
+	}
+
+}
+
+// 更新
+func (c *DetailController) UpdateDetail(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	var entity *detail.Entity
+	// 赋值并校验参数
+	if err := r.Parse(&entity); err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	// 初始化课程详情service
+	service, err := detailService.NewDetailService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	// 获取操作人
+	realName := r.GetParamVar("realname").String()
+	entity.UpdatedBy = realName
+
+	if detail, err := service.Save(entity); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		response.Json(r, 0, "更新成功", detail)
+	}
+
+}

+ 114 - 99
backend/src/dashoo.cn/modi_webapi/app/api/duty/duty.go

@@ -1,139 +1,154 @@
 package duty
 
 import (
-	"dashoo.cn/modi_webapi/app/service/duty"
+	"dashoo.cn/modi_webapi/app/common"
+	"dashoo.cn/modi_webapi/app/model/duty"
+	dutyService "dashoo.cn/modi_webapi/app/service/duty"
 	"dashoo.cn/modi_webapi/library/request"
 	"dashoo.cn/modi_webapi/library/response"
-	"fmt"
 	"github.com/gogf/gf/net/ghttp"
-	"github.com/gogf/gf/os/gtime"
-	"github.com/gogf/gf/util/gvalid"
 )
 
-type Controller struct {
+type DutyController struct {
 }
-//  获取值班管理列表
-func (c *Controller) GetAllDuty(r *ghttp.Request){
-	page := request.GetPageInfo(r)
-	where := ""
 
-	if year := r.GetInt("Year"); year != 0 {
-		if where == ""{
-			where = fmt.Sprintf(" Year = %v", year)
-		} else {
-			where += fmt.Sprintf(" AND Year = %v", year)
-		}
+// 分页查询
+func (c *DutyController) GetPageList(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	page := request.GetPageInfo(r)
+	// 初始化service
+	service, err := dutyService.NewDutyService(tenant)
+	if err != nil {
+		response.Json(r, 1, err.Error())
+	}
+	pageInfo := common.PageInfo{
+		Current:   page.Current,
+		PagesSize: page.Size,
 	}
 
-	if term := r.GetString("Term"); term != ""{
-		if where == ""{
-			where = fmt.Sprintf(" Term LIKE '%%%v%%'", term)
-		} else {
-			where += fmt.Sprintf(" AND Term LIKE '%%%v%%'", term)
-		}
+	selectPageReq := duty.SelectPageReq{
+		Title: "",
+		Year:  0,
+		Term:  0,
+		Common: common.SelectPageReq{
+			Tenant: tenant,
+			Page:   &pageInfo,
+			Order:  r.GetString("order"),
+		},
+	}
+	if Title := r.GetString("Title"); Title != "" {
+		selectPageReq.Title = Title
+	}
+	if Year := r.GetInt("Year"); Year != 0 {
+		selectPageReq.Year = Year
+	}
+	if Term := r.GetInt("Term"); Term != 0 {
+		selectPageReq.Term = Term
 	}
 
-	var result []duty.Entity
-	if err := duty.GetAllDuty(page, where, &result); err != nil{
-		if err.Error() == "sql: no rows in result set"{
-			response.Json(r, 0, "")
-			return
-		}
+	if dutyList, total, err := service.GetPageList(&selectPageReq); err != nil {
 		response.Json(r, -1, err.Error())
-	}else {
-		count, err1 := duty.FindDutyCount(where)
-		if err1 != nil {
-			response.Json(r, -1, err1.Error())
-		} else {
-			var records response.PagedRecords
-			records.Size = page.Size
-			records.Current = page.Current
-			records.Total = count
-			records.Records = result
-			response.Json(r, 0, "", records)
-		}
+	} else {
+		var records response.PagedRecords
+		records.Current = page.Current
+		records.Size = page.Size
+		records.Total = total
+		records.Records = dutyList
+		response.Json(r, 0, "ok", records)
 	}
 }
 
-//  添加一条值班信息
-func (c *Controller) AddDuty(r *ghttp.Request){
-	Duty := new(duty.Entity)
-	if err := r.Parse(Duty); err != nil {
-		// 数据验证错误
-		if v, ok := err.(*gvalid.Error); ok {
-			response.Json(r, 1, v.FirstString())
-			r.ExitAll()
-		}
-		// 其他错误
-		response.Json(r, 1, err.Error())
-		r.ExitAll()
+// 添加值班
+func (c *DutyController) AddDuty(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	var entity *duty.Entity
+	// 赋值并校验参数
+	if err := r.Parse(&entity); err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	// 初始化课程详情service
+	service, err := dutyService.NewDutyService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
 	}
+	// 获取操作人
 	realName := r.GetParamVar("realname").String()
-	currentTime := gtime.Now()
-	Duty.CreatedTime = currentTime
-	Duty.CreatedBy = realName
-	Duty.UpdatedTime = currentTime
-	Duty.UpdatedBy = realName
-
-	if result,err := duty.Insert(Duty); err != nil {
+	entity.CreatedBy = realName
+	if newId, err := service.Add(entity); err != nil {
 		response.Json(r, 1, err.Error())
 	} else {
-		var records response.PagedRecords
-		id, _ := result.LastInsertId()
-		Duty.Id = int(id)
-		records.Records = Duty
-		response.Json(r, 0, "", records)
+		response.Json(r, 0, "新增成功", newId)
 	}
+
 }
-//  获取一条值班信息
-func (c *Controller) GetOneDuty(r *ghttp.Request){
-	id := r.GetInt("id")
-	if result, err := duty.FindOne(id); err != nil {
+
+// 获取详情
+func (c *DutyController) GetDutyById(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	Id := r.GetInt("Id")
+	// 初始化课程详情service
+	service, err := dutyService.NewDutyService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	if duty, err := service.GetDutyById(Id); err != nil {
 		response.Json(r, 1, err.Error())
-		r.ExitAll()
-	}else {
-		var records response.PagedRecords
-		records.Records = result
-		response.Json(r, 0, "", records)
+	} else {
+		response.Json(r, 0, "ok", duty)
 	}
 
 }
 
-// 修改一条值班信息
-func (c *Controller) UpdateDuty(r *ghttp.Request){
-	Duty := new(duty.Entity)
-	if err := r.Parse(Duty); err != nil {
-		// 数据验证错误
-		if v, ok := err.(*gvalid.Error); ok {
-			response.Json(r, 1, v.FirstString())
-			r.ExitAll()
-		}
-		// 其他错误
-		response.Json(r, 1, err.Error())
-		r.ExitAll()
+// 更新
+func (c *DutyController) UpdateDuty(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	var entity *duty.Entity
+	// 赋值并校验参数
+	if err := r.Parse(&entity); err != nil {
+		response.Json(r, -1, err.Error())
 	}
-
+	// 初始化课程详情service
+	service, err := dutyService.NewDutyService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	// 获取操作人
 	realName := r.GetParamVar("realname").String()
-	currentTime := gtime.Now()
+	entity.UpdatedBy = realName
 
-	Duty.UpdatedTime = currentTime
-	Duty.UpdatedBy = realName
-
-	if _,err := duty.Replace(Duty); err != nil {
+	if duty, err := service.Save(entity); err != nil {
 		response.Json(r, 1, err.Error())
 	} else {
-		var records response.PagedRecords
-		records.Records = Duty
-		response.Json(r, 0, "", records)
+		response.Json(r, 0, "更新成功", duty)
 	}
+
 }
- //   删除一条值班信息
-func (c *Controller) DeleteDuty(r *ghttp.Request){
-	id := r.GetInt("id")
-	if _,err := duty.Delete(fmt.Sprintf("Id=%v", id)); err != nil{
+
+// 删除
+func (c *DutyController) DeleteDuty(r *ghttp.Request) {
+	// tenant 租户模式
+	tenant := r.Header.Get("Tenant")
+	// 详情id
+	Ids := r.GetInts("ids")
+	delIdsReq := new(common.DeleteIdsReq)
+	delUpdReq := new(common.DeleteUpdReq)
+	delIdsReq.Id = Ids
+	// 获取操作人
+	realName := r.GetParamVar("realname").String()
+	delUpdReq.UpdatedBy = realName
+	// 初始化课程详情service
+	service, err := dutyService.NewDutyService(tenant)
+	if err != nil {
+		response.Json(r, -1, err.Error())
+	}
+	if err := service.DeleteById(delIdsReq, delUpdReq); err != nil {
 		response.Json(r, 1, err.Error())
-		r.ExitAll()
 	} else {
-		response.Json(r, 0, "该记录已删除!")
+		response.Json(r, 0, "删除成功")
 	}
+
 }

+ 26 - 0
backend/src/dashoo.cn/modi_webapi/app/common/utils.go

@@ -2,6 +2,7 @@ package common
 
 import (
 	"bytes"
+	"github.com/gogf/gf/os/gtime"
 	"strings"
 )
 
@@ -55,3 +56,28 @@ func UnMarshal(name string) string {
 	s := strings.ToLower(buf.String())
 	return s
 }
+
+// 分页请求
+type PageInfo struct {
+	Current   int `protobuf:"varint,1,opt,name=current,proto3" json:"current,omitempty"`
+	PagesSize int `protobuf:"varint,2,opt,name=pages_size,json=pagesSize,proto3" json:"pages_size,omitempty"`
+}
+
+type DeleteIdsReq struct {
+	Id []int // 批量删除,id以逗号隔开
+}
+
+// 删除详情请求
+type DeleteUpdReq struct {
+	IsDel       int         `orm:"isDel"`       // 是否删除 0未删除 1已删除
+	UpdatedBy   string      `orm:"UpdatedBy"`   // 更新人
+	UpdatedTime *gtime.Time `orm:"UpdatedTime"` // 更新时间
+}
+
+// 搜索请求
+type SelectPageReq struct {
+	Tenant string    `protobuf:"bytes,1,opt,name=tenant,proto3" json:"tenant,omitempty"`
+	Page   *PageInfo `protobuf:"bytes,3,opt,name=page" json:"page,omitempty"`
+	Prop   string    `json:prop`
+	Order  string    `json:order`
+}

+ 1 - 14
backend/src/dashoo.cn/modi_webapi/app/model/course/detail/detail.go

@@ -21,26 +21,13 @@ type PageInfo struct {
 
 type SelectPageReq struct {
 	Tenant     string    `protobuf:"bytes,1,opt,name=tenant,proto3" json:"tenant,omitempty"`
-	CourseName string    `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
+	CourseName string    `protobuf:"bytes,2,opt,name=CourseName,proto3" json:"CourseName,omitempty"`
 	Page       *PageInfo `protobuf:"bytes,3,opt,name=page" json:"page,omitempty"`
 	CourseId   int       `protobuf:"varint,4,opt,name=CourseId,json=CourseId,proto3" json:"CourseId,omitempty"`
 	Prop       string    `json:prop`
 	Order      string    `json:order`
 }
 
-// 查询信息
-type SearchEntity struct {
-	Id          int         `xorm:"not null pk autoincr INT(10)"`
-	CourseId    int         `xorm:"INT(10)"`     // 课程ID
-	CourseName  string      `xorm:"VARCHAR(32)"` // 课程名
-	Teacher     int         `xorm:"INT(10)"`     // 授课老师
-	TeacherName string      `xorm:"VARCHAR(32)"` // 授课教师
-	Local       int         `xorm:"INT(10)"`     // 实验地点
-	Num         int         `xorm:"INT(10)"`     // 人数
-	Status      int         `xorm:"INT(10)"`     // 发布状态
-	CreatedTime *gtime.Time `xorm:"DATETIME"`    // 创建时间
-}
-
 // 删除详情请求
 type DeleteUpdReq struct {
 	IsDel       int         `orm:"isDel"`       // 是否删除 0未删除 1已删除

+ 1 - 1
backend/src/dashoo.cn/modi_webapi/app/model/course/detail/detail_entity.go

@@ -20,7 +20,7 @@ type Entity struct {
 	Num 		int 		`xorm:"INT(10)"`		// 人数
 	WeekTitle	string		`xorm:"VARCHAR(32)"`	// 教学周
 	DayOfWeek   int 		`xorm:"INT(10)"`  		// 周次 1-7
-	Time		string 		`xorm:"VARCHAR(32)"`	// 节次
+	Time		string 		`xorm:"VARCHAR(32)"`	// 节次 多个节次id,逗号隔开
 	Status		int 		`xorm:"TINYINT"` 		// 状态 发布状态
 	CreatedBy	string		`xorm:"VARCHAR(32)"`	// 创建人
 	CreatedTime	*gtime.Time	`xorm:"DATETIME"`		// 创建时间

+ 14 - 0
backend/src/dashoo.cn/modi_webapi/app/model/duty/detail/detail.go

@@ -0,0 +1,14 @@
+package detail
+
+import "dashoo.cn/modi_webapi/app/common"
+
+// 搜索请求
+type SelectPageReq struct {
+	Tenant string           `protobuf:"bytes,1,opt,name=tenant,proto3" json:"tenant,omitempty"`
+	Title  string           `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"`
+	Year   int              `protobuf:"bytes,2,opt,name=Year,proto3" json:"Year,omitempty"`
+	Term   int              `protobuf:"bytes,2,opt,name=Term,proto3" json:"Term,omitempty"`
+	Page   *common.PageInfo `protobuf:"bytes,3,opt,name=page" json:"page,omitempty"`
+	Prop   string           `json:prop`
+	Order  string           `json:order`
+}

+ 71 - 0
backend/src/dashoo.cn/modi_webapi/app/model/duty/detail/detail_entity.go

@@ -0,0 +1,71 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. You may not really want to edit it.
+// ==========================================================================
+
+package detail
+
+import (
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// Entity is the golang structure for table instrument.
+type Entity struct {
+	Id          int         `xorm:"not null pk autoincr INT(10)"` // id
+	DutyId      int         `xorm:"INT(10)"`                      // 值周ID
+	Local       string      `xorm:"INT(10)"`                      // 地点
+	Time        int         `xorm:"INT(10)"`                      // 时间段
+	Status      string      `xorm:"VARCHAR(32)"`                  // 状态
+	People      string      `xorm:"VARCHAR(32)"`                  // 值班人员
+	Monday      int         `xorm:"INT(10)"`                      // 周一
+	Tuesday     int         `xorm:"INT(10)"`                      // 周二
+	Wednesday   int         `xorm:"INT(10)"`                      // 周三
+	Thursday    int         `xorm:"INT(10)"`                      // 周四
+	Friday      int         `xorm:"INT(10)"`                      // 周五
+	Saturday    int         `xorm:"INT(10)"`                      // 周六
+	Sunday      int         `xorm:"INT(10)"`                      // 周天
+	CreatedBy   string      `xorm:"VARCHAR(32)"`                  // 创建人
+	CreatedTime *gtime.Time `xorm:"DATETIME created"`             // 创建时间
+	UpdatedBy   string      `xorm:"VARCHAR(32)"`                  // 更新人
+	UpdatedTime *gtime.Time `xorm:"DATETIME updated"`             // 更新时间
+	IsDel       int         `xorm:"INT(11)"`                      // 删除标志
+
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (r *Entity) OmitEmpty() *arModel {
+	return Model.Data(r).OmitEmpty()
+}
+
+// Inserts does "INSERT...INTO..." statement for inserting current object into table.
+func (r *Entity) Insert() (result sql.Result, err error) {
+	return Model.Data(r).Insert()
+}
+
+// Replace does "REPLACE...INTO..." statement for inserting current object into table.
+// If there's already another same record in the table (it checks using primary key or unique index),
+// it deletes it and insert this one.
+func (r *Entity) Replace() (result sql.Result, err error) {
+	return Model.Data(r).Replace()
+}
+
+// Save does "INSERT...INTO..." statement for inserting/updating current object into table.
+// It updates the record if there's already another same record in the table
+// (it checks using primary key or unique index).
+func (r *Entity) Save() (result sql.Result, err error) {
+	return Model.Data(r).Save()
+}
+
+// Update does "UPDATE...WHERE..." statement for updating current object from table.
+// It updates the record if there's already another same record in the table
+// (it checks using primary key or unique index).
+func (r *Entity) Update() (result sql.Result, err error) {
+	return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
+}
+
+// Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
+func (r *Entity) Delete() (result sql.Result, err error) {
+	return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
+}

+ 369 - 0
backend/src/dashoo.cn/modi_webapi/app/model/duty/detail/detail_model.go

@@ -0,0 +1,369 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. You may not really want to edit it.
+// ==========================================================================
+
+package detail
+
+import (
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"time"
+)
+
+// arModel is a active record design model for table instrument operations.
+type arModel struct {
+	M *gdb.Model
+}
+
+var (
+	// Table is the table name of instrument.
+	Table = "duty_detail"
+	// Model is the model object of instrument.
+	Model = &arModel{g.DB("default").Table(Table).Safe()}
+	// Columns defines and stores column names for table instrument.
+)
+
+// FindOne is a convenience method for Model.FindOne.
+// See Model.FindOne.
+func FindOne(where ...interface{}) (*Entity, error) {
+	return Model.FindOne(where...)
+}
+
+// FindAll is a convenience method for Model.FindAll.
+// See Model.FindAll.
+func FindAll(where ...interface{}) ([]*Entity, error) {
+	return Model.FindAll(where...)
+}
+
+// FindValue is a convenience method for Model.FindValue.
+// See Model.FindValue.
+func FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error) {
+	return Model.FindValue(fieldsAndWhere...)
+}
+
+// FindCount is a convenience method for Model.FindCount.
+// See Model.FindCount.
+func FindCount(where ...interface{}) (int, error) {
+	return Model.FindCount(where...)
+}
+
+// Insert is a convenience method for Model.Insert.
+func Insert(data ...interface{}) (result sql.Result, err error) {
+	return Model.Insert(data...)
+}
+
+// Replace is a convenience method for Model.Replace.
+func Replace(data ...interface{}) (result sql.Result, err error) {
+	return Model.Replace(data...)
+}
+
+// Save is a convenience method for Model.Save.
+func Save(data ...interface{}) (result sql.Result, err error) {
+	return Model.Save(data...)
+}
+
+// Update is a convenience method for Model.Update.
+func Update(dataAndWhere ...interface{}) (result sql.Result, err error) {
+	return Model.Update(dataAndWhere...)
+}
+
+// Delete is a convenience method for Model.Delete.
+func Delete(where ...interface{}) (result sql.Result, err error) {
+	return Model.Delete(where...)
+}
+
+// As sets an alias name for current table.
+func (m *arModel) As(as string) *arModel {
+	return &arModel{m.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (m *arModel) TX(tx *gdb.TX) *arModel {
+	return &arModel{m.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (m *arModel) Master() *arModel {
+	return &arModel{m.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (m *arModel) Slave() *arModel {
+	return &arModel{m.M.Slave()}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+func (m *arModel) LeftJoin(joinTable string, on string) *arModel {
+	return &arModel{m.M.LeftJoin(joinTable, on)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+func (m *arModel) RightJoin(joinTable string, on string) *arModel {
+	return &arModel{m.M.RightJoin(joinTable, on)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+func (m *arModel) InnerJoin(joinTable string, on string) *arModel {
+	return &arModel{m.M.InnerJoin(joinTable, on)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+func (m *arModel) Fields(fields string) *arModel {
+	return &arModel{m.M.Fields(fields)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+func (m *arModel) FieldsEx(fields string) *arModel {
+	return &arModel{m.M.FieldsEx(fields)}
+}
+
+// Option sets the extra operation option for the model.
+func (m *arModel) Option(option int) *arModel {
+	return &arModel{m.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (m *arModel) OmitEmpty() *arModel {
+	return &arModel{m.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (m *arModel) Filter() *arModel {
+	return &arModel{m.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (m *arModel) Where(where interface{}, args ...interface{}) *arModel {
+	return &arModel{m.M.Where(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (m *arModel) And(where interface{}, args ...interface{}) *arModel {
+	return &arModel{m.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (m *arModel) Or(where interface{}, args ...interface{}) *arModel {
+	return &arModel{m.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (m *arModel) Group(groupBy string) *arModel {
+	return &arModel{m.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (m *arModel) Order(orderBy string) *arModel {
+	return &arModel{m.M.Order(orderBy)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (m *arModel) Limit(limit ...int) *arModel {
+	return &arModel{m.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (m *arModel) Offset(offset int) *arModel {
+	return &arModel{m.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (m *arModel) Page(page, limit int) *arModel {
+	return &arModel{m.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (m *arModel) Batch(batch int) *arModel {
+	return &arModel{m.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (m *arModel) Cache(expire time.Duration, name ...string) *arModel {
+	return &arModel{m.M.Cache(expire, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (m *arModel) Data(data ...interface{}) *arModel {
+	return &arModel{m.M.Data(data...)}
+}
+
+// Insert does "INSERT INTO ..." statement for the model.
+// The optional parameter <data> is the same as the parameter of Model.Data function,
+// see Model.Data.
+func (m *arModel) Insert(data ...interface{}) (result sql.Result, err error) {
+	return m.M.Insert(data...)
+}
+
+// Replace does "REPLACE INTO ..." statement for the model.
+// The optional parameter <data> is the same as the parameter of Model.Data function,
+// see Model.Data.
+func (m *arModel) Replace(data ...interface{}) (result sql.Result, err error) {
+	return m.M.Replace(data...)
+}
+
+// Save does "INSERT INTO ... ON DUPLICATE KEY UPDATE..." statement for the model.
+// It updates the record if there's primary or unique index in the saving data,
+// or else it inserts a new record into the table.
+//
+// The optional parameter <data> is the same as the parameter of Model.Data function,
+// see Model.Data.
+func (m *arModel) Save(data ...interface{}) (result sql.Result, err error) {
+	return m.M.Save(data...)
+}
+
+// Update does "UPDATE ... " statement for the model.
+//
+// If the optional parameter <dataAndWhere> is given, the dataAndWhere[0] is the updated
+// data field, and dataAndWhere[1:] is treated as where condition fields.
+// Also see Model.Data and Model.Where functions.
+func (m *arModel) Update(dataAndWhere ...interface{}) (result sql.Result, err error) {
+	return m.M.Update(dataAndWhere...)
+}
+
+// Delete does "DELETE FROM ... " statement for the model.
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+func (m *arModel) Delete(where ...interface{}) (result sql.Result, err error) {
+	return m.M.Delete(where...)
+}
+
+// Count does "SELECT COUNT(x) FROM ..." statement for the model.
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+func (m *arModel) Count(where ...interface{}) (int, error) {
+	return m.M.Count(where...)
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*Entity.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+func (m *arModel) All(where ...interface{}) ([]*Entity, error) {
+	all, err := m.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*Entity
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *Entity.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+func (m *arModel) One(where ...interface{}) (*Entity, error) {
+	one, err := m.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *Entity
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// Value retrieves a specified record value from table and returns the result as interface type.
+// It returns nil if there's no record found with the given conditions from table.
+//
+// If the optional parameter <fieldsAndWhere> is given, the fieldsAndWhere[0] is the selected fields
+// and fieldsAndWhere[1:] is treated as where condition fields.
+// Also see Model.Fields and Model.Where functions.
+func (m *arModel) Value(fieldsAndWhere ...interface{}) (gdb.Value, error) {
+	return m.M.Value(fieldsAndWhere...)
+}
+
+// FindOne retrieves and returns a single Record by Model.WherePri and Model.One.
+// Also see Model.WherePri and Model.One.
+func (m *arModel) FindOne(where ...interface{}) (*Entity, error) {
+	one, err := m.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *Entity
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by Model.WherePri and Model.All.
+// Also see Model.WherePri and Model.All.
+func (m *arModel) FindAll(where ...interface{}) ([]*Entity, error) {
+	all, err := m.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*Entity
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// FindValue retrieves and returns single field value by Model.WherePri and Model.Value.
+// Also see Model.WherePri and Model.Value.
+func (m *arModel) FindValue(fieldsAndWhere ...interface{}) (gdb.Value, error) {
+	return m.M.FindValue(fieldsAndWhere...)
+}
+
+// FindCount retrieves and returns the record number by Model.WherePri and Model.Count.
+// Also see Model.WherePri and Model.Count.
+func (m *arModel) FindCount(where ...interface{}) (int, error) {
+	return m.M.FindCount(where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (m *arModel) Chunk(limit int, callback func(entities []*Entity, err error) bool) {
+	m.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*Entity
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+
+}

+ 15 - 0
backend/src/dashoo.cn/modi_webapi/app/model/duty/duty.go

@@ -0,0 +1,15 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package duty
+
+import "dashoo.cn/modi_webapi/app/common"
+
+// 搜索请求
+type SelectPageReq struct {
+	Title  string `protobuf:"bytes,2,opt,name=Title,proto3" json:"Title,omitempty"`
+	Year   int    `protobuf:"bytes,2,opt,name=Year,proto3" json:"Year,omitempty"`
+	Term   int    `protobuf:"bytes,2,opt,name=Term,proto3" json:"Term,omitempty"`
+	Common common.SelectPageReq
+}

+ 11 - 22
backend/src/dashoo.cn/modi_webapi/app/service/duty/duty_entity.go → backend/src/dashoo.cn/modi_webapi/app/model/duty/duty_entity.go

@@ -12,26 +12,16 @@ import (
 
 // Entity is the golang structure for table instrument.
 type Entity struct {
-	Id                      int           `xorm:"not null pk autoincr INT(10)"`  // id
-	Year                    int           `xorm:"not null pk autoincr INT(11)"`  // 学年
-	Term                    string        `xorm:"VARCHAR(32)"`                   // 学期
-	Title                   string        `xorm:"VARCHAR(32)"`                   // 标题
-	Local                   string        `xorm:"VARCHAR(32)"`                   // 地点
-	Time                    int           `xorm:"INT(11)"`                       // 时间段
-	Status                  string        `xorm:"VARCHAR(32)"`                   // 状态
-	People                  string        `xorm:"VARCHAR(32)"`                   // 值班人员
-	Monday                  int           `xorm:"INT(11)"`                       // 周一
-	Tuesday                 int           `xorm:"INT(11)"`                       // 周二
-	Wednesday               int           `xorm:"INT(11)"`                       // 周三
-	Thursday                int           `xorm:"INT(11)"`                       // 周四
-	Friday                  int           `xorm:"INT(11)"`                       // 周五
-	Saturday                int           `xorm:"INT(11)"`                       // 周六
-	Sunday                  int           `xorm:"INT(11)"`                       // 周日/周天
-	CreatedBy               string        `xorm:"VARCHAR(32)"`                   // 创建人
-	CreatedTime             *gtime.Time   `xorm:"DATETIME created"`              // 创建时间
-	UpdatedBy               string        `xorm:"VARCHAR(32)"`                   // 更新人
-	UpdatedTime             *gtime.Time   `xorm:"DATETIME updated"`              // 更新时间
-	IsDel                   int           `xorm:"INT(11)"`                       // 删除标志
+	Id          int         `xorm:"not null pk autoincr INT(10)"` // id
+	Year        int         `xorm:"not null pk autoincr INT(11)"` // 学年
+	Term        string      `xorm:"VARCHAR(32)"`                  // 学期
+	Title       string      `xorm:"VARCHAR(32)"`                  // 标题
+	Status      string      `xorm:"VARCHAR(32)"`                  // 状态
+	CreatedBy   string      `xorm:"VARCHAR(32)"`                  // 创建人
+	CreatedTime *gtime.Time `xorm:"DATETIME created"`             // 创建时间
+	UpdatedBy   string      `xorm:"VARCHAR(32)"`                  // 更新人
+	UpdatedTime *gtime.Time `xorm:"DATETIME updated"`             // 更新时间
+	IsDel       int         `xorm:"INT(11)"`                      // 删除标志
 
 }
 
@@ -46,7 +36,6 @@ func (r *Entity) Insert() (result sql.Result, err error) {
 	return Model.Data(r).Insert()
 }
 
-
 // Replace does "REPLACE...INTO..." statement for inserting current object into table.
 // If there's already another same record in the table (it checks using primary key or unique index),
 // it deletes it and insert this one.
@@ -71,4 +60,4 @@ func (r *Entity) Update() (result sql.Result, err error) {
 // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
 func (r *Entity) Delete() (result sql.Result, err error) {
 	return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
-}
+}

+ 1 - 1
backend/src/dashoo.cn/modi_webapi/app/service/duty/duty_model.go → backend/src/dashoo.cn/modi_webapi/app/model/duty/duty_model.go

@@ -366,4 +366,4 @@ func (m *arModel) Chunk(limit int, callback func(entities []*Entity, err error)
 		return callback(entities, err)
 	})
 
-}
+}

+ 7 - 16
backend/src/dashoo.cn/modi_webapi/app/service/course/detail/detail.go

@@ -2,7 +2,6 @@ package detail
 
 import (
 	"dashoo.cn/micro_libary/db"
-	"dashoo.cn/modi_webapi/app/common"
 	"dashoo.cn/modi_webapi/app/model/course/detail"
 	"database/sql"
 	"github.com/gogf/gf/errors/gerror"
@@ -40,7 +39,7 @@ func (s CourseDetailService) Update(param *detail.Entity) (*detail.Entity, error
 	}
 	// 设置更新时间
 	param.UpdatedTime = gtime.Now()
-	if _, err = s.SafeModel.WherePri(param.Id).Update(param); err != nil {
+	if _, err = s.SafeModel.Where(param.Id).Update(param); err != nil {
 		return nil, err
 	}
 	return detail, nil
@@ -48,8 +47,8 @@ func (s CourseDetailService) Update(param *detail.Entity) (*detail.Entity, error
 }
 
 // 分页查询课程表详情
-func (s CourseDetailService) GetPageList(param *detail.SelectPageReq) (list []*detail.SearchEntity, total int, err error) {
-	model := s.DB.Table(detail.Table).As("d").InnerJoin("base_itemdetails b", "d.Teacher = b.ItemValue").Where("b.ItemCode", "Teacher")
+func (s CourseDetailService) GetPageList(param *detail.SelectPageReq) (list []*detail.Entity, total int, err error) {
+	model := s.DB.Table(detail.Table)
 	if param != nil {
 		if param.CourseName != "" {
 			model = model.Where("CourseName like ?", "%"+param.CourseName+"%")
@@ -66,19 +65,11 @@ func (s CourseDetailService) GetPageList(param *detail.SelectPageReq) (list []*d
 		return nil, -1, gerror.New("读取行数失败")
 	}
 	// 排序
-	prop := param.Prop
-	order := param.Order
-	orderby := "d.Id asc" // 默认排序
-	if prop != "" {
-		if prop == "TeacherName" {
-			orderby = "b.ItemName " + order
-		} else {
-			orderby = "s." + common.UnMarshal(prop) + " " + order
-		}
-	}
+	orderby := "Id asc" // 默认排序
+
 	// 查询列表
-	model = model.Fields("d.*, b.ItemName as TeacherName").Page(int(param.Page.Current), int(param.Page.PagesSize)).Where("isDel", 0).Order(orderby)
-	var result []*detail.SearchEntity
+	model = model.Page(int(param.Page.Current), int(param.Page.PagesSize)).Where("isDel", 0).Order(orderby)
+	var result []*detail.Entity
 	err = model.Structs(&result)
 	// 如果未查到列表返回空
 	if err == sql.ErrNoRows {

+ 88 - 0
backend/src/dashoo.cn/modi_webapi/app/service/duty/detail.go

@@ -0,0 +1,88 @@
+package duty
+
+import (
+	"dashoo.cn/micro_libary/db"
+	"dashoo.cn/modi_webapi/app/common"
+	"dashoo.cn/modi_webapi/app/model/duty/detail"
+	"database/sql"
+	"github.com/gogf/gf/errors/gerror"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// 值班详情定义
+type DetailService struct {
+	db.ServiceBase
+}
+
+// 初始化service
+func NewDetailService(tenant string) (DetailService, error) {
+	var service DetailService
+	err := service.Init(tenant, detail.Table)
+	return service, err
+}
+
+// 分页查询值班表
+func (s DetailService) GetPageList(param *common.SelectPageReq) (list []*detail.Entity, total int, err error) {
+	model := s.SafeModel
+	// 查询总数
+	total, err = model.Where("isDel", 0).Count()
+	if err != nil {
+		return nil, -1, gerror.New("读取行数失败")
+	}
+	// 排序
+	orderby := "Id asc" // 默认排序
+	// 列表查询
+	model = model.Page(int(param.Page.Current), int(param.Page.PagesSize)).Order(orderby)
+	var result []*detail.Entity
+	err = model.Struct(&result)
+	// 如果未查到列表返回空
+	if err == sql.ErrNoRows {
+		return nil, 0, nil
+	}
+	return result, total, err
+}
+
+// 新增
+func (s DetailService) Add(param *detail.Entity) (id int64, err error) {
+	param.CreatedTime = gtime.Now()
+	if result, err := s.SafeModel.Insert(param); err != nil {
+		return 0, err
+	} else {
+		id, _ = result.LastInsertId()
+	}
+	return id, nil
+}
+
+// 获取详情
+func (s DetailService) GetDetailById(id int) (res *detail.Entity, err error) {
+	model := s.SafeModel.Where("Id", id).Where("isDel", 0)
+	var result *detail.Entity
+	err = model.Struct(&result)
+	return result, nil
+}
+
+// 删除
+func (s DetailService) DeleteById(Ids *common.DeleteIdsReq, param *common.DeleteUpdReq) error {
+	//设置更新时间
+	param.UpdatedTime = gtime.Now()
+	// 修改删除状态
+	param.IsDel = 1
+	if _, err := s.SafeModel.WherePri(Ids).Update(param); err != nil {
+		return err
+	}
+	return nil
+}
+
+// 更新
+func (s DetailService) Save(param *detail.Entity) (*detail.Entity, error) {
+	detail, err := s.GetDetailById(param.Id)
+	if err != nil {
+		return nil, err
+	}
+	// 设置更新时间
+	param.UpdatedTime = gtime.Now()
+	if _, err = s.SafeModel.Where(param.Id).Update(param); err != nil {
+		return nil, err
+	}
+	return detail, nil
+}

+ 90 - 14
backend/src/dashoo.cn/modi_webapi/app/service/duty/duty.go

@@ -1,23 +1,99 @@
-// ============================================================================
-// This is auto-generated by gf cli tool only once. Fill this file as you wish.
-// ============================================================================
-
 package duty
 
 import (
-	"dashoo.cn/modi_webapi/library/request"
-	"github.com/gogf/gf/frame/g"
+	"dashoo.cn/micro_libary/db"
+	"dashoo.cn/modi_webapi/app/common"
+	"dashoo.cn/modi_webapi/app/model/duty"
+	"database/sql"
+	"github.com/gogf/gf/errors/gerror"
+	"github.com/gogf/gf/os/gtime"
 )
 
-var (
-	recordsTable = g.DB().Table("duty").Safe()
-)
+// DutyService 值班定义
+type DutyService struct {
+	db.ServiceBase
+}
+
+// 初始化DutyService
+func NewDutyService(tenant string) (DutyService, error) {
+	var service DutyService
+	err := service.Init(tenant, duty.Table)
+	return service, err
+}
+
+// 分页查询值班表
+func (s DutyService) GetPageList(param *duty.SelectPageReq) (list []*duty.Entity, total int, err error) {
+	model := s.DB.Table(duty.Table)
+	if param != nil {
+		if param.Title != "" {
+			model = model.Where("Title like ?", "%"+param.Title+"%")
+		}
+		if param.Year != 0 {
+			model = model.Where("Year", param.Year)
+		}
+		if param.Term != 0 {
+			model = model.Where("Term", param.Term)
+		}
+	}
+	// 查询总数
+	total, err = model.Where("isDel", 0).Count()
+	if err != nil {
+		return nil, -1, gerror.New("读取行数失败")
+	}
+	// 排序
+	orderby := "Id asc" // 默认排序
+	// 列表查询
+	model = model.Page(int(param.Common.Page.Current), int(param.Common.Page.PagesSize)).Order(orderby)
+	var result []*duty.Entity
+	err = model.Struct(&result)
+	// 如果未查到列表返回空
+	if err == sql.ErrNoRows {
+		return nil, 0, nil
+	}
+	return result, total, err
+}
+
+// 新增
+func (s DutyService) Add(param *duty.Entity) (id int64, err error) {
+	param.CreatedTime = gtime.Now()
+	if result, err := s.SafeModel.Insert(param); err != nil {
+		return 0, err
+	} else {
+		id, _ = result.LastInsertId()
+	}
+	return id, nil
+}
+
+// 获取详情
+func (s DutyService) GetDutyById(id int) (res *duty.Entity, err error) {
+	model := s.SafeModel.Where("Id", id).Where("isDel", 0)
+	var result *duty.Entity
+	err = model.Struct(&result)
+	return result, nil
+}
 
-func GetAllDuty(page request.PageInfo, where string, result *[]Entity)(err error){
-	err = recordsTable.Where(where).Limit((page.Current-1)*page.Size, page.Size).Scan(result)
-	return err
+// 删除
+func (s DutyService) DeleteById(Ids *common.DeleteIdsReq, param *common.DeleteUpdReq) error {
+	//设置更新时间
+	param.UpdatedTime = gtime.Now()
+	// 修改删除状态
+	param.IsDel = 1
+	if _, err := s.SafeModel.WherePri(Ids).Update(param); err != nil {
+		return err
+	}
+	return nil
 }
 
-func FindDutyCount(where string)(int, error){
-	return recordsTable.Where(where).Count()
+// 更新
+func (s DutyService) Save(param *duty.Entity) (*duty.Entity, error) {
+	duty, err := s.GetDutyById(param.Id)
+	if err != nil {
+		return nil, err
+	}
+	// 设置更新时间
+	param.UpdatedTime = gtime.Now()
+	if _, err = s.SafeModel.Where(param.Id).Update(param); err != nil {
+		return nil, err
+	}
+	return duty, nil
 }

+ 4 - 4
backend/src/dashoo.cn/modi_webapi/router/router.go

@@ -9,12 +9,12 @@ import (
 	"dashoo.cn/modi_webapi/app/api/instrument"
 	"dashoo.cn/modi_webapi/app/api/microDemo"
 	"dashoo.cn/modi_webapi/app/api/neo"
+	"dashoo.cn/modi_webapi/app/api/personnel"
 	"dashoo.cn/modi_webapi/app/api/system/item"
 	"dashoo.cn/modi_webapi/app/api/system/itemdetail"
 	"dashoo.cn/modi_webapi/app/api/system/menu"
 	"dashoo.cn/modi_webapi/app/api/system/organize"
 	"dashoo.cn/modi_webapi/app/api/system/permission"
-	"dashoo.cn/modi_webapi/app/api/personnel"
 	"dashoo.cn/modi_webapi/app/api/system/role"
 	"dashoo.cn/modi_webapi/app/api/system/user"
 	"dashoo.cn/modi_webapi/library/gtoken"
@@ -55,7 +55,7 @@ func init() {
 		// 班级管理
 		{"All", "/class", new(class.Controller)},
 		// 值班表管理
-		{"All", "/duty", new(duty.Controller)},
+		{"All", "/duty", new(duty.DutyController)},
 		// 课程管理
 		{"All", "/course", new(course.Controller)},
 		{"All", "/course/detail", new(detail.CourseDetailController)},
@@ -87,8 +87,8 @@ func init() {
 		LoginPath:        "/login",
 		LoginBeforeFunc:  loginFunc,
 		LogoutPath:       "/logout",
-		AuthPaths:        g.SliceStr{"/api"},                                                                               // 这里是按照前缀拦截,拦截/api
-		AuthExcludePaths: g.SliceStr{"/api/class/*", "/api/student/*", "/api/micro/*", "/api/item/*", "/api/itemdetail/*"}, // 不拦截路径
+		AuthPaths:        g.SliceStr{"/api"},                                                                                                                                                          // 这里是按照前缀拦截,拦截/api
+		AuthExcludePaths: g.SliceStr{"/api/class/*", "/api/student/*", "/api/micro/*", "/api/item/*", "/api/itemdetail/*", "/api/information/*", "/api/duty/*", "/api/course/*", "/api/itemdetail/*"}, // 不拦截路径
 	}
 	gfToken.Start()
 }

+ 125 - 15
doc/系统设计/数据库设计/data.pdman.json

@@ -459,7 +459,7 @@
       "chnname": "实验室值班人员管理",
       "entities": [
         {
-          "title": "DUTY",
+          "title": "duty_detail",
           "fields": [
             {
               "name": "Id",
@@ -471,22 +471,11 @@
               "autoIncrement": true
             },
             {
-              "name": "Year",
+              "name": "DutyId",
               "type": "Integer",
               "remark": "",
-              "chnname": "学年"
-            },
-            {
-              "name": "Term",
-              "type": "DefaultString",
-              "remark": "",
-              "chnname": "学期"
-            },
-            {
-              "name": "Title",
-              "type": "DefaultString",
-              "remark": "",
-              "chnname": "标题"
+              "chnname": "值班ID",
+              "notNull": true
             },
             {
               "name": "Local",
@@ -633,6 +622,127 @@
               "relationNoShow": true
             }
           ],
+          "chnname": "值班详情表"
+        },
+        {
+          "title": "duty",
+          "fields": [
+            {
+              "name": "Id",
+              "type": "Integer",
+              "remark": "",
+              "chnname": "主键",
+              "pk": true,
+              "notNull": true,
+              "autoIncrement": true
+            },
+            {
+              "name": "Year",
+              "type": "Integer",
+              "remark": "",
+              "chnname": "学年",
+              "notNull": true
+            },
+            {
+              "name": "Term",
+              "type": "Integer",
+              "remark": "",
+              "chnname": "学期",
+              "notNull": true
+            },
+            {
+              "name": "Title",
+              "type": "DefaultString",
+              "remark": "",
+              "chnname": "标题",
+              "notNull": true
+            },
+            {
+              "name": "Status",
+              "type": "Integer",
+              "remark": "",
+              "chnname": "状态",
+              "notNull": true
+            },
+            {
+              "name": "CreatedBy",
+              "type": "IdOrKey",
+              "remark": "",
+              "chnname": "创建人"
+            },
+            {
+              "name": "CreatedTime",
+              "type": "DateTime",
+              "remark": "",
+              "chnname": "创建时间"
+            },
+            {
+              "name": "UpdatedBy",
+              "type": "IdOrKey",
+              "remark": "",
+              "chnname": "更新人"
+            },
+            {
+              "name": "UpdatedTime",
+              "type": "DateTime",
+              "remark": "",
+              "chnname": "更新时间"
+            },
+            {
+              "name": "IsDel",
+              "type": "Integer",
+              "remark": "",
+              "chnname": "删除标志",
+              "notNull": true
+            }
+          ],
+          "indexs": [],
+          "headers": [
+            {
+              "fieldName": "chnname",
+              "relationNoShow": false
+            },
+            {
+              "fieldName": "name",
+              "relationNoShow": false
+            },
+            {
+              "fieldName": "type",
+              "relationNoShow": false
+            },
+            {
+              "fieldName": "dataType",
+              "relationNoShow": true
+            },
+            {
+              "fieldName": "remark",
+              "relationNoShow": true
+            },
+            {
+              "fieldName": "pk",
+              "relationNoShow": false
+            },
+            {
+              "fieldName": "notNull",
+              "relationNoShow": true
+            },
+            {
+              "fieldName": "autoIncrement",
+              "relationNoShow": true
+            },
+            {
+              "fieldName": "defaultValue",
+              "relationNoShow": true
+            },
+            {
+              "fieldName": "relationNoShow",
+              "relationNoShow": true
+            },
+            {
+              "fieldName": "uiHint",
+              "relationNoShow": true
+            }
+          ],
           "chnname": "值班表"
         }
       ],

+ 2 - 1
frontend_web/.env.development

@@ -14,7 +14,8 @@ VUE_APP_API=http://127.0.0.1:8090/api/
 
 # 第二后端API地址
 #VUE_APP_API02=http://39.98.34.197:9915/api/
-VUE_APP_API02=http://127.0.0.1:9635/api/
+VUE_APP_API02=http://192.168.0.252:12002/api/
+#VUE_APP_API02=http://127.0.0.1:9635/api/
 
 # 分模块地址
 VUE_APP_MODULE01=http://localhost:8081/#

+ 5 - 10
frontend_web/src/router/routes.js

@@ -29,16 +29,6 @@ const frameIn = [
         },
         component: _import('system/index')
       },
-      // 演示页面
-      {
-        path: 'page1',
-        name: 'page1',
-        meta: {
-          title: '数据展示',
-          auth: true
-        },
-        component: _import('demo/page1')
-      },
       {
         path: 'page2',
         name: 'page2',
@@ -336,6 +326,11 @@ const frameOut = [
     path: '/login',
     name: 'login',
     component: _import('system/login')
+  },
+  {
+    path: '/page1',
+    name: 'page1',
+    component: _import('demo/page1')
   }
 ]
 

+ 15 - 33
frontend_web/src/views/course/components/courseInfoDialog.vue

@@ -32,11 +32,12 @@
       <el-form-item label="班级"
                     prop="title">
         <el-select v-model="course.Class"
-                   placeholder="请选择班级">
-          <el-option v-for="item in activitiesclass"
-                     :key="item.value"
-                     :label="item.label"
-                     :value="item.value">
+                   placeholder="请选择班级"
+                   filterable="true">
+          <el-option v-for="item in classList"
+                     :key="item.Id"
+                     :label="item.Name"
+                     :value="item.Id">
           </el-option>
         </el-select>
       </el-form-item>
@@ -44,18 +45,17 @@
                     prop="title">
         <el-select v-model="course.Term">
           <el-option v-for="item in term"
-                     :key="item.ItemName"
+                     :key="item.ItemValue"
                      :label="item.ItemName"
                      :value="item.ItemValue">
           </el-option>
         </el-select>
       </el-form-item>
       <el-form-item label="状态">
-        <el-radio-group v-model="course.Status">
-          <el-radio class="radio"
-                    label="1">发布</el-radio>
-          <el-radio class="radio"
-                    label="0">草稿</el-radio>
+        <el-radio-group v-model="course.Status" >
+
+          <el-radio class="radio" v-for="item in statusList"
+                    :label="item.ItemValue">{{item.ItemName}}</el-radio>
         </el-radio-group>
       </el-form-item>
     </el-form>
@@ -73,18 +73,18 @@
 <script>
 
 import CourseApi from '@/api/course'
-import ClassApi from '@/api/class'
 import itemDetailApi from '@/api/sysadmin/itemdetail'
 
 export default {
   name: 'courseInfoDialog',
   props: {
-    courseId: Number
+    courseId: Number,
+    statusList: Array,
+    term: Array,
+    classList: Array
   },
   data () {
     return {
-      term: [],
-      activitiesclass: [],
       years: [],
       checkAll: false,
       dialogvisible: false,
@@ -96,8 +96,6 @@ export default {
     var myDate = new Date()
     var year = myDate.getFullYear()// 获取当前年
     this.initSelectYear(year)
-    this.initDatas_class()
-    this.getTerm()
     this.getData()
   },
   methods: {
@@ -112,20 +110,6 @@ export default {
           console.error(err)
         })
     },
-    // class
-    initDatas_class () {
-      let _this = this
-      let params = {
-        _currentPage: this.currpage,
-        _size: this.size
-      }
-      ClassApi.getAllClass(params)
-        .then(res => {
-          for (let i = 0; i < res.records.length; i++) {
-            this.activitiesclass.push({ value: (res.records[i].Id), label: (res.records[i].Year + '_' + res.records[i].Name) })
-          }
-        })
-    },
     initSelectYear (year) {
       this.years = []
       for (let i = 0; i < 30; i++) {
@@ -134,13 +118,11 @@ export default {
     },
     dialogOpen () {
       this.course = {}
-      console.log('courseId:' + this.courseId)
       this.$refs.courseForm.resetFields()
       this.getData()
     },
     dialogClose () {
       this.course = {}
-      console.log('courseId:' + this.courseId)
       this.$refs.courseForm.resetFields()
       this.$emit('handleClose')
       this.dialogVisible = false

+ 26 - 26
frontend_web/src/views/course/detail/components/command.vue

@@ -6,34 +6,34 @@
 </template>
 
 <script>
-    import Vue from 'vue'
-    export default Vue.extend({
-        data () {
-            return {
-                tableHeight: 1
-            }
-        },
-        methods: {
-            handleEdit () {
-                let id = this.params.data['Id']
-                this.params.context.page.handleEdit(id)
-            },
-            handleDelete () {
-                let id = this.params.data['Id']
-                let _this = this
-                _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    this.params.context.page.handleDelete(id)
-                }).catch(() => { })
-            }
+import Vue from 'vue'
+export default Vue.extend({
+  data () {
+    return {
+      tableHeight: 1
+    }
+  },
+  methods: {
+    handleEdit () {
+      let id = this.params.data['Id']
+      this.params.context.page.handleEdit(id)
+    },
+    handleDelete () {
+      let id = this.params.data['Id']
+      let _this = this
+      _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.params.context.page.handleDelete(id)
+      }).catch(() => { })
+    }
 
-        }
-    })
+  }
+})
 </script>
 
 <style scoped>
 
-</style>
+</style>

+ 71 - 35
frontend_web/src/views/course/detail/editForm.vue

@@ -14,10 +14,10 @@
                           label="课程名">
                 <el-input v-model="formdata.CourseName"></el-input>
             </el-form-item>
-            <el-form-item label="授课教师">
+            <el-form-item label="授课教师" prop="Teacher">
                 <el-select v-model="formdata.Teacher"
                            style="width: 100%">
-                    <el-option v-for="item in Teachers"
+                    <el-option v-for="item in TeacherList"
                                :key="item.Teacher"
                                :label="item.ItemName"
                                :value="parseInt(item.ItemValue)">
@@ -25,13 +25,13 @@
                 </el-select>
             </el-form-item>
 
-            <el-form-item label="实验地点">
-                <el-select v-model="formdata.Teacher"
+            <el-form-item label="实验地点" prop="Local">
+                <el-select v-model="formdata.Local"
                            style="width: 100%">
-                    <el-option v-for="item in Teachers"
-                               :key="item.Teacher"
-                               :label="item.ItemName"
-                               :value="parseInt(item.ItemValue)">
+                    <el-option v-for="item in RoomList"
+                               :key="item.Id"
+                               :label="item.RoomName"
+                               :value="parseInt(item.Id)">
                     </el-option>
                 </el-select>
             </el-form-item>
@@ -57,15 +57,16 @@
                 <el-input v-model="formdata.DayOfWeek"></el-input>
             </el-form-item>
 
-            <el-form-item prop="Time"
-                          label="节次">
-                <el-input v-model="formdata.Time"></el-input>
+            <el-form-item label="节次">
+                <el-checkbox-group style="width:100%;text-align:left" v-model="checkedTimes" @change="handleCheckedChange">
+                    <el-checkbox :label="item.ItemValue" v-for="item in TimeList" :key="item.ItemValue">{{ item.ItemName }}</el-checkbox>
+                </el-checkbox-group>
             </el-form-item>
 
 
-            <el-form-item label="发布状态" prop="Status">
-                <el-switch style="width:100%;text-align:left" v-model="formdata.Status"></el-switch>
-            </el-form-item>
+<!--            <el-form-item label="发布状态" prop="Status">-->
+<!--                <el-switch style="width:100%;text-align:left" v-model="formdata.Status"></el-switch>-->
+<!--            </el-form-item>-->
 
 
         </el-form>
@@ -92,17 +93,17 @@ export default {
         Year: Number,
         Term: Number,
         ClassId: Number,
+        RoomList: Array,
+        TeacherList: Array,
     },
     data () {
         return {
             loading: false,
             dialogVisible: false,
-            classList: [],
-            subjectList: [],
-            selectSubject: [],
+            checkedTimes: [],
             Teachers :[],
             formdata: {
-                Id: 0,
+                Id: '',
                 CourseId : '',
                 Year : '',
                 Term : '',
@@ -114,16 +115,25 @@ export default {
                 Num :'',
                 WeekTitle : '',
                 DayOfWeek : '',
-                Time : '',
-                Status : 0,
+                Time : [],
+                // Status : 0,
             },
-            imageUrl: '',
             rules: {
                 CourseName: [{
                     required: true,
                     message: '课程名不能为空',
                     trigger: 'blur'
                 }],
+                Teacher: [{
+                    required: true,
+                    message: '授课教师不能为空',
+                    trigger: 'blur'
+                }],
+                Local: [{
+                    required: true,
+                    message: '实验地点不能为空',
+                    trigger: 'blur'
+                }],
                 Mark: [{
                     required: true,
                     message: '学分不能为空',
@@ -161,14 +171,7 @@ export default {
         }
     },
     mounted () {
-        itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
-            .then(res => {
-                this.Teachers = res
-                this.initData()
-            })
-            .catch(err => {
-                console.error(err)
-            })
+        this.getTimeList()
     },
     methods: {
         dialogOpen () {
@@ -186,13 +189,21 @@ export default {
                     .then(res => {
                         _this.formdata = res
                         // 编辑时初始化表单数据,给字段赋值
-                        _this.formdata.Status = _this.formdata.Status === 1
+                        // _this.formdata.Status = _this.formdata.Status === 1
+                        // 判断多选的选中状态
+                        if (_this.formdata.Time) {
+                            let subStr = _this.formdata.Time
+                            _this.checkedTimes = subStr.split(',').map(Number)
+
+                            console.log(_this.checkedTimes)
+                        } else {
+                            _this.checkedTimes = []
+                        }
                     })
                     .catch(err => {
                         console.error(err)
                     })
             } else {
-                console.log(_this)
                 _this.formdata.Id = ''
                 _this.formdata.CourseId = _this.CourseId
                 _this.formdata.Year = _this.Year
@@ -205,17 +216,18 @@ export default {
                 _this.formdata.Num = ''
                 _this.formdata.WeekTitle = ''
                 _this.formdata.DayOfWeek = ''
-                _this.formdata.Time = ''
-                _this.formdata.Status = 0
+                _this.formdata.Time = []
+                // _this.formdata.Status = 0
+                _this.checkedTimes = [] // 多选选中项、
+
             }
         },
         saveEntity () {
             let _this = this
-            console.log(_this)
             _this.formdata.Id = this.id
             _this.$refs['form'].validate(valid => {
                 if (valid) {
-                    _this.formdata.Status = _this.formdata.Status ? 1 : 0
+                    // _this.formdata.Status = _this.formdata.Status ? 1 : 0
                     _this.loading = true
                     detailApi.save(_this.formdata)
                         .then(data => {
@@ -231,6 +243,30 @@ export default {
                 }
             })
         },
+
+        // 获取课程节次列表
+        getTimeList (query) {
+            let _this = this
+            if (query !== '') {
+                _this.loading = true
+                itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Time' })
+                    .then(res => {
+                        _this.loading = false
+                        this.TimeList = res
+                        this.initData()
+                    })
+                    .catch(err => {
+                        console.error(err)
+                    })
+            } else {
+                _this.TimeList = []
+            }
+        },
+        handleCheckedChange (val) {
+            let _this = this
+            _this.formdata.Time = val
+        },
+
         dialogClose () {
             this.$refs['form'].resetFields()
             this.dialogVisible = false

+ 280 - 216
frontend_web/src/views/course/detail/index.vue

@@ -71,232 +71,296 @@
                    :Year="parseInt(Year)"
                    :Term="parseInt(Term)"
                    :ClassId="parseInt(Class)"
+                   :RoomList="RoomList"
+                   :TeacherList="TeacherList"
                    @submit="doRefresh" />
     </d2-container>
 </template>
 
 <script>
-    import command from './components/command'
-    import detailApi from '@/api/course/detail'
-    import editForm from './editForm'
-    import { AgGridVue } from 'ag-grid-vue'
-    import 'ag-grid-community/dist/styles/ag-grid.css'
-    import 'ag-grid-community/dist/styles/ag-theme-balham.css'
-    export default {
-        name: 'courseDetail',
-        components: { AgGridVue, editForm },
-        data () {
-            return {
-                // ag-grid相关变量
-                gridOptions: null,
-                gridApi: null,
-                columnApi: null,
-                rowData: null,
-                columnDefs: null,
+import itemDetailApi from '@/api/sysadmin/itemdetail'
+import command from './components/command'
+import detailApi from '@/api/course/detail'
+import editForm from './editForm'
+import { searchmanagingroomdata } from '@/api/instrumentroom'
+import { AgGridVue } from 'ag-grid-vue'
+import 'ag-grid-community/dist/styles/ag-grid.css'
+import 'ag-grid-community/dist/styles/ag-theme-balham.css'
 
-                page: {
-                    current: 1,
-                    size: 10,
-                    total: 1
-                },
-                sort: {
-                    prop: '',
-                    order: ''
-                },
+export default {
+  name: 'courseDetail',
+  components: { AgGridVue, editForm },
+  data () {
+    return {
+      // ag-grid相关变量
+      gridOptions: null,
+      gridApi: null,
+      columnApi: null,
+      rowData: null,
+      columnDefs: null,
+      RoomList: [],
+      TeacherList: [],
+      page: {
+        current: 1,
+        size: 10,
+        total: 1
+      },
+      sort: {
+        prop: '',
+        order: ''
+      },
 
-                id: -1,
-                CourseId:null,
-                Term:null,
-                Class:null,
-                Year:null,
-                rowdata: {},
-                searchForm: {
-                    name: ''
-                },
-                loading: false,
-                multipleSelection: [],
-                editFormVisible: false,
-                deleteBtnVisible: true,
-                deleteIds: []
-            }
-        },
-        beforeMount () {
-            this.gridOptions = {
-                rowHeight: 32, // 设置行高为32px
-                // 缺省列属性
-                defaultColDef: {
-                    width: 200,
-                    resizable: true
-                },
-                onRowSelected: this.handleSelectionChange, // 行选中
-                onSortChanged: this.handleSortChange // 排序传递后台
-            }
-            this.columnDefs = [
-                { headerName: '', checkboxSelection: true, headerCheckboxSelection: true, width: 50, 'pinned': 'left' },
-                {
-                    headerName: '序号',
-                    width: 50,
-                    field: 'OrdNo',
-                    cellRenderer: (params) => {
-                        return params ? params.node.rowIndex + 1 + '' : ''
-                    }
-                },
-                {headerName: '课程名称', field: 'CourseName', sortable: true},
-                { headerName: '授课老师', field: 'TeacherName'},
-                { headerName: '实验地点', field: 'Local' },
-                { headerName: '人数', field: 'Num', sortable: true },
-                { headerName: '发布状态', field: 'Status',
-                    valueFormatter (params) {
-                        return params.value === 0 ? '未发布' : '已发布'
-                    },},
-                { headerName: '创建时间', field: 'CreatedTime', sortable: true },
-                { headerName: '操作', field: 'operation', width: 120, 'pinned': 'right', cellRendererFramework: command }
-            ]
-        },
-        created () {
-        },
-        mounted () {
-            let _this = this
-            _this.gridOptions.context = { page: _this }
-            _this.gridApi = _this.gridOptions.api
-            _this.CourseId = _this.$route.query.CourseId
-            _this.Year = _this.$route.query.Year
-            _this.Term = _this.$route.query.Term
-            _this.Class = _this.$route.query.Class
-            this.doRefresh()
-        },
-        methods: {
-            // 表格就绪后后执行
-            onGridReady (params) {
-                // 调整表格列宽大小自适应
-                this.gridApi.sizeColumnsToFit()
-            },
-            // 执行刷新(获取数据)
-            doRefresh () {
-                let _this = this
-                let query = {
-                    // 分页信息
-                    size: this.page.size,
-                    current: this.page.current,
-                    // 排序信息
-                    prop: this.sort.prop,
-                    order: this.sort.order,
-                    // 搜索名称
-                    CourseName: this.searchForm.name,
-                    CourseId:this.CourseId // 课程ID
-                }
-                detailApi.getList(query)
-                    .then(res => {
-                        _this.rowData = res.records
-                        // console.log(_this.rowData, '============')
-                        // _this.page.current = res.current
-                        // _this.page.size = res.size
-                        _this.page.total = res.total
-                    })
-                    .catch(err => {
-                        console.error(err)
-                    })
-            },
+      id: -1,
+      CourseId: null,
+      Term: null,
+      Class: null,
+      Year: null,
+      rowdata: {},
+      searchForm: {
+        name: ''
+      },
+      loading: false,
+      multipleSelection: [],
+      editFormVisible: false,
+      deleteBtnVisible: true,
+      deleteIds: []
+    }
+  },
+  beforeMount () {
+    let _this = this
+    this.gridOptions = {
+      rowHeight: 32, // 设置行高为32px
+      // 缺省列属性
+      defaultColDef: {
+        width: 200,
+        resizable: true
+      },
+      onRowSelected: this.handleSelectionChange, // 行选中
+      onSortChanged: this.handleSortChange // 排序传递后台
+    }
+    this.columnDefs = [
+      { headerName: '', checkboxSelection: true, headerCheckboxSelection: true, width: 50, 'pinned': 'left' },
+      {
+        headerName: '序号',
+        width: 50,
+        field: 'OrdNo',
+        cellRenderer: (params) => {
+          return params ? params.node.rowIndex + 1 + '' : ''
+        }
+      },
+      { headerName: '课程名称', field: 'CourseName', sortable: true },
+      { headerName: '授课老师', field: 'Teacher', valueFormatter: teacherFormatter },
+      { headerName: '实验地点', field: 'Local', valueFormatter: localFormatter },
+
+      { headerName: '人数', field: 'Num', sortable: true },
+
+      { headerName: '创建时间', field: 'CreatedTime', sortable: true },
+      { headerName: '操作', field: 'operation', width: 120, 'pinned': 'right', cellRendererFramework: command }
+    ]
+
+    // 授课老师
+    function teacherFormatter (item) {
+      for (var i = 0; i < _this.TeacherList.length; i++) {
+        if (parseInt(_this.TeacherList[i].ItemValue) === item.value) {
+          return _this.TeacherList[i].ItemName
+        }
+      }
+    }
+
+    // 实验地点
+    function localFormatter (item) {
+      for (var i = 0; i < _this.RoomList.length; i++) {
+        if (parseInt(_this.RoomList[i].Id) === item.value) {
+          return _this.RoomList[i].RoomName
+        }
+      }
+    }
+  },
+  created () {
+  },
+  mounted () {
+    let _this = this
+    _this.gridOptions.context = { page: _this }
+    _this.gridApi = _this.gridOptions.api
+    _this.CourseId = _this.$route.query.CourseId
+    _this.Year = _this.$route.query.Year
+    _this.Term = _this.$route.query.Term
+    _this.Class = _this.$route.query.Class
+    this.getTeacherList()
+    let params = {
+      _currentPage: 1,
+      _size: 9999
+    }
+    this.getRoomList(params)
+    this.doRefresh()
+  },
+  methods: {
+    // 表格就绪后后执行
+    onGridReady (params) {
+      // 调整表格列宽大小自适应
+      this.gridApi.sizeColumnsToFit()
+    },
+    // 获取教师列表
+    getTeacherList (query) {
+      let _this = this
+      if (query !== '') {
+        _this.loading = true
+        itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Teacher' })
+          .then(res => {
+            _this.loading = false
+            this.TeacherList = res
+            this.initData()
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      } else {
+        _this.TeacherList = []
+      }
+    },
+    // 获取实验室地点
+    getRoomList (params) {
+      let _this = this
+      if (params !== '') {
+        _this.loading = true
+        searchmanagingroomdata(params)
+          .then(res => {
+            _this.loading = false
+            this.RoomList = res.info.items
+          })
+          .catch(function (error) {
+            console.log(error)
+          })
+      } else {
+        _this.RoomList = []
+      }
+    },
+    // 执行刷新(获取数据)
+    doRefresh () {
+      let _this = this
+      let query = {
+        // 分页信息
+        size: this.page.size,
+        current: this.page.current,
+        // 排序信息
+        prop: this.sort.prop,
+        order: this.sort.order,
+        // 搜索名称
+        CourseName: this.searchForm.name,
+        CourseId: this.CourseId // 课程ID
+      }
+      detailApi.getList(query)
+        .then(res => {
+          _this.rowData = res.records ? res.records : []
+          _this.page.current = res.current
+          _this.page.size = res.size
+          _this.page.total = res.total
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+
+    // 分页-改变分页大小
+    handleSizeChange (value) {
+      this.page.size = value
+      this.page.current = 1
+      this.doRefresh()
+    },
+    // 分页-改变当前页
+    handleCurrentChange (value) {
+      this.page.current = value
+      this.doRefresh()
+    },
+    // 处理编辑
+    handleEdit (id) {
+      this.id = id
+      this.editFormVisible = true
+    },
+    // 处理删除
+    handleDelete (id) {
+      const params = {
+        ids: this.deleteIds
+      }
+      detailApi.delete(params).then((res) => {
+        this.$message({
+          type: 'success',
+          message: '删除成功!'
+        })
+        this.doRefresh()
+      })
+    },
 
-            // 分页-改变分页大小
-            handleSizeChange (value) {
-                this.page.size = value
-                this.page.current = 1
-                this.doRefresh()
-            },
-            // 分页-改变当前页
-            handleCurrentChange (value) {
-                this.page.current = value
-                this.doRefresh()
-            },
-            // 处理编辑
-            handleEdit (id) {
-                this.id = id
-                this.editFormVisible = true
-            },
-            // 处理删除
-            handleDelete (id) {
-                const params = {
-                    ids: this.deleteIds
-                }
-                detailApi.delete(params).then((res) => {
-                    this.$message({
-                        type: 'success',
-                        message: '删除成功!'
-                    })
-                    this.doRefresh()
-                })
-            },
-            // 查询
-            handleSearch () {
-                this.currentPage = 1
-                this.doRefresh()
-            },
-            // 重置
-            handleSearchFormReset () {
-                this.searchForm.name = ''
-                this.doRefresh()
-            },
-            // 新建窗口
-            add () {
-                this.rowdata = {}
-                this.id = -1
-                this.editFormVisible = true
-            },
-            // 批量删除
-            delSelectedIds () {
-                this.$confirm('此操作将永久删除所选课程, 是否继续?', '提示', {
-                    confirmButtonText: '确定',
-                    cancelButtonText: '取消',
-                    type: 'warning'
-                }).then(() => {
-                    const params = {
-                        ids: this.deleteIds
-                    }
-                    detailApi.delete(params).then((res) => {
-                        this.$message({
-                            type: 'success',
-                            message: '删除成功!'
-                        })
-                        this.doRefresh()
-                    })
-                }).catch(() => {
-                    this.$message({
-                        type: 'info',
-                        message: '已取消删除'
-                    })
-                })
-            },
-            // 处理列表选择
-            handleSelectionChange () {
-                let _this = this
-                _this.multipleSelection = _this.gridOptions.api.getSelectedRows()
-                _this.deleteBtnVisible = !_this.multipleSelection || _this.multipleSelection.length === 0
-                if (!_this.deleteBtnVisible) {
-                    _this.deleteIds = []
-                    // 赋值删除id列表
-                    _this.multipleSelection.forEach((item, k) => {
-                        _this.deleteIds.push(item.Id)
-                    })
-                } else {
-                    _this.deleteIds = []
-                }
-            },
-            handleSortChange (val) {
-                var sortState = this.gridApi.getSortModel()
-                // 获取排序的字段
-                if (sortState && sortState.length > 0) {
-                    var item = sortState[0]
-                    this.sort.prop = item.colId
-                    this.sort.order = item.sort
-                }
-                this.doRefresh()
-            },
-            back () { // 返回上一页
-                this.$router.go(-1)
-            }
+    // 查询
+    handleSearch () {
+      this.currentPage = 1
+      this.doRefresh()
+    },
+    // 重置
+    handleSearchFormReset () {
+      this.searchForm.name = ''
+      this.doRefresh()
+    },
+    // 新建窗口
+    add () {
+      this.rowdata = {}
+      this.id = 0
+      this.editFormVisible = true
+    },
+    // 批量删除
+    delSelectedIds () {
+      this.$confirm('此操作将永久删除所选课程, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        const params = {
+          ids: this.deleteIds
         }
+        detailApi.delete(params).then((res) => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          })
+          this.doRefresh()
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '已取消删除'
+        })
+      })
+    },
+    // 处理列表选择
+    handleSelectionChange () {
+      let _this = this
+      _this.multipleSelection = _this.gridOptions.api.getSelectedRows()
+      _this.deleteBtnVisible = !_this.multipleSelection || _this.multipleSelection.length === 0
+      if (!_this.deleteBtnVisible) {
+        _this.deleteIds = []
+        // 赋值删除id列表
+        _this.multipleSelection.forEach((item, k) => {
+          _this.deleteIds.push(item.Id)
+        })
+      } else {
+        _this.deleteIds = []
+      }
+    },
+    handleSortChange (val) {
+      var sortState = this.gridApi.getSortModel()
+      // 获取排序的字段
+      if (sortState && sortState.length > 0) {
+        var item = sortState[0]
+        this.sort.prop = item.colId
+        this.sort.order = item.sort
+      }
+      this.doRefresh()
+    },
+    back () { // 返回上一页
+      this.$router.go(-1)
     }
+  }
+}
 </script>
 
 <style lang="scss">

+ 82 - 28
frontend_web/src/views/course/index.vue

@@ -88,29 +88,34 @@
                        label="学期"
                        align="center"
                        min-width="160px"
-                       show-overflow-tooltip></el-table-column>
+                       show-overflow-tooltip
+                       :formatter="formatTerm"
+      ></el-table-column>
       <el-table-column prop="Title"
                        label="标题"
                        align="center"
                        min-width="160px"
                        show-overflow-tooltip></el-table-column>
-      <el-table-column prop="CourseWeek"
-                       label="教学周"
-                       align="center"
-                       min-width="160px"
-                       show-overflow-tooltip></el-table-column>
-      <el-table-column prop="content"
+<!--      <el-table-column prop="CourseWeek"-->
+<!--                       label="教学周"-->
+<!--                       align="center"-->
+<!--                       min-width="160px"-->
+<!--                       show-overflow-tooltip></el-table-column>-->
+      <el-table-column prop="ClassId"
                        label="班级"
                        align="center"
                        min-width="160px"
-                       show-overflow-tooltip></el-table-column>
-      <el-table-column prop="status"
+                       show-overflow-tooltip
+                       :formatter="formatClass"
+      ></el-table-column>
+      <el-table-column prop="Status"
                        align="center"
                        min-width="40px"
                        label="状态"
                        show-overflow-tooltip
-                       :formatter="formatStatus"></el-table-column>
-      <el-table-column prop="createdtime"
+                       :formatter="formatStatus"
+      ></el-table-column>
+      <el-table-column prop="CreatedTime"
                        align="center"
                        min-width="120px"
                        label="创建时间"
@@ -120,6 +125,9 @@
     <courseInfoDialog ref="courseDialog"
                       @handleClose="handleClose"
                       :courseId="courseId"
+                      :statusList="statusList"
+                      :term="term"
+                      :classList="classList"
                       width="75"></courseInfoDialog>
     <!-- </div> -->
     <template slot="footer">
@@ -138,7 +146,9 @@
 
 <script>
 
+import ClassApi from '@/api/class'
 import CourseApi from '@/api/course'
+import itemDetailApi from '@/api/sysadmin/itemdetail'
 import courseInfoDialog from './components/courseInfoDialog'
 export default {
   name: 'course',
@@ -151,12 +161,15 @@ export default {
       details: false,
       activities: [],
       courseId: -1,
+      classList: [], // 班级列表
+      statusList: [], // 状态列表
+      term: [], // 学期
       search: {
         Term: '',
         Year: '',
         Title: '',
         CourseWeek: '',
-        status: -1,
+        status: 0,
         content: '',
         page: {
           total: 0,
@@ -164,19 +177,6 @@ export default {
           size: 10
         }
       },
-      status: [{
-        key: '全部',
-        value: -1
-      },
-      {
-        key: '草稿',
-        value: 0
-      },
-      {
-        key: '已发布',
-        value: 1
-      }
-      ],
       // 列表排序
       Column: {
         Order: '',
@@ -185,16 +185,57 @@ export default {
     }
   },
   mounted () {
+    this.getTerm()
+    this.getStatus()
     this.initDatas()
   },
   methods: {
+    // 匹配状态
     formatStatus (row, column) {
-      for (var i = 0; i < this.status.length; i++) {
-        if (this.status[i].value === row.status) {
-          return this.status[i].key
+      for (var i = 0; i < this.statusList.length; i++) {
+        if (parseInt(this.statusList[i].ItemValue) === parseInt(row.Status)) {
+          return this.statusList[i].ItemName
+        }
+      }
+    },
+    // 匹配班级
+    formatClass (row, column) {
+      for (var i = 0; i < this.classList.length; i++) {
+        if (parseInt(this.classList[i].Id) === row.ClassId) {
+          return this.classList[i].Name
         }
       }
     },
+    // 获取学期
+    getTerm () {
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'Term' })
+        .then(res => {
+          this.term = res
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
+    // 匹配学期
+    formatTerm (row, column) {
+      for (var i = 0; i < this.term.length; i++) {
+        if (parseInt(this.term[i].ItemValue) === parseInt(row.Term)) {
+          return this.term[i].ItemName
+        }
+      }
+    },
+    // 发布状态
+    getStatus () {
+      let _this = this
+      itemDetailApi.getItemDetailByItemCode({ ItemCode: 'PublishStatus' })
+        .then(res => {
+          _this.statusList = res
+          this.initDatas()
+        })
+        .catch(err => {
+          console.error(err)
+        })
+    },
     initSearchInfo () {
       this.search = {
         Title: '',
@@ -232,6 +273,7 @@ export default {
     },
     // 初始化列表数据
     initDatas () {
+      this.getClassList()
       CourseApi.getPageList(this.search)
         .then(res => {
           this.activities = res.records
@@ -293,6 +335,18 @@ export default {
       this.initSearchInfo()
       this.initPageInfo()
       this.initDatas()
+    },
+
+    // 获取班级列表
+    getClassList () {
+      let params = {
+        _currentPage: 1,
+        _size: 9999
+      }
+      ClassApi.getAllClass(params)
+        .then(res => {
+          this.classList = res.records
+        })
     }
 
   }

binární
frontend_web/src/views/demo/page1/image/backg.png


binární
frontend_web/src/views/demo/page1/image/background.png


binární
frontend_web/src/views/demo/page1/image/button.png


binární
frontend_web/src/views/demo/page1/image/footer_logo.png


binární
frontend_web/src/views/demo/page1/image/logo.png


binární
frontend_web/src/views/demo/page1/image/title.png


+ 49 - 7
frontend_web/src/views/demo/page1/index.vue

@@ -1,9 +1,30 @@
 <template>
   <d2-container>
+
+    <!-- <img class="page_logo"
+           src="./image/logo.png"
+           width="100%"
+           height="115"
+           style="margin:0px"> -->
+    <div class="container1">
+      <el-row style="height:100%">
+        <el-col :span="20">
+          &nbsp;
+        </el-col>
+        <el-col :span="4">
+          <div class="login_bg5x">
+            <a href="/login"
+               alt="logo">
+              <img src="./image/button.png"
+                   class="intelligent1-img" /> </a>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
     <el-row :gutter="15">
-      <el-card>
+      <el-card style="width: 100%">
         <div style="font-size:20px">
-          信息发布
+          公告
         </div>
         <el-table ref="multipleTable"
                   :data="activities"
@@ -45,7 +66,7 @@
             style="margin-top: 10px;">
       <el-card>
         <div style="font-size:20px">
-          课程管理
+          课程
         </div>
         <template style="padding: 15px;">
           <el-form size="mini"
@@ -150,7 +171,7 @@
             style="margin-top: 10px;">
       <el-card>
         <div style="font-size:20px">
-          值班管理
+          值班
         </div>
         <template style="padding: 15px;">
           <el-form size="mini"
@@ -454,11 +475,32 @@ export default {
 </script>
 
 <style lang="scss">
-.el-pagination {
-  margin: 1rem 0 2rem;
-  text-align: right;
+.container1 {
+  text-align: center;
+  background: url("./image/backg.png");
+  width: 100%;
+  min-height: 135px;
+  height: 135px;
+  margin: 0 auto;
+  background-size: cover;
+}
+
+.intelligent1-img {
+  width: 120px;
 }
 
+.login_bg5x {
+  margin-top: 65px;
+  margin-right: 40px;
+  // padding-left: 40px;
+  // float: left;
+}
+
+// .el-pagination {
+//   margin: 1rem 0 2rem;
+//   text-align: left;
+// }
+
 .plab {
   font-size: 13px;
   color: #999;

+ 2 - 2
frontend_web/src/views/instrument/components/instrumentadd.vue

@@ -10,7 +10,7 @@
              ref="testlistform">
       <el-row :gutter="20"
               class="donorsaddformcss">
-        <el-col :span="8">
+        <!-- <el-col :span="8">
           <el-form-item label="设备大类"
                         prop="Classification"
                         label-width="120px">
@@ -26,7 +26,7 @@
             </el-select>
 
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="8">
           <el-form-item label="设备编码"
                         prop="Code"

+ 2 - 2
frontend_web/src/views/instrument/components/instrumentedit.vue

@@ -10,7 +10,7 @@
              ref="testlistform">
       <el-row :gutter="20"
               class="donorsaddformcss">
-        <el-col :span="8">
+        <!-- <el-col :span="8">
           <el-form-item label="设备大类"
                         prop="Classification"
                         label-width="120px">
@@ -26,7 +26,7 @@
             </el-select>
 
           </el-form-item>
-        </el-col>
+        </el-col> -->
         <el-col :span="8">
           <el-form-item label="设备编码"
                         required

+ 0 - 13
frontend_web/src/views/instrument/index.vue

@@ -13,19 +13,6 @@
                     v-model="search.Name"
                     placeholder="请输入设备名称"></el-input>
         </el-form-item>
-        <el-form-item label="设备大类"
-                      class="sbutton_margin">
-          <el-select style="width:140px;"
-                     v-model="search.classification"
-                     clearable
-                     placeholder="请选择设备大类">
-            <el-option v-for="item in classificationlist"
-                       :key="item.Value"
-                       :label="item.Value"
-                       :value="item.Value">
-            </el-option>
-          </el-select>
-        </el-form-item>
         <!-- <el-form-item label="创建时间" class="sbutton_margin">
           <el-date-picker   style="width: 220px" v-model="CalibrationTime" type="daterange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束日期"></el-date-picker>
         </el-form-item> -->

+ 0 - 12
frontend_web/src/views/instrument/maintainlog/index.vue

@@ -14,18 +14,6 @@
                     v-model="search.InstrumenName"
                     placeholder="请输入设备名称"></el-input>
         </el-form-item>
-        <el-form-item label="操作类型"
-                      class="sbutton_margin">
-          <el-select v-model="search.OperaTpye"
-                     placeholder="请输入操作类型"
-                     clearable
-                     style="width:140px;">
-            <el-option v-for="item in classificationlist"
-                       :label="item.Value"
-                       :value="item.Value"
-                       :key="item.Value"></el-option>
-          </el-select>
-        </el-form-item>
         <!-- <el-form-item label="操作人">
           <el-input v-model="search.OperaUser"
                     style="width: 165px;"

+ 10 - 11
frontend_web/src/views/sysadmin/item/index.vue

@@ -11,7 +11,7 @@
           <el-input v-model="searchForm.name"
                     placeholder="字典分类名称"
                     style="width: 140px;"
-                    clearable/>
+                    clearable />
         </el-form-item>
         <el-form-item>
           <el-button type="primary"
@@ -41,13 +41,12 @@
     </template>
     <ag-grid-vue class="table ag-theme-balham ag-title-center"
                  style="width: 100%; height: 100%;"
-      id="myGrid"
-      :gridOptions="gridOptions"
-      @gridReady="onGridReady"
-      :rowData="rowData"
-      :columnDefs="columnDefs"
-      rowSelection="multiple"
-      >
+                 id="myGrid"
+                 :gridOptions="gridOptions"
+                 @gridReady="onGridReady"
+                 :rowData="rowData"
+                 :columnDefs="columnDefs"
+                 rowSelection="multiple">
     </ag-grid-vue>
     <template slot="footer">
       <el-pagination style="margin: -10px;"
@@ -145,6 +144,7 @@ export default {
         headerName: '使用分类名',
         field: 'UseItemName',
         valueFormatter (params) {
+          console.log('---params---', params)
           return params.value === 0 ? '否' : '是'
         }
       },
@@ -308,7 +308,6 @@ export default {
 </script>
 
 <style lang="scss">
-
 .el-pagination {
   margin: 1rem 0 2rem;
   text-align: right;
@@ -323,8 +322,8 @@ export default {
   margin-left: 1px;
   padding: 5px 10px 0 0;
 }
-.ag-header-cell-text{
-  text-align: center ;
+.ag-header-cell-text {
+  text-align: center;
   width: 100%;
 }
 </style>

binární
frontend_web/src/views/system/index/image/logo_nmg.png