all il y a 5 ans
Parent
commit
f6022b9ed8

+ 143 - 0
backend/src/dashoo.cn/modi_webapi/app/api/personnel/personnel.go

@@ -0,0 +1,143 @@
+package personnel
+
+import (
+	"dashoo.cn/modi_webapi/app/service/personnel"
+	"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) GetAllPersonnel(r *ghttp.Request){
+	page := request.GetPageInfo(r)
+	where := ""
+
+
+
+	if name := r.GetString("Name"); name != ""{
+		if where == ""{
+			where = fmt.Sprintf(" PersonnelName LIKE '%%%v%%'", name)
+		} else {
+			where += fmt.Sprintf(" AND PersonnelName LIKE '%%%v%%'", name)
+		}
+	}
+
+	var result []personnel.Entity
+	if err := personnel.GetAllPersonnel(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 := personnel.FindPersonnelCount(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) GetOnePersonnel(r *ghttp.Request){
+	id := r.GetInt("id")
+	if result, err := personnel.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) AddPersonnel(r *ghttp.Request){
+	Personnel := new(personnel.Entity)
+	fmt.Println("---Personnel---",Personnel)
+	if err := r.Parse(Personnel); 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()
+
+	Personnel.CreateOn = currentTime
+	Personnel.CreateBy = realName
+	Personnel.CreateUserId = userId
+
+	Personnel.ModifiedOn = currentTime
+	Personnel.ModifiedBy = realName
+	Personnel.ModifiedUserId = userId
+
+	if result,err := personnel.Insert(Personnel); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		var records response.PagedRecords
+		id, _ := result.LastInsertId()
+		Personnel.Id = int(id)
+		records.Records = Personnel
+		response.Json(r, 0, "", records)
+	}
+}
+
+func (c *Controller) UpdatePersonnel(r *ghttp.Request){
+	Personnel := new(personnel.Entity)
+	if err := r.Parse(Personnel); 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()
+
+	Personnel.ModifiedOn = currentTime
+	Personnel.ModifiedBy = realName
+	Personnel.ModifiedUserId = userId
+
+	if _,err := personnel.Replace(Personnel); err != nil {
+		response.Json(r, 1, err.Error())
+	} else {
+		var records response.PagedRecords
+		//id, _ := result.LastInsertId()
+		//theChargeRecord.Id = int(id)
+		records.Records = Personnel
+		response.Json(r, 0, "", records)
+	}
+}
+
+func (c *Controller) DeletePersonnel(r *ghttp.Request){
+	id := r.GetInt("id")
+	if _,err := personnel.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/personnel/personnel.go

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

+ 71 - 0
backend/src/dashoo.cn/modi_webapi/app/service/personnel/personnel_entity.go

@@ -0,0 +1,71 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. You may not really want to edit it.
+// ==========================================================================
+
+package personnel
+
+import (
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// Entity is the golang structure for table personnel.
+type Entity struct {
+	Id                      int       `xorm:"not null pk autoincr INT(10)"`
+	PersonnelName           string    `xorm:"VARCHAR(50)"`      //名称
+	PersonneCode           string    `xorm:"VARCHAR(255)"`     //编号
+	Person              	 string    `xorm:"VARCHAR(50)"`          //联系人
+	Telephone            string    `xorm:"VARCHAR(255)"`     //电话
+	Mailbox              string    `xorm:"VARCHAR(255)"`     //邮箱
+	CardId                   string    `xorm:"VARCHAR(255)"`     //身份证号
+	Address                   string    `xorm:"VARCHAR(255)"`     //地址
+	Website          string    `xorm:"VARCHAR(255)"`     //网站地址
+	DepartmentId                string    `xorm:"VARCHAR(50)"`      //组织id
+	DepartmentName                 string    `xorm:"VARCHAR(255)"`     //组织名称
+	Type                    string    `xorm:"VARCHAR(50)"`       //类型
+	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)"`
+}
+
+// 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/personnel/personnel_model.go

@@ -0,0 +1,369 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. You may not really want to edit it.
+// ==========================================================================
+
+package personnel
+
+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 personnel operations.
+type arModel struct {
+	M *gdb.Model
+}
+
+var (
+	// Table is the table name of personnel.
+	Table = "personnel"
+	// Model is the model object of personnel.
+	Model = &arModel{g.DB("default").Table(Table).Safe()}
+	// Columns defines and stores column names for table personnel.
+)
+
+// 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)
+	})
+
+}

