浏览代码

Merge branch 'master' of http://git.cc-lotus.info/free-lab/lab-mobile

guhongwei 3 年之前
父节点
当前提交
29c42a1fc3
共有 3 个文件被更改,包括 37 次插入32 次删除
  1. 5 5
      src/layout/infoview/equipment/equipment-total.vue
  2. 5 0
      src/store/index.js
  3. 27 27
      src/views/infoview/equipment/index.vue

+ 5 - 5
src/layout/infoview/equipment/equipment-total.vue

@@ -15,23 +15,23 @@
           </van-col>
           <van-col span="24" class="two_1">
             <p>大型仪器服务共享平台(台)</p>
-            <p>{{ totalInfo.p1 }}</p>
+            <p>{{ totalInfo.p2 }}</p>
           </van-col>
           <van-col span="24" class="two_1">
             <p>设备总价值(万元)</p>
-            <p>{{ totalInfo.p1 }}</p>
+            <p>{{ totalInfo.p3 }}</p>
           </van-col>
           <van-col span="24" class="two_1">
             <p>平均每台仪器研究工作总时(小时)</p>
-            <p>{{ totalInfo.p1 }}</p>
+            <p>{{ totalInfo.p4 }}</p>
           </van-col>
           <van-col span="24" class="two_1">
             <p>平均每台仪器服务工作总时(小时)</p>
-            <p>{{ totalInfo.p1 }}</p>
+            <p>{{ totalInfo.p5 }}</p>
           </van-col>
           <van-col span="24" class="two_1">
             <p>机时率(%)</p>
-            <p>{{ totalInfo.p1 }}</p>
+            <p>{{ totalInfo.p6 }}</p>
           </van-col>
         </van-col>
       </van-col>

+ 5 - 0
src/store/index.js

@@ -4,7 +4,9 @@ import * as ustate from '@common/src/store/user/state';
 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';
 // 博硕培养情况
 import doctor from '@common/src/store/doctor';
@@ -12,6 +14,8 @@ import doctor from '@common/src/store/doctor';
 import title from '@common/src/store/title';
 // 人才称号
 import personnelname from '@common/src/store/personnelname';
+// 设备
+import equipment from '@common/src/store/equipment';
 // 社会服务活动
 import socialservices from '@common/src/store/socialservices';
 // 技术服务活动
@@ -43,6 +47,7 @@ export default new Vuex.Store({
     doctor,
     title,
     personnelname,
+    equipment,
     socialservices,
     technicalservice,
     scienceactivities,

+ 27 - 27
src/views/infoview/equipment/index.vue

@@ -20,6 +20,8 @@ import list1 from '@/layout/infoview/equipment/list-1.vue';
 import info1 from '@/layout/infoview/equipment/info-1.vue';
 import adminFrame from '@common/src/components/mobile-frame/mobile-main.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('equipment');
+const _ = require('lodash');
 export default {
   name: 'index',
   props: {},
@@ -32,36 +34,11 @@ export default {
   data: function () {
     return {
       active: 0,
-      list: [
-        {
-          count1: null,
-          count2: null,
-          count3: null,
-          count4: null,
-          count5: null,
-          count6: null,
-          createBy: '1',
-          createTime: '2021-10-17 16:14:42',
-          delFlag: '0',
-          equipmentMoney: 50,
-          equipmentNumb: null,
-          id: '42d852f2bc9944feaca6671630b38aa0',
-          instrumentsNumb: 'Y',
-          name: '特种设备3',
-          params: {},
-          rate: 0.07778,
-          remark: null,
-          researchHour: 60,
-          searchValue: null,
-          servicesHour: 80,
-          updateBy: '特种设备3',
-          updateTime: '2021-10-17 16:25:37',
-        },
-      ],
+      list: [],
       total: 0,
       limit: 5,
       // 设备总数信息
-      totalInfo: { p1: 1, p2: 1, p3: 50.0, p4: 60.0, p5: 80.0, p6: 0.0778 },
+      totalInfo: {},
       // 弹框
       dialog: { show: false, title: '详细信息', type: '1' },
       // 详细信息
@@ -70,10 +47,33 @@ export default {
   },
   async created() {
     await this.search();
+    await this.toTotal();
   },
   methods: {
+    ...mapActions(['query', 'count']),
     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)) {
+        this.$set(this, `list`, res.rows);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    async toTotal() {
+      const res = await this.count();
+      if (this.$checkRes(res)) {
+        const data = _.head(res.rows);
+        const num = 6;
+        const prefix = 'count';
+        let obj = {};
+        for (let n = 1; n <= num; n++) {
+          const key = `${prefix}${n}`;
+          const value = data[key];
+          obj[`p${n}`] = value;
+        }
+        this.$set(this, `totalInfo`, obj);
+        console.log(this.totalInfo);
+      }
     },
     // 查看信息
     async toView(data) {