Przeglądaj źródła

油田专用变压器

lining 6 lat temu
rodzic
commit
8c0bc6806d

+ 49 - 0
src/dashoo.cn/backend/api/business/limsreportspecialfield/limsreportspecialfield.go

@@ -0,0 +1,49 @@
+package limsreportspecialfield
+
+import "time"
+
+type LimsReportSpecialField struct {
+	Id               int       `xorm:"not null pk autoincr INT(10)"`
+	EId              int       `xorm:"comment('委托单ID') INT(10)"`
+	TaskBalanceId    int       `xorm:"comment('任务分配表ID') INT(10)"`
+	DataEntryId      int       `xorm:"comment('数据记录表ID') INT(10)"`
+	TestDepartId     int       `xorm:"comment('受检单位ID') INT(10)"`
+	InstalPositionId int       `xorm:"comment('安装位置ID') INT(10)"`
+	TestDepart       string    `xorm:"comment('受检单位ID') VARCHAR(50)"`
+	InstalPosition   string    `xorm:"comment('安装位置ID') VARCHAR(50)"`
+	Number           string    `xorm:"comment('变压器编号') VARCHAR(20)"`
+	Type             string    `xorm:"comment('变压器型号') VARCHAR(20)"`
+	Manufacturer     string    `xorm:"comment('变压器生产厂家') VARCHAR(50)"`
+	ProductionDate   time.Time `xorm:"comment('出厂日期') DATETIME"`
+	Capacity         float64    `xorm:"comment('额定容量') DECIMAL(10,2)"`
+	RatedVoltage     float64    `xorm:"comment('额定电压') DECIMAL(10,2)"`
+	RatedCurrent     float64    `xorm:"comment('额定电流') DECIMAL(10,2)"`
+	NoloadLoss       float64    `xorm:"comment('空载损耗') DECIMAL(10,2)"`
+	LoadLoss         float64    `xorm:"comment('负载损耗') DECIMAL(10,2)"`
+	LoadCurrent      float64    `xorm:"comment('空载电流') VARCHAR(50)"`
+	ImpedanceVoltage float64    `xorm:"comment('阻抗电压') DECIMAL(10,2)"`
+	JoinGroupMode    string    `xorm:"comment('联接组方式') VARCHAR(20)"`
+	Standard         string    `xorm:"comment('依据标准') VARCHAR(100)"`
+	AvgVoltage       float64    `xorm:"comment('平均电压') DECIMAL(10,2)"`
+	Active           float64    `xorm:"comment('累计有功+') DECIMAL(10,2)"`
+	AvgCurrent       float64    `xorm:"comment('平均电流') DECIMAL(10,2)"`
+	NegativeActive   float64    `xorm:"comment('累计有功-') DECIMAL(10,2)"`
+	AvgActive        float64    `xorm:"comment('平均有功') DECIMAL(10,2)"`
+	Reactive         float64    `xorm:"comment('累计无功+') DECIMAL(10,2)"`
+	AvgReactive      float64    `xorm:"comment('平均无功') DECIMAL(10,2)"`
+	NegativeReactive float64    `xorm:"comment('累计无功-') DECIMAL(10,2)"`
+	Apparent         float64    `xorm:"comment('平均视在') DECIMAL(10,2)"`
+	TestTime         time.Time `xorm:"comment('测试时间') DATETIME"`
+	PowerFactor      float64    `xorm:"comment('功率因数') DECIMAL(10,2)"`
+	EquipName        string    `xorm:"comment('使用仪器') VARCHAR(50)"`
+	EquipStatus      string    `xorm:"comment('仪器状态') VARCHAR(10)"`
+	Temperature      float64    `xorm:"comment('环境温度') DECIMAL(10,2)"`
+	Humidity         float64    `xorm:"comment('环境相对湿度') DECIMAL(10,2)"`
+	Remark           string    `xorm:"comment('备注') VARCHAR(255)"`
+	CreateUserId     int       `xorm:"INT(11)"`
+	CreateOn         time.Time `xorm:"DATETIME"`
+	CreateBy         string    `xorm:"VARCHAR(50)"`
+	ModifiedOn       time.Time `xorm:"DATETIME"`
+	ModifiedUserId   int       `xorm:"INT(11)"`
+	ModifiedBy       string    `xorm:"VARCHAR(50)"`
+}

+ 16 - 0
src/dashoo.cn/backend/api/business/limsreportspecialfield/limsreportspecialfieldService.go

@@ -0,0 +1,16 @@
+package limsreportspecialfield
+
+import (
+	. "dashoo.cn/cellbank/backend/api/mydb"
+	"github.com/go-xorm/xorm"
+)
+
+type LimsReportSpecialFieldService struct {
+	MyServiceBase
+}
+
+func GetLimsReportSpecialFieldService(xormEngine *xorm.Engine) *LimsReportSpecialFieldService {
+	s := new(LimsReportSpecialFieldService)
+	s.DBE = xormEngine
+	return s
+}

