stock-taking.vue 10.6 KB
<template>
    <div class="container resource close-left-menu">

        <div class="pop-banner clearfix">
            <div class="operate-btns">
                <a class="fbtn fb-create " v-link="{path : 'stockTakingCreate'}">制定盘点单</a>
                <a @click="exportPdstockdetail" class="fbtn fb-Print2 mr-20 m-20">导出盘点单</a>

            </div>
            <h3 class="current-module">盘点单</h3>
        </div>

        <!--order-orderlist-view start-->
        <div class="order-orderlist-view clearfix">

            <div class="pd-form form-label4em mb-40 fast-search-form">
                <div class="group-row">
                    <div class="form-group">
                        <div class="control">
                            <input type="text" v-rule maxlength="17" v-model="search.billno" title='盘点单号' placeholder="盘点单号">
                        </div>
                    </div>
                    <div class="form-group form-required form-label">
                        <select v-model="search.depotguid">
                            <option value="" style='display:none;' selected> 请选择 库房 </option>
                            <option :value="ite.guid" v-for="ite in getDepartmentList">{{ite.hdeptname}}</option>
                        </select>
                    </div>
                </div>
                <div class="group-row">
                    <div class="form-group">
                        <!-- <label for="cn1" class="label">退货日期</label> -->
                        <div class="control control-date" style="height:34px;overflow: inherit;">
                            <div style="width: 44%;float: left">
                                <datepicker :target.sync='search.begindate' :readonly="readonlyFlag" title='退货开始日期' placeholder="拣货开始日期" styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;"></datepicker>
                            </div>
                            <span class="text-and" style="width: 45px"></span>
                            <div style="width: 46%;float: right;">
                                <datepicker :target.sync="search.enddate" :readonly="readonlyFlag" title='退货结束日期' placeholder="拣货结束日期" styleobj="width:100% !important;border-radius:0px 8px 8px 0px !important;"></datepicker>
                            </div>
                        </div>
                    </div>

                </div>

                <div class="group-row">
                    <div class="form-group" style='width:560px;'>
                        <label class="label">单据状态</label>
                        <div class="control control-filtering control-filtering-green fl w450">
                            <a class="option" href="javascript:;" :class="{'all active':search.billstate==''}" v-on:click="search.billstate=''">全部</a>
                            <a class="option" href="javascript:;" :class="{'all active':search.billstate=='PD1'}" v-on:click="search.billstate='PD1'">未盘点</a>
                            <a class="option" href="javascript:;" :class="{'all active':search.billstate=='PD2'}" v-on:click="search.billstate='PD2'">已盘点</a>
                        </div>
                    </div>
                </div>

                <div class="group-row t-right">
                    <button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" @click="getData">查 询</button>
                </div>
            </div>

            <table class="itable itable-td-long-text">
                <thead>
                <tr>
                    <th class="w70"> 序号</th>
                    <th class="w160">盘点单号</th>
                    <th class="w100">盘点库房</th>
                    <th class="w100">录入员</th>
                    <th class="w100">盘点日期</th>
                    <th class="w100">录入日期</th>
                    <th class="w100">品规数</th>
                    <th class="w100">盘点状态</th>
                    <th class="w100">盘点来源</th>
                    <th class="w100">备注</th>
                    <th class="w100">操作</th>
                </tr>
                </thead>
                <tbody class="txt_v">
                <tr v-if="getDeptApplyList==null || getDeptApplyList.length==0">
                    <td colspan="11">暂无符合条件的记录</td>
                </tr>
                <tr v-for="item in getDeptApplyList" v-else>
                    <td class="w30">
                        <div class="control radio-control">
                            <input type="radio" id="radio{{$index+1}}" v-model="checkBillno" value="{{item.guid}}" style="opacity: 0;">
                            <label class="radio mr-0" for="radio{{$index+1}}"> {{ $index + 1 }}</label>
                        </div>

                    </td>
                    <td>{{item.billno}}</td>
                    <td>{{item.depotname}}</td>

                    <td>{{item.operatername}}</td>

                    <td>{{item.pddate|getYMD}}</td>
                    <td>{{item.inputdate|getYMD}}</td>
                    <td>{{item.detailrecordsum}}</td>

                    <td>{{item.billstate|pdstate}}</td>
                    <td>{{item.pdsource==1?'正常盘点':'拣货异常'}}</td>

                    <td>{{item.memo}}</td>
                    <td>
                        <a class="btn button-green" v-link="{path : 'stockTakingDetail/'+item.guid}">明细</a>
                    </td>
                </tr>
                </tbody>
            </table>

            <pagination @page-change="getData" :class="['m-20-0']" :page-no.sync="search.page" :total-pages.sync="search.totalPages">
            </pagination>

        </div>
        <!--order-orderlist-view end-->

    </div>
