all преди 5 години
родител
ревизия
52975c319f

+ 43 - 0
.gitignore

@@ -0,0 +1,43 @@
+# Compiled Object files, Static and Dynamic libs (Shared Objects)
+*.o
+*.a
+*.so
+
+# Folders
+_obj
+_test
+
+# Architecture specific extensions/prefixes
+*.[568vq]
+[568vq].out
+
+*.cgo1.go
+*.cgo2.c
+_cgo_defun.c
+_cgo_gotypes.go
+_cgo_export.*
+
+_testmain.go
+
+*.exe
+*.test
+*.prof
+
+# dist目录
+sample/front_end
+dist
+
+# 生成的可执行文件
+sample/sample
+src/dashoo.cn/dqm_api/dqm_api
+src/dashoo.cn/dqm_frontend_server/dqm_frontend_server
+src/dashoo.cn/genepoint_interface/genepoint_interface
+
+
+
+# beego临时文件
+lastupdate.tmp
+commentsRouter_*.go
+
+# Editor directories and files
+.idea

+ 149 - 0
backend/src/dashoo.cn/modi_webapi/app/api/instrument/instrument.go

@@ -0,0 +1,149 @@
+package instrument
+
+import (
+	"dashoo.cn/modi_webapi/app/service/instrument"
+	"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 {
+}
+
+func (c *Controller) GetAllInstrument(r *ghttp.Request){
+	page := request.GetPageInfo(r)
+	where := ""
+
+	if productway := r.GetString("ProductWay"); productway != ""{
+		if where == ""{
+			where = fmt.Sprintf(" ProductWay = %v", productway)
+		} else {
+			where += fmt.Sprintf(" AND ProductWay = %v", productway)
+		}
+	}
+
+	if name := r.GetString("ProductName"); name != ""{
+		if where == ""{
+			where = fmt.Sprintf(" ProductName LIKE '%%%v%%'", name)
+		} else {
+			where += fmt.Sprintf(" AND ProductName LIKE '%%%v%%'", name)
+		}
+	}
+
+	var result []instrument.Entity
+	if err := instrument.GetAllInstrument(page, where, &result); err != nil{
+		if err.Error() == "sql: no rows in result set"{
+			response.Json(r, 0, "")
+			return
+		}
+		response.Json(r, -1, err.Error())
+	}else {
+		count, err1 := instrument.FindInstrumentCount(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)
+		}
+	}
+}
+
+
+func (c *Controller) GetOneInstrument(r *ghttp.Request){
+	id := r.GetInt("id")
+	if result, err := instrument.FindOne(id); err != nil {
+		response.Json(r, 1, err.Error())
+		r.ExitAll()
+	}else {
+		var records response.PagedRecords
+		records.Records = result
+		response.Json(r, 0, "", records)
+	}
+
+}
+
+func (c *Controller) AddInstrument(r *ghttp.Request){
+	Instrument := new(instrument.Entity)
+	fmt.Println("---Instrument---",Instrument)
+	if err := r.Parse(Instrument); 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()
+	}
+
+	realName := r.GetParamVar("realname").String()
+	userId := r.GetParamVar("userid").Int()
+	currentTime := gtime.Now()
+
+	Instrument.CreateOn = currentTime
+	Instrument.CreateBy = realName
+	Instrument.CreateUserId = userId
+
+	Instrument.ModifiedOn = currentTime
+	Instrument.ModifiedBy = realName
+	Instrument.ModifiedUserId = userId
+
+	if result,err := instrument.Insert(Instrument); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		var records response.PagedRecords
+		id, _ := result.LastInsertId()
+		Instrument.Id = int(id)
+		records.Records = Instrument
+		response.Json(r, 0, "", records)
+	}
+}
+
+func (c *Controller) UpdateInstrument(r *ghttp.Request){
+	Instrument := new(instrument.Entity)
+	if err := r.Parse(Instrument); 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()
+	}
+
+	realName := r.GetParamVar("realname").String()
+	userId := r.GetParamVar("userid").Int()
+	currentTime := gtime.Now()
+
+	Instrument.ModifiedOn = currentTime
+	Instrument.ModifiedBy = realName
+	Instrument.ModifiedUserId = userId
+
+	if _,err := instrument.Replace(Instrument); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		var records response.PagedRecords
+		//id, _ := result.LastInsertId()
+		//theChargeRecord.Id = int(id)
+		records.Records = Instrument
+		response.Json(r, 0, "", records)
+	}
+}
+
+func (c *Controller) DeleteInstrument(r *ghttp.Request){
+	id := r.GetInt("id")
+	if _,err := instrument.Delete(fmt.Sprintf("Id=%v", id)); err != nil{
+		response.Json(r, 1, err.Error())
+		r.ExitAll()
+	} else {
+		response.Json(r, 0, "该记录已删除!")
+	}
+}

+ 23 - 0
backend/src/dashoo.cn/modi_webapi/app/service/instrument/instrument.go

@@ -0,0 +1,23 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package instrument
+
+import (
+	"dashoo.cn/modi_webapi/library/request"
+	"github.com/gogf/gf/frame/g"
+)
+
+var (
+	recordsTable = g.DB().Table("instrument").Safe()
+)
+
+func GetAllInstrument(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 FindInstrumentCount(where string)(int, error){
+	return recordsTable.Where(where).Count()
+}

+ 89 - 0
backend/src/dashoo.cn/modi_webapi/app/service/instrument/instrument_entity.go

@@ -0,0 +1,89 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. You may not really want to edit it.
+// ==========================================================================
+
+package instrument
+
+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)"`
+	Code                    string    `xorm:"VARCHAR(50)"`      //设备编码
+	Name                    string    `xorm:"VARCHAR(255)"`     //设备名称
+	SupplierId              int       `xorm:"INT(10)"`          //供应商Id
+	Supplier                string    `xorm:"VARCHAR(255)"`     //供应商
+	FactoryNum              string    `xorm:"VARCHAR(255)"`     //出厂编号
+	Model                   string    `xorm:"VARCHAR(255)"`     //型号
+	Brand                   string    `xorm:"VARCHAR(255)"`     //设备品牌
+	Classification          string    `xorm:"VARCHAR(255)"`     //设备大类
+	Location                string    `xorm:"VARCHAR(50)"`      //设备所在位置
+	Remarks                 string    `xorm:"VARCHAR(255)"`     //备注
+	State                   int       `xorm:"INT(10)"`          //设备状态 1正常 2异常
+	CalibrationTime         *gtime.Time`xorm:"DATETIME"`         //校准时间
+	CalibrationDeadline     int       `xorm:"INT(10)"`          //校准使用期限
+	CalibrationDeadlineType int       `xorm:"INT(10)"`          //期限类型:1:天 2:周 3:月 4:年
+	MaintenCycle            int       `xorm:"INT(10)"`          //维护周期数
+	CycleType               int       `xorm:"INT(10)"`          //维护周期类型
+	FileUrl                 string    `xorm:"VARCHAR(50)"`      //操作规程文件路径
+	FileName                string    `xorm:"VARCHAR(50)"`      //操作规程文件名称
+	HeartbeatTime           *gtime.Time `xorm:"DATETIME created"` //心跳时间 对应服务器时间
+	Spec                    string       `xorm:"VARCHAR(255)"`          //规格
+	IsFixedPoint            int       `xorm:"INT(2)"`
+	CreateOn                *gtime.Time `xorm:"DATETIME created"`
+	CreateUserId            int       `xorm:"INT(10)"`
+	CreateBy                string    `xorm:"VARCHAR(50)"`
+	ModifiedOn              *gtime.Time `xorm:"DATETIME updated"`
+	ModifiedUserId          int       `xorm:"INT(10)"`
+	ModifiedBy              string    `xorm:"VARCHAR(50)"`
+	Remark                  string    `xorm:"VARCHAR(50)"`
+	TimeNotification        int       `xorm:"INT(10)"`
+	Sharable                int       `xorm:"TINYINT"`
+	Responsible             string    `xorm:"VARCHAR(50)"` //责任人
+	EndTime                 *gtime.Time `xorm:"DATETIME"`    //截止日期
+	Purchasedate             *gtime.Time `xorm:"DATETIME"`    //采购日期
+	MaintenTime             *gtime.Time `xorm:"DATE"`        //维护日期
+	JoinPlan                bool      `xorm:"TINYINT"`     //是否参与点检计划
+}
+
+// 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/service/instrument/instrument_model.go