+ 1 - 0
src/dashoo.cn/backend/api/controllers/base.go

@@ -235,6 +235,7 @@ var (
 	LimsReportMotorName                      string = "LimsReportMotor" // 电动机节能监测原始记录
 	LimsReportElecPumpWellName               string = "LimsReportElecPumpWell" // 电泵井节能监测原始数据记录表
 	LimsReportScrewPumpName                  string = "LimsReportScrewPump" //  螺杆泵节能监测原始数据记录表
+	LimsReportSpecialFieldName               string = "LimsReportSpecialField" // 油田专用变压器运行数据现场测试记录
 )
 
 //分页信息及数据

+ 572 - 0
src/dashoo.cn/backend/api/controllers/lims/limsreportspecialfield.go

@@ -0,0 +1,572 @@
+package lims
+
+import (
+"dashoo.cn/business/userRole"
+"dashoo.cn/backend/api/business/baseUser"
+"dashoo.cn/backend/api/business/limsreportspecialfield"
+. "dashoo.cn/backend/api/controllers"
+"dashoo.cn/utils"
+"encoding/json"
+"strings"
+"time"
+)
+
+type LimsReportSpecialFieldController struct {
+	BaseController
+}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []limsreportspecialfield.LimsReportSpecialField
+// @router /list [get]
+func (this *LimsReportSpecialFieldController) GetEntityList() {
+
+	//获取分页信息
+	page := this.GetPageInfoForm()
+	where := " 1=1 "
+	orderby := "Id"
+	asc := false
+	Order := this.GetString("Order")
+	Prop := this.GetString("Prop")
+	if Order != "" && Prop != "" {
+		orderby = Prop
+		if Order == "asc" {
+			asc = true
+		}
+	}
+	Id := this.GetString("Id")
+	EId := this.GetString("EId")
+	TaskBalanceId := this.GetString("TaskBalanceId")
+	DataEntryId := this.GetString("DataEntryId")
+	TestDepartId := this.GetString("TestDepartId")
+	InstalPositionId := this.GetString("InstalPositionId")
+	TestDepart := this.GetString("TestDepart")
+	InstalPosition := this.GetString("InstalPosition")
+	Number := this.GetString("Number")
+	Type := this.GetString("Type")
+	Manufacturer := this.GetString("Manufacturer")
+	ProductionDate := this.GetString("ProductionDate")
+	Capacity := this.GetString("Capacity")
+	RatedVoltage := this.GetString("RatedVoltage")
+	RatedCurrent := this.GetString("RatedCurrent")
+	NoloadLoss := this.GetString("NoloadLoss")
+	LoadLoss := this.GetString("LoadLoss")
+	LoadCurrent := this.GetString("LoadCurrent")
+	ImpedanceVoltage := this.GetString("ImpedanceVoltage")
+	JoinGroupMode := this.GetString("JoinGroupMode")
+	Standard := this.GetString("Standard")
+	AvgVoltage := this.GetString("AvgVoltage")
+	Active := this.GetString("Active")
+	AvgCurrent := this.GetString("AvgCurrent")
+	NegativeActive := this.GetString("NegativeActive")
+	AvgActive := this.GetString("AvgActive")
+	Reactive := this.GetString("Reactive")
+	AvgReactive := this.GetString("AvgReactive")
+	NegativeReactive := this.GetString("NegativeReactive")
+	Apparent := this.GetString("Apparent")
+	TestTime := this.GetString("TestTime")
+	PowerFactor := this.GetString("PowerFactor")
+	EquipName := this.GetString("EquipName")
+	EquipStatus := this.GetString("EquipStatus")
+	Temperature := this.GetString("Temperature")
+	Humidity := this.GetString("Humidity")
+	Remark := this.GetString("Remark")
+	CreateUserId := this.GetString("CreateUserId")
+	CreateOn := this.GetString("CreateOn")
+	CreateBy := this.GetString("CreateBy")
+	ModifiedOn := this.GetString("ModifiedOn")
+	ModifiedUserId := this.GetString("ModifiedUserId")
+	ModifiedBy := this.GetString("ModifiedBy")
+
+	if Id != "" {
+		where = where + " and Id like '%" + Id + "%'"
+	}
+
+
+	if EId != "" {
+		where = where + " and EId like '%" + EId + "%'"
+	}
+
+
+	if TaskBalanceId != "" {
+		where = where + " and TaskBalanceId like '%" + TaskBalanceId + "%'"
+	}
+
+
+	if DataEntryId != "" {
+		where = where + " and DataEntryId like '%" + DataEntryId + "%'"
+	}
+
+
+	if TestDepartId != "" {
+		where = where + " and TestDepartId like '%" + TestDepartId + "%'"
+	}
+
+
+	if InstalPositionId != "" {
+		where = where + " and InstalPositionId like '%" + InstalPositionId + "%'"
+	}
+
+
+	if TestDepart != "" {
+		where = where + " and TestDepart like '%" + TestDepart + "%'"
+	}
+
+
+	if InstalPosition != "" {
+		where = where + " and InstalPosition like '%" + InstalPosition + "%'"
+	}
+
+
+	if Number != "" {
+		where = where + " and Number like '%" + Number + "%'"
+	}
+
+
+	if Type != "" {
+		where = where + " and Type like '%" + Type + "%'"
+	}
+
+
+	if Manufacturer != "" {
+		where = where + " and Manufacturer like '%" + Manufacturer + "%'"
+	}
+
+
+	if ProductionDate != "" {
+		where = where + " and ProductionDate like '%" + ProductionDate + "%'"
+	}
+
+
+	if Capacity != "" {
+		where = where + " and Capacity like '%" + Capacity + "%'"
+	}
+
+
+	if RatedVoltage != "" {
+		where = where + " and RatedVoltage like '%" + RatedVoltage + "%'"
+	}
+
+
+	if RatedCurrent != "" {
+		where = where + " and RatedCurrent like '%" + RatedCurrent + "%'"
+	}
+
+
+	if NoloadLoss != "" {
+		where = where + " and NoloadLoss like '%" + NoloadLoss + "%'"
+	}
+
+
+	if LoadLoss != "" {
+		where = where + " and LoadLoss like '%" + LoadLoss + "%'"
+	}
+
+
+	if LoadCurrent != "" {
+		where = where + " and LoadCurrent like '%" + LoadCurrent + "%'"
+	}
+
+
+	if ImpedanceVoltage != "" {
+		where = where + " and ImpedanceVoltage like '%" + ImpedanceVoltage + "%'"
+	}
+
+
+	if JoinGroupMode != "" {
+		where = where + " and JoinGroupMode like '%" + JoinGroupMode + "%'"
+	}
+
+
+	if Standard != "" {
+		where = where + " and Standard like '%" + Standard + "%'"
+	}
+
+
+	if AvgVoltage != "" {
+		where = where + " and AvgVoltage like '%" + AvgVoltage + "%'"
+	}
+
+
+	if Active != "" {
+		where = where + " and Active like '%" + Active + "%'"
+	}
+
+
+	if AvgCurrent != "" {
+		where = where + " and AvgCurrent like '%" + AvgCurrent + "%'"
+	}
+
+
+	if NegativeActive != "" {
+		where = where + " and NegativeActive like '%" + NegativeActive + "%'"
+	}
+
+
+	if AvgActive != "" {
+		where = where + " and AvgActive like '%" + AvgActive + "%'"
+	}
+
+
+	if Reactive != "" {
+		where = where + " and Reactive like '%" + Reactive + "%'"
+	}
+
+
+	if AvgReactive != "" {
+		where = where + " and AvgReactive like '%" + AvgReactive + "%'"
+	}
+
+
+	if NegativeReactive != "" {
+		where = where + " and NegativeReactive like '%" + NegativeReactive + "%'"
+	}
+
+
+	if Apparent != "" {
+		where = where + " and Apparent like '%" + Apparent + "%'"
+	}
+
+
+	if TestTime != "" {
+		where = where + " and TestTime like '%" + TestTime + "%'"
+	}
+
+
+	if PowerFactor != "" {
+		where = where + " and PowerFactor like '%" + PowerFactor + "%'"
+	}
+
+
+	if EquipName != "" {
+		where = where + " and EquipName like '%" + EquipName + "%'"
+	}
+
+
+	if EquipStatus != "" {
+		where = where + " and EquipStatus like '%" + EquipStatus + "%'"
+	}
+
+
+	if Temperature != "" {
+		where = where + " and Temperature like '%" + Temperature + "%'"
+	}
+
+
+	if Humidity != "" {
+		where = where + " and Humidity like '%" + Humidity + "%'"
+	}
+
+
+	if Remark != "" {
+		where = where + " and Remark like '%" + Remark + "%'"
+	}
+
+
+	if CreateUserId != "" {
+		where = where + " and CreateUserId like '%" + CreateUserId + "%'"
+	}
+
+
+	if CreateOn != "" {
+		where = where + " and CreateOn like '%" + CreateOn + "%'"
+	}
+
+
+	if CreateBy != "" {
+		where = where + " and CreateBy like '%" + CreateBy + "%'"
+	}
+
+
+	if ModifiedOn != "" {
+		where = where + " and ModifiedOn like '%" + ModifiedOn + "%'"
+	}
+
+
+	if ModifiedUserId != "" {
+		where = where + " and ModifiedUserId like '%" + ModifiedUserId + "%'"
+	}
+
+
+	if ModifiedBy != "" {
+		where = where + " and ModifiedBy like '%" + ModifiedBy + "%'"
+	}
+
+
+	if CreateOn != "" {
+		dates := strings.Split(CreateOn, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+		}
+	}
+
+	svc := limsreportspecialfield.GetLimsReportSpecialFieldService(utils.DBE)
+	var list []limsreportspecialfield.LimsReportSpecialField
+	total := svc.GetPagingEntitiesWithOrderBytbl(this.User.AccCode, page.CurrentPage, page.Size, orderby, asc, &list, where)
+	var datainfo DataInfo
+	datainfo.Items = list
+	datainfo.CurrentItemCount = total
+	datainfo.PageIndex = page.CurrentPage
+	datainfo.ItemsPerPage = page.Size
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取字典列表
+// @Description get user by token
+// @Success 200 {object} map[string]interface{}
+// @router /dictlist [get]
+func (this *LimsReportSpecialFieldController) GetDictList() {
+	dictList := make(map[string]interface{})
+	//dictSvc := items.GetItemsService(utils.DBE)
+	userSvc := baseUser.GetBaseUserService(utils.DBE)
+	//customerSvc := svccustomer.GetCustomerService(utils.DBE)
+	//dictList["WellNo"] = dictSvc.GetKeyValueItems("WellNo", this.User.AccCode)
+	var userEntity userRole.Base_User
+	userSvc.GetEntityById(this.User.Id, &userEntity)
+	dictList["Supervisers"] = userSvc.GetUserListByDepartmentId(this.User.AccCode, userEntity.Departmentid)
+
+	//var dictCustomer []svccustomer.Customer
+	//customerSvc.GetEntitysByWhere(this.User.AccCode + CustomerName, "", &dictCustomer)
+	//dictList["EntrustCorp"] = &dictCustomer
+
+	var datainfo DataInfo
+	datainfo.Items = dictList
+	this.Data["json"] = &datainfo
+	this.ServeJSON()
+}
+
+// @Title 获取实体
+// @Description 获取实体
+// @Success 200 {object} limsreportspecialfield.LimsReportSpecialField
+// @router /getEntityByDataEntryId/:id [get]
+func (this *LimsReportSpecialFieldController) GetEntityByDataEntryId() {
+	Id := this.Ctx.Input.Param(":id")
+	where := "DataEntryId=" + Id
+	var model limsreportspecialfield.LimsReportSpecialField
+	svc := limsreportspecialfield.GetLimsReportSpecialFieldService(utils.DBE)
+	//svc.GetEntityByIdBytbl(this.User.AccCode+LimsReportSpecialFieldName, Id, &model)
+	has := svc.GetEntityByWhere(this.User.AccCode+LimsReportSpecialFieldName, where, &model)
+	var data ErrorDataInfo
+	if (has) {
+		data.Code = 0
+	} else {
+		data.Code = -1
+	}
+	data.Item = model
+	this.Data["json"] = &data
+	this.ServeJSON()
+}
+
+// @Title 获取实体
+// @Description 获取实体
+// @Success 200 {object} limsreportspecialfield.LimsReportSpecialField
+// @router /get/:id [get]
+func (this *LimsReportSpecialFieldController) GetEntity() {
+	Id := this.Ctx.Input.Param(":id")
+
+	var model limsreportspecialfield.LimsReportSpecialField
+	svc := limsreportspecialfield.GetLimsReportSpecialFieldService(utils.DBE)
+	svc.GetEntityByIdBytbl(this.User.AccCode+LimsReportSpecialFieldName, Id, &model)
+
+	this.Data["json"] = &model
+	this.ServeJSON()
+}
+
+// @Title 添加
+// @Description 新增
+// @Param 	body body limsreportspecialfield.LimsReportSpecialField
+// @Success	200	{object} controllers.Request
+// @router /add [post]
+func (this *LimsReportSpecialFieldController) AddEntity() {
+	var model limsreportspecialfield.LimsReportSpecialField
+	var jsonBlob = this.Ctx.Input.RequestBody
+	svc := limsreportspecialfield.GetLimsReportSpecialFieldService(utils.DBE)
+
+	json.Unmarshal(jsonBlob, &model)
+	model.CreateOn = time.Now()
+	model.CreateBy = this.User.Realname
+	model.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	_, err := svc.InsertEntityBytbl(this.User.AccCode+LimsReportSpecialFieldName, &model)
+
+	var errinfo ErrorDataInfo
+	if err == nil {
+		//新增
+		errinfo.Message = "添加成功!"
+		errinfo.Code = 0
+		errinfo.Item = model.Id
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "添加失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 修改实体
+// @Description 修改实体
+// @Param 	body body limsreportspecialfield.LimsReportSpecialField
+// @Success	200	{object} controllers.Request
+// @router /update/:id [post]
+func (this *LimsReportSpecialFieldController) UpdateEntity() {
+	id := this.Ctx.Input.Param(":id")
+	var errinfo ErrorInfo
+	if id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	var model limsreportspecialfield.LimsReportSpecialField
+	svc := limsreportspecialfield.GetLimsReportSpecialFieldService(utils.DBE)
+
+	var jsonBlob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonBlob, &model)
+	model.ModifiedOn = time.Now()
+	model.ModifiedBy = this.User.Realname
+	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+
+	cols := []string{
+
+		"Id",
+
+		"EId",
+
+		"TaskBalanceId",
+
+		"DataEntryId",
+
+		"TestDepartId",
+
+		"InstalPositionId",
+
+		"TestDepart",
+
+		"InstalPosition",
+
+		"Number",
+
+		"Type",
+
+		"Manufacturer",
+
+		"ProductionDate",
+
+		"Capacity",
+
+		"RatedVoltage",
+
+		"RatedCurrent",
+
+		"NoloadLoss",
+
+		"LoadLoss",
+
+		"LoadCurrent",
+
+		"ImpedanceVoltage",
+
+		"JoinGroupMode",
+
+		"Standard",
+
+		"AvgVoltage",
+
+		"Active",
+
+		"AvgCurrent",
+
+		"NegativeActive",
+
+		"AvgActive",
+
+		"Reactive",
+
+		"AvgReactive",
+
+		"NegativeReactive",
+
+		"Apparent",
+
+		"TestTime",
+
+		"PowerFactor",
+
+		"EquipName",
+
+		"EquipStatus",
+
+		"Temperature",
+
+		"Humidity",
+
+		"Remark",
+
+		"CreateUserId",
+
+		"CreateOn",
+
+		"CreateBy",
+
+		"ModifiedOn",
+
+		"ModifiedUserId",
+
+		"ModifiedBy",
+
+
+	}
+	err := svc.UpdateEntityBytbl(this.User.AccCode+LimsReportSpecialFieldName, id, &model, cols)
+	if err == nil {
+		errinfo.Message = "修改成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "修改失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+
+// @Title 删除单条信息
+// @Description
+// @Success 200 {object} ErrorInfo
+// @Failure 403 :id 为空
+// @router /delete/:Id [delete]
+func (this *LimsReportSpecialFieldController) DeleteEntity() {
+	Id := this.Ctx.Input.Param(":Id")
+	var errinfo ErrorInfo
+	if Id == "" {
+		errinfo.Message = "操作失败!请求信息不完整"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var model limsreportspecialfield.LimsReportSpecialField
+	var entityempty limsreportspecialfield.LimsReportSpecialField
+	svc := limsreportspecialfield.GetLimsReportSpecialFieldService(utils.DBE)
+	opdesc := "删除-" + Id
+	err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+LimsReportSpecialFieldName, BaseOperationLogName, Id, &model, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "钻井日报")
+	if err == nil {
+		errinfo.Message = "删除成功"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	} else {
+		errinfo.Message = "删除失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+	}
+}
+

+ 6 - 0
src/dashoo.cn/backend/api/routers/router.go

@@ -470,6 +470,12 @@ func init() {
 				&lims.LimsReportScrewPumpController{},
 			),
 		),
+		// 油田专用变压器运行数据现场测试记录
+		beego.NSNamespace("/limsreportspecialfield",
+			beego.NSInclude(
+				&lims.LimsReportSpecialFieldController{},
+			),
+		),
 	)
 	beego.AddNamespace(ns)
 }

+ 47 - 0
src/dashoo.cn/frontend_web/src/api/lims/limsreportspecialfield.js

@@ -0,0 +1,47 @@
+export default {
+  getList (CreateOn, params, myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/list?CreateOn=' + CreateOn,
+      method: 'GET',
+      params: params
+    })
+  },
+  getDictList (myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/dictlist/',
+      method: 'GET'
+    })
+  },
+  getEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/get/' + entityId,
+      method: 'GET'
+    })
+  },
+  getEntityByDataEntryId (entityId, myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/getEntityByDataEntryId/' + entityId,
+      method: 'GET'
+    })
+  },
+  addEntity (formData, myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/add',
+      method: 'post',
+      data: formData
+    })
+  },
+  updateEntity (entityId, formData, myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/update/' + entityId,
+      method: 'post',
+      data: formData
+    })
+  },
+  deleteEntity (entityId, myAxios) {
+    return myAxios({
+      url: '/limsreportspecialfield/delete/' + entityId,
+      method: 'delete'
+    })
+  }
+}

