shihang 6 anni fa
parent
commit
1642f72bd9

+ 2 - 0
src/dashoo.cn/backend/api/business/samplessource/samplessource.go

@@ -124,6 +124,8 @@ type AnimalInfo struct {
 	Latitude       string    `xorm:"VARCHAR(50)"`
 	Altitude       string    `xorm:"VARCHAR(50)"`
 	SurveyDate     time.Time `xorm:"DATE`
+	ProjectId      int       `xorm:"INT(10)"`
+	ProjectName    string    `xorm:"VARCHAR(50)"`
 	CreateUserId   int       `xorm:"INT(10)"`
 	CreateBy       string    `xorm:"VARCHAR(255)"`
 	CreateOn       time.Time `xorm:"DATETIME created"`

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

@@ -664,12 +664,14 @@ func (this *SamplesSourceController) AnimalList() {
 	name := this.GetString("Name")
 	innerno := this.GetString("InnerNo")
 	SurveyDate := this.GetString("SurveyDate")
+	CreateOn := this.GetString("CreateOn")
+	fmt.Println("[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p[p", CreateOn)
 	SourceType := this.GetString("SourceType")
 	Address := this.GetString("Address")
 
 	svc := samplessource.GetSamplesSourceService(utils.DBE)
 	where := " 1=1"
-	orderby := "SurveyDate"
+	orderby := " CreateOn "
 	asc := false
 	Order := this.GetString("Order")
 	Prop := this.GetString("Prop")
@@ -696,6 +698,14 @@ func (this *SamplesSourceController) AnimalList() {
 			where = where + " and SurveyDate>='" + minDate + "' and SurveyDate<='" + maxDate + "'"
 		}
 	}
+	if CreateOn != "" {
+		dates := strings.Split(CreateOn, ",")
+		if len(dates) == 2 {
+			minDate := dates[0]
+			maxDate := dates[1]
+			where = where + " and CreateOn>='" + minDate + "' and CreateOn<='" + maxDate + "'"
+		}
+	}
 	if SourceType != "" {
 		where = where + " and SourceType = '" + SourceType + "'"
 	}
@@ -825,10 +835,10 @@ func (this *SamplesSourceController) EditAnimal() {
 	var jsonblob = this.Ctx.Input.RequestBody
 	json.Unmarshal(jsonblob, &model)
 	var entity samplessource.AnimalInfo
-	model.ModifiedBy = this.User.Realname
+	model.ModifiedBy = this.User.Username
 	model.ModifiedUserId, _ = utils.StrTo(this.User.Id).Int()
 	svc := samplessource.GetSamplesSourceService(utils.DBE)
-	var cols []string = []string{"Genus", "InnerNo", "Name", "Amount", "Unit", "SourceType", "Weight", "Province", "ProvinceName", "City", "CityName", "Street", "StreetName", "Address", "AreaCode", "Longitude", "Latitude", "Altitude", "SurveyDate", "Remark", "ModifiedBy", "ModifiedUserId"}
+	var cols []string = []string{"Genus", "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)
@@ -869,6 +879,12 @@ func (this *SamplesSourceController) DelBioInfo() {
 	opdesc := "删除生物样本源-" + id
 	svc := samplessource.GetSamplesSourceService(utils.DBE)
 	err := svc.DeleteOperationAndWriteLogBytbl(this.User.AccCode+AnimaltbName, BaseOperationLogName, id, &entity, &entityempty, utils.ToStr(this.User.Id), this.User.Username, opdesc, this.User.AccCode, "样本来源")
+
+	if err == nil {
+		where_code := "SeqName = '" + id + "'"
+		svc.DeleteEntityBytbl(CodecSequenceName, where_code)
+	}
+
 	if err == nil {
 		errinfo.Message = "删除成功"
 		errinfo.Code = 0
@@ -882,7 +898,7 @@ func (this *SamplesSourceController) DelBioInfo() {
 	}
 }
 
-// @Title 获取物样本来源列表
+// @Title 获取微生物样本来源列表
 // @Description get user by token
 // @Success 200 {object} models.Userblood
 // @router /microbiallist [get]

+ 30 - 9
src/dashoo.cn/frontend_animal/src/pages/biobank/source/_opera/operationb.vue

@@ -68,7 +68,7 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="单位">
-                <el-select ref="refee" v-model="samplesForm.Unit" clearable style="width:100%" placeholder="请选择单位">
+                <el-select ref="refUnit" v-model="samplesForm.Unit" clearable style="width:100%" placeholder="请选择单位">
                   <el-option v-for="item in sampeunitlist" :label="item.Value" :value="item.Value" :key="item.Value">
                   </el-option>
                 </el-select>
@@ -118,6 +118,15 @@
                 </el-date-picker>
               </el-form-item>
             </el-col>
+            <el-col :span="8">
+              <el-form-item label="项目属性">
+                <el-select ref="refProject" v-model="samplesForm.ProjectName" clearable style="width:100%"
+                  placeholder="请选择项目属性">
+                  <el-option v-for="item in projectlist" :label="item.Value" :value="item.Value" :key="item.Value">
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
             <el-col :span="24">
               <el-form-item label="备注信息">
                 <el-input v-model="samplesForm.Remark" type="textarea" :rows=3 placeholder="请输入备注信息"></el-input>
@@ -235,11 +244,14 @@
           Latitude: '',
           Altitude: '',
           SurveyDate: new Date(),
+          ProjectId: '',
+          ProjectName: '',
           Remark: '',
         },
         extendForm: {},
         sampeunitlist: [],
         genuslist: [],
+        projectlist: [],
         samplesrules: {
           // InnerNo: [{
           //   required: true,
@@ -293,6 +305,7 @@
       _this.getGroupName()
       _this.getAnimalGenus()
       _this.getsampetypeunit()
+      _this.getProjectlist()
       _this.getDictOptions()
     },
     methods: {
@@ -351,7 +364,8 @@
           if (valid) {
             let _this = this
             _this.samplesForm.Amount = parseInt(_this.samplesForm.Amount)
-            _this.samplesForm.Unit = _this.$refs.refee.selectedLabel
+            _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
             let jsonstr = ''
@@ -397,7 +411,8 @@
           if (valid) {
             let _this = this
             _this.samplesForm.Amount = parseInt(_this.samplesForm.Amount)
-            _this.samplesForm.Unit = _this.$refs.refee.selectedLabel
+            _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
             let jsonstr = ''
@@ -412,7 +427,6 @@
             params = Object.assign(params, jsonobj)
             _this.$axios.put('/samplessource/editanimal/' + _this.pid, params)
               .then(res => {
-                // response
                 if (res.data.code === 0) {
                   _this.$message({
                     type: 'success',
@@ -429,7 +443,6 @@
                 }
               })
               .catch(err => {
-                // handle error
                 console.error(err)
               })
           } else {
@@ -454,6 +467,14 @@
             _this.genuslist = res.data
           })
       },
+      //获取项目属性
+      getProjectlist() {
+        let _this = this
+        _this.$axios.get('/items/worditem?code=ProjectName', {})
+          .then(res => {
+            _this.projectlist = res.data
+          })
+      },
       getGroupName() {
         this.$axios.get('extends/listbyloginwithgroup', {})
           .then(res => {
@@ -472,7 +493,6 @@
           .then(res => {
             this.animalextends = res.data
             if (this.pid > '1' && this.pid != 'addsource') {
-              console.log("wewwwwwwwwwwwww", this.pid)
               this.getanimalinfo()
             }
           })
@@ -516,17 +536,18 @@
         for (var i = 0; i < this.countryoptions.length; i++) {
           if (value[0] == this.countryoptions[i].adcode) {
             this.samplesForm.ProvinceName = this.countryoptions[i].name
-            
+
             if (this.countryoptions[i].districts) {
               for (var n = 0; n < this.countryoptions[i].districts.length; n++) {
                 if (value[1] == this.countryoptions[i].districts[n].adcode) {
                   this.samplesForm.CityName = this.countryoptions[i].districts[n].name
 
                   if (this.countryoptions[i].districts[n].districts) {
-                    for (var m = 0; m < this.countryoptions[i].districts[n].districts.length; m++) {                   
+                    for (var m = 0; m < this.countryoptions[i].districts[n].districts.length; m++) {
                       if (value[2] == this.countryoptions[i].districts[n].districts[m].adcode) {
                         this.samplesForm.StreetName = this.countryoptions[i].districts[n].districts[m].name
-                        this.samplesForm.AreaCode = (Array(4).join(0) + this.countryoptions[i].districts[n].districts[m].citycode).slice(-4)
+                        this.samplesForm.AreaCode = (Array(4).join(0) + this.countryoptions[i].districts[n].districts[m]
+                          .citycode).slice(-4)
                       }
                     }
                   } else {

+ 15 - 5
src/dashoo.cn/frontend_animal/src/pages/biobank/source/animal.vue

@@ -21,8 +21,8 @@
           <el-form-item label="来源内码">
             <el-input size="mini" style="width: 165px;" v-model="searchform.InnerNo" placeholder="请输入来源内码"></el-input>
           </el-form-item>
-          <el-form-item label="采样日期">
-            <el-date-picker size="mini" style="width: 220px" v-model="SurveyDate" type="daterange" range-separator="至"
+          <el-form-item label="创建日期">
+            <el-date-picker size="mini" style="width: 220px" v-model="CreateOn" type="daterange" range-separator="至"
               start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
           </el-form-item>
           <el-form-item>
@@ -173,7 +173,8 @@
           starttime: null,
           endtime: null,
         },
-        SurveyDate: [new Date(new Date().getTime() - 3 * 30 * 24 * 60 * 60 * 1000), new Date()], // 采样日期
+        SurveyDate: [], // 采样日期
+        CreateOn: [new Date(new Date().getTime() - 3 * 30 * 24 * 60 * 60 * 1000), new Date()],
         currentItemCount: 0,
         currentPage: 1,
         size: 10,
@@ -209,7 +210,6 @@
         if (!_this.SurveyDate) {
           _this.SurveyDate = []
         }
-        // 解析时间
         if (_this.SurveyDate.length == 2) {
           _this.SurveyDate[1].setHours(23)
           _this.SurveyDate[1].setMinutes(59)
@@ -217,6 +217,14 @@
           SurveyDate.push(_this.formatDateTime(_this.SurveyDate[0]))
           SurveyDate.push(_this.formatDateTime(_this.SurveyDate[1]))
         }
+        let CreateOn = []
+        if (_this.CreateOn.length == 2) {
+          _this.CreateOn[1].setHours(23)
+          _this.CreateOn[1].setMinutes(59)
+          _this.CreateOn[1].setSeconds(59)
+          CreateOn.push(_this.formatDateTime(_this.CreateOn[0]))
+          CreateOn.push(_this.formatDateTime(_this.CreateOn[1]))
+        }
         const params = {
           _currentPage: this.currentPage,
           _size: this.size,
@@ -224,7 +232,8 @@
           Prop: this.Column.Prop
         }
         Object.assign(params, _this.searchform)
-        _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate.join(','), {
+        _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate.join(',') + '&CreateOn=' +
+            CreateOn.join(','), {
             params
           })
           .then(res => {
@@ -303,6 +312,7 @@
         this.searchform.SourceType = ''
         this.searchform.Name = ''
         this.SurveyDate = []
+        this.CreateOn = []
         this.initdata()
       },
       handleSizeChange(value) {