Procházet zdrojové kódy

修改采集日期查询bug

jianglw před 4 roky
rodič
revize
08ad9452a2

+ 35 - 26
src/dashoo.cn/frontend_animal/src/pages/biobank/source/animal.vue

@@ -19,8 +19,12 @@
           </el-form-item>
           <el-form-item label="创建日期">
             <el-date-picker size="mini" style="width: 110px" v-model="CreateOnStart" type="date"
+                            format="yyyy-MM-dd"
+                            value-format="yyyy-MM-dd"
                             placeholder="开始日期"></el-date-picker>
             <el-date-picker size="mini" style="width: 110px" v-model="CreateOnEnd" type="date"
+                            format="yyyy-MM-dd"
+                            value-format="yyyy-MM-dd"
                             placeholder="结束日期"></el-date-picker>
           </el-form-item>
           <el-form-item>
@@ -194,8 +198,12 @@
           <el-col :span="12">
             <el-form-item label="采样日期">
               <el-date-picker size="mini" style="width: 120px" v-model="SurveyDateStart" type="date"
+                              format="yyyy-MM-dd"
+                              value-format="yyyy-MM-dd"
                               placeholder="开始日期"></el-date-picker>
               <el-date-picker size="mini" style="width: 120px" v-model="SurveyDateEnd" type="date"
+                              format="yyyy-MM-dd"
+                              value-format="yyyy-MM-dd"
                               placeholder="结束日期"></el-date-picker>
             </el-form-item>
           </el-col>
@@ -479,33 +487,33 @@ export default {
         _this.SurveyDate = []
       }
       if (_this.SurveyDate.length == 2) {
-        _this.SurveyDate[1].setHours(23)
-        _this.SurveyDate[1].setMinutes(59)
-        _this.SurveyDate[1].setSeconds(59)
-        SurveyDate.push(_this.formatDateTime(_this.SurveyDate[0]))
-        SurveyDate.push(_this.formatDateTime(_this.SurveyDate[1]))
+        // _this.SurveyDate[1].setHours(23)
+        // _this.SurveyDate[1].setMinutes(59)
+        // _this.SurveyDate[1].setSeconds(59)
+        SurveyDate.push(_this.SurveyDate[0])
+        SurveyDate.push(_this.SurveyDate[1])
       }
       console.log('createon', _this.CreateOn)
       let CreateOn = []
-      if (_this.CreateOn != null) {
+      if (_this.CreateOn.length > 0) {
         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]))
+          CreateOn.push(_this.CreateOn[0])
+          CreateOn.push(_this.CreateOn[1])
         }
-      }
-      if (store.get('samplestoredseach').CreateOn && store.get('samplestoredseach').CreateOn.length != 0) {
+      } else if (store.get('samplestoredseach').CreateOn && store.get('samplestoredseach').CreateOn.length != 0) {
         console.log('createOnOnOn', store.get('samplestoredseach').CreateOn)
-        let CreateOnTemp = store.get('samplestoredseach').CreateOn
+        let CreateOnTemp = store.get('samplestoredseach').CreateOn.split(',')
         CreateOn.push(CreateOnTemp[0])
         CreateOn.push(CreateOnTemp[1])
+        _this.CreateOnStart = CreateOnTemp[0]
+        _this.CreateOnEnd = CreateOnTemp[1]
       }
       if (store.get('samplestoredseach').SurveyDate && store.get('samplestoredseach').SurveyDate.length != 0) {
         let SurveyDateTemp = store.get('samplestoredseach').SurveyDate
-        CreateOn.push(SurveyDateTemp[0])
-        CreateOn.push(SurveyDateTemp[1])
+        SurveyDate.push(SurveyDateTemp[0])
+        SurveyDate.push(SurveyDateTemp[1])
+        _this.SurveyDateStart = SurveyDateTemp[0]
+        _this.SurveyDateEnd = SurveyDateTemp[1]
       }
       console.log('size---', this.size)
       console.log('currentPage---', this.currentPage)
@@ -517,15 +525,16 @@ export default {
       }
       // _this.searchform.CreateOn = _this.CreateOn
       Object.assign(params, _this.searchform)