+ 140 - 163
src/dashoo.cn/frontend_web/src/pages/lims/reportspecialfield/_opera/operation.vue

@@ -27,27 +27,27 @@
           </el-col>
           <el-col :span="8">
             <el-form-item label="安装地点">
-              <el-input v-model.trim="formData.PositionCheck" placeholder="请输入" style="width: 100%"></el-input>
+              <el-input v-model.trim="formData.InstalPosition" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="变压器编号">
-              <el-input v-model.trim="formData.WellNumber" placeholder="请输入" style="width: 100%"></el-input>
+              <el-input v-model.trim="formData.Number" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
             <el-form-item label="变压器型号">
-              <el-input v-model.trim="formData.WellNumber" placeholder="请输入" style="width: 100%"></el-input>
+              <el-input v-model.trim="formData.Type" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="变压器生产厂家">
-              <el-input v-model.trim="formData.WellNumber" placeholder="请输入" style="width: 100%"></el-input>
+            <el-form-item label="变压器生产厂家" label-width="130px">
+              <el-input v-model.trim="formData.Manufacturer" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="8">
-            <el-form-item label="变压器出厂日期">
-              <el-date-picker style="width: 100%" v-model="formData.CheckDate" type="date" placeholder="请选择检测日期">
+            <el-form-item label="变压器出厂日期" label-width="130px">
+              <el-date-picker style="width: 100%" v-model="formData.ProductionDate" type="date" placeholder="请选择日期">
               </el-date-picker>
             </el-form-item>
           </el-col>
