Blame view

ant-design-vue-jeecg/src/views/system/config/ContainerCapacityList.vue 10.4 KB
肖超群 authored
1
2
3
4
5
6
7
8
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="容器类型">
谭毅彬 authored
9
10
11
12
13
14
15
16
17
18
              <a-select
                show-search
                placeholder="请选择容器类型"
                option-filter-prop="children"
                v-model="queryParam.containerTypeCode"
              >
                <a-select-option v-for="item in containerTypeList" :key="item.name" :value="item.code">
                  {{ item.name }}
                </a-select-option>
              </a-select>
肖超群 authored
19
20
21
22
23
24
25
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料编码">
              <a-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></a-input>
            </a-form-item>
          </a-col>
谭毅彬 authored
26
27
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="是否可用">
28
              <j-dict-select-tag placeholder="请选择是否可用" v-model="queryParam.enable" dictCode="enable_status"/>
谭毅彬 authored
29
30
            </a-form-item>
          </a-col>
肖超群 authored
31
32
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
33
34
              <a-button type="primary" @click="searchQuery" icon="search">{{ $t('button.search') }}</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">{{ $t('button.reset') }}</a-button>
肖超群 authored
35
36
37
38
39
40
41
42
43
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
44
45
      <a-button @click="handleAdd" v-has="'containerCapacity:add'" type="primary" icon="plus">{{ $t('button.new') }}</a-button>
      <a-button v-has="'containerCapacity:export'" type="primary" icon="download" @click="handleExportXls('容器容量管理')">{{ $t('button.export') }}</a-button>
谭毅彬 authored
46
47
48
49
50
51
52
53
54
      <a-upload
        v-has="'containerCapacity:import'"
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel"
      >
55
        <a-button type="primary" icon="import">{{ $t('button.import') }}</a-button>
肖超群 authored
56
57
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
易文鹏 authored
58
        <a-menu slot="overlay" v-has="'containerCapacity:deleteBatch'">
肖超群 authored
59
          <a-menu-item key="1" @click="batchDel">
60
            <a-icon type="delete"/>{{$t('button.delete')}}
肖超群 authored
61
          </a-menu-item>
肖超群 authored
62
        </a-menu>
63
        <a-button style="margin-left: 8px">{{$t('button.multiSelectActions')}}
64
          <a-icon type="down"/>
肖超群 authored
65
        </a-button>
肖超群 authored
66
      </a-dropdown>
67
68
      <j-super-query :fieldList="superFieldList" v-has="'containerCapacity:superQuery'"
                     @handleSuperQuery="handleSuperQuery"/>
肖超群 authored
69
70
71
72
73
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
74
75
76
        <i class="anticon anticon-info-circle ant-alert-icon"></i> {{ $t('button.selected') }}
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> {{ $t('button.item') }}
        <a style="margin-left: 24px" @click="onClearSelected">{{ $t('button.clearAll') }}</a>
肖超群 authored
77
78
79
80
81
      </div>

      <a-table
        ref="table"
        size="middle"
谭毅彬 authored
82
        :scroll="{ x: true }"
肖超群 authored
83
84
85
86
87
88
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
谭毅彬 authored
89
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
肖超群 authored
90
        class="j-table-force-nowrap"
谭毅彬 authored
91
92
93
94
95
96
97
        @change="handleTableChange"
      >
        <span slot="containerTypeCode" slot-scope="containerTypeCode">
          <a-tag :key="containerTypeCode" color="pink">
            {{ solutionContainerType(containerTypeCode) }}
          </a-tag>
        </span>
肖超群 authored
98
99
100
101
102
103

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
谭毅彬 authored
104
105
106
107
108
109
110
          <img
            v-else
            :src="getImgView(text)"
            height="25px"
            alt=""
            style="max-width:80px;font-size: 12px;font-style: italic;"
          />
肖超群 authored
111
112
113
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
谭毅彬 authored
114
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
肖超群 authored
115
116
117
118
            下载
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
119
          <a v-has="'containerCapacity:edit'" @click="handleEdit(record)">{{$t('button.edit')}}<a-divider type="vertical"/></a>
肖超群 authored
120
          <a-dropdown>
121
            <a class="ant-dropdown-link">{{$t('button.more')}}&nbsp;<a-icon type="down"/></a>
肖超群 authored
122
123
            <a-menu slot="overlay">
              <a-menu-item>
124
                <a @click="handleDetail(record)">{{$t('button.details')}}</a>
肖超群 authored
125
              </a-menu-item>
易文鹏 authored
126
              <a-menu-item v-has="'containerCapacity:delete'">
127
128
                <a-popconfirm :title="$t('button.deletingIt')" @confirm="() => handleDelete(record.id)">
                  <a>{{$t('button.delete')}}</a>
肖超群 authored
129
130
131
132
133
134
135
136
137
138
139
140
141
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>

    <container-capacity-modal ref="modalForm" @ok="modalFormOk"></container-capacity-modal>
  </a-card>
</template>

