Browse Source

样本管理 预录入 待复存 已归档 自定义查询 下拉弹框

gongyb 4 years ago
parent
commit
8a07c39bfd

+ 87 - 14
src/dashoo.cn/frontend_animal/src/components/samples/samplesearchdialog.vue

@@ -910,7 +910,7 @@ export default {
           <el-tab-pane label="扩展字段"
                        style="height:calc(100vh - 370px)">
             <div :style="{'width':'100%','height':tableHeight-60+'px','overflow':'auto'}">
-              <el-tree :data="data"
+              <el-tree :data="data3"
                        @node-click="handleNodeClicKuoZhan"></el-tree>
             </div>
 
@@ -925,7 +925,7 @@ export default {
           <el-tab-pane label="样本来源扩展字段"
                        style="height:calc(100vh - 370px)">
             <div :style="{'width':'100%','height':tableHeight-60+'px','overflow':'auto'}">
-              <el-tree :data="data3"
+              <el-tree :data="data4"
                        @node-click="handleNodeClicKuoZhan"></el-tree>
             </div>
 
@@ -1309,9 +1309,51 @@ export default {
         type: 'date'
       }
       ],
-      data: [],
-      data2: [],
-      data3: []
+      data3: [],
+      data2: [{
+        value: 'Area',
+        label: '取样地区',
+        type: 'str'
+      }, {
+        value: 'SurveyDate',
+        label: '采样日期',
+        type: 'date'
+      }, {
+        value: 'Genus',
+        label: '蜂种',
+        type: 'str'
+      }, {
+        value: 'Remark',
+        label: '备注信息',
+        type: 'str'
+      }, {
+        value: 'Altitude',
+        label: '海拔',
+        type: 'str'
+      }, {
+        value: 'ProjectName',
+        label: '项目属性',
+        type: 'str'
+      }, {
+        value: 'SampleTypestr',
+        label: '样本类型',
+        type: 'date'
+      }, {
+        value: 'Name',
+        label: '名称',
+        type: 'str'
+      }
+        //   {
+        //   value: 'Latitude',
+        //   label: '纬度',
+        //   type: 'str'
+        // }, {
+        //   value: 'Longitude',
+        //   label: '经度',
+        //   type: 'str'
+        // }
+      ],
+      data4: []
     }
   },
 
