Blame view

ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountHeaderList.vue 12.1 KB
1
2
3
4
5
6
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
7
8
9
10
11
12
13
14
15
16
17
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="盘点单编码">
              <a-input placeholder="请输入盘点单编码" v-model="queryParam.code"></a-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
18
19
20
21
22
23
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div class="table-operator">
易文鹏 authored
24
      <a-button v-has="'cycleCountHeader:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button>
25
      <a-button v-has="'cycleCountHeader:export'" type="primary" icon="download" @click="handleExportXls('盘点主表')">导出</a-button>
26
27
      <a-upload v-has="'cycleCountHeader:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
                :action="importExcelUrl" @change="handleImportExcel">
28
29
30
31
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
32
          <a-menu-item key="1" @click="batchDel">
33
34
            <a-icon type="delete" />
            删除
35
          </a-menu-item>
36
        </a-menu>
37
        <a-button style="margin-left: 8px"> 批量操作
38
          <a-icon type="down" />
39
        </a-button>
40
41
42
43
44
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
45
46
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项
47
48
49
50
51
52
53
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
曾湘平 authored
54
        :scroll="{x:true}"
55
56
57
58
59
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
曾湘平 authored
60
61
        :customRow="clickThenSelect"
        :rowClassName="rowClassName"
62
63
        class="j-table-force-nowrap"
        @change="handleTableChange">
李泰瑜 authored
64
        <!-- 内嵌table区域 begin -->
65
66
67
68
69
70
71
        <!--        <template slot="expandedRowRender" slot-scope="record">-->
        <!--          <a-tabs tabPosition="top">-->
        <!--            <a-tab-pane tab="盘点明细" key="cycleCountDetailId" forceRender>-->
        <!--              <cycle-count-detail-list :record="record" :isLoad="true"/>-->
        <!--            </a-tab-pane>-->
        <!--          </a-tabs>-->
        <!--        </template>-->
李泰瑜 authored
72
        <!-- 内嵌table区域 end -->
73
74
75
76
77
78
79
        <span slot="companyCode" slot-scope="companyCode">
          <a-tag :key="companyCode" color=blue>
            {{ solutionCompany(companyCode) }}
          </a-tag>
        </span>

        <span slot="countType" slot-scope="countType">
80
          <a-tag :key="countType" :color="getCountTypeColor(countType)">
81
82
83
84
            {{ solutionCountType(countType) }}
          </a-tag>
        </span>
85
86
87
88
89
90
        <span slot="statusCyc_dictText" slot-scope="statusCyc_dictText">
            <a-tag :key="statusCyc_dictText" :color="getStatusColor(statusCyc_dictText)">
              {{ statusCyc_dictText }}
            </a-tag>
        </span>
91
        <span slot="action" slot-scope="text, record">
92
          <a v-if="record.statusCyc === 1" @click="cycleCountDetailAdd(record)">新增</a>
93
          <a-divider type="vertical" v-if="record.statusCyc !== 100" />
94
          <a-dropdown>
95
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
96
            <a-menu slot="overlay">
谭毅彬 authored
97
              <a-menu-item v-has="'cycleCountHeader:edit'">
98
                <a v-if="record.statusCyc === 1" @click="handleEdit(record)">编辑</a>
99
100
              </a-menu-item>
              <a-menu-item>
101
102
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
103
              <a-menu-item v-if="record.statusCyc === 1" v-has="'cycleCountHeader:delete'">
谭毅彬 authored
104
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
105
106
107
108
109
110
111
112
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
曾湘平 authored
113
114
115
116
117
118

    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="盘点明细" key="1">
        <Cycle-Count-Detail-List ref="CycleCountDetailList"></Cycle-Count-Detail-List>
      </a-tab-pane>
    </a-tabs>
119
    <cycle-count-header-modal ref="modalForm" @ok="modalFormOk"></cycle-count-header-modal>
120
    <cycle-count-detail-modal ref="detailModalForm" @ok="detailModalFormOk" />
