Blame view

ant-design-vue-jeecg/src/views/dashboard/Analysis.vue 4.47 KB
肖超群 authored
1
<template>
谭毅彬 authored
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="add">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item :label="$t('scanin.scanCodeText')">
              <a-input :placeholder="$t('scanin.inputScanCodeText')" v-model="queryParam.context" ref="input" @blur="focus"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{ x: false }"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="false"
        class="j-table-force-nowrap"
        @change="handleTableChange"
      ></a-table>
    </div>
  </a-card>
肖超群 authored
32
33
</template>
谭毅彬 authored
34
35
36
37
38
39
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { httpGroupRequest } from '@/api/GroupRequest.js'
import { getAction, postAction } from '@/api/manage'
肖超群 authored
40
41

export default {
谭毅彬 authored
42
43
44
45
  name: 'ScaninRecordList',
  mixins: [JeecgListMixin, mixinDevice],
  props: ['groupId'],
  components: {},
肖超群 authored
46
47
  data() {
    return {
谭毅彬 authored
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
      description: '上线扫码管理页面',
      dataSource: [],
      isorter: {
        column: 'createTime',
        order: 'desc'
      },
      // 表头
      columns: [
        {
          title: 'ID',
          align: 'center',
          dataIndex: 'id'
        },
        {
          title: this.$t('scanin.scanCodeText'),
          align: 'center',
          dataIndex: 'context'
        },
        {
          title: this.$t('scanin.status'),
          align: 'center',
          dataIndex: 'status'
        },
        {
          title: this.$t('system.remark'),
          align: 'center',
          dataIndex: 'remark'
        },
        {
          title: this.$t('system.createTime'),
          align: 'center',
          dataIndex: 'createTime'
        },
        {
          title: this.$t('system.updateTime'),
          align: 'center',
          dataIndex: 'updateTime'
        }
      ],
      url: {
        list: '/scan/scaninRecord/list',
        add: '/scan/scaninRecord/add'
      },
      dictOptions: {},
      superFieldList: []
肖超群 authored
93
94
95
    }
  },
  mounted() {
谭毅彬 authored
96
97
98
99
100
101
102
103
104
105
106
107
108
    // 每隔3秒定时刷新
    this.timer = setInterval(() => {
      this.loadPeriodData()
    }, 30000)
  },
  created() {
    this.$nextTick(() => this.$refs.input.focus())
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
肖超群 authored
109
110
  },
  methods: {
谭毅彬 authored
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
    focus() {
      this.$nextTick(() => this.$refs.input.focus())
    },
    add() {
      let params = Object.assign({}, this.queryParam, this.isorter)
      let url = `${this.url.add}`
      //缓存key
      let groupIdKey
      if (this.groupId) {
        groupIdKey = this.groupId + url
      }
      httpGroupRequest(() => postAction(url, params), groupIdKey).then(res => {
        if (res.success) {
          if (res.message != '') {
            this.$notification.success({
              message: this.$t('system.systemMessage'),
              description: this.queryParam.context + ' ' + this.$t('scanin.scanSuccessful')
            })
            this.loadPeriodData()
          }
        } else {
          this.$notification.error({
            message: this.$t('system.systemMessage'),
            description: res.message
          })
        }
        this.searchReset()
      })
    },
    initDictConfig() {},
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'context', text: 'context', dictCode: '' })
      fieldList.push({ type: 'string', value: 'status', text: 'status', dictCode: '' })
      this.superFieldList = fieldList
    },
    async loadPeriodData() {
      let params = Object.assign({}, null, this.isorter)
      let url = `${this.url.list}`
      //缓存key
      let groupIdKey
      if (this.groupId) {
        groupIdKey = this.groupId + url
      }
      httpGroupRequest(() => getAction(url, params), groupIdKey).then(res => {
        let data = res.result
        console.info(data.records)
        if (data.length > 0) {
          this.dataSource = data
        } else {
          this.dataSource = []
        }
      })
李泰瑜 authored
164
165
    }
  }
肖超群 authored
166
}
李泰瑜 authored
167
168
</script>
<style scoped>
谭毅彬 authored
169
@import '~@assets/less/common.less';
李泰瑜 authored
170
</style>