@@ -1410,6 +1452,7 @@ export default {
     creatpage () {
       // 黏膜搜索
       this.searchKuoZhanData()
+      this.searchSourceKuoZhanData()
       this.getAllSearchTab()
     },
     removeCustomCondition (row) {
@@ -1425,9 +1468,9 @@ export default {
     // 查询扩展字段
     searchKuoZhanData () {
       this.data = []
-      service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'CustomizeSearch',{type: 'Sample'})
+      service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'CustomizeSearch', {type: 'Sample'})
         .then(res => {
-          var models = res.info.items
+          var models = res.data
           for (var i = 0; i < models.length; i++) {
             var kuozhan = {
               label: '',
@@ -1435,26 +1478,56 @@ export default {
             }
             if (i !== 0) {
               // 和上一条数据是同一种类型,i-1>=0 数组下标不会越界
-              if (models[i].SampleTypeId === models[i - 1].SampleTypeId) {
-                this.data[this.data.length - 1].label = models[i].SampleTypeName
-                this.data[this.data.length - 1].children.push({ label: models[i].KuoZhanFieldName, sampleTypeId: models[i].SampleTypeId, FieldName: models[i].FieldName, FieldType: models[i].FieldType, TagIcon: models[i].TagIcon })
+              if (models[i].GroupName === models[i - 1].GroupName) {
+                this.data[this.data.length - 1].label = models[i].GroupName
+                this.data[this.data.length - 1].children.push({ label: models[i].Name, FieldName: models[i].FieldName, FieldType: models[i].FieldType })
               } else {
                 // 和上一条数据不是同一个样本类型
-                kuozhan.label = models[i].SampleTypeName
-                kuozhan.children.push({ label: models[i].KuoZhanFieldName, sampleTypeId: models[i].SampleTypeId, FieldName: models[i].FieldName, FieldType: models[i].FieldType, TagIcon: models[i].TagIcon })
+                kuozhan.label = models[i].GroupName
+                kuozhan.children.push({ label: models[i].Name, FieldName: models[i].FieldName, FieldType: models[i].FieldType })
                 // 不是同一种样本类型的时候需要增加一个元素
                 this.data.push(kuozhan)
               }
             } else {
               // 第一次循环肯定要加入一个元素
               kuozhan.label = models[i].SampleTypeName
-              kuozhan.children.push({ label: models[i].KuoZhanFieldName, sampleTypeId: models[i].SampleTypeId, FieldName: models[i].FieldName, FieldType: models[i].FieldType, TagIcon: models[i].TagIcon })
+              kuozhan.children.push({ label: models[i].Name, FieldName: models[i].FieldName, FieldType: models[i].FieldType })
+              this.data.push(kuozhan)
+            }
+          }
+        })
+    },
+    searchSourceKuoZhanData () {
+      this.data = []
+      service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'CustomizeSearch', {type: 'SampleSource'})
+        .then(res => {
+          var models = res.data
+          for (var i = 0; i < models.length; i++) {
+            var kuozhan = {
+              label: '',
+              children: []
+            }
+            if (i !== 0) {
+              // 和上一条数据是同一种类型,i-1>=0 数组下标不会越界
+              if (models[i].GroupName === models[i - 1].GroupName) {
+                this.data[this.data.length - 1].label = models[i].GroupName
+                this.data[this.data.length - 1].children.push({ label: models[i].Name, FieldName: models[i].FieldName, FieldType: models[i].FieldType })
+              } else {
+                // 和上一条数据不是同一个样本类型
+                kuozhan.label = models[i].GroupName
+                kuozhan.children.push({ label: models[i].Name, FieldName: models[i].FieldName, FieldType: models[i].FieldType })
+                // 不是同一种样本类型的时候需要增加一个元素
+                this.data.push(kuozhan)
+              }
+            } else {
+              // 第一次循环肯定要加入一个元素
+              kuozhan.label = models[i].SampleTypeName
+              kuozhan.children.push({ label: models[i].Name, FieldName: models[i].FieldName, FieldType: models[i].FieldType })
               this.data.push(kuozhan)
             }
           }
         })
     },
-
     // getSampleSourceTypeExpand () {
     //   this.data2 = []
     //   service.postRequest('dashoo.biobank.bee-0.1', 'SampleSource', 'SourceTypeExpand')

+ 17 - 7
src/dashoo.cn/frontend_animal/src/pages/samples/archived/index.vue

@@ -36,8 +36,8 @@
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
                 <el-dropdown-item command="clear">查询重置</el-dropdown-item>
-                <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.Name"
-                  :command="item.Name">{{item.Name}}</el-dropdown-item>
+                <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.name"
+                  :command="item.name">{{item.name}}</el-dropdown-item>
                 <el-dropdown-item divided style="color:black;" command="编辑">自定义</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
@@ -298,6 +298,7 @@
   } from 'vuex'
   import draggable from 'vuedraggable'
   import samplesearchdialog from '../../../components/samples/samplesearchdialog'
+  import service from '../../../utils/micro_request'
   export default {
     name: 'samplesunsave',
     computed: mapGetters({
@@ -985,14 +986,22 @@
       },
       getAllSearchTab () {
         let _this = this
-        this.$axios.get('/sampleinput/searchTemplate', {})
+        // getSearchTemplate({ Type: 'sample' })
+        service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
           .then(res => {
-            if (res.data && res.data.items && res.data.items.length > 0) {
-              _this.searchTemplates = res.data.items.map(function (e) {
-                e.Fields = JSON.parse(e.Template)
+            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)
                 return e
               })
-              _this.currentSearchTemplateName = _this.searchTemplates[0].Name
+              console.log('_this.searchTemplates', _this.searchTemplates)
+              // //当前搜索模板的I
+
+              _this.currentSearchId = _this.searchTemplates[0].id
+              _this.currentSearchTemplateName = _this.searchTemplates[0].name
+              // console.log(_this.searchTemplates, 'searchTemplatessearchTemplatessearchTemplates')
+              // console.log(this.searchTemplates[0].Fields, "this.searchTemplates[0].Fields")
               _this.searchTableData = this.getSearchTableData(this.searchTemplates[0].Fields)
             } else {
               // _this.$message({
@@ -1002,6 +1011,7 @@
             }
           })
           .catch(err => {
+            // handle error
             console.error(err)
           })
       },

+ 15 - 6
src/dashoo.cn/frontend_animal/src/pages/samples/prerecorded/index.vue

@@ -41,7 +41,7 @@
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
                 <el-dropdown-item command="clear">查询重置</el-dropdown-item>
-                <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.Name" :command="item.Name">{{item.Name}}</el-dropdown-item>
+                <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.name" :command="item.name">{{item.name}}</el-dropdown-item>
                 <el-dropdown-item divided style="color:black;" command="编辑">自定义</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
@@ -288,6 +288,7 @@
   import store from 'store'
   import draggable from 'vuedraggable'
   import samplesearchdialog from '../../../components/samples/samplesearchdialog'
+  import service from '../../../utils/micro_request'
   export default {
     name: 'samplespreinputlist',
     computed: mapGetters({
@@ -1047,14 +1048,22 @@
       },
       getAllSearchTab () {
         let _this = this
-        this.$axios.get('/sampleinput/searchTemplate', {})
+        // getSearchTemplate({ Type: 'sample' })
+        service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
           .then(res => {
-            if (res.data && res.data.items && res.data.items.length > 0) {
-              _this.searchTemplates = res.data.items.map(function (e) {
-                e.Fields = JSON.parse(e.Template)
+            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)
                 return e
               })
-              _this.currentSearchTemplateName = _this.searchTemplates[0].Name
+              console.log('_this.searchTemplates', _this.searchTemplates)
+              // //当前搜索模板的I
+
+              _this.currentSearchId = _this.searchTemplates[0].id
+              _this.currentSearchTemplateName = _this.searchTemplates[0].name
+              // console.log(_this.searchTemplates, 'searchTemplatessearchTemplatessearchTemplates')
+              // console.log(this.searchTemplates[0].Fields, "this.searchTemplates[0].Fields")
               _this.searchTableData = this.getSearchTableData(this.searchTemplates[0].Fields)
             } else {
               // _this.$message({

+ 16 - 6
src/dashoo.cn/frontend_animal/src/pages/samples/waitingstore/index.vue

@@ -32,7 +32,7 @@
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
                 <el-dropdown-item command="clear">查询重置</el-dropdown-item>
-                <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.Name" :command="item.Name">{{item.Name}}</el-dropdown-item>
+                <el-dropdown-item style="color:black;" v-for="item in searchTemplates" :key="item.name" :command="item.name">{{item.name}}</el-dropdown-item>
                 <el-dropdown-item divided style="color:black;" command="编辑">自定义</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
@@ -278,6 +278,7 @@
   } from 'vuex'
   import draggable from 'vuedraggable'
   import samplesearchdialog from '../../../components/samples/samplesearchdialog'
+  import service from '../../../utils/micro_request'
   export default {
     name: 'samplesunsave',
     computed: mapGetters({
@@ -859,14 +860,22 @@
       },
       getAllSearchTab () {
         let _this = this
-        this.$axios.get('/sampleinput/searchTemplate', {})
+        // getSearchTemplate({ Type: 'sample' })
+        service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'GetSearchTemplate', {type: 'Sample'})
           .then(res => {
-            if (res.data && res.data.items && res.data.items.length > 0) {
-              _this.searchTemplates = res.data.items.map(function (e) {
-                e.Fields = JSON.parse(e.Template)
+            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)
                 return e
               })
-              _this.currentSearchTemplateName = _this.searchTemplates[0].Name
+              console.log('_this.searchTemplates', _this.searchTemplates)
+              // //当前搜索模板的I
+
+              _this.currentSearchId = _this.searchTemplates[0].id
+              _this.currentSearchTemplateName = _this.searchTemplates[0].name
+              // console.log(_this.searchTemplates, 'searchTemplatessearchTemplatessearchTemplates')
+              // console.log(this.searchTemplates[0].Fields, "this.searchTemplates[0].Fields")
               _this.searchTableData = this.getSearchTableData(this.searchTemplates[0].Fields)
             } else {
               // _this.$message({
@@ -876,6 +885,7 @@
             }
           })
           .catch(err => {
+            // handle error
             console.error(err)
           })
       },