@@ -0,0 +1,369 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. You may not really want to edit it.
+// ==========================================================================
+
+package instrument
+
+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 = "instrument"
+	// 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)
+	})
+
+}

+ 2 - 1
backend/src/dashoo.cn/modi_webapi/config/config.toml

@@ -12,7 +12,8 @@
 [database]
     [[database.default]]
         Debug = true
-        link = "mysql:modi_user:Y6Ba64w1Hezo@tcp(39.98.34.197:3307)/modi_db"
+#          link = "mysql:modi_user:Y6Ba64w1Hezo@tcp(39.98.34.197:3307)/modi_db"
+        link = "mysql:l_lims_u:TmBT65FNAAqJoBMl@tcp(rm-8vbk16zx2rbfu6jt6uo.mysql.zhangbei.rds.aliyuncs.com)/l_lims"
 
 # Redis数据库配置
 [redis]

+ 15 - 0
backend/src/dashoo.cn/modi_webapi/library/request/request.go

@@ -0,0 +1,15 @@
+package request
+
+import "github.com/gogf/gf/net/ghttp"
+
+type PageInfo struct {
+	Current int `json:"current"` //分页当前页
+	Size    int `json:"size"`    //分页记录数条数
+}
+
+func GetPageInfo(r *ghttp.Request) PageInfo {
+	var page PageInfo
+	page.Current = r.GetInt("current")
+	page.Size = r.GetInt("size")
+	return page
+}

+ 31 - 0
backend/src/dashoo.cn/modi_webapi/library/response/response.go

@@ -0,0 +1,31 @@
+package response
+
+import (
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/net/ghttp"
+)
+
+type PagedRecords struct {
+	Current int         `json:"current,omitempty"` //分页当前页
+	Total   int         `json:"total,omitempty"`   //结果总数
+	Size    int         `json:"size,omitempty"`    //分页记录数条数
+	Records interface{} `json:"records,omitempty"` //数据
+}
+
+// 标准返回结果数据结构封装。
+// 返回固定数据结构的JSON:
+// code:  错误码(0:成功, 1:失败, >1:错误码);
+// msg:  请求结果信息;
+// data: 请求结果,根据不同接口返回结果的数据结构不同;
+func Json(r *ghttp.Request, code int, msg string, data ...interface{}) {
+	responseData := interface{}(nil)
+	if len(data) > 0 {
+		responseData = data[0]
+	}
+	r.Response.WriteJson(g.Map{
+		"code": code,
+		"msg":  msg,
+		"data": responseData,
+	})
+	r.Exit()
+}

+ 2 - 0
backend/src/dashoo.cn/modi_webapi/router/router.go

