Browse Source

1.苏州康宁需求:批量添加功能

hanmj 6 năm trước cách đây
mục cha
commit
3ab9ce40f1

+ 34 - 0
src/dashoo.cn/backend/api/controllers/equipment/shelfset.go

@@ -874,3 +874,37 @@ func (this *ShelfSetController) SampleDelete() {
 		return
 	}
 }
+
+// @Title 根据选中的冻存盒,获取所有盒中的管的数量和管的信息
+// @Description 样本批量添加
+// @Success	200	{object} controllers.Request
+// @router /getCountByBoxs [get]
+func (this *ShelfSetController) GetCountByBoxs() {
+	//获取到选中的冻存盒位置数组  位置信息用-连接成字符串
+	batchAddSelectBox := this.GetString("batchAddSelectBox")
+	// 初始化服务
+	var errinfo ErrorDataInfo
+	if batchAddSelectBox == "" {
+		errinfo.Message = "请先选择冻存盒"
+		errinfo.Code = -2
+		this.Data["json"] = &errinfo
+		this.ServeJSON()
+		return
+	}
+
+	batchAddSelectBoxarr := strings.Split(batchAddSelectBox, "-")
+	count:=0
+	for i := 0; i < len(batchAddSelectBoxarr); i++ {
+		positionArr := strings.Split(batchAddSelectBoxarr[i], "@")// 前两位是 盒的坐标 后一位是  层的ID
+
+		box_model := new(shelfset.Box)
+		svc := shelfset.GetshelfsetService(utils.DBE)
+		svc.GetEntityByShelfIdXY(positionArr[2],positionArr[0], positionArr[1], box_model)
+		count += box_model.RowNum*box_model.ColumnNum
+		errinfo.Item = count
+	}
+
+	errinfo.Code = 0
+	this.Data["json"] = &errinfo
+	this.ServeJSON()
+}

+ 223 - 0
src/dashoo.cn/backend/api/controllers/samplesinfo/sampleoperation.go

@@ -74,6 +74,7 @@ type SampmanageModel struct {
 	AttachmodelList             []Attachmodel `json:"uploadeds"`      // 上传附件
 	Uploadedremark              string        `json:"uploadedremark"` // 上传附件说明
 	BusinessOpDesc              string        `json:"businessopdesc"` // sampleBusiness表OpDesc字段
+	SampleNumber                int           `json:"SampleNumber"`   //一次添加的样本数量
 }
 
 //由交接单存储 样本批量添加model
@@ -1712,3 +1713,225 @@ func (this *SampleOperationController) BatchAddByApply(datamain samplesapply.Sam
 		return
 	}
 }
