Parcourir la source

添加样本多字段匹配查询功能,添加编码同步,添加容器类型选择,优化前端微服务调用方式,修复添加样本时取样地区不显示的bug

jianglw il y a 4 ans
Parent
commit
b5d8a31f92
26 fichiers modifiés avec 1215 ajouts et 489 suppressions
  1. 2 2
      src/dashoo.cn/backend/api/business/equipment/equipmentService.go
  2. 114 34
      src/dashoo.cn/backend/api/business/samplesinfo/samplesinfoService.go
  3. 19 9
      src/dashoo.cn/backend/api/conf/app.conf
  4. 4 4
      src/dashoo.cn/backend/api/controllers/biobank/samplessource.go
  5. 11 5
      src/dashoo.cn/backend/api/controllers/equipment/equipment.go
  6. 6 3
      src/dashoo.cn/backend/api/controllers/samplesinfo/samplesfiles.go
  7. 37 34
      src/dashoo.cn/backend/api/controllers/samplesinfo/samplesinput.go
  8. 24 14
      src/dashoo.cn/backend/api/controllers/samplesinfo/samplespreinput.go
  9. 42 31
      src/dashoo.cn/backend/api/controllers/samplesinfo/samplesubpackage.go
  10. 6 3
      src/dashoo.cn/backend/api/controllers/samplesinfo/samplesunsave.go
  11. 38 37
      src/dashoo.cn/backend/api/tests/default_test.go
  12. 3 0
      src/dashoo.cn/frontend_animal/package.json
  13. 29 24
      src/dashoo.cn/frontend_animal/src/components/samples/samplesearchdialog.vue
  14. 23 16
      src/dashoo.cn/frontend_animal/src/components/samples/samplesourcesearchdialog.vue
  15. 263 8
      src/dashoo.cn/frontend_animal/src/pages/biobank/source/_opera/operationb.vue
  16. 161 71
      src/dashoo.cn/frontend_animal/src/pages/biobank/source/animal.vue
  17. 61 15
      src/dashoo.cn/frontend_animal/src/pages/equipment/_opera/operation.vue
  18. 28 3
      src/dashoo.cn/frontend_animal/src/pages/equipment/index.vue
  19. 67 48
      src/dashoo.cn/frontend_animal/src/pages/samples/archived/index.vue
  20. 1 1
      src/dashoo.cn/frontend_animal/src/pages/samples/prerecorded/_opera/unhumanadd.vue
  21. 62 43
      src/dashoo.cn/frontend_animal/src/pages/samples/prerecorded/index.vue
  22. 85 48
      src/dashoo.cn/frontend_animal/src/pages/samples/stored/index.vue
  23. 56 35
      src/dashoo.cn/frontend_animal/src/pages/samples/waitingstore/index.vue
  24. 17 0
      src/dashoo.cn/frontend_animal/src/utils/microEquipment.js
  25. 52 0
      src/dashoo.cn/frontend_animal/src/utils/microSampleRelated.js
  26. 4 1
      src/dashoo.cn/frontend_animal/src/utils/micro_request.js

+ 2 - 2
src/dashoo.cn/backend/api/business/equipment/equipmentService.go

@@ -170,9 +170,9 @@ func (s *EquipmentService) GetAllBrands(acccode string) (brands []string) {
 	return
 }
 