@@ -56,63 +56,56 @@
           <el-card>
             <el-col :span="8">
               <el-form-item label="额定容量"
-                            prop="Capacity"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.Capacity" placeholder="请输入" style="width: 100%">
+                            prop="Capacity">
+                <el-input type="number" step="0.01" v-model.number="formData.Capacity" placeholder="请输入" style="width: 100%">
                   <template slot="append">Se(kVA)</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="额定电压"
-                            prop="RatedVoltage"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.RatedVoltage" placeholder="请输入" style="width: 100%">
+                            prop="RatedVoltage">
+                <el-input type="number" step="0.01" v-model.number="formData.RatedVoltage" placeholder="请输入" style="width: 100%">
                   <template slot="append">U1e/U2e</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="额定电流"
-                            prop="RatedCurrent"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.RatedCurrent" placeholder="请输入" style="width: 100%">
+                            prop="RatedCurrent">
+                <el-input type="number" step="0.01" v-model.number="formData.RatedCurrent" placeholder="请输入" style="width: 100%">
                   <template slot="append">I1e/I2e</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="空载损耗"
-                            prop="NoloadLoss"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.NoloadLoss" placeholder="请输入" style="width: 100%">
+                            prop="NoloadLoss">
+                <el-input type="number" step="0.01" v-model.number="formData.NoloadLoss" placeholder="请输入" style="width: 100%">
                   <template slot="append">P<sub>O</sub>(kW)</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="负载损耗"
