ke_junjie
2025-06-04 84620534eb627e95811b971a4b552b6a177829bf
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
<template>
    <el-dialog
        custom-class="sy-modal"
        
        title="新建出库任务"
        width="700px"
        append-to-body
        :before-close="close"
    >
        <div class="sy-default-choose-table-modal-content" v-loading="loading">
            <search-bar @search="onSearch" @reset="onReset">
                <el-form :inline="true" class="search-form" label-width="80px">
                    <el-form-item label="货位编号">
                        <el-input placeholder="请输入..." clearable class="default-form-width" v-model.trim="query.srmStationCode"></el-input>
                    </el-form-item>
                </el-form>
            </search-bar>
            
            <el-table :data="list" ref="list" border stripe>
                <el-table-column width="80" label="序号" fixed align="center">
                    <template #default="scope">{{(queried.page-1)*queried.pageSize+(scope.$index+1)}}</template>
                </el-table-column>
                <el-table-column prop="SrmStationCode" label="货位编号" />
                <el-table-column prop="Qty" label="数量" />
                <el-table-column label="操作" width="100" align="center" fixed="right">
                    <template #default="scope">
                        <el-button type="primary" size="small" @click="onConfirm(scope.row)">出库</el-button>
                    </template>
                </el-table-column>
            </el-table>
            
            <div class="pagination-row">
                <el-pagination :pager-count="5" layout="total, prev, pager, next, jumper" :total="total" @current-change="onPageList" />
            </div>
        </div>
        <template #footer>
            <span class="dialog-footer">
                <el-button @click="onClose">关&nbsp;闭</el-button>
            </span>
        </template>
    </el-dialog>
</template>
 
<script>
import SearchBar from '@/components/SearchBar.vue'
const defaultQuery = {
    srmStationCode:'',
    srmStationCode_FilterMode:'1',
    stationIsHasTaskDoing:false,
    stationIsHasTaskDoing_FilterMode:'2',
    materialType:2,
    materialType_FilterMode:'2'
}
export default {
    name:'tasksOfCarriersOutputNewCompontent',
    components:{SearchBar},
    emits:['submitCallback','update:visible'],
    props:{
        visible:{
            type:Boolean,
            default:false
        },
        selectList:{
            type:Object,
            default:function(){
                return {
                    series:[],
                    types:[]
                }
            }
        }
    },
    data(){
        return {
            loading:false,
            list:[],
            total:100,
            query:{...defaultQuery},
            queried:{...this.$config.pagination}
        }
    },
    watch:{
        visible(newVal,oldVal){
            if (newVal!==oldVal) {
                if (newVal) {
                    this.initModal();
                } 
            }
        }
    },
    methods:{
        initModal(){
            this.reset()
        },
        close(){
            this.$emit('update:visible',false)
        },
        onClose(){
            this.close();
        },
        /* 搜索按钮 */
        onSearch(){
            this.newList()
        },
        /* 重置按钮 */
        onReset(){
            this.reset();
        },
        reset(needLoading=true,callback){
            this.query = {...defaultQuery}
            this.newList(needLoading,callback)
        },
        /* 翻页功能 */
        onPageList(page){
            this.queried.page = page;
            this.getList();
        },
        /* 表格刷新至首页 */
        newList(needLoading=true,callback){
            this.queried = {...this.query,...this.$config.pagination}
            this.getList(callback,needLoading)
        },
        /* 更新数据表 */
        getList(callback,needLoading=true){
            if (needLoading) {
                this.loading = true;
            }
            this.$api.post('Get',this.queried,{block:'store'}).then((d)=>{
                this.total = d.total;
                this.list = d.list || []
                if (needLoading) {
                    this.loading = false;
                }
                callback && callback(true)
            }).catch((err)=>{
                if (needLoading) {
                    this.loading = false;
                }
                callback && callback(false)
            })
        },
        onConfirm(row){
            let params = {stationId:row.StationId}
            this.dealSubmit(params,(f)=>{
                if (f) {
                    this.close();
                    this.$emit('submitCallback')
                }
            })
        },
        dealSubmit(params,callback){
            this.loading = true;
            this.$api.post('EmptySalversOutStore',{},{block:'taskMain'},params).then(()=>{
                this.loading = false;
                this.$message.success('新增出库任务成功!')
                callback(true)
            }).catch(()=>{
                this.loading = false;
                callback(false)
            })
        }
    }
}
</script>
 
<style scoped lang="scss">
</style>