package controllers
|
|
|
|
import (
|
|
"LAPP_GAAS_GFrame_BACKEND/utils"
|
|
"LAPP_GAAS_GFrame_BACKEND/web/middleware/jwts"
|
|
"LAPP_GAAS_GFrame_BACKEND/web/models"
|
|
"LAPP_GAAS_GFrame_BACKEND/web/supports"
|
|
"github.com/kataras/iris/v12"
|
|
"time"
|
|
)
|
|
|
|
func GetPmWostatusList(ctx iris.Context) {
|
|
|
|
user, ok := jwts.ParseToken(ctx)
|
|
utils.TrimStruct(user, *user)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
//日志
|
|
logs := new(models.LeitServerLog)
|
|
logs.File = "/controllers/PmWo_controller.go"
|
|
logs.Level = "info"
|
|
logs.Function = "GetPmWostatusList"
|
|
logs.Message = "维护工单日志查看"
|
|
logs.Operator = user.Userid
|
|
logs.TimeStamp = utils.TimeFormat(time.Now(), "yyyyMMddHHmmss")
|
|
logs.InsertRecord()
|
|
var data models.PmWostatus
|
|
var err error
|
|
var pageSize = 10
|
|
var pageIndex = 1
|
|
|
|
if size := ctx.URLParam("pageSize"); size != "" {
|
|
pageSize = utils.ValueToInt(size, 0)
|
|
}
|
|
|
|
if index := ctx.URLParam("pageIndex"); index != "" {
|
|
pageIndex = utils.ValueToInt(index, 0)
|
|
}
|
|
data.Finr = user.Pid
|
|
searchtime := ctx.URLParam("searchtime")
|
|
data.Maintwoid = ctx.URLParam("maintwoid")
|
|
result, count, err := data.GetPage(pageSize, pageIndex, searchtime)
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil)
|
|
return
|
|
}
|
|
res := make(map[string]interface{})
|
|
res["data"] = result
|
|
res["count"] = count
|
|
res["pageIndex"] = pageIndex
|
|
res["pageSize"] = pageSize
|
|
supports.Ok(ctx, supports.OptionSuccess, res)
|
|
}
|
|
|
|
func GetPmWostatus(ctx iris.Context) {
|
|
user, ok := jwts.ParseToken(ctx)
|
|
utils.TrimStruct(user, *user)
|
|
if !ok {
|
|
supports.Error(ctx, iris.StatusBadRequest, supports.ParseParamsFailur, nil)
|
|
return
|
|
}
|
|
var me models.PmWostatus
|
|
me.Finr = user.Pid
|
|
me.Maintwoid = ctx.URLParam("maintwoid")
|
|
result, err := me.SelectAllByID()
|
|
if err != nil {
|
|
supports.Error(ctx, iris.StatusBadRequest, "抱歉未找到相关信息", nil)
|
|
return
|
|
}
|
|
supports.Ok(ctx, supports.OptionSuccess, result)
|
|
}
|