</template>
<script>
    module.exports = {
        data: function() {
            return {
                search: {
                    page: 1,
                    totalPages: 1,
                    pageSize: 50,
                    pageNo: 0,
                    billno: '',
                    depotguid: '',
                    begindate: '',
                    enddate: '',
                    billstate: '',
                },
                getDepartmentList: '', // 科室list
                getDeptApplyList: '',
                checkBillno: '',
            };
        },
        methods: {
            init: function() {
                var self = this;
                // 查询库房
                Ajax.post('/procurment/getDeptListOut').
                then(function(response) {
                    var res = response.data.data;
                    if(response.data.errorCode == 0) {
                        self.$set('getDepartmentList', res);
                    } else {
                        self.MessageBox({
                            title: '提示',
                            message: response.data.message,
                            type: 'alert'
                        }, function(action) {});
                    }

                })
            },
            getData: function() {
                var self = this;
                Ajax.post('/procurment/getTrmedpdstock', self.search).
                then(function(response) {
                    var res = response.data.data;
                    if(response.data.errorCode == 0) {
                        self.$set('getDeptApplyList', res.list);
                        self.search.pageNo = res.pageNo;
                        self.search.totalPages = res.totalPages;
                    } else {
                        self.MessageBox({
                            title: '提示',
                            message: response.data.message,
                            type: 'alert'
                        }, function(action) {});
                    }

                })
            },

            exportPdstockdetail: function() {
                var self = this;
                if(!self.checkBillno) {
                    self.MessageBox({
                        title: '提示',
                        message: '请选择盘点单',
                        type: 'alert'
                    }, function(action) {});
                    return;
                }
                Ajax.post('/procurment/exportPdstockdetail', {
                    guid: self.checkBillno
                }).
                then(function(response) {

                    window.open(response.data);

                    //					if(response.data.errorCode == 0) {
                    //
                    //						window.open(res);
                    //
                    //					} else {
                    //						self.MessageBox({
                    //							title: '提示',
                    //							message: response.data.message,
                    //							type: 'alert'
                    //						}, function(action) {});
                    //					}

                })
            },
            getdate: function() {
                var self = this;
                // 结束日期
                var nowdate = new Date();
                var y = nowdate.getFullYear();
                var m = nowdate.getMonth() + 1;
                m = m >= 10 ? m : '0' + m;
                var d = nowdate.getDate();
                d = d >= 10 ? d : '0' + d;
                self.search.enddate = y + '-' + m + '-' + d;

                // 开始日期
                nowdate.setMonth(nowdate.getMonth() - 1);
                var yn = nowdate.getFullYear();
                var mn = nowdate.getMonth() + 1;
                mn = mn >= 10 ? mn : '0' + mn;
                var dn = nowdate.getDate();
                dn = dn >= 10 ? dn : '0' + dn;
                self.search.begindate = yn + '-' + mn + '-' + dn;
            },
            selectAllsum: function(flag) {
                var self = this;
                if(!flag) {
                    self.getDeptApplyList.forEach(function(item, i) {
                        var data = item.guid + '/' + item.ckbillno + '/' + item.slbillno + '/' + item.slguid + '/' + item.billstate;
                        self.checkArr.push(data);
                    });
                } else {
                    self.$set('checkArr', []);
                    self.getDeptApplyList.forEach(function(item, i) {

                    });
                }
            },
        },
        watch: {
            'search.billstate': function(val) {
                this.getData();

            }
        },

        route: {
            activate: function() {
                this.getdate();
                this.init();
                this.getData();
            }
        }
    };
</script>