+
+
+// @Title 在容器界面批量添加
+// @Success	200	{object} controllers.Request
+// @router /saveBatchAdd [post]
+func (this *SampleOperationController) SaveBatchAdd() {
+	fmt.Println("批量保存")
+	groupid := this.GetString("groupid")
+	groupname := this.GetString("groupname")
+	batchAddSelectBox := this.GetString("batchAddSelectBox")
+	var jsonblob = this.Ctx.Input.RequestBody
+	var datamain samplesinfo.SamplesMain
+	var datadetail samplesinfo.SamplesDetail
+	var dataother SampmanageModel
+	json.Unmarshal(jsonblob, &datamain)
+	json.Unmarshal(jsonblob, &datadetail)
+	json.Unmarshal(jsonblob, &dataother)
+	datamain.MCreateBy = this.User.Realname
+	datamain.MCreateOn = time.Now()
+	datamain.MCreateUserId,_ = utils.StrTo(this.User.Id).Int()
+	datadetail.CreateBy = this.User.Realname
+	datadetail.CreateOn = time.Now()
+	datadetail.CreateUserId,_ = utils.StrTo(this.User.Id).Int()
+	fmt.Println(groupid)
+	fmt.Println(groupname)
+	fmt.Println(batchAddSelectBox)
+	svcSample := samplesinfo.GetSamplesInfoService(utils.DBE)
+
+	datadetail.IState = 1
+	datadetail.Capacity, _ = utils.StrTo(dataother.Capacitystr).Float32()
+	datadetail.InitCapacity = datadetail.Capacity
+
+	if dataother.Isyongjiu {
+		datadetail.ValidityDate, _ = utils.TimeParse("5000-1-1 23:59:59", "2006-1-2 15:4:5")
+	} else {
+		datadetail.ValidityDate = time.Unix(dataother.ValidityDateint/1000, 0)
+	}
+	datamain.ReceiveDate = time.Unix(dataother.ReceiveDateint/1000, 0)
+
+	var err error
+	var datamainold samplesinfo.SamplesMain
+	wheremain := " SampleCode='" + datamain.SampleCode + "'"
+	has := svcSample.GetEntityByWhere(this.User.AccCode+SamplesMaintbName, wheremain, &datamainold)
+	if has { //如果存在,表示添加新管,主信息不允许修改
+		if datadetail.BarCode == "" {
+			datadetail.BarCode = svcSample.AutoGetBarCode(this.User.AccCode, datamainold.SampleCode)
+		}
+		datamain.MModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
+		datamain.MModifiedBy = this.User.Realname
+		var cols []string = []string{"Name", "MModifiedUserId", "MModifiedBy"}
+		if datamainold.SamplingOrgan == "" {
+			cols = append(cols, "SamplingOrgan")
+			cols = append(cols, "SamplingOrganName")
+		}
+		if datamainold.SamplingSite == "" {
+			cols = append(cols, "SamplingSite")
+			cols = append(cols, "SamplingSiteName")
+		}
+		if datamainold.SourceId == 0 {
+			cols = append(cols, "SourceId")
+			cols = append(cols, "SourceIdCard")
+			cols = append(cols, "SourceName")
+		}
+		zback := svcSample.QueryZBackList(this.User.AccCode)
+		for i := 0; i < (len(zback)); i++ {
+			cols = append(cols, zback[i].Id)
+		}
+		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)
+
+	} else { //如果不存在,表示完全新增
+
+		datamain.AccCode = this.User.AccCode
+		datamain.MCreateUserId = datadetail.CreateUserId
+		datamain.MCreateBy = datadetail.CreateBy
+		datamain.ReceiveDate = time.Unix(dataother.ReceiveDateint/1000, 0)
+		_, err = svcSample.InsertEntityBytbl(this.User.AccCode+SamplesMaintbName, &datamain)
+	}
+
+	//equipmentId := dataother.Eid
+	batchAddSelectBoxarr := strings.Split(batchAddSelectBox, "-")
+	j:=0
+	for i := 0; i < len(batchAddSelectBoxarr); i++ {
+		positionArr := strings.Split(batchAddSelectBoxarr[i], "@")// 前两位是 盒的坐标 后一位是  层的ID
+		//fmt.Println(positionArr[0]+positionArr[1]+positionArr[2]);
+
+		box_model := new(shelfset.Box)
+		svc := shelfset.GetshelfsetService(utils.DBE)
+		svc.GetEntityByShelfIdXY(positionArr[2],positionArr[0], positionArr[1], box_model)
+		for  m := 0; m < box_model.RowNum;m++{
+			for n := 0; n < box_model.ColumnNum;n++{
+				if datadetail.BarCode == "" {
+					if this.User.AccCode == "sBBo4" {
+						datadetail.BarCode = datamain.SampleCode + "01"
+					} else {
+						datadetail.BarCode = datamain.SampleCode + "-" +  strconv.Itoa(j)
+					}
+				}
+				datadetail.EquipmentId,_ = strconv.Atoi(dataother.Eid)
+				datadetail.ShelfId,_ =  strconv.Atoi(positionArr[2])
+				datadetail.BoxId = box_model.Id
+				datadetail.Position = strconv.Itoa(n+1)  +";" + strconv.Itoa(m+1)
+				if(j<dataother.SampleNumber){
+					_, err = svcSample.InsertEntityBytbl(this.User.AccCode+SamplesDetailtbName, &datadetail)
+					j++
+				}else{
+					break
+				}
+
+			}
+		}
+	}
+
+	if dataother.Code_codeId > 0 {
+		svc_coderule := coderule.GetCodeRuleService(utils.DBE)
+		svc_coderule.UpdateLastNum(dataother.Code_lastnum, utils.ToStr(dataother.Code_codeId))
+	}
+
+	//打印相关
+	var sisAutoPrintSample string
+	sdefaultfangan := ""
+	if dataother.Autoprintchecked {
+		sisAutoPrintSample = "true"
+		var PrintSchemeList []printscheme.PrintScheme
+		svcprint := printscheme.GetPrintSchemeService(utils.DBE)
+		where1 := " Funcode = '样本'  and AccCode = '" + this.User.AccCode + "'  and IsDefault=1  "
+		PrintSchemeList = svcprint.GetPrintSchemeList(where1)
+		if len(PrintSchemeList) > 0 {
+			sdefaultfangan = PrintSchemeList[0].FileName
+		}
+	} else {
+		sisAutoPrintSample = "false"
+	}
+
+	//写入分组表
+	if err == nil {
+		if groupid != "" {
+			var entity samplesgroup.GroupDetail
+			entity.GroupId = groupid
+			entity.GroupName = groupname
+			entity.SampleId = datadetail.Id
+			entity.SampleCode = datamain.SampleCode
+			entity.BarCode = datadetail.BarCode
+			entity.GroupType = "SampleGroup"
+			entity.CreateBy = this.User.Realname
+			entity.CreateUserId, _ = utils.StrTo(this.User.Id).Int()
+			groupSvc := samplesgroup.GetSamplesGroupService(utils.DBE)
+			groupSvc.InsertEntityBytbl(this.User.AccCode+GroupDetailName, &entity)
+		}
+	}
+
+	var errinfo ErrorDataInfo
+	saveandadd := dataother.Saveandadd
+	var Auto_Code_Struct AutoCodeStruct
+	if err == nil {
+		if saveandadd == "1" { //保存并新增新编码
+			if dataother.Code_codeId > 0 { //使用默认规则
+				n, _ := utils.StrTo(dataother.Code_lastnum).Int()
+				count := len(dataother.Code_lastnum)
+				Auto_Code_Struct.Num = strconv.FormatFloat(float64(n+1)*(1/math.Pow(10, float64(count))), 'f', count, 64)[2:]
+				Auto_Code_Struct.SampleCode = this.AutoBarCodeAdd()
+			} else { //不使用默认规则
+				Auto_Code_Struct.Num = ""
+				Auto_Code_Struct.SampleCode = ""
+			}
+			if datamain.AccCode == "" {
+				Auto_Code_Struct.PrintAccCode = this.User.AccCode
+			} else {
+				Auto_Code_Struct.PrintAccCode = datamain.AccCode
+			}
+			Auto_Code_Struct.PrintCode = datadetail.Id
+			Auto_Code_Struct.PrintSAuto = sisAutoPrintSample
+			Auto_Code_Struct.Printfangan = sdefaultfangan
+
+			errinfo.Code = 1
+			errinfo.Message = "保存成功"
+			errinfo.Item = Auto_Code_Struct
+		} else if saveandadd == "2" { //保存并添加分管
+			if dataother.Code_codeId > 0 { //使用默认规则
+				Auto_Code_Struct.Num = dataother.Code_lastnum
+			} else { //不使用默认规则
+				Auto_Code_Struct.Num = ""
+			}
+			Auto_Code_Struct.SampleCode = datamain.SampleCode
+			Auto_Code_Struct.PrintAccCode = this.User.AccCode
+			Auto_Code_Struct.PrintCode = datadetail.Id
+			Auto_Code_Struct.PrintSAuto = sisAutoPrintSample
+			Auto_Code_Struct.Printfangan = sdefaultfangan
+			errinfo.Code = 2
+			errinfo.Message = "保存成功"
+			errinfo.Item = Auto_Code_Struct
+		} else {
+			if sisAutoPrintSample == "true" {
+				if sdefaultfangan != "" {
+					errinfo.Code = 10
+					errinfo.Message = "保存成功"
+					errinfo.Item = fmt.Sprintf("%v,%v,%v", datamainold.AccCode, sdefaultfangan, utils.ToStr(datadetail.Id))
+				} else {
+					errinfo.Code = 11
+					errinfo.Message = "保存成功,没有打印标签。原因可能是没有设置默认打印方案。"
+					errinfo.Item = ""
+				}
+			} else {
+				errinfo.Code = 0
+				errinfo.Message = "保存成功"
+			}
+		}
+	} else {
+		if saveandadd == "1" {
+			Auto_Code_Struct.SampleCode = "-1"
+			errinfo.Code = -2
+			errinfo.Message = "保存失败!"
+			errinfo.Item = Auto_Code_Struct
+		} else {
+			errinfo.Code = -1
+			errinfo.Message = "保存失败!" + err.Error()
+		}
+	}
+	this.Data["json"] = &errinfo
+	this.ServeJSON()
+}

+ 47 - 48
src/dashoo.cn/frontend_web/src/components/samples/abstractdialog.vue

@@ -58,7 +58,7 @@
           <el-col :span="12">
             <el-form-item label="样本类型" prop="NewsSampleType" required>
               <el-select v-model="TiQuForm.NewsSampleType" @change="choosetype" style="width:100%" placeholder="请选择">
-                <el-option v-for="item in sampletypes" :label="item.Name" :value="item.Id+''" :key="item"></el-option>
+                <el-option v-for="item in sampletypes" :label="item.Name" :value="item.Id+''" :key="item.Id"></el-option>
               </el-select>
             </el-form-item>
           </el-col>
@@ -67,7 +67,7 @@
               <el-input v-model="TiQuForm.NewCapacity" placeholder="容量" style="width:50%">
               </el-input>
               <el-select v-model="TiQuForm.NewsUnit" style="width:48%" placeholder="单位">
-                <el-option v-for="item in sampeunitlist" :label="item.Value" :value="item.Value" :key="item">
+                <el-option v-for="item in sampeunitlist" :label="item.Value" :value="item.Value" :key="item.Id">
                 </el-option>
               </el-select>
             </el-form-item>
@@ -107,7 +107,7 @@
       },
       sampleinfo: {}
     },
