|
@@ -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) {
|