-      let params1 = {
-        CreateOn: _this.CreateOn
-      }
-      params = Object.assign(params, params1)
+      console.log('createOnOnOnONOn', _this.CreateOn)
+      console.log('createOnOnOnONOn', _this.SurveyDate)
+      CreateOn = _this.CreateOn[0] != null && _this.CreateOn[1] != null ? _this.CreateOn.join(',') : ''
+      SurveyDate = _this.SurveyDate[0] != null && _this.SurveyDate[1] != null ? _this.SurveyDate.join(',') : ''
+      params = Object.assign(params)
       console.log('params', params)
       store.set('samplestoredseach', params)
       _this.getAllSearchTab()
-      _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate.join(',') + '&CreateOn=' +
-        CreateOn.join(','), {
+      _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate + '&CreateOn=' +
+        CreateOn, {
         params
       })
         .then(res => {
@@ -631,7 +640,6 @@ export default {
       // getSearchTemplate({ Type: 'sample' })
       service.postRequest('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'GetSearchTemplate', {type: 'SampleSource'})
         .then(res => {
-          console.log('res.data', res.data)
           if (res.data && res.data.length > 0) {
             _this.searchTemplates = res.data.map(function (e) {
               e.Fields = JSON.parse(e.template)
@@ -736,7 +744,6 @@ export default {
         this.CreateOn.push(this.CreateOnStart)
         this.CreateOn.push(this.CreateOnEnd)
       }
-      console.log("CreateOn", this.CreateOn)
       this.initdata()
     },
     searchCommand (command) {
@@ -980,8 +987,7 @@ export default {
         params.currentPage = 0
         params.size = 0
       }
-      const name = dateInfo + '样本来源关联样本.xlsx'
-      service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', name, params)
+      service.downloadExcel('dashoo.biobank.bee-0.1-jlw', 'SampleRelated', 'ExportExcel', params)
     },
     jstimehandle (val) {
       if (val === '') {
@@ -1027,6 +1033,9 @@ export default {
           this.checkAll = true
         }
       }
+      this.$nextTick(() => {
+        this.$refs.tableData.doLayout()
+      })
     },
     handleCheckAllChange (val) {
       for (var i = 0; i < this.showcolumn.length; i++) {

+ 82 - 0
src/dashoo.cn/frontend_animal/src/pages/samples/archived/index.vue

@@ -627,6 +627,88 @@ export default {
       this.initData()
       this.dialogVisible = false
     },
+    deletedata(val) {
+      let _this = this
+      _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        _this.$axios.delete('samplesfiles/' + val.Id + '?sampletype=' + val.SampleType, null)
+          .then(res => {
+            if (res.data.code === 0) {
+              _this.$message({
+                type: 'success',
+                message: res.data.message
+              })
+              // 更新界面
+              this.initData()
+            } else {
+              _this.$message({
+                type: 'warning',
+                message: res.data.message
+              })
+            }
+          })
+          .catch(() => {})
+      }).catch(() => {})
+    },
+    //批量删除
+    batchdelete() {
+      let _this = this
+      if (_this.multipleSelection.length < 1) {
+        _this.$message({
+          type: 'warning',
+          message: '请选择要批量删除的样本'
+        })
+        return
+      }
+      _this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        let failedIds = []
+        let succeedMsg = ''
+        let errorMsg = ''
+        let count = 0
+        for (var i = 0; i < _this.multipleSelection.length; i++) {
+          _this.$axios.delete('samplesfiles/' + _this.multipleSelection[i].Id + '?sampletype=' + _this
+            .multipleSelection[
+            i].SampleType, null)
+            .then(res => {
+              if (res.data.code === 0) {
+                succeedMsg = res.data.message
+              } else {
+                errorMsg = res.data.message
+                failedIds.push(_this.multipleSelection[i].Id);
+              }
+              count++
+              //最后一个请求结束
+              if (count == _this.multipleSelection.length) {
+                //更新界面
+                this.initData()
+                //全部删除成功
+                if (failedIds.length == 0) {
+                  _this.$message({
+                    type: 'success',
+                    message: succeedMsg,
+                  })
+                } else {
+                  //存在删除失败
+                  errorMsg = errorMsg + ",失败ID:" + failedIds.join(",")
+                  _this.$message({
+                    type: 'warning',
+                    message: errorMsg,
+                  })
+                }
+              }
+            })
+        }
+      }).catch(err => {
+        console.error(err)
+      })
+    },
     selsampletypeChange () {
       // 获取特有扩展
       let _this = this