121
122
123
124
125
  </a-card>
</template>

<script>
126
import '@/assets/less/TableExpand.less'
127
128
129
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getCompanyList, getCountTypeList } from '@/api/api'
130
import CycleCountHeaderModal from './modules/CycleCountHeaderModal'
131
132
133
import CycleCountDetailList from './CycleCountDetailList'
import Utils from '@/components/jeecgbiz/JButtonBizComponent/util.js'
import CycleCountDetailModal from './modules/CycleCountDetailModal'
134
135
136
137
138
export default {
  name: 'CycleCountHeaderList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
139
    CycleCountDetailModal,
140
    CycleCountHeaderModal,
141
    CycleCountDetailList
142
143
144
145
146
  },
  data() {
    return {
      description: '盘点主表管理页面',
      companyList: [],
147
      countTypeList: [],
148
149
150
151
      // 表头
      columns: [
        {
          title: 'ID',
152
          dataIndex: 'id',
153
          width: 60,
154
155
156
157
158
          align: 'center'
          /* key: 'rowIndex',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }*/
159
        },
160
161
        {
          title: '盘点单编码',
162
          align: 'center',
163
          dataIndex: 'code'
164
        },
165
166
        {
          title: '货主编码',
167
          align: 'center',
168
169
          dataIndex: 'companyCode',
          key: 'companyCode',
170
          scopedSlots: { customRender: 'companyCode' }
171
172
173
        },
        {
          title: '总货位数',
174
          align: 'center',
175
176
177
178
          dataIndex: 'totalLocs'
        },
        {
          title: '总物料数',
179
          align: 'center',
180
181
182
183
          dataIndex: 'totalItems'
        },
        {
          title: '盘点类型',
184
          align: 'center',
185
186
          dataIndex: 'countType',
          key: 'countType',
187
          scopedSlots: { customRender: 'countType' }
188
189
190
        },
        {
          title: '盘点主单状态',
191
          align: 'center',
192
          dataIndex: 'statusCyc_dictText',
193
          scopedSlots: { customRender: 'statusCyc_dictText' }
194
195
196
        },
        {
          title: '指定盘点人员',
197
          align: 'center',
198
199
200
201
          dataIndex: 'stocktakingAs'
        },
        {
          title: '实际盘点人员',
202
          align: 'center',
203
204
205
206
          dataIndex: 'stocktakingAc'
        },
        {
          title: '是否有效',
207
          align: 'center',
208
209
210
211
          dataIndex: 'enable_dictText'
        },
        {
          title: '备注',
212
          align: 'center',
213
214
215
216
217
          dataIndex: 'remark'
        },
        {
          title: '操作',
          dataIndex: 'action',
218
          align: 'center',
219
          width: 147,
220
          scopedSlots: { customRender: 'action' }
221
222
223
        }
      ],
      url: {
224
225
226
227
228
        list: '/cycleCountHeader/cycleCountHeader/list',
        delete: '/cycleCountHeader/cycleCountHeader/delete',
        deleteBatch: '/cycleCountHeader/cycleCountHeader/deleteBatch',
        exportXlsUrl: '/cycleCountHeader/cycleCountHeader/exportXls',
        importExcelUrl: 'cycleCountHeader/cycleCountHeader/importExcel'
229
      },
230
      superFieldList: []
231
232
233
    }
  },
  created() {
234
235
    this.getSuperFieldList()
    this.loadFrom()
236
  },
237
  mounted() {
238
    let that = this
239
240
241
242
    Utils.$on('refreshCycleCountHeader', () => {
      that.loadData()
    })
  },