-                            prop="LoadLoss"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.LoadLoss" placeholder="请输入" style="width: 100%">
+                            prop="LoadLoss">
+                <el-input type="number" step="0.01" v-model.number="formData.LoadLoss" placeholder="请输入" style="width: 100%">
                   <template slot="append">P<sub>k</sub>(kW)</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="空载电流"
-                            prop="LoadCurrent"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.LoadCurrent" placeholder="请输入" style="width: 100%">
+                            prop="LoadCurrent">
+                <el-input type="number" step="0.01" v-model.number="formData.LoadCurrent" placeholder="请输入" style="width: 100%">
                   <template slot="append">I<sub>0</sub>(%)</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="8">
               <el-form-item label="阻抗电压"
-                            prop="ImpedanceVoltage"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.ImpedanceVoltage" placeholder="请输入" style="width: 100%">
+                            prop="ImpedanceVoltage">
+                <el-input type="number" step="0.01" v-model.number="formData.ImpedanceVoltage" placeholder="请输入" style="width: 100%">
                   <template slot="append">U<sub>k</sub>(%)</template>
                 </el-input>
               </el-form-item>
@@ -131,129 +124,125 @@
             </el-col>
           </el-card>
         </el-row>
-        <el-row>
+
           <el-card>
-            <el-col :span="8">
+            <div slot="header" class="clearfix">
+              <span>现场监测数据</span>
+            </div>
+            <el-row>
+            <el-col :span="6">
               <el-form-item label="平均电压"
