ScanApprove: function () {
            //if (c.PrintSelected.length != 0) {
            pbui.Dialog('Scan.html', {}, ['$scope', '$uibModalInstance', 'paramObj', '$timeout', '$translate', function ($scope, $uibModalInstance, paramObj, $timeout, $translate) {
                var dc = this;
                var interval =  setInterval("document.getElementById(\"txtPONo\").focus()", 50);//文本框光标显示
                $('<audio id="beepAudio"><source src="../Content/music/beep.mp3" type="audio/mpeg"></audio>').appendTo('body');
                dc.Event = {
                    ScanApproved: function () {
                        function Beep() { $('#beepAudio')[0].play(); }
                        if (event.keyCode == 13 && dc.vm.PONo != null && dc.vm.PONo != "") {
                            $timeout(function () {
                                pb.CallAction("/PO/TobeApproved/ScanApprove?" + 'pONo=' + dc.vm.PONo, null, function (ret) {
                                    var tempPONo = dc.vm.PONo;
                                    if (ret.data) {
                                        dc.vm.PONo = "";
                                        $translate('ApprovedPO_SendSucceed').then(function (mess) {
                                            dc.vm.Result = "PONo:" + tempPONo + mess;
                                        })
                                        var item = c.vm.ResultList.filter(function (x) { return x.PONo == tempPONo})[0];
                                        var index = c.vm.ResultList.indexOf(item);
                                        c.vm.ResultList.splice(index, 1);
                                        c.PrintSelected = [];
                                        c.DataSource.read();
                                        //dc.Event.Close();
                                    } else {
                                            Beep();
                                            dc.vm.PONo = "";
                                            $translate('ApprovedPO_SendFailed').then(function (mess) {
                                                dc.vm.Result = "PONo:" + tempPONo + mess;
                                            })
                                        }
                                    })
                            });
                        }
                    },
                    Close: function () {
                        clearInterval(interval);//停止
                        $uibModalInstance.close();
                    },
                }
            }], 'md')
            //} else {
            //    pbui.Alert("PleaseSelectAtLeastOneMultipleBox");
            //}
        },

 

posted on 2021-02-02 16:09  蒙蒙浮霁月  阅读(138)  评论(0编辑  收藏  举报