Blame view

ant-design-vue-jeecg/src/views/system/config/MaterialMultipleList.vue 7.34 KB
1
2
3
4
5
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
6
        <a-row :gutter="24"></a-row>
7
8
9
10
11
12
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
易文鹏 authored
13
      <a-button v-has="'materialMultiple:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button>
14
15
16
17
18
19
      <a-button
        v-has="'materialMultiple:export'"
        type="primary"
        icon="download"
        @click="handleExportXls('物料单位换算')"
        >导出
20
      </a-button>
21
22
23
24
25
26
27
28
29
      <a-upload
        v-has="'materialMultiple:import'"
        name="file"
        :showUploadList="false"
        :multiple="false"
        :headers="tokenHeader"
        :action="importExcelUrl"
        @change="handleImportExcel"
      >
30
31
32
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
易文鹏 authored
33
        <a-menu slot="overlay" v-has="'materialMultiple:deleteBatch'">
34
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
35
        </a-menu>
36
        <a-button style="margin-left: 8px">批量操作<a-icon type="down"/></a-button>
37
      </a-dropdown>
38
39
40
41
42
      <j-super-query
        :fieldList="superFieldList"
        v-has="'materialMultiple:superQuery'"
        @handleSuperQuery="handleSuperQuery"
      />
43
44
45
46
47
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
48
49
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项
50
51
52
53
54
55
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
56
        :scroll="{ x: true }"
57
58
59
60
61
62
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
63
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
64
        class="j-table-force-nowrap"
谭毅彬 authored
65
66
67
68
69
70
71
        @change="handleTableChange">

        <span slot="companyCode" slot-scope="companyCode">
          <a-tag :key="companyCode" color=blue>
            {{ solutionCompany(companyCode) }}
          </a-tag>
        </span>
72
73

        <span slot="action" slot-scope="text, record">
易文鹏 authored
74
          <a v-has="'materialMultiple:edit'" @click="handleEdit(record)">编辑</a>
75
76
          <a-divider type="vertical" />
77
          <a-dropdown>
肖超群 authored
78
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
79
80
81
82
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
易文鹏 authored
83
              <a-menu-item v-has="'materialMultiple:delete'">
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>

    <material-multiple-modal ref="modalForm" @ok="modalFormOk"></material-multiple-modal>
  </a-card>
</template>

<script>
肖超群 authored
99
import '@/assets/less/TableExpand.less'
100
101
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
肖超群 authored
102
import MaterialMultipleModal from './modules/MaterialMultipleModal'
谭毅彬 authored
103
import {getCompanyList} from "@api/api"
104
肖超群 authored
105
106
107
108
109
110
111
112
113
export default {
  name: 'MaterialMultipleList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    MaterialMultipleModal
  },
  data() {
    return {
      description: '物料单位换算管理页面',
谭毅彬 authored
114
      companyList: [],
肖超群 authored
115
116
117
118
119
120
121
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
122
123
124
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
125
126
          }
        },
肖超群 authored
127
128
        {
          title: '物料编码',
129
          align: 'center',
肖超群 authored
130
131
132
133
          dataIndex: 'materialCode'
        },
        {
          title: '物料名称',
134
          align: 'center',
肖超群 authored
135
136
137
138
          dataIndex: 'materialName'
        },
        {
          title: '物料规格',
139
          align: 'center',
肖超群 authored
140
141
142
          dataIndex: 'materialSpec'
        },
        {
谭毅彬 authored
143
          title: '货主',
144
          align: 'center',
谭毅彬 authored
145
146
147
          dataIndex: 'companyCode',
          key: 'companyCode',
          scopedSlots: {customRender: 'companyCode'}
肖超群 authored
148
149
        },
        {
150
151
          title: '基准单位',
          align: 'center',
肖超群 authored
152
153
154
          dataIndex: 'unit1'
        },
        {
155
156
          title: '转换单位',
          align: 'center',
肖超群 authored
157
158
159
          dataIndex: 'unit2'
        },
        {
160
161
          title: '转换比率',
          align: 'center',
肖超群 authored
162
163
164
165
          dataIndex: 'multiple'
        },
        {
          title: '创建人',
166
          align: 'center',
肖超群 authored
167
168
169
170
          dataIndex: 'createBy'
        },
        {
          title: '创建日期',
171
          align: 'center',
肖超群 authored
172
173
174
175
          dataIndex: 'createTime'
        },
        {
          title: '更新人',
176
          align: 'center',
肖超群 authored
177
178
179
180
          dataIndex: 'updateBy'
        },
        {
          title: '更新日期',
181
          align: 'center',
肖超群 authored
182
183
184
185
186
          dataIndex: 'updateTime'
        },
        {
          title: '操作',
          dataIndex: 'action',
187
188
          align: 'center',
          fixed: 'right',
肖超群 authored
189
          width: 147,
190
          scopedSlots: { customRender: 'action' }
肖超群 authored
191
192
193
        }
      ],
      url: {
194
195
196
197
198
        list: '/config/materialMultiple/list',
        delete: '/config/materialMultiple/delete',
        deleteBatch: '/config/materialMultiple/deleteBatch',
        exportXlsUrl: '/config/materialMultiple/exportXls',
        importExcelUrl: 'config/materialMultiple/importExcel'
肖超群 authored
199
200
      },
      dictOptions: {},
201
      superFieldList: []
肖超群 authored
202
203
204
    }
  },
  created() {
205
    this.getSuperFieldList()
谭毅彬 authored
206
    this.loadFrom();
肖超群 authored
207
208
  },
  computed: {
209
210
211
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
肖超群 authored
212
213
  },
  methods: {
214
    initDictConfig() {},
谭毅彬 authored
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
    loadFrom() {
      getCompanyList().then((res) => {
        if (res.success) {
          this.companyList = res.result
        }
      });
    },
    solutionCompany(value) {
      var actions = []
      Object.keys(this.companyList).some((key) => {
        if (this.companyList[key].code == ('' + value)) {
          actions.push(this.companyList[key].name)
          return true
        }
      })
      return actions.join('')
    },
肖超群 authored
232
    getSuperFieldList() {
233
234
235
236
237
238
239
240
      let fieldList = []
      fieldList.push({ type: 'string', value: 'materialCode', text: '物料编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'materialName', text: '物料名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'materialSpec', text: '物料规格', dictCode: '' })
      fieldList.push({ type: 'string', value: 'companyCode', text: '货主编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'unit1', text: '基准单位', dictCode: '' })
      fieldList.push({ type: 'string', value: 'unit2', text: '转换单位', dictCode: '' })
      fieldList.push({ type: 'double', value: 'multiple', text: '转换比率', dictCode: '' })
肖超群 authored
241
      this.superFieldList = fieldList
242
243
    }
  }
肖超群 authored
244
}
245
246
</script>
<style scoped>
肖超群 authored
247
@import '~@assets/less/common.less';
248
</style>