4
0
Просмотр исходного кода

1.样本复苏bug修改2.出入库功能梳理3.样本复苏导出excel

peiyt 6 лет назад
Родитель
Сommit
8a9348ca21

+ 1 - 0
src/dashoo.cn/backend/api/business/samplesapply/samplesapply.go

@@ -50,6 +50,7 @@ type SamplesApplyDetail struct {
 	ModifiedOn     time.Time `xorm:"DATETIME updated"`
 	ModifiedUserId int       `xorm:"INT(10)"`
 	ModifiedBy     string    `xorm:"VARCHAR(50)"`
+	RecoveryId     int    `xorm:"INT(10)"`
 }
 
 type Applydetailmodel struct {

+ 29 - 0
src/dashoo.cn/backend/api/business/samplesapply/samplesapplyService.go

@@ -1,6 +1,7 @@
 package samplesapply
 
 import (
+	"dashoo.cn/backend/api/controllers"
 	"fmt"
 	"strconv"
 
@@ -62,6 +63,20 @@ func (s *SamplesApplyService) GetApplySamplesDetail(acccode string, pageIndex, i
 	return total, List
 }
 
+
+func (s *SamplesApplyService) QueryApplySamplesDetail(acccode ,entryno string) ([]Applydetailmodel) {
+	var err error
+    var where string
+	if where == "" {
+		where = "1=1"
+	}
+	var sql string
+	sql="SELECT t1.* FROM  smkfjSamplesApplyDetail t1 , smkfjSamplesApply t2 WHERE t1.parentid=t2.id AND t2.entryno='"+entryno+"'"
+	List := make([]Applydetailmodel, 0)
+	utils.DBE.Sql(sql).Find(&List)
+	LogError(err)
+	return List
+}
 // 获取分页列表
 func (s *SamplesApplyService) GetApplyViewtList(pageIndex, itemsPerPage int64, applytable string, order, where string) (int64, []SamplesApply) {
 	var err error
@@ -90,3 +105,17 @@ func (s *SamplesApplyService) GetApplyViewtList(pageIndex, itemsPerPage int64, a
 	fmt.Println("-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0", List)
 	return total, List
 }
+
+func (s *SamplesApplyService) QuerySampleApplyDetailByBarCode(acccode string ,barcode string ) (entity SamplesApplyDetail){
+	tableName:=acccode+controllers.SamplesApplyDetailName
+	sql:="select a.* from "+tableName+" a where a.barcode= '"+barcode+"'"
+	utils.DBE.Sql(sql).Get(&entity)
+	return
+}
+
+func (s *SamplesApplyService) QuerySampleDetailByBarCode(acccode string ,barcode string ) (entity SamplesApplyDetail){
+	tableName:=acccode+controllers.SamplesApplyDetailName
+	sql:="select a.* from "+tableName+" a where a.barcode= '"+barcode+"'"
+	utils.DBE.Sql(sql).Get(&entity)
+	return
+}

+ 7 - 0
src/dashoo.cn/backend/api/business/samplesfileinfo/samplesfileinfoService.go

@@ -107,6 +107,13 @@ func (s *SamplesFileInfoService) QuerySampleFileEntity(acccode string, where str
 	s.DBE.Sql(sql).Get(&entity)
 	return
 }
+//根据barcode 从sampleFileDetail中查询归档信息
+func(s * SamplesFileInfoService) QuerySampleFileByBarCode(acccode string,barcode string)(entity SamplesFileDetail){
+	tableName:=acccode+SamplesDetailFiletbName
+	sql:="select a.* from "+tableName+" a where  a.barcode= '"+barcode+"' and a.deletionstatecode=0 ORDER BY createon desc"
+	s.DBE.SQL(sql).Get(&entity)
+	return
+}
 
 //获取数量
 func (s *SamplesFileInfoService) GetSampleFileCount(acccode, where string) int {

+ 8 - 0
src/dashoo.cn/backend/api/business/samplesinfo/samplesinfoService.go

@@ -911,6 +911,13 @@ func (s *SamplesInfoService) GetSampleOwnCount(tablename, where string) int {
 	total := num.Id
 	return total
 }
+func (s *SamplesInfoService) GetSampleApplyMaxId(tablename string) int{
+	var num MyInt_Id
+	sql:="select max(Id) Id from "+tablename
+	s.DBE.Sql(sql).Get(&num)
+	maxId:=num.Id
+	return maxId
+}
 
 //获取数量
 func (s *SamplesInfoService) GetSampleOwnCountBySourceId(acccode, where string) int {
@@ -1539,3 +1546,4 @@ func (s *SamplesInfoService) CreateTemplateTable(tablename string) error {
 
 	return err
 }
+

+ 383 - 19
src/dashoo.cn/backend/api/controllers/biobank/samplesapply.go

@@ -1,7 +1,12 @@
 package biobank
 
 import (
+	//"dashoo.cn/backend/api/business/approveinfo"
+	"dashoo.cn/backend/api/business/samplesbusiness"
+	"dashoo.cn/backend/api/business/samplesfileinfo"
 	"encoding/json"
+	//"fmt"
+
 	//"fmt"
 	"strconv"
 	"strings"
@@ -523,7 +528,225 @@ func (this *SamplesApplyController) AddCKDetail() {
 		svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols, where)
 	}
 }
+// @Title 批量复苏
+// @Description 批量复苏
+// @Param	body	body	business.device.DeviceChannels	"传感器信息"
+// @Success	200	{object} controllers.Request
+//@router /batchfusu [put]
+func (this *SamplesApplyController) BatchFuSuEditPost() {
+	ids := this.GetString("ids")
+	idsarr := strings.Split(ids, ",")
+	var errinfo ErrorInfo
+	if len(idsarr) == 0 {
+		errinfo.Message = "批量复苏操作失败!参数不合法!"
+		errinfo.Code = -3
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+	var err error
+	var model samplesbusiness.SamplesFuSu
+	var jsonblob = this.Ctx.Input.RequestBody
+	json.Unmarshal(jsonblob, &model)
+	svc := samplesinfo.GetSamplesInfoService(utils.DBE)
+
+	//生成出库单
+	entryNo:=GetRandomOrderNum()
+	var smkfjsamplesapply samplesapply.SamplesApply
+	smkfjsamplesapply.EntryNo=utils.ToStr(entryNo)
+	//1:入库;2:出库
+	smkfjsamplesapply.ApplyType=2
+	//0:申请;1:审核中;2:已审核;3:审核异常;5:撤销'
+	smkfjsamplesapply.ApplyStatus=2
+	//申请人
+	smkfjsamplesapply.OperationBy=this.User.Realname
+	//申请时间
+	smkfjsamplesapply.EntryTime=time.Now()
+	//领用部门
+	//smkfjsamplesapply.Section=this.User.DepartmentId
+	//审核人ID
+	conUserId,_:=strconv.Atoi(this.User.Id)
+	smkfjsamplesapply.ConUserId= conUserId
+	//审核人
+	smkfjsamplesapply.ConUserBy=this.User.Realname
+	//备注
+	smkfjsamplesapply.Remark="直接出库"
+	//审核备注
+	smkfjsamplesapply.AuditorRemark="直接出库"
+	//审核时间
+	smkfjsamplesapply.ConTime=time.Now()
+	smkfjsamplesapply.CreateOn=time.Now()
+	smkfjsamplesapply.CreateUserId=conUserId
+	smkfjsamplesapply.CreateBy=this.User.Realname
+	//保存出库单
+	svc.InsertEntityBytbl("smkFjSamplesApply",&smkfjsamplesapply)
+	count:=svc.GetSampleApplyMaxId("smkFjSamplesApply")
+	for i := 0; i < len(idsarr); i++ {
+		if idsarr[i] != "" {
+			var dataold samplesinfo.SamplesDetail //原始样本
+			where := " Id=" + idsarr[i] + ""
+			svc := samplesinfo.GetSamplesInfoService(utils.DBE)
+			svc.GetEntityByWhere(this.User.AccCode+SamplesDetailtbName, where, &dataold)
+
+			fusu := utils.ToStr(model.FusuRadio)
+			quyong, _ := utils.StrTo(model.CapacityUsed).Float32() //取用容量
+			var currCapacity float64
+			currCapacity = FloatPoint(float64(dataold.Capacity-quyong), 4) //取用后容量
+			var currFreezingNum int                                        //冻融次数
+			if model.FreezingNum {
+				currFreezingNum = dataold.FreezingNum + 1
+			} else {
+				currFreezingNum = dataold.FreezingNum
+			}
+			//fusu  1复苏直接复存 2再次存入不保留位置 3归档 4存到预录入 5再次存入保留位置
+			//11复苏复存12复苏至???复存(不保留位置)13复苏至归档14复苏至预录入 15复苏至待复存(保留位置)
+			var optype int
+			if fusu == "1" {
+				optype = 11
+			} else if fusu == "2" {
+				optype = 12
+			} else if fusu == "3" {
+				optype = 13
+			} else if fusu == "4" {
+				optype = 14
+			} else if fusu == "5" {
+				optype = 15
+			}
+			var samplesInfoShow samplesinfo.SamplesInfoShow
+			sql:=" a.SampleCode='"+dataold.SampleCode+"'"
+			samplesInfoShow=svc.QuerySampleEntity(this.User.AccCode,sql)
+			var entity samplesbusiness.SamplesBusiness //业务记录
+			entity.AccCode = this.User.AccCode
+			entity.SampleCode = dataold.SampleCode
+			entity.BarCode = dataold.BarCode
+			entity.Unit = dataold.Unit
+			entity.CapacityUsed = quyong
+			entity.CapacityRest = float32(currCapacity)
+			entity.OpDesc = model.OpDesc
+			entity.OpType = optype
+			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+			entity.CreateBy = this.User.Realname
+			if fusu != "3" { //除去归档
+				var datanew samplesinfo.SamplesDetail
+				datanew = dataold
+				var cols []string = []string{"ModifiedUserId", "ModifiedBy", "Capacity", "FreezingNum", "IState"}
+				if fusu == "1" { //复苏复存
+					datanew.IState = 1
+				} else if fusu == "2" { //不保留位置,存到待复存中
+					datanew.IState = 6
+					datanew.EquipmentId = 0
+					datanew.ShelfId = 0
+					datanew.BoxId = 0
+					datanew.Position = ""
+					cols = append(cols, "EquipmentId")
+					cols = append(cols, "ShelfId")
+					cols = append(cols, "BoxId")
+					cols = append(cols, "Position")
+					cols = append(cols, "PositionDesc")
+				} else if fusu == "4" { //存到预录入
+					datanew.IState = 4
+					datanew.EquipmentId = 0
+					datanew.ShelfId = 0
+					datanew.BoxId = 0
+					datanew.Position = ""
+					cols = append(cols, "EquipmentId")
+					cols = append(cols, "ShelfId")
+					cols = append(cols, "BoxId")
+					cols = append(cols, "Position")
+					cols = append(cols, "PositionDesc")
+				} else if fusu == "5" { //保留位置,存到待复存中
+					datanew.IState = 5
+				}
+				datanew.Capacity = float32(currCapacity)
+				datanew.FreezingNum = currFreezingNum
+				datanew.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+				datanew.ModifiedBy = this.User.Realname
+
+				entity.EquipmentId = datanew.EquipmentId
+				entity.ShelfId = datanew.ShelfId
+				entity.BoxId = datanew.BoxId
+				entity.Position = datanew.Position
+				entity.PositionDesc = svc.GetPostiondescByPosId(datanew.EquipmentId, datanew.ShelfId, datanew.BoxId, datanew.Position)
+				err = svc.UpdateDetailAndBuss(this.User.AccCode+SamplesDetailtbName, this.User.AccCode+SamplesBusstbName, idsarr[i], &datanew, &entity, cols)
+			} else { //归档
+				entity.EquipmentId = 0
+				entity.ShelfId = 0
+				entity.BoxId = 0
+				entity.Position = ""
+				entity.PositionDesc = ""
+				var datafiledetail samplesfileinfo.SamplesFileDetail
+				datafiledetail.SampleCode = dataold.SampleCode
+				datafiledetail.BarCode = dataold.BarCode
+				datafiledetail.InnerCode = dataold.InnerCode
+				datafiledetail.InitCapacity = dataold.InitCapacity
+				datafiledetail.Capacity = float32(currCapacity)
+				datafiledetail.Unit = dataold.Unit
+				datafiledetail.FreezingNum = currFreezingNum
+				datafiledetail.ValidityDate = dataold.ValidityDate
+				datafiledetail.ParentBarCode = dataold.ParentBarCode
+				datafiledetail.IType = dataold.IType
+				datafiledetail.CreateOn = dataold.CreateOn
+				datafiledetail.CreateBy = dataold.CreateBy
+				datafiledetail.CreateUserId = dataold.CreateUserId
+				datafiledetail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+				datafiledetail.ModifiedBy = this.User.Realname
+				datafiledetail.ModifiedOn = time.Now()
+				datafiledetail.Remark = dataold.Remark
+
+				svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailFiletbName, &datafiledetail)
+				svc.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &entity)
+				svc.DelSDetailInfo(this.User.AccCode, dataold.Id)
+			}
+			var samplesapplyDataInfo samplesapply.SamplesApplyDetail
+			//复苏类型
+			samplesapplyDataInfo.RecoveryId=model.FusuRadio
+			//出库信息
+			samplesapplyDataInfo.SampleCode=dataold.SampleCode
+			samplesapplyDataInfo.BarCode=dataold.BarCode
+			samplesapplyDataInfo.InitCapacity=dataold.InitCapacity
+			samplesapplyDataInfo.Capacity=quyong
+			samplesapplyDataInfo.Unit=dataold.Unit
+			samplesapplyDataInfo.CreateOn=time.Now()
+			samplesapplyDataInfo.CreateBy=dataold.CreateBy
+			samplesapplyDataInfo.CreateUserId=dataold.CreateUserId
+			samplesapplyDataInfo.ModifiedUserId=dataold.ModifiedUserId
+			samplesapplyDataInfo.ModifiedBy = this.User.Realname
+			samplesapplyDataInfo.ModifiedOn = time.Now()
+			modifiedUserId,_:=strconv.Atoi(this.User.Id)
+			samplesapplyDataInfo.ModifiedUserId=modifiedUserId
+			samplesapplyDataInfo.EquipmentId=dataold.EquipmentId
+			samplesapplyDataInfo.ShelfId=dataold.ShelfId
+			samplesapplyDataInfo.BoxId=dataold.BoxId
+			samplesapplyDataInfo.Position=dataold.Position
+			samplesapplyDataInfo.CHUserBy=this.User.Realname
+			int,_:=strconv.Atoi(this.User.Id)
+			samplesapplyDataInfo.CHUserId=int
+			samplesapplyDataInfo.ParentId=count
+
+			samplesapplyDataInfo.SampleType=samplesInfoShow.SampleType
+			samplesapplyDataInfo.SampleTypeName=samplesInfoShow.SampleTypeName
+			//状态0:申请;1:已审核
+			samplesapplyDataInfo.DetailStatus=2
+		    //保存出库详情
+			svc.InsertEntityBytbl("smkFjSamplesApplyDetail",&samplesapplyDataInfo)
+
+		}
+	}
+	if err == nil {
+		errinfo.Message = "批量复苏操作成功!"
+		errinfo.Code = 0
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	} else {
+		errinfo.Message = "批量复苏操作失败!" + utils.AlertProcess(err.Error())
+		errinfo.Code = -1
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
 
+}
 // @Title 获取预出库样本列表
 // @Description get user by token
 // @Success 200 {object} models.Userblood
@@ -531,7 +754,7 @@ func (this *SamplesApplyController) AddCKDetail() {
 func (this *SamplesApplyController) GetCKList() {
 	page := this.GetPageInfoForm()
 	svc := samplesapply.GetSamplesApplyService(utils.DBE)
-	where := " ParentId = 0"
+	where := " DetailStatus = 0"
 	var list []samplesapply.Applydetailmodel
 	total, list := svc.GetApplySamplesDetail(this.User.AccCode, page.CurrentPage, page.Size, "Id desc", where)
 	var datainfo DataInfo
@@ -594,13 +817,13 @@ func (this *SamplesApplyController) SaveDetail() {
 		where_detail := " Id ='" + strconv.Itoa(dataother.Detaillist[i].Id) + "'"
 		svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesApplyDetailName, &datadetail, cols_detail, where_detail)
 
-		var modeldetail samplesinfo.SamplesDetail
-		modeldetail.ModifiedBy = this.User.Realname
-		modeldetail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-		modeldetail.IState = 10
-		where := "BarCode = '" + dataother.Detaillist[i].BarCode + "'"
-		var cols []string = []string{"IState", "ModifiedBy", "ModifiedUserId"}
-		svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &modeldetail, cols, where)
+		//var modeldetail samplesinfo.SamplesDetail
+		//modeldetail.ModifiedBy = this.User.Realname
+		//modeldetail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+		//modeldetail.IState = 10
+		//where := "BarCode = '" + dataother.Detaillist[i].BarCode + "'"
+		//var cols []string = []string{"IState", "ModifiedBy", "ModifiedUserId"}
+		//svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &modeldetail, cols, where)
 	}
 }
 
@@ -660,10 +883,10 @@ func (this *SamplesApplyController) AuditorCKDetail() {
 			var cols_samples []string = []string{"IState", "ModifiedBy", "ModifiedUserId"}
 			svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_samples, where_detail)
 		} else {
-			//修改样本状态
-			detail.IState = 5
-			var cols_samples []string = []string{"IState", "ModifiedBy", "ModifiedUserId"}
-			svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_samples, where_detail)
+			////修改样本状态
+			//detail.IState = 5
+			//var cols_samples []string = []string{"IState", "ModifiedBy", "ModifiedUserId"}
+			//svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_samples, where_detail)
 		}
 	}
 }