@@ -1,6 +1,7 @@
 package router
 
 import (
+	"dashoo.cn/modi_webapi/app/api/instrument"
 	"dashoo.cn/modi_webapi/app/api/demo"
 	"dashoo.cn/modi_webapi/app/api/microDemo"
 	"dashoo.cn/modi_webapi/app/api/neo"
@@ -44,6 +45,7 @@ func init() {
 		{"ALL", "/permission", new(permission.Controller)},
 		{"ALL", "/organize", new(organize.Controller)},
 		{"ALL", "/menu", new(menu.Controller)},
+		{"All", "/instrument", new ( instrument.Controller) },
 		// 配置测试路由
 		{"ALL", "/class", new(demo.ClassController)},
 		{"ALL", "/student", new(demo.StudentController)},

+ 1 - 1
frontend_web/.env.development

@@ -21,4 +21,4 @@ VUE_APP_MODULE01=http://localhost:8081/#
 VUE_APP_MODULE02=http://localhost:8082/#
 
 # 租户
-VUE_APP_TENANT=default
+VUE_APP_TENANT=CU6zmPWhZp

+ 1 - 0
frontend_web/.gitignore

@@ -1,6 +1,7 @@
 .DS_Store
 node_modules
 /dist
+/.env.development
 
 # Log files
 npm-debug.log*

+ 48 - 0
frontend_web/src/api/instrument.js

@@ -0,0 +1,48 @@
+import request from '@/plugin/axios'
+
+export default {
+   // 产品方案 ----获取产品信息列表
+  getAllInstrument(params) {
+    return request({
+      url: process.env.VUE_APP_API02 + 'instrument/getallinstrument',
+      method: 'get', 
+      params: params
+    })
+  },
+
+  getOneInstrument(params) {
+    return request({
+      url: process.env.VUE_APP_API02 + 'instrument/getoneinstrument',
+      method: 'get', 
+      params: params
+    })
+  },
+
+  //删除产品信息
+   deleteInstrument(params) {
+    return request({
+      url: process.env.VUE_APP_API02 + 'instrument/deleteinstrument',
+      method: 'delete',
+      params: params
+    })
+  },
+  
+   // 保存产品方案
+  AddInstrument (data) {
+    return request({
+      url: process.env.VUE_APP_API02 + 'instrument/addinstrument',
+      method: 'post',
+      data: data
+    })
+  },
+  
+  UpdateInstrument (data) {
+    return request({
+      url: process.env.VUE_APP_API02 + 'instrument/updateinstrument',
+      method: 'post',
+      data: data
+    })
+  },
+ 
+  
+}

+ 11 - 0
frontend_web/src/router/routes.js

@@ -57,6 +57,17 @@ const frameIn = [
         },
         component: _import('demo/page3')
       },
+     // 设备管理
+     {
+      path: 'instrument',
+      name: 'instrument',
+      meta: {
+        title: '设备管理',
+        auth: true
+      },
+      component: _import('instrument')
+    },
+      
       // 系统 前端日志
       {
         path: 'log',

+ 548 - 0
frontend_web/src/views/instrument/components/instrumentadd.vue

@@ -0,0 +1,548 @@
+<template>
+  <el-dialog title="添加设备管理"
+             :visible.sync="dialogvisible"
+             width="65%"
+             :before-close="handleCloseAdd">
+    <el-form size="mini"
+             :model="testlistform"
+             :rules="rulestestlistform"
+             label-width="100px"
+             ref="testlistform">
+      <el-row :gutter="20"
+              class="donorsaddformcss">
+        <el-col :span="8">
+          <el-form-item label="设备大类"
+                        prop="Classification"
+                        label-width="120px">
+            <el-select ref="reftube"
+                       v-model="testlistform.Classification"
+                       placeholder="请选择设备大类"
+                       style="width:100%">
+              <el-option v-for="item in classificationlist"
+                         :label="item.Value"
+                         :value="item.Value"
+                         :key="item.Value">
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="设备编码"
+                        prop="Code"
+                        label-width="120px">
+            <el-input v-model="testlistform.Code"
+                      placeholder="请输入设备编码"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="设备名称"
+                        required
+                        prop="Name"
+                        label-width="120px">
+            <el-input v-model="testlistform.Name"
+                      placeholder="请输入设备名称"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="型号"
+                        prop="Model"
+                        label-width="120px">
+            <el-input v-model="testlistform.Model"
+                      placeholder="请输入型号"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="规格"
+                        prop="Spec"
+                        label-width="120px">
+            <el-input v-model="testlistform.Spec"
+                      placeholder="请输入规格"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="品牌名称"
+                        prop="Brand"
+                        label-width="120px">
+            <el-input v-model="testlistform.Brand"
+                      placeholder="请输入品牌名称"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="出厂编号"
+                        prop="FactoryNum"
+                        label-width="120px">
+            <el-input v-model="testlistform.FactoryNum"
+                      placeholder="请输入出厂编号"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="供应商"
+                        prop="SupplierId"
+                        label-width="120px">
+            <el-select ref="reftube"
+                       v-model="testlistform.SupplierId"
+                       clearable
+                       placeholder="请选择供应商"
+                       style="width:100%">
+              <el-option v-for="item in getsupplierlist"
+                         :label="item.CustomerName"
+                         :value="item.Id"
+                         :key="item.Id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <!-- <el-col :span="8">
+          <el-form-item label="设备状态" required prop="State" label-width="120px">
+            <el-select   v-model="testlistform.State" placeholder="请选择设备状态" style="width:100%">
+              <el-option v-for="item in statelist" :key="item.Id" :label="item.stateName" :value="item.Id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col> -->
+
+        <el-col :span="8">
+          <el-form-item label="校验日期"
+                        label-width="120px"
+                        prop="CalibrationTime">
+            <el-date-picker v-model="testlistform.CalibrationTime"
+                            type="date"
+                            style="width:100%"
+                            placeholder="请选择校验日期">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="校验使用期限"
+                        label-width="120px">
+            <!-- <el-input    v-model="testlistform.CalibrationDeadline" placeholder="请输入校验使用期限" style="width: 49%"></el-input> -->
+            <el-input-number v-model="testlistform.CalibrationDeadline"
+                             :min="1"
+                             style="width:59%"></el-input-number>
+            <el-select v-model="testlistform.CalibrationDeadlineType"
+                       style="width: 39%;float:right">
+              <el-option v-for="item in timeType"
+                         :key="item.Id"
+                         :label="item.stateName"
+                         :value="item.Id">
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="8">
+          <el-form-item label="位置" prop="Location" label-width="120px">
+            <el-input    v-model="testlistform.Location" placeholder="请输入设备所在位置"></el-input>
+          </el-form-item>
+        </el-col> -->
+
+        <el-col :span="8">
+          <el-form-item label="责任人"
+                        label-width="120px">
+            <el-input v-model="testlistform.Responsible"
+                      placeholder="请输入责任人">
+            </el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="校验有效期提醒"
+                        label-width="120px">
+            <el-switch style="margin-left:30px"
+                       v-model="TimeNotification"
+                       active-color="#13ce66"
+                       inactive-color="#CCCCCC">
+            </el-switch>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="维护保养周期"
+                        label-width="120px"
+                        prop="Cycle">
+            <el-input-number v-model="testlistform.MaintenCycle"
+                             :min="1"
+                             style="width:59%"></el-input-number>
+            <el-select v-model="testlistform.CycleType"
+                       style="width:39%;float:right">
+              <el-option label="天"
+                         :value="1"></el-option>
+              <el-option label="周"
+                         :value="2"></el-option>
+              <el-option label="月"
+                         :value="3"></el-option>
+              <el-option label="年"
+                         :value="4"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <!-- <el-col :span="2">
+          <el-form-item label-width="0px">
+
+          </el-form-item>
+        </el-col> -->
+
+        <!-- <el-col :span="24">
+          <el-form-item label="操作规程"
+                        label-width="120px">
+            <el-upload style="height:65px"
+                       ref="uploader"
+                       action=""
+                       :file-list="fileList"
+                       :on-success="handleUploadSuccess"
+                       :on-remove="handleRemove"
+                       :http-request="uploadrequest"
+                       :limit="1">
+              <el-button size="mini"
+                         type="primary">点击上传</el-button>
+            </el-upload>
+          </el-form-item>
+        </el-col> -->
+
+        <el-col :span="24">
+          <el-form-item label="备注信息"
+                        label-width="120px">
+            <el-input v-model="testlistform.Remarks"
+                      type="textarea"
+                      :rows=3
+                      placeholder="请输入备注信息"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+      </el-row>
+    </el-form>
+    <span slot="footer">
+      <el-button size="mini"
+                 type="primary"
+                 @click="savedata()">保存</el-button>
+      <el-button size="mini"
+                 @click="handleCloseAdd">关闭</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+// import {
+//   classificationlist,
+//   instrumentGetCode,
+//   getSaveinstrument,
+//   getsupplierlist
+// } from '@/api/instrument'
+import InstrumentApi from '@/api/instrument'
+import axios from 'axios'
+import uploadajax from '@/assets/js/uploadajax.js'
+// import { addTrigger,
+//   gettriggerlist
+// } from '@/api/trigger'
+export default {
+  name: 'instrumentadd',
+  data () {
+    return {
+      fileList: [],
+      FileUrl: {},
+      uploadFile: {},
+      dialogvisible: false,
+      formtype: '1',
+      disabledbarcode: false,
+      testlistform: {
+        Code: '',
+        Name: '',
+        Supplier: '',
+        Model: '',
+        SupplierId: '',
+        FactoryNum: '',
+        Brand: '',
+        Classification: '',
+        Responsible: '',
+        State: 1,
+        Remarks: '',
+        CalibrationDeadlineType: 3,
+        CalibrationTime: new Date(),
+        CalibrationDeadline: 1,
+        HeartbeatTime: new Date(),
+        TimeNotification: 0,
+        MaintenCycle: 1,
+        CycleType: 3
+
+      },
+      Advancetime: 0,
+      triggerlist: {},
+      TimeNotification: false, // 有效期提醒
+      classificationlist: [],
+      getsupplierlist: [],
+      statelist: [{
+        stateName: '正常',
+        Id: 1
+      }, {
+        stateName: '维修',
+        Id: 2
+      }, {
+        stateName: '停用',
+        Id: 3
+      }],
+      timeType: [{
+        stateName: '天',
+        Id: 1
+      }, {
+        stateName: '周',
+        Id: 2
+      }, {
+        stateName: '月',
+        Id: 3
+      }, {
+        stateName: '年',
+        Id: 4
+      }],
+      rulestestlistform: {
+
+        Code: [{
+          required: true,
+          message: '请输入设备编码',
+          trigger: 'blur'
+        }],
+        Name: [{
+          required: true,
+          message: '请输入设备名称',
+          trigger: 'blur'
+        }]
+        // SupplierId: [{
+        //   required: true,
+        //   message: '请选择供应商',
+        //   trigger: 'blur'
+        // }],
+        // Model: [{
+        //   required: true,
+        //   message: '请输入型号',
+        //   trigger: 'blur'
+        // }],
+        // Spec: [{
+        //   required: true,
+        //   message: '请输入规格',
+        //   trigger: 'blur'
+        // }],
+        // Brand: [{
+        //   required: true,
+        //   message: '请输入品牌名称',
+        //   trigger: 'blur'
+        // }],
+        // Classification: [{
+        //   required: true,
+        //   message: '请输入设备大类',
+        //   trigger: 'blur'
+        // }],
+        // State: [{
+        //   required: true,
+        //   message: '请输入设备状态',
+        //   trigger: 'blur'
+        // }]
+      }
+    }
+  },
+  created () {
+    // let _this = this
+    // this.getclassificationlist()
+    // this.getSupplier()
+  },
+  methods: {
+    // 操作规程文件上传
+    uploadrequest (option) {
+      let _this = this
+      axios.post(this.$uploadFile, {})
+        .then(function (res) {
+          if (res.data && res.data.fid && res.data.fid !== '') {
+            option.action = `http://${res.data.url}/${res.data.fid}`
+            _this.uploadFile = {
+              uid: option.file.uid,
+              url: res.data.publicUrl,
+              fid: res.data.fid
+            }
+            uploadajax(option)
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: '未上传成功!请刷新界面重新上传!'
+            })
+          }
+        })
+        .catch(function (error) {
+          console.log(error)
+          _this.$message({
+            type: 'warning',
+            message: '未上传成功!请重新上传!'
+          })
+        })
+    },
+    handleRemove (file, fileList) {
+      this.testlistform.FileUrl = ''
+      this.testlistform.FileName = ''
+      this.FileUrl = {}
+    },
+    handleUploadSuccess (res, file) {
+      this.testlistform.FileUrl = `${this.uploadFile.url}/${this.uploadFile.fid}`
+      this.testlistform.FileName = file.name
+      this.FileUrl = URL.createObjectURL(file.raw)
+    },
+    savedata () {
+      InstrumentApi.AddInstrument(this.testlistform, {})
+        .then(res => {
+          // response
+          console.log('--------', res)
+          // if (res.info.code === 0) {
+          //   _this.$message({
+          //     type: 'success',
+          //     message: res.info.message
+
+          //   })
+          //   // window.history.go(-1)
+          // } else {
+          //   _this.$message({
+          //     type: 'warning',
+          //     message: res.info.message
+          //   })
+          // }
+          // this.handleCloseAdd()
+          this.$emit('closeAddDialog')
+          this.dialogvisible = false
+          this.fileList = []
+          // 刷新
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    // // 保存
+    // getCode (formName) {
+    //   let _this = this
+    //   this.$refs[formName].validate((valid) => {
+    //     instrumentGetCode(_this.testlistform.Code)
+    //       .then(function (response) {
+    //         _this.total = response.info.items
+    //         if (_this.total === 0) {
+    //           _this.savedata()
+    //         } else {
+    //           _this.$message({
+    //             type: 'warning',
+    //             message: '设备编号已存在'
+    //           })
+    //         }
+    //         _this.refreshData()
+    //       })
+    //       .catch(function (error) {
+    //         console.log(error)
+    //       })
+    //   })
+    // },
+    refreshData () {
+      this.$emit('refreshData')
+    },
+    // // 获取设备大类
+    // getclassificationlist () {
+    //   let _this = this
+    //   let params = {
+
+    //     code: 'InstrumentItem'
+    //   }
+    //   classificationlist(params)
+    //     .then(res => {
+    //       _this.classificationlist = res.info
+    //     })
+    // },
+    // 获取供应商
+    // getSupplier () {
+    //   let _this = this
+    //   let params = {
+    //     customerName: 'Supplier'
+    //   }
+    //   getsupplierlist(params)
+    //     .then(res => {
+    //       _this.getsupplierlist = res.info
+    //     })
+    // },
+    closedialog () {
+      this.dialogvisible = false
+    },
+    handleCloseAdd () {
+      this.$refs['testlistform'].resetFields()
+      // this.$refs['uploader'].clearFiles()
+      this.testlistform.Code = ''
+      this.testlistform.Name = ''
+      this.testlistform.Brand = ''
+      this.testlistform.SupplierId = ''
+      this.testlistform.FactoryNum = ''
+      this.testlistform.Responsible = ''
+      this.testlistform.CalibrationDeadline = 1
+      this.testlistform.MaintenCycle = 1
+      this.testlistform.Model = ''
+      this.testlistform.Remarks = ''
+      this.testlistform.Classification = ''
+      this.$emit('closeAddDialog')
+    },
+
+    // 计算日期
+    addDate (date, days) {
+      if (days === undefined || days === '') {
+        days = 1
+      }
+      var dates = new Date(date)
+      dates.setDate(dates.getDate() + days)
+      var month = dates.getMonth() + 1
+      var day = dates.getDate()
+      var mm = "'" + month + "'"
+      var dd = "'" + day + "'"
+
+      // 单位数前面加0
+      if (mm.length === 3) {
+        month = '0' + month
+      }
+      if (dd.length === 3) {
+        day = '0' + day
+      }
+
+      var time = dates.getFullYear() + '-' + month + '-' + day
+      return time
+    }
+    // // 查询action
+    // getttriggernow (id, instumentid) {
+    //   gettriggerlist({}, id)
+    //     .then(res => {
+    //       let _this = this
+    //       _this.Advancetime = res.items.Advancetime
+    //       // 查询子表 有效期
+    //       _this.addTriggerl(instumentid, _this.testlistform.Code, _this.testlistform.TimeNotification, _this.testlistform.Name, _this.Advancetime, _this.testlistform.CalibrationTime, _this.testlistform.CalibrationDeadline, _this.testlistform.CalibrationDeadlineType)
+    //     })
+    //     .catch(err => {
+    //       console.error(err)
+    //     })
+    // }
+
+  }
+}
+
+</script>
+
+<style lang="scss">
+.button {
+  padding: 0;
+  float: right;
+}
+
+.donorsaddformcss .el-col-8 {
+  height: 58px;
+}
+</style>

+ 528 - 0
frontend_web/src/views/instrument/components/instrumentedit.vue

@@ -0,0 +1,528 @@
+<template>
+  <el-dialog title="编辑设备信息"
+             :visible.sync="dialogvisible"
+             width="75%"
+             :before-close="handleCloseEdit">
+    <el-form size="mini"
+             :model="testlistform"
+             :rules="rulestestlistform"
+             label-width="130px"
+             ref="testlistform">
+      <el-row :gutter="20"
+              class="donorsaddformcss">
+        <el-col :span="8">
+          <el-form-item label="设备大类"
+                        prop="Classification"
+                        label-width="120px">
+            <el-select ref="reftube"
+                       v-model="testlistform.Classification"
+                       placeholder="请输入设备大类"
+                       style="width:100%">
+              <el-option v-for="item in classificationlist"
+                         :label="item.Value"
+                         :value="item.Value"
+                         :key="item.Value">
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="设备编码"
+                        required
+                        prop="Code"
+                        label-width="120px">
+            <el-input v-model="testlistform.Code"
+                      placeholder="请输入设备编码"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="设备名称"
+                        required
+                        prop="Name"
+                        label-width="120px">
+            <el-input v-model="testlistform.Name"
+                      placeholder="请输入设备名称"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="型号"
+                        required
+                        prop="Model"
+                        label-width="120px">
+            <el-input v-model="testlistform.Model"
+                      placeholder="请输入型号"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="品牌名称"
+                        prop="Brand"
+                        label-width="120px">
+            <el-input v-model="testlistform.Brand"
+                      placeholder="请输入品牌名称"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="供应商"
+                        prop="SupplierId"
+                        label-width="120px">
+            <!-- <el-input v-model="testlistform.Supplier" placeholder="请输入供应商" style="width:100%"></el-input> -->
+            <el-select ref="reftube"
+                       v-model="testlistform.SupplierId"
+                       placeholder="请输入设备大类"
+                       style="width:100%">
+              <el-option v-for="item in getsupplierlist"
+                         :label="item.CustomerName"
+                         :value="item.Id"
+                         :key="item.Id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="设备状态"
+                        required
+                        prop="State"
+                        label-width="120px">
+            <el-select v-model="testlistform.State"
+                       placeholder="请选择设备状态"
+                       style="width:100%">
+              <el-option v-for="item in statelist"
+                         :key="item.Id"
+                         :label="item.stateName"
+                         :value="item.Id">
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="校准时间"
+                        label-width="120px"
+                        prop="CalibrationTime">
+            <el-date-picker v-model="testlistform.CalibrationTime"
+                            type="datetime"
+                            style="width:100%"
+                            placeholder="请选择校准时间">
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="校准使用期限"
+                        label-width="120px">
+            <el-input v-model="testlistform.CalibrationDeadline"
+                      placeholder="请输入校准使用期限"
+                      style="width: 49%"></el-input>
+
+            <el-select v-model="testlistform.CalibrationDeadlineType"
+                       placeholder="请选择设备状态"
+                       style="width: 49%;float:right">
+              <el-option v-for="item in timeType"
+                         :key="item.Id"
+                         :label="item.stateName"
+                         :value="item.Id">
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="位置"
+                        prop="Location"
+                        label-width="120px">
+            <el-input v-model="testlistform.Location"
+                      placeholder="请输入设备所在位置"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="有效期提醒">
+            <el-switch v-model="TimeNotification"
+                       active-color="#13ce66"
+                       inactive-color="#CCCCCC">
+            </el-switch>
+          </el-form-item>
+        </el-col>
+
+        <!-- <el-col :span="16">
+          <el-form-item label="法规文件"
+                        label-width="120px">
+            <el-upload style="height:65px"
+                       ref="uploader"
+                       action=""
+                       :file-list="fileList"
+                       :on-success="handleUploadSuccess"
+                       :on-remove="handleRemove"
+                       :http-request="uploadrequest"
+                       :limit="1">
+              <el-button size="mini"
+                         type="primary">点击上传</el-button>
+            </el-upload>
+          </el-form-item>
+        </el-col> -->
+        <el-col :span="24">
+          <el-form-item label="备注信息"
+                        label-width="120px">
+            <el-input v-model="testlistform.Remarks"
+                      type="textarea"
+                      :rows=3
+                      placeholder="请输入备注信息"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+      </el-row>
+    </el-form>
+    <span slot="footer">
+      <el-button size="mini"
+                 type="primary"
+                 @click="savedata">保存</el-button>
+      <el-button size="mini"
+                 @click="handleCloseEdit">关闭</el-button>
+    </span>
+  </el-dialog>
+</template>
+
+<script>
+import axios from 'axios'
+import uploadajax from '@/assets/js/uploadajax.js'
+import InstrumentApi from '@/api/instrument'
+// import {
+//   initData,
+//   classificationlist,
+//   savedataedit,
+//   getsupplierlist
+// } from '@/api/instrument'
+// import { addTrigger,
+//   gettriggerlist,
+//   deletetriggerlistfordid
+// } from '@/api/trigger'
+export default {
+  name: 'instrumentadd',
+  props: {
+    InstrumentId: {
+      default: 0
+    }
+  },
+  data () {
+    return {
+      fileList: [],
+      FileUrl: {},
+      uploadFile: {},
+      dialogvisible: false,
+      formtype: '1',
+      disabledbarcode: false,
+      testlistform: {
+        Code: '',
+        Name: '',
+        Supplier: '',
+        SupplierId: '',
+        Model: '',
+        Brand: '',
+        Classification: '',
+        State: 1,
+        Remarks: '',
+        CalibrationDeadlineType: 2,
+        CalibrationTime: new Date(),
+        CalibrationDeadline: 1,
+        HeartbeatTime: new Date(),
+        TimeNotification: 0
+      },
+      Advancetime: 0,
+      triggerlist: {},
+      TimeNotification: false, // 有效期提醒
+      classificationlist: [],
+      getsupplierlist: [],
+      statelist: [{
+        stateName: '正常',
+        Id: 1
+      }, {
+        stateName: '维修',
+        Id: 2
+      }, {
+        stateName: '闲置',
+        Id: 3
+      }],
+      timeType: [{
+        stateName: '天',
+        Id: 1
+      }, {
+        stateName: '周',
+        Id: 2
+      }, {
+        stateName: '月',
+        Id: 3
+      }, {
+        stateName: '年',
+        Id: 4
+      }],
+      rulestestlistform: {
+
+        Code: [{
+          required: true,
+          message: '请输入设备编码',
+          trigger: 'blur'
+        }],
+        Name: [{
+          required: true,
+          message: '请输入设备名称',
+          trigger: 'blur'
+        }],
+        Supplier: [{
+          required: true,
+          message: '请输入供应商',
+          trigger: 'blur'
+        }],
+        Model: [{
+          required: true,
+          message: '请输入型号',
+          trigger: 'blur'
+        }],
+        Brand: [{
+          required: true,
+          message: '请输入品牌名称',
+          trigger: 'blur'
+        }],
+        State: [{
+          required: true,
+          message: '请输入设备状态',
+          trigger: 'blur'
+        }],
+        Classification: [{
+          required: true,
+          message: '请输入设备大类',
+          trigger: 'blur'
+        }]
+
+      }
+    }
+  },
+  created () {
+    //  this.getEntity(this.InstrumentId)
+    // this.getclassificationlist()
+    // this.getSupplier()
+  },
+  methods: {
+    // 操作规程文件上传
+    uploadrequest (option) {
+      let _this = this
+      axios.post(this.$uploadFile, {})
+        .then(function (res) {
+          if (res.data && res.data.fid && res.data.fid !== '') {
+            option.action = `http://${res.data.url}/${res.data.fid}`
+            _this.uploadFile = {
+              uid: option.file.uid,
+              url: res.data.publicUrl,
+              fid: res.data.fid
+            }
+            uploadajax(option)
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: '未上传成功!请刷新界面重新上传!'
+            })
+          }
+        })
+        .catch(function (error) {
+          console.log(error)
+          _this.$message({
+            type: 'warning',
+            message: '未上传成功!请重新上传!'
+          })
+        })
+    },
+    handleRemove (file, fileList) {
+      this.testlistform.FileUrl = ''
+      this.testlistform.FileName = ''
+      this.FileUrl = {}
+    },
+    handleUploadSuccess (res, file) {
+      this.testlistform.FileUrl = `${this.uploadFile.url}/${this.uploadFile.fid}`
+      this.testlistform.FileName = file.name
+      this.FileUrl = URL.createObjectURL(file.raw)
+    },
+    savedata () {
+      let _this = this
+      InstrumentApi.UpdateInstrument(this.testlistform, {})
+        .then(res => {
+          // savedataedit(_this.testlistform.Id, _this.testlistform)
+          // _this.$axios.put('/instrument/saveeditinstument/' + _this.testlistform.Id, _this.testlistform)
+          // .then(res => {
+          // response
+          // if (res.info.code === 0) {
+          // if (_this.TimeNotification) {
+          //   // _this.getttriggernow(4802)
+          // }
+          // _this.$message({
+          //   type: 'success',
+          //   message: res.info.message
+          // })
+          // window.history.go(-1)
+          // } else {
+          // _this.$message({
+          //   type: 'warning',
+          //   message: res.info.message
+          // })
+          // }
+          this.dialogvisible = false
+          this.fileList = []
+          // 刷新
+          // this.$emit('initDatas')
+          this.$emit('closeEditDialog')
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+
+    },
+    getEntity (pid) {
+      let _this = this
+      let query = {
+        id: pid
+      }
+      InstrumentApi.getOneInstrument(query)
+        .then(response => {
+          _this.testlistform = response.records
+          _this.testlistform.CalibrationTime = new Date(response.CalibrationTime)
+          if (_this.testlistform.FileName !== '') {
+            let file = {
+              name: _this.testlistform.FileName,
+              url: _this.testlistform.FileUrl
+            }
+            _this.fileList.push(file)
+          }
+        }).catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    // // 查询action
+    // getttriggernow (id) {
+    //   gettriggerlist({}, id)
+    //     .then(res => {
+    //       let _this = this
+    //       _this.Advancetime = res.items.Advancetime
+    //       // 查询子表 有效期
+    //       _this.addTriggerl(_this.testlistform.Id, _this.testlistform.Code, _this.testlistform.TimeNotification, _this.testlistform.Name, _this.Advancetime, _this.testlistform.CalibrationTime, _this.testlistform.CalibrationDeadline, _this.testlistform.CalibrationDeadlineType)
+    //     })
+    //     .catch(err => {
+    //       console.error(err)
+    //     })
+    // },
+    // getclassificationlist () {
+    //   // 获取样本单位
+    //   let _this = this
+    //   let params = {
+    //     code: 'InstrumentItem'
+    //   }
+    //   classificationlist(params)
+    //     .then(res => {
+    //       _this.classificationlist = res.info
+    //     })
+    // },
+    // // 添加报警
+    // addTriggerl (ID, Code, TimeNotification, Name, Advancetime, CalibrationTime, CalibrationDeadline, CalibrationDeadlineType) {
+    //   // eslint-disable-next-line no-undef
+    //   let _this = this
+    //   _this.triggerlist.Aid = '4802'
+    //   _this.triggerlist.DId = ID
+    //   _this.triggerlist.Advancetime = Advancetime// action  报警提前时间
+    //   _this.triggerlist.TimeNotification = TimeNotification // 保质期到期提醒
+    //   _this.triggerlist.ProductDate = CalibrationTime// '校准日期',
+    //   _this.triggerlist.AccCode = Code // '物品编码',
+    //   _this.triggerlist.Name = Name // '名称',
+    //   _this.triggerlist.ValidityLong = CalibrationDeadline // '有效时长',
+    //   _this.triggerlist.ValidityLongType = CalibrationDeadlineType// '有效时长类型:1天;2周;3月;4年',
+    //   _this.triggerlist.Category = 3 // '种类 1、耗材;2:试剂'
+    //   if (CalibrationDeadlineType === 1) {
+    //     _this.triggerlist.RemindTime = new Date(_this.addDate(CalibrationTime, CalibrationDeadline))
+    //   } else if (CalibrationDeadlineType === 2) {
+    //     _this.triggerlist.RemindTime = new Date(_this.addDate(CalibrationTime, CalibrationDeadline * 7))
+    //   } else if (CalibrationDeadlineType === 3) {
+    //     _this.triggerlist.RemindTime = new Date(_this.addDate(CalibrationTime, CalibrationDeadline * 30))
+    //   } else if (CalibrationDeadlineType === 4) {
+    //     _this.triggerlist.RemindTime = new Date(_this.addDate(CalibrationTime, CalibrationDeadline * 365))
+    //   }
+    //   addTrigger(_this.triggerlist)
+    //     .then(function (response) {
+
+    //     })
+    // },
+    // 计算日期
+    addDate (date, days) {
+      if (days === undefined || days === '') {
+        days = 1
+      }
+      var dates = new Date(date)
+      dates.setDate(dates.getDate() + days)
+      var month = dates.getMonth() + 1
+      var day = dates.getDate()
+      var mm = "'" + month + "'"
+      var dd = "'" + day + "'"
+
+      // 单位数前面加0
+      if (mm.length === 3) {
+        month = '0' + month
+      }
+      if (dd.length === 3) {
+        day = '0' + day
+      }
+
+      var time = dates.getFullYear() + '-' + month + '-' + day
+      return time
+    },
+    // // 获取供应商
+    // getSupplier () {
+    //   let _this = this
+    //   let params = {
+    //     customerName: 'Supplier'
+    //   }
+    //   getsupplierlist(params)
+    //     .then(res => {
+    //       _this.getsupplierlist = res.info
+    //     })
+    // },
+    // 返回当前页
+    handleCloseEdit () {
+      // this.$refs['uploader'].clearFiles()
+      this.fileList = []
+      this.$emit('closeEditDialog')
+    },
+    deletedataforDid (val) {
+      deletetriggerlistfordid(val)
+        .then(res => {
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    }
+
+  }
+  // watch: {
+  //   InstrumentId: function (newVal) {
+  //     this.getEntity(newVal)
+  //   }
+  // }
+
+}
+
+</script>
+
+<style lang="scss">
+.button {
+  padding: 0;
+  float: right;
+}
+</style>

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

@@ -0,0 +1,576 @@
+<template>
+  <d2-container>
+    <template slot="header"
+              style="padding: 5px;">
+      <el-form size="mini"
+               ref="form"
+               :inline="true"
+               class="sbutton_padding"
+               style="margin-top: -7px;text-align:right;">
+        <el-form-item label="设备名称"
+                      class="sbutton_margin">
+          <el-input style="width: 140px;"
+                    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> -->
+        <el-button size="mini"
+                   type="primary"
+                   @click="initDatas()"
+                   style="margin-left:10px"
+                   @command="searchCommand"
+                   class="sbutton_margin">查 询</el-button>
+        <el-button size="mini"
+                   type="primary"
+                   @click="clearSearch"
+                   class="sbutton_margin">重 置</el-button>
+        <el-button size="mini"
+                   type="primary"
+                   style="margin-right:6px"
+                   @click="openinstrumentadd()"
+                   class="sbutton_margin">添加</el-button>
+      </el-form>
+    </template>
+    <el-table ref="multipleTable"
+              :data="activities"
+              border
+              fit
+              tooltip-effect="dark"
+              style="width: 100%"
+              @sort-change="orderby"
+              height="100%">
+      <el-table-column label="操作"
+                       width="100px"
+                       align="center"
+                       fixed='right'>
+        <template slot-scope="scope">
+          <!-- <router-link :to="'/instrument/' + scope.row.Id + '/instrumentedit'"> -->
+          <!-- <router-link :to="'/instrument/instrumentdetails?id='+scope.row.Id +''"> -->
+          <el-button size="mini"
+                     title="编辑"
+                     type="primary"
+                     @click="instrumentedit(scope.row.Id)"
+                     icon="el-icon-edit"
+                     circle></el-button>
+          <!-- </router-link> -->
+          <el-button size="mini"
+                     type="danger"
+                     title="删除"
+                     @click="deleteinstrument(scope.row)"
+                     style="margin-left:5px;"
+                     icon="el-icon-delete"
+                     circle></el-button>
+          <!-- <router-link :to="'/instrument/maintainlog?id='+scope.row.Id +''">
+              <el-button size="mini"   title="质量管理" type="warning" style="margin-left:5px;" icon="fa fa-flask" circle>
+              </el-button>
+            </router-link>
+            <router-link :to="'/instrument/instrumenrunrecord?id='+scope.row.Id +''">
+              <el-button size="mini"   title="运行记录" type="warning" style="margin-left:5px;" icon="fa fa-tachometer" circle>
+              </el-button>
+            </router-link> -->
+          <!-- <el-dropdown>
+                <el-button size="mini"   type="success" >
+                  更多
+                  <i class="el-icon-arrow-down el-icon--right"></i>
+                </el-button>
+                <el-dropdown-menu slot="dropdown">
+
+                  <el-dropdown-item>
+
+                  </el-dropdown-item>
+                  <el-dropdown-item>
+
+                  </el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown> -->
+        </template>
+      </el-table-column>
+      <el-table-column prop="Code"
+                       fit
+                       min-width="160px"
+                       label="设备编码"
+                       align="center"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Name"
+                       label="设备名称"
+                       align="center"
+                       min-width="120px"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Spec"
+                       align="center"
+                       min-width="120px"
+                       label="规格"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Classification"
+                       align="center"
+                       min-width="120px"
+                       label="设备大类"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Brand"
+                       label="品牌"
+                       align="center"
+                       min-width="120px"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="FactoryNum"
+                       label="出厂编号"
+                       align="center"
+                       min-width="120px"
+                       show-overflow-tooltip></el-table-column>
+
+      <!-- <el-table-column prop="CalibrationTime"
+                         sortable
+                         label="校准时间"
+                         align="center"
+                         width="140px"
+                         show-overflow-tooltip>
+          <template slot-scope="scope">{{ jstimehandle(scope.row.CalibrationTime +'') }}</template>
+        </el-table-column> -->
+
+      <!-- <el-table-column prop="CalibrationDeadline"
+                         sortable
+                         align="center"
+                         width="100px"
+                         label="校准期限"></el-table-column> -->
+      <el-table-column prop="Responsible"
+                       align="center"
+                       min-width="100px"
+                       label="责任人"></el-table-column>
+      <el-table-column prop="State"
+                       label="设备状态"
+                       align="center"
+                       min-width="100px"
+                       show-overflow-tooltip>
+        <template slot-scope="scope">
+          <el-alert v-if="scope.row.State==1"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="正常"
+                    type="success"
+                    center></el-alert>
+          <el-alert v-if="scope.row.State==2"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="维修"
+                    type="warning"
+                    center></el-alert>
+          <el-alert v-if="scope.row.State==3"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="停用"
+                    type="info"
+                    center></el-alert>
+        </template>
+      </el-table-column>
+
+      <el-table-column prop="Type"
+                       label="有效期状态"
+                       align="center"
+                       min-width="100"
+                       show-overflow-tooltip>
+        <template slot-scope="scope">
+          <el-alert v-if="scope.row.tYPE==1"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="校准正常"
+                    type="success"
+                    center></el-alert>
+          <el-alert v-if="scope.row.tYPE==2"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="即将到期"
+                    type="warning"
+                    center></el-alert>
+          <el-alert v-if="scope.row.tYPE==3"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="过期提醒"
+                    type="info"
+                    center></el-alert>
+        </template>
+      </el-table-column>
+      <el-table-column prop="TimeNotification"
+                       label="校准提醒"
+                       align="center"
+                       min-width="100"
+                       show-overflow-tooltip>
+        <template slot-scope="scope">
+          <el-alert v-if="scope.row.TimeNotification==2"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="是"
+                    type="success"
+                    center></el-alert>
+          <el-alert v-if="scope.row.TimeNotification !=2"
+                    :closable="false"
+                    style="background:rgba(255,255,255,0.2)"
+                    title="否"
+                    type="warning"
+                    center></el-alert>
+        </template>
+      </el-table-column>
+      <el-table-column prop="Remarks"
+                       min-width="160px"
+                       label="备注"
+                       align="center"
+                       show-overflow-tooltip></el-table-column>
+    </el-table>
+    <!-- </el-card> -->
+    <addinstrumentlog ref="addinstrument"
+                      @closeAddDialog="handleCloseAdd"
+                      @refreshData="initDatas"
+                      width="75"></addinstrumentlog>
+    <addinstrumenteditlog ref="instrumentedit"
+                          @closeEditDialog="handleCloseEdit"
+                          :InstrumentId="selectedInstrumentId"
+                          @refreshData="initDatas"
+                          width="80%"></addinstrumenteditlog>
+    <!-- </div> -->
+    <template slot="footer">
+      <el-pagination style="margin: -10px;"
+                     @size-change="handleSizeChange"
+                     @current-change="handleCurrentChange"
+                     :current-page="currpage"
+                     :page-sizes="[10, 15, 20]"
+                     :page-size="size"
+                     layout="total, sizes, prev, pager, next, jumper"
+                     :total="totalsize">
+      </el-pagination>
+    </template>
+  </d2-container>
+</template>
+
+<script>
+// import {
+//   classificationlist,
+//   searchdata,
+//   deleteinstrument
+// } from '@/api/instrument'
+import InstrumentApi from '@/api/instrument'
+// import {
+//   deletetriggerlistfordid
+// } from '@/api/trigger'
+import addinstrumentlog from './components/instrumentadd'
+import addinstrumenteditlog from './components/instrumentedit'
+export default {
+  name: 'instrument',
+  components: {
+    addinstrumentlog,
+    addinstrumenteditlog
+  },
+  data () {
+    return {
+      selectedInstrumentId: 0,
+      dialogvisible: false,
+      name: '',
+      details: false,
+      totalsize: 0,
+      currpage: 1,
+      size: 10,
+      classificationlist: [],
+      activities: [],
+      Code: '',
+      Name: '',
+      Brand: '',
+      CalibrationTime: [], // 录入时期
+      Classification: '',
+      State: '正常',
+      Remarks: '',
+      search: {
+        Name: '',
+        Code: '',
+        classification: ''
+      },
+      statelist: [
+        {
+          stateName: '正常',
+          Id: 1
+        },
+        {
+          stateName: '维修',
+          Id: 2
+        },
+        {
+          stateName: '闲置',
+          Id: 3
+        }
+      ],
+      // 列表排序
+      Column: {
+        Order: '',
+        Prop: ''
+      }
+    }
+  },
+  mounted () {
+    this.initDatas()
+    // this.getclassificationlist()
+  },
+  methods: {
+    download (val) {
+
+    },
+    // 打开 添加弹窗
+    openinstrumentadd () {
+      this.$refs.addinstrument.dialogvisible = true
+    },
+    // 打开 编辑弹窗
+    instrumentedit (instrumentId) {
+      this.$refs.instrumentedit.dialogvisible = true
+      this.$refs.instrumentedit.getEntity(instrumentId)
+      this.selectedInstrumentId = instrumentId
+    },
+    // 添加 返回页面
+    handleCloseAdd () {
+      this.$refs.addinstrument.dialogvisible = false
+      this.currpage = 1
+      this.initDatas()
+      // this.getclassificationlist()
+    },
+    // 编辑 返回页面
+    handleCloseEdit () {
+      this.$refs.instrumentedit.dialogvisible = false
+      // this.getclassificationlist()
+      this.initDatas()
+    },
+    // 初始化列表数据
+    initDatas () {
+      let _this = this
+      let CalibrationTime = []
+      if (!_this.CalibrationTime) {
+        _this.CalibrationTime = []
+      }
+      // 解析时间
+      // if (_this.CalibrationTime.length === 2) {
+      //   _this.CalibrationTime[1].setHours(23)
+      //   _this.CalibrationTime[1].setMinutes(59)
+      //   _this.CalibrationTime[1].setSeconds(59)
+      //   CalibrationTime.push(_this.formatDateTime(_this.CalibrationTime[0]))
+      //   CalibrationTime.push(_this.formatDateTime(_this.CalibrationTime[1]))
+      // }
+      let params = {
+        _currentPage: this.currpage,
+        _size: this.size,
+        Code: this.search.Code,
+        Classification: this.search.classification,
+        Name: this.search.Name,
+        Order: this.Column.Order,
+        Prop: this.Column.Prop
+      }
+      InstrumentApi.getAllInstrument(params)
+        .then(res => {
+          _this.activities = res.records
+          //   for (let i = 0; i < _this.activities.length; i++) {
+          //     var addTime = _this.addDate(_this.activities[i].CalibrationTime, 2)
+          //     var tdate = 0
+          //     if (_this.activities[i].CalibrationDeadlineType === 1) {
+          //       addTime = _this.addDate(_this.activities[i].CalibrationTime, _this.activities[i].CalibrationDeadline)
+          //       tdate = _this.count(new Date(addTime))
+          //       _this.activities[i].CalibrationDeadlineType = '天'
+          //     } else if (_this.activities[i].CalibrationDeadlineType === 2) {
+          //       addTime = _this.addDate(_this.activities[i].CalibrationTime, (_this.activities[i].CalibrationDeadline) * 7)
+          //       tdate = _this.count(new Date(addTime))
+          //       _this.activities[i].CalibrationDeadlineType = '周'
+          //     } else if (_this.activities[i].CalibrationDeadlineType === 3) {
+          //       addTime = _this.addDate(_this.activities[i].CalibrationTime, (_this.activities[i].CalibrationDeadline) * 30)
+          //       tdate = _this.count(new Date(addTime))
+          //       _this.activities[i].CalibrationDeadlineType = '月'
+          //     } else if (_this.activities[i].CalibrationDeadlineType === 4) {
+          //       addTime = _this.addDate(_this.activities[i].CalibrationTime, (_this.activities[i].CalibrationDeadline) * 365)
+          //       tdate = _this.count(new Date(addTime))
+          //       _this.activities[i].CalibrationDeadlineType = '年'
+          //     }
+          //     if (tdate >= 30) {
+          //       _this.activities[i].tYPE = 1
+          //     } else if (tdate < 30 && tdate >= 0) {
+          //       _this.activities[i].tYPE = 2
+          //     } else if (tdate < 0) {
+          //       _this.activities[i].tYPE = 3
+          //     }
+          //   }
+
+          //   for (let i = 0; i < _this.activities.length; i++) {
+          //     // _this.activities[i].CalibrationDeadline = _this.activities[i].CalibrationDeadline + ''
+          //     _this.activities[i].CalibrationDeadline = _this.activities[i].CalibrationDeadline + '' + _this.activities[i].CalibrationDeadlineType
+          //   }
+
+          //   _this.totalsize = response.info.currentItemCount
+          // })
+          // .catch(function (error) {
+          //   console.log(error)
+        })
+    },
+    handleSizeChange (val) {
+      this.size = val
+      this.currpage = 1
+      this.initDatas()
+    },
+    handleCurrentChange (val) {
+      this.currpage = val
+      this.initDatas()
+    },
+    jstimehandle (val) {
+      if (val === '') {
+        return '----'
+      } else if (val === '0001-01-01T08:00:00+08:00') {
+        return '----'
+      } else if (val === '5000-01-01T23:59:59+08:00') {
+        return '永久'
+      } else {
+        if (val === '0001-01-01T00:00:00Z') {
+          return '----'
+        } else val = val.replace('T', ' ')
+        return val.substring(0, 19)
+      }
+    },
+    count (date2) {
+      var date1 = new Date()
+      var date = (date2.getTime() - date1.getTime()) / (1000 * 60 * 60 * 24)/* 不用考虑闰年否 */
+      return parseInt(date)
+    },
+    // // 获取设备大类
+    // getclassificationlist () {
+    //   let _this = this
+    //   let params = {
+
+    //     code: 'InstrumentItem'
+    //   }
+    //   // _this.$axios.get('/items/worditem?code=InstrumentItem', {})
+    //   classificationlist(params)
+    //     .then(res => {
+    //       _this.classificationlist = res.info
+    //     })
+    // },
+
+    deleteinstrument (val) {
+      let _this = this
+      let params = {
+        id: val.Id
+      }
+      _this.$confirm('此操作将永久删除该产品数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '关闭',
+        type: 'warning'
+      }).then(() => {
+        InstrumentApi.deleteInstrument(params)
+          .then(data => {
+            // response
+            // if (response.info.code === 0) {
+            //   _this.deletedataforDid(val.Id)
+            //   _this.$message({
+            //     type: 'success',
+            //     message: response.info.message
+            //   })
+            //   // 更新界面
+            _this.initDatas()
+            // } else {
+            //   _this.$message({
+            //     type: 'warning',
+            //     message: response.info.message
+            //   })
+            // }
+          })
+          .catch(function (error) {
+            console.log(error)
+          })
+      })
+        .catch(() => { })
+    },
+    // 列表排序功能
+    orderby (column) {
+      if (column.order === 'ascending') {
+        this.Column.Order = 'asc'
+      } else if (column.order === 'descending') {
+        this.Column.Order = 'desc'
+      }
+      this.Column.Prop = column.prop
+      this.initDatas()
+    },
+
+    formatDateTime (date) {
+      var y = date.getFullYear()
+      var m = date.getMonth() + 1
+      m = m < 10 ? '0' + m : m
+      var d = date.getDate()
+      d = d < 10 ? '0' + d : d
+      // var h = date.getHours();
+      // var minute = date.getMinutes();
+      // minute = minute < 10 ? ('0' + minute) : minute;
+      return y + '-' + m + '-' + d
+    },
+    searchCommand (command) {
+      if (command === 'search') {
+        this.dialogvisible = true
+      } else if (command === 'clear') {
+        this.clearSearch()
+      }
+    },
+    clearSearch () {
+      this.currpage = 1
+      this.search.Code = ''
+      this.search.Name = ''
+      this.search.classification = ''
+      this.CalibrationTime = []
+      this.initDatas()
+    },
+    deletedataforDid (val) {
+      deletetriggerlistfordid(val)
+        .then(res => {
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    addDate (date, days) {
+      if (days === undefined || days === '') {
+        days = 1
+      }
+      var dates = new Date(date)
+      dates.setDate(dates.getDate() + days)
+      var month = dates.getMonth() + 1
+      var day = dates.getDate()
+      var mm = "'" + month + "'"
+      var dd = "'" + day + "'"
+
+      // 单位数前面加0
+      if (mm.length === 3) {
+        month = '0' + month
+      }
+      if (dd.length === 3) {
+        day = '0' + day
+      }
+
+      var time = dates.getFullYear() + '-' + month + '-' + day
+      return time
+    }
+
+  }
+}
+</script>
+
+<style lang="scss">
+.el-pagination {
+  margin: 1rem 0 2rem;
+  text-align: right;
+}
+
+.plab {
+  font-size: 13px;
+  color: #999;
+}
+</style>