-                            prop="AvgVoltage"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgVoltage" placeholder="请输入" style="width: 100%">
+                            prop="AvgVoltage">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgVoltage" placeholder="请输入" style="width: 100%">
                   <template slot="append">V</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="平均电流"
-                            prop="AvgCurrent"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgCurrent" placeholder="请输入" style="width: 100%">
+                            prop="AvgCurrent">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgCurrent" placeholder="请输入" style="width: 100%">
                   <template slot="append">V</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="平均有功"
-                            prop="AvgActive"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgActive" placeholder="请输入" style="width: 100%">
+                            prop="AvgActive">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgActive" placeholder="请输入" style="width: 100%">
                   <template slot="append">kW</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="平均无功"
-                            prop="AvgReactive"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.AvgReactive" placeholder="请输入" style="width: 100%">
+                            prop="AvgReactive">
+                <el-input type="number" step="0.01" v-model.number="formData.AvgReactive" placeholder="请输入" style="width: 100%">
                   <template slot="append">kvar</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="平均视在"
-                            prop="Apparent"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.Apparent" placeholder="请输入" style="width: 100%">
+                            prop="Apparent">
+                <el-input type="number" step="0.01" v-model.number="formData.Apparent" placeholder="请输入" style="width: 100%">
                   <template slot="append">kVA</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="功率因数"
