Ver código fonte

Merge remote-tracking branch 'origin/master'

gongyb 4 anos atrás
pai
commit
230608d9ab

+ 1 - 2
src/dashoo.cn/frontend_animal/src/components/samples/samplesourcesearchdialog.vue

@@ -239,7 +239,6 @@ export default {
   name: 'customsearchdialog',
 
   created () {
-    this.getOrgTreeList()
   },
   computed: {
 
@@ -758,7 +757,7 @@ export default {
       // console.log(template, 'BBBBBBBBB')
 
       // 保存确定
-      service.postRequest('dashoo.biobank.bee-0.1', 'Search', 'PutSearchTemplate', {templeteName: this.currentSearchTemplateName, currentSearchId: this.currentSearchId, template: template, type: 'sampleSource'})
+      service.postRequest('dashoo.biobank.bee-0.1', 'SampleRelated', 'SaveSearchTemplate', {name: this.currentSearchTemplateName, template: template, type: 'SampleSource'})
       // putSearchTemplate(this.currentSearchTemplateName, this.currentSearchId, template, 'sample')
         .then(res => {
           if (res.info.code === 0) {

+ 84 - 29
src/dashoo.cn/frontend_animal/src/pages/biobank/source/animal.vue

@@ -44,10 +44,10 @@
                 <el-dropdown-item command="search">高级查询</el-dropdown-item>
                 <el-dropdown-item style="color:black;"
                                   v-for="item in searchTemplates"
-                                  :key="item.Name"
-                                  :command="item.Template">{{item.Name}}</el-dropdown-item>
-                <el-dropdown-item command="customize">自定义查询</el-dropdown-item>
+                                  :key="item.name"
+                                  :command="item.template">{{item.name}}</el-dropdown-item>
                 <el-dropdown-item command="clear">查询重置</el-dropdown-item>
+                <el-dropdown-item divided command="customize">自定义查询</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
           </el-form-item>
@@ -242,6 +242,9 @@ export default {
       dialogVisible: false,
       classificationlist: [],
       multipleSelection: [],
+      currentSearchId: null, // 当前搜索模板id
+      currentSearchTemplateName: '', // 当前搜索模板名称
+      searchTemplates: [], // 自定义模板
       list: [], // table显示数据集
       exportloading: false,
       searchform: {
@@ -281,18 +284,17 @@ export default {
     }
   },
   created () {
-    let _this=this
+    let _this = this
     // console.log('jlw', store.get('samplestoredseach'))
     if (this.$route.query.size && this.$route.query.currentPage) {
       this.size = parseInt(this.$route.query.size)
       this.currentPage = parseInt(this.$route.query.currentPage)
       let searchmodel = store.get('samplestoredseach')
-      if (typeof (searchmodel) != 'undefined') {
+      if (typeof (searchmodel) !== 'undefined') {
         if (searchmodel.Name && searchmodel.BarCode !== '') { // 样本源名称
           this.searchform.Name = searchmodel.Name
         }
         if (searchmodel.InnerNo && searchmodel.InnerNo != '') { // 来源内码
-
           this.searchform.InnerNo = searchmodel.InnerNo
         }
         // if (searchmodel.CreateOn && searchmodel.CreateOn != '') { // 创建时间
@@ -300,7 +302,6 @@ export default {
         //   this.CreateOn = searchmodel.CreateOn
         // }
         if (searchmodel.Genus && searchmodel.Genus != '') { // 蜂种
-
           this.searchform.Genus = searchmodel.Genus
         }
         if (searchmodel.Address && searchmodel.Address != '') { // 取样地区
@@ -387,13 +388,13 @@ export default {
         CreateOn.push(SurveyDateTemp[0])
         CreateOn.push(SurveyDateTemp[1])
       }
-      console.log('size---',this.size)
-      console.log('currentPage---',this.currentPage)
+      console.log('size---', this.size)
+      console.log('currentPage---', this.currentPage)
       let params = {
         _currentPage: this.currentPage,
         _size: this.size,
         Order: this.Column.Order,
-        Prop: this.Column.Prop,
+        Prop: this.Column.Prop
       }
       // _this.searchform.CreateOn = _this.CreateOn
       Object.assign(params, _this.searchform)
@@ -404,6 +405,29 @@ export default {
       console.log('params', params)
       store.set('samplestoredseach', params)
       console.log('jlw', store.get('samplestoredseach'))
+      service.postRequest('dashoo.biobank.bee-0.1', '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)
+              return e
+            })
+            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({
+            //   type: 'warning',
+            //   message: res.data.message,
+            // })
+          }
+        })
       _this.$axios.get('/samplessource/animallist?SurveyDate=' + SurveyDate.join(',') + '&CreateOn=' +
         CreateOn.join(','), {
         params
@@ -498,6 +522,7 @@ export default {
     },
     // 关闭自定义查询
     closeDialog () {
+      console.log('closed')
       this.getAllSearchTab()
     },
 
@@ -508,7 +533,7 @@ export default {
         .then(res => {
           if (res.info && res.info.items && res.info.items.length > 0) {
             _this.searchTemplates = res.info.items.map(function (e) {
-              e.Fields = JSON.parse(e.Template)
+              e.Fields = JSON.parse(e.template)
               return e
             })
             _this.currentSearchTemplateName = _this.searchTemplates[0].Name
@@ -526,26 +551,39 @@ export default {
           console.error(err)
         })
     },
+    // getSearchTableData (searchFields) {
+    //   let data = searchFields.map(function (ele) {
+    //     // if (ele['OrAnd'] === 'or') {
+    //     //   ele['Guanxi'] = '或者'
+    //     // } else {
+    //     //   ele['Guanxi'] = '并且'
+    //     // }
+    //
+    //     // _this.searchTemplates.forEach((item) => {
+    //     //   item.Fields.forEach((it) => {
+    //     //     if (it.TagIcon == "cascader") {
+    //     //       it.Value = "[" + it.Value + "]"
+    //     //     }
+    //     //   })
+    //     // })
+    //     if (ele['Operate'] === 'between') {
+    //       ele['Value'] = ele['Value'].split('--')
+    //     }
+    //     if (ele.TagIcon == 'cascader') {
+    //       ele.Value = ele.Value.split('/')
+    //     }
+    //     return ele
+    //   })
+    //
+    //   return data || []
+    // },
+
     getSearchTableData (searchFields) {
       let data = searchFields.map(function (ele) {
-        // if (ele['OrAnd'] === 'or') {
-        //   ele['Guanxi'] = '或者'
-        // } else {
-        //   ele['Guanxi'] = '并且'
-        // }
-
-        // _this.searchTemplates.forEach((item) => {
-        //   item.Fields.forEach((it) => {
-        //     if (it.TagIcon == "cascader") {
-        //       it.Value = "[" + it.Value + "]"
-        //     }
-        //   })
-        // })
-        if (ele['Operate'] === 'between') {
-          ele['Value'] = ele['Value'].split('--')
-        }
-        if (ele.TagIcon == 'cascader') {
-          ele.Value = ele.Value.split('/')
+        if (ele['OrAnd'] === 'or') {
+          ele['Guanxi'] = '或者'
+        } else {
+          ele['Guanxi'] = '并且'
         }
         return ele
       })
@@ -600,6 +638,23 @@ export default {
         // })
       } else if (command == 'clear') {
         this.clearSearch()
+      } else {
+        this.currentSearchTemplate = command
+        /* let searchmodel = {
+          searchWithTemplate: command
+        }
+        store.set('samplestoredseach', searchmodel) */
+        // this.searchWithTemplate(command)
+        // 调用子组件的查询方法 状态  1待存储2已存储3.取出待放回4.已归档
+
+        let searchParams = {
+          template: command,
+          status: 2,
+          isStore: true,
+          type: 0,
+          current: 1
+        }
+        this.$refs.sampleTable.searchWithTemplate(searchParams)
       }
     },
     clearSearch () {

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

@@ -112,7 +112,7 @@ service.postRequest = function postRequest(basePath, srvName, funcName, data) {
     data = nullParam
   }
   return service.request({
-    url: 'localhost:9981' + basePath,
+    url: basePath,
     method: 'post',
     headers: {
       'Content-Type': 'application/rpcx',