Browse Source

研究方向

lrf 3 years ago
parent
commit
2ddf3bc2d3
3 changed files with 13 additions and 85 deletions
  1. 1 1
      src/layout/infoview/research/list-1.vue
  2. 2 0
      src/store/index.js
  3. 10 84
      src/views/infoview/research/index.vue

+ 1 - 1
src/layout/infoview/research/list-1.vue

@@ -42,7 +42,7 @@ export default {
     },
     // 整理数据
     getData(data) {
-      return JSON.stringify(data.persons.map((i) => i.personName));
+      return data.persons.map((i) => i.personName).join(',');
     },
   },
   computed: {

+ 2 - 0
src/store/index.js

@@ -5,6 +5,7 @@ import * as umutations from '@common/src/store/user/mutations';
 import test from '@common/src/store/test';
 import login from '@common/src/store/login';
 import laboratory from '@common/src/store/laboratory';
+import direction from '@common/src/store/direction';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
@@ -15,5 +16,6 @@ export default new Vuex.Store({
     test,
     login,
     laboratory,
+    direction,
   },
 });

+ 10 - 84
src/views/infoview/research/index.vue

@@ -16,6 +16,7 @@ import list1 from '@/layout/infoview/research/list-1.vue';
 import info1 from '@/layout/infoview/research/info-1.vue';
 import adminFrame from '@common/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('direction');
 export default {
   name: 'index',
   props: {},
@@ -26,89 +27,7 @@ export default {
   },
   data: function () {
     return {
-      list: [
-        {
-          createBy: '1',
-          createTime: '2021-09-24 15:10:01',
-          delFlag: '0',
-          id: 'direction001',
-          name: '开创视觉光刺激治疗癫痫研究',
-          params: {},
-          personId: 'person001',
-          personName: '王江涛',
-          persons: [
-            {
-              createBy: null,
-              createTime: '2021-10-11 19:57:29',
-              direction: 'direction001',
-              id: '2896b42a57ec49b4aa2102d324fca81e',
-              params: {},
-              personId: 'person435',
-              personName: '张洪波',
-              remark: null,
-              searchValue: null,
-              updateBy: null,
-              updateTime: null,
-            },
-            {
-              createBy: null,
-              createTime: '2021-10-11 19:57:29',
-              direction: 'direction001',
-              id: '39ec9611c3814f738cf8118522e00c7a',
-              params: {},
-              personId: 'person1119',
-              personName: '李国亮',
-              remark: null,
-              searchValue: null,
-              updateBy: null,
-              updateTime: null,
-            },
-            {
-              createBy: null,
-              createTime: '2021-10-11 19:57:29',
-              direction: 'direction001',
-              id: '509af2c53cfa4a28aa58eab8c7491a19',
-              params: {},
-              personId: 'person579',
-              personName: '张艳凤',
-              remark: null,
-              searchValue: null,
-              updateBy: null,
-              updateTime: null,
-            },
-            {
-              createBy: null,
-              createTime: '2021-10-11 19:57:29',
-              direction: 'direction001',
-              id: '9dfa64d3f9594e509880eded42cabbcf',
-              params: {},
-              personId: 'person986',
-              personName: '杨诺',
-              remark: null,
-              searchValue: null,
-              updateBy: null,
-              updateTime: null,
-            },
-            {
-              createBy: null,
-              createTime: '2021-10-11 19:57:29',
-              direction: 'direction001',
-              id: 'bb3b9aa4c1104833940896349a2d9b05',
-              params: {},
-              personId: 'person004',
-              personName: '张彤',
-              remark: null,
-              searchValue: null,
-              updateBy: null,
-              updateTime: null,
-            },
-          ],
-          remark: null,
-          searchValue: null,
-          updateBy: '1',
-          updateTime: '2021-10-11 19:57:28',
-        },
-      ],
+      list: [],
       total: 0,
       limit: 5,
       // 弹框
@@ -121,12 +40,19 @@ export default {
     await this.search();
   },
   methods: {
+    ...mapActions(['query']),
     async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
       if (searchName) info.name = searchName;
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        const data = _.cloneDeep(res.rows);
+        this.$set(this, `list`, res.rows);
+        this.$set(this, `total`, res.total);
+      }
     },
     // 查看信息
     async toView(data) {
-      data.persons = JSON.stringify(data.persons.map((i) => i.personName));
+      data.persons = data.persons.map((i) => i.personName).join(',');
       this.$set(this, `info`, data);
       this.dialog = { show: true, title: '详细信息', type: '1' };
     },