skyouc
2025-01-08 d1511d2d12b4223882fcfdabd3ba6b59c038edc4
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
<template>
    <a-table :columns="columns" :data-source="datasource" bordered>
        <template #bodyCell="{column, record}">
            <template v-if="column.key === 'operate'">
                <a-button @click="viewDetail(record)" type="link">
                    {{ "查看明细" }}
                </a-button>
                <a-button @click="showDeleteConfirm(record)" danger type="link">{{"删除"}}</a-button>
            </template>
            <template v-if="column.key === 'status'">
               <a-tag :color="record.status === 1 ? 'green' : 'volcano'">
                   {{record.status === 1 ? "正常" : "禁用"}}
               </a-tag>
            </template>
        </template>
    </a-table>
    <a-modal ref="sheetDetl" v-model:open="show" :width="'80%'" title="拣货单明细" @ok="handleOk">
        <a-table :columns="childNodes" :data-source="childList">
            <template #bodyCell="{column, record}">
                <template v-if="column.key === 'status'">
                    <a-tag :color="record.status === 1 ? 'green' : 'volcano'">
                        {{record.status === 1 ? "正常" : "禁用"}}
                    </a-tag>
                </template>
            </template>
        </a-table>
    </a-modal>
</template>
 
<script>
    import {post, get} from "@/utils/request.js";
    import {message, Modal} from "ant-design-vue";
    import { createVNode } from 'vue';
    import {formatMessage} from "@/utils/localeUtils.js";
    import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
 
    export default {
        name: "out-stock-flat",
        data() {
            return {
                columns: [
                    {key: 'number', title: '序号', dataIndex: 'number'},
                    {key: 'pickNo', title: '单号', dataIndex: 'pickNo'},
                    {key: 'waveNo', title: '波次号', dataIndex: 'waveNo'},
                    {key: 'anfme', title: '数量', dataIndex: 'anfme'},
                    {key: 'status', title: '单据状态', dataIndex: 'status'},
                    {key: 'memo', title: '备注', dataIndex: ''},
                    {key: 'createdTime', title: '创建时间', dataIndex: 'createdTime'},
                    {key: 'updatedTime', title: '修改时间', dataIndex: 'updatedTime'},
                    {key: 'operate', title: '操作', dataIndex: 'operate'}
                ],
                childNodes: [
                    {key: 'number', title: '序号', dataIndex: 'number'},
                    {key: 'maktx', title: '物料名称', dataIndex: 'maktx'},
                    {key: 'matnr', title: '物料编码', dataIndex: 'matnr'},
                    {key: 'batch', title: '批号', dataIndex: 'batch'},
                    {key: 'locNo', title: '库位', dataIndex: 'locNo'},
                    {key: 'barcode', title: '拖盘码', dataIndex: 'barcode'},
                    {key: 'anfme', title: '数量', dataIndex: 'anfme'},
                    {key: 'memo', title: '备注', dataIndex: ''},
                    {key: 'status', title: '单据状态', dataIndex: 'status'},
                    // {key: 'operate', title: '操作', dataIndex: 'operate'}
                ],
                datasource: [],
                childList:[],
                show: false,
            }
        },
 
        mounted() {
            //获取拣货单数据源
            this.getOutFlatSheet();
        },
 
        methods: {
             showDeleteConfirm(record){
                 let that = this
                Modal.confirm({
                    title: '是否确认删除当前拣货单',
                    icon: createVNode(ExclamationCircleOutlined),
                    content: '连同明细一起删除',
                    okText: '确认',
                    okType: 'danger',
                    cancelText: '取消',
                    onOk() {
                        that.removeRow(record)
                    },
                    onCancel() {
                        console.log('Cancel');
                    },
                });
            },
 
            //删除当前行
            removeRow(record) {
                let that = this
                get('/api/pick/flat/remove/' + record.id).then((resp)=>{
                    let result = resp.data;
                    if (result.code == 200) {
                        that.getOutFlatSheet()
                        message.success(formatMessage('page.delete.success', '删除成功'));
                    } else {
                        message.error(result.msg);
                    }
                })
            },
            //查看明细
            viewDetail(record) {
                this.show = !this.show
                this.getSheetDetl(record)
            },
            getOutFlatSheet() {
                let that = this
                post('/api/pick/flat/page',{page: {currnt: 1, size: 10}}).then((resp) => {
                    let result = resp.data;
                    if (result.code == 200) {
                        // message.success(formatMessage('page.add.success', '成功'));
                        that.datasource = result.data
                    } else {
                        message.error(result.msg);
                    }
                })
            },
            getSheetDetl(record) {
              let that = this
                post('/api/pick/flat/detl/page',{page: {currnt: 1, size: 10}, params: {pickId: record.id}}).then((resp) => {
                    let result = resp.data;
                    if (result.code == 200) {
                        // message.success(formatMessage('page.add.success', '成功'));
                        that.childList = result.data
                    } else {
                        message.error(result.msg);
                    }
                })
            },
        }
    }
</script>
 
<style scoped>
 
</style>