243
  computed: {
244
245
246
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
247
248
249
250
251
  },
  methods: {
    initDictConfig() {
    },
    getSuperFieldList() {
252
253
254
255
256
257
258
259
260
261
262
263
264
265
      let fieldList = []
      fieldList.push({ type: 'string', value: 'code', text: '盘点主表编号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'companyCode', text: '货主编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'countType', text: '盘点类型', dictCode: '' })
      fieldList.push({ type: 'int', value: 'statusCyc', text: '盘点状态', dictCode: 'cycleCount_status' })
      fieldList.push({ type: 'string', value: 'remark', text: '备注', dictCode: '' })
      fieldList.push({ type: 'int', value: 'totalLocs', text: '总货位数', dictCode: '' })
      fieldList.push({ type: 'int', value: 'totalItems', text: '总物料数', dictCode: '' })
      fieldList.push({ type: 'string', value: 'stocktakingAs', text: '指定盘点人员', dictCode: '' })
      fieldList.push({ type: 'string', value: 'stocktakingAc', text: '实际盘点人员', dictCode: '' })
      fieldList.push({ type: 'int', value: 'enable', text: '是否有效', dictCode: 'valid_status' })
      fieldList.push({ type: 'datetime', value: 'uploadTime', text: '回传时间' })
      fieldList.push({ type: 'int', value: 'uploadStatus', text: '回传状态', dictCode: 'valid_status' })
      fieldList.push({ type: 'string', value: 'closedBy', text: '关闭人', dictCode: '' })
266
267
      this.superFieldList = fieldList
    },
曾湘平 authored
268
    onClearSelected() {
269
270
      this.selectedRowKeys = []
      this.selectionRows = []
曾湘平 authored
271
272
    },
    onSelectChange(selectedRowKeys, selectionRows) {
273
274
275
      this.selectedRowKeys = selectedRowKeys
      this.selectionRows = selectionRows
      this.$refs.CycleCountDetailList.loadDatas(this.selectedRowKeys[0])
曾湘平 authored
276
    },
277
    clickThenSelect(record, index) {
曾湘平 authored
278
279
280
      return {
        on: {
          click: () => {
281
282
            this.selectIndex = index
            this.onSelectChange([record.id], [record])
曾湘平 authored
283
284
285
286
287
288
289
          }
        }
      }
    },
    rowClassName(record, index) {
      return index === this.selectIndex ? 'Rowactive' : ''
    },
290
291
292
293
294
    loadFrom() {
      getCompanyList().then((res) => {
        if (res.success) {
          this.companyList = res.result
        }
295
      })
296
297
      getCountTypeList().then((res) => {
        if (res.success) {
298
          this.countTypeList = res.result
299
        }
300
      })
301
    },
302
    solutionCompany(value) {
303
      let actions = []
304
      Object.keys(this.companyList).some((key) => {
305
        if (this.companyList[key].code === ('' + value)) {
306
307
308
309
310
311
312
          actions.push(this.companyList[key].name)
          return true
        }
      })
      return actions.join('')
    },
    solutionCountType(value) {
313
      let actions = []
314
315
316
      Object.keys(this.countTypeList).some((key) => {
        if (this.countTypeList[key].code === ('' + value)) {
          actions.push(this.countTypeList[key].name)
317
318
319
320
321
          return true
        }
      })
      return actions.join('')
    },
322
323
324
325
    cycleCountDetailAdd(record) {
      this.$refs.detailModalForm.title = '库存'
      this.$refs.detailModalForm.cycleCountHeader = record
      this.$refs.detailModalForm.visible = true
326
    },
327
328
    detailModalFormOk() {
      this.loadData()
肖超群 authored
329
      // this.searchQuery();
330
331
332
333
334
335
336
    },
    getStatusColor(status) {
      const colors = {
        '新建': 'green',
        '已登记': 'orange',
        '盘点完成': 'grey',
        default: 'blue'
337
338
      }
      return colors[status] || colors.default
339
340
341
342
343
344
345
346
    },
    getCountTypeColor(countType) {
      const colors = {
        '01': 'cyan',
        '02': 'purple',
        '明盘': 'cyan',
        '暗盘': 'purple',
        default: 'blue'
347
348
      }
      return colors[countType] || colors.default
349
    }
350
  }
351
}
352
353
</script>
<style scoped>
354
@import '~@assets/less/common.less';
355
</style>