-    created() {
+    created () {
       this.getextends()
       this.getsampetypeunit()
       // 获取自动生成编码数据
@@ -119,7 +119,7 @@
       })
     },
     watch: {
-      visible(val) {
+      visible (val) {
         this.selfVisible = val
         if (this.visible) {
           this.TiQuForm.SamplingOrgan = this.sampleinfo.SamplingOrgan
@@ -128,52 +128,52 @@
           this.createoptions
         }
       },
-      selfVisible(val) {
+      selfVisible (val) {
         this.$emit('update:visible', val)
       }
     },
-    data() {
+    data () {
       var checkCapacityUsed = (rule, value, callback) => {
-        if (value === '') {
-          callback(new Error('请输入取用容量'))
-          return
-        }
-        if (!isNaN(parseFloat(value)) && !isNaN(value)) {
-          if (parseFloat(value) <= 0) {
-            callback(new Error('请输入大于0的数字值'))
+      if (value === '') {
+        callback(new Error('请输入取用容量'))
+        return
+      }
+      if (!isNaN(parseFloat(value)) && !isNaN(value)) {
+        if (parseFloat(value) <= 0) {
+          callback(new Error('请输入大于0的数字值'))
+          
+        } else {
+          if (parseFloat(value) > this.sampleinfo.Capacity) {
+            callback(new Error('取用量不能大于可用容量'))
+            return
+          } else if (parseFloat(value) === this.sampleinfo.Capacity && this.TiQuForm.TiQuRadio !== 3) {
+            callback(new Error('剩余容量为0,不能再次存入'))
             return
-          } else {
-            if (parseFloat(value) > this.sampleinfo.Capacity) {
-              callback(new Error('取用量不能大于可用容量'))
-              return
-            } else if (parseFloat(value) === this.sampleinfo.Capacity && this.TiQuForm.TiQuRadio !== 3) {
-              callback(new Error('剩余容量为0,不能再次存入'))
-              return
-            }
-            callback()
           }
-        } else {
-          callback(new Error('请输入正确数字值'))
-          return
+          callback()
         }
+      } else {
+        callback(new Error('请输入正确数字值'))
+        return
       }
+    }
       var checkNewCapacity = (rule, value, callback) => {
-        if (value === '') {
-          callback(new Error('请输入新样本容量'))
-          return
-        }
-        if (!isNaN(parseFloat(value)) && !isNaN(value)) {
-          if (parseFloat(value) <= 0) {
-            callback(new Error('请输入大于0的数字值'))
-            return
-          } else {
-            callback()
-          }
+      if (value === '') {
+        callback(new Error('请输入新样本容量'))
+        return
+      }
+      if (!isNaN(parseFloat(value)) && !isNaN(value)) {
+        if (parseFloat(value) <= 0) {
+          callback(new Error('请输入大于0的数字值'))
+          
         } else {
-          callback(new Error('请输入正确数字值'))
-          return
+          callback()
         }
+      } else {
+        callback(new Error('请输入正确数字值'))
+        return
       }
+    }
       var checkBarCode = (rule, value, callback) => {
         if (value === '') {
           callback()
@@ -245,16 +245,16 @@
     },
     methods: {
       // 样本类型
-      getextends() {
+      getextends () {
         let _this = this
         this.$axios.get('sampleinput/getsampletype', {
-            _currentPage: -1
-          })
+          _currentPage: -1
+        })
           .then(res => {
             _this.sampletypes = res.data.items
           }).catch(() => {})
       },
-      getsampetypeunit() {
+      getsampetypeunit () {
         // 获取样本单位
         let _this = this
         _this.$axios.get('sampletype/sunitajax', {})
@@ -262,7 +262,7 @@
             _this.sampeunitlist = res.data
           })
       },
-      getautocodedata() {
+      getautocodedata () {
         let _this = this
         // request
         // 获取冻存架信息
@@ -280,7 +280,7 @@
             console.error(err)
           })
       },
-      choosetype(v) {
+      choosetype (v) {
         // 获取样本类型数据
         let _this = this
         _this.$axios.get('sampletype/sampletypeajax?id=' + v, {})
@@ -294,7 +294,7 @@
             }
           })
       },
-      getautobarcode(samptype, samporg) {
+      getautobarcode (samptype, samporg) {
         // 获取自动编码
         let _this = this
         _this.$axios.get('sampleoperation/getautobarcode?SampleType=' + samptype + '&fid=' + samporg +
@@ -304,7 +304,7 @@
             _this.TiQuForm.NewsSampleCode = res.data.barcode
           })
       },
-      chooseorgange(value) {
+      chooseorgange (value) {
         let _this = this
         if (_this.TiQuForm.code_default === 'true' && _this.TiQuForm.SamplingOrgan !== '') {
           if (_this.TiQuForm.coderule_sampletype_flag !== 1) {
@@ -314,7 +314,7 @@
           _this.getautobarcode(_this.TiQuForm.NewsSampleType, _this.TiQuForm.SamplingOrgan)
         }
       },
-      savedata() {
+      savedata () {
         this.$refs['TiQuFormref'].validate((valid) => {
           if (valid) {
             let _this = this
@@ -341,7 +341,6 @@
       }
     }
   }
-
 </script>
 
 <style>

+ 919 - 0
src/dashoo.cn/frontend_web/src/components/samples/batchadddialog.vue

@@ -0,0 +1,919 @@
+/* eslint-disable no-debugger */
+<style>
+  .input-with-select .el-select .el-input {
+    width: 110px;
+  }
+
+  .input-with-select .el-input-group__append {
+    background-color: #fff;
+  }
+
+</style>
+
+<template>
+    <el-dialog title="批量添加" :visible.sync="visible" width="1000px" :before-close="handleDialogClose">
+      <el-form ref="samplemanageform" :rules="sampleformrule" :model="sampleform" label-width="100px">
+        <el-row>
+          <el-col :span="8">
+            <el-form-item label="样本数量" prop="SampleNumber">
+              <el-input v-model="sampleform.SampleNumber"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本条码" prop="BarCode">
+              <el-input v-model="sampleform.BarCode" placeholder="为空默认自动生成" :disabled="disabledbarcode"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本类型" required prop="SampleType">
+              <el-select v-model="sampleform.SampleType" clearable placeholder="请选择" style="width:100%" ref="SampleTypeselect"
+                @change="choosetype" :disabled="disabledsampletype">
+                <el-option v-for="item in sampletypelist" :label="item.label" :value="item.value" :key="item.value">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本编码" required prop="SampleCode">
+              <el-input v-model="sampleform.SampleCode" :disabled="disabledsamplecode" @blur="blursamplecode"
+                placeholder="样本编码"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本名称">
+              <el-input v-model="sampleform.Name" placeholder="样本名称"></el-input>
+            </el-form-item>
+          </el-col>
+          
+          <el-col :span="8">
+            <el-form-item label="可用容量" placeholder="可用容量">
+              <el-input v-model="sampleform.Capacitystr" :disabled="disabledcapacity" placeholder="可用容量"></el-input>
+            </el-form-item>
+          </el-col>
+
+          <el-col :span="8">
+            <el-form-item label="容量单位">
+              <el-select v-model="sampleform.Unit" clearable style="width:100%" :disabled="disabledunit">
+                <el-option v-for="item in sampeunitlist" :label="item.Value" :value="item.Value" :key="item.Value">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          
+          <el-col :span="8">
+            <el-form-item label="接收日期">
+              <el-date-picker style="width: 100%" v-model="sampleform.ReceiveDatedate" type="date" :clearable="false"
+                placeholder="请选择接收日期" :disabled="diaabledreceiveDate">
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="有效日期">
+              <el-date-picker style="width: 70%" v-model="sampleform.ValidityDatedate" type="date" :clearable="false"
+                :placeholder="sampleform.Isyongjiu ? '永久' : '请选择有效日期'"
+                :disabled="disabledvaliditydate || sampleform.Isyongjiu">
+              </el-date-picker>
+              <el-checkbox v-model="sampleform.Isyongjiu" style="float:right" :disabled="diaabledyongjiu">永久
+              </el-checkbox>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本内码" v-if="acc !='srNA2'">
+              <el-input v-model="sampleform.InnerCode" placeholder="样本内码"></el-input>
+            </el-form-item>
+          </el-col>
+          <!-- <el-col :span="8">
+            <el-form-item label="样本来源" v-if="acc !='sBBo4' && acc != 'ssqOy' && acc != 'saB4v'">
+              <el-input v-model="sampleform.SourceName" placeholder="样本来源" style="width:68%" disabled></el-input>
+              <el-button type="primary" :disabled="disabledsourcebutton" style="width:30%"
+                @click="dialogsamplesourceVisible = true" class="btnbox">选择1</el-button>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本来源" v-if="acc =='sBBo4' || acc == 'saB4v'">
+              <el-input v-model="sampleform.SourceName" placeholder="样本来源" style="width:68%" disabled></el-input>
+              <el-button type="primary" :disabled="disabledanimalbutton" style="width:30%"
+                @click="animalSourceVisible = true" class="btnbox">选择2</el-button>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="样本来源" v-if="acc =='ssqOy'">
+              <el-input v-model="sampleform.SourceName" placeholder="样本来源" style="width:68%" disabled></el-input>
+              <el-button type="primary" :disabled="disabledanimalbutton" style="width:30%"
+                @click="microSourceVisible = true" class="btnbox">选择3</el-button>
+            </el-form-item>
+          </el-col> -->
+          <el-col :span="24">
+            <el-form-item label="备注">
+              <el-input v-model="sampleform.Remark" type="textarea" :rows="1" placeholder="样本备注"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="录入人">
+              <el-select ref="reflrrselect" v-model="sampleform.CreateUserId" style="width:100%">
+                <el-option v-for="item in userlist" :label="item.Realname" :value="item.Id" :key="item.Id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="8">
+            <el-form-item label="所属分组">
+              <el-select ref="refGroup" multiple filterable default-first-option v-model="GroupIdOption"
+                placeholder="请选择" style="width: 100%">
+                <el-option v-for="item in groupList" :key="item.Key" :label="item.Value" :value="item.Id">
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item>
+              <el-checkbox :disabled="disabledcheckprint" v-model="sampleform.autoprintchecked" class="title">
+                新增保存时打印标签(如若勾选,请确保已经设置过默认打印方案)
+              </el-checkbox>
+            </el-form-item>
+          </el-col>
+          
+        </el-row>
+
+        <el-tabs tab-position="top" v-model="Tabs">
+          <el-tab-pane :label="groupname" :name="groupname" :key="groupname" v-for="groupname in groupnameList">
+            <el-card class="box-card infocard">
+              <el-row>
+                <template v-for="(item, index) in typetykzlist">
+                  <el-col :span="(item.FieldType === '3')? 24:8" :key="index" v-if="item.GroupName === groupname">
+                    <el-form-item :label="item.Name">
+                      <el-input v-model="item.FieldDefault" v-if="item.FieldType === '1'" :placeholder="'请输入'+item.Name"
+                        auto-complete="off"></el-input>
+
+                      <el-select v-model="item.FieldDefault" v-if="item.FieldType === '2'" clearable
+                        :placeholder="'请选择'+item.Name" style="width:100%">
+                        <el-option :label="v" :value="v" :key="v" v-for=" v in item.FieldContent.split(',')">
+                        </el-option>
+                      </el-select>
+
+                      <el-input v-model="item.FieldDefault" v-if="item.FieldType === '3'" :placeholder="'请输入'+item.Name"
+                        type="textarea" :rows=3 auto-complete="off"></el-input>
+
+                      <el-date-picker v-model="item.FieldDefault" v-if="item.FieldType === '4'" type="datetime"
+                        style="width:100%" placeholder="选择日期"></el-date-picker>
+
+                      <el-button plain v-model="item.FieldDefault" v-if="item.FieldType === '5'" type="primary"
+                        size="mini" class="el-button--small" style="margin-left: 8px" @click="getitem(item)">上传图片
+                      </el-button>
+                    </el-form-item>
+                  </el-col>
+                </template>
+
+              </el-row>
+            </el-card>
+            <el-dialog :title="ImageTitle" width="80%" :visible.sync="imageDialog">
+              <el-upload action="" :before-upload="beforeAvatarUpload" :on-preview="handlePictureCardPreview"
+                :http-request="uploadrequest" :on-success="handleAvatarSuccess" :on-remove="handleRemove"
+                :file-list="imagefilelist" list-type="picture">
+                <el-button size="small" type="primary">点击上传</el-button>
+                <div slot="tip" class="el-upload__tip">只能上传jpg/png文件</div>
+              </el-upload>
+            </el-dialog>
+          </el-tab-pane>
+        </el-tabs>
+      </el-form>
+      <div slot="footer" class="dialog-footer" style="margin-top:-30px;">
+        <el-button @click="handleDialogClose()" size="mini">取 消</el-button>
+        <el-button type="primary" @click="savedata()" size="mini">确 定</el-button>
+      </div>
+    </el-dialog>
+</template>
+<script>
+  import {
+    mapGetters
+  } from 'vuex'
+  import axios from 'axios'
+  export default {
+    name: 'batchadddialog',
+    props: {
+      visible: {
+        type: Boolean,
+        default: false
+      },
+      model: {}
+    },
+    created () {
+      this.acc = this.authUser.Profile.AccCode
+    },
+    computed: mapGetters({
+      authUser: 'authUser'
+    }),
+    data () {
+      var checkSampleType = (rule, value, callback) => {
+        if (value === '') {
+          callback(new Error('请选择样本类型'))
+        } else {
+          callback()
+        }
+      }
+      var checkCapacity = (rule, value, callback) => {
+        if (!isNaN(parseFloat(value)) && !isNaN(value)) {
+          callback()
+          // }
+        } else {
+          callback(new Error('请输入正确数字值'))
+        }
+      }
+      var checkSampleCode = (rule, value, callback) => {
+        if (value === '') {
+          callback(new Error('请输入样本编码'))
+        } else {
+          callback()
+        }
+      }
+      var checkBarCode = (rule, value, callback) => {
+        let _this = this
+        if (_this.sampleform.type_flag === 'add') {
+          if (value === '') {
+            callback()
+            return
+          }
+          _this.$axios.get('/sampleoperation/validformdetailbarcoder?param=' + value, {})
+            .then(res => {
+              if (res.data.code === 0) {
+                callback()
+              } else {
+                callback(new Error(res.data.message))
+              }
+            })
+            .catch(err => {
+              // handle error
+              callback(new Error('网络异常请重试'))
+              console.error(err)
+            })
+        } else {
+          callback()
+        }
+      }
+      // 校验输入的样本数量与所选冻存盒数量大小关系
+      var checkSampleNumber = (rule, value, callback) => {
+        let _this = this
+        if (_this.sampleform.type_flag === 'add') {
+          let params = {
+            equipmentId: _this.sampleform.eid,
+            batchAddSelectBox: _this.batchAddSelectBox.join('-')
+          }
+          _this.$axios.get('/shelfset/getCountByBoxs', {params})
+            .then(res => {
+              if (res.data.code === 0) {
+                if (value <= res.data.item) {
+                  callback()
+                } else {
+                  callback(new Error('样本数量大于所选冻存盒总容量'))
+                }
+              } else {
+                callback(new Error(res.data.message))
+              }
+            })
+            .catch(err => {
+              // handle error
+              callback(new Error('网络异常请重试'))
+              console.error(err)
+            })
+        } else {
+          callback()
+        }
+      }
+      return {
+        disabledbarcode: false,
+        disabledsamplecode: false,
+        disabledsampletype: false,
+        disabledvaliditydate: false,
+        disabledsourcebutton: false,
+        disabledanimalbutton: false,
+        disabledcheckprint: false,
+        diaabledreceiveDate: false,
+        diaabledyongjiu: false,
+        disabledsamplingsite: false,
+        disabledcapacity: false,
+        disabledunit: false,
+        disabledbtnpreopera: false,
+        sampleform: {
+          id: 0,
+          BarCode: '', // 样本条码
+          SampleCode: '', // 样本编码
+          SampleType: '', // 样本类型
+          SampleTypeName: '',
+          SamplingOrgan: '', // 组织器官
+          SamplingSite: '', // 取材部位
+          SamplingSiteName: '',
+          Name: '', // 名称
+          ReceiveDatedate: new Date(), // 接收日期
+          Capacitystr: '0', // 可用容量
+          Unit: '', // 单位(容量)
+          ValidityDatedate: '', // 有效日期
+          InnerCode: '', // 样本内码
+          SourceName: '', // 样本来源
+          Remark: '', // 备注----------------------
+          Isyongjiu: false, // 是否永久
+          code_default: '',
+          code_codeId: 0,
+          code_lastnum: '',
+          coderule_samplingorgan_flag: 0,
+          coderule_sampletype_flag: 0,
+          eid: '',
+          x_shelf: '',
+          y_shelf: '',
+          x_box: '',
+          y_box: '',
+          min_x: '',
+          min_y: '',
+          autoprintchecked: true,
+          type_flag: 'add', // 标记点预录入或者没点
+          saveandadd: '', // 保存并新增:1;保存新增分管:2
+          // SampleTypeName: '', // 样本类型名称
+          // zuzhiName: '', // 组织器官名称
+          // SamplingSiteName: '', // 取材部位名称
+          PositionStr: '', // 样本位置信息
+          CreateUserId: 0, // 录入人
+          CreateBy: '', // 录入人
+          SampleNumber: 0
+        },
+        sampleformrule: {
+          SampleCode: [{
+            validator: checkSampleCode,
+            trigger: 'blur'
+          }],
+          SampleType: [{
+            validator: checkSampleType,
+            trigger: 'change'
+          }],
+          Capacitystr: [{
+            validator: checkCapacity,
+            trigger: 'blur'
+          }],
+          BarCode: [{
+            validator: checkBarCode,
+            trigger: 'blur'
+          }],
+          SampleNumber: [{
+            validator: checkSampleNumber,
+            trigger: 'blur'
+          }]
+        },
+        Tabs: '',
+        groupnameList: [], // 扩展字段分组列表
+        imageDialog: false,
+        ImageTitle: '',
+        imagefiles: '',
+        imagefilelist: [],
+        imagenewlist: '', // 删除图片时使用
+        dialogImageUrl: '',
+        dialogVisible: false,
+
+        groupList: [], // 合作用户分组
+        GroupIdOption: [],
+        GroupId: '',
+        GroupName: '',
+
+        dialogsamplesourceVisible: false,
+        animalSourceVisible: false,
+        microSourceVisible: false,
+        //  选项的基础资料
+        sampletypelist: [],
+        sampeunitlist: [],
+        selectedorgan: [], // 级联所选组织结构
+        organlist2: [],
+        typetykzlist: [], // 特有扩展
+        // publickzlist: [], // 公共扩展
+        userlist: [], // 录入人
+        acc: '',
+        batchAddSelectBox: []
+      }
+    },
+    created () {
+      // initial data
+      this.getType()
+      this.getsampetypeunit()
+      this.getsametypetreelist()
+      this.getautocodedata()
+      // 获取公共扩展
+      // this.getpublickz()
+      this.acc = this.authUser.Profile.AccCode
+      // 获取录入人
+      this.getuserlist()
+      // 获取合作用户分组列表
+      this.getGrouplist()
+    },
+    methods: {
+      handleDialogClose () {
+        this.$emit('close')
+      },
+      savedata () {
+        // eslint-disable-next-line no-debugger
+        let _this = this
+  
+        this.$refs['samplemanageform'].validate((valid) => {
+          if (valid) {
+            // 拼接扩展字段
+            let jsonstr = _this.getkuozhandata()
+            // 转换为json对象
+            let jsonobj = JSON.parse(jsonstr)
+            // 拼接两个对象
+            _this.sampleform.CreateBy = _this.$refs.reflrrselect.selectedLabel
+            _this.sampleform.SampleType = parseInt(_this.sampleform.SampleType)
+            _this.sampleform.SampleNumber = parseInt(_this.sampleform.SampleNumber)
+            _this.sampleform.SampleTypeName = _this.$refs.SampleTypeselect.selectedLabel
+            let params = _this.sampleform
+            params = Object.assign(params, jsonobj)
+            // 时间格式数据拼接
+            if (_this.sampleform.ReceiveDatedate && _this.sampleform.ReceiveDatedate.getTime() > 0) {
+              params = Object.assign(params, {
+                ReceiveDateint: _this.sampleform.ReceiveDatedate.getTime()
+              })
+            }
+            if (_this.sampleform.ValidityDatedate && _this.sampleform.ValidityDatedate.getTime() > 0) {
+              params = Object.assign(params, {
+                ValidityDateint: _this.sampleform.ValidityDatedate.getTime()
+              })
+            }
+            if (_this.GroupIdOption.length > 0) {
+              _this.GroupId = _this.GroupIdOption.join(',')
+              let tempOfficers = []
+              for (let idx in this.GroupIdOption) {
+                let selectId = this.GroupIdOption[idx]
+                for (let idx2 in this.groupList) {
+                  let item = this.groupList[idx2]
+                  if (item.Id === selectId) {
+                    tempOfficers.push(item.Value)
+                    break
+                  }
+                }
+              }
+              _this.GroupName = tempOfficers.join(',')
+            }
+            _this.$axios.post('/sampleoperation/saveBatchAdd?groupid=' + _this.GroupId + '&groupname=' + _this.GroupName + '&batchAddSelectBox=' + _this.batchAddSelectBox.join('-'), params)
+              .then(res => {
+                this.handleDialogClose()
+                if (res.data.code === 0) {
+                  this.$message({
+                    type: 'success',
+                    message: res.data.message
+                  })
+                } else if (res.data.code === 10 || res.data.code === 11) { // 保存成功后打印
+                  this.$message({
+                    type: 'success',
+                    message: res.data.message
+                  })
+                  // 自动打印
+                  if (res.data.item !== '') {
+                    let printparams = res.data.item.split(',')
+                    if (printparams.length === 3 && printparams[0] !== '' && printparams[1] !== '' && printparams[2] !== '') {
+                      // 执行打印操作
+                      window.PrintReport(printparams[1], `samplespreinput,${printparams[2]},${printparams[0]}`)
+                    }
+                  }
+                } else {
+                  this.$message({
+                    type: 'warning',
+                    message: res.data.message
+                  })
+                }
+              })
+              .catch(err => {
+                // handle error
+                console.error(err)
+              })
+          }
+        })
+      },
+      getkuozhandata () {
+        // 拼接扩展字段
+        let _this = this
+        let jsonstr = ''
+        // 公共扩展
+        // for (let i = 0; i < _this.publickzlist.length; i++) {
+        //   jsonstr += '"' + _this.publickzlist[i].FieldName + '" : "' + _this.publickzlist[i].FieldDefault + '",'
+        // }
+        // 特有扩展
+        for (let i = 0; i < _this.typetykzlist.length; i++) {
+          jsonstr += '"' + _this.typetykzlist[i].FieldName + '" : "' + _this.typetykzlist[i].FieldDefault + '",'
+        }
+        jsonstr = '{' + jsonstr.substring(0, jsonstr.length - 1) + '}'
+        return jsonstr
+      },
+      savesample () {
+        let _this = this
+        if (_this.sampleform.type_flag === 'add') {
+          if (_this.sampleform.InnerCode != '') {
+            _this.trueInnoCode()
+          } else {
+            _this.saveadd()
+          }
+        } else if (_this.sampleform.type_flag === 'edit') {
+          if (_this.sampleform.id > 0) {
+            _this.saveedit()
+          } else {
+            _this.$message({
+              type: 'warning',
+              message: '请求参数有错误!请重新操作!'
+            })
+          }
+        } else {
+          _this.$message({
+            type: 'warning',
+            message: '请求参数有错误!请重新操作!'
+          })
+        }
+      },
+      trueInnoCode () {
+        let _this = this
+        _this.$axios.get('/samplepreinput/innernomakesure?InnerCode=' + this.sampleform.InnerCode, {})
+          .then(function (response) {
+            let innerTotal = response.data.items
+            if (innerTotal === 0) {
+              _this.saveadd()
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: '样本内码重复!'
+              })
+            }
+          })
+      },
+  
+      getautocodedata () {
+        let _this = this
+        // 获取冻存架信息
+        _this.$axios.get('/sampleoperation/getautocodedata', {})
+          .then(res => {
+            _this.sampleform.code_default = res.data.code_default
+            _this.sampleform.code_codeId = res.data.code_codeId
+            _this.sampleform.code_lastnum = res.data.code_lastnum
+            _this.sampleform.coderule_samplingorgan_flag = res.data.coderule_samplingorgan_flag
+            _this.sampleform.coderule_sampletype_flag = res.data.coderule_sampletype_flag
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+      getsampetypeunit () {
+        // 获取样本单位
+        let _this = this
+        _this.$axios.get('/sampletype/sunitajax', {})
+          .then(res => {
+            _this.sampeunitlist = res.data
+          })
+      },
+  
+      choosetype (v) {
+        // 获取特有扩展
+        let _this = this
+        _this.groupnameList = []
+        _this.typetykzlist = []
+        if (_this.sampleform.type_flag === 'add' && v !== '') {
+          _this.$axios.get('/sampletype/gettykzzdgroup?SampleType=' + v, {})
+            .then(res => {
+              console.log('kuozhan', res)
+              for (var i = 0; i < res.data.length; i++) {
+                if (res.data[i].GroupName != '') {
+                  _this.groupnameList.push(res.data[i].GroupName)
+                }
+              }
+              _this.Tabs = _this.groupnameList[0]
+              _this.getSpecialkz(v)
+              _this.getCodeRule()
+            })
+        }
+      },
+      getSpecialkz (v) {
+        // 获取特有扩展
+        let _this = this
+        if (_this.sampleform.type_flag === 'add' && v !== '') {
+          _this.$axios.get('/sampletype/gettykzzd?SampleType=' + v, {})
+            .then(res => {
+              _this.typetykzlist = res.data
+              // 获取样本类型数据
+              _this.getsampetypedata(v)
+            })
+        }
+      },
+      getsampetypedata (v) {
+        // 获取样本类型数据
+        let _this = this
+        _this.$axios.get('/sampletype/sampletypeajax?id=' + v, {})
+          .then(res => {
+            _this.sampleform.Capacitystr = res.data.SampleType.DefaultCapacity + ''
+            if (res.data.VHours === '5000-1-1 23:59:59') {
+              _this.sampleform.Isyongjiu = true
+            } else {
+              _this.sampleform.ValidityDatedate = new Date(res.data.VHours)
+              _this.sampleform.Isyongjiu = false
+            }
+            _this.sampleform.Unit = res.data.SampleType.Unit
+            if (_this.sampleform.code_default === 'true' && _this.sampleform.coderule_sampletype_flag === 1) {
+              if (_this.sampleform.coderule_samplingorgan_flag !== 1 || (_this.sampleform
+                .coderule_samplingorgan_flag ===
+                  1 && _this.selectedorgan.length > 0)) {
+                let sampletype = _this.sampleform.SampleType
+                let sampleselectedorgan = ''
+                if (_this.selectedorgan.length > 0) {
+                  sampleselectedorgan = _this.selectedorgan[_this.selectedorgan.length - 1]
+                }
+                _this.getautobarcode(sampletype, sampleselectedorgan)
+              }
+            }
+          })
+      },
+      getCodeRule () {
+        this.$axios.get('/sampleoperation/getcoderule', {})
+          .then(res => {
+            let sampletype = this.sampleform.SampleType
+            this.getautobarcode(sampletype)
+          })
+      },
+      getautobarcode (samptype, samporg) {
+        // 获取自动编码
+        let _this = this
+        _this.$axios.get('/sampleoperation/getautobarcode?SampleType=' + samptype + '&fid=' + samporg, {})
+          .then(res => {
+            _this.sampleform.code_lastnum = res.data.num
+            _this.sampleform.SampleCode = res.data.barcode
+          })
+      },
+      getsametypetreelist () {
+        let _this = this
+        // request
+        _this.$axios.get('/sampleorgan/gettreelist', {})
+          .then(res => {
+            _this.organlist2 = window.toolfun_gettreejson(res.data, 'id', 'pId', 'id,name,code')
+          })
+          .catch(err => {
+            console.error(err)
+          })
+      },
+
+      blursamplecode () {
+        let _this = this
+        if (_this.sampleform.SampleCode !== '' && _this.sampleform.type_flag === 'add') {
+          _this.$axios.get('/sampleoperation/getsamplebysamplecode?samplecode=' + this.sampleform.SampleCode, {})
+            .then(res => {
+              if (res.data.SampleCode !== '') {
+                _this.disabledsamplecode = true
+                _this.disabledsampletype = true
+                _this.disabledsourcebutton = true
+                _this.disabledanimalbutton = true
+                _this.sampleform.BarCode = ''
+                _this.sampleform.SampleCode = res.data.SampleCode
+                _this.sampleform.SampleType = res.data.SampleType
+                _this.getparentcodebytopcode(res.data.SamplingOrgan)
+                _this.sampleform.SamplingSite = res.data.SamplingSite
+                _this.sampleform.Name = res.data.Name
+                _this.sampleform.SourceId = res.data.SourceId
+                _this.sampleform.SourceIdCard = res.data.SourceIdCard
+                _this.sampleform.SourceName = res.data.SourceName
+                if (res.data.ReceiveDate.substring(0, 3) === '000') {
+                  _this.sampleform.ReceiveDatedate = null
+                } else {
+                  _this.sampleform.ReceiveDatedate = new Date(res.data.ReceiveDate)
+                }
+                _this.geteditsampetypedata(_this.sampleform.SampleType)
+                // 定义window变量,eval使用需要
+                let foo = window
+                foo.samplepreoperav = res.data
+                // 给公共扩展信息赋值
+                // for (let i = 0; i < _this.publickzlist.length; i++) {
+                //   _this.publickzlist[i].FieldDefault = foo.eval('samplepreoperav.' + _this.publickzlist[i].FieldName)
+                // }
+                // 获取特有扩展并给特有扩展信息赋值
+                _this.getItemGroupName(res.data)
+              }
+            })
+        }
+      },
+      getItemGroupName (val) {
+        // 获取特有扩展
+        let _this = this
+        _this.$axios.get('/sampletype/gettykzzdgroup?SampleType=' + val.SampleType, {})
+          .then(res => {
+            for (var i = 0; i < res.data.length; i++) {
+              if (res.data[i].GroupName != '') {
+                _this.groupnameList.push(res.data[i].GroupName)
+              }
+            }
+            _this.Tabs = _this.groupnameList[0]
+            _this.getItemDetail(val)
+          })
+      },
+      getItemDetail (val) {
+        // 获取特有扩展并赋值
+        if (val && val.SampleType > 0) {
+          let _this = this
+          _this.$axios.get('/sampletype/gettykzzd?SampleType=' + val.SampleType, {})
+            .then(res => {
+              _this.typetykzlist = res.data
+              // 定义window变量,eval使用需要
+              let foo = window
+              foo.typetykzsampedit = val
+              // 给扩展信息赋值
+              for (let i = 0; i < this.typetykzlist.length; i++) {
+                if (this.typetykzlist[i].FieldType == '4') {
+                  this.typetykzlist[i].FieldDefault = foo.eval('typetykzsampedit.' + this.typetykzlist[i].FieldName)
+                    .substr(
+                      0, 24)
+                } else {
+                  this.typetykzlist[i].FieldDefault = foo.eval('typetykzsampedit.' + this.typetykzlist[i].FieldName)
+                }
+              }
+            })
+        }
+      },
+      geteditsampetypedata (v) {
+        // 获取样本类型数据
+        let _this = this
+        _this.$axios.get('/sampletype/sampletypeajax?id=' + v, {})
+          .then(res => {
+            // response
+            _this.sampleform.Capacitystr = res.data.SampleType.DefaultCapacity + ''
+            if (res.data.VHours === '5000-1-1 23:59:59') {
+              _this.sampleform.Isyongjiu = true
+            } else {
+              _this.sampleform.ValidityDatedate = new Date(res.data.VHours)
+              _this.sampleform.Isyongjiu = false
+            }
+          })
+      },
+      getparentcodebytopcode (v) {
+        let _this = this
+        _this.$axios.get('/sampleorgan/getparentcodebytopcode/' + v, {})
+          .then(res => {
+            _this.selectedorgan = []
+            let pidarr = res.data.split(',')
+            for (var i = pidarr.length - 1; i >= 0; i--) {
+              if (pidarr[i] !== '0') {
+                _this.selectedorgan.push(pidarr[i])
+              }
+            }
+            _this.getOrgan(_this.selectedorgan[_this.selectedorgan.length - 1])
+          })
+      },
+
+      // 获取样本类型
+      getType () {
+        let _this = this
+        _this.$axios.get('/sampletype/list', {})
+          .then(res => {
+            _this.sampletypelist = []
+            for (var i = 0; i < res.data.currentItemCount; i++) {
+              _this.sampletypelist.push({
+                label: res.data.items[i].Name,
+                code: res.data.items[i].Code,
+                photo: res.data.items[i].Photo,
+                value: res.data.items[i].Id + ''
+              })
+            }
+          })
+      },
+      getuserlist () {
+        this.$axios.get('users/list', {})
+          .then(res => {
+            // response
+            this.userlist = res.data.items
+            // this.userlist.unshift({
+            //   'Id': this.authUser.Profile.Id,
+            //   'Realname': this.authUser.Profile.Realname
+            // })
+            this.sampleform.CreateUserId = this.authUser.Profile.Id
+          })
+          .catch(err => {
+            // handle error
+            console.error(err)
+          })
+      },
+
+      // 获取当前上传图片字段
+      getitem (val) {
+        this.imagefiles = ''
+        this.imagefilelist = []
+        this.ImageTitle = val.Name
+        // 显示已存储图片
+        if (val.FieldDefault != '') {
+          let imagearr = []
+          imagearr = val.FieldDefault.split('|')
+          for (var i = 0; i < imagearr.length; i++) {
+            if (imagearr[i] !== '') {
+              this.imagefilelist.unshift({
+                'name': 'picture - ' + (i + 1),
+                'url': 'http://' + imagearr[i]
+              })
+            }
+          }
+          this.imagefiles = val.FieldDefault
+        }
+        this.imageDialog = true
+        this.extendId = val.Id
+      },
+      // 扩展字段图片类型处理
+      beforeAvatarUpload (file) {
+        const isJPG = (file.type.indexOf('image/') === 0)
+        const isLt2M = file.size / 1024 / 1024 < 10
+        if (!isJPG) {
+          this.$message.error('上传影像文件只能是 图片 格式!')
+          return false
+        }
+        if (!isLt2M) {
+          this.$message.error('上传影像图片大小不能超过 1MB!')
+          return false
+        }
+        return true
+      },
+      handlePictureCardPreview (file) {
+        this.dialogImageUrl = file.url
+        this.dialogVisible = true
+      },
+      uploadrequest (option) {
+        let _this = this
+        axios.post(process.env.upfilehost, {})
+          .then(function (res) {
+            if (res.data && res.data.fid && res.data.fid !== '') {
+              option.action = `http://${res.data.url}/${res.data.fid}`
+              _this.uploadimg = {
+                uid: option.file.uid,
+                url: res.data.publicUrl,
+                fid: res.data.fid
+              }
+              uploadajax(option)
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: '未上传成功!请刷新界面重新上传!'
+              })
+            }
+          })
+          .catch(function (error) {
+            console.log(error)
+            _this.$message({
+              type: 'warning',
+              message: '未上传成功!请重新上传!'
+            })
+          })
+      },
+      handleAvatarSuccess (res, file) {
+        for (var i = 0; i < this.typetykzlist.length; i++) {
+          if (this.typetykzlist[i].Id == this.extendId) {
+            this.typetykzlist[i].FieldDefault = this.typetykzlist[i].FieldDefault +
+              `${this.uploadimg.url}/${this.uploadimg.fid}|`
+          }
+        }
+        this.imagefiles = ''
+      },
+      handleRemove (file, fileList) {
+        console.log(this.imagefilelist)
+        for (var i = 0; i < this.imagefilelist.length; i++) {
+          if (this.imagefilelist[i].uid != file.uid) {
+            this.imagenewlist = this.imagenewlist + this.imagefilelist[i].url.substring(7, 42) + `|`
+          }
+        }
+        for (var j = 0; j < this.typetykzlist.length; j++) {
+          if (this.typetykzlist[j].Id == this.extendId) {
+            this.typetykzlist[j].FieldDefault = this.imagenewlist
+          }
+        }
+      },
+
+      // 合作用户分组处理
+      getGroup (val) {
+        this.$axios.get('samplesgroup/groupbybarcode/' + val, {})
+          .then(res => {
+            this.GroupIdOption = []
+            if (res.data.GroupId != '') {
+              let tempArr = res.data.GroupId.split(',')
+              for (let idx in tempArr) {
+                this.GroupIdOption.push(parseInt(tempArr[idx]))
+              }
+            }
+          })
+          .catch(err => {
+            // handle error
+            console.error(err)
+          })
+      },
+      getGrouplist () {
+        let _this = this
+        _this.$axios.get('/samplesgroup/grouplist', {})
+          .then(res => {
+            _this.groupList = res.data
+          })
+      }
+
+    }
+  }
+</script>
+
+<style lang="scss">
+  .donorsggextendcard .el-card__header {
+    padding: 5px 10px;
+    font-size: 10px;
+  }
+
+  .donorsggextendcard .el-card__body {
+    padding: 5px;
+    margin: -11px 0;
+  }
+
+</style>

+ 90 - 34
src/dashoo.cn/frontend_web/src/pages/equipment/_opera/manage_new.vue

@@ -26,7 +26,8 @@
         <span style="float: right;">
           <el-button size="mini" type="primary" style="margin-left: 8px" v-if="Apply_flag==false" @click="SaveApply">保存
           </el-button>
-          <el-button size="mini" type="primary" style="margin-left: 8px" @click="exportVisible = true">导入</el-button>
+          <el-button size="mini" type="primary" style="margin-left: 8px" v-if="acc == 's71yI'" @click="showBatchAdd()">批量添加</el-button>
+          <el-button size="mini" type="primary" style="margin-left: 8px" @click="exportVisible = true">Excel导入</el-button>
           <el-button size="mini" type="primary" style="margin-left: 8px" @click="showBoxTemplate()">下载冻存盒导入模板
           </el-button>
           <el-button size="mini" type="primary" style="margin-left: 8px" @click="showEquipemplate()">下载设备模板</el-button>
@@ -63,6 +64,7 @@
                         <div v-for="b in selectdtedanguan.ColumnNum" :key="b">
                           <div class="hoverdiv" v-if="(b <= g*21) && (b > (g - 1)*21)"
                             @click="handleclk(b-1, 0, selectdtedanguan.YStation, selectdtedanguan.XStation)"
+                             @dblclick="handledbclk(b-1, 0, selectdtedanguan['A'+b],selectdtedanguan.ShelfId)"
                             v-bind:style="{
                               backgroundColor: xbox == b && ybox == 1 &&
                               xshelf == selectdtedanguan.YStation && yshelf == selectdtedanguan.XStation ? COLORARR[2] :
@@ -136,6 +138,7 @@
                           shelfs[numtoengs[ybox-1]+g] <= 75 ? COLORARR[5] :
                           (shelfs[numtoengs[ybox-1]+g] > 75 ? COLORARR[6] :
                           COLORARR[7])))))) }" @click="handleclk(g-1, ybox-1, shelfs.YStation, shelfs.XStation)"
+                           @dblclick="handledbclk(g-1, ybox-1, shelfs[numtoengs[ybox-1]+g],shelfs.ShelfId)"
                           style="margin: 1px;width:50px; height:20px;">
                         </div>
                       </div>
@@ -547,6 +550,12 @@
       :visible.sync="dialogfenzhuangVisible"></packingdialog>
     <abstractdialog @close="recoverydialogcallback" :sampleinfo="sampleinfodetail" :visible.sync="dialogtiquVisible">
     </abstractdialog>
+    <abstractdialog @close="recoverydialogcallback" :sampleinfo="sampleinfodetail" :visible.sync="dialogtiquVisible">
+    </abstractdialog>
+    <!--批量添加dialog  开始 20190725-->
+    <batchadddialog @close="batchaddDialogCallback" ref="batchadddialog"  :visible.sync="batchaddVisible">
+    </batchadddialog>
+    <!--批量添加dialog  结束 20190725-->
   </div>
 </template>
 
@@ -561,9 +570,11 @@
   import recoverydialog from '@/components/samples/recoverydialog'
   import packingdialog from '@/components/samples/packingdialog'
   import abstractdialog from '@/components/samples/abstractdialog'
+  import batchadddialog from '@/components/samples/batchadddialog'
   import {
     mapGetters
   } from 'vuex'
+  var timeTask = null //  在这里定义timeTask 为null
   export default {
     name: 'sampleoperation',
     components: {
@@ -573,7 +584,8 @@
       ChooseMicroDialog,
       recoverydialog,
       packingdialog,
-      abstractdialog
+      abstractdialog,
+      batchadddialog
     },
     computed: mapGetters({
       authUser: 'authUser'
@@ -829,6 +841,7 @@
         sampleinfoid: 0, // 所选样本的id
         code_default: false, // 样本编码是否知道生成
         extendList: [], // 特有扩展
+        batchaddVisible: false, // 批量添加对话框
         exportVisible: false, // 导入对话框
         exportfileparam: {}, // 导入文件参数
         exportfilepath: '', // 导入文件路径
@@ -3298,7 +3311,8 @@
         batchitem: '0', // 批量添加类型,1:由交接单存储过来,带有样本类型,样本来源信息;2:有制备存储过来,不带样本类型等信息
         batchstorages: [], // 批量存储的样本
         Apply_flag: true,
-        acc: ''
+        acc: '',
+        batchAddSelectBox: [] // 批量添加样本选中的盒子
       }
     },
     created () {
@@ -3684,41 +3698,68 @@
       },
 
       handleclk (xbox, ybox, xshelf, yshelf) {
+        clearTimeout(timeTask) // 首先清除计时器
+        timeTask = setTimeout(() => {
         // 清空状态
-        this.clearSampleForm()
-        let _this = this
-        var inputstr = _this.equipid + ',' + yshelf + ',' + xshelf + ',' + (xbox + 1) + ',' + (ybox + 1)
-        _this.$axios.get('/shelfset/boxdraw/' + inputstr, {})
-          .then(res => {
-            _this.selectedBox = res.data.Boxshelf
-            _this.boxSample = res.data.Boxsample
-            _this.TableHeight = _this.selectedBox.RowNum
-            _this.TableWidth = _this.selectedBox.ColumnNum
-            for (var i = 0; i < this.boxSample.length; i++) {
-              if (this.boxSample[i].Position == this.ytable + ';' + this.xtable) {
-                this.tableclk(this.boxSample[i], this.xtable, this.ytable)
+          this.clearSampleForm()
+          let _this = this
+          var inputstr = _this.equipid + ',' + yshelf + ',' + xshelf + ',' + (xbox + 1) + ',' + (ybox + 1)
+          _this.$axios.get('/shelfset/boxdraw/' + inputstr, {})
+            .then(res => {
+              _this.selectedBox = res.data.Boxshelf
+              _this.boxSample = res.data.Boxsample
+              _this.TableHeight = _this.selectedBox.RowNum
+              _this.TableWidth = _this.selectedBox.ColumnNum
+              if (this.boxSample !== null) {
+                for (var i = 0; i < this.boxSample.length; i++) {
+                  if (this.boxSample[i].Position === this.ytable + ';' + this.xtable) {
+                    this.tableclk(this.boxSample[i], this.xtable, this.ytable)
+                  }
+                }
               }
-            }
-            // 重置选择的冻存管
-            _this.dchxtable = -1
-            _this.dchytable = -1
-            // 如果是搜索进来的
-            if (_this.fristseach) {
-              _this.tableclk({
-                Id: _this.locationparam.id
-              }, _this.locationparam.y, _this.locationparam.x)
-            }
+              // 重置选择的冻存管
+              _this.dchxtable = -1
+              _this.dchytable = -1
+              // 如果是搜索进来的
+              if (_this.fristseach) {
+                _this.tableclk({
+                  Id: _this.locationparam.id
+                }, _this.locationparam.y, _this.locationparam.x)
+              }
+            })
+            .catch(err => {
+              console.error(err)
+            })
+          // 修改颜色
+          this.xshelf = xshelf
+          this.yshelf = yshelf
+          this.xbox = xbox + 1
+          this.ybox = ybox + 1
+          this.dchxtable = -1
+          this.dchytable = -1
+        }, 300) // 大概时间300ms
+      },
+      handledbclk (xbox, ybox, color, ShelfId) { // 参数1,2 是盒所在位置坐标  参数3 盒的颜色  参数4 盒所在层的id
+        console.log('双击盒', xbox, ybox, color, ShelfId)
+        clearTimeout(timeTask) // 清除
+        if (color === -1) {
+          let weizhi = (xbox + 1) + '@' + (ybox + 1) + '@' + ShelfId
+          if (this.batchAddSelectBox.indexOf(weizhi) !== -1) {
+            this.batchAddSelectBox.splice(this.batchAddSelectBox.indexOf(weizhi), 1)
+          } else {
+            this.batchAddSelectBox.push(weizhi)
+          }
+          console.log(this.batchAddSelectBox)
+          this.$message({
+            type: 'warning',
+            message: '已经选中' + this.batchAddSelectBox.length + '个冻存盒'
           })
-          .catch(err => {
-            console.error(err)
+        } else {
+          this.$message({
+            type: 'warning',
+            message: '请选择空的冻存盒'
           })
-        // 修改颜色
-        this.xshelf = xshelf
-        this.yshelf = yshelf
-        this.xbox = xbox + 1
-        this.ybox = ybox + 1
-        this.dchxtable = -1
-        this.dchytable = -1
+        }
       },
       tableclk (v, x, y) {
         this.checkPosition =
@@ -4033,6 +4074,21 @@
         this.sampleForm.SourceId = val.Id
         this.sampleForm.SourceName = val.Name
       },
+      batchaddDialogCallback (val) {
+        this.batchaddVisible = false
+      },
+      showBatchAdd () {
+        if (this.batchAddSelectBox.length > 0) {
+          this.$refs.batchadddialog.batchAddSelectBox = this.batchAddSelectBox
+          this.$refs.batchadddialog.sampleform.eid = this.$route.params.opera
+          this.batchaddVisible = true
+        } else {
+          this.$message({
+            type: 'warning',
+            message: '请选择冻存盒!'
+          })
+        }
+      },
 
       showDialog () {
         this.sampleTitle = '编辑样本'