BIN
backend/src/dashoo.cn/modi_webapi/go_build_dashoo_cn_modi_webapi_darwin


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

@@ -12,6 +12,7 @@ import (
 	"dashoo.cn/modi_webapi/app/api/system/menu"
 	"dashoo.cn/modi_webapi/app/api/system/organize"
 	"dashoo.cn/modi_webapi/app/api/system/permission"
+	"dashoo.cn/modi_webapi/app/api/personnel"
 	"dashoo.cn/modi_webapi/app/api/system/role"
 	"dashoo.cn/modi_webapi/app/api/system/user"
 	"dashoo.cn/modi_webapi/library/gtoken"
@@ -41,6 +42,7 @@ func init() {
 		{"ALL", "*", CorsHookHandler, ghttp.HOOK_BEFORE_SERVE},
 		//{"MIDDLEWARE", "*", MiddlewareCORS},
 		{"ALL", "/user", new(user.Controller)},
+		{"ALL", "/personnel", new(personnel.Controller)},
 		{"ALL", "/role", new(role.Controller)},
 		{"ALL", "/neo", new(neo.Controller)},
 		{"ALL", "/task", new(Task)},

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

@@ -0,0 +1,48 @@
+import request from '@/plugin/axios'
+
+export default {
+   // 产品方案 ----获取产品信息列表
+  getAllPersonnel(params) {
+    return request({
+      url: process.env.VUE_APP_API + 'personnel/getallpersonnel',
+      method: 'get', 
+      params: params
+    })
+  },
+
+  getOnePersonnel(params) {
+    return request({
+      url: process.env.VUE_APP_API + 'personnel/getonepersonnel',
+      method: 'get', 
+      params: params
+    })
+  },
+
+  //删除产品信息
+   deletePersonnel(params) {
+    return request({
+      url: process.env.VUE_APP_API + 'personnel/deletepersonnel',
+      method: 'delete',
+      params: params
+    })
+  },
+  
+   // 保存产品方案
+  AddPersonnel (data) {
+    return request({
+      url: process.env.VUE_APP_API + 'personnel/addpersonnel',
+      method: 'post',
+      data: data
+    })
+  },
+  
+  UpdatePersonnel (data) {
+    return request({
+      url: process.env.VUE_APP_API + 'personnel/updatepersonnel',
+      method: 'post',
+      data: data
+    })
+  },
+ 
+  
+}

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

@@ -66,6 +66,16 @@ const frameIn = [
         auth: true
       },
       component: _import('instrument')
+    },
+     // 人员管理
+     {
+      path: 'personnel',
+      name: 'personnel',
+      meta: {
+        title: '人员管理',
+        auth: true
+      },
+      component: _import('personnel')
     },
     // 班级管理
     {

+ 404 - 0
frontend_web/src/views/personnel/components/personneladd.vue

@@ -0,0 +1,404 @@
+<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="PersonnelName"
+                        label-width="120px">
+            <el-input v-model="testlistform.PersonnelName"
+                      placeholder="请输入人员姓名"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="人员编号"
+                        prop="PersonneCode"
+                        label-width="120px">
+            <el-input v-model="testlistform.PersonneCode"
+                      placeholder="请输入人员编号"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="电话"
+                        prop="Telephone"
+                        label-width="120px">
+            <el-input v-model="testlistform.Telephone"
+                      placeholder="请输入电话"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="邮箱"
+                        prop="Mailbox"
+                        label-width="120px">
+            <el-input v-model="testlistform.Mailbox"
+                      placeholder="请输入邮箱"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="身份证号"
+                        prop="CardId"
+                        label-width="120px">
+            <el-input v-model="testlistform.CardId"
+                      placeholder="请输入身份证号"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="联系地址"
+                        prop="Address"
+                        label-width="120px">
+            <el-input v-model="testlistform.Address"
+                      placeholder="请输入联系地址"></el-input>
+          </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,
+//   personnelGetCode,
+//   getSavepersonnel,
+//   getsupplierlist
+// } from '@/api/personnel'
+import PersonnelApi from '@/api/personnel'
+import axios from 'axios'
+import uploadajax from '@/assets/js/uploadajax.js'
+// import { addTrigger,
+//   gettriggerlist
+// } from '@/api/trigger'
+export default {
+  name: 'personneladd',
+  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 () {
+      PersonnelApi.AddPersonnel(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) => {
+    //     personnelGetCode(_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: 'PersonnelItem'
+    //   }
+    //   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>

+ 427 - 0
frontend_web/src/views/personnel/components/personneledit.vue

@@ -0,0 +1,427 @@
+<template>
+  <el-dialog title="编辑设备信息"
+             :visible.sync="dialogvisible"
+             width="75%"
+             :before-close="handleCloseEdit">
+    <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="PersonnelName"
+                        label-width="120px">
+            <el-input v-model="testlistform.PersonnelName"
+                      placeholder="请输入人员姓名"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="人员编号"
+                        prop="PersonneCode"
+                        label-width="120px">
+            <el-input v-model="testlistform.PersonneCode"
+                      placeholder="请输入人员编号"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="电话"
+                        prop="Telephone"
+                        label-width="120px">
+            <el-input v-model="testlistform.Telephone"
+                      placeholder="请输入电话"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="邮箱"
+                        prop="Mailbox"
+                        label-width="120px">
+            <el-input v-model="testlistform.Mailbox"
+                      placeholder="请输入邮箱"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="身份证号"
+                        prop="CardId"
+                        label-width="120px">
+            <el-input v-model="testlistform.CardId"
+                      placeholder="请输入身份证号"
+                      style="width:100%"></el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="8">
+          <el-form-item label="联系地址"
+                        prop="Address"
+                        label-width="120px">
+            <el-input v-model="testlistform.Address"
+                      placeholder="请输入联系地址"></el-input>
+          </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 PersonnelApi from '@/api/personnel'
+// import {
+//   initData,
+//   classificationlist,
+//   savedataedit,
+//   getsupplierlist
+// } from '@/api/personnel'
+// import { addTrigger,
+//   gettriggerlist,
+//   deletetriggerlistfordid
+// } from '@/api/trigger'
+export default {
+  name: 'personneladd',
+  props: {
+    PersonnelId: {
+      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.PersonnelId)
+    // 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
+      PersonnelApi.UpdatePersonnel(this.testlistform, {})
+        .then(res => {
+          // savedataedit(_this.testlistform.Id, _this.testlistform)
+          // _this.$axios.put('/personnel/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
+      }
+      PersonnelApi.getOnePersonnel(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: 'PersonnelItem'
+    //   }
+    //   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: {
+  //   PersonnelId: function (newVal) {
+  //     this.getEntity(newVal)
+  //   }
+  // }
+
+}
+
+</script>
+
+<style lang="scss">
+.button {
+  padding: 0;
+  float: right;
+}
+</style>

+ 499 - 0
frontend_web/src/views/personnel/index.vue

@@ -0,0 +1,499 @@
+<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="openpersonneladd()"
+                   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="'/personnel/' + scope.row.Id + '/personneledit'"> -->
+          <!-- <router-link :to="'/personnel/personneldetails?id='+scope.row.Id +''"> -->
+          <el-button size="mini"
+                     title="编辑"
+                     type="primary"
+                     @click="personneledit(scope.row.Id)"
+                     icon="el-icon-edit"
+                     circle></el-button>
+          <!-- </router-link> -->
+          <el-button size="mini"
+                     type="danger"
+                     title="删除"
+                     @click="deletepersonnel(scope.row)"
+                     style="margin-left:5px;"
+                     icon="el-icon-delete"
+                     circle></el-button>
+          <!-- <router-link :to="'/personnel/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="'/personnel/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="PersonnelName"
+                       fit
+                       min-width="160px"
+                       label="人员姓名"
+                       align="center"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="PersonneCode"
+                       label="人员编号"
+                       align="center"
+                       min-width="120px"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Telephone"
+                       align="center"
+                       min-width="120px"
+                       label="电话"
+                       show-overflow-tooltip></el-table-column>
+      <el-table-column prop="Mailbox"
+                       align="center"
+                       min-width="120px"
+                       label="邮箱"
+                       show-overflow-tooltip></el-table-column>
+
+      <el-table-column prop="CardId"
+                       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="Address"
+                       align="center"
+                       min-width="100px"
+                       label="地址"></el-table-column>
+
+      <!-- <el-table-column prop="Type"
+                       min-width="160px"
+                       label="类型"
+                       align="center"
+                       show-overflow-tooltip></el-table-column> -->
+    </el-table>
+    <!-- </el-card> -->
+    <addpersonnellog ref="addpersonnel"
+                     @closeAddDialog="handleCloseAdd"
+                     @refreshData="initDatas"
+                     width="75"></addpersonnellog>
+    <addpersonneleditlog ref="personneledit"
+                         @closeEditDialog="handleCloseEdit"
+                         :PersonnelId="selectedPersonnelId"
+                         @refreshData="initDatas"
+                         width="80%"></addpersonneleditlog>
+    <!-- </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,
+//   deletepersonnel
+// } from '@/api/personnel'
+import PersonnelApi from '@/api/personnel'
+// import {
+//   deletetriggerlistfordid
+// } from '@/api/trigger'
+import addpersonnellog from './components/personneladd'
+import addpersonneleditlog from './components/personneledit'
+export default {
+  name: 'personnel',
+  components: {
+    addpersonnellog,
+    addpersonneleditlog
+  },
+  data () {
+    return {
+      selectedPersonnelId: 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()
+  },
+  methods: {
+    download (val) {
+
+    },
+    // 打开 添加弹窗
+    openpersonneladd () {
+      this.$refs.addpersonnel.dialogvisible = true
+    },
+    // 打开 编辑弹窗
+    personneledit (personnelId) {
+      this.$refs.personneledit.dialogvisible = true
+      this.$refs.personneledit.getEntity(personnelId)
+      this.selectedPersonnelId = personnelId
+    },
+    // 添加 返回页面
+    handleCloseAdd () {
+      this.$refs.addpersonnel.dialogvisible = false
+      this.currpage = 1
+      this.initDatas()
+      // this.getclassificationlist()
+    },
+    // 编辑 返回页面
+    handleCloseEdit () {
+      this.$refs.personneledit.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
+      }
+      PersonnelApi.getAllPersonnel(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: 'PersonnelItem'
+    //   }
+    //   // _this.$axios.get('/items/worditem?code=PersonnelItem', {})
+    //   classificationlist(params)
+    //     .then(res => {
+    //       _this.classificationlist = res.info
+    //     })
+    // },
+
+    deletepersonnel (val) {
+      let _this = this
+      let params = {
+        id: val.Id
+      }
+      _this.$confirm('此操作将永久删除该产品数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '关闭',
+        type: 'warning'
+      }).then(() => {
+        PersonnelApi.deletePersonnel(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>