schangxiang@126.com
2024-04-23 f47411fb53aeee0c7bd514cbc841f9030349f448
1
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
<template>
  <div>
    <!-- 收货单 -->
    <a-card :bordered="false" :bodyStyle="tstyle">
      <div class="table-page-search-wrapper" v-if="hasPerm('WmsReceiptOrder:page')">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="8" :sm="24">
              <a-form-item label="单据编号">
                <a-input v-model="queryParam.no" allow-clear placeholder="请输入单据编号" />
              </a-form-item>
            </a-col>
            <a-col :md="8" :sm="24">
              <a-form-item label="送货通知单号">
                <a-input v-model="queryParam.sourceBillno" allow-clear placeholder="请输入送货通知单号" />
              </a-form-item>
            </a-col><template v-if="advanced">
              <a-col :md="8" :sm="24">
                <a-form-item label="供应商编码">
                  <a-input v-model="queryParam.vendorcode" allow-clear placeholder="请输入供应商编码" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="供应商名称">
                  <a-input v-model="queryParam.vendorname" allow-clear placeholder="请输入供应商名称" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="公司名称">
                  <a-input v-model="queryParam.companyname" allow-clear placeholder="请输入公司名称" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="仓管员">
                  <a-input v-model="queryParam.warehouseKeepername" allow-clear placeholder="请输入仓管员" />
                </a-form-item>
              </a-col><a-col :md="8" :sm="24">
                <a-form-item label="贸易方式">
                  <a-select :allowClear="true" style="width: 100%" v-model="queryParam.tradeMode" placeholder="请选择贸易方式">
                    <a-select-option v-for="(item, index) in tradeModeData" :key="index" :value="item.code">{{ item.name
                    }}</a-select-option>
                  </a-select>
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="仓储中心">
                  <a-input v-model="queryParam.warehouseCentername" allow-clear placeholder="请输入仓储中心" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="仓间">
                  <a-input v-model="queryParam.storeRoomname" allow-clear placeholder="请输入仓间" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="报关单号">
                  <a-input v-model="queryParam.declarationCode" allow-clear placeholder="请输入报关单号" />
                </a-form-item>
              </a-col>
              <a-col :md="8" :sm="24">
                <a-form-item label="专业">
                  <a-input v-model="queryParam.majorname" allow-clear placeholder="请输入专业" />
                </a-form-item>
              </a-col><a-col :md="8" :sm="24">
                <a-form-item label="单据状态">
                  <a-select :allowClear="true" style="width: 100%" v-model="queryParam.orderStatus" placeholder="请选择单据状态">
                    <a-select-option v-for="(item, index) in orderStatusData" :key="index" :value="item.code">{{ item.name
                    }}</a-select-option>
                  </a-select>
                </a-form-item>
              </a-col> </template>
 
            <a-col :md="8" :sm="24">
              <span class="table-page-search-submitButtons">
                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
                <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
                <a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
                  <a-icon :type="advanced ? 'up' : 'down'" />
                </a>
              </span>
            </a-col>
 
          </a-row>
        </a-form>
      </div>
    </a-card>
    <a-card :bordered="false">
      <!-- :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" -->
      <s-table ref="table" :scroll="{ x: true }" :columns="columns" :data="loadData" :alert="true"
        :rowKey="(record) => record.id" >
        <template slot="index" slot-scope="text, record, index">{{ index + 1 }}</template>
 
        <template slot="linkSlot" slot-scope="text,record">
          <a @click="onOpenInfo(record)">{{ text }}</a>
        </template>
 
        <template class="table-operator" slot="operator" v-if="hasPerm('WmsReceiptOrder:add')">
 
          <a-button type="info" v-if="hasPerm('sysExcelTemplate:importExcel')" icon="upload" @click="$refs.excelForm.index()">
            导入
          </a-button>
          <a-button type="info" v-if="hasPerm('wmsReceiptOrder:exportExcel')" icon="download" @click="wmsReceiptOrderToExcel()">
            导出
          </a-button>
          <a-button type="primary" v-if="hasPerm('WmsReceiptOrder:add')" icon="plus" @click="$refs.addForm.add()">更新</a-button>
        </template>
        <span slot="tradeModescopedSlots" slot-scope="text">
          {{ 'trade_mode' | dictType(text) }}
        </span>
        <!-- <span slot="orderStatusscopedSlots" slot-scope="text">
          {{ 'order_statusenum' | dictType(text) }}
        </span> -->
        <span slot="action" slot-scope="text, record">
          <!-- <a v-if="hasPerm('WmsReceiptOrder:edit')" :class="[record.orderStatus == 4 ? 'disabled' : '']" @click="$refs.editForm.edit(record)">收货</a> -->
          <a v-if="hasPerm('WmsReceiptOrder:edit')" :class="[record.orderStatus == 4 ? 'disabled' : '']"
            @click="onDistribute(record)">收货</a>
 
            &nbsp;&nbsp;&nbsp;
 
            <a v-if="hasPerm('WmsReceiptOrder:edit')" :class="[record.receivingStatus == 1 ? 'disabled' : '']"
            @click="onDistributeBj(record)">报检</a>
 
          <!-- <a v-if="hasPerm('WmsReceiptOrder:edit')" @click="$refs.editForm.edit(record)">编辑</a> -->
          <!-- <a-divider type="vertical" v-if="hasPerm('WmsReceiptOrder:edit') & hasPerm('WmsReceiptOrder:delete')"/> -->
          <!-- <a-popconfirm v-if="hasPerm('WmsReceiptOrder:delete')" placement="topRight" title="确认删除?" @confirm="() => WmsReceiptOrderDelete(record)">
            <a>删除</a>
          </a-popconfirm> -->
        </span>
 
        <!-- <span slot="orderStatusscopedSlots" slot-scope="text">
          <a-tag :color="text == '2' ? '#daa520' : (text == '1' ? '#cd5c5c' : (text == '3' ? '#add8e6' : '#696969'))">{{ 'order_statusenum'
            | dictType(text) }}</a-tag>
        </span> -->
 
 
        <span slot="receivingStatusscopedSlots" slot-scope="text">
          <a-tag :color="text == '2' ? '#daa520' : (text == '1' ? '#cd5c5c' : (text == '3' ? '#add8e6' : '#696969'))">{{ 'ReceivingStatus'
            | dictType(text) }}</a-tag>
        </span>
 
 
        <span slot="inspectionStatusscopedSlots" slot-scope="text">
          <a-tag :color="text == '2' ? '#daa520' : (text == '1' ? '#cd5c5c' : (text == '3' ? '#add8e6' : '#696969'))">{{ 'InspectionStatus'
            | dictType(text) }}</a-tag>
        </span>
 
 
 
      </s-table>
      <add-form ref="addForm" @ok="handleOk" />
      <edit-form ref="editForm" @ok="handleOk" />
      <detail-drawer ref="tableDetailDrawer" :visible.sync="infoVisible" :row="infoRow"  @postBjData="postBjData"/>
    </a-card>
  </div>