-                            prop="PowerFactor"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.PowerFactor" placeholder="请输入" style="width: 100%">
+                            prop="PowerFactor">
+                <el-input type="number" step="0.01" v-model.number="formData.PowerFactor" placeholder="请输入" style="width: 100%">
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="累计有功+"
-                            prop="Active"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.Active" placeholder="请输入" style="width: 100%">
+                            prop="Active">
+                <el-input type="number" step="0.01" v-model.number="formData.Active" placeholder="请输入" style="width: 100%">
                   <template slot="append">kW</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+
+            <el-col :span="6">
               <el-form-item label="累计有功-"
-                            prop="NegativeActive"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.NegativeActive" placeholder="请输入" style="width: 100%">
+                            prop="NegativeActive">
+                <el-input type="number" step="0.01" v-model.number="formData.NegativeActive" placeholder="请输入">
                   <template slot="append">kW</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
-              <el-form-item label="累计无功+"
-                            prop="Reactive"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.Reactive" placeholder="请输入" style="width: 100%">
+            </el-row>
+            <el-row>
+            <el-col :span="6">
+              <el-form-item label="累计无功+">
+                <el-input type="number" step="0.01" v-model.number="formData.Reactive" placeholder="请输入" >
                   <template slot="append">kvar</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="累计无功-"
-                            prop="NegativeReactive"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.NegativeReactive" placeholder="请输入" style="width: 100%">
+                            prop="NegativeReactive">
+                <el-input type="number" step="0.01" v-model.number="formData.NegativeReactive" placeholder="请输入">
                   <template slot="append">kvar</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="测试时间">
                 <el-date-picker style="width: 100%" v-model="formData.TestTime" type="date" placeholder="请选择检测日期">
                 </el-date-picker>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="使用仪器">
-                <el-input v-model.trim="formData.EquipName" placeholder="请输入" style="width: 100%">
+                <el-input v-model.trim="formData.EquipName" placeholder="请输入">
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            </el-row>
+            <el-row>
+            <el-col :span="6">
               <el-form-item label="仪器状态">
-                <el-input v-model.trim="formData.EquipStatus" placeholder="请输入" style="width: 100%">
+                <el-input v-model.trim="formData.EquipStatus" placeholder="请输入">
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="环境温度"
-                            prop="Temperature"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.trim="formData.Temperature" placeholder="请输入" style="width: 100%">
+                            prop="Temperature">
+                <el-input type="number" step="0.01" v-model.number="formData.Temperature" placeholder="请输入" style="width: 100%">
                   <template slot="append">℃</template>
                 </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="6">
               <el-form-item label="相对湿度"
-                            prop="Humidity"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.trim="formData.Humidity" placeholder="请输入" style="width: 100%">
+                            prop="Humidity">
+                <el-input type="number" step="0.01" v-model.number="formData.Humidity" placeholder="请输入" style="width: 100%">
                   <template slot="append">%</template>
                 </el-input>
               </el-form-item>
@@ -270,8 +259,9 @@
                   </el-button>
                 </el-form-item>
               </el-col>
+            </el-row>
           </el-card>
-        </el-row>
+
       </el-form>
     </el-card>
   </div>
@@ -281,6 +271,7 @@
   import {
     mapGetters
   } from 'vuex'