<script>
肖超群 authored
142
import '@/assets/less/TableExpand.less'
143
144
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
肖超群 authored
145
import ContainerCapacityModal from './modules/ContainerCapacityModal'
146
147
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import {getZoneList, getContainerTypeList} from '@/api/api'
肖超群 authored
148
肖超群 authored
149
150
151
152
153
154
155
156
157
export default {
  name: 'ContainerCapacityList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    ContainerCapacityModal
  },
  data() {
    return {
      description: '容器容量管理管理页面',
谭毅彬 authored
158
      containerTypeList: [],
肖超群 authored
159
160
161
162
163
164
165
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
谭毅彬 authored
166
          align: 'center',
167
          customRender: function (t, r, index) {
谭毅彬 authored
168
            return parseInt(index) + 1
肖超群 authored
169
170
          }
        },
肖超群 authored
171
172
        {
          title: '容器类型',
谭毅彬 authored
173
174
175
          align: 'center',
          dataIndex: 'containerTypeCode',
          key: 'containerTypeCode',
176
          scopedSlots: {customRender: 'containerTypeCode'}
肖超群 authored
177
178
179
        },
        {
          title: '物料编码',
谭毅彬 authored
180
          align: 'center',
肖超群 authored
181
182
183
184
          dataIndex: 'materialCode'
        },
        {
          title: '物料名称',
谭毅彬 authored
185
          align: 'center',
肖超群 authored
186
187
188
189
          dataIndex: 'materialName'
        },
        {
          title: '物料单位',
谭毅彬 authored
190
          align: 'center',
肖超群 authored
191
192
193
194
          dataIndex: 'materialUnit'
        },
        {
          title: '存放数量',
谭毅彬 authored
195
          align: 'center',
肖超群 authored
196
197
198
199
          dataIndex: 'qty'
        },
        {
          title: '是否可用',
谭毅彬 authored
200
          align: 'center',
肖超群 authored
201
202
203
          dataIndex: 'enable_dictText'
        },
        {
204
          title: this.$t('system.createBy'),
谭毅彬 authored
205
          align: 'center',
肖超群 authored
206
207
208
          dataIndex: 'createBy'
        },
        {
209
          title: this.$t('system.createTime'),
谭毅彬 authored
210
          align: 'center',
肖超群 authored
211
212
213
          dataIndex: 'createTime'
        },
        {
214
          title: this.$t('system.updater'),
谭毅彬 authored
215
          align: 'center',
肖超群 authored
216
217
218
          dataIndex: 'updateBy'
        },
        {
219
          title: this.$t('system.updateTime'),
谭毅彬 authored
220
          align: 'center',
肖超群 authored
221
222
223
          dataIndex: 'updateTime'
        },
        {
224
          title: this.$t('system.options'),
肖超群 authored
225
          dataIndex: 'action',
谭毅彬 authored
226
227
          align: 'center',
          fixed: 'right',
肖超群 authored
228
          width: 147,
229
          scopedSlots: {customRender: 'action'}
肖超群 authored
230
231
232
        }
      ],
      url: {
谭毅彬 authored
233
234
235
236
237
        list: '/config/containerCapacity/list',
        delete: '/config/containerCapacity/delete',
        deleteBatch: '/config/containerCapacity/deleteBatch',
        exportXlsUrl: '/config/containerCapacity/exportXls',
        importExcelUrl: 'config/containerCapacity/importExcel'
肖超群 authored
238
239
      },
      dictOptions: {},
谭毅彬 authored
240
      superFieldList: []
肖超群 authored
241
242
243
    }
  },
  created() {
谭毅彬 authored
244
245
    this.getSuperFieldList()
    this.loadFrom()
肖超群 authored
246
247
  },
  computed: {
248
    importExcelUrl: function () {
谭毅彬 authored
249
250
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
肖超群 authored
251
252
  },
  methods: {
253
254
    initDictConfig() {
    },
谭毅彬 authored
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
    solutionContainerType(value) {
      var actions = []
      Object.keys(this.containerTypeList).some(key => {
        if (this.containerTypeList[key].code == '' + value) {
          actions.push(this.containerTypeList[key].name)
          return true
        }
      })
      return actions.join('')
    },
    loadFrom() {
      getContainerTypeList().then(res => {
        if (res.success) {
          this.containerTypeList = res.result
        }
      })
肖超群 authored
271
    },
肖超群 authored
272
    getSuperFieldList() {
谭毅彬 authored
273
      let fieldList = []
274
275
276
277
278
279
280
281
282
283
284
285
      fieldList.push({type: 'string', value: 'containerTypeCode', text: '容器类型', dictCode: ''})
      fieldList.push({type: 'string', value: 'warehouseCode', text: '仓库编码', dictCode: ''})
      fieldList.push({type: 'string', value: 'companyCode', text: '货主', dictCode: ''})
      fieldList.push({type: 'string', value: 'materialCode', text: '物料编码', dictCode: ''})
      fieldList.push({type: 'string', value: 'materialName', text: '物料名称', dictCode: ''})
      fieldList.push({type: 'string', value: 'materialUnit', text: '物料单位', dictCode: ''})
      fieldList.push({type: 'BigDecimal', value: 'qty', text: '存放数量', dictCode: ''})
      fieldList.push({type: 'int', value: 'enable', text: '是否可用', dictCode: 'enable_status'})
      fieldList.push({type: 'string', value: 'createBy', text: '创建人', dictCode: ''})
      fieldList.push({type: 'datetime', value: 'createTime', text: '创建日期'})
      fieldList.push({type: 'string', value: 'updateBy', text: '更新人', dictCode: ''})
      fieldList.push({type: 'datetime', value: 'updateTime', text: '更新日期'})
肖超群 authored
286
      this.superFieldList = fieldList
肖超群 authored
287
288
    }
  }
肖超群 authored
289
}
肖超群 authored
290
291
</script>
<style scoped>
肖超群 authored
292
@import '~@assets/less/common.less';
肖超群 authored
293
</style>