</template>
<script>
import { STable } from '@/components'
import { WmsReceiptOrderPage, WmsReceiptOrderDelete ,WmsReceiptOrderSh ,WmsOrderBaojian} from '@/api/modular/main/WmsReceiptOrderManage'
import addForm from './addForm.vue'
import editForm from './editForm.vue'
import DetailDrawer from './DetailDrawer.vue'
 
export default {
  components: {
    STable,
    addForm,
    editForm,
    DetailDrawer
  },
  data() {
    return {
      advanced: false, // 高级搜索 展开/关闭
      queryParam: {},
      columns: [
      {
          dataIndex: 'index',
          title: '序号',
          fixed: 'left',
          width: '60',
          scopedSlots: { customRender: 'index' },
          align: 'center'
        },
        {
          title: '单据编号',
          align: 'center',
          fixed: 'left',
          dataIndex: 'no',
          scopedSlots: { customRender: 'linkSlot' },
          width: "140px"
        },
        // {
        //   title: '单据状态',
        //   align: 'center',
        //   dataIndex: 'orderStatus',
        //   scopedSlots: { customRender: 'orderStatusscopedSlots' },
        //   width: "100px"
        // },
 
        {
          title: '收货状态',
          align: 'center',
          dataIndex: 'receivingStatus',
          scopedSlots: { customRender: 'receivingStatusscopedSlots' },
          width: "100px"
        },
        {
          title: '报检状态',
          align: 'center',
          dataIndex: 'inspectionStatus',
          scopedSlots: { customRender: 'inspectionStatusscopedSlots' },
          width: "100px"
        },
 
        {
          title: '创建日期',
          align: 'center',
          dataIndex: 'billdate',
          width: "160px"
        },
        {
          title: '送货通知单号',
          align: 'center',
          dataIndex: 'sourceBillNo',
          width: "160px"
        },
        {
          title: '供应商编码',
          align: 'center',
          dataIndex: 'vendorcode',
          width: "160px"
        },
        {
          title: '供应商名称',
          align: 'center',
          dataIndex: 'vendorname',
          width: "160px"
        },
        {
          title: '公司名称',
          align: 'center',
          dataIndex: 'companyname',
          width: "160px"
        },
        {
          title: '仓管员',
          align: 'center',
          dataIndex: 'warehouseKeepername',
          width: "100px"
        },
        {
          title: '贸易方式',
          align: 'center',
          dataIndex: 'tradeMode',
          scopedSlots: { customRender: 'tradeModescopedSlots' },
          width: "100px"
        },
        {
          title: '仓储中心',
          align: 'center',
          dataIndex: 'warehouseCentername',
          width: "160px"
        },
        {
          title: '仓间',
          align: 'center',
          dataIndex: 'storeRoomname',
          width: "100px"
        },
        {
          title: '报关单号',
          align: 'center',
          dataIndex: 'declarationCode',
          width: "100px"
        },
        {
          title: '专业',
          align: 'center',
          dataIndex: 'majorname',
          width: "100px"
        },
        {
          title: '备注',
          align: 'center',
          dataIndex: 'remarks',
          width: "100px"
        },
 
      ],
      tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
       
        return WmsReceiptOrderPage(Object.assign(parameter, this.queryParam)).then((res) => {
 
          this.$nextTick(()=>{
            if(res.data.rows && res.data.rows.length>0){
              this.onOpenInfo(res.data.rows[0]);
            }
          })
// // 测试数据
//           res.data.rows.forEach(element => {
//             element.receivingStatus =1;
//             element.inspectionStatus =1;
//           });
          return res.data
        })
      },
      tradeModeData: [],
      orderStatusData: [],
      selectedRowKeys: [],
      selectedRows: [],
      //详情变量
      infoRow: {},
      infoVisible: false,
      postBjDataArr: []
    }
  },
  created() {
    if (this.hasPerm('WmsReceiptOrder:edit') || this.hasPerm('WmsReceiptOrder:delete')) {
      this.columns.push({
        title: '操作',
        width: '150px',
        dataIndex: 'action',
        fixed: 'right',
        scopedSlots: { customRender: 'action' }
      })
    }
    const tradeModeOption = this.$options
    this.tradeModeData = tradeModeOption.filters['dictData']('trade_mode')
    const orderStatusOption = this.$options
    this.orderStatusData = orderStatusOption.filters['dictData']('order_statusenum')
 
  },
  methods: {
    /**
     * 查询参数组装
     */
    switchingDate() {
      const obj = JSON.parse(JSON.stringify(this.queryParam))
      return obj
    },
    WmsReceiptOrderDelete(record) {
      WmsReceiptOrderDelete(record).then((res) => {
        if (res.success) {
          this.$message.success('删除成功')
          this.$refs.table.refresh()
        } else {
          this.$message.error('删除失败') // + res.message
        }
      })
    },
    toggleAdvanced() {
      this.advanced = !this.advanced
    },
    handleOk() {
      this.$refs.table.refresh()
    },
    onSelectChange(selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    },
    //详情
    onOpenInfo(row) {
      this.infoVisible = true;
      this.infoRow = row;
      if(row){
       this.$refs.tableDetailDrawer.getList(row);
      }
    },
 
// 收货
    onDistribute(obj) {
      // if (obj.orderStatus !== 1 && obj.orderStatus !== 4) return false
      // if (obj.orderStatus == 1) return false
 
      if(this.postBjDataArr.length<=0 || obj.id != this.postBjDataArr[0].orderId){
        this.$message.error('请选中此单据下的物料!')
        return
      }
      this.$confirm({
        title: '系统提示',
        content: '您将要进行收货任务的操作,确认要继续嘛?',
        okText: '确认',
        cancelText: '取消',
        onOk: () => {
          let param = {
            "no":obj.no,
            getOrderDetailOutputList: this.postBjDataArr
          }
          WmsReceiptOrderSh(param).then(res => {
            if (res.success) {
              this.$message.success('操作成功')
              this.$refs.table.refresh()
              this.$refs.tableDetailDrawer.clearAll()
            } else {
              this.$message.error('操作失败')
            }
          })
        }
      })
    },
 
      // 选中的物料
      postBjData(data) {
      this.postBjDataArr = data
    },
// 报检
    onDistributeBj(obj) {
      // if (obj.orderStatus !== 1 && obj.orderStatus !== 4) return false
      // if (obj.orderStatus == 1) return false
      if(this.postBjDataArr.length<=0 || obj.id != this.postBjDataArr[0].orderId){
        this.$message.error('请选中此单据下的物料!')
        return
      }
      this.$confirm({
        title: '系统提示',
        content: '您将要进行报检任务的操作,确认要继续嘛?',
        okText: '确认',
        cancelText: '取消',
        onOk: () => {
          let param = {
            ...obj,
            dtls: this.postBjDataArr
          }
          WmsOrderBaojian(param).then(res => {
            if (res.success) {
              this.$message.success('操作成功')
              this.$refs.table.refresh()
            } else {
              this.$message.error('操作失败')
            }
          })
        }
      })
    },
 
  }
}
</script>
<style lang="less">
.table-operator {
  margin-bottom: 18px;
}
 
button {
  margin-right: 8px;
}
</style>