+  import api from '@/api/lims/limsreportspecialfield'
 
   export default {
     computed: {
@@ -291,6 +282,11 @@
     name: '',
     data () {
       return {
+        Id: '',
+        EId: '',
+        TaskBalanceId: '',
+        DataEntryId: '',
+        TestDepartId: '',
         formData: {
           Id: '',
           EId: '',
@@ -303,7 +299,7 @@
           Number: '',
           Type: '',
           Manufacturer: '',
-          ProductionDate: '',
+          ProductionDate: new Date(),
           Capacity: '',
           RatedVoltage: '',
           RatedCurrent: '',
@@ -322,7 +318,7 @@
           AvgReactive: '',
           NegativeReactive: '',
           Apparent: '',
-          TestTime: '',
+          TestTime: new Date(),
           PowerFactor: '',
           EquipName: '',
           EquipStatus: '',
@@ -343,92 +339,73 @@
         }
       }
     },
+    created () {
+      // this.EId = this.$route.query.eid
+      // this.TaskBalanceId = this.$route.query.tbid
+      this.DataEntryId = 15// this.$route.query.deid
+      this.formData.DataEntryId = parseInt(this.DataEntryId)
+      this.initData()
+    },
     methods: {
       saveEntity () {
         this.$refs['formData'].validate((valid) => {
           if (valid) {
-            alert('submit!')
+            if (this.formData.Id > 0) {
+              this.updateEntity()
+            } else {
+              this.addEntity()
+            }
           } else {
-            console.log('error submit!!')
             return false
           }
         })
       },
-      numberCheck (str) {
-        switch (str) {
-          case 'TrafficTest1':
-            this.formData.TrafficTest1 = this.formData.TrafficTest1.replace(/[^0-9.-]/g, '')
-            break
-          case 'TrafficTest2':
-            this.formData.TrafficTest2 = this.formData.TrafficTest2.replace(/[^0-9.-]/g, '')
-            break
-          case 'TrafficTest3':
-            this.formData.TrafficTest3 = this.formData.TrafficTest3.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpSuction1':
-            this.formData.PumpSuction1 = this.formData.PumpSuction1.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpSuction2':
-            this.formData.PumpSuction2 = this.formData.PumpSuction2.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpSuction3':
-            this.formData.PumpSuction3 = this.formData.PumpSuction3.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpDischarge1':
-            this.formData.PumpDischarge1 = this.formData.PumpDischarge1.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpDischarge2':
-            this.formData.PumpDischarge2 = this.formData.PumpDischarge2.replace(/[^0-9.-]/g, '')
-            break
-          case 'PumpDischarge3':
-            this.formData.PumpDischarge3 = this.formData.PumpDischarge3.replace(/[^0-9.-]/g, '')
-            break
-          case 'ThrottlePressure1':
-            this.formData.ThrottlePressure1 = this.formData.ThrottlePressure1.replace(/[^0-9.-]/g, '')
-            break
-          case 'ThrottlePressure2':
-            this.formData.ThrottlePressure2 = this.formData.ThrottlePressure2.replace(/[^0-9.-]/g, '')
-            break
-          case 'ThrottlePressure3':
-            this.formData.ThrottlePressure3 = this.formData.ThrottlePressure3.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestVoltage1':
-            this.formData.TestVoltage1 = this.formData.TestVoltage1.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestVoltage2':
-            this.formData.TestVoltage2 = this.formData.TestVoltage2.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestVoltage3':
-            this.formData.TestVoltage3 = this.formData.TestVoltage3.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestCurrent1':
-            this.formData.TestCurrent1 = this.formData.TestCurrent1.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestCurrent2':
-            this.formData.TestCurrent2 = this.formData.TestCurrent2.replace(/[^0-9.-]/g, '')
-            break
-          case 'TestCurrent3':
-            this.formData.TestCurrent3 = this.formData.TestCurrent3.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorPower1':
-            this.formData.MotorPower1 = this.formData.MotorPower1.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorPower2':
-            this.formData.MotorPower2 = this.formData.MotorPower2.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorPower3':
-            this.formData.MotorPower3 = this.formData.MotorPower3.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorFactor1':
-            this.formData.MotorFactor1 = this.formData.MotorFactor1.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorFactor2':
-            this.formData.MotorFactor2 = this.formData.MotorFactor2.replace(/[^0-9.-]/g, '')
-            break
-          case 'MotorFactor3':
-            this.formData.MotorFactor3 = this.formData.MotorFactor3.replace(/[^0-9.-]/g, '')
-            break
-        }
+      addEntity () {
+        api.addEntity(this.formData, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.formData.Id = res.data.item
+            this.initData()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+      updateEntity () {
+        api.updateEntity(this.formData.Id, this.formData, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.initData()
+            this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+          } else {
+            this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        }).catch(err => {
+          console.error(err)
+        })
+      },
+      initData () {
+        api.getEntityByDataEntryId(this.formData.DataEntryId, this.$axios).then(res => {
+          if (res.data.code === 0) {
+            this.formData = res.data.item
+          } else {
+          }
+        }).catch(err => {
+          console.error(err)
+        })
       }
 
     }