Browse Source

电动机节能

lining 6 years ago
parent
commit
b40825dcfe

+ 48 - 0
src/dashoo.cn/backend/api/business/limsreportmotor/limsreportmotor.go

@@ -0,0 +1,48 @@
+package limsreportmotor
+
+
+import "time"
+
+type LimsReportMotor struct {
+	Id                  int       `xorm:"not null pk autoincr INT(10)"`
+	EId                 int       `xorm:"comment('委托单ID') INT(11)"`
+	TaskBalanceId       int       `xorm:"comment('任务分配表ID') INT(11)"`
+	DataEntryId         int       `xorm:"comment('数据记录表ID') INT(11)"`
+	TestDepartId        int       `xorm:"comment('受检单位ID') INT(11)"`
+	InstalPositionId    int       `xorm:"comment('安装位置ID') INT(11)"`
+	CreateReportStatus  int       `xorm:"comment('报告生成状态') INT(11)"`
+	InstalPosition      string    `xorm:"comment('安装位置') VARCHAR(100)"`
+	TestDepart          string    `xorm:"comment('受检单位') VARCHAR(100)"`
+	DeviceName          string    `xorm:"comment('设备名称及编号') VARCHAR(50)"`
+	SectionMonitor      string    `xorm:"comment('节监通知号') VARCHAR(255)"`
+	MotorType           string    `xorm:"comment('电动机型号') VARCHAR(255)"`
+	RatedPower          float64    `xorm:"comment('额定功率') DECIMAL(10,2)"`
+	RatedVoltage        float64    `xorm:"comment('额定电压') DECIMAL(10,2)"`
+	RatedCurrent        float64    `xorm:"comment('额定电流') DECIMAL(10,2)"`
+	RatedSpeed          float64    `xorm:"comment('额定转速') DECIMAL(10,2)"`
+	RatedEfficiency     float64    `xorm:"comment('额定效率') DECIMAL(10,2)"`
+	RatedNoloadPower    float64    `xorm:"comment('额定空载功率') DECIMAL(10,2)"`
+	RatedPowerFactor    float64    `xorm:"comment('标额定功率因数') DECIMAL(10,2)"`
+	NoloadCurrent       float64    `xorm:"comment('空载电流') DECIMAL(10,2)"`
+	Insulation          string    `xorm:"comment('制造厂') VARCHAR(50)"`
+	Standard            string    `xorm:"comment('依据标准') VARCHAR(100)"`
+	UseInstrument       string    `xorm:"comment('使用仪器') VARCHAR(50)"`
+	BeforeTesting       string    `xorm:"comment('测试前仪器状态') VARCHAR(20)"`
+	AfterTesting        string    `xorm:"comment('测试后仪器状态') VARCHAR(20)"`
+	Temperature         float64    `xorm:"comment('环境温度') DECIMAL(10,2)"`
+	RelativeHumidity    float64    `xorm:"comment('相对湿度') DECIMAL(10,2)"`
+	Voltage             float64    `xorm:"comment('电压') DECIMAL(10,2)"`
+	Electric            float64    `xorm:"comment('电流') DECIMAL(10,2)"`
+	ActivePower         float64    `xorm:"comment('有功功率') DECIMAL(10,2)"`
+	ReactivePower       float64    `xorm:"comment('无功功率') DECIMAL(10,2)"`
+	ApparentPower       float64    `xorm:"comment('视在功率') DECIMAL(10,2)"`
+	PowerFactor         float64    `xorm:"comment('功率因数') DECIMAL(10,2)"`
+	OperatingEfficiency 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/limsreportmotor/limsreportmotorService.go

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

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

@@ -232,6 +232,7 @@ var (
 	LimsReportAlertorValueName				 string = "LimsReportAlertorValue" // 计量站报警器 报警误差/报警功能及报警动作值
 	LimsReportLiquidTransportationName       string = "LimsReportLiquidTransportation" //离心泵机组液体输送系统节能监测原始记录
 	LimsReportPistonPumpUnitName             string = "LimsReportPistonPumpUnit" //柱塞泵机组液体输送系统节能监测原始记录
+	LimsReportMotorName                      string = "LimsReportMotor" // 电动机节能监测原始记录
 )
 
 //分页信息及数据

+ 435 - 0
src/dashoo.cn/backend/api/controllers/lims/limsreportmotor.go

@@ -0,0 +1,435 @@
+package lims
+
+import (
+"dashoo.cn/business/userRole"
+"dashoo.cn/backend/api/business/baseUser"
+"dashoo.cn/backend/api/business/limsreportmotor"
+. "dashoo.cn/backend/api/controllers"
+"dashoo.cn/utils"
+"encoding/json"
+"strings"
+"time"
+)
+
+type LimsReportMotorController struct {
+	BaseController
+}
+
+// @Title 获取列表
+// @Description get user by token
+// @Success 200 {object} []limsreportmotor.LimsReportMotor
+// @router /list [get]
+func (this *LimsReportMotorController) 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")
+	SectionMonitor := this.GetString("SectionMonitor")
+	MotorType := this.GetString("MotorType")
+	RatedPower := this.GetString("RatedPower")
+	RatedVoltage := this.GetString("RatedVoltage")
+	RatedCurrent := this.GetString("RatedCurrent")
+	RatedSpeed := this.GetString("RatedSpeed")
+	RatedEfficiency := this.GetString("RatedEfficiency")
+	RatedNoloadPower := this.GetString("RatedNoloadPower")
+	RatedPowerFactor := this.GetString("RatedPowerFactor")
+	NoloadCurrent := this.GetString("NoloadCurrent")
+	Insulation := this.GetString("Insulation")
+	Standard := this.GetString("Standard")
+	UseInstrument := this.GetString("UseInstrument")
+	BeforeTesting := this.GetString("BeforeTesting")
+	AfterTesting := this.GetString("AfterTesting")
+	Temperature := this.GetString("Temperature")
+	RelativeHumidity := this.GetString("RelativeHumidity")
+	Voltage := this.GetString("Voltage")
+	Electric := this.GetString("Electric")
+	ActivePower := this.GetString("ActivePower")
+	ReactivePower := this.GetString("ReactivePower")
+	ApparentPower := this.GetString("ApparentPower")
+	PowerFactor := this.GetString("PowerFactor")
+	OperatingEfficiency := this.GetString("OperatingEfficiency")
+	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 SectionMonitor != "" {
+		where = where + " and SectionMonitor like '%" + SectionMonitor + "%'"
+	}
+
+
+	if MotorType != "" {
+		where = where + " and MotorType like '%" + MotorType + "%'"
+	}
+
+
+	if RatedPower != "" {
+		where = where + " and RatedPower like '%" + RatedPower + "%'"
+	}
+
+
+	if RatedVoltage != "" {
+		where = where + " and RatedVoltage like '%" + RatedVoltage + "%'"
+	}
+
+
+	if RatedCurrent != "" {
+		where = where + " and RatedCurrent like '%" + RatedCurrent + "%'"
+	}
+
+
+	if RatedSpeed != "" {
+		where = where + " and RatedSpeed like '%" + RatedSpeed + "%'"
+	}
+
+
+	if RatedEfficiency != "" {
+		where = where + " and RatedEfficiency like '%" + RatedEfficiency + "%'"
+	}
+
+
+	if RatedNoloadPower != "" {
+		where = where + " and RatedNoloadPower like '%" + RatedNoloadPower + "%'"
+	}
+
+
+	if RatedPowerFactor != "" {
+		where = where + " and RatedPowerFactor like '%" + RatedPowerFactor + "%'"
+	}
+
+
+	if NoloadCurrent != "" {
+		where = where + " and NoloadCurrent like '%" + NoloadCurrent + "%'"
+	}
+
+
+	if Insulation != "" {
+		where = where + " and Insulation like '%" + Insulation + "%'"
+	}
+
+
+	if Standard != "" {
+		where = where + " and Standard like '%" + Standard + "%'"
+	}
+
+
+	if UseInstrument != "" {
+		where = where + " and UseInstrument like '%" + UseInstrument + "%'"
+	}
+
+
+	if BeforeTesting != "" {
+		where = where + " and BeforeTesting like '%" + BeforeTesting + "%'"
+	}
+
+
+	if AfterTesting != "" {
+		where = where + " and AfterTesting like '%" + AfterTesting + "%'"
+	}
+
+
+	if Temperature != "" {
+		where = where + " and Temperature like '%" + Temperature + "%'"
+	}
+
+
+	if RelativeHumidity != "" {
+		where = where + " and RelativeHumidity like '%" + RelativeHumidity + "%'"
+	}
+
+
+	if Voltage != "" {
+		where = where + " and Voltage like '%" + Voltage + "%'"
+	}
+
+
+	if Electric != "" {
+		where = where + " and Electric like '%" + Electric + "%'"
+	}
+
+
+	if ActivePower != "" {
+		where = where + " and ActivePower like '%" + ActivePower + "%'"
+	}
+
+
+	if ReactivePower != "" {
+		where = where + " and ReactivePower like '%" + ReactivePower + "%'"
+	}
+
+
+	if ApparentPower != "" {
+		where = where + " and ApparentPower like '%" + ApparentPower + "%'"
+	}
+
+
+	if PowerFactor != "" {
+		where = where + " and PowerFactor like '%" + PowerFactor + "%'"
+	}
+
+
+	if OperatingEfficiency != "" {
+		where = where + " and OperatingEfficiency like '%" + OperatingEfficiency + "%'"
+	}
+
+
+	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 := limsreportmotor.GetLimsReportMotorService(utils.DBE)
+	var list []limsreportmotor.LimsReportMotor
+	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 *LimsReportMotorController) 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} limsreportmotor.LimsReportMotor
+// @router /get/:id [get]
+func (this *LimsReportMotorController) GetEntity() {
+	Id := this.Ctx.Input.Param(":id")
+	where := "DataEntryId=" + Id
+	var model limsreportmotor.LimsReportMotor
+	svc := limsreportmotor.GetLimsReportMotorService(utils.DBE)
+	//svc.GetEntityByIdBytbl(this.User.AccCode+LimsReportMotorName, Id, &model)
+	has := svc.GetEntityByWhere(this.User.AccCode+LimsReportMotorName, 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 新增
+// @Param 	body body limsreportmotor.LimsReportMotor
+// @Success	200	{object} controllers.Request
+// @router /add [post]
+func (this *LimsReportMotorController) AddEntity() {
+	var model limsreportmotor.LimsReportMotor
+	var jsonBlob = this.Ctx.Input.RequestBody
+	svc := limsreportmotor.GetLimsReportMotorService(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+LimsReportMotorName, &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 limsreportmotor.LimsReportMotor
+// @Success	200	{object} controllers.Request
+// @router /update/:id [post]
+func (this *LimsReportMotorController) 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 limsreportmotor.LimsReportMotor
+	svc := limsreportmotor.GetLimsReportMotorService(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",
+		"SectionMonitor",
+		"MotorType",
+		"RatedPower",
+		"RatedVoltage",
+		"RatedCurrent",
+		"RatedSpeed",
+		"RatedEfficiency",
+		"RatedNoloadPower",
+		"RatedPowerFactor",
+		"NoloadCurrent",
+		"Insulation",
+		"Standard",
+		"UseInstrument",
+		"BeforeTesting",
+		"AfterTesting",
+		"Temperature",
+		"RelativeHumidity",
+		"Voltage",
+		"Electric",
+		"ActivePower",
+		"ReactivePower",
+		"ApparentPower",
+		"PowerFactor",
+		"OperatingEfficiency",
+		"Remark",
+		"CreateUserId",
+		"CreateOn",
+		"CreateBy",
+		"ModifiedOn",
+		"ModifiedUserId",
+		"ModifiedBy",
+	}
+	err := svc.UpdateEntityBytbl(this.User.AccCode+LimsReportMotorName, 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 *LimsReportMotorController) 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 limsreportmotor.LimsReportMotor
+	var entityempty limsreportmotor.LimsReportMotor
+	svc := limsreportmotor.GetLimsReportMotorService(utils.DBE)
+	opdesc := "删除-" + Id
+	err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+LimsReportMotorName, 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

@@ -452,6 +452,12 @@ func init() {
 				&lims.LimsReportPistonPumpUnitController{},
 			),
 		),
+		// 柱塞泵机组液体输送系统节能监测原始记录
+		beego.NSNamespace("/limsreportmotor",
+			beego.NSInclude(
+				&lims.LimsReportMotorController{},
+			),
+		),
 	)
 	beego.AddNamespace(ns)
 }

+ 41 - 0
src/dashoo.cn/frontend_web/src/api/lims/limsreportmotor.js

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

+ 121 - 136
src/dashoo.cn/frontend_web/src/pages/lims/reportmotor/_opera/operation.vue

@@ -1,10 +1,10 @@
 <template>
   <div>
-    <!--<el-breadcrumb class="heading">-->
-    <!--<el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>-->
-    <!--<el-breadcrumb-item :to="{ path: '/lims/' }">离心泵机组液体输送系统节能监测原始记录</el-breadcrumb-item>-->
-    <!--<el-breadcrumb-item>编辑</el-breadcrumb-item>-->
-    <!--</el-breadcrumb>-->
+    <el-breadcrumb class="heading">
+      <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
+      <el-breadcrumb-item :to="{ path: '/lims/dataentry' }">数据录入</el-breadcrumb-item>
+      <el-breadcrumb-item>电动机节能监测原始记录</el-breadcrumb-item>
+    </el-breadcrumb>
     <el-card class="box-card">
       <div slot="header">
         <span>
@@ -21,7 +21,7 @@
         <el-row>
           <el-col :span="6">
             <el-form-item label="被测单位名称">
-              <el-input v-model.trim="formData.SectionMonitor" placeholder="请输入" style="width: 100%"></el-input>
+              <el-input v-model.trim="formData.TestDepart" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
@@ -29,73 +29,71 @@
               <el-input v-model.trim="formData.SectionMonitor" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="12">
-            <el-form-item label="安装地点及设备名称" label-width="150px">
-              <el-input v-model.trim="formData.SectionMonitor" placeholder="请输入" style="width: 100%"></el-input>
+          <el-col :span="6">
+            <el-form-item label="安装地点" label-width="150px">
+              <el-input v-model.trim="formData.InstalPosition" placeholder="请输入" style="width: 100%"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item label="设备名称" label-width="150px">
+              <el-input v-model.trim="formData.DeviceName" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="电动机型号">
-              <el-input v-model.trim="formData.SectionMonitor" placeholder="请输入" style="width: 100%"></el-input>
+              <el-input v-model.trim="formData.MotorType" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="额定功率"
-                          prop="RatedPower"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.number="formData.RatedPower" placeholder="请输入" style="width: 100%">
+                          prop="RatedPower">
+              <el-input type="number" step="0.01" v-model.number="formData.RatedPower" placeholder="请输入" style="width: 100%">
                 <template slot="append">kW</template>
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <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">V</template>
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="额定转速"
-                          prop="RatedSpeed"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.number="formData.RatedSpeed" placeholder="请输入" style="width: 100%">
+                          prop="RatedSpeed">
+              <el-input type="number" step="0.01" v-model.number="formData.RatedSpeed" placeholder="请输入" style="width: 100%">
                 <template slot="append">r/min</template>
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="额定效率"
-                          prop="RatedEfficiency"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.number="formData.RatedEfficiency" placeholder="请输入" style="width: 100%">
+                          prop="RatedEfficiency">
+              <el-input type="number" step="0.01" v-model.number="formData.RatedEfficiency" placeholder="请输入" style="width: 100%">
                 <template slot="append">%</template>
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="额定空载功率"
-                          prop="RatedNoloadPower"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.number="formData.RatedNoloadPower" placeholder="请输入" style="width: 100%">
+                          prop="RatedNoloadPower">
+              <el-input type="number" step="0.01" v-model.number="formData.RatedNoloadPower" placeholder="请输入" style="width: 100%">
                 <template slot="append">kW</template>
               </el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="额定功率因数"
-                          prop="RatedPowerFactor"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.number="formData.RatedPowerFactor" placeholder="请输入" style="width: 100%"></el-input>
+                          prop="RatedPowerFactor">
+              <el-input type="number" step="0.01" v-model.number="formData.RatedPowerFactor" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="6">
             <el-form-item label="空载电流"
-                          prop="NoloadCurrent"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.number="formData.NoloadCurrent" placeholder="请输入" style="width: 100%">
+                          prop="NoloadCurrent">
+              <el-input type="number" step="0.01" v-model.number="formData.NoloadCurrent" placeholder="请输入" style="width: 100%">
                 <template slot="append">A</template>
               </el-input>
             </el-form-item>
@@ -107,7 +105,7 @@
           </el-col>
           <el-col :span="6">
             <el-form-item label="依据标准">
-              <el-input v-model.trim="formData.SectionMonitor" placeholder="请输入" style="width: 100%"></el-input>
+              <el-input v-model.trim="formData.Standard" placeholder="请输入" style="width: 100%"></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -127,18 +125,16 @@
           </el-col>
           <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="6">
             <el-form-item label="相对湿度"
-                          prop="RelativeHumidity"
-                          :rules="[ { type: 'number', message: '必须为数字'}]">
-              <el-input v-model.trim="formData.RelativeHumidity" placeholder="请输入" style="width: 100%">
+                          prop="RelativeHumidity">
+              <el-input type="number" step="0.01" v-model.number="formData.RelativeHumidity" placeholder="请输入" style="width: 100%">
                 <template slot="append">%</template>
               </el-input>
             </el-form-item>
@@ -151,62 +147,55 @@
           <el-row>
             <el-col :span="6">
               <el-form-item label="电压"
-                            prop="Voltage"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.Voltage" placeholder="请输入" style="width: 100%">
+                            prop="Voltage">
+                <el-input type="number" step="0.01" v-model.number="formData.Voltage" placeholder="请输入" style="width: 100%">
                   <template slot="append">V</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="电流"
-                            prop="Electric"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.Electric" placeholder="请输入" style="width: 100%">
+                            prop="Electric">
+                <el-input type="number" step="0.01" v-model.number="formData.Electric" placeholder="请输入" style="width: 100%">
                   <template slot="append">A</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="有功功率"
-                            prop="ActivePower"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.ActivePower" placeholder="请输入" style="width: 100%">
+                            prop="ActivePower">
+                <el-input type="number" step="0.01" v-model.number="formData.ActivePower" placeholder="请输入" style="width: 100%">
                   <template slot="append">kW</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="无功功率"
-                            prop="ReactivePower"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.ReactivePower" placeholder="请输入" style="width: 100%">
+                            prop="ReactivePower">
+                <el-input type="number" step="0.01" v-model.number="formData.ReactivePower" placeholder="请输入" style="width: 100%">
                   <template slot="append">kvar</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <el-col :span="6">
               <el-form-item label="视在功率"
-                            prop="ApparentPower"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.ApparentPower" placeholder="请输入" style="width: 100%">
+                            prop="ApparentPower">
+                <el-input type="number" step="0.01" v-model.number="formData.ApparentPower" placeholder="请输入" style="width: 100%">
                   <template slot="append">kVA</template>
                 </el-input>
               </el-form-item>
             </el-col>
             <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="6">
               <el-form-item label="运行频率"
-                            prop="OperatingEfficiency"
-                            :rules="[ { type: 'number', message: '必须为数字'}]">
-                <el-input v-model.number="formData.OperatingEfficiency" placeholder="请输入" style="width: 100%">
+                            prop="OperatingEfficiency">
+                <el-input type="number" step="0.01" v-model.number="formData.OperatingEfficiency" placeholder="请输入" style="width: 100%">
                   <template slot="append">Hz</template>
                 </el-input>
               </el-form-item>
@@ -234,6 +223,7 @@
   import {
     mapGetters
   } from 'vuex'
+  import api from '@/api/lims/limsreportmotor'
 
   export default {
     computed: {
@@ -244,8 +234,22 @@
     name: '',
     data () {
       return {
+        Id: '',
+        EId: '',
+        TaskBalanceId: '',
+        DataEntryId: '',
         formData: {
           Id: '',
+          EId: '',
+          TaskBalanceId: '',
+          DataEntryId: '',
+          TestDepartId: '',
+          InstalPositionId: '',
+          CreateReportStatus: '',
+          InstalPosition: '',
+          TestDepart: '',
+          DeviceName: '',
+          Standard: '',
           SectionMonitor: '',
           MotorType: '',
           RatedPower: '',
@@ -284,92 +288,73 @@
         }
       }
     },
+    created () {
+      // this.EId = this.$route.query.eid
+      // this.TaskBalanceId = this.$route.query.tbid
+      this.DataEntryId = 15// this.$route.query.deid
+      this.initData()
+    },
     methods: {
       saveEntity () {
         this.$refs['formData'].validate((valid) => {
           if (valid) {
-            alert('submit!')
+            this.formData.DataEntryId = parseInt(this.DataEntryId)
+            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.getEntity(this.DataEntryId, this.$axios).then(res => { // this.formData.Id
+          if (res.data.code === 0) {
+            this.formData = res.data.item
+          } else {
+          }
+        }).catch(err => {
+          console.error(err)
+        })
       }
 
     }