-func (s *EquipmentService) GetModelsByBrand(brand, acccode string) []EquipMentModel {
+func (s *EquipmentService) GetModelsByBrand(brand, dItem, acccode string) []EquipMentModel {
 	ModelList := make([]EquipMentModel, 0)
-	err := s.DBE.Sql(`select Id,DModel from EquipMentModel where Brands = '` + brand + `' and (AccCode='ALL' or AccCode='` + acccode + `') order by SortCode desc`).Find(&ModelList)
+	err := s.DBE.Sql(`select Id,DModel from EquipMentModel where Brands = '` + brand + `' and (AccCode='ALL' or AccCode='` + acccode + `') and DItem = ` + dItem + ` order by SortCode desc`).Find(&ModelList)
 	LogError(err)
 	//	for i := 0; i < len(ModelList); i++ {
 	//		models = append(models, ModelList[i].DModel)

+ 114 - 34
src/dashoo.cn/backend/api/business/samplesinfo/samplesinfoService.go

@@ -1,8 +1,12 @@
 package samplesinfo
 
 import (
+	"bytes"
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/frame/g"
+	"io/ioutil"
+	"net/http"
 	"os"
 	"strconv"
 	"strings"
@@ -51,9 +55,9 @@ func (s *SamplesInfoService) GetPagingEntitiesWithOrderSearch(acccode string, pa
 	tblmain := acccode + SamplesMaintbName
 	//当是蜜蜂所用户时,取acccode + AnimalInfoName  动物表数据
 	tbldonor := ""
-	if(strings.EqualFold(acccode,"sBBo4")){
+	if strings.EqualFold(acccode, "sBBo4") {
 		tbldonor = acccode + AnimalInfoName
-	}else{
+	} else {
 		tbldonor = acccode + DonorstbName
 	}
 	groupdetail := acccode + GroupDetailName
@@ -135,53 +139,130 @@ func (s *SamplesInfoService) GetPagingEntitiesWithTb(acccode string, pageIndex,
 	return total, List
 }
 
+// 样本条码规则响应请求结构体
 type BarcodeRules struct {
 	Id         int    `orm:"Id,primary" json:"id"`         //
 	SampleCode string `orm:"SampleCode" json:"sampleCode"` // 样本编码
 	Count      int    `orm:"Count"      json:"count"`      // 计数
+	Error      error  `json:"err"`
+}
+
+// 样本条码规则响应接收结构体
+type Resp struct {
+	Code int32       `json:"code,omitempty"`
+	Msg  string      `json:"msg,omitempty"`
+	Data interface{} `json:"data,omitempty"`
+}
+
+// 样本条码规则响应接收Data结构体
+type BarcodeRulesInfo struct {
+	CountStr string `json:"countStr"`
+	Id       int    `json:"id"`
+	Error    error  `json:"err"`
 }
 
 // GetBarcodeRules 获取样本条码自动生成信息
 func GetBarcodeRules(sampleCode string) (countStr string, id int, err error) {
-	barcodeRulesEntity := make([]BarcodeRules, 0)
-	// 查询样本编码对应的计数
-	sql := "select id, samplecode, count from b_bj_bee.barcode_rules where SampleCode = '" + sampleCode + "'"
-	fmt.Println(sql)
-	err = utils.DBE.Sql(sql).Find(&barcodeRulesEntity)
+	//barcodeRulesEntity := make([]BarcodeRules, 0)
+	//// 查询样本编码对应的计数
+	//sql := "select id, samplecode, count from b_bj_bee.barcode_rules where SampleCode = '" + sampleCode + "'"
+	//fmt.Println(sql)
+	//utils.SetDbEngine("mysql", "sh-cdb-jecu4azm.sql.tencentcdb.com", "b_bj_bee", "b_bj_bee_u", "DPc7769lnPCOv4Si")
+	//err = utils.DBE.SQL(sql).Find(&barcodeRulesEntity)
+	//if err != nil {
+	//	return "", 0,  err
+	//}
+	//if len(barcodeRulesEntity) == 0 {
+	//	var newBarcodeRules BarcodeRules
+	//	newBarcodeRules.Count =  1
+	//	newBarcodeRules.SampleCode = sampleCode
+	//	// 没有则更新一条
+	//	insertSql := "insert into b_bj_bee.barcode_rules (SampleCode, count) values('"+ sampleCode + "','" +
+	//		strconv.Itoa(newBarcodeRules.Count) + "')"
+	//	_, err = utils.DBE.Exec(insertSql)
+	//	if err != nil {
+	//		return "", 0, err
+	//	}
+	//	return "01", 0,  nil
+	//}
+	//count := barcodeRulesEntity[0].Count + 1
+	//return count2string(count), barcodeRulesEntity[0].Id, nil
+	//return "", nil
+	g.Log().Infof("获取样本条码自动生成信息:", sampleCode)
+	var barcodeRules BarcodeRules
+	barcodeRules.SampleCode = sampleCode
+	jsonStr, _ := json.Marshal(barcodeRules)
+	req, err := http.NewRequest("POST", beego.AppConfig.String("micro_srv::url"), bytes.NewBuffer(jsonStr))
+	req.Header.Add("X-Rpcx-Messageid", "168")
+	req.Header.Add("X-Rpcx-Messagestatustype", "Normal")
+	//req.Header.Add("X-Rpcx-Meta", "")
+	req.Header.Add("X-Rpcx-Serializetype", "1")
+	req.Header.Add("X-Rpcx-Servicemethod", "GetBarcodeRules")
+	req.Header.Add("X-Rpcx-Servicepath", "BarcodeRules")
+	req.Header.Add("X-Rpcx-Version", "0")
+	defer req.Body.Close()
+	client := &http.Client{Timeout: 5 * time.Second}
+	resp, err := client.Do(req)
 	if err != nil {
-		return "", 0,  err
+		return "", 0, err
 	}
-	if len(barcodeRulesEntity) == 0 {
-		var newBarcodeRules BarcodeRules
-		newBarcodeRules.Count =  1
-		newBarcodeRules.SampleCode = sampleCode
-		// 没有则更新一条
-		insertSql := "insert into b_bj_bee.barcode_rules (SampleCode, count) values('"+ sampleCode + "','" +
-			strconv.Itoa(newBarcodeRules.Count) + "')"
-		_, err = utils.DBE.Exec(insertSql)
-		if err != nil {
-			return "", 0, err
-		}
-		return "01", 0,  nil
+	defer resp.Body.Close()
+	var barcodeRulesInfo BarcodeRulesInfo
+	result, _ := ioutil.ReadAll(resp.Body)
+	content := string(result)
+	fmt.Println(content)
+	var respInfo Resp
+	json.Unmarshal(result, &respInfo)
+	marshal, _ := json.Marshal(respInfo.Data)
+	json.Unmarshal(marshal, &barcodeRulesInfo)
+	if barcodeRulesInfo.Error != nil {
+		return "", 0, barcodeRulesInfo.Error
 	}
-	count := barcodeRulesEntity[0].Count + 1
-	return count2string(count), barcodeRulesEntity[0].Id, nil
-	//return "", nil
+	return barcodeRulesInfo.CountStr, barcodeRulesInfo.Id, nil
 }
 
-// UpdateBarcodeRules 更新样本条码规则
-func UpdateBarcodeRules(id int) error{
+// UpdateBarcodeRules 更新样本条码计数
+func UpdateBarcodeRules(id int) error {
 	// 更新计数加一
-	updateSql := "update b_bj_bee.barcode_rules set Count = Count + 1 where Id = " +
-		strconv.Itoa(id)
-	_, err := utils.DBE.Exec(updateSql)
+	//utils.SetDbEngine("mysql", "sh-cdb-jecu4azm.sql.tencentcdb.com", "b_bj_bee", "b_bj_bee_u", "DPc7769lnPCOv4Si")
+	//updateSql := "update b_bj_bee.barcode_rules set Count = Count + 1 where Id = " +
+	//	strconv.Itoa(id)
+	//_, err := utils.DBE.Exec(updateSql)
+	//if err != nil {
+	//	return err
+	//}
+	var barcodeRules BarcodeRules
+	barcodeRules.Id = id
+	jsonStr, _ := json.Marshal(barcodeRules)
+	req, err := http.NewRequest("POST", beego.AppConfig.String("micro_srv::url"), bytes.NewBuffer(jsonStr))
+	req.Header.Add("X-Rpcx-Messageid", "168")
+	req.Header.Add("X-Rpcx-Messagestatustype", "Normal")
+	//req.Header.Add("X-Rpcx-Meta", "")
+	req.Header.Add("X-Rpcx-Serializetype", "1")
+	req.Header.Add("X-Rpcx-Servicemethod", "UpdateBarcodeRules")
+	req.Header.Add("X-Rpcx-Servicepath", "BarcodeRules")
+	req.Header.Add("X-Rpcx-Version", "0")
+	defer req.Body.Close()
+	client := &http.Client{Timeout: 5 * time.Second}
+	resp, err := client.Do(req)
 	if err != nil {
 		return err
 	}
+	var barcodeRulesInfo BarcodeRulesInfo
+	result, _ := ioutil.ReadAll(resp.Body)
+	var respInfo Resp
+	json.Unmarshal(result, &respInfo)
+	marshal, _ := json.Marshal(respInfo.Data)
+	json.Unmarshal(marshal, &barcodeRulesInfo)
+
+	if barcodeRulesInfo.Error != nil {
+		return barcodeRulesInfo.Error
+	}
+	defer resp.Body.Close()
 	return nil
 }
 
-func count2string (count int) (countStr string) {
+func count2string(count int) (countStr string) {
 	if count < 10 {
 		countStr = "0" + strconv.Itoa(count)
 	} else {
@@ -388,13 +469,12 @@ func (s *SamplesInfoService) InsertExcelSamplesInput(excelpath, acccode, createb
 	//tbldonor := acccode + DonorstbName
 	//当是蜜蜂所用户时,取acccode + AnimalInfoName  动物表数据
 	tbldonor := ""
-	if(strings.EqualFold(acccode,"sBBo4")){
+	if strings.EqualFold(acccode, "sBBo4") {
 		tbldonor = acccode + AnimalInfoName
-	}else{
+	} else {
 		tbldonor = acccode + DonorstbName
 	}
 
-
 	var datadetail SamplesDetail
 	var databuss samplesbusiness.SamplesBusiness //业务记录
 
@@ -527,7 +607,7 @@ func (s *SamplesInfoService) InsertExcelSamplesInput(excelpath, acccode, createb
 							basestation.ParentBarCode = cell.String()
 						} else if field == "InnerCode" {
 							basestation.InnerCode = cell.String()
-						}else if field == "Capacity" {
+						} else if field == "Capacity" {
 							basestation.Capacity, _ = utils.StrTo(cell.String()).Float32()
 							basestation.InitCapacity = basestation.Capacity
 						} else {
@@ -973,6 +1053,7 @@ func (s *SamplesInfoService) GetSampleOwnCount(tablename, where string) int {
 	total := num.Id
 	return total
 }
+
 //获取数量
 func (s *SamplesInfoService) GetSampleOwnCountBySourceId(acccode, where string) int {
 	tblmain := acccode + SamplesMaintbName
@@ -1600,4 +1681,3 @@ func (s *SamplesInfoService) CreateTemplateTable(tablename string) error {
 
 	return err
 }
-

+ 19 - 9
src/dashoo.cn/backend/api/conf/app.conf

@@ -11,6 +11,10 @@ apiurl=http://47.92.238.200:10015/v1
 dataapiurl=http://47.92.238.200:18010/v1
 orderurl=http://uid.labsop.cn:8182/worker/2
 
+[micro_srv]
+#   url = "http://81.68.138.114:9982/dashoo.biobank.bee-0.1";
+  url = "http://192.168.0.37:9981/dashoo.biobank.bee-0.1-jlw"
+
 #临沂
 #orderurl=http:/188.188.30.89:8182/worker/2
 
@@ -24,10 +28,11 @@ type=mysql
 #pwd=ixcell123456
 
 #阿里云 BioBank服务器
-name=biobank_db
-host=47.92.238.200
-user=biobank_user
-pwd=8ebE5iH4Vo7I
+name=b_bj_bee
+host=sh-cdb-jecu4azm.sql.tencentcdb.com
+db_port=60583
+user=b_bj_bee_u
+pwd=DPc7769lnPCOv4Si
 
 #AWS BioBank服务器
 #name=BiobankDB
@@ -54,12 +59,17 @@ excelPassword = lims123456
 [casbin]
 type=mysql
 
-#本地测试服务器
-name=casbin
-host=47.92.238.200
-user=casbin_user
-pwd=xaBoDu3ehu2i
+name=b_bj_bee
+host=sh-cdb-jecu4azm.sql.tencentcdb.com
+user=b_bj_bee_u
+pwd=DPc7769lnPCOv4Si
 domain=biobank
+#本地测试服务器
+#name=casbin
+#host=47.92.238.200
+#user=casbin_user
+#pwd=xaBoDu3ehu2i
+#domain=biobank
 
 #name=casbin
 #host=mydb01.cnbkzlqg5w7l.rds.cn-north-1.amazonaws.com.cn

+ 4 - 4
src/dashoo.cn/backend/api/controllers/biobank/samplessource.go

@@ -679,7 +679,7 @@ func (this *SamplesSourceController) AnimalList() {
 	page := this.GetPageInfoForm()
 	var list []samplessource.AnimalInfo
 	genus := this.GetString("Genus")
-	name := this.GetString("Name")
+	area := this.GetString("Area")
 	innerno := this.GetString("InnerNo")
 	SurveyDate := this.GetString("SurveyDate")
 	CreateOn := this.GetString("CreateOn")
@@ -704,8 +704,8 @@ func (this *SamplesSourceController) AnimalList() {
 	if genus != "" {
 		where = where + " and Genus = '" + genus + "'"
 	}
-	if name != "" {
-		where = where + " and Name like '%" + name + "%'"
+	if area != "" {
+		where = where + " and concat(ProvinceName,CityName,StreetName,Address) like '%" + area + "%'"
 	}
 	if innerno != "" {
 		where = where + " and InnerNo like '%" + innerno + "%'"
@@ -850,7 +850,7 @@ func (this *SamplesSourceController) EditBee() {
 	model.ModifiedBy = this.User.Username
 	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
 	svc := samplessource.GetSamplesSourceService(utils.DBE)
-	var cols []string = []string{"Genus","GenusName", "InnerNo", "Name", "Amount", "Unit", "SourceType", "Weight", "Province", "ProvinceName", "City", "CityName", "Street", "StreetName", "Address", "AreaCode", "Longitude", "Latitude", "Altitude", "SurveyDate", "ProjectId", "ProjectName", "Remark", "ModifiedBy", "ModifiedUserId"}
+	var cols []string = []string{"Genus", "GenusName", "InnerNo", "Name", "Amount", "Unit", "SourceType", "Weight", "Province", "ProvinceName", "City", "CityName", "Street", "StreetName", "Address", "AreaCode", "Longitude", "Latitude", "Altitude", "SurveyDate", "ProjectId", "ProjectName", "Remark", "ModifiedBy", "ModifiedUserId"}
 	zback := svc.QueryZBackList(this.User.AccCode)
 	for i := 0; i < (len(zback)); i++ {
 		cols = append(cols, zback[i].Id)

+ 11 - 5
src/dashoo.cn/backend/api/controllers/equipment/equipment.go

@@ -110,6 +110,10 @@ func (this *EquipmentController) List() {
 	if searchkey != "" {
 		where = where + " and (a.Code like '%" + searchkey + "%' or a.Name like  '%" + searchkey + "%') "
 	}
+	ditem := this.GetString("ditem")
+	if ditem != "" {
+		where = where + " and a.DItem = " + ditem
+	}
 	total, list := svc.GetEquipmenViewtList(page.CurrentPage, page.Size, "a.Id desc", where)
 
 	var equipmentsinfos []EquipmentInfo
@@ -214,10 +218,12 @@ func (this *EquipmentController) GetBrands() {
 // @Success 200 {object} business.device.DeviceChannels
 // @router /dmodels/:brand [get]
 func (this *EquipmentController) Dmodels() {
-	brand := this.Ctx.Input.Param(":brand")
+	//brand := this.Ctx.Input.Param(":brand")
+	brand := this.GetString("brand")
+	dItem := this.GetString("dItem")
 	svc := equipment.GetEquipmentService(utils.DBE)
 	// 获得所有的品牌
-	dmodels := svc.GetModelsByBrand(brand, this.User.AccCode)
+	dmodels := svc.GetModelsByBrand(brand, dItem, this.User.AccCode)
 
 	var datainfo DataInfo
 	datainfo.Items = dmodels
@@ -787,7 +793,7 @@ func (this *EquipmentController) AddEquipment() {
 					if j > 12 {
 						continue
 					}
-				}  else if i == 21 || i == 22 { // 21-22号14层5*5孔
+				} else if i == 21 || i == 22 { // 21-22号14层5*5孔
 					shelf_x_int = 1
 					shelf_y_int = 14
 					box_x_int = 5
@@ -800,7 +806,7 @@ func (this *EquipmentController) AddEquipment() {
 					shelf_y_int = 5
 					box_x_int = 25
 					box_y_int = 20
-					if  j > 2 {
+					if j > 2 {
 						continue
 					}
 				}
@@ -935,7 +941,7 @@ func (this *EquipmentController) AddEquipment() {
 
 // 同步添加冻存架和冻存盒 姜立伟 2021-08-16
 func addShelfAndBox(accCode, realName, userId string, num_lastdata, num_lastdata_box int64, shelfX, shelfY, boxX, boxY,
-	i, j int, equipment equipment.Equipment, svcshelf *shelfset.ShelfsetService, svc *equipment.EquipmentService)  error{
+	i, j int, equipment equipment.Equipment, svcshelf *shelfset.ShelfsetService, svc *equipment.EquipmentService) error {
 	var shelfempty shelfset.Shelf
 	shelfempty.AccCode = accCode
 	shelfempty.EquipmentId = equipment.Id

+ 6 - 3
src/dashoo.cn/backend/api/controllers/samplesinfo/samplesfiles.go

@@ -130,7 +130,10 @@ func (this *SamplesfilesController) AnimalList() {
 	}
 	barCode := this.GetString("BarCode")
 	if barCode != "" {
-		where = where + " and a.BarCode like '%" + barCode + "%' "
+		where = where + " and (a.BarCode like '%" + barCode + "%' or" +
+			" concat(c.ProvinceName,c.CityName,c.StreetName,c.Address) like '%" + barCode + "%' or " +
+			"c.ProjectName like '%" + barCode + "%' or " +
+			"b.SampleTypeName like '%" + barCode + "%')"
 	}
 	name := this.GetString("Name")
 	if name != "" {
@@ -187,9 +190,9 @@ func (this *SamplesfilesController) AnimalList() {
 	if ditem != "" {
 		where = where + " and f.DItem = '" + ditem + "'"
 	}
-	equipmentIds :=this.GetString("EquipmentIds")
+	equipmentIds := this.GetString("EquipmentIds")
 	if equipmentIds != "" {
-		where += " and f.Name in("+ equipmentIds +")"
+		where += " and f.Name in(" + equipmentIds + ")"
 	}
 	svc := samplesfileinfo.GetSamplesFileInfoService(utils.DBE)
 	var list []samplesfileinfo.AnimalSamplesFileInfoList

+ 37 - 34
src/dashoo.cn/backend/api/controllers/samplesinfo/samplesinput.go

@@ -227,7 +227,10 @@ func (this *SamplesinputController) AnimalList() {
 	}
 	barCode := this.GetString("BarCode")
 	if barCode != "" {
-		where = where + " and a.BarCode like '%" + barCode + "%' "
+		where = where + " and (a.BarCode like '%" + barCode + "%' or" +
+			" concat(c.ProvinceName,c.CityName,c.StreetName,c.Address) like '%" + barCode + "%' or " +
+			"c.ProjectName like '%" + barCode + "%' or " +
+			"b.SampleTypeName like '%" + barCode + "%')"
 	}
 	name := this.GetString("Name")
 	if name != "" {
@@ -997,10 +1000,10 @@ func (this *SamplesinputController) BatchFuSuEditPost() {
 			//修改SampleDetail=10
 			var datanew samplesinfo.SamplesDetail
 			var cols []string = []string{"FreezingNum", "IState"}
-			datanew=dataold
+			datanew = dataold
 			datanew.FreezingNum = currFreezingNum
-			datanew.IState=10
-			svc.UpdateEntityBytbl(this.User.AccCode+SamplesDetailtbName,dataold.Id,&datanew,cols)
+			datanew.IState = 10
+			svc.UpdateEntityBytbl(this.User.AccCode+SamplesDetailtbName, dataold.Id, &datanew, cols)
 			if fusu != "3" { //除去归档
 				entity.EquipmentId = datanew.EquipmentId
 				entity.ShelfId = datanew.ShelfId
@@ -1018,38 +1021,38 @@ func (this *SamplesinputController) BatchFuSuEditPost() {
 			svc.InsertEntityBytbl(this.User.AccCode+SamplesBusstbName, &entity)
 			var samplesapplyDataInfo samplesapply.SamplesApplyDetail
 			//复苏类型
-			samplesapplyDataInfo.RecoveryId=model.FusuRadio
+			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.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.EquipmentId = dataold.EquipmentId
+			samplesapplyDataInfo.ShelfId = dataold.ShelfId
+			samplesapplyDataInfo.BoxId = dataold.BoxId
+			samplesapplyDataInfo.Position = dataold.Position
 			//样本选定人
-			samplesapplyDataInfo.CHUserBy=this.User.Realname
+			samplesapplyDataInfo.CHUserBy = this.User.Realname
 			//样本选定人ID
-			chUserId,_:=strconv.Atoi(this.User.Id)
-			samplesapplyDataInfo.CHUserId=chUserId
+			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
+			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
+			samplesapplyDataInfo.DetailStatus = 0
 			//生成样本出库详情
-			svc.InsertEntityBytbl(this.User.AccCode+SamplesApplyDetailName,&samplesapplyDataInfo)
+			svc.InsertEntityBytbl(this.User.AccCode+SamplesApplyDetailName, &samplesapplyDataInfo)
 			//是否有审批权限
 			svcpermission := permission.GetPermissionService(utils.DBE)
 			if svcpermission.IsAuthorized(utils.ToStr(this.User.Id), "WaterDrop.Home.approve") {
@@ -2176,15 +2179,15 @@ func (this *SamplesinputController) ExportExcel() {
 func (this *SamplesinputController) ExportExcelSampleApply() {
 	var title []string
 	var list []samplesapply.Applydetailmodel
-	entryno:=this.GetString("Entryno")
+	entryno := this.GetString("Entryno")
 	fmt.Println(entryno)
 	svc := samplesapply.GetSamplesApplyService(utils.DBE)
-	list=svc.QueryApplySamplesDetail(this.User.AccCode,entryno)
-	var filetitle="出库详情" //文件名
+	list = svc.QueryApplySamplesDetail(this.User.AccCode, entryno)
+	var filetitle = "出库详情" //文件名
 
 	titlestring := ""
 	f := xlsx.NewFile()
-	titlestring="样本条码,样本编码,样本类型,可用容量,存储位置,审核状态,操作人,撤销人"
+	titlestring = "样本条码,样本编码,样本类型,可用容量,存储位置,审核状态,操作人,撤销人"
 	title = strings.Split(titlestring, ",")
 	this.DaySaveXlsxExport(filetitle, title, list, f)
 	SaveDirectory("static/file/excel/report/")
@@ -2218,7 +2221,7 @@ func (this *SamplesinputController) DaySaveXlsxExport(name string, title []strin
 		//	strmarital = ""
 		//}
 
-		datastring := v.SampleCode + "," + v.BarCode +","+ v.SampleTypeName +","+ utils.ToStr(v.Capacity) +"," +v.Position  + "," + strconv.Itoa(v.DetailStatus) + "," + v.CHUserBy + "," + v.CancelBy
+		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)
@@ -2590,7 +2593,7 @@ func (this *SamplesinputController) SearchList() {
 	//设备权限
 	svcPermission := permission.GetPermissionService(utils.DBE)
 	eids := svcPermission.GetEquipmentIdById(utils.ToStr(this.User.Id))
-	where := " IState =1 and DeletionStateCode=0 and (f.CreateUserId= " + utils.ToStr(this.User.Id) + " or a.EquipmentId in ("+eids+"))"
+	where := " IState =1 and DeletionStateCode=0 and (f.CreateUserId= " + utils.ToStr(this.User.Id) + " or a.EquipmentId in (" + eids + "))"
 	//设备权限
 	//svcs := equipment.GetEquipmentService(utils.DBE)
 	//poweeids := svcs.GetPowerEquipmentids(this.User.AccCode, utils.ToStr(this.User.Id))

+ 24 - 14
src/dashoo.cn/backend/api/controllers/samplesinfo/samplespreinput.go

@@ -162,7 +162,10 @@ func (this *SamplespreinputController) AnimalList() {
 	}
 	barCode := this.GetString("BarCode")
 	if barCode != "" {
-		where = where + " and a.BarCode like '%" + barCode + "%' "
+		where = where + " and (a.BarCode like '%" + barCode + "%' or" +
+			" concat(c.ProvinceName,c.CityName,c.StreetName,c.Address) like '%" + barCode + "%' or " +
+			"c.ProjectName like '%" + barCode + "%' or " +
+			"b.SampleTypeName like '%" + barCode + "%')"
 	}
 	name := this.GetString("Name")
 	if name != "" {
@@ -219,9 +222,9 @@ func (this *SamplespreinputController) AnimalList() {
 	if ditem != "" {
 		where = where + " and f.DItem = '" + ditem + "'"
 	}
-	equipmentIds :=this.GetString("EquipmentIds")
+	equipmentIds := this.GetString("EquipmentIds")
 	if equipmentIds != "" {
-		where += " and f.Name in("+ equipmentIds +")"
+		where += " and f.Name in(" + equipmentIds + ")"
 	}
 	svc := samplesinfo.GetSamplesInfoService(utils.DBE)
 	var list []samplesinfo.SamplesInfoList
@@ -598,19 +601,15 @@ func (this *SamplespreinputController) Subpackage() {
 	//has := svcSample.GetEntityByWhere(this.User.AccCode+SamplesMaintbName, wheremain, &datamainold)
 	count, id, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
 	if err != nil {
-		g.Log().Info("添加样本失败")
+		g.Log().Info("添加样本失败", err)
 		return
 	}
-	if count != "01" { //如果存在,表示添加新管,主信息不允许修改
-		if count != "01"{
-			if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
-				g.Log().Info("添加样本失败")
-				return
-			}
-		}
+	g.Log().Info("count", count)
+	if count != "0" { //如果存在,表示添加新管,主信息不允许修改
+		g.Log().Info("count", count)
 		//if datadetail.BarCode == "" {
-			//subSvc := samplesubpackage.GetSampleSubpackageService(utils.DBE)
-			//datadetail.BarCode = subSvc.AutoGetBarCodeAnimal(this.User.AccCode, datamainold.SampleCode, timecode)
+		//subSvc := samplesubpackage.GetSampleSubpackageService(utils.DBE)
+		//datadetail.BarCode = subSvc.AutoGetBarCodeAnimal(this.User.AccCode, datamainold.SampleCode, timecode)
 		datadetail.BarCode = datadetail.SampleCode + count + "-" + timecode
 		//}
 		datamain.MModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -627,7 +626,12 @@ func (this *SamplespreinputController) Subpackage() {
 		var mainempty samplesinfo.SamplesMain
 		_, err = svcSample.InsertOtherSamplePre(this.User.AccCode+SamplesMaintbName, this.User.AccCode+SamplesDetailtbName, &datamain, &datadetail,
 			cols, datamainold.MId, &mainempty, this.User.AccCode+SamplesLogtbName, this.User.AccCode, utils.ToStr(this.User.Id), this.User.Realname, datamainold.SampleCode, datamainold.SampleType)
-
+		if err == nil {
+			if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+				g.Log().Info("添加样本失败")
+				return
+			}
+		}
 	} else { //如果不存在,表示完全新增
 		//if datadetail.BarCode == "" {
 		datadetail.BarCode = datamain.SampleCode + "01" + "-" + timecode
@@ -637,6 +641,12 @@ func (this *SamplespreinputController) Subpackage() {
 		datamain.MCreateBy = datadetail.CreateBy
 		datamain.ReceiveDate = time.Unix(dataother.ReceiveDateint/1000, 0)
 		_, err = svcSample.InsertSamplePre(this.User.AccCode+SamplesMaintbName, this.User.AccCode+SamplesDetailtbName, &datamain, &datadetail)
+		if err == nil {
+			if err = samplesinfo.UpdateBarcodeRules(0); err != nil {
+				g.Log().Info("样本不存在,且添加样本失败")
+				return
+			}
+		}
 	}
 
 	if dataother.Code_codeId > 0 {

+ 42 - 31
src/dashoo.cn/backend/api/controllers/samplesinfo/samplesubpackage.go

@@ -390,15 +390,9 @@ func (this *SampleSubpackageController) Subpackage() {
 				//datadetail.BarCode = datamain.SampleCode + rsp.Data
 				count, id, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
 				if err != nil {
-					g.Log().Info("添加样本失败")
+					g.Log().Info("查询样本失败")
 					return
 				}
-				if count != "01"{
-					if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
-						g.Log().Info("添加样本失败")
-						return
-					}
-				}
 				datadetail.BarCode = datamain.SampleCode + count + "-" + timecode
 				datamain.AccCode = this.User.AccCode
 				datamain.MCreateUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -406,6 +400,12 @@ func (this *SampleSubpackageController) Subpackage() {
 				datadetail.InitCapacity = datadetail.Capacity + UsedCapacity
 				datamain.ReceiveDate = time.Unix(dataother.ReceiveDateint/1000, 0)
 				_, err = svc.InsertSamplePre(this.User.AccCode+SamplesMaintbName, this.User.AccCode+SamplesDetailtbName, &datamain, &datadetail)
+				if err == nil {
+					if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+						g.Log().Info("添加样本失败")
+						return
+					}
+				}
 			} else {
 				datamain.AccCode = this.User.AccCode
 				datamain.MCreateUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -416,15 +416,21 @@ func (this *SampleSubpackageController) Subpackage() {
 				//where_main := "SampleCode = '" + datamain.SampleCode + "'"
 				//has := svc.GetEntityByWhere(this.User.AccCode+SamplesMaintbName, where_main, &modelmain)
 
-				count, _, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
+				count, id, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
 				if err != nil {
-					g.Log().Info("添加样本失败")
+					g.Log().Info("查询样本失败")
 					return
 				}
 				datadetail.BarCode = datamain.SampleCode + count + "-" + timecode
 
 				if count == "01" {
 					_, err = svc.InsertEntityBytbl(this.User.AccCode+SamplesMaintbName, &datamain)
+					if err == nil {
+						if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+							g.Log().Info("添加样本失败")
+							return
+						}
+					}
 				} else {
 					err = nil
 				}
@@ -444,18 +450,18 @@ func (this *SampleSubpackageController) Subpackage() {
 						g.Log().Info("添加样本失败")
 						return
 					}
-					if count != "01"{
-						if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
-							g.Log().Info("添加样本失败")
-							return
-						}
-					}
 					datadetailnew.BarCode = datamain.SampleCode + count + "-" + timecode
 					datadetailnew.SampleCode = datamain.SampleCode
 					datadetailnew.ParentBarCode = datadetail.BarCode
 					datadetailnew.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 					datadetailnew.CreateBy = this.User.Realname
 					_, err = svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailtbName, &datadetailnew)
+					if err == nil {
+						if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+							g.Log().Info("添加样本失败")
+							return
+						}
+					}
 					if groupid != "" {
 						var entity samplesgroup.GroupDetail
 						entity.GroupId = groupid
@@ -497,12 +503,6 @@ func (this *SampleSubpackageController) Subpackage() {
 				g.Log().Info("添加样本失败")
 				return
 			}
-			if count != "01"{
-				if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
-					g.Log().Info("添加样本失败")
-					return
-				}
-			}
 			datadetail.BarCode = datamain.SampleCode + count + "-" + timecode
 			datamain.AccCode = this.User.AccCode
 			datamain.MCreateUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -510,6 +510,12 @@ func (this *SampleSubpackageController) Subpackage() {
 			datadetail.InitCapacity = datadetail.Capacity + UsedCapacity
 			datamain.ReceiveDate = time.Unix(dataother.ReceiveDateint/1000, 0)
 			_, err = svc.InsertSamplePre(this.User.AccCode+SamplesMaintbName, this.User.AccCode+SamplesDetailtbName, &datamain, &datadetail)
+			if err == nil {
+				if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+					g.Log().Info("添加样本失败")
+					return
+				}
+			}
 		} else {
 			datamain.AccCode = this.User.AccCode
 			datamain.MCreateUserId, _ = utils.StrTo(this.User.Id).Int()
@@ -520,13 +526,19 @@ func (this *SampleSubpackageController) Subpackage() {
 			//where_main := "SampleCode = '" + datamain.SampleCode + "'"
 			//has := svc.GetEntityByWhere(this.User.AccCode+SamplesMaintbName, where_main, &modelmain)
 
-			count, _, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
+			count, id, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
 			if err != nil {
 				g.Log().Info("添加样本失败")
 				return
 			}
 			if count == "01" {
 				_, err = svc.InsertEntityBytbl(this.User.AccCode+SamplesMaintbName, &datamain)
+				if err == nil {
+					if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+						g.Log().Info("添加样本失败")
+						return
+					}
+				}
 			} else {
 				err = nil
 			}
@@ -543,24 +555,23 @@ func (this *SampleSubpackageController) Subpackage() {
 				datadetailnew.InitCapacity, _ = utils.StrTo(utils.ToStr(subpackagecapacity)).Float32()
 				//datadetailnew.BarCode = svc.AutoGetBarCodeAnimal(this.User.AccCode, datamainnew.SampleCode, timecode)
 
-
 				count, id, err := samplesinfo.GetBarcodeRules(datamain.SampleCode)
 				if err != nil {
 					g.Log().Info("添加样本失败")
 					return
 				}
-				if count != "01"{
-					if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
-						g.Log().Info("添加样本失败")
-						return
-					}
-				}
 				datadetailnew.BarCode = datamain.SampleCode + count + "-" + timecode
 
 				datadetailnew.ParentBarCode = datadetail.BarCode
 				datadetailnew.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
 				datadetailnew.CreateBy = this.User.Realname
-				svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailtbName, &datadetailnew)
+				_, err = svc.InsertEntityBytbl(this.User.AccCode+SamplesDetailtbName, &datadetailnew)
+				if count != "01" && err == nil {
+					if err = samplesinfo.UpdateBarcodeRules(id); err != nil {
+						g.Log().Info("添加样本失败")
+						return
+					}
+				}
 				if groupid != "" {
 					var entity samplesgroup.GroupDetail
 					entity.GroupId = groupid
@@ -585,7 +596,7 @@ func (this *SampleSubpackageController) Subpackage() {
 		if err == nil {
 			errinfo.Code = 0
 			//errinfo.Message = "操作成功"
-			errinfo.Message = "操作成功 \n 新增了"+this.GetString("subpackagenum")+"条"
+			errinfo.Message = "操作成功 \n 新增了" + this.GetString("subpackagenum") + "条"
 		} else {
 			errinfo.Code = -1
 			errinfo.Message = "保存失败!" + err.Error()

+ 6 - 3
src/dashoo.cn/backend/api/controllers/samplesinfo/samplesunsave.go

@@ -145,7 +145,10 @@ func (this *SamplesunsaveController) AnimalList() {
 	}
 	barCode := this.GetString("BarCode")
 	if barCode != "" {
-		where = where + " and a.BarCode like '%" + barCode + "%' "
+		where = where + " and (a.BarCode like '%" + barCode + "%'  or" +
+			" concat(c.ProvinceName,c.CityName,c.StreetName,c.Address) like '%" + barCode + "%' or " +
+			"c.ProjectName like '%" + barCode + "%' or " +
+			"b.SampleTypeName like '%" + barCode + "%')"
 	}
 	name := this.GetString("Name")
 	if name != "" {
@@ -202,9 +205,9 @@ func (this *SamplesunsaveController) AnimalList() {
 	if ditem != "" {
 		where = where + " and f.DItem = '" + ditem + "'"
 	}
-	equipmentIds :=this.GetString("EquipmentIds")
+	equipmentIds := this.GetString("EquipmentIds")
 	if equipmentIds != "" {
-		where += " and f.Name in("+ equipmentIds +")"
+		where += " and f.Name in(" + equipmentIds + ")"
 	}
 	svc := samplesinfo.GetSamplesInfoService(utils.DBE)
 	var list []samplesinfo.SamplesInfoList

+ 38 - 37
src/dashoo.cn/backend/api/tests/default_test.go

@@ -1,38 +1,39 @@
-package test
+package tests
 
-import (
-	"net/http"
-	"net/http/httptest"
-	"path/filepath"
-	"runtime"
-	"testing"
-
-	_ "dashoo.cn/api/routers"
-
-	"github.com/astaxie/beego"
-	. "github.com/smartystreets/goconvey/convey"
-)
-
-func init() {
-	_, file, _, _ := runtime.Caller(1)
-	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
-	beego.TestBeegoInit(apppath)
-}
-
-// TestGet is a sample to run an endpoint test
-func TestGet(t *testing.T) {
-	r, _ := http.NewRequest("GET", "/v1/object", nil)
-	w := httptest.NewRecorder()
-	beego.BeeApp.Handlers.ServeHTTP(w, r)
-
-	beego.Trace("testing", "TestGet", "Code[%d]\n%s", w.Code, w.Body.String())
-
-	Convey("Subject: Test Station Endpoint\n", t, func() {
-		Convey("Status Code Should Be 200", func() {
-			So(w.Code, ShouldEqual, 200)
-		})
-		Convey("The Result Should Not Be Empty", func() {
-			So(w.Body.Len(), ShouldBeGreaterThan, 0)
-		})
-	})
-}
+//
+//import (
+//	"net/http"
+//	"net/http/httptest"
+//	"path/filepath"
+//	"runtime"
+//	"testing"
+//
+//	_ "dashoo.cn/api/routers"
+//
+//	"github.com/astaxie/beego"
+//	. "github.com/smartystreets/goconvey/convey"
+//)
+//
+//func init() {
+//	_, file, _, _ := runtime.Caller(1)
+//	apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
+//	beego.TestBeegoInit(apppath)
+//}
+//
+//// TestGet is a sample to run an endpoint test
+//func TestGet(t *testing.T) {
+//	r, _ := http.NewRequest("GET", "/v1/object", nil)
+//	w := httptest.NewRecorder()
+//	beego.BeeApp.Handlers.ServeHTTP(w, r)
+//
+//	beego.Trace("testing", "TestGet", "Code[%d]\n%s", w.Code, w.Body.String())
+//
+//	Convey("Subject: Test Station Endpoint\n", t, func() {
+//		Convey("Status Code Should Be 200", func() {
+//			So(w.Code, ShouldEqual, 200)
+//		})
+//		Convey("The Result Should Not Be Empty", func() {
+//			So(w.Body.Len(), ShouldBeGreaterThan, 0)
+//		})
+//	})
+//}

+ 3 - 0
src/dashoo.cn/frontend_animal/package.json

@@ -61,5 +61,8 @@
     "postcss-loader": "0.11.1",
     "postcss-salad": "^1.0.8",
     "sass-loader": "^6.0.7"
+  },
+  "router": {
+    "base": "/dist"
   }
 }

+ 29 - 24
src/dashoo.cn/frontend_animal/src/components/samples/samplesearchdialog.vue

@@ -5,7 +5,7 @@
              :before-close="beforeClose"
              :close-on-click-modal="false">
     <el-row class="inputrow" type="flex">
-      <el-col :span="4"  >
+      <el-col :span="4">
 
         <el-row style="height:calc(100% - 1px)">
         <el-tabs type="border-card" style="height:calc(100% - 1px)">
@@ -261,6 +261,7 @@
 
 <script>
 import service from '../../utils/micro_request'
+import { customizeSearch, getSearchTemplate, deleteSearchTemplate, saveSearchTemplate } from '../../utils/microSampleRelated'
 export default {
   name: 'customsearchdialog',
 
@@ -416,7 +417,11 @@ export default {
       }, {
         value: 'PositionInfo',
         label: '存储位置',
-        type: 'date'
+        type: 'str'
+      }, {
+        value: 'Remark',
+        label: '备注',
+        type: 'str'
       }
       ],
       data3: [],
@@ -434,8 +439,16 @@ export default {
           label: '蜂种',
           type: 'str'
         }, {
-          value: 'Remark',
-          label: '备注信息',
+          value: 'GenusName',
+          label: '蜂种备注',
+          type: 'str'
+        }, {
+          value: 'Latitude',
+          label: '纬度',
+          type: 'str'
+        }, {
+          value: 'Longitude',
+          label: '经度',
           type: 'str'
         }, {
           value: 'Altitude',
@@ -453,17 +466,11 @@ export default {
           value: 'Name',
           label: '名称',
           type: 'str'
-        }
-        //   {
-        //   value: 'Latitude',
-        //   label: '纬度',
-        //   type: 'str'
-        // }, {
-        //   value: 'Longitude',
-        //   label: '经度',
-        //   type: 'str'
-        // }
-      ],
+        }, {
+          value: 'Remark',
+          label: '备注信息',
+          type: 'str'
+        }],
       data: []
     }
   },
@@ -476,7 +483,7 @@ export default {
   // },
   methods: {
     getOrgTreeList () {
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Sample', 'BasicSampleType')
+      service.postRequest('dashoo.biobank.bee-0.1', 'Sample', 'BasicSampleType')
         .then(res => {
           this.orgtreelist = utils.toolfun_gettreejson(res.data, 'id', 'parent_id', 'id,label')
         })
@@ -580,7 +587,7 @@ export default {
     // 查询扩展字段
     searchKuoZhanData () {
       this.data3 = []
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'Sample'})
+      customizeSearch({type: 'Sample'})
         .then(res => {
           var models = res.data
           for (var i = 0; i < models.length; i++) {
@@ -611,7 +618,7 @@ export default {
     },
     searchSourceKuoZhanData () {
       this.data = []
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'SampleSource'})
+      customizeSearch({type: 'SampleSource'})
         .then(res => {
           var models = res.data
           for (var i = 0; i < models.length; i++) {
@@ -642,7 +649,7 @@ export default {
     },
     // getSampleSourceTypeExpand () {
     //   this.data2 = []
-    //   service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleSource', 'SourceTypeExpand')
+    //   service.postRequest('dashoo.biobank.bee-0.1', 'SampleSource', 'SourceTypeExpand')
     //     .then(res => {
     //       var models = res
     //       // cascader判断
@@ -695,8 +702,7 @@ export default {
     },
     getAllSearchTab () {
       let _this = this
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', { type: 'Sample' })
-        // getSearchTemplate({ Type: 'sample' })
+      getSearchTemplate({ Type: 'Sample' })
         .then(res => {
           console.log('searchTemplates', _this.searchTemplates)
           if (res.data && res.data.length > 0) {
@@ -736,7 +742,7 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'DeleteSearchTemplate', {id: Id})
+        deleteSearchTemplate({id:Id})
           .then(res => {
             if (res.code === 0) {
               _this.$message({
@@ -875,8 +881,7 @@ export default {
       // console.log(template, 'BBBBBBBBB')
 
       // 保存确定
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SaveSearchTemplate', {id: this.currentSearchId, name: this.currentSearchTemplateName, template: template, type: 'Sample'})
-        // putSearchTemplate(this.currentSearchTemplateName, this.currentSearchId, template, 'sample')
+      saveSearchTemplate({id: this.currentSearchId, name: this.currentSearchTemplateName, template: template, type: 'Sample'})
         .then(res => {
           if (res.code === 0) {
             _this.$message({

+ 23 - 16
src/dashoo.cn/frontend_animal/src/components/samples/samplesourcesearchdialog.vue

@@ -236,6 +236,7 @@
 
 <script>
 import service from '../../utils/micro_request'
+import { customizeSearch, getSearchTemplate, deleteSearchTemplate, saveSearchTemplate } from '../../utils/microSampleRelated'
 export default {
   name: 'customsearchdialog',
 
@@ -363,10 +364,22 @@ export default {
         value: 'Genus',
         label: '蜂种',
         type: 'str'
+      }, {
+        value: 'GenusName',
+        label: '蜂种备注',
+        type: 'str'
       }, {
         value: 'Remark',
         label: '备注信息',
         type: 'str'
+      }, {
+        value: 'Latitude',
+        label: '纬度',
+        type: 'str'
+      }, {
+        value: 'Longitude',
+        label: '经度',
+        type: 'str'
       }, {
         value: 'Altitude',
         label: '海拔',
@@ -383,17 +396,7 @@ export default {
         value: 'Name',
         label: '名称',
         type: 'str'
-      }
-      //   {
-      //   value: 'Latitude',
-      //   label: '纬度',扩展
-      //   type: 'str'
-      // }, {
-      //   value: 'Longitude',
-      //   label: '经度',
-      //   type: 'str'
-      // }
-      ],
+      }],
       data: []
       // data2: []
     }
@@ -510,7 +513,8 @@ export default {
     // 查询扩展字段
     searchKuoZhanData () {
       this.data = []
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'SampleSource'})
+      // service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'CustomizeSearch', {type: 'SampleSource'})
+      customizeSearch({type: 'SampleSource'})
         .then(res => {
           var models = res.data
           for (var i = 0; i < models.length; i++) {
@@ -542,7 +546,7 @@ export default {
 
     // getSampleSourceTypeExpand () {
     //   this.data2 = []
-    //   service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleSource', 'SourceTypeExpand')
+    //   service.postRequest('dashoo.biobank.bee-0.1', 'SampleSource', 'SourceTypeExpand')
     //     .then(res => {
     //       var models = res
     //       // cascader判断
@@ -585,8 +589,9 @@ export default {
     },
     getAllSearchTab () {
       let _this = this
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', { type: 'SampleSource' })
+      // service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'GetSearchTemplate', { type: 'SampleSource' })
       // getSearchTemplate({ Type: 'sample' })
+      getSearchTemplate({ type: 'SampleSource' })
         .then(res => {
           console.log('searchTemplates', _this.searchTemplates)
           if (res.data && res.data.length > 0) {
@@ -625,7 +630,8 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'DeleteSearchTemplate', {id: Id})
+        // service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'DeleteSearchTemplate', {id: Id})
+        deleteSearchTemplate({id:Id})
           .then(res => {
             if (res.code === 0) {
               _this.$message({
@@ -762,8 +768,9 @@ export default {
       // console.log(template, 'BBBBBBBBB')
 
       // 保存确定
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SaveSearchTemplate', {id: this.currentSearchId, name: this.currentSearchTemplateName, template: template, type: 'SampleSource'})
+      // service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'SaveSearchTemplate', {id: this.currentSearchId, name: this.currentSearchTemplateName, template: template, type: 'SampleSource'})
       // putSearchTemplate(this.currentSearchTemplateName, this.currentSearchId, template, 'sample')
+      saveSearchTemplate({id: this.currentSearchId, name: this.currentSearchTemplateName, template: template, type: 'SampleSource'})
         .then(res => {
           if (res.code === 0) {
             _this.$message({

+ 263 - 8
src/dashoo.cn/frontend_animal/src/pages/biobank/source/_opera/operationb.vue

@@ -88,10 +88,33 @@
                 </el-select>
               </el-form-item>
             </el-col>
-            <el-col :span="16">
+            <el-col :span="4">
+              <el-form-item label="国内/国外取样" prop="InOrOut">
+                <el-select placeholder="取样地区" v-model="isOversea" filterable prop="Oversea" :disabled="samplesForm.AuditorStatus != 0 || !author_flag">
+                  <el-option
+                    v-for="item in isoversea"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
               <el-form-item label="取样地区" prop="Province">
                 <el-row>
-                  <el-col :span="10">
+                  <el-col :span="6" v-if="isOversea == 2">
+                    <el-select placeholder="国家"
+                                 v-model="samplesForm.Province" style="width: 100%" @change="countryChange" filterable :disabled="samplesForm.AuditorStatus != 0 || !author_flag">
+                      <el-option
+                        v-for="item in overseaoptions"
+                        :key="item.country_id"
+                        :label="item.country_name"
+                        :value="item.country_id">
+                      </el-option>
+                    </el-select>
+                  </el-col>
+                  <el-col :span="6" v-if="isOversea == 1">
                     <el-cascader :options="countryoptions" :props="countryprops" maxlength="20" placeholder="省市区"
                       v-model="CityAry" style="width: 100%" @change="handleAreaChange" filterable :disabled="samplesForm.AuditorStatus != 0 || !author_flag">
                     </el-cascader>
@@ -111,17 +134,107 @@
           </el-row>
           <el-row>
             <el-col :span="8">
+              <el-form-item label="经度/纬度格式">
+                <el-select v-model="LongLaType" style="width:100%" placeholder="请选择经度/纬度格式">
+                  <el-option v-for="item in LongLaTypeList" :label="item.Label" :value="item.Value" :key="item.Value">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="4" v-if="LongLaType == 1">
               <el-form-item label="经度">
-                <el-input v-model="samplesForm.Longitude" placeholder="请输入经度" style="width: 100%"></el-input>
+                <el-input v-model="long_dot" style="width: 100%">
+                  <template slot="append">.</template>
+                </el-input>
               </el-form-item>
             </el-col>
-            <el-col :span="8">
+            <el-col :span="4" v-if="LongLaType == 1">
+              <el-input v-model="long_degree" style="width: 100%">
+                <template slot="append">°</template>
+              </el-input>
+            </el-col>
+            <el-col :span="3" v-if="LongLaType == 2">
+              <el-form-item label="经度">
+                <el-input v-model="long_degree" style="width: 100%">
+                  <template slot="append">°</template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="2" v-if="LongLaType == 2">
+              <el-input v-model="long_dot" style="width: 100%">
+                <template slot="append">.</template>
+              </el-input>
+            </el-col>
+            <el-col :span="3" v-if="LongLaType == 2">
+              <el-input v-model="long_minute" style="width: 100%">
+                <template slot="append">′</template>
+              </el-input>
+            </el-col>
+            <el-col :span="4" v-if="LongLaType == 3">
+              <el-form-item label="经度">
+                <el-input v-model="long_degree" style="width: 100%">
+                  <template slot="append">°</template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="2" v-if="LongLaType == 3">
+              <el-input v-model="long_minute" style="width: 100%">
+                <template slot="append">′</template>
+              </el-input>
+            </el-col>
+            <el-col :span="2" v-if="LongLaType == 3">
+              <el-input v-model="long_second" style="width: 100%">
+                <template slot="append">″</template>
+              </el-input>
+            </el-col>
+            <el-col :span="4" v-if="LongLaType == 1">
+              <el-form-item label="纬度">
+                <el-input v-model="lat_dot" style="width: 100%">
+                  <template slot="append">.</template>
+                </el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="4" v-if="LongLaType == 1">
+              <el-input v-model="lat_degree" style="width: 100%">
+                <template slot="append">°</template>
+              </el-input>
+            </el-col>
+            <el-col :span="3" v-if="LongLaType == 2">
               <el-form-item label="纬度">
-                <el-input v-model="samplesForm.Latitude" placeholder="请输入纬度" style="width: 100%"></el-input>
+                <el-input v-model="lat_degree" style="width: 100%">
+                  <template slot="append">°</template>
+                </el-input>
               </el-form-item>
             </el-col>
+            <el-col :span="2" v-if="LongLaType == 2">
+              <el-input v-model="lat_dot" style="width: 100%">
+                <template slot="append">.</template>
+              </el-input>
+            </el-col>
+            <el-col :span="3" v-if="LongLaType == 2">
+              <el-input v-model="lat_minute" style="width: 100%">
+                <template slot="append">′</template>
+              </el-input>
+            </el-col>
+            <el-col :span="4" v-if="LongLaType == 3">
+            <el-form-item label="纬度">
+              <el-input v-model="lat_degree" style="width: 100%">
+                <template slot="append">°</template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+            <el-col :span="2" v-if="LongLaType == 3">
+              <el-input v-model="lat_minute" style="width: 100%">
+                <template slot="append">′</template>
+              </el-input>
+            </el-col>
+            <el-col :span="2" v-if="LongLaType == 3">
+              <el-input v-model="lat_second" style="width: 100%">
+                <template slot="append">″</template>
+              </el-input>
+            </el-col>
             <el-col :span="8">
-              <el-form-item label="海拔">
+              <el-form-item label="海拔" prop="Altitude">
                 <el-input v-model="samplesForm.Altitude" placeholder="请输入海拔" style="width: 85%"></el-input>
                 <span style="margin-left:15px">米</span>
               </el-form-item>
@@ -228,6 +341,8 @@
   } from 'vuex'
   import axios from 'axios'
   import uploadajax from '../../../../assets/js/uploadajax.js'
+  import { getCountriesInfos } from '../../../../utils/microSampleRelated'
+
   export default {
     name: 'samplessource',
     computed: {
@@ -248,6 +363,15 @@
         pagetitle: '', // 界面标题
         dictData: null,
         countryoptions: [],
+        overseaoptions: [], // 海外国家信息表
+        isoversea: [{
+          value: 1,
+          label: '国内'
+        }, {
+          value: 2,
+          label: '国外'
+        }],
+        isOversea: null,
         countryListOptions: [],
         countryprops: {
           value: 'adcode',
@@ -287,6 +411,15 @@
           AuditorRemark: '',
           Remark: ''
         },
+        LongLaType: 1, // 经纬度格式
+        long_dot: '', // 经纬度拼接字段
+        long_degree: '',
+        long_minute: '',
+        long_second: '',
+        lat_dot: '',
+        lat_degree: '',
+        lat_minute: '',
+        lat_second: '',
         // 审核按钮可否点击
         auditorShow: false,
         shenheForm: {
@@ -296,6 +429,18 @@
         author_flag: false,
         extendForm: {},
         sampeunitlist: [],
+        LongLaTypeList: [
+          {
+            Label: 'ddd.ddddd°',
+            Value: 1
+          }, {
+            Label: 'ddd°mm.mmm′',
+            Value: 2
+          }, {
+            Label: 'ddd°mm′ss″',
+            Value: 3
+          }
+        ],
         genuslist: [],
         projectlist: [],
         samplesrules: {
@@ -318,10 +463,20 @@
             validator: checkAmount,
             trigger: 'blur'
           }],
-          Province: [{
+          Oversea: [{
             required: true,
-            message: '请选择省市区',
+            message: '请选择',
             trigger: 'change'
+          }],
+          Province: [{
+            required: true,
+            message: '请选择省市区或国家',
+            trigger: 'blur'
+          }],
+          Altitude: [{
+            validator: checkAmount,
+            message: '请输入数字类型',
+            trigger: 'blur'
           }]
         },
         groupnameList: [],
@@ -346,6 +501,14 @@
     },
     created () {
       let _this = this
+      _this.long_dot = ''
+      _this.long_degree = ''
+      _this.long_minute = ''
+      _this.long_second = ''
+      _this.lat_dot = ''
+      _this.lat_degree = ''
+      _this.lat_minute = ''
+      _this.lat_second = ''
       this.pid = this.$route.params.opera
       if (this.pid == 'addsource') {
         this.pagetitle = '添加样本来源'
@@ -361,6 +524,7 @@
       _this.getDictOptions()
       _this.getPermissions()
       _this.getAnimalInfo()
+      _this.getCountriesInfo()
     },
     methods: {
       thisdate () {
@@ -380,6 +544,12 @@
             console.error(err)
           })
       },
+      getCountriesInfo () {
+        getCountriesInfos()
+          .then(res => {
+            this.overseaoptions = res.data
+          })
+      },
       dateFormat (date) {
         var y = date.getFullYear()
         var m = date.getMonth() + 1
@@ -424,8 +594,55 @@
           params
         })
           .then(res => {
+            let longitude = res.data.items.Longitude
+            let latitude = res.data.items.Longitude
+            if (longitude.indexOf('°') != -1 && longitude.indexOf('.') != -1 && longitude.indexOf('′') != -1) {
+              _this.LongLaType = 2
+              let longDegreeSplit = longitude.split('°')
+              let longDotSplit = longDegreeSplit[1].split('.')
+              let longMinuteSplit = longDotSplit[1].split('′')
+              let latDegreeSplit = latitude.split('°')
+              let latDotSplit = latDegreeSplit[1].split('.')
+              let latMinuteSplit = latDotSplit[1].split('′')
+              _this.long_degree = longDegreeSplit[0]
+              _this.long_dot = longDotSplit[0]
+              _this.long_minute = longMinuteSplit[0]
+              _this.lat_degree = latDegreeSplit[0]
+              _this.lat_dot = latDotSplit[0]
+              _this.lat_minute = latMinuteSplit[0]
+            } else if (longitude.indexOf('°') != -1 && longitude.indexOf('′') != -1 && longitude.indexOf('″') != -1) {
+              _this.LongLaType = 3
+              let longDegreeSplit = longitude.split('°')
+              let longMinuteSplit = longDegreeSplit[1].split('′')
+              let longSecondSplit = longMinuteSplit[1].split('″')
+              let latDegreeSplit = latitude.split('°')
+              let latMinuteSplit = latDegreeSplit[1].split('′')
+              let latSecondSplit = latMinuteSplit[1].split('″')
+              _this.long_degree = longDegreeSplit[0]
+              _this.long_minute = longMinuteSplit[0]
+              _this.long_second = longSecondSplit[0]
+              _this.lat_degree = latDegreeSplit[0]
+              _this.lat_minute = latMinuteSplit[0]
+              _this.lat_second = latSecondSplit[0]
+            } else if (longitude.indexOf('.') != -1 && longitude.indexOf('°') != -1) {
+              _this.LongLaType = 1
+              let longDotSplit = longitude.split('.')
+              let longDegreeSplit = longDotSplit[1].split('°')
+              let latDotSplit = latitude.split('.')
+              let latDegreeSplit = latDotSplit[1].split('°')
+              _this.long_dot = longDotSplit[0]
+              _this.long_degree = longDegreeSplit[0]
+              _this.lat_dot = latDotSplit[0]
+              _this.lat_degree = latDegreeSplit[0]
+            }
             _this.samplesForm = res.data.items
             _this.samplesForm.SurveyDate = new Date(res.data.items.SurveyDate)
+            console.log('res.data.items.AreaCode', res.data.items.AreaCode)
+            if ((res.data.items.AreaCode).length == 4) {
+              _this.isOversea = 1
+            } else if ((res.data.items.AreaCode).length == 6) {
+              _this.isOversea = 2
+            }
             _this.CityAry = []
             _this.CityAry.push(_this.samplesForm.Province)
             _this.CityAry.push(_this.samplesForm.City)
@@ -451,6 +668,21 @@
             _this.samplesForm.ProjectName = _this.$refs.refProject.selectedLabel
             // _this.samplesForm.SourceType = _this.$refs.refplace.selectedLabel
             let params = _this.samplesForm
+            if (_this.LongLaType == 1) {
+              params.Longitude = _this.long_dot + '.' + _this.long_degree + '°'
+              params.Latitude = _this.lat_dot + '.' + _this.lat_degree + '°'
+            } else if (_this.LongLaType == 2) {
+              params.Longitude = _this.long_degree + '°' + _this.long_dot + '.' + _this.long_minute + '′'
+              params.Latitude = _this.lat_degree + '°' + _this.lat_dot + '.' + _this.lat_minute + '′'
+            } else if (_this.LongLaType == 3) {
+              params.Longitude = _this.long_degree + '°' + _this.long_minute + '′' + _this.long_second + '″'
+              params.Latitude = _this.lat_degree + '°' + _this.lat_minute + '′' + _this.lat_second + '″'
+            }
+            if (params.Longitude == '.°' || params.Longitude == '°.′' || params.Longitude == '°′″') {
+              params.Longitude = ''
+              params.Latitude = ''
+            }
+
             let jsonstr = ''
             for (let i = 0; i < _this.animalextends.length; i++) {
               jsonstr += '"' + _this.animalextends[i].FieldName + '" : "' + _this.animalextends[i].FieldDefault +
@@ -492,12 +724,23 @@
       editbasic () {
         this.$refs['samplesForm'].validate((valid) => {
           if (valid) {
+            this.isOversea = 1
             let _this = this
             _this.samplesForm.Amount = parseInt(_this.samplesForm.Amount)
             _this.samplesForm.Unit = _this.$refs.refUnit.selectedLabel
             _this.samplesForm.ProjectName = _this.$refs.refProject.selectedLabel
             // _this.samplesForm.SourceType = _this.$refs.refplace.selectedLabel
             let params = _this.samplesForm
+            if (_this.LongLaType == 1) {
+              params.Longitude = _this.long_dot + '.' + _this.long_degree + '°'
+              params.Latitude = _this.lat_dot + '.' + _this.lat_degree + '°'
+            } else if (_this.LongLaType == 2) {
+              params.Longitude = _this.long_degree + '°' + _this.long_dot + '.' + _this.long_minute + '′'
+              params.Latitude = _this.lat_degree + '°' + _this.lat_dot + '.' + _this.lat_minute + '′'
+            } else if (_this.LongLaType == 3) {
+              params.Longitude = _this.long_degree + '°' + _this.long_minute + '′' + _this.long_second + '″'
+              params.Latitude = _this.lat_degree + '°' + _this.lat_minute + '′' + _this.lat_second + '″'
+            }
             let jsonstr = ''
             for (let i = 0; i < _this.animalextends.length; i++) {
               jsonstr += '"' + _this.animalextends[i].FieldName + '" : "' + _this.animalextends[i].FieldDefault +
@@ -689,6 +932,18 @@
           }
         }
       },
+      // 选择国家后信息绑定到Province相关字段中
+      countryChange (value) {
+        const provinceName = this.overseaoptions.find(item => item.country_id === value)
+        this.samplesForm.Province = (provinceName.country_id).toString()
+        this.samplesForm.ProvinceName = provinceName.country_name
+        this.samplesForm.AreaCode = (provinceName.country_id).toString()
+        this.samplesForm.City = ''
+        this.samplesForm.CityName = ''
+        this.samplesForm.Street = ''
+        this.samplesForm.StreetName = ''
+        console.log('country_id:', this.samplesForm.Province, 'country_name:', this.samplesForm.ProvinceName)
+      },
       // 获取当前上传图片字段
       getitem (val) {
         this.imagefiles = ''

+ 161 - 71
src/dashoo.cn/frontend_animal/src/pages/biobank/source/animal.vue

@@ -11,8 +11,8 @@
         </el-breadcrumb>
         <span style="float: right;">
           <el-form ref="form" :inline="true" style="float: left; margin-top: -11.5px">
-          <el-form-item label="样本源名称">
-            <el-input size="mini" style="width: 165px;" v-model="searchform.Name" placeholder="请输入样本源名称"></el-input>
+          <el-form-item label="取样地区">
+            <el-input size="mini" style="width: 165px;" v-model="searchform.Area" placeholder="请输入取样地区"></el-input>
           </el-form-item>
           <el-form-item label="来源内码">
             <el-input size="mini" style="width: 165px;" v-model="searchform.InnerNo" placeholder="请输入来源内码"></el-input>
@@ -57,6 +57,7 @@
           <router-link :to="'/biobank/source/addsource/operationb'">
             <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;">添加</el-button>
           </router-link>
+           <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;" @click="synchronizeVisible = true">数据同步</el-button>
           <el-button type="primary" size="mini" style="margin-left:10px; margin-top: -4px;"
                      @click="columndialogVisible = true">显示列</el-button>
           <!-- <el-button size="mini" type="primary" style="margin-left:10px; margin-top: -4px;"
@@ -156,7 +157,7 @@
         </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-                     :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
+                     :page-sizes="[100, 200, 500, 1000]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
                      :total="currentItemCount">
       </el-pagination>
     </el-card>
@@ -248,7 +249,18 @@
         <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
       </span>
     </el-dialog>
-
+    <el-dialog  title="样本导出" :visible.sync="sampleSourceExportVisible" @close="exportSampleSourceTypeInfo" width = "600px">
+      <el-form>
+        <el-form-item label="文件名称">
+          <el-input v-model="FileName" placeholder="请输入导出文件名称" size="middle" style="width:60%"></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="mini" @click="exportSampleSourceTypeInfo">取 消</el-button>
+        <el-button size="mini" type="primary" @click="exportType == 'exportrelated' ? exportSamples() : exportSampleSource()">导 出</el-button>
+<!--        <el-button size="mini" type="primary" @click="exportSampleSource">导 出</el-button> // this.exportType == 'exportrelated' ? exportSamples :-->
+      </span>
+    </el-dialog>
     <el-dialog title="样本批量导入" :visible.sync="importVisible">
       <el-upload :action="filehost + '/api/uploads/exportanimal'" :show-file-list="false" :data="importfileparam"
                  :on-success="handleexportfileSuccess" :before-upload="beforeexportfileUpload">
@@ -277,6 +289,17 @@
         <el-button type="primary" @click="saveshowfiled()">确 定</el-button>
       </div>
     </el-dialog>
+    <el-dialog title="数据同步"
+               :visible.sync="synchronizeVisible"
+               v-loading="loading"
+               element-loading-text="数据同步中,请耐心等待">
+      <el-radio v-model="syncType" label="1">南口同步到马连洼</el-radio>
+      <el-radio v-model="syncType" label="2">马连洼同步到南口</el-radio>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="synchronizeVisible = false">取 消</el-button>
+        <el-button type="primary" @click="synchronizeSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
 
     <!-- 自定义查询 -->
     <samplesourcesearchdialog @close="closeDialog"
@@ -288,6 +311,7 @@ import {
   mapGetters
 } from 'vuex'
 import service from '../../../utils/micro_request'
+import { customizeSearch, getSearchTemplate, sampleSourceSearchByTemplate, exportExcel, updateInfo } from '../../../utils/microSampleRelated'
 import samplesourcesearchdialog from '../../../components/samples/samplesourcesearchdialog'
 import draggable from 'vuedraggable'
 import store from 'store'
@@ -305,6 +329,7 @@ export default {
   },
   data () {
     return {
+      loading: false,
       filehost: '',
       importfileparam: {}, // 导入文件参数
       importfilepath: '', // 导入文件路径
@@ -319,17 +344,22 @@ export default {
       list: [], // table显示数据集
       showcolumn: [], // 显示列
       columndialogVisible: false, // 自定义显示列弹框
+      sampleSourceExportVisible: false, // 样本导出弹框
       isIndeterminate: false,
       checkAll: true,
       exportloading: false,
       ExpandInfoList: [], // 扩展字段列表
+      FileName: '', // 导出文件名称,
+      exportType: '', // 导出类型
+      synchronizeVisible: false, // 数据同步弹窗
+      syncType: undefined, // 同步类型 1 南口-->马连洼 2 马连洼-->南口
       searchform: {
         GenusId: '',
         Genus: '',
         Address: '',
         InnerNo: '',
         CreateOn: '',
-        Name: '',
+        Area: '',
         Weight: '',
         SourceType: '',
         currentPage: '',
@@ -427,11 +457,32 @@ export default {
         name: '取样地区',
         show: true,
         kuoz: false
+      }, {
+        filed: 'Longitude',
+        name: '经度',
+        show: true,
+        kuoz: false
+      }, {
+        filed: 'Latitude',
+        name: '纬度',
+        show: true,
+        kuoz: false
+      }, {
+        filed: 'Altitude',
+        name: '海拔',
+        show: true,
+        kuoz: false
+      }, {
+        filed: 'ProjectName',
+        name: '项目属性',
+        show: true,
+        kuoz: false
       }, {
         filed: 'Amount',
         name: '数量',
         show: true,
-        kuoz: false
+        kuoz: false,
+        columnwidth: 80
       }, {
         filed: 'AuditorStatus',
         name: '审核状态',
@@ -448,6 +499,16 @@ export default {
         name: '采样日期',
         show: true,
         kuoz: false
+      }, {
+        filed: 'GenusName',
+        name: '蜂种备注',
+        show: true,
+        kuoz: false
+      }, {
+        filed: 'Remark',
+        name: '备注信息',
+        show: true,
+        kuoz: false
       }]
     }
     this.filehost = process.env.imgserverhost
@@ -463,12 +524,7 @@ export default {
   methods: {
     // 接收时this.$route.query.SourceName
     handlePush (name) {
-      this.$router.push(
-        {
-          path: '/samples/stored',
-          query: {name: name}
-        }
-      )
+      window.open('/samples/stored?name=' + name, '_blank')
     },
     sampleDetails (id) {
       this.$router.push(
@@ -483,6 +539,7 @@ export default {
       )
     },
     initdata () {
+      this.currentSearchTemplate = ''
       let _this = this
       let SurveyDate = []
       if (!_this.SurveyDate) {
@@ -546,7 +603,7 @@ export default {
         .catch(err => {
           console.error(err)
         })
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'SampleSource'})
+      customizeSearch({type: 'SampleSource'})
         .then(res => {
           this.ExpandInfoList = res.data
         })
@@ -636,11 +693,12 @@ export default {
       console.log('closed')
       this.getAllSearchTab()
     },
-
+    exportSampleSourceTypeInfo () {
+      this.sampleSourceExportVisible = false
+    },
     getAllSearchTab () {
       let _this = this
-      // getSearchTemplate({ Type: 'sample' })
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', {type: 'SampleSource'})
+      getSearchTemplate({type: 'SampleSource'})
         .then(res => {
           if (res.data && res.data.length > 0) {
             _this.searchTemplates = res.data.map(function (e) {
@@ -716,7 +774,7 @@ export default {
       for (var i = 0; i < this.showcolumn.length; i++) {
         if (this.showcolumn[i].name === column.label) {
           this.showcolumn[i].columnwidth = newWidth
-          store.set('sapminputshowcolumn', this.showcolumn)
+          store.set('sapmsourceinputshowcolumn', this.showcolumn)
           return
         }
       }
@@ -760,36 +818,27 @@ export default {
       } else if (command == 'clear') {
         this.clearSearch()
       } else {
-        // TODO 样本模板查询微服务
-        let params = {
-          currentPage: 1,
-          size: 200,
-          template: command,
-          isDelete: 0,
-          type: 'SampleSource'
-        }
-        console.log(params)
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SampleSourceSearchByTemplate', params).then(res => {
+        this.searchByTemplate(command)
+        // this.$refs.sampleTable.searchWithTemplate(searchParams)
+      }
+    },
+    // 自定义模板查询数据
+    searchByTemplate (command) {
+      // 样本模板查询微服务
+      let params = {
+        currentPage: this.currentPage,
+        size: this.size,
+        template: command,
+        isDelete: 0,
+        type: 'SampleSource'
+      }
+      console.log(params)
+      sampleSourceSearchByTemplate(params)
+        .then(res => {
           this.donorsList = res.data.list
           this.currentItemCount = res.data.total
         })
-        this.currentSearchTemplate = command
-        /* let searchmodel = {
-          searchWithTemplate: command
-        }
-        store.set('samplestoredseach', searchmodel) */
-        // this.searchWithTemplate(command)
-        // 调用子组件的查询方法 状态  1待存储2已存储3.取出待放回4.已归档
-
-        let searchParams = {
-          template: command,
-          status: 2,
-          isStore: true,
-          type: 0,
-          current: 1
-        }
-        // this.$refs.sampleTable.searchWithTemplate(searchParams)
-      }
+      this.currentSearchTemplate = command
     },
     clearSearch () {
       this.searchform.GenusId = ''
@@ -810,11 +859,19 @@ export default {
     handleSizeChange (value) {
       this.size = value
       this.currentPage = 1
-      this.initdata()
+      if (this.currentSearchTemplate) {
+        this.searchByTemplate(this.currentSearchTemplate)
+      } else {
+        this.initdata()
+      }
     },
     handleCurrentChange (value) {
       this.currentPage = value
-      this.initdata()
+      if (this.currentSearchTemplate) {
+        this.searchByTemplate(this.currentSearchTemplate)
+      } else {
+        this.initdata()
+      }
     },
     formatDateTime (date) {
       var y = date.getFullYear()
@@ -847,7 +904,9 @@ export default {
           })
           return
         }
-        _this.exportSampleSource('exportchosen')
+        this.exportType = 'exportchosen'
+        this.sampleSourceExportVisible = true
+        // _this.exportSampleSource('exportchosen')
       } else if (command === 'exportpage') { // 导出当前页数据
         if (_this.$refs.tableData.data.length < 1) {
           _this.$message({
@@ -856,16 +915,20 @@ export default {
           })
           return
         }
-        _this.exportSampleSource('exportpage')
+        this.exportType = 'exportpage'
+        this.sampleSourceExportVisible = true
+        // _this.exportSampleSource('exportpage')
       } else if (command === 'exportall') { // 导出所有数据
-        _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'info'
-        }).then(() => {
-          _this.exportSampleSource('exportall')
-        }).catch(() => {
-        })
+        // _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
+        //   confirmButtonText: '确定',
+        //   cancelButtonText: '取消',
+        //   type: 'info'
+        // }).then(() => {
+        //   _this.exportSampleSource('exportall')
+        // }).catch(() => {
+        // })
+        this.exportType = 'exportall'
+        this.sampleSourceExportVisible = true
       } else if (command === 'exportrelated') {
         if (this.multipleSelection.length === 0) {
           _this.$message({
@@ -879,12 +942,15 @@ export default {
           cancelButtonText: '取消',
           type: 'info'
         }).then(() => {
-          _this.exportSamples()
+          // _this.exportSamples()
+          this.exportType = 'exportrelated'
+          this.sampleSourceExportVisible = true
         }).catch(() => {
         })
       }
     },
-    exportSampleSource (val) {
+    exportSampleSource () {
+      this.sampleSourceExportVisible = false
       let _this = this
       _this.exportloading = true
       // 显示列
@@ -901,6 +967,7 @@ export default {
         current_page: this.currentPage,
         size: this.size,
         name: this.searchform.Name,
+        file_name: this.FileName,
         inner_no: this.InnerNo,
         genus: this.searchform.Genus,
         address: this.searchform.Address,
@@ -915,7 +982,8 @@ export default {
       }
       if (this.CreateOn && this.CreateOn.length === 2) {
         let params2 = {
-          create_on: this.CreateOn[0] / 1000 + ',' + this.CreateOn[1] / 1000
+          CreateOnStart: this.CreateOnStart,
+          CreateOnEnd: this.CreateOnEnd
         }
         params = Object.assign(params, params2)
       }
@@ -927,7 +995,7 @@ export default {
         params = Object.assign(params, params3)
       }
       // 导出所选样本
-      if (val === 'exportchosen') {
+      if (_this.exportType === 'exportchosen') {
         for (var i = 0; i < _this.$refs.tableData.selection.length; i++) {
           if (i === _this.$refs.tableData.selection.length - 1) {
             id += _this.$refs.tableData.selection[i].Id
@@ -941,7 +1009,7 @@ export default {
         params = Object.assign(params, paramsid)
       }
       // 导出当前页样本
-      if (val === 'exportpage') {
+      if (_this.exportType === 'exportpage') {
         for (var i = 0; i < _this.$refs.tableData.data.length; i++) {
           if (i === _this.$refs.tableData.data.length - 1) {
             id += _this.$refs.tableData.data[i].Id
@@ -954,25 +1022,27 @@ export default {
         }
         params = Object.assign(params, paramsid)
       }
-      if (val === 'exportall') {
+      if (_this.exportType === 'exportall') {
         params.current_page = 0
         params.size = 0
       }
       // 样本来源相关导出
-      service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
+      exportExcel(params)
     },
     exportSamples () {
-      const dateInfo = this.formatExportDate(new Date())
+      this.sampleSourceExportVisible = false
+      // const dateInfo = this.formatExportDate(new Date())
       let _this = this
       let id = ''
       let params = {
         AccCode: this.authUser.Profile.AccCode,
-        Name: this.Name,
-        InnerNo: this.InnerNo,
-        CreateOn: (this.CreateOn).join(','),
-        currentPage: this.currentPage,
+        name: this.Name,
+        file_name: this.FileName,
+        inner_no: this.InnerNo,
+        create_on: this.create_on,
+        current_page: this.currentPage,
         size: this.size,
-        Type: 'Sample'
+        type: 'Sample'
       }
       for (var i = 0; i < _this.$refs.tableData.selection.length; i++) {
         if (i === _this.$refs.tableData.selection.length - 1) {
@@ -982,14 +1052,14 @@ export default {
         }
       }
       let paramsid = {
-        Id: id
+        id: id
       }
       params = Object.assign(params, paramsid)
       if (this.multipleSelection.length === 0) {
         params.currentPage = 0
         params.size = 0
       }
-      service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
+      exportExcel(params)
     },
     jstimehandle (val) {
       if (val === '') {
@@ -1019,6 +1089,26 @@ export default {
       // this.$forceUpdate()
       // this.initdata()
     },
+    // 同步数据
+    synchronizeSubmit () {
+      this.$confirm('是否确认数据同步?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.loading = true
+        updateInfo({update_type: this.syncType}).then(res => {
+          this.loading = false
+          if (res.code === 200) {
+            this.$message({
+              type: 'success',
+              message: res.msg
+            })
+            this.synchronizeVisible = false
+          }
+        })
+      })
+    },
     checkedshowall () {
       let tc = 0
       for (var i = 0; i < this.showcolumn.length; i++) {

+ 61 - 15
src/dashoo.cn/frontend_animal/src/pages/equipment/_opera/operation.vue

@@ -35,13 +35,32 @@
             <el-form-item label="容器编码" prop="Code" required>
               <el-input v-model="formmodel.Code"></el-input>
             </el-form-item>
-            <el-form-item label="品牌" required>
-              <el-select :disabled="!isadd && (formmodel.DItem === 19 || formmodel.DItem === 20)"
-                v-model="formmodel.Brand" placeholder="请选择品牌" @change="selectDModel" style="width:100%">
-                <el-option v-for="item in brandoptions" :label="item.label" :value="item.value" :key="item.value">
-                </el-option>
-              </el-select>
-            </el-form-item>
+            <el-col :span="12">
+              <el-form-item label="容器类型" required>
+                <el-select
+                  style="width:100%"
+                  v-model="DItem"
+                  clearable placeholder="请选择"
+                  @change="getbrand"
+                  @clear="ClearEquipment">
+                  <el-option
+                    v-for="item in EquipmentList"
+                    :key="item.DItem"
+                    :label="item.DItemName"
+                    :value="item.DItem">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="品牌" required>
+                <el-select :disabled="!isadd && (formmodel.DItem === 19 || formmodel.DItem === 20)"
+                  v-model="formmodel.Brand" placeholder="请选择品牌" @change="selectDModel" style="width:100%">
+                  <el-option v-for="item in brandoptions" :label="item.label" :value="item.value" :key="item.value">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
           </el-col>
 
           <el-col :span="8">
@@ -146,6 +165,8 @@
 </template>
 
 <script>
+  import { getBrandsByDItem, getEquipmentType } from '../../../utils/microEquipment'
+
   export default {
     name: 'makerTemplatesEdit',
 
@@ -191,6 +212,8 @@
         ValidityDate: new Date(), // 到期日期
         UseDate: new Date(), // 投入使用日期
         ProduceDate: new Date(), // 生产日期
+        EquipmentList: [], // 容器类型列表
+        DItem: '', // 容器类型
         formmodel: {
           Code: '',
           Name: '',
@@ -259,27 +282,42 @@
         this.isadd = false
         this.getmodel(eid)
         this.getsensorsbyequid(eid)
+        getEquipmentType({type: 'all'})
+          .then(res => {
+            this.EquipmentList = res.data
+          })
       } else {
         this.head = '新增容器'
         this.title = '新增容器'
         this.isadd = true
-        this.getbrand('中科美菱')
+        // this.getbrand('中科美菱')
         // 获取样本类型
         this.getType()
+        // 获取容器类型
+        getEquipmentType({type: 'all'})
+          .then(res => {
+            this.EquipmentList = res.data
+          })
       }
     },
     methods: {
-      getbrand (brand) {
+      getbrand () {
         // toggle loading
         let _this = this
+        _this.formmodel.Brand = ''
+        _this.brandoptions = []
         // request
-        this.$axios.get('/equipment/brands', {})
+        if (this.DItem == "") {
+          return
+        }
+        // this.$axios.get('/equipment/brands', {})
+        getBrandsByDItem({DItem: this.DItem})
           .then(res => {
             // response
-            for (var i = 0; i < res.data.items.length; i++) {
+            for (var i = 0; i < res.data.length; i++) {
               _this.brandoptions.push({
-                value: res.data.items[i],
-                label: res.data.items[i]
+                value: res.data[i],
+                label: res.data[i]
               })
             }
             // 默认选择其他
@@ -314,7 +352,8 @@
         let _this = this
         this.modeloptions = []
         // request
-        this.$axios.get('/equipment/dmodels/' + value, {})
+        // this.$axios.get('/equipment/dmodels/' + value, {})
+        this.$axios.get('/equipment/dmodels?brand=' + value + '&dItem=' + _this.DItem, {})
           .then(res => {
             // response
             for (var i = 0; i < res.data.items.length; i++) {
@@ -435,6 +474,7 @@
           .then(res => {
             _this.head = `编辑容器 (${res.data.Name})`
             _this.title = '编辑容器'
+            _this.DItem = res.data.DItem + ''
             // response
             _this.formmodel.Code = res.data.Code
             _this.formmodel.Name = res.data.Name
@@ -463,7 +503,7 @@
             if (new Date(res.data.ValidityDate).getTime() > 0) {
               _this.ValidityDate = new Date(res.data.ValidityDate)
             }
-            _this.getbrand(res.data.Brand)
+            // _this.getbrand(res.data.Brand)
             // 调整层数冻存架个数状态
             _this.isesedshelf(opera)
             // 获取样本类型
@@ -584,6 +624,12 @@
         } else {
           this.$router.go(-1)
         }
+      },
+      // 清空容器类型
+      ClearEquipment () {
+        this.DItem = ''
+        this.modeloptions = []
+        this.formmodel.ModelVersion = ''
       }
     }
   }

+ 28 - 3
src/dashoo.cn/frontend_animal/src/pages/equipment/index.vue

@@ -15,6 +15,22 @@
           </router-link>
         </span>
         <el-form ref="form" :inline="true" style="float: right; margin-top: -10px">
+          <el-form-item label="容器类型">
+            <el-select
+              size="mini"
+              style="width:100%"
+              v-model="ditem"
+              clearable placeholder="请选择"
+              @change="getbrand"
+              @clear="ClearEquipment">
+              <el-option
+                v-for="item in EquipmentList"
+                :key="item.DItem"
+                :label="item.DItemName"
+                :value="item.DItem">
+              </el-option>
+            </el-select>
+          </el-form-item>
           <el-form-item label="容器名称">
             <el-input size="mini" v-model="keyword" style="width:100%" placeholder="请输入容器名称"></el-input>
           </el-form-item>
@@ -87,10 +103,11 @@
       </div>
     </el-dialog>
   </div>
-  </div>
 </template>
 
 <script>
+  import { getEquipmentType } from '../../utils/microEquipment'
+
   export default {
     name: 'equipmanage',
 
@@ -103,9 +120,11 @@
         size: 12,
         list: [],
         keyword: '',
+        ditem: '', // 容器类型
         // 提示与移动用对话框
         alertVisible: false,
-        downloading: true
+        downloading: true,
+        EquipmentList: [] // 容器类型列表
       }
     },
     created () {
@@ -115,6 +134,11 @@
         this.currentPage = parseInt(this.$route.query.currentPage)
       }
       // initial data
+      // 获取容器类型
+      getEquipmentType({type: 'part'})
+        .then(res => {
+          this.EquipmentList = res.data
+        })
       this.initData()
     },
     methods: {
@@ -123,7 +147,8 @@
         const params = {
           _currentPage: this.currentPage,
           _size: this.size,
-          searchkey: this.keyword
+          searchkey: this.keyword,
+          ditem: this.ditem
         }
         this.$axios.get('/equipment/list', {
           params

+ 67 - 48
src/dashoo.cn/frontend_animal/src/pages/samples/archived/index.vue

@@ -11,7 +11,7 @@
         </el-breadcrumb>
         <span style="float: right;">
           <el-form ref="form" :inline="true" style="float: left; margin-top: -11.5px">
-          <el-form-item label="样本条码">
+          <el-form-item label="样本条码/采样地区/项目属性/样本类型">
             <el-input size="mini" style="width: 165px;" v-model="BarCode" placeholder="请输入样本条码"></el-input>
           </el-form-item>
           <el-form-item>
@@ -67,6 +67,7 @@
             <template v-if="item.filed === 'SourceName'">
               <router-link
                 :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
+                :target = "'_blank'"
                 :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
                 {{scope.row.SourceName}}
               </router-link>
@@ -96,7 +97,7 @@
         </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-        :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
+        :page-sizes="[100, 200, 500, 1000]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
         :total="currentItemCount">
       </el-pagination>
     </el-card>
@@ -208,26 +209,27 @@
       <span slot="footer" class="dialog-footer">
           <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
           <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
-        </span>
+      </span>
     </el-dialog>
-
-    <el-dialog title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "800px">
+    <el-dialog  title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "600px">
       <el-form>
-        <el-form-item label="样本类型">
-          <el-select v-model="SampleType" placeholder="请选择样本类型">
+        <el-form-item label="样本类型" v-if="exportType != 'exportall'">
+          <el-select v-model="SampleType" placeholder="请选择样本类型" style="width:60%">
             <el-option v-for="(item, index) in ExportSampleTypeList"
                        :label="item.name"
                        :value="item.id"
                        :key="index"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="文件名称">
+          <el-input v-model="FileName" placeholder="请输入导出文件名称" size="middle" style="width:60%"></el-input>
+        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
           <el-button size="mini" @click="exportSampleTypeInfo">取 消</el-button>
           <el-button size="mini" type="primary" @click="exportsamples">导 出</el-button>
-        </span>
+      </span>
     </el-dialog>
-
     <el-dialog title="选中显示列(拖拽可以实现排序)" :visible.sync="columndialogVisible" top="5vh">
       <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"
         style="margin-left:15px;">全选</el-checkbox>
@@ -261,6 +263,8 @@ import {
 import draggable from 'vuedraggable'
 import samplesearchdialog from '../../../components/samples/samplesearchdialog'
 import service from '../../../utils/micro_request'
+import { customizeSearch, getSampleType, sampleSearchByTemplate, getSearchTemplate, exportExcel } from '../../../utils/microSampleRelated'
+import { getEquipmentType, getEquipmentInfos } from '../../../utils/microEquipment'
 export default {
   name: 'samplesunsave',
   computed: mapGetters({
@@ -315,6 +319,7 @@ export default {
       searchTemplates: [],
       currentSearchTemplateName: '',
       searchField: 'BarCode',
+      FileName: '', // 导出文件名称
       searchValue: {
         BarCode: '',
         SampleCode: '',
@@ -408,7 +413,7 @@ export default {
         name: '样本条码',
         show: true,
         kuoz: false,
-        columnwidth: 170
+        columnwidth: 200
       }, {
         filed: 'SampleCode',
         name: '样本编码',
@@ -448,7 +453,8 @@ export default {
         filed: 'SampleTypeName',
         name: '样本类型',
         show: true,
-        kuoz: false
+        kuoz: false,
+        columnwidth: 100
       }, {
         filed: 'Capacity',
         name: '可用容量',
@@ -465,13 +471,13 @@ export default {
         name: '有效日期',
         show: true,
         kuoz: false,
-        columnwidth: 100
+        columnwidth: 200
       }, {
         filed: 'ReceiveDate',
         name: '接收日期',
         show: true,
         kuoz: false,
-        columnwidth: 150
+        columnwidth: 200
       }, {
         filed: 'CreateBy',
         name: '录入人',
@@ -482,6 +488,11 @@ export default {
         name: '所属分组',
         show: false,
         kuoz: false
+      }, {
+        filed: 'Remark',
+        name: '备注',
+        show: true,
+        kuoz: false
       }]
     }
     this.initData()
@@ -546,8 +557,8 @@ export default {
       }
       if (this.CreateOn && this.CreateOn.length === 2) {
         let params2 = {
-          CreateOnstart: this.CreateOn[0] / 1000,
-          CreateOnend: this.CreateOn[1] / 1000
+          CreateOnstart: this.StartDate,
+          CreateOnend: this.EndDate
         }
         params = Object.assign(params, params2)
       }
@@ -570,18 +581,18 @@ export default {
         .catch(err => {
           console.error(err)
         })
-      // 获取容器类型
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentType')
+      // 获取容器类型(只查有的类型)
+      getEquipmentType({type: 'part'})
         .then(res => {
           this.EquipmentList = res.data
         })
       // 获取样本扩展列表
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'Sample'})
+      customizeSearch({type: 'Sample'})
         .then(res => {
           this.ExpandInfoList = res.data
         })
       // 获取样本类型列表
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSampleType')
+      getSampleType()
         .then(res => {
           this.SampleTypeList = res.data
         })
@@ -591,7 +602,7 @@ export default {
     },
     GetEquipmentInfos () {
       if (this.DItem != '') {
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentInfos', {DItem: this.DItem})
+        getEquipmentInfos({DItem: this.DItem})
           .then(res => {
             this.EquipmentInfosList = res.data
           })
@@ -622,7 +633,6 @@ export default {
         _currentPage: -1
       })
         .then(res => {
-          // _this.exportsamples('exportchosen')
           if (store.get('samplearchivedseach').searchWithTemplate && store.get('samplearchivedseach').searchWithTemplate !==
             '') { // 自定义查询
             this.handleSearchCommand(store.get('samplearchivedseach').searchWithTemplate)
@@ -823,21 +833,27 @@ export default {
         this.$refs.samplesearchdialog.creatpage()
         this.$refs.samplesearchdialog.samplesearchdialogVisable = true
       } else {
-        let params = {
-          currentPage: 1,
-          size: 200,
-          template: command,
-          isDelete: 0,
-          type: 'Sample',
-          status: 'archived'
-        }
-        console.log(params)
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SampleSearchByTemplate', params).then(res => {
+        this.searchCommand (command)
+      }
+    },
+    // 自定义模板查询数据
+    searchByTemplate (command) {
+      // 样本模板查询微服务
+      let params = {
+        currentPage: this.currentPage,
+        size: this.size,
+        template: command,
+        isDelete: 0,
+        type: 'Sample',
+        status: 'archived'
+      }
+      console.log(params)
+      sampleSearchByTemplate(params)
+        .then(res => {
           this.list = res.data.list
           this.currentItemCount = res.data.total
         })
-        this.currentSearchTemplate = command
-      }
+      this.currentSearchTemplate = command
     },
     // 添加自定义搜索
     addSearchTab (name) {
@@ -1042,7 +1058,7 @@ export default {
     getAllSearchTab () {
       let _this = this
       // getSearchTemplate({ Type: 'sample' })
-      service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
+      getSearchTemplate({type: 'Sample'})
         .then(res => {
           console.log('res.data', res.data)
           if (res.data && res.data.length > 0) {
@@ -1166,6 +1182,7 @@ export default {
       this.Noteitemvalue = ''
       this.currentPage = 1
       this.GroupName = ''
+      this.FileName = ''
       this.initData()
     },
     // 导出样本
@@ -1181,7 +1198,6 @@ export default {
         }
         _this.getSampleTypeList(this.multipleSelection)
         _this.exportType = 'exportchosen'
-        _this.exportsamples('exportchosen')
         this.sampleExportVisible = true
       } else if (command == 'exportpage') { // 导出当前页数据
         if (_this.list.length < 1) {
@@ -1194,15 +1210,17 @@ export default {
         this.getSampleTypeList(null)
         this.exportType = 'exportpage'
         this.sampleExportVisible = true
-        // _this.exportsamples('exportpage')
       } else if (command == 'exportall') { // 导出所有数据
-        _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'info'
-        }).then(() => {
-          _this.exportsamples()
-        }).catch(() => {})
+        // _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
+        //   confirmButtonText: '确定',
+        //   cancelButtonText: '取消',
+        //   type: 'info'
+        // }).then(() => {
+        //   _this.exportsamples()
+        // }).catch(() => {})
+        this.getSampleTypeList(null)
+        this.exportType = 'exportall'
+        this.sampleExportVisible = true
       }
     },
     // 获取当前选择样本的类型
@@ -1270,6 +1288,7 @@ export default {
         create_by: this.CreateBy,
         source_name: this.SourceName,
         name: this.Name,
+        file_name: this.FileName,
         validity: this.Validity,
         inner_code: this.InnerCode,
         group_name: this.GroupName,
@@ -1282,8 +1301,8 @@ export default {
       }
       if (this.CreateOn && this.CreateOn.length === 2) {
         let params2 = {
-          CreateOnstart: this.CreateOn[0] / 1000,
-          CreateOnend: this.CreateOn[1] / 1000
+          CreateOnstart: '' + this.CreateOn[0] / 1000 + '',
+          CreateOnend: '' + this.CreateOn[1] / 1000 + ''
         }
         params = Object.assign(params, params2)
       }
@@ -1326,7 +1345,7 @@ export default {
       const name = dateInfo + '样本来源.xlsx'
       console.log('filename', name)
       // 样本来源相关导出
-      service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
+      exportExcel(params)
       _this.SampleType = ''
       _this.sampleExportVisible = false
     },
@@ -1378,7 +1397,7 @@ export default {
       this.size = value
       this.currentPage = 1
       if (this.currentSearchTemplate) {
-        this.searchWithTemplate(this.currentSearchTemplate)
+        this.searchByTemplate(this.currentSearchTemplate)
       } else {
         this.initData()
       }
@@ -1386,7 +1405,7 @@ export default {
     handleCurrentChange (value) {
       this.currentPage = value
       if (this.currentSearchTemplate) {
-        this.searchWithTemplate(this.currentSearchTemplate)
+        this.searchByTemplate(this.currentSearchTemplate)
       } else {
         this.initData()
       }

+ 1 - 1
src/dashoo.cn/frontend_animal/src/pages/samples/prerecorded/_opera/unhumanadd.vue

@@ -880,7 +880,7 @@
         this.sampleform.SourceName = val.Name
         this.sampleform.InnerNo = val.InnerNo
         this.sampleform.ProjectName = val.ProjectName
-        this.sampleform.AddressName = val.AddressName
+        this.sampleform.AddressName = val.Address
         this.sampleform.SurveyDate = new Date(val.SurveyDate)
         this.amountuni = val.Amount + val.Unit
         this.AreaCode = val.AreaCode

+ 62 - 43
src/dashoo.cn/frontend_animal/src/pages/samples/prerecorded/index.vue

@@ -11,7 +11,7 @@
         </el-breadcrumb>
         <span style="float: right;">
  <el-form ref="form" :inline="true" style="float: left; margin-top: -11.5px">
-          <el-form-item label="样本条码">
+          <el-form-item label="样本条码/采样地区/项目属性/样本类型">
             <el-input size="mini" style="width: 165px;" v-model="BarCode" placeholder="请输入样本条码"></el-input>
           </el-form-item>
           <el-form-item>
@@ -76,7 +76,9 @@
           align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'SourceName'">
-              <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
+              <router-link
+                :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
+                :target = "'_blank'"
                 :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
                 {{scope.row.SourceName}}
               </router-link>
@@ -106,7 +108,7 @@
         </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-        :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
+        :page-sizes="[100, 200, 500, 1000]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
       </el-pagination>
     </el-card>
     <el-dialog title="高级查询" :visible.sync="dialogVisible" width="1000px">
@@ -213,16 +215,19 @@
           <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
         </span>
     </el-dialog>
-    <el-dialog  title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "800px">
+    <el-dialog  title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "600px">
       <el-form>
-        <el-form-item label="样本类型">
-          <el-select v-model="SampleType" placeholder="请选择样本类型">
+        <el-form-item label="样本类型" v-if="exportType != 'exportall'">
+          <el-select v-model="SampleType" placeholder="请选择样本类型" style="width:60%">
             <el-option v-for="(item, index) in ExportSampleTypeList"
                        :label="item.name"
                        :value="item.id"
                        :key="index"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="文件名称">
+          <el-input v-model="FileName" placeholder="请输入导出文件名称" size="middle" style="width:60%"></el-input>
+        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
           <el-button size="mini" @click="exportSampleTypeInfo">取 消</el-button>
@@ -266,7 +271,8 @@
   import store from 'store'
   import draggable from 'vuedraggable'
   import samplesearchdialog from '../../../components/samples/samplesearchdialog'
-  import service from '../../../utils/micro_request'
+  import { customizeSearch, getSampleType, exportExcel, sampleSearchByTemplate, getSearchTemplate } from '../../../utils/microSampleRelated'
+  import { getEquipmentType } from '../../../utils/microEquipment'
   export default {
     name: 'samplespreinputlist',
     computed: mapGetters({
@@ -325,6 +331,7 @@
         searchTemplates: [],
         currentSearchTemplateName: '',
         searchField: 'BarCode',
+        FileName: '', // 导出文件名称
         searchValue: {
           BarCode: '',
           SampleCode: '',
@@ -430,7 +437,7 @@
           name: '样本条码',
           show: true,
           kuoz: false,
-          columnwidth: 170
+          columnwidth: 200
         }, {
           filed: 'SampleCode',
           name: '样本编码',
@@ -470,7 +477,8 @@
           filed: 'SampleTypeName',
           name: '样本类型',
           show: true,
-          kuoz: false
+          kuoz: false,
+          columnwidth: 100
         }, {
           filed: 'Capacity',
           name: '可用容量',
@@ -487,13 +495,13 @@
           name: '有效日期',
           show: true,
           kuoz: false,
-          columnwidth: 100
+          columnwidth: 200
         }, {
           filed: 'ReceiveDate',
           name: '接收日期',
           show: true,
           kuoz: false,
-          columnwidth: 150
+          columnwidth: 200
         }, {
           filed: 'CreateBy',
           name: '录入人',
@@ -601,17 +609,17 @@
             console.error(err)
           })
         // 获取容器类型
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentType')
+        getEquipmentType({type: 'part'})
           .then(res => {
             this.EquipmentList = res.data
           })
         // 获取样本扩展列表
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'Sample'})
+        customizeSearch({type: 'Sample'})
           .then(res => {
             this.ExpandInfoList = res.data
           })
         // 获取样本类型列表
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSampleType')
+        getSampleType()
           .then(res => {
             this.SampleTypeList = res.data
           })
@@ -621,7 +629,7 @@
       },
       /* GetEquipmentInfos () {
         if (this.DItem != '') {
-          service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentInfos', {DItem: this.DItem})
+          service.postRequest('dashoo.biobank.bee-0.1', 'Equipment', 'GetEquipmentInfos', {DItem: this.DItem})
             .then(res => {
               this.EquipmentInfosList = res.data
             })
@@ -722,14 +730,17 @@
           this.sampleExportVisible = true
           // _this.exportsamples('exportpage')
         } else if (command == 'exportall') { // 导出所有数据
-          _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'info'
-          }).then(() => {
-            this.exportType = 'exportall'
-            _this.exportsamples()
-          }).catch(() => {})
+          // _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
+          //   confirmButtonText: '确定',
+          //   cancelButtonText: '取消',
+          //   type: 'info'
+          // }).then(() => {
+          //   this.exportType = 'exportall'
+          //   _this.exportsamples()
+          // }).catch(() => {})
+          this.getSampleTypeList(null)
+          this.exportType = 'exportall'
+          this.sampleExportVisible = true
         }
       },
       // 获取当前选择样本的类型
@@ -797,6 +808,7 @@
           create_by: this.CreateBy,
           source_name: this.SourceName,
           name: this.Name,
+          file_name: this.FileName,
           validity: this.Validity,
           inner_code: this.InnerCode,
           group_name: this.GroupName,
@@ -808,10 +820,10 @@
           ExportFlag: 'prerecorded' */
 
         }
-        if (this.CreateOn && this.CreateOn.length === 2) {
+        if (this.StartDate != '' && this.EndDate != '') {
           let params2 = {
-            CreateOnstart: this.CreateOn[0] / 1000,
-            CreateOnend: this.CreateOn[1] / 1000
+            CreateOnstart: '' + this.CreateOn[0] / 1000 + '',
+            CreateOnend: '' + this.CreateOn[1] / 1000 + ''
           }
           params = Object.assign(params, params2)
         }
@@ -854,7 +866,7 @@
         const name = dateInfo + '样本来源.xlsx'
         console.log('filename', name)
         // 样本来源相关导出
-        service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
+        exportExcel(params)
         _this.SampleType = ''
         _this.sampleExportVisible = false
       },
@@ -985,21 +997,28 @@
           this.$refs.samplesearchdialog.creatpage()
           this.$refs.samplesearchdialog.samplesearchdialogVisable = true
         } else {
-          let params = {
-            currentPage: 1,
-            size: 200,
-            template: command,
-            isDelete: 0,
-            type: 'Sample',
-            status: 'prerecorded'
-          }
-          console.log(params)
-          service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SampleSearchByTemplate', params).then(res => {
+          this.searchByTemplate(command)
+        }
+      },
+      // 自定义模板查询数据
+      searchByTemplate (command) {
+        // 样本模板查询微服务
+        let params = {
+          currentPage: this.currentPage,
+          size: this.size,
+          template: command,
+          isDelete: 0,
+          type: 'Sample',
+          status: 'prerecorded'
+        }
+        console.log(params)
+        sampleSearchByTemplate(params)
+          .then(res => {
             this.list = res.data.list
+            console.log(121212121212,this.multipleTable)
             this.currentItemCount = res.data.total
           })
-          this.currentSearchTemplate = command
-        }
+        this.currentSearchTemplate = command
       },
       // 添加自定义搜索
       addSearchTab (name) {
@@ -1208,8 +1227,7 @@
       },
       getAllSearchTab () {
         let _this = this
-        // getSearchTemplate({ Type: 'sample' })
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
+        getSearchTemplate({type: 'Sample'})
           .then(res => {
             console.log('res.data', res.data)
             if (res.data && res.data.length > 0) {
@@ -1271,7 +1289,7 @@
         this.size = value
         this.currentPage = 1
         if (this.currentSearchTemplate) {
-          this.searchWithTemplate(this.currentSearchTemplate)
+          this.searchByTemplate(this.currentSearchTemplate)
         } else {
           this.initData()
         }
@@ -1303,7 +1321,7 @@
       handleCurrentChange (value) {
         this.currentPage = value
         if (this.currentSearchTemplate) {
-          this.searchWithTemplate(this.currentSearchTemplate)
+          this.searchByTemplate(this.currentSearchTemplate)
         } else {
           this.initData()
         }
@@ -1328,6 +1346,7 @@
         this.Validity = []
         this.GroupName = ''
         this.currentPage = 1
+        this.FileName = ''
         this.initData()
       },
       deletedata (val) {

+ 85 - 48
src/dashoo.cn/frontend_animal/src/pages/samples/stored/index.vue

@@ -11,7 +11,7 @@
         </el-breadcrumb>
         <span style="float: right;">
            <el-form ref="form" :inline="true" style="float: left; margin-top: -11.5px">
-          <el-form-item label="样本条码">
+          <el-form-item label="样本条码/采样地区/项目属性/样本类型">
             <el-input size="mini" style="width: 165px;" v-model="BarCode" placeholder="请输入样本条码"></el-input>
           </el-form-item>
           <el-form-item>
@@ -100,15 +100,19 @@
             <template v-if="item.filed === 'SourceName'">
               <router-link
                 :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
+                :target = "'_blank'"
                 :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
                 {{scope.row.SourceName}}
               </router-link>
+<!--              <router-link @click="handlePush(scope.row.SourceId, size, currentPage)">-->
+<!--                {{scope.row.SourceName}}-->
+<!--              </router-link>-->
             </template>
             <template v-else-if="item.filed === 'ValidityDate' || item.filed === 'ReceiveDate'">
               {{jstimehandle(scope.row[item.filed])}}
             </template>
             <template v-else-if="item.filed === 'SurveyDate'">
-              {{jstimehandle(scope.row[item.filed])}}
+              {{Jstimehandle(scope.row[item.filed])}}
             </template>
             <template v-else-if="item.filed === 'Location'">
               <router-link :to="'/equipment/'+scope.row.EquipmentId +'/manage_new' + getstationurl(scope.row)">
@@ -138,7 +142,7 @@
       <div class="block">
         <span class="demonstration"></span>
         <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-          :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
+          :page-sizes="[100, 200, 500, 1000]" :page-size="size" layout="total, sizes, prev, pager, next, jumper"
           :total="currentItemCount">
         </el-pagination>
       </div>
@@ -250,25 +254,25 @@
           <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
         </span>
       </el-dialog>
-
-      <el-dialog title="样本导出" :visible.sync="sampleExportVisible"  @close="exportSampleTypeInfo" width = "800px">
+      <el-dialog  title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "600px">
         <el-form>
-          <el-form-item label="样本类型">
-            <el-select v-model="SampleType" placeholder="请选择样本类型">
+          <el-form-item label="样本类型" v-if="exportType != 'exportall'">
+            <el-select v-model="SampleType" placeholder="请选择样本类型" style="width:60%">
               <el-option v-for="(item, index) in ExportSampleTypeList"
-                  :label="item.name"
-                  :value="item.id"
-                  :key="index"
-              ></el-option>
+                         :label="item.name"
+                         :value="item.id"
+                         :key="index"></el-option>
             </el-select>
           </el-form-item>
+          <el-form-item label="文件名称">
+            <el-input v-model="FileName" placeholder="请输入导出文件名称" size="middle" style="width:60%"></el-input>
+          </el-form-item>
         </el-form>
         <span slot="footer" class="dialog-footer">
           <el-button size="mini" @click="exportSampleTypeInfo">取 消</el-button>
           <el-button size="mini" type="primary" @click="exportsamples">导 出</el-button>
         </span>
       </el-dialog>
-
       <el-dialog title="打印" :visible.sync="dialogPrintVisible" size="tiny">
         <el-select v-model="Printscheme" placeholder="请选择">
           <el-option v-for="item in printschemelist" :label="item.Name" :value="item.FileName" :key="item.FileName">
@@ -322,7 +326,8 @@
   import {
     mapGetters
   } from 'vuex'
-  import service from '../../../utils/micro_request'
+  import { customizeSearch, getSampleType, exportExcel, sampleSearchByTemplate, getSearchTemplate } from '../../../utils/microSampleRelated'
+  import { getEquipmentType, getEquipmentInfos } from '../../../utils/microEquipment'
 
   export default {
     name: 'sampleinput',
@@ -408,6 +413,7 @@
         searchTemplateName: '自定义搜索1',
         currentSearchTemplateName: '',
         searchField: 'BarCode',
+        FileName: '', // 导出文件名称
         searchValue: {
           BarCode: '',
           SampleCode: '',
@@ -503,7 +509,7 @@
           name: '样本条码',
           show: true,
           kuoz: false,
-          columnwidth: 170
+          columnwidth: 200
         }, {
           filed: 'SampleCode',
           name: '样本编码',
@@ -543,7 +549,8 @@
           filed: 'SampleTypeName',
           name: '样本类型',
           show: true,
-          kuoz: false
+          kuoz: false,
+          columnwidth: 100
         }, {
           filed: 'Capacity',
           name: '可用容量',
@@ -560,13 +567,13 @@
           name: '有效日期',
           show: true,
           kuoz: false,
-          columnwidth: 100
+          columnwidth: 200
         }, {
           filed: 'ReceiveDate',
           name: '接收日期',
           show: true,
           kuoz: false,
-          columnwidth: 150
+          columnwidth: 200
         }, {
           filed: 'CreateBy',
           name: '录入人',
@@ -583,6 +590,11 @@
           name: '所属分组',
           show: true,
           kuoz: false
+        }, {
+          filed: 'Remark',
+          name: '备注',
+          show: true,
+          kuoz: false
         }]
       }
       this.getextends()
@@ -658,17 +670,17 @@
             console.error(err)
           })
         // 获取容器类型
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentType')
+        getEquipmentType({type: 'part'})
           .then(res => {
             this.EquipmentList = res.data
           })
         // 获取样本扩展列表
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'Sample'})
+        customizeSearch({type: 'Sample'})
           .then(res => {
             this.ExpandInfoList = res.data
           })
         // 获取样本类型列表
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSampleType')
+        getSampleType()
           .then(res => {
             this.SampleTypeList = res.data
           })
@@ -678,7 +690,7 @@
       },
       GetEquipmentInfos () {
         if (this.DItem != '') {
-          service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentInfos', {DItem: this.DItem})
+          getEquipmentInfos({DItem: this.DItem})
             .then(res => {
               this.EquipmentInfosList = res.data
             })
@@ -812,12 +824,15 @@
             this.checkAll = true
           }
         }
+        this.$nextTick(() => {
+          this.$refs.multipleTable.doLayout()
+        })
       },
       handleSizeChange (value) {
         this.size = value
         this.currentPage = 1
         if (this.currentSearchTemplate) {
-          this.searchWithTemplate(this.currentSearchTemplate)
+          this.searchByTemplate(this.currentSearchTemplate)
         } else {
           this.initData()
         }
@@ -825,7 +840,7 @@
       handleCurrentChange (value) {
         this.currentPage = value
         if (this.currentSearchTemplate) {
-          this.searchWithTemplate(this.currentSearchTemplate)
+          this.searchByTemplate(this.currentSearchTemplate)
         } else {
           this.initData()
         }
@@ -843,6 +858,18 @@
           return val.substring(0, 19)
         }
       },
+      Jstimehandle (val) {
+        if (val === '') {
+          return '----'
+        } else if (val === '0001-01-01T08:00:00+08:00') {
+          return '----'
+        } else if (val === '5000-01-01T23:59:59+08:00') {
+          return '永久'
+        } else {
+          val = val.replace('T', ' ')
+          return val.substring(0, 10)
+        }
+      },
       jssubstrhandle (val, no) {
         let position = val.split(';')
         return position[no]
@@ -940,14 +967,17 @@
           // }
           // _this.exportsamples('exportpage')
         } else if (command == 'exportall') { // 导出所有数据
-          _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'info'
-          }).then(() => {
-            this.exportType = 'exportall'
-            _this.exportsamples()
-          }).catch(() => {})
+          // _this.$confirm('此操作将导出所有满足条件的数据!是否继续导出?', '提示', {
+          //   confirmButtonText: '确定',
+          //   cancelButtonText: '取消',
+          //   type: 'info'
+          // }).then(() => {
+          //   this.exportType = 'exportall'
+          //   _this.exportsamples()
+          // }).catch(() => {})
+          this.getSampleTypeList(null)
+          this.exportType = 'exportall'
+          this.sampleExportVisible = true
         }
       },
       // 获取当前选择样本的类型
@@ -1016,6 +1046,7 @@
           create_by: this.CreateBy,
           source_name: this.SourceName,
           name: this.Name,
+          file_name: this.FileName,
           validity: this.Validity,
           inner_code: this.InnerCode,
           group_name: this.GroupName,
@@ -1028,7 +1059,8 @@
         }
         if (this.CreateOn && this.CreateOn.length === 2) {
           let params2 = {
-            create_on: this.CreateOn[0] / 1000 + ',' + this.CreateOn[1] / 1000
+            CreateOnstart: '' + this.CreateOn[0] / 1000 + '',
+            CreateOnend: '' + this.CreateOn[1] / 1000 + ''
           }
           params = Object.assign(params, params2)
         }
@@ -1071,7 +1103,7 @@
         const name = dateInfo + '样本来源.xlsx'
         console.log('filename', name)
         // 样本来源相关导出
-        service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
+        exportExcel(params)
         _this.SampleType = ''
         _this.sampleExportVisible = false
       },
@@ -1243,8 +1275,7 @@
 
       getAllSearchTab () {
         let _this = this
-        // getSearchTemplate({ Type: 'sample' })
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
+        getSearchTemplate({type: 'Sample'})
           .then(res => {
             console.log('res.data', res.data)
             if (res.data && res.data.length > 0) {
@@ -1293,23 +1324,28 @@
           this.$refs.samplesearchdialog.creatpage()
           this.$refs.samplesearchdialog.samplesearchdialogVisable = true
         } else {
-          let params = {
-            currentPage: 1,
-            size: 200,
-            template: command,
-            isDelete: 0,
-            type: 'Sample',
-            status: 'stored'
-          }
-          console.log(params)
-          service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SampleSearchByTemplate', params).then(res => {
+          this.searchByTemplate(command)
+        }
+      },
+      // 自定义模板查询数据
+      searchByTemplate (command) {
+        // 样本模板查询微服务
+        let params = {
+          currentPage: this.currentPage,
+          size: this.size,
+          template: command,
+          isDelete: 0,
+          type: 'Sample',
+          status: 'stored'
+        }
+        console.log(params)
+        sampleSearchByTemplate(params)
+          .then(res => {
             this.list = res.data.list
             this.currentItemCount = res.data.total
           })
-          /* this.currentSearchTemplate = command */
-        }
+        this.currentSearchTemplate = command
       },
-
       searchWithTemplate (name) {
         this.searchDialogVisible = false
         let params = {
@@ -1424,6 +1460,7 @@
         this.Validity = []
         this.currentPage = 1
         this.GroupName = ''
+        this.FileName = ''
         this.initData()
       }
     }

+ 56 - 35
src/dashoo.cn/frontend_animal/src/pages/samples/waitingstore/index.vue

@@ -11,7 +11,7 @@
         </el-breadcrumb>
         <span style="float: right;">
           <el-form ref="form" :inline="true" style="float: left; margin-top: -11.5px">
-          <el-form-item label="样本条码">
+          <el-form-item label="样本条码/采样地区/项目属性/样本类型">
             <el-input size="mini" style="width: 165px;" v-model="BarCode" placeholder="请输入样本条码"></el-input>
           </el-form-item>
           <el-form-item>
@@ -73,7 +73,9 @@
           align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'SourceName'">
-              <router-link :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
+              <router-link
+                :to="'/biobank/source/'+ scope.row.SourceId + '/sourcedetail?pname=samples-prerecorded&size='+size+'&currentPage='+currentPage"
+                :target = "'_blank'"
                 :style="{color: scope.row.FamilyState === 0 ? 'blue' : 'red'}">
                 {{scope.row.SourceName}}
               </router-link>
@@ -105,7 +107,7 @@
         </el-table-column>
       </el-table>
       <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
-        :page-sizes="[10, 100, 200, 500]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
+        :page-sizes="[100, 200, 500, 1000]" :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="currentItemCount">
       </el-pagination>
     </el-card>
 
@@ -218,23 +220,25 @@
           <el-button size="mini" type="primary" @click="seachdata">查 询</el-button>
         </span>
     </el-dialog>
-    <el-dialog title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "800px">
+    <el-dialog  title="样本导出" :visible.sync="sampleExportVisible" @close="exportSampleTypeInfo" width = "600px">
       <el-form>
-        <el-form-item label="样本类型">
-          <el-select v-model="SampleType" placeholder="请选择样本类型">
+        <el-form-item label="样本类型" v-if="exportType != 'exportall'">
+          <el-select v-model="SampleType" placeholder="请选择样本类型" style="width:60%">
             <el-option v-for="(item, index) in ExportSampleTypeList"
                        :label="item.name"
                        :value="item.id"
                        :key="index"></el-option>
           </el-select>
         </el-form-item>
+        <el-form-item label="文件名称">
+          <el-input v-model="FileName" placeholder="请输入导出文件名称" size="middle" style="width:60%"></el-input>
+        </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
           <el-button size="mini" @click="exportSampleTypeInfo">取 消</el-button>
           <el-button size="mini" type="primary" @click="exportsamples">导 出</el-button>
         </span>
     </el-dialog>
-
     <el-dialog title="选中显示列(拖拽可以实现排序)" :visible.sync="columndialogVisible" top="5vh">
       <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" style="margin-left:15px;">全选</el-checkbox>
       <div style="margin: 10px 0;"></div>
@@ -263,7 +267,8 @@
   } from 'vuex'
   import draggable from 'vuedraggable'
   import samplesearchdialog from '../../../components/samples/samplesearchdialog'
-  import service from '../../../utils/micro_request'
+  import { customizeSearch, getSampleType, exportExcel, sampleSearchByTemplate, getSearchTemplate } from '../../../utils/microSampleRelated'
+  import { getEquipmentType, getEquipmentInfos } from '../../../utils/microEquipment'
   export default {
     name: 'samplesunsave',
     computed: mapGetters({
@@ -318,6 +323,7 @@
         searchTemplates: [],
         currentSearchTemplateName: '',
         searchField: 'BarCode',
+        FileName: '', // 导出文件名称
         searchValue: {
           BarCode: '',
           SampleCode: '',
@@ -411,7 +417,7 @@
           name: '样本条码',
           show: true,
           kuoz: false,
-          columnwidth: 170
+          columnwidth: 200
         }, {
           filed: 'SampleCode',
           name: '样本编码',
@@ -451,7 +457,8 @@
           filed: 'SampleTypeName',
           name: '样本类型',
           show: true,
-          kuoz: false
+          kuoz: false,
+          columnwidth: 100
         }, {
           filed: 'Capacity',
           name: '可用容量',
@@ -468,13 +475,13 @@
           name: '有效日期',
           show: true,
           kuoz: false,
-          columnwidth: 100
+          columnwidth: 200
         }, {
           filed: 'ReceiveDate',
           name: '接收日期',
           show: true,
           kuoz: false,
-          columnwidth: 150
+          columnwidth: 200
         }, {
           filed: 'CreateBy',
           name: '录入人',
@@ -485,6 +492,11 @@
           name: '所属分组',
           show: false,
           kuoz: false
+        }, {
+          filed: 'Remark',
+          name: '备注',
+          show: true,
+          kuoz: false
         }]
       }
       this.getextends()
@@ -564,17 +576,17 @@
             console.error(err)
           })
         // 获取容器类型
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentType')
+        getEquipmentType({type: 'part'})
           .then(res => {
             this.EquipmentList = res.data
           })
         // 获取样本扩展列表
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'CustomizeSearch', {type: 'Sample'})
+        customizeSearch({type: 'Sample'})
           .then(res => {
             this.ExpandInfoList = res.data
           })
         // 获取样本类型列表
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSampleType')
+        getSampleType()
           .then(res => {
             this.SampleTypeList = res.data
           })
@@ -584,7 +596,7 @@
       },
       GetEquipmentInfos () {
         if (this.DItem != '') {
-          service.postRequest('dashoo.biobank.bee-0.1-jlw', 'Equipment', 'GetEquipmentInfos', {DItem: this.DItem})
+          getEquipmentInfos({DItem: this.DItem})
             .then(res => {
               this.EquipmentInfosList = res.data
             })
@@ -680,6 +692,9 @@
             this.checkAll = true
           }
         }
+        this.$nextTick(() => {
+          this.$refs.multipleTable.doLayout()
+        })
       },
       handleCheckAllChange (val) {
         for (var i = 0; i < this.showcolumn.length; i++) {
@@ -727,21 +742,26 @@
           this.$refs.samplesearchdialog.creatpage()
           this.$refs.samplesearchdialog.samplesearchdialogVisable = true
         } else {
-          let params = {
-            currentPage: 1,
-            size: 200,
-            template: command,
-            isDelete: 0,
-            type: 'Sample',
-            status: 'waitingstore'
-          }
-          console.log(params)
-          service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'SampleSearchByTemplate', params).then(res => {
+          this.searchByTemplate(command)
+        }
+      },
+      searchByTemplate (command) {
+        // 样本模板查询微服务
+        let params = {
+          currentPage: this.currentPage,
+          size: this.size,
+          template: command,
+          isDelete: 0,
+          type: 'Sample',
+          status: 'waitingstore'
+        }
+        console.log(params)
+        sampleSearchByTemplate(params)
+          .then(res => {
             this.list = res.data.list
             this.currentItemCount = res.data.total
           })
-          this.currentSearchTemplate = command
-        }
+        this.currentSearchTemplate = command
       },
       // 添加自定义搜索
       addSearchTab (name) {
@@ -945,8 +965,7 @@
       },
       getAllSearchTab () {
         let _this = this
-        // getSearchTemplate({ Type: 'sample' })
-        service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
+        getSearchTemplate({ Type: 'Sample' })
           .then(res => {
             console.log('res.data', res.data)
             if (res.data && res.data.length > 0) {
@@ -1071,6 +1090,7 @@
         this.Noteitemvalue = ''
         this.currentPage = 1
         this.GroupName = ''
+        this.FileName = ''
         this.initData()
       },
       // 导出样本
@@ -1176,6 +1196,7 @@
           create_by: this.CreateBy,
           source_name: this.SourceName,
           name: this.Name,
+          file_name: this.FileName,
           validity: this.Validity,
           inner_code: this.InnerCode,
           group_name: this.GroupName,
@@ -1188,8 +1209,8 @@
         }
         if (this.CreateOn && this.CreateOn.length === 2) {
           let params2 = {
-            CreateOnstart: this.CreateOn[0] / 1000,
-            CreateOnend: this.CreateOn[1] / 1000
+            CreateOnstart: '' + this.CreateOn[0] / 1000 + '',
+            CreateOnend: '' + this.CreateOn[1] / 1000 + ''
           }
           params = Object.assign(params, params2)
         }
@@ -1232,7 +1253,7 @@
         const name = dateInfo + '样本来源.xlsx'
         console.log('filename', name)
         // 样本来源相关导出
-        service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
+        exportExcel(params)
         _this.SampleType = ''
         _this.sampleExportVisible = false
       },
@@ -1284,7 +1305,7 @@
         this.size = value
         this.currentPage = 1
         if (this.currentSearchTemplate) {
-          this.searchWithTemplate(this.currentSearchTemplate)
+          this.searchByTemplate(this.currentSearchTemplate)
         } else {
           this.initData()
         }
@@ -1292,7 +1313,7 @@
       handleCurrentChange (value) {
         this.currentPage = value
         if (this.currentSearchTemplate) {
-          this.searchWithTemplate(this.currentSearchTemplate)
+          this.searchByTemplate(this.currentSearchTemplate)
         } else {
           this.initData()
         }

+ 17 - 0
src/dashoo.cn/frontend_animal/src/utils/microEquipment.js

@@ -0,0 +1,17 @@
+import request from '../utils/micro_request'
+const basePath = process.env.micro_base_path
+
+// 高级查询获取容器类型
+export function getEquipmentType (params) {
+  return request.postRequest(basePath, 'Equipment', 'GetEquipmentType', params)
+}
+
+// 获取容器名称列表
+export function getBrandsByDItem (params) {
+  return request.postRequest(basePath, 'Equipment', 'GetBrandsByDItem', params)
+}
+
+// 高级查询获取容器名称列表
+export function getEquipmentInfos (params) {
+  return request.postRequest(basePath, 'Equipment', 'GetEquipmentInfos', params)
+}

+ 52 - 0
src/dashoo.cn/frontend_animal/src/utils/microSampleRelated.js

@@ -0,0 +1,52 @@
+import request from '../utils/micro_request'
+const basePath = process.env.micro_base_path
+
+// 扩展字段查询 params{type: Sample样本、SampleSource样本来源}
+export function customizeSearch (params) {
+  return request.postRequest(basePath, 'SampleRelated', 'CustomizeSearch', params)
+}
+
+// 获取自定义模板信息 params{type: Sample样本、SampleSource样本来源}
+export function getSearchTemplate (params) {
+  return request.postRequest(basePath, 'SampleRelated', 'GetSearchTemplate', params)
+}
+
+// 删除自定义模板
+export function deleteSearchTemplate (params) {
+  return request.postRequest(basePath, 'SampleRelated', 'DeleteSearchTemplate', params)
+}
+
+// 新增修改自定义模板
+export function saveSearchTemplate (params) {
+  return request.postRequest(basePath, 'SampleRelated', 'SaveSearchTemplate', params)
+}
+
+// 获取海外国家编码信息
+export function getCountriesInfos () {
+  return request.postRequest(basePath, 'SampleRelated', 'GetCountriesInfos')
+}
+
+// 样本来源通过自定义模板分页查询
+export function sampleSourceSearchByTemplate (params) {
+  return request.postRequest(basePath, 'SampleRelated', 'SampleSourceSearchByTemplate', params)
+}
+
+// 导出Excel
+export function exportExcel (params) {
+  return request.downloadExcel(basePath, 'SampleRelated', 'ExportExcel', params)
+}
+
+// 获取样本类型列表
+export function getSampleType () {
+  return request.postRequest(basePath, 'SampleRelated', 'GetSampleType')
+}
+
+// 样本通过自定义模板分页查询
+export function sampleSearchByTemplate (params) {
+  return request.postRequest(basePath, 'SampleRelated', 'SampleSearchByTemplate', params)
+}
+
+// 数据同步
+export function updateInfo (params) {
+  return request.postRequest(basePath, 'BarcodeRules', 'UpdateInfo', params)
+}

+ 4 - 1
src/dashoo.cn/frontend_animal/src/utils/micro_request.js

@@ -9,7 +9,10 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   // baseURL: process.env.VUE_APP_BASE_API,
-  baseURL: 'http://localhost:9981',
+  // baseURL: 'http://81.68.138.114:9982',
+  baseURL: process.env.micro_base_url,
+  // baseURL: 'http://36.112.37.213:9881',
+  // baseURL: 'http://10.66.6.237:9981',
   // 超时
   timeout: 60000
 })