@@ -700,9 +923,9 @@ func (this *SamplesApplyController) AuditorCKApply() {
 		datamain.AuditorRemark = dataother.AuditorRemark
 		datamain.ConTime = time.Now()
 		id := dataother.ApplyList[i].Id
-		opdesc := "审核库申请-" + dataother.ApplyList[i].EntryNo
+		opdesc := "审核库申请-" + dataother.ApplyList[i].EntryNo
 		var cols []string = []string{"ApplyStatus", "ConUserBy", "ConUserId", "ConTime", "AuditorRemark", "ModifiedBy", "ModifiedUserId"}
-		svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+SamplesApplyName, BaseOperationLogName, id, &datamain, &modelmain, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "入库申请")
+		svc.UpdateOperationAndWriteLogBytbl(this.User.AccCode+SamplesApplyName, BaseOperationLogName, id, &datamain, &modelmain, cols, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "出库出申请")
 
 		var list []samplesapply.SamplesApplyDetail
 		where := " ParentId ='" + strconv.Itoa(dataother.ApplyList[i].Id) + "'"
@@ -726,9 +949,84 @@ func (this *SamplesApplyController) AuditorCKApply() {
 				svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_samples, where_detail)
 			} else {
 				//更新样本详情表状态
-				detail.IState = 5
-				var cols_samples []string = []string{"IState", "Capacity", "ModifiedBy", "ModifiedUserId"}
-				svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_samples, where_detail)
+				//detail.IState = 5
+				//var cols_samples []string = []string{"IState", "Capacity", "ModifiedBy", "ModifiedUserId"}
+				//svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_samples, where_detail)
+				var samplesApplyDetail =list[j]
+				var dataold samplesinfo.SamplesDetail //原始样本
+				where := " barcode='" + samplesApplyDetail.BarCode + "' and DeletionStateCode=0"
+				svc := samplesinfo.GetSamplesInfoService(utils.DBE)
+				svc.GetEntityByWhere(this.User.AccCode+SamplesDetailtbName, where, &dataold)
+				recoveryType:=strconv.Itoa(samplesApplyDetail.RecoveryId)
+				quyong:=samplesApplyDetail.Capacity //取用容量
+				var currCapacity float64
+				currCapacity = FloatPoint(float64(dataold.Capacity-quyong), 4) //取用后容量
+				//1.判断复苏的类型
+				if recoveryType != "3" { //除去归档
+					var datanew samplesinfo.SamplesDetail
+					datanew = dataold
+					var cols []string = []string{"ModifiedUserId", "ModifiedBy", "Capacity", "IState"}
+					if recoveryType == "1" { //复苏复存
+						datanew.IState = 1
+					} else if recoveryType == "2" { //不保留位置,存到待复存中
+						datanew.IState = 6
+						datanew.EquipmentId = 0
+						datanew.ShelfId = 0
+						datanew.BoxId = 0
+						datanew.Position = ""
+						cols = append(cols, "EquipmentId")
+						cols = append(cols, "ShelfId")
+						cols = append(cols, "BoxId")
+						cols = append(cols, "Position")
+						cols = append(cols, "PositionDesc")
+					} else if recoveryType == "4" { //存到预录入
+						datanew.IState = 4
+						datanew.EquipmentId = 0
+						datanew.ShelfId = 0
+						datanew.BoxId = 0
+						datanew.Position = ""
+						cols = append(cols, "EquipmentId")
+						cols = append(cols, "ShelfId")
+						cols = append(cols, "BoxId")
+						cols = append(cols, "Position")
+						cols = append(cols, "PositionDesc")
+					} else if recoveryType == "5" { //保留位置,存到待复存中
+						datanew.IState = 5
+					}
+					datanew.Capacity = float32(currCapacity)
+					datanew.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+					datanew.ModifiedBy = this.User.Realname
+					datanew.ModifiedOn=time.Now()
+					//审核通过后根据不同的复苏类型跟新位置信息和  IState Capacity ......
+					svc.UpdateEntityBytbl(this.User.AccCode+SamplesDetailtbName,datanew.Id,&datanew,cols)
+					//err = svc.UpdateDetailAndBuss(this.User.AccCode+SamplesDetailtbName, this.User.AccCode+SamplesBusstbName, idsarr[i], &datanew, &entity, cols)
+				} else { //归档
+					var datafiledetail samplesfileinfo.SamplesFileDetail
+					datafiledetail.SampleCode = dataold.SampleCode
+					datafiledetail.BarCode = dataold.BarCode
+					datafiledetail.InnerCode = dataold.InnerCode
+					datafiledetail.InitCapacity = dataold.InitCapacity
+					datafiledetail.Capacity = float32(currCapacity)
+					datafiledetail.Unit = dataold.Unit
+					datafiledetail.FreezingNum = dataold.FreezingNum
+					datafiledetail.ValidityDate = dataold.ValidityDate
+					datafiledetail.ParentBarCode = dataold.ParentBarCode
+					datafiledetail.IType = dataold.IType
+					datafiledetail.CreateOn = dataold.CreateOn
+					datafiledetail.CreateBy = dataold.CreateBy
+					datafiledetail.CreateUserId = dataold.CreateUserId
+					datafiledetail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+					datafiledetail.ModifiedBy = this.User.Realname
+					datafiledetail.ModifiedOn = time.Now()
+					datafiledetail.Remark = dataold.Remark
+					datafiledetail.DeletionStateCode=dataold.DeletionStateCode
+					datafiledetail.ParentBarCode=dataold.ParentBarCode
+					svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailFiletbName, &datafiledetail)
+					//svc.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &entity)
+					svc.DelSDetailInfo(this.User.AccCode, dataold.Id)
+
+				}
+
 			}
 		}
 	}
@@ -742,9 +1040,13 @@ func (this *SamplesApplyController) AuditorCKApply() {
 func (this *SamplesApplyController) RepealCKApply() {
 	id := this.Ctx.Input.Param(":id")
 	var datamain samplesapply.SamplesApply
+	var oldStatus=datamain.ApplyStatus
 	var jsonblob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonblob, &datamain)
 	svc := samplesapply.GetSamplesApplyService(utils.DBE)
+	svcf:=samplesfileinfo.GetSamplesFileInfoService(utils.DBE)
+	svcd := samplesinfo.GetSamplesInfoService(utils.DBE)
+	//svcApply:=samplesapply.GetSamplesApplyService(utils.DBE)
 	datamain.ModifiedBy = this.User.Realname
 	datamain.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
 	datamain.ApplyStatus = 5
@@ -757,6 +1059,8 @@ func (this *SamplesApplyController) RepealCKApply() {
 	where := " ParentId ='" + strconv.Itoa(datamain.Id) + "'"
 	svc.GetEntitysByWhere(this.User.AccCode+SamplesApplyDetailName, where, &list)
 	var datadetail samplesapply.SamplesApplyDetail
+	var sampleFileDetail samplesfileinfo.SamplesFileDetail
+	//var sampleApplyDetail samplesapply.SamplesApplyDetail
 	for j := 0; j < len(list); j++ {
 		datadetail.ModifiedBy = this.User.Realname
 		datadetail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -772,8 +1076,68 @@ func (this *SamplesApplyController) RepealCKApply() {
 		detail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
 		//撤销申请状态
 		detail.IState = 1
-		var cols_detail []string = []string{"IState", "ModifiedBy", "ModifiedUserId"}
-		svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_detail, where_detail)
+		/*
+		 1.从【已归档样本】中取出要撤回的该条样本信息
+		 2.修改IState的状态为1。
+		 3.原来的容量=currCapacity+quyong
+		 4.恢复位置,位置信息从sampleApplyDetail中查询
+		 5.currCapacity在已归档数据表sampleFileDetail中查询。
+		 6.quyong sampleApplyDetail 表中。
+		*/
+		//根据barcode从【已归档中】sampleFileDetail 表中取出Capacity(取出后的剩余量)
+		sampleFileDetail=svcf.QuerySampleFileByBarCode(this.User.AccCode,list[j].BarCode)
+		//根据barcode 从出库详情中得到取出量
+		//sampleApplyDetail=svcApply.QuerySampleApplyDetailByBarCode(this.User.AccCode,list[j].BarCode)
+		//要恢复的量=归档中剩余量+出库详情中的取出量
+		//恢复位置
+		detail.Position=list[j].Position
+		detail.ShelfId=list[j].ShelfId
+		detail.BoxId=list[j].BoxId
+		detail.EquipmentId=list[j].EquipmentId
+		detail.ModifiedOn=time.Now()
+
+		/**
+		  这里要进行判断,如果是当初复苏的时候选择的是复苏类型是【复苏后不再存入(保留位置信息)】,则撤回的时候insert 数据到SampleDetail中。
+		  如果是其他的则update 操作。因为【复苏后不再存入(保留位置信息)】操作会从sampleDetail中删除数据
+		*/
+
+		//sampleFileDetail的barcode不为"",则说明该barcode 复苏的类型一定是【复苏后不再存入(保留位置信息)】进行inset 到sampleDetail表进行恢复。
+		if sampleFileDetail.BarCode!=""{
+			var column_name []string =[]string{"DeletionStateCode"}
+			//insert 操作
+			detail.Capacity=sampleFileDetail.Capacity+list[j].Capacity
+			detail.CreateBy=sampleFileDetail.CreateBy
+			detail.CreateUserId=sampleFileDetail.CreateUserId
+			detail.CreateOn=sampleFileDetail.CreateOn
+			detail.BarCode=sampleFileDetail.BarCode
+			detail.SampleCode=sampleFileDetail.SampleCode
+			detail.Remark=sampleFileDetail.Remark
+			detail.Unit=sampleFileDetail.Unit
+			detail.InitCapacity=sampleFileDetail.InitCapacity
+			detail.DeletionStateCode=sampleFileDetail.DeletionStateCode
+			detail.FreezingNum=sampleFileDetail.FreezingNum
+			detail.ValidityDate=sampleFileDetail.ValidityDate
+			detail.ParentBarCode=sampleFileDetail.ParentBarCode
+			detail.IType=sampleFileDetail.IType
+			detail.InnerCode=sampleFileDetail.InnerCode
+			svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailtbName, &detail)
+			//需要删除【已归档】中数据,即DeletionStateCode=1
+			sampleFileDetail.DeletionStateCode=1
+			svcf.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailFiletbName,&sampleFileDetail,column_name,where_detail)
+		}else {
+			//从sampleDetail表中查询剩余的容量用来恢复
+			sql:=" a.barcode='"+list[j].BarCode+"' and DeletionStateCode=0 "
+			sampleDetail:=svcd.QuerySampleEntity(this.User.AccCode,sql)
+			//如果是审核异常撤销的
+			if oldStatus==3{
+				detail.Capacity=sampleDetail.Capacity
+			}else{
+				detail.Capacity=sampleDetail.Capacity+list[j].Capacity
+			}
+			var cols_detail []string = []string{"IState", "Capacity","Position","ShelfId","BoxId","EquipmentId","ModifiedBy", "ModifiedUserId","ModifiedOn"}
+			svc.UpdateEntityBywheretbl(this.User.AccCode+SamplesDetailtbName, &detail, cols_detail, where_detail)
+		}
+
 	}
 	var errinfo ErrorInfo
 	if err == nil {

+ 114 - 61
src/dashoo.cn/backend/api/controllers/samplesinfo/samplesinput.go

@@ -1,6 +1,7 @@
 package samplesinfo
 
 import (
+	"dashoo.cn/backend/api/business/samplesapply"
 	"encoding/json"
 	"fmt"
 	"strconv"
@@ -948,7 +949,6 @@ func (this *SamplesinputController) BatchFuSuEditPost() {
 			//	oldshelfid := utils.ToStr(dataold.ShelfId)
 			//	oldboxid := utils.ToStr(dataold.BoxId)
 			//	oldposition := dataold.Position
-
 			fusu := utils.ToStr(model.FusuRadio)
 			quyong, _ := utils.StrTo(model.CapacityUsed).Float32() //取用容量
 			var currCapacity float64
@@ -973,6 +973,7 @@ func (this *SamplesinputController) BatchFuSuEditPost() {
 			} else if fusu == "5" {
 				optype = 15
 			}
+
 			var entity samplesbusiness.SamplesBusiness //业务记录
 			entity.AccCode = this.User.AccCode
 			entity.SampleCode = dataold.SampleCode
@@ -984,78 +985,63 @@ func (this *SamplesinputController) BatchFuSuEditPost() {
 			entity.OpType = optype
 			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 			entity.CreateBy = this.User.Realname
+			//对于SampleDetail的修改仅仅修改IState=10
+			//修改SampleDetail=10
+			var datanew samplesinfo.SamplesDetail
+			var cols []string = []string{"FreezingNum", "IState"}
+			datanew=dataold
+			datanew.FreezingNum = currFreezingNum
+			datanew.IState=10
+			svc.UpdateEntityBytbl(this.User.AccCode+SamplesDetailtbName,dataold.Id,&datanew,cols)
 			if fusu != "3" { //除去归档
-				var datanew samplesinfo.SamplesDetail
-				datanew = dataold
-				var cols []string = []string{"ModifiedUserId", "ModifiedBy", "Capacity", "FreezingNum", "IState"}
-				if fusu == "1" { //复苏复存
-					datanew.IState = 1
-				} else if fusu == "2" { //不保留位置,存到待复存中
-					datanew.IState = 6
-					datanew.EquipmentId = 0
-					datanew.ShelfId = 0
-					datanew.BoxId = 0
-					datanew.Position = ""
-					cols = append(cols, "EquipmentId")
-					cols = append(cols, "ShelfId")
-					cols = append(cols, "BoxId")
-					cols = append(cols, "Position")
-					cols = append(cols, "PositionDesc")
-				} else if fusu == "4" { //存到预录入
-					datanew.IState = 4
-					datanew.EquipmentId = 0
-					datanew.ShelfId = 0
-					datanew.BoxId = 0
-					datanew.Position = ""
-					cols = append(cols, "EquipmentId")
-					cols = append(cols, "ShelfId")
-					cols = append(cols, "BoxId")
-					cols = append(cols, "Position")
-					cols = append(cols, "PositionDesc")
-				} else if fusu == "5" { //保留位置,存到待复存中
-					datanew.IState = 5
-				}
-				datanew.Capacity = float32(currCapacity)
-				datanew.FreezingNum = currFreezingNum
-				datanew.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-				datanew.ModifiedBy = this.User.Realname
-
 				entity.EquipmentId = datanew.EquipmentId
 				entity.ShelfId = datanew.ShelfId
 				entity.BoxId = datanew.BoxId
 				entity.Position = datanew.Position
 				entity.PositionDesc = svc.GetPostiondescByPosId(datanew.EquipmentId, datanew.ShelfId, datanew.BoxId, datanew.Position)
-
-				err = svc.UpdateDetailAndBuss(this.User.AccCode+SamplesDetailtbName, this.User.AccCode+SamplesBusstbName, idsarr[i], &datanew, &entity, cols)
 			} else { //归档
 				entity.EquipmentId = 0
 				entity.ShelfId = 0
 				entity.BoxId = 0
 				entity.Position = ""
 				entity.PositionDesc = ""
-				var datafiledetail samplesfileinfo.SamplesFileDetail
-				datafiledetail.SampleCode = dataold.SampleCode
-				datafiledetail.BarCode = dataold.BarCode
-				datafiledetail.InnerCode = dataold.InnerCode
-				datafiledetail.InitCapacity = dataold.InitCapacity
-				datafiledetail.Capacity = float32(currCapacity)
-				datafiledetail.Unit = dataold.Unit
-				datafiledetail.FreezingNum = currFreezingNum
-				datafiledetail.ValidityDate = dataold.ValidityDate
-				datafiledetail.ParentBarCode = dataold.ParentBarCode
-				datafiledetail.IType = dataold.IType
-				datafiledetail.CreateOn = dataold.CreateOn
-				datafiledetail.CreateBy = dataold.CreateBy
-				datafiledetail.CreateUserId = dataold.CreateUserId
-				datafiledetail.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
-				datafiledetail.ModifiedBy = this.User.Realname
-				datafiledetail.ModifiedOn = time.Now()
-				datafiledetail.Remark = dataold.Remark
-
-				svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailFiletbName, &datafiledetail)
-				svc.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &entity)
-				svc.DelSDetailInfo(this.User.AccCode, dataold.Id)
 			}
+			//insert 业务记录到SamplesBusiness
+			svc.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &entity)
+			var samplesapplyDataInfo samplesapply.SamplesApplyDetail
+			//复苏类型
+			samplesapplyDataInfo.RecoveryId=model.FusuRadio
+			//在出库的时候会和出库单建立关系
+			samplesapplyDataInfo.ParentId=0
+			samplesapplyDataInfo.SampleCode=dataold.SampleCode
+			samplesapplyDataInfo.BarCode=dataold.BarCode
+			samplesapplyDataInfo.InitCapacity=dataold.InitCapacity
+			samplesapplyDataInfo.Capacity=quyong
+			samplesapplyDataInfo.Unit=dataold.Unit
+			samplesapplyDataInfo.CreateOn=dataold.CreateOn
+			samplesapplyDataInfo.CreateBy=dataold.CreateBy
+			samplesapplyDataInfo.CreateUserId=dataold.CreateUserId
+			samplesapplyDataInfo.ModifiedUserId=dataold.ModifiedUserId
+			samplesapplyDataInfo.ModifiedBy = this.User.Realname
+			samplesapplyDataInfo.ModifiedOn = time.Now()
+			samplesapplyDataInfo.EquipmentId=dataold.EquipmentId
+			samplesapplyDataInfo.ShelfId=dataold.ShelfId
+			samplesapplyDataInfo.BoxId=dataold.BoxId
+			samplesapplyDataInfo.Position=dataold.Position
+			//样本选定人
+			samplesapplyDataInfo.CHUserBy=this.User.Realname
+			//样本选定人ID
+			chUserId,_:=strconv.Atoi(this.User.Id)
+			samplesapplyDataInfo.CHUserId=chUserId
+			var samplesInfoShow samplesinfo.SamplesInfoShow
+			sql:=" a.SampleCode='"+dataold.SampleCode+"'"
+			samplesInfoShow=svc.QuerySampleEntity(this.User.AccCode,sql)
+			samplesapplyDataInfo.SampleType=samplesInfoShow.SampleType
+			samplesapplyDataInfo.SampleTypeName=samplesInfoShow.SampleTypeName
+			//状态0:申请;1:已审核
+			samplesapplyDataInfo.DetailStatus=0
+			//生成样本出库详情
+			svc.InsertEntityBytbl(this.User.AccCode+SamplesApplyDetailName,&samplesapplyDataInfo)
 			//是否有审批权限
 			svcpermission := permission.GetPermissionService(utils.DBE)
 			if svcpermission.IsAuthorized(utils.ToStr(this.User.Id), "WaterDrop.Home.approve") {
@@ -1069,7 +1055,7 @@ func (this *SamplesinputController) BatchFuSuEditPost() {
 				approveentity.AccCode = this.User.AccCode
 				approveentity.CKNo = ckno
 				approveentity.CKInfo = "样本复苏审批"
-				approveentity.BarCode = entity.BarCode
+				approveentity.BarCode = dataold.BarCode
 				approveentity.ToUserId, _ = utils.StrTo(approveperson).Int()
 				approveentity.SendDate = time.Now()
 				approveentity.ApproveState = 0
@@ -2175,6 +2161,73 @@ func (this *SamplesinputController) ExportExcel() {
 	this.ServeJSON()
 }
 
+// @Title get
+// @Description get SampleType by token
+// @Success 200 {object} sampletype.SampleType
+// @router /exportexcelapply [get]
+func (this *SamplesinputController) ExportExcelSampleApply() {
+	var title []string
+	var list []samplesapply.Applydetailmodel
+	entryno:=this.GetString("Entryno")
+	fmt.Println(entryno)
+	svc := samplesapply.GetSamplesApplyService(utils.DBE)
+	list=svc.QueryApplySamplesDetail(this.User.AccCode,entryno)
+	var filetitle="出库详情" //文件名
+
+	titlestring := ""
+	f := xlsx.NewFile()
+	titlestring="样本条码,样本编码,样本类型,可用容量,存储位置,审核状态,操作人,撤销人"
+	title = strings.Split(titlestring, ",")
+	this.DaySaveXlsxExport(filetitle, title, list, f)
+	SaveDirectory("static/file/excel/report/")
+	f.Save("static/file/excel/report/" + utils.TimeFormat(time.Now(), "200612") + "出库详情.xlsx")
+	this.Ctx.WriteString(this.Ctx.Request.Host + "/static/file/excel/report/" + utils.TimeFormat(time.Now(), "200612") + "出库详情.xlsx")
+
+}
+func (this *SamplesinputController) DaySaveXlsxExport(name string, title []string, datas []samplesapply.Applydetailmodel, f *xlsx.File) {
+	sheet, _ := f.AddSheet(name)
+	rowhead := sheet.AddRow()
+	rowhead.WriteSlice(&title, -1)
+
+	for _, v := range datas {
+
+		//strsex := ""
+		//if v.Sex == 0 {
+		//	strsex = "男"
+		//} else if v.Sex == 1 {
+		//	strsex = "女"
+		//} else {
+		//	strsex = ""
+		//}
+		//strmarital := ""
+		//if v.MaritalStatus == 0 {
+		//	strmarital = "未婚"
+		//} else if v.MaritalStatus == 1 {
+		//	strmarital = "已婚"
+		//} else if v.MaritalStatus == 2 {
+		//	strmarital = "未知"
+		//} else {
+		//	strmarital = ""
+		//}
+
+		datastring := v.SampleCode + "," + v.BarCode +","+ v.SampleTypeName +","+ utils.ToStr(v.Capacity) +"," +v.Position  + "," + strconv.Itoa(v.DetailStatus) + "," + v.CHUserBy + "," + v.CancelBy
+		cellname := strings.Split(datastring, ",")
+		row := sheet.AddRow()
+		row.WriteSlice(&cellname, -1)
+	}
+	//sheet.Cols[1].Width = 20
+	//sheet.Cols[4].Width = 20
+	//sheet.Cols[6].Width = 20
+	//sheet.Cols[7].Width = 15
+	//sheet.Cols[8].Width = 20
+	//sheet.Cols[12].Width = 20
+	//sheet.Cols[13].Width = 50
+	//sheet.Cols[14].Width = 30
+	//sheet.Cols[15].Width = 20
+	//sheet.Cols[16].Width = 20
+	//sheet.Cols[17].Width = 20
+}
+
 func (this *SamplesinputController) DaySaveXlsx(name string, title []string, column string, datas []samplesinfo.SamplesInfoList, f *xlsx.File, tykzlist []stypenoteitem.STypeNoteItem) {
 
 	sheet, _ := f.AddSheet(name)

+ 232 - 148
src/dashoo.cn/frontend_web/src/components/samples/batchrecoverydialog.vue

@@ -1,26 +1,75 @@
 <template>
   <div>
-    <el-dialog title="样本批量复苏" :visible.sync="visible" top="5vh">
-      <el-form ref="FuSuFormref" :model="FuSuForm" :rules="rulesfusu" label-width="100px">
+    <el-dialog title="样本批量复苏"
+               :visible.sync="visible"
+               top="5vh">
+      <el-form ref="FuSuFormref"
+               :model="FuSuForm"
+               :rules="rulesfusu"
+               label-width="100px">
         <el-row>
           <el-col :span="16">
-            <el-form-item label="取用容量" prop="CapacityUsed" required>
-              <el-input v-model="FuSuForm.CapacityUsed" placeholder="取用容量">
+            <el-form-item label="取用容量"
+                          prop="CapacityUsed"
+                          required>
+              <el-input v-model="FuSuForm.CapacityUsed"
+                        placeholder="取用容量">
               </el-input>
             </el-form-item>
           </el-col>
-          <el-col :span="8" v-if="fusu_flag">
+          <el-col :span="8"
+                  v-if="fusu_flag">
             <el-form-item label="记录冻融次数">
               <el-switch v-show="false"></el-switch>
-              <el-switch v-model="FuSuForm.FreezingNum" on-color="#13ce66" on-text="开" off-text="关"> </el-switch>
+              <el-switch v-model="FuSuForm.FreezingNum"
+                         on-color="#13ce66"
+                         on-text="开"
+                         off-text="关"> </el-switch>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8"
+                  v-if="!fusu_flag">
+            <el-form-item label="记录冻融次数">
+              <el-switch v-show="false"></el-switch>
+              <el-switch v-model="FuSuForm.FreezingNum"
+                         on-color="#13ce66"
+                         on-text="开"
+                         off-text="关"> </el-switch>
             </el-form-item>
           </el-col>
         </el-row>
-        <el-form-item label="操作说明" style="margin-top:15px;" v-if="fusu_flag">
-          <el-input type="textarea" v-model="FuSuForm.OpDesc" placeholder="操作说明"></el-input>
+        <el-form-item label="操作说明"
+                      style="margin-top:15px;"
+                      v-if="fusu_flag">
+          <el-input type="textarea"
+                    v-model="FuSuForm.OpDesc"
+                    placeholder="操作说明"></el-input>
+        </el-form-item>
+        <el-form-item label="操作说明"
+                      style="margin-top:15px;"
+                      v-if="!fusu_flag">
+          <el-input type="textarea"
+                    v-model="FuSuForm.OpDesc"
+                    placeholder="操作说明"></el-input>
+        </el-form-item>
+        <el-form-item label="复苏类型"
+                      required
+                      v-if="fusu_flag">
+          <el-radio-group v-model="FuSuForm.FusuRadio"
+                          class="samplerecoveope">
+            <el-radio :label="3">复苏后不再存入(保留样本信息)</el-radio>
+            <el-radio :label="1">复苏直接复存</el-radio>
+            <el-radio :label="5">复苏之后再次存入(保留位置)</el-radio>
+            <el-radio :label="2">复苏后再次存入(不保留位置)</el-radio>
+            <el-radio :label="4">复苏后存入预录入</el-radio>
+          </el-radio-group>
         </el-form-item>
-        <el-form-item label="复苏类型" required v-if="fusu_flag">
-          <el-radio-group v-model="FuSuForm.FusuRadio" class="samplerecoveope">
+
+              <el-form-item label="复苏类型"
+                      required
+                      v-if="!fusu_flag">
+          <el-radio-group v-model="FuSuForm.FusuRadio"
+                          class="samplerecoveope">
             <el-radio :label="3">复苏后不再存入(保留样本信息)</el-radio>
             <el-radio :label="1">复苏直接复存</el-radio>
             <el-radio :label="5">复苏之后再次存入(保留位置)</el-radio>
@@ -29,164 +78,199 @@
           </el-radio-group>
         </el-form-item>
       </el-form>
-      <div slot="footer" class="dialog-footer" style="margin-top:-30px;">
-        <el-button @click="visible = false">取 消</el-button>
-        <el-button type="primary" @click="savedata()" v-if="fusu_flag">确 定</el-button>
-        <el-button type="primary" @click="addDetail()" v-if="!fusu_flag">确 定</el-button>
+      <div slot="footer"
+           class="dialog-footer"
+           style="margin-top:-30px;">
+        <el-button @click="clear()">取 消</el-button>
+        <el-button type="primary"
+                   @click="savedata()"
+                   v-if="fusu_flag">确 定</el-button>
+        <el-button type="primary"
+                   @click="addDetail()"
+                   v-if="!fusu_flag">确 定</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-  import {
-    mapGetters
-  } from 'vuex'
-  export default {
-    name: 'batchrecoverydialog',
-    props: {
-      visible: {
-        type: Boolean,
-        default: false
-      },
-      applyform: {}
-    },
-    created() {},
-    computed: {
-      ...mapGetters({
-        session: 'session'
-      })
+import {
+  mapGetters
+} from 'vuex'
+export default {
+  name: 'batchrecoverydialog',
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
     },
-    watch: {
-      visible(val) {
-        this.selfVisible = val
-        if (this.visible) {
-          this.fusu_flag = this.applyform.applyfusu_flag
-          this.samples = this.applyform.samples
-          this.createoptions
-        }
-      },
-      selfVisible(val) {
-        this.$emit('update:visible', val)
+    applyform: {}
+  },
+  created () { },
+  computed: {
+    ...mapGetters({
+      session: 'session'
+    })
+  },
+  watch: {
+    visible (val) {
+      this.selfVisible = val
+      if (this.visible) {
+        // alert('this.applyform.applyfusu_flag:' + this.applyform.applyfusu_flag)
+        this.fusu_flag = this.applyform.applyfusu_flag
+        this.samples = this.applyform.samples
+        this.createoptions
       }
     },
-    data() {
-      var checkCapacityUsed = (rule, value, callback) => {
-        if (value === '') {
-          callback(new Error('请输入取用容量'))
-          return
-        }
-        if (!isNaN(parseFloat(value)) && !isNaN(value)) {
-          if (parseFloat(value) <= 0) {
-            callback(new Error('请输入大于0的数字值'))
-            return
-          } else {
-            for (let i = 0; i < this.samples.length; i++) {
-              if (parseFloat(value) > this.samples[i].Capacity) {
-                callback(new Error(`样本【${this.samples[i].BarCode}】验证失败,取用量不能大于可用容量`))
-                return
-              }
+    selfVisible (val) {
+      this.$emit('update:visible', val)
+    }
+  },
+  data () {
+    var checkCapacityUsed = (rule, value, callback) => {
+      if (value === '') {
+        callback(new Error('请输入取用容量'))
+        return
+      }
+      if (!isNaN(parseFloat(value)) && !isNaN(value)) {
+        if (parseFloat(value) <= 0) {
+          callback(new Error('请输入大于0的数字值'))
+        } else {
+          for (let i = 0; i < this.samples.length; i++) {
+            if (parseFloat(value) > this.samples[i].Capacity) {
+              callback(new Error(`样本【${this.samples[i].BarCode}】验证失败,取用量不能大于可用容量`))
+              return
             }
-            for (let i = 0; i < this.samples.length; i++) {
-              if (parseFloat(value) === this.samples[i].Capacity && this.FuSuForm.FusuRadio !== 3) {
-                callback(new Error(`样本【${this.samples[i].BarCode}】验证失败,剩余容量为0,不能再次存入`))
-                return
-              }
+          }
+          for (let i = 0; i < this.samples.length; i++) {
+            if (parseFloat(value) === this.samples[i].Capacity && this.FuSuForm.FusuRadio !== 3) {
+              callback(new Error(`样本【${this.samples[i].BarCode}】验证失败,剩余容量为0,不能再次存入`))
+              return
             }
-            callback()
           }
-        } else {
-          callback(new Error('请输入正确数字值'))
-          return
+          callback()
         }
+      } else {
+        callback(new Error('请输入正确数字值'))
       }
-      return {
-        FuSuForm: {
-          CapacityUsed: 0, // 取用容量
-          OpDesc: '', // 操作说明
-          FreezingNum: true, // 记录冻融次数
-          FusuRadio: 3 // 复苏类型
-        },
-        rulesfusu: {
-          CapacityUsed: [{
-            validator: checkCapacityUsed,
-            trigger: 'blur'
-          }]
-        },
-        fusu_flag: true,
-        samples: [],
-        selfVisible: this.visible // 避免vue双向绑定警告
-      }
-    },
-    methods: {
-      savedata() {
-        this.$refs['FuSuFormref'].validate((valid) => {
-          if (valid) {
-            let ids = []
-            for (let i = 0; i < this.samples.length; i++) {
-              ids.push(this.samples[i].Id)
-            }
-            let _this = this
-            _this.$axios.put('/sampleinput/batchfusu?ids=' + ids, _this.FuSuForm)
-              .then(res => {
-                // response
-                if (res.data.code === 0) {
-                  _this.$message({
-                    type: 'success',
-                    message: res.data.message
-                  })
-                  _this.$emit('close', _this.FuSuForm.FusuRadio)
-                  _this.selfVisible = false
-                } else {
-                  _this.$message({
-                    type: 'warning',
-                    message: res.data.message
-                  })
-                }
-              })
-              .catch(() => {})
-          }
-        })
+    }
+    return {
+      FuSuForm: {
+        CapacityUsed: 0, // 取用容量
+        OpDesc: '', // 操作说明
+        FreezingNum: true, // 记录冻融次数
+        FusuRadio: 3 // 复苏类型
+      },
+      rulesfusu: {
+        CapacityUsed: [{
+          validator: checkCapacityUsed,
+          trigger: 'blur'
+        }]
       },
-      addDetail() {
-        this.$refs['FuSuFormref'].validate((valid) => {
-          if (valid) {
-            let _this = this
-            _this.FuSuForm.CapacityUsed = parseFloat(_this.FuSuForm.CapacityUsed)
-            let params = _this.FuSuForm
-            params = Object.assign(params, {
-              Detaillist: _this.samples
+      fusu_flag: true,
+      samples: [],
+      selfVisible: this.visible // 避免vue双向绑定警告
+    }
+  },
+  methods: {
+    savedata () {
+      this.$refs['FuSuFormref'].validate((valid) => {
+        if (valid) {
+          let ids = []
+          for (let i = 0; i < this.samples.length; i++) {
+            ids.push(this.samples[i].Id)
+          }
+          let _this = this
+          _this.$axios.put('/sampleinput/batchfusu?ids=' + ids, _this.FuSuForm)
+            .then(res => {
+              // response
+              if (res.data.code === 0) {
+                _this.$message({
+                  type: 'success',
+                  message: res.data.message
+                })
+                _this.$emit('close', _this.FuSuForm.FusuRadio)
+                _this.selfVisible = false
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: res.data.message
+                })
+              }
             })
-            _this.$axios.post('/samplesapply/addckdetail', _this.FuSuForm)
-              .then(res => {
-                // response
-                if (res.data.code === 0) {
-                  _this.$message({
-                    type: 'success',
-                    message: res.data.message
-                  })
-                  _this.$emit('close')
-                  _this.selfVisible = false
-                } else {
-                  _this.$message({
-                    type: 'warning',
-                    message: res.data.message
-                  })
-                }
-              })
-              .catch(() => {})
+            .catch(() => { })
+        }
+      })
+    },
+    clear () {
+      this.visible = false
+      this.applyform.applyfusu_flag = true
+    },
+    addDetail () {
+      // alert('Hello')
+      this.$refs['FuSuFormref'].validate((valid) => {
+        if (valid) {
+          let ids = []
+          for (let i = 0; i < this.samples.length; i++) {
+            ids.push(this.samples[i].Id)
           }
-        })
-      },
+          let _this = this
+          _this.$axios.put('/samplesapply/batchfusu?ids=' + ids, _this.FuSuForm)
+            .then(res => {
+              // response
+              if (res.data.code === 0) {
+                _this.$message({
+                  type: 'success',
+                  message: res.data.message
+                })
+                _this.$emit('close', _this.FuSuForm.FusuRadio)
+                _this.selfVisible = false
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: res.data.message
+                })
+              }
+            })
+            .catch(() => { })
+        }
+      })
+      // this.$refs['FuSuFormref'].validate((valid) => {
+      //   if (valid) {
+      //     let _this = this
+      //     _this.FuSuForm.CapacityUsed = parseFloat(_this.FuSuForm.CapacityUsed)
+      //     let params = _this.FuSuForm
+      //     params = Object.assign(params, {
+      //       Detaillist: _this.samples
+      //     })
+      //     _this.$axios.post('/samplesapply/addckdetail', _this.FuSuForm)
+      //       .then(res => {
+      //         // response
+      //         if (res.data.code === 0) {
+      //           _this.$message({
+      //             type: 'success',
+      //             message: res.data.message
+      //           })
+      //           _this.$emit('close')
+      //           _this.selfVisible = false
+      //         } else {
+      //           _this.$message({
+      //             type: 'warning',
+      //             message: res.data.message
+      //           })
+      //         }
+      //       })
+      //       .catch(() => { })
+      //   }
+      // })
     }
   }
-
+}
 </script>
 
 <style>
-  .samplerecoveope .el-radio {
-    padding: 8px 15px 0 0;
-    margin-left: -2px;
-  }
-
+.samplerecoveope .el-radio {
+  padding: 8px 15px 0 0;
+  margin-left: -2px;
+}
 </style>

+ 755 - 510
src/dashoo.cn/frontend_web/src/pages/biobank/sampleCK/_opera/operation.vue

@@ -1,35 +1,65 @@
 <style>
-  .input-with-select .el-select .el-input {
-    width: 110px;
-  }
-
-  .input-with-select .el-input-group__append {
-    background-color: #fff;
-  }
+.input-with-select .el-select .el-input {
+  width: 110px;
+}
 
+.input-with-select .el-input-group__append {
+  background-color: #fff;
+}
 </style>
 
 <template>
   <div>
     <el-card style="min-height: calc(100vh - 92px);">
-      <div slot="header" style="height: 20px;">
+      <div slot="header"
+           style="height: 20px;">
         <span style="float: left;">
           <i class="icon icon-table2"></i>
         </span>
-        <el-breadcrumb class="heading" style="float: left; margin-left: 5px">
+        <el-breadcrumb class="heading"
+                       style="float: left; margin-left: 5px">
           <el-breadcrumb-item :to="{ path: '/' }">平台首页</el-breadcrumb-item>
           <el-breadcrumb-item :to="{ path: '/biobank/sampleCK' }">出库申请</el-breadcrumb-item>
           <el-breadcrumb-item>{{pagetitle}}</el-breadcrumb-item>
         </el-breadcrumb>
         <span style="float: right;">
-          <el-button size="mini" type="primary" class="el-button--small" style="margin-left: 8px" :disabled="save_flag"
-            @click="saveApply">保存</el-button>
-          <el-button size="mini" type="primary" class="el-button--small" style="margin-left: 8px"
-            onclick="window.history.go(-1)">返回</el-button>
+          <!-- <el-dropdown split-button
+                       type="primary"
+                       size="mini"
+                       style="margin-left:10px; margin-top: -4px;"
+                       @command="handleExportsamplesCommand">
+            导出
+            <el-dropdown-menu slot="dropdown">
+              <el-dropdown-item style="color:black;"
+                                command="exportchosen">导出所选样本</el-dropdown-item>
+              <el-dropdown-item style="color:black;"
+                                command="exportpage">导出当前页样本</el-dropdown-item>
+              <el-dropdown-item style="color:black;"
+                                command="exportall">导出所有样本</el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown> -->
+          <el-button size="mini"
+                     type="primary"
+                     class="el-button--small"
+                     style="margin-left: 8px"
+                     :disabled="save_flag"
+                     @click="saveApply">保存</el-button>
+        <el-button size="mini"
+                     type="primary"
+                     class="el-button--small"
+                     style="margin-left: 8px"
+                   
+                     @click="handleExportsamplesCommand">导出</el-button>
+          <el-button size="mini"
+                     type="primary"
+                     class="el-button--small"
+                     style="margin-left: 8px"
+                     onclick="window.history.go(-1)">返回</el-button>
         </span>
       </div>
-
-      <el-form :model="SampleCKform" label-width="100px" ref="SampleCKform">
+      <el-form :model="SampleCKform"
+               label-width="100px"
+               ref="SampleCKform">
         <el-row :gutter="20">
           <el-col :span="24">
             <el-card class="box-card equipmentdetail">
@@ -39,51 +69,76 @@
               </div>
               <el-col :span="8">
                 <el-form-item label="出库单号">
-                  <el-input v-model="SampleCKform.EntryNo" placeholder="为空默认自动生成" :disabled="add_flag"></el-input>
+                  <el-input v-model="SampleCKform.EntryNo"
+                            placeholder="为空默认自动生成"
+                            :disabled="add_flag"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="申请人">
-                  <el-input v-model="SampleCKform.OperationBy" placeholder="请输入申请人" :disabled="add_flag"></el-input>
+                  <el-input v-model="SampleCKform.OperationBy"
+                            placeholder="请输入申请人"
+                            :disabled="add_flag"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="领用部门">
-                  <el-input v-model="SampleCKform.Section" placeholder="请输入领用部门" :disabled="add_flag"></el-input>
+                  <el-input v-model="SampleCKform.Section"
+                            placeholder="请输入领用部门"
+                            :disabled="add_flag"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="申请时间">
-                  <el-date-picker v-model="SampleCKform.EntryTime" type="datetime" style="width:100%"
-                    placeholder="请选择申请时间" :disabled="add_flag">
+                  <el-date-picker v-model="SampleCKform.EntryTime"
+                                  type="datetime"
+                                  style="width:100%"
+                                  placeholder="请选择申请时间"
+                                  :disabled="add_flag">
                   </el-date-picker>
                 </el-form-item>
               </el-col>
-              <el-col :span="8" v-if="(save_flag) && (SampleCKform.ApplyStatus != 5)">
+              <el-col :span="8"
+                      v-if="(save_flag) && (SampleCKform.ApplyStatus != 5)">
                 <el-form-item label="审核人">
-                  <el-select ref="reflrrselect" v-model="SampleCKform.ConUserId" style="width:100%">
-                    <el-option v-for="item in userlist" :label="item.Realname" :value="item.Id" :key="item.Id">
+                  <el-select ref="reflrrselect"
+                             v-model="SampleCKform.ConUserId"
+                             style="width:100%">
+                    <el-option v-for="item in userlist"
+                               :label="item.Realname"
+                               :value="item.Id"
+                               :key="item.Id">
                     </el-option>
                   </el-select>
                 </el-form-item>
               </el-col>
-              <el-col :span="8" v-if="(save_flag) && (SampleCKform.ApplyStatus != 5)">
+              <el-col :span="8"
+                      v-if="(save_flag) && (SampleCKform.ApplyStatus != 5)">
                 <el-form-item label="审核时间">
-                  <el-date-picker v-model="SampleCKform.ConTime" type="datetime" style="width:100%"
-                    placeholder="请选择审核时间">
+                  <el-date-picker v-model="SampleCKform.ConTime"
+                                  type="datetime"
+                                  style="width:100%"
+                                  placeholder="请选择审核时间">
                   </el-date-picker>
                 </el-form-item>
               </el-col>
               <el-col :span="24">
                 <el-form-item label="备注">
-                  <el-input v-model="SampleCKform.Remark" type="textarea" :rows=3 :disabled="add_flag"
-                    placeholder="请输入备注信息"></el-input>
+                  <el-input v-model="SampleCKform.Remark"
+                            type="textarea"
+                            :rows=3
+                            :disabled="add_flag"
+                            placeholder="请输入备注信息"></el-input>
                 </el-form-item>
               </el-col>
-              <el-col :span="24" v-if="(save_flag) && (SampleCKform.ApplyStatus != 5)">
+              <el-col :span="24"
+                      v-if="(save_flag) && (SampleCKform.ApplyStatus != 5)">
                 <el-form-item label="审核备注">
-                  <el-input v-model="SampleCKform.AuditorRemark" type="textarea" :rows=3 :disabled="save_flag"
-                    placeholder="请输入审核备注信息"></el-input>
+                  <el-input v-model="SampleCKform.AuditorRemark"
+                            type="textarea"
+                            :rows=3
+                            :disabled="save_flag"
+                            placeholder="请输入审核备注信息"></el-input>
                 </el-form-item>
               </el-col>
             </el-card>
@@ -95,10 +150,14 @@
         <el-col :span="24">&nbsp;</el-col>
       </el-row>
 
-      <el-form :model="applyForm" label-width="100px" ref="applydetail">
-        <el-row :gutter="20" class="applydetailcss">
+      <el-form :model="applyForm"
+               label-width="100px"
+               ref="applydetail">
+        <el-row :gutter="20"
+                class="applydetailcss">
           <el-col :span="24">
-            <el-card class="box-card equipmentdetail adddetailcard" v-if="save_flag">
+            <el-card class="box-card equipmentdetail adddetailcard"
+                     v-if="save_flag">
               <div slot="header">
                 <legend style="color:#436EEE"></legend>
                 <i class="icon icon-paragraph-justify">申请信息</i>
@@ -108,42 +167,87 @@
               </div>
               <!-- <el-table :data="ApplyList" border style="width: 100%" @selection-change="authorSelectionChange"> -->
               <!-- <el-table-column type="selection" width="35px"></el-table-column> -->
-              <el-table :data="ApplyList" border style="width: 100%">
-                <el-table-column prop="BarCode" label="样本条码" min-width="120" align="center" show-overflow-tooltip>
+              <el-table :data="ApplyList"
+                        border
+                        @selection-change="handleSelectionChange"
+                        style="width: 100%">
+                        
+                         <el-table-column type="selection" width="55"></el-table-column>
+                <el-table-column prop="BarCode"
+                                 label="样本条码"
+                                 min-width="120"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column prop="SampleCode" label="样本编码" min-width="120" align="center" show-overflow-tooltip>
+                <el-table-column prop="SampleCode"
+                                 label="样本编码"
+                                 min-width="120"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column prop="SampleTypeName" min-width="80" label="样本类型" align="center" show-overflow-tooltip>
+                <el-table-column prop="SampleTypeName"
+                                 min-width="80"
+                                 label="样本类型"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column label="可用容量" min-width="80" show-overflow-tooltip align="center" header-align="center">
+                <el-table-column label="可用容量"
+                                 min-width="80"
+                                 show-overflow-tooltip
+                                 align="center"
+                                 header-align="center">
                   <template slot-scope="scope">
                     {{ scope.row.Capacity }} {{ scope.row.Unit }}
                   </template>
                 </el-table-column>
-                <el-table-column label="存储位置" min-width="120" show-overflow-tooltip align="center"
-                  header-align="center">
+                <el-table-column label="存储位置"
+                                 min-width="120"
+                                 show-overflow-tooltip
+                                 align="center"
+                                 header-align="center">
                   <template slot-scope="scope">
                     {{ scope.row.ECode + "-" + numtoupchar(scope.row.ShelfY) + scope.row.ShelfX + "-" +
                     numtoupchar(scope.row.BoxY) + scope.row.BoxX + "-" + postiontoupchar(scope.row.Position) }}
                   </template>
                 </el-table-column>
-                <el-table-column prop="DetailStatus" sortable label="审核状态" align="center" min-width="80">
+                <el-table-column prop="DetailStatus"
+                                 sortable
+                                 label="审核状态"
+                                 align="center"
+                                 min-width="80">
                   <template slot-scope="scope">
-                    <el-tag v-show="scope.row.DetailStatus=='0'" type="warning">未审核</el-tag>
-                    <el-tag v-show="scope.row.DetailStatus=='1'" type="success">已审核</el-tag>
-                    <el-tag v-show="scope.row.DetailStatus=='2'" type="success">已审核</el-tag>
-                    <el-tag v-show="scope.row.DetailStatus=='3'" type="danger">审核异常</el-tag>
-                    <el-tag v-show="scope.row.DetailStatus=='5'" type="danger">已撤销</el-tag>
+                    <el-tag v-show="scope.row.DetailStatus=='0'"
+                            type="warning">未审核</el-tag>
+                    <el-tag v-show="scope.row.DetailStatus=='1'"
+                            type="success">已审核</el-tag>
+                    <el-tag v-show="scope.row.DetailStatus=='2'"
+                            type="success">已审核</el-tag>
+                    <el-tag v-show="scope.row.DetailStatus=='3'"
+                            type="danger">审核异常</el-tag>
+                    <el-tag v-show="scope.row.DetailStatus=='5'"
+                            type="danger">已撤销</el-tag>
                   </template>
                 </el-table-column>
-                <el-table-column prop="CHUserBy" min-width="80" label="操作人" align="center" show-overflow-tooltip>
+                <el-table-column prop="CHUserBy"
+                                 min-width="80"
+                                 label="操作人"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column prop="CancelBy" min-width="80" label="撤销人" align="center" show-overflow-tooltip>
+                <el-table-column prop="CancelBy"
+                                 min-width="80"
+                                 label="撤销人"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
               </el-table>
-              <el-pagination @size-change="HandleSizeChange" @current-change="HandleCurrentChange"
-                :current-page="CurrentPage" :page-sizes="[10, 15, 20]" :page-size="Size"
-                layout="total, sizes, prev, next, jumper" :total="CurrentItemCount">
+              <el-pagination @size-change="HandleSizeChange"
+                             @current-change="HandleCurrentChange"
+                             :current-page="CurrentPage"
+                             :page-sizes="[10, 15, 20]"
+                             :page-size="Size"
+                             layout="total, sizes, prev, next, jumper"
+                             :total="CurrentItemCount">
               </el-pagination>
             </el-card>
           </el-col>
@@ -154,27 +258,70 @@
         <el-col :span="24">&nbsp;</el-col>
       </el-row>
 
-      <el-form :model="samplesForm" label-width="100px" ref="samplesdetail">
-        <el-row :gutter="20" class="samplesdetailcss">
+      <el-form :model="samplesForm"
+               label-width="100px"
+               ref="samplesdetail">
+        <el-row :gutter="20"
+                class="samplesdetailcss">
           <el-col :span="24">
-            <el-card class="box-card equipmentdetail adddetailcard" v-if="!save_flag">
+            <el-card class="box-card equipmentdetail adddetailcard"
+                     v-if="!save_flag">
               <div slot="header">
                 <legend style="color:#436EEE"></legend>
                 <i class="icon icon-paragraph-justify">样本信息</i>
                 <span style="float: right;">
-                  <el-button type="primary" class="el-button--mini" @click="AddDetail" :disabled="!add_flag">样本出库
+                  <el-dropdown split-button
+                               type="primary"
+                               size="mini"
+                               @click="seachdata"
+                               class="el-button--mini"
+                               @command="handleSearchCommand">
+                    出库查询
+                    <el-dropdown-menu slot="dropdown">
+                      <el-dropdown-item command="search">高级查询</el-dropdown-item>
+                      <el-dropdown-item command="clear">查询重置</el-dropdown-item>
+                      <!-- <el-dropdown-item style="color:black;"
+                                      v-for="item in searchTemplates"
+                                      :key="item.Name"
+                                      :command="item.Name">{{item.Name}}</el-dropdown-item> -->
+                    </el-dropdown-menu>
+                  </el-dropdown>
+                  <el-button type="primary"
+                             class="el-button--mini"
+                             @click="AddDetail"
+                             :disabled="!add_flag">样本出库
                   </el-button>
                 </span>
               </div>
-              <el-table :data="SamplesList" border style="width: 100%" @selection-change="handleSelectionChange">
-                <el-table-column type="selection" width="35px"></el-table-column>
-                <el-table-column prop="BarCode" label="样本条码" min-width="120" align="center" show-overflow-tooltip>
+              <el-table :data="SamplesList"
+                        border
+                        style="width: 100%"
+                        @selection-change="handleSelectionChange">
+                <el-table-column type="selection"
+                                 width="35px"></el-table-column>
+                <el-table-column prop="BarCode"
+                                 label="样本条码"
+                                 min-width="120"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column prop="SampleCode" label="样本编码" min-width="120" align="center" show-overflow-tooltip>
+                <el-table-column prop="SampleCode"
+                                 label="样本编码"
+                                 min-width="120"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column prop="SampleTypeName" min-width="80" label="样本类型" align="center" show-overflow-tooltip>
+                <el-table-column prop="SampleTypeName"
+                                 min-width="80"
+                                 label="样本类型"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
-                <el-table-column label="可用容量" min-width="80" show-overflow-tooltip align="center" header-align="center">
+                <el-table-column label="可用容量"
+                                 min-width="80"
+                                 show-overflow-tooltip
+                                 align="center"
+                                 header-align="center">
                   <template slot-scope="scope">
                     {{ scope.row.Capacity }} {{ scope.row.Unit }}
                   </template>
@@ -186,19 +333,30 @@
                     </router-link>
                   </template>
                 </el-table-column> -->
-                <el-table-column label="存储位置" min-width="120" show-overflow-tooltip align="center"
-                  header-align="center">
+                <el-table-column label="存储位置"
+                                 min-width="120"
+                                 show-overflow-tooltip
+                                 align="center"
+                                 header-align="center">
                   <template slot-scope="scope">
                     {{ scope.row.ECode + "-" + numtoupchar(scope.row.ShelfY) + scope.row.ShelfX + "-" +
                     numtoupchar(scope.row.BoxY) + scope.row.BoxX + "-" + postiontoupchar(scope.row.Position) }}
                   </template>
                 </el-table-column>
-                <el-table-column prop="CHUserBy" min-width="80" label="提交人" align="center" show-overflow-tooltip>
+                <el-table-column prop="CHUserBy"
+                                 min-width="80"
+                                 label="提交人"
+                                 align="center"
+                                 show-overflow-tooltip>
                 </el-table-column>
               </el-table>
-              <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
-                :current-page="currentPage" :page-sizes="[10, 15, 20]" :page-size="size"
-                layout="total, sizes, prev, next, jumper" :total="currentItemCount">
+              <el-pagination @size-change="handleSizeChange"
+                             @current-change="handleCurrentChange"
+                             :current-page="currentPage"
+                             :page-sizes="[10, 15, 20]"
+                             :page-size="size"
+                             layout="total, sizes, prev, next, jumper"
+                             :total="currentItemCount">
               </el-pagination>
             </el-card>
           </el-col>
@@ -206,499 +364,586 @@
       </el-form>
     </el-card>
 
-    <el-dialog title="审核信息" :visible.sync="auditorShow" top="5vh">
-      <el-form :model="shenheForm" label-width="130px" ref="shenheForm">
+    <el-dialog title="审核信息"
+               :visible.sync="auditorShow"
+               top="5vh">
+      <el-form :model="shenheForm"
+               label-width="130px"
+               ref="shenheForm">
         <el-form-item label="审核状态">
           <template>
-            <el-radio class="radio" v-model="shenheForm.SuccessStatus" :label="0">审核通过</el-radio>
-            <el-radio class="radio" v-model="shenheForm.SuccessStatus" :label="1">审核异常</el-radio>
+            <el-radio class="radio"
+                      v-model="shenheForm.SuccessStatus"
+                      :label="0">审核通过</el-radio>
+            <el-radio class="radio"
+                      v-model="shenheForm.SuccessStatus"
+                      :label="1">审核异常</el-radio>
           </template>
         </el-form-item>
         <el-form-item label="审核说明">
-          <el-input type="textarea" v-model="shenheForm.AuditorRemark" placeholder="请输入审核说明"></el-input>
+          <el-input type="textarea"
+                    v-model="shenheForm.AuditorRemark"
+                    placeholder="请输入审核说明"></el-input>
         </el-form-item>
       </el-form>
-      <div slot="footer" class="dialog-footer" style="margin-top: -25px">
-        <el-button size="small" @click="auditorShow = false">取 消</el-button>
-        <el-button type="primary" size="small" @click="auditor()">确 定</el-button>
+      <div slot="footer"
+           class="dialog-footer"
+           style="margin-top: -25px">
+        <el-button size="small"
+                   @click="auditorShow = false">取 消</el-button>
+        <el-button type="primary"
+                   size="small"
+                   @click="auditor()">确 定</el-button>
       </div>
     </el-dialog>
 
     <!-- 登陆验证 -->
-    <el-dialog title="登录验证" width="80%" :visible.sync="loginDialogVisible" top="5vh" center @close="cancelLogin">
-      <el-form class="login-form" auto-complete="off" ref="user" label-position="top">
+    <el-dialog title="登录验证"
+               width="80%"
+               :visible.sync="loginDialogVisible"
+               top="5vh"
+               center
+               @close="cancelLogin">
+      <el-form class="login-form"
+               auto-complete="off"
+               ref="user"
+               label-position="top">
         <el-row>
           <el-col :span="24">
-            <el-form-item label="用户" prop="username">
-              <el-input type="text" v-model="GetterName" disabled placeholder="请输入用户名" />
+            <el-form-item label="用户"
+                          prop="username">
+              <el-input type="text"
+                        v-model="GetterName"
+                        disabled
+                        placeholder="请输入用户名" />
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="24">
-            <el-form-item label="密码" prop="password">
-              <el-input type="password" v-model="password" placeholder="请输入密码" @keyup.enter.native="confirmLogin" />
+            <el-form-item label="密码"
+                          prop="password">
+              <el-input type="password"
+                        v-model="password"
+                        placeholder="请输入密码"
+                        @keyup.enter.native="confirmLogin" />
             </el-form-item>
           </el-col>
         </el-row>
       </el-form>
       <div style="text-align:center;">
-        <el-button size="small" @click="cancelLogin">取 消</el-button>
-        <el-button size="small" type="primary" @click="confirmLogin">登录</el-button>
+        <el-button size="small"
+                   @click="cancelLogin">取 消</el-button>
+        <el-button size="small"
+                   type="primary"
+                   @click="confirmLogin">登录</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-  import {
-    mapGetters
-  } from 'vuex'
-  import store from 'store'
-  export default {
-    name: 'materialdetect',
-    components: {},
-    components: {},
-    data() {
-      return {
-        pagetitle: '', //面包屑标题
-        service_flag: '', //页面新增或编辑标志位
-        CurrentItemCount: 0, // 当前页显示数量
-        CurrentPage: 1, // 当前页
-        Size: 10,
-        currentItemCount: 0, // 当前页显示数量
-        currentPage: 1, // 当前页
-        size: 10,
-        SamplesList: [], //选择样本列表
-        selectSamples: [],
-        SampleCKform: {
-          ApplyType: 2,
-          EntryNo: '',
-          OperationBy: '',
-          Section: '',
-          ConUserId: '', //负责人ID
-          ConUserBy: '', //负责人
-          EntryTime: new Date(),
-          ConTime: new Date(),
-          ApplyStatus: 0,
-          Remark: '',
-          SuccessStatus: 0,
-          AuditorRemark: ''
-        },
-        auditor_flag: false,
-        save_flag: false,
-        add_flag: false,
-        detail_flag: false,
-        Id: 0,
-        userlist: [],
-        Equipment: '',
-        samplesForm: {},
-        ApplyList: [],
-        applyForm: {},
-        auditorShow: false,
-        ParentId: 0,
-        authorSamples: [], //要审核的样本列表
-        shenheForm: {
-          SuccessStatus: 0,
-          AuditorRemark: ''
-        },
-        loginDialogVisible: false,
-        username: '',
-        password: '',
-        isLoginSucceed: false,
-        acceptUsers: [],
-        Getter: '', //接收人
-        GetterName: '', //接收人
-        CreateOn: [],
-        ServiceId: 0,
-        permissionscode: {
-          ckadd: 'biobank.sampleCK.add',
-          ckedit: 'biobank.sampleCK.edit',
-          ckdelete: 'biobank.sampleCK.delete',
-          ckapprove: 'biobank.sampleCK.approve',
-        },
-        permissions: {
-          'biobank.sampleCK.add': false,
-          'biobank.sampleCK.edit': false,
-          'biobank.sampleCK.delete': false,
-          'biobank.sampleCK.approve': false,
-        },
+import {
+  mapGetters
+} from 'vuex'
+import store from 'store'
+import axios from 'axios'
+export default {
+  name: 'materialdetect',
+  components: {},
+  components: {},
+  data () {
+    return {
+      pagetitle: '', // 面包屑标题
+      service_flag: '', // 页面新增或编辑标志位
+      CurrentItemCount: 0, // 当前页显示数量
+      CurrentPage: 1, // 当前页
+      Size: 10,
+      currentItemCount: 0, // 当前页显示数量
+      currentPage: 1, // 当前页
+      size: 10,
+      SamplesList: [], // 选择样本列表
+      selectSamples: [],
+      SampleCKform: {
+        ApplyType: 2,
+        EntryNo: '',
+        OperationBy: '',
+        Section: '',
+        ConUserId: '', // 负责人ID
+        ConUserBy: '', // 负责人
+        EntryTime: new Date(),
+        ConTime: new Date(),
+        ApplyStatus: 0,
+        Remark: '',
+        SuccessStatus: 0,
+        AuditorRemark: ''
+      },
+      auditor_flag: false,
+      save_flag: false,
+      add_flag: false,
+      detail_flag: false,
+      Id: 0,
+      userlist: [],
+      Equipment: '',
+      samplesForm: {},
+      ApplyList: [],
+      applyForm: {},
+      auditorShow: false,
+      ParentId: 0,
+      authorSamples: [], // 要审核的样本列表
+      shenheForm: {
+        SuccessStatus: 0,
+        AuditorRemark: ''
+      },
+      loginDialogVisible: false,
+      username: '',
+      password: '',
+      isLoginSucceed: false,
+      acceptUsers: [],
+      Getter: '', // 接收人
+      GetterName: '', // 接收人
+      CreateOn: [],
+      ServiceId: 0,
+      permissionscode: {
+        ckadd: 'biobank.sampleCK.add',
+        ckedit: 'biobank.sampleCK.edit',
+        ckdelete: 'biobank.sampleCK.delete',
+        ckapprove: 'biobank.sampleCK.approve'
+      },
+      permissions: {
+        'biobank.sampleCK.add': false,
+        'biobank.sampleCK.edit': false,
+        'biobank.sampleCK.delete': false,
+        'biobank.sampleCK.approve': false
       }
+    }
+  },
+  created () {
+    this.filehost = process.env.imgserverhost
+    let _this = this
+    _this.ServiceId = _this.$route.params.opera // 主单id
+    console.log(_this.ServiceId)
+    if (_this.ServiceId && _this.ServiceId === 'addCK') {
+      _this.pagetitle = '新增样本出库'
+      _this.service_flag = 'addCK'
+      _this.getEntryNo()
+    } else if (_this.ServiceId != '0') {
+      _this.pagetitle = '编辑样本出库'
+      _this.service_flag = 'editCK'
+      _this.save_flag = true
+      _this.getApplyInfo()
+      _this.getdetaillist()
+    }
+    // _this.getEntryNo()
+    _this.getuserlist()
+    _this.getsamplelist() // 获取样本列表
+    _this.getuserlist()
+  },
+  computed: {
+    ...mapGetters({
+      authUser: 'authUser'
+    })
+  },
+  methods: {
+    saveApply () {
+      let _this = this
+      _this.$axios.post('/samplesapply/saveapply/', _this.SampleCKform)
+        .then(res => {
+          // response
+          if (res.data.code === 0) {
+            _this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+            _this.add_flag = true
+            _this.ServiceId = res.data.item
+            _this.getApplyInfo()
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
     },
-    created() {
+    // 导出样本
+    handleExportsamplesCommand (command) {
       let _this = this
-      _this.ServiceId = _this.$route.params.opera //主单id
-      if (_this.ServiceId && _this.ServiceId == 'addCK') {
-        _this.pagetitle = '新增样本出库'
-        _this.service_flag = 'addCK'
-        _this.getEntryNo()
-      } else if (_this.ServiceId != '0') {
-        _this.pagetitle = '编辑样本出库'
-        _this.service_flag = 'editCK'
-        _this.save_flag = true
-        _this.getApplyInfo()
-        _this.getdetaillist()
+      if (_this.selectSamples.length < 1) {
+        _this.$message({
+          type: 'warning',
+          message: '请选择要导出的样本'
+        })
+        return
       }
-      _this.getEntryNo()
-      _this.getuserlist()
-      _this.getsamplelist() //获取样本列表
-      _this.getuserlist()
+      _this.exportsamples()
     },
-    computed: {
-      ...mapGetters({
-        authUser: 'authUser'
+    exportsamples () {
+      let _this = this
+      let id = ''
+
+      let params = {
+        Entryno: this.SampleCKform.EntryNo
+      }
+
+      for (var i = 0; i < _this.selectSamples.length; i++) {
+        if (i === _this.selectSamples.length - 1) {
+          id += _this.selectSamples[i].Id
+        } else {
+          id += _this.selectSamples[i].Id + ','
+        }
+      }
+      let paramsid = {
+        Id: id
+      }
+      params = Object.assign(params, paramsid)
+
+      _this.$axios.get('/sampleinput/exportexcelapply', {
+        params
       })
+        .then(res => {
+          console.log(res, 'exportexcelapply')
+          window.location = 'http://' + res.data
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
     },
-    methods: {
-      saveApply() {
-        let _this = this
-        _this.$axios.post('/samplesapply/saveapply/', _this.SampleCKform)
-          .then(res => {
-            // response
-            if (res.data.code === 0) {
-              _this.$message({
-                type: 'success',
-                message: res.data.message,
-              })
-              _this.add_flag = true
-              _this.ServiceId = res.data.item
-              _this.getApplyInfo()
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
-              })
-            }
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
+    getApplyInfo () {
+      let _this = this // request
+      let params = {
+        Id: this.ServiceId
+      }
+      _this.$axios.get('/samplesapply/getapplyinfo', {
+        params
+      })
+        .then(res => {
+          _this.SampleCKform = res.data.items
+          if (_this.SampleCKform.ApplyStatus == 0) {
+            _this.SampleCKform.ConUserId = ''
+            _this.SampleCKform.ConTime = new Date()
+          } else {
+            _this.SampleCKform.ConTime = new Date(res.data.items.ConTime)
+          }
+          if (_this.SampleCKform.ApplyStatus == 2 || _this.SampleCKform.ApplyStatus == 5) {
+            _this.auditor_flag = true
+          }
+          // if (_this.samplesForm.CreateUserId && _this.samplesForm.CreateUserId != 0) {
+          //   for (var i = 0; i < _this.acceptUsers.length; i++) {
+          //     if (_this.acceptUsers[i].id == _this.samplesForm.CreateUserId) {
+          //       _this.AuthorUser = _this.samplesForm.CreateUserId
+          //     }
+          //   }
+          // }
+        }).catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    // 获取样本信息
+    getdetaillist () {
+      let _this = this // request
+      let params = {
+        ParentId: this.ServiceId,
+        _currentPage: this.CurrentPage,
+        _size: this.Size
+      }
+      _this.$axios.get('/samplesapply/applydetaillist', {
+        params
+      })
+        .then(res => {
+          console.log(res, '/samplesapply/applydetaillist')
+          _this.ApplyList = res.data.items
+          _this.CurrentItemCount = res.data.currentItemCount
+        })
+        .catch(function (error) {
+          console.log(error)
+        })
+    },
+    // 自动生成单品交付单编号
+    getEntryNo () {
+      let _this = this
+      if (_this.SampleCKform.EntryNo == '') {
+        _this.$axios.get('orderadd/getOrderNumgene')
+          .then(function (response) {
+            _this.SampleCKform.EntryNo = response.data.items + ''
           })
+      }
+    },
+    // 获取样本信息
+    getsamplelist () {
+      let _this = this // request
+      let params = {
+        _currentPage: this.currentPage,
+        _size: this.size
+      }
+      _this.$axios.get('/samplesapply/cklist', {
+        params
+      })
+        .then(res => {
+          _this.SamplesList = res.data.items
+          _this.currentItemCount = res.data.currentItemCount
+        })
+        .catch(function (error) {
+          console.log(error)
+        })
+    },
+    // 添加申请出库样本
+    AddDetail () {
+      let _this = this
+      if (_this.selectSamples.length < 1) {
+        _this.$message({
+          type: 'warning',
+          message: '请先选择要出库的样本'
+        })
+        return
+      }
+      _this.detail_flag = true
+      let params = _this.SampleCKform
+      params = Object.assign(params, {
+        Detaillist: _this.selectSamples
+      })
+      _this.$axios.post('/samplesapply/savedetail', params)
+        .then(res => {
+          // response
+          if (res.data.code === 0) {
+            _this.$message({
+              type: 'success',
+              message: res.data.message
+            })
+            _this.save_flag = true
+            _this.getdetaillist()
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    // 样本出库信息查询
+    searchSampleDetail () {
 
-      },
-      getApplyInfo() {
-        let _this = this // request
-        let params = {
-          Id: this.ServiceId
-        }
-        _this.$axios.get('/samplesapply/getapplyinfo', {
-            params
-          })
-          .then(res => {
-            _this.SampleCKform = res.data.items
-            if (_this.SampleCKform.ApplyStatus == 0) {
-              _this.SampleCKform.ConUserId = ''
-              _this.SampleCKform.ConTime = new Date()
-            } else {
-              _this.SampleCKform.ConTime = new Date(res.data.items.ConTime)
-            }
-            if (_this.SampleCKform.ApplyStatus == 2 || _this.SampleCKform.ApplyStatus == 5) {
-              _this.auditor_flag = true
-            }
-            // if (_this.samplesForm.CreateUserId && _this.samplesForm.CreateUserId != 0) {
-            //   for (var i = 0; i < _this.acceptUsers.length; i++) {
-            //     if (_this.acceptUsers[i].id == _this.samplesForm.CreateUserId) {
-            //       _this.AuthorUser = _this.samplesForm.CreateUserId
-            //     }
-            //   }
-            // }
-          }).catch(err => {
-            // handle error
-            console.error(err)
-          })
-      },
-      //获取样本信息
-      getdetaillist() {
-        let _this = this // request
-        let params = {
-          ParentId: this.ServiceId,
-          _currentPage: this.CurrentPage,
-          _size: this.Size,
-        }
-        _this.$axios.get("/samplesapply/applydetaillist", {
-            params
-          })
-          .then(res => {
-            _this.ApplyList = res.data.items
-            _this.CurrentItemCount = res.data.currentItemCount
-          })
-          .catch(function (error) {
-            console.log(error);
-          });
-      },
-      //自动生成单品交付单编号
-      getEntryNo() {
-        let _this = this
-        if (_this.SampleCKform.EntryNo == '') {
-          _this.$axios.get('orderadd/getOrderNumgene')
-            .then(function (response) {
-              _this.SampleCKform.EntryNo = response.data.items + ''
+    },
+    // 打开审核弹窗
+    auditorshow () {
+      let _this = this
+      if (_this.authorSamples.length < 1) {
+        _this.$message({
+          type: 'warning',
+          message: '请先选择要审核入库的样本'
+        })
+        return
+      }
+      _this.SampleCKform.ConUserBy = _this.$refs.reflrrselect.selectedLabel
+      if (_this.authorSamples.length == _this.CurrentItemCount) {
+        _this.SampleCKform.ApplyStatus = 2
+      } else {
+        _this.SampleCKform.ApplyStatus = 1
+      }
+      _this.auditorShow = true
+    },
+    auditor () {
+      let _this = this
+      _this.$confirm('确定审核该出库申请单?审核后所有信息将不可修改!', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          if (_this.shenheForm.SuccessStatus == 1) {
+            _this.SampleCKform.ApplyStatus = 3
+          }
+          _this.SampleCKform.AuditorRemark = _this.shenheForm.AuditorRemark
+          _this.auditorShow = false
+          _this.saveauditor('SampleCKform')
+        })
+        .catch(() => { })
+    },
+    saveauditor (SampleCKform) {
+      let _this = this
+      let params = _this.SampleCKform
+      params = Object.assign(params, {
+        Detaillist: _this.authorSamples
+      })
+      _this.$axios.put('/samplesapply/auditorckdetail/' + _this.ServiceId, params)
+        .then(res => {
+          // response
+          if (res.data.code === 0) {
+            _this.$message({
+              type: 'success',
+              message: res.data.message
             })
-        }
-      },
-      //获取样本信息
-      getsamplelist() {
-        let _this = this // request
-        let params = {
-          _currentPage: this.currentPage,
-          _size: this.size,
-        }
-        _this.$axios.get("/samplesapply/cklist", {
-            params
-          })
-          .then(res => {
-            _this.SamplesList = res.data.items
-            _this.currentItemCount = res.data.currentItemCount
-          })
-          .catch(function (error) {
-            console.log(error);
-          });
-      },
-      // 添加申请出库样本
-      AddDetail() {
-        let _this = this
-        if (_this.selectSamples.length < 1) {
-          _this.$message({
-            type: 'warning',
-            message: '请先选择要出库的样本'
-          })
-          return
-        }
-        _this.detail_flag = true
-        let params = _this.SampleCKform
-        params = Object.assign(params, {
-          Detaillist: _this.selectSamples
+            _this.getApplyInfo()
+            _this.getdetaillist()
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
         })
-        _this.$axios.post('/samplesapply/savedetail', params)
-          .then(res => {
-            // response
-            if (res.data.code === 0) {
-              _this.$message({
-                type: 'success',
-                message: res.data.message
-              })
-              _this.save_flag = true
-              _this.getdetaillist()
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
-              })
-            }
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
-          })
-      },
-      // 打开审核弹窗
-      auditorshow() {
-        let _this = this
-        if (_this.authorSamples.length < 1) {
-          _this.$message({
-            type: 'warning',
-            message: '请先选择要审核入库的样本'
-          })
-          return
-        }
-        _this.SampleCKform.ConUserBy = _this.$refs.reflrrselect.selectedLabel
-        if (_this.authorSamples.length == _this.CurrentItemCount) {
-          _this.SampleCKform.ApplyStatus = 2
-        } else {
-          _this.SampleCKform.ApplyStatus = 1
-        }
-        _this.auditorShow = true
-      },
-      auditor() {
-        let _this = this
-        _this.$confirm("确定审核该出库申请单?审核后所有信息将不可修改!", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
-          .then(() => {
-            if (_this.shenheForm.SuccessStatus == 1) {
-              _this.SampleCKform.ApplyStatus = 3
-            }
-            _this.SampleCKform.AuditorRemark = _this.shenheForm.AuditorRemark
-            _this.auditorShow = false
-            _this.saveauditor('SampleCKform')
-          })
-          .catch(() => {})
-      },
-      saveauditor(SampleCKform) {
-        let _this = this
-        let params = _this.SampleCKform
-        params = Object.assign(params, {
-          Detaillist: _this.authorSamples
+        .catch(err => {
+          // handle error
+          console.error(err)
         })
-        _this.$axios.put('/samplesapply/auditorckdetail/' + _this.ServiceId, params)
-          .then(res => {
-            // response
-            if (res.data.code === 0) {
-              _this.$message({
-                type: 'success',
-                message: res.data.message
-              })
-              _this.getApplyInfo()
-              _this.getdetaillist()
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
-              })
-            }
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
+    },
+    authorSelectionChange (val) {
+      this.authorSamples = val
+    },
+    getuserlist () {
+      this.$axios.get('users/list', {})
+        .then(res => {
+          // response
+          this.userlist = res.data.items
+          this.userlist.unshift({
+            'Id': this.authUser.Profile.Id,
+            'Realname': this.authUser.Profile.Realname
           })
-      },
-      authorSelectionChange(val) {
-        this.authorSamples = val
-      },
-      getuserlist() {
-        this.$axios.get('users/list', {})
-          .then(res => {
-            // response
-            this.userlist = res.data.items
-            this.userlist.unshift({
-              'Id': this.authUser.Profile.Id,
-              'Realname': this.authUser.Profile.Realname
+          if (this.service_flag == 'editCK') {
+            this.getApplyInfo()
+            this.getdetaillist()
+          }
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    numtoupchar (num) {
+      return String.fromCharCode(64 + parseInt(num))
+    },
+    postiontoupchar (postion) {
+      let pos = postion.split(';')
+      if (pos.length === 2) {
+        return this.numtoupchar(pos[1]) + pos[0]
+      } else {
+        return postion
+      }
+    },
+    // 获取权限
+    getPermissions () {
+      let _this = this
+      // request
+      let params = {
+        percodes: `'${this.permissionscode.ckadd}','${this.permissionscode.ckedit}','${this.permissionscode.ckdelete}','${this.permissionscode.ckapprove}'`
+      }
+      this.$axios.get('/permissions/isauths', {
+        params
+      })
+        .then(res => {
+          if (res.data instanceof Array && res.data.length > 0) {
+            console.log(res.data)
+            res.data.forEach(element => {
+              _this.permissions[element.Code] = element.Isperm
             })
-            if (this.service_flag == 'editCK') {
-              this.getApplyInfo()
-              this.getdetaillist()
-            }
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
-          })
-      },
-      numtoupchar(num) {
-        return String.fromCharCode(64 + parseInt(num));
-      },
-      postiontoupchar(postion) {
-        let pos = postion.split(";");
-        if (pos.length === 2) {
-          return this.numtoupchar(pos[1]) + pos[0];
-        } else {
-          return postion;
-        }
-      },
-      //获取权限
-      getPermissions() {
-        let _this = this
-        // request
-        let params = {
-          percodes: `'${this.permissionscode.ckadd}','${this.permissionscode.ckedit}','${this.permissionscode.ckdelete}','${this.permissionscode.ckapprove}'`
-        }
-        this.$axios.get('/permissions/isauths', {
-            params
-          })
-          .then(res => {
-            if (res.data instanceof Array && res.data.length > 0) {
-              console.log(res.data)
-              res.data.forEach(element => {
-                _this.permissions[element.Code] = element.Isperm
-              });
-            }
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
-          })
-      },
-      handleSelectionChange(val) {
-        this.selectSamples = val
-      },
-      contains(strs, str) {
-        let arrs = strs.split(',')
-        for (let v in arrs) {
-          if (arrs[v] === (str + '')) return true
-        }
-        return false
-      },
-      //登陆
-      selectGetter() {
-        if (this.Getter != this.authUser.Profile.Id) {
-          this.loginDialogVisible = true
-        }
-        for (var i = 0; i < this.acceptUsers.length; i++) {
-          if (this.acceptUsers[i].id === this.Getter) {
-            this.GetterName = this.acceptUsers[i].name
           }
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    handleSelectionChange (val) {
+      this.selectSamples = val
+    },
+    contains (strs, str) {
+      let arrs = strs.split(',')
+      for (let v in arrs) {
+        if (arrs[v] === (str + '')) return true
+      }
+      return false
+    },
+    // 登陆
+    selectGetter () {
+      if (this.Getter != this.authUser.Profile.Id) {
+        this.loginDialogVisible = true
+      }
+      for (var i = 0; i < this.acceptUsers.length; i++) {
+        if (this.acceptUsers[i].id === this.Getter) {
+          this.GetterName = this.acceptUsers[i].name
         }
-      },
-      cancelLogin() {
-        if (this.isLoginSucceed) {
-          this.isLoginSucceed = false
-        } else {
-          this.Getter = ''
-        }
-        this.loginDialogVisible = false
-      },
-      confirmLogin() {
-        let _this = this
-        let fields = {
-          username: this.username,
-          password: this.password,
-        }
-        this.$axios.post("/users/checkUserPwd?RealName=" + this.GetterName, fields)
-          .then(res => {
-            if (res.data.code == 0) {
-              _this.loginDialogVisible = false
-              this.isLoginSucceed = true
-            } else {
-              _this.$message({
-                type: 'warning',
-                message: res.data.message
-              })
-            }
-            _this.password = ''
-          })
-          .catch(err => {
-            // handle error
-            console.error(err)
-          })
-      },
-      HandleCurrentChange(value) {
-        this.CurrentPage = value
-        this.getdetaillist()
-      },
-      HandleSizeChange(value) {
-        this.Size = value
-        this.CurrentPage = 1
-        this.getdetaillist()
-      },
-      handleCurrentChange(value) {
-        this.currentPage = value
-        this.getsamplelist()
-      },
-      handleSizeChange(value) {
-        this.size = value
-        this.currentPage = 1
-        this.getsamplelist()
-      },
+      }
+    },
+    cancelLogin () {
+      if (this.isLoginSucceed) {
+        this.isLoginSucceed = false
+      } else {
+        this.Getter = ''
+      }
+      this.loginDialogVisible = false
+    },
+    confirmLogin () {
+      let _this = this
+      let fields = {
+        username: this.username,
+        password: this.password
+      }
+      this.$axios.post('/users/checkUserPwd?RealName=' + this.GetterName, fields)
+        .then(res => {
+          if (res.data.code == 0) {
+            _this.loginDialogVisible = false
+            this.isLoginSucceed = true
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: res.data.message
+            })
+          }
+          _this.password = ''
+        })
+        .catch(err => {
+          // handle error
+          console.error(err)
+        })
+    },
+    HandleCurrentChange (value) {
+      this.CurrentPage = value
+      this.getdetaillist()
+    },
+    HandleSizeChange (value) {
+      this.Size = value
+      this.CurrentPage = 1
+      this.getdetaillist()
+    },
+    handleCurrentChange (value) {
+      this.currentPage = value
+      this.getsamplelist()
+    },
+    handleSizeChange (value) {
+      this.size = value
+      this.currentPage = 1
+      this.getsamplelist()
     }
   }
-
+}
 </script>
 
 <style lang="scss">
-  .equipmentdetail .el-card__header {
-    padding: 5px 10px;
-    font-size: 10px;
-  }
+.equipmentdetail .el-card__header {
+  padding: 5px 10px;
+  font-size: 10px;
+}
 
-  .adddetailcard .el-button--mini {
-    padding: 2px
-  }
+.adddetailcard .el-button--mini {
+  padding: 2px;
+}
 
-  .el-pagination {
-    margin: 1rem 0 2rem;
-    text-align: right;
-  }
+.el-pagination {
+  margin: 1rem 0 2rem;
+  text-align: right;
+}
 
+.adddetailcard .el-dropdown--mini {
+  padding: 2px;
+}
 </style>

+ 73 - 74
src/dashoo.cn/frontend_web/src/pages/biobank/sampleCK/index.vue

@@ -152,31 +152,31 @@
     computed: {
       ...mapGetters({
         authUser: 'authUser'
-      }),
+      })
     },
-    data() {
+    data () {
       return {
         dialogVisible: false,
         size: 10,
         currentItemCount: 0,
         currentPage: 1,
         downloading: '',
-        //查询
+        // 查询
         searchForm: {
           ApplyType: 2,
-          entryno: '', //出库单号
+          entryno: '', // 出库单号
           operationby: '',
           section: '',
-          ApplyStatus: '', //是否审核  0 未审核  1已审核
-          //EntryTime: new Date(), //出库时间
-          ConUserBy: '', //负责人
+          ApplyStatus: '', // 是否审核  0 未审核  1已审核
+          // EntryTime: new Date(), //出库时间
+          ConUserBy: '', // 负责人
           ConUserId: ''
         },
         EntryTime: [new Date(new Date().getTime() - 30 * 24 * 60 * 60 * 1000), new Date()], // 签订日期
         userlist: [],
         clearable: false,
-        CKList: [], //入库列表
-        //列表排序
+        CKList: [], // 入库列表
+        // 列表排序
         Column: {
           Order: '',
           Prop: ''
@@ -191,26 +191,26 @@
           ckadd: 'biobank.sampleCK.add',
           ckedit: 'biobank.sampleCK.edit',
           ckdelete: 'biobank.sampleCK.delete',
-          ckapprove: 'biobank.sampleCK.approve',
+          ckapprove: 'biobank.sampleCK.approve'
         },
         permissions: {
           'biobank.sampleCK.add': false,
           'biobank.sampleCK.edit': false,
           'biobank.sampleCK.delete': false,
-          'biobank.sampleCK.approve': false,
-        },
+          'biobank.sampleCK.approve': false
+        }
       }
     },
-    created() {
+    created () {
       this.initdata()
-      this.getuserlist() //负责人下拉
+      this.getuserlist() // 负责人下拉
       this.getPermissions()
     },
     methods: {
-      //获取入库单列表
-      initdata() {
-        let _this = this;
-        let EntryTime = []
+      // 获取入库单列表
+      initdata () {
+        let _this = this
+      let EntryTime = []
         if (!_this.EntryTime) {
           _this.EntryTime = []
         }
@@ -233,25 +233,25 @@
         }
         Object.assign(params, this.searchForm)
         _this.$axios.get('/samplesapply/samplesapplylist?EntryTime=' + EntryTime.join(','), {
-            params
-          })
+          params
+        })
           .then(function (response) {
             _this.CKList = response.data.items
             _this.currentItemCount = response.data.currentItemCount
           })
           .catch(function (error) {
-            console.log(error);
-          });
-      },
-      searchCommand(command) {
+            console.log(error)
+        })
+    },
+      searchCommand (command) {
         if (command == 'search') {
           this.dialogVisible = true
         } else if (command == 'clear') {
           this.clearSearch()
         }
       },
-      //清空查询结构体
-      clearSearch() {
+      // 清空查询结构体
+      clearSearch () {
         this.searchForm.entryno = ''
         this.searchForm.operationby = ''
         this.searchForm.section = ''
@@ -261,31 +261,31 @@
         this.searchForm.ConUserId = ''
         this.initdata()
       },
-      //获取权限
-      getPermissions() {
+      // 获取权限
+      getPermissions () {
         let _this = this
         // request
         let params = {
           percodes: `'${this.permissionscode.ckadd}','${this.permissionscode.ckedit}','${this.permissionscode.ckdelete}','${this.permissionscode.ckapprove}'`
         }
         this.$axios.get('/permissions/isauths', {
-            params
-          })
+          params
+        })
           .then(res => {
             if (res.data instanceof Array && res.data.length > 0) {
               console.log(res.data)
               res.data.forEach(element => {
                 _this.permissions[element.Code] = element.Isperm
-              });
-            }
+              })
+          }
           })
           .catch(err => {
             // handle error
             console.error(err)
           })
       },
-      //获取人员列表
-      getuserlist() {
+      // 获取人员列表
+      getuserlist () {
         let _this = this
         _this.$axios.get('users/list', {})
           .then(res => {
@@ -301,11 +301,11 @@
             console.error(err)
           })
       },
-      handleSelectionChange(val) {
+      handleSelectionChange (val) {
         this.selectSamples = val
       },
       // 打开审核弹窗
-      auditorshow() {
+      auditorshow () {
         let _this = this
         if (_this.selectSamples.length < 1) {
           _this.$message({
@@ -316,20 +316,20 @@
         }
         _this.auditorShow = true
       },
-      makesure() {
+      makesure () {
         let _this = this
-        _this.$confirm("确定审核该出库申请单?审核后所有信息将不可修改!", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
+        _this.$confirm('确定审核该出库申请单?审核后所有信息将不可修改!', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
           .then(() => {
             _this.auditorShow = false
             _this.saveauditor()
           })
           .catch(() => {})
       },
-      saveauditor() {
+      saveauditor () {
         let _this = this
         let params = _this.shenheForm
         params = Object.assign(params, {
@@ -356,16 +356,16 @@
             console.error(err)
           })
       },
-      RePeal(val) {
-        let _this = this;
-        _this.$confirm("此操作撤销该申请, 是否继续?", "提示", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
+      RePeal (val) {
+        let _this = this
+      _this.$confirm('此操作撤销该申请, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
           .then(() => {
             let params = val
-            _this.$axios.put("samplesapply/repealckapply/" + val.Id, params)
+            _this.$axios.put('samplesapply/repealckapply/' + val.Id, params)
               .then(res => {
                 // response
                 if (res.data.code === 0) {
@@ -382,13 +382,13 @@
                 }
               })
               .catch(function (error) {
-                console.log(error);
-              });
-          })
-          .catch(() => {});
-      },
-      //列表排序功能
-      orderby(column) {
+                console.log(error)
+            })
+        })
+          .catch(() => {})
+    },
+      // 列表排序功能
+      orderby (column) {
         if (column.order == 'ascending') {
           this.Column.Order = 'asc'
         } else if (column.order == 'descending') {
@@ -397,20 +397,20 @@
         this.Column.Prop = column.prop
         this.initdata()
       },
-      seachdata() {
+      seachdata () {
         this.currentPage = 1
         this.initdata()
       },
-      handleSizeChange(val) {
+      handleSizeChange (val) {
         this.size = val
         this.currpage = 1
         this.initdata()
       },
-      handleCurrentChange(val) {
+      handleCurrentChange (val) {
         this.currpage = val
         this.initdata()
       },
-      jstimehandle(val) {
+      jstimehandle (val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -422,20 +422,19 @@
           return val.substring(0, 19)
         }
       },
-      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 + ' ' + h + ':' + minute;
-      }
+      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 + ' ' + h + ':' + minute
+    }
     }
   }
-
 </script>
 
 <style lang="scss">

+ 39 - 40
src/dashoo.cn/frontend_web/src/pages/biobank/source/index.vue

@@ -146,11 +146,11 @@
       })
     },
     name: 'samplessource',
-    data() {
+    data () {
       return {
         filehost: '',
         importfileparam: {}, // 导入文件参数
-        importfilepath: '', //导入文件路径
+        importfilepath: '', // 导入文件路径
         importVisible: false, // 导入对话框
         importmsg: '未选择文件', // 导入文件
         dialogVisible: false,
@@ -162,23 +162,23 @@
           // CreateBy: '', //操作人
           // CreateUserId: '',
           starttime: null,
-          endtime: null,
+          endtime: null
         },
         currentItemCount: 0,
         currentPage: 1,
         size: 10,
         donorsList: [],
-        //列表排序
+        // 列表排序
         Column: {
           Order: '',
           Prop: ''
         },
         acceptUsers: [],
         userlist: [],
-        acc: '',
+        acc: ''
       }
     },
-    created() {
+    created () {
       this.initdata()
       this.filehost = process.env.imgserverhost
       this.acc = this.authUser.Profile.AccCode
@@ -187,7 +187,7 @@
       }
     },
     methods: {
-      initdata() {
+      initdata () {
         let _this = this
         const params = {
           _currentPage: this.currentPage,
@@ -209,8 +209,8 @@
           Object.assign(params, endparams)
         }
         _this.$axios.get('/samplessource/samplessourcelist', {
-            params
-          })
+          params
+        })
           .then(res => {
             _this.donorsList = res.data.items
             _this.currentItemCount = res.data.currentItemCount
@@ -219,14 +219,14 @@
             console.error(err)
           })
       },
-      delSamplesSource(val) {
+      delSamplesSource (val) {
         let _this = this
         _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
         }).then(() => {
-          _this.$axios.delete("samplessource/deldonors/" + val.Id + '?IdCard=' + val.IdCard, null)
+          _this.$axios.delete('samplessource/deldonors/' + val.Id + '?IdCard=' + val.IdCard, null)
             .then(res => {
               if (res.data.code === 0) {
                 _this.$message({
@@ -245,11 +245,11 @@
             .catch(() => {})
         }).catch(() => {})
       },
-      exportExcel() {
+      exportExcel () {
         let _this = this
-        _this.$confirm("此操作将导出所有数据, 是否继续?", "提示", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
+        _this.$confirm('此操作将导出所有数据, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
           type: 'info'
         }).then(() => {
           _this.exportloading = true
@@ -268,8 +268,8 @@
             })
         }).catch(() => {})
       },
-      //列表排序功能
-      orderby(column) {
+      // 列表排序功能
+      orderby (column) {
         if (column.order == 'ascending') {
           this.Column.Order = 'asc'
         } else if (column.order == 'descending') {
@@ -278,8 +278,8 @@
         this.Column.Prop = column.prop
         this.initdata()
       },
-      //导入蜜蜂样本来源
-      importData() {
+      // 导入蜜蜂样本来源
+      importData () {
         let _this = this
         if (_this.importfilepath === '') {
           _this.$message({
@@ -311,7 +311,7 @@
             console.error(err)
           })
       },
-      beforeexportfileUpload(file) {
+      beforeexportfileUpload (file) {
         let i = file.name.lastIndexOf('.')
         let typename = ''
         if (i > -1) {
@@ -330,10 +330,10 @@
         this.importmsg = '上传文件:' + file.name
         return true
       },
-      handleexportfileSuccess(res, file) {
+      handleexportfileSuccess (res, file) {
         this.importfilepath = res
       },
-      getuserlist() {
+      getuserlist () {
         let _this = this
         _this.$axios.get('users/list', {})
           .then(res => {
@@ -349,18 +349,18 @@
             console.error(err)
           })
       },
-      seachdata() {
+      seachdata () {
         this.currentPage = 1
         this.initdata()
       },
-      searchCommand(command) {
+      searchCommand (command) {
         if (command == 'search') {
           this.dialogVisible = true
         } else if (command == 'clear') {
           this.clearSearch()
         }
       },
-      clearSearch() {
+      clearSearch () {
         this.searchform.idcard = ''
         this.searchform.name = ''
         this.searchform.telephone = ''
@@ -371,16 +371,16 @@
         this.searchform.endtime = null
         this.initdata()
       },
-      handleSizeChange(value) {
+      handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         this.initdata()
       },
-      handleCurrentChange(value) {
+      handleCurrentChange (value) {
         this.currentPage = value
         this.initdata()
       },
-      jstimehandle(val) {
+      jstimehandle (val) {
         if (val === '') {
           return '----'
         } else if (val === '0001-01-01T08:00:00+08:00') {
@@ -392,20 +392,19 @@
           return val.substring(0, 10)
         }
       },
-      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 + ' ' + h + ':' + minute;
-      }
+      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 + ' ' + h + ':' + minute
+    }
     }
   }
-
 </script>
 
 <style lang="scss">

+ 3 - 0
src/dashoo.cn/frontend_web/src/pages/samples/stored/_opera/detailed.vue

@@ -657,6 +657,9 @@
         // this.initData()
         this.goback()
       },
+      getstationurl (val) {
+        return `?station=${val.ShelfX};${val.ShelfY};${val.BoxX};${val.BoxY};${val.Position};${val.Id}&pname=samples-stored&size=${this.size}&currentPage=${this.currentPage}`
+      },
       uploaddialogcallback (v) {
         this.createpage()
       },

+ 2 - 1
src/dashoo.cn/frontend_web/src/pages/samples/stored/index.vue

@@ -979,7 +979,8 @@
           })
           return
         }
-        if (command == 'Apply') { // 生成出库申请单:复苏
+        console.log(command, 'command')
+        if (command === 'Apply') { // 生成出库申请单:复苏
           _this.shenhe.applyfusu_flag = false
         }
         _this.shenhe = Object.assign(_this.shenhe, {

+ 23 - 3
src/dashoo.cn/frontend_web/src/pages/samples/waitingstore/index.vue

@@ -88,11 +88,11 @@
             <template v-else-if="item.filed === 'ValidityDate' || item.filed === 'ReceiveDate'">
               {{jstimehandle(scope.row[item.filed])}}
             </template>
-            <!-- <template v-else-if="item.filed === 'Location'">
+            <template v-else-if="item.filed === 'Location'&& scope.row.EquipmentId!==0">
               <router-link :to="'/equipment/'+scope.row.EquipmentId +'/manage_new' + getstationurl(scope.row)">
-                {{scope.row.ECode}}-{{numtoupchar(scope.row.ShelfY)}}{{scope.row.ShelfX}}-{{numtoupchar(scope.row.BoxY)}}{{scope.row.BoxX}}-{{postiontoupchar(scope.row.Position)}}
+                  {{scope.row.ECode}}-{{numtoupchar(scope.row.ShelfY)}}{{scope.row.ShelfX}}-{{numtoupchar(scope.row.BoxY)}}{{scope.row.BoxX}}-{{postiontoupchar(scope.row.Position)}}
               </router-link>
-            </template> -->
+            </template>
             <template v-else>
               {{scope.row[item.filed]}}
             </template>
@@ -339,6 +339,7 @@
         CreateOn: [], // 录入时期
         GroupName: '', // 所属分组
         Name: '', // 名称
+        Location: '',
         SourceName: '', // 样本来源
         InnerCode: '', // 样本内码
         dialogFormVisible: false, // 添加弹框是否显示
@@ -410,6 +411,7 @@
     },
     created () {
       this.acc = this.authUser.Profile.AccCode
+      console.log(this.acc, 'this.authUser.Profile.AccCode')
       if (this.$route.query.size && this.$route.query.currentPage) {
         this.size = parseInt(this.$route.query.size)
         this.currentPage = parseInt(this.$route.query.currentPage)
@@ -479,6 +481,7 @@
       }
       if (this.cachecols && this.cachecols !== '') {
         this.showcolumn = this.cachecols
+        console.log(this.showcolumn, ' this.showcolumn')
       } else {
         this.showcolumn = [{
           filed: 'BarCode',
@@ -596,6 +599,7 @@
         })
           .then(res => {
             // response
+            console.log(res, '/samplesunsave/list')
             _this.list = res.data.items
             _this.currentItemCount = res.data.currentItemCount
           })
@@ -1073,6 +1077,8 @@
       // 批量复存
       batchsave () {
         let _this = this
+        console.log(_this.multipleSelection, 'multipleSelection')
+
         if (_this.multipleSelection.length < 1) {
           _this.$message({
             type: 'warning',
@@ -1331,6 +1337,20 @@
       handleChange (value) {
         console.log(value)
       },
+      getstationurl (val) {
+        return `?station=${val.ShelfX};${val.ShelfY};${val.BoxX};${val.BoxY};${val.Position};${val.Id}&pname=samples-stored&size=${this.size}&currentPage=${this.currentPage}`
+      },
+      numtoupchar (num) {
+        return String.fromCharCode(64 + parseInt(num))
+      },
+      postiontoupchar (postion) {
+        let pos = postion.split(';')
+        if (pos.length === 2) {
+          return this.numtoupchar(pos[1]) + pos[0]
+        } else {
+          return postion
+        }
+      },
       jstimehandle (val) {
         if (val === '') {
           return '----'