| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 | var acceptClick;var selectBomInfo;var calQty;var BillBomInfo = [];var keyValue = request('keyValue');var bootstrap = function ($, learun) {    "use strict";    var classnames = ['yellowCircle'];    var reg = /^(\-|\+)?\d+(\.\d+)?$/;    var regex = /^[1-9]\d*$/;    const StampChildTypes = ["WS34芯股--异常", "WS18--异常", "WS50--异常", "WS09--异常"];    var selectedRow = learun.frameTab.currentIframe().selectedRow;    var page = {        init: function () {            page.bind();            page.initData();        },        bind: function () {            // 设置小圆圈的点击事件            //$('.circle').click(function () {            //    $(this).toggleClass('selectedactive');            //});            for (var i = 0; i < StampChildTypes.length; i++) {                let id = i + 1;                $("#StampChildType").append($("<option value='" + id + "'>" + StampChildTypes[i] + "</option>"));            }            $("#StampChildType").on('change', function () {                for (var i = 0; i < StampChildTypes.length; i++) {                    let id = i + 1;                    if ($(this).val() == id) {                        $("#StampChildType" + id).show();                    }                    else {                        $("#StampChildType" + id).hide();                    }                }            });            $("#StampChildType").val(1).change();            // 设置小圆圈的点击事件            $('.clickcircle').click(function () {                //for (var i = 0; i < classnames.length; i++) {                //    if ($(this).attr('class').indexOf(classnames[i]) >= 0) {                //        $(this).removeClass(classnames[i]);                //        $(this).addClass('selectedactive');                //    }                //}                $(this).toggleClass(classnames[0]);            });        },        initData: function () {            if (!!keyValue) {                learun.httpAsync('GET', top.$.rootUrl + '/FJManager/BillBomSet/GetBillBomsetinfo', { id: keyValue }, function (res) {                    if (res.code > 0) {                        BillBomInfo = res.data;                        $('#form').lrSetFormData(res.data);                        $("#StampChildType").val(BillBomInfo.StampChildType).change();                        $("#StampChildType" + BillBomInfo.StampChildType).show();                        for (var i = 0; i < BillBomInfo.Bomsetinfos.length; i++) {                            var item = BillBomInfo.Bomsetinfos[i];                            $("#StampChildType" + BillBomInfo.StampChildType).children().each(function () {                                var id = $(this).text();                                if (item.XYNo == id) {                                    $(this).removeClass('selectedactive');                                    $(this).addClass(classnames[item.CategoryId]);                                }                            });                            //$("#allcontainer > div").children().each(function () {                            //    var id = $(this).text();                            //    if (item.XYNo == id) {                            //        $(this).removeClass('selectedactive');                            //        $(this).addClass(classnames[item.CategoryId]);                            //    }                            //});                        }                    }                });            }        }    };    // 保存数据    acceptClick = function (callBack) {        if (!$('#form').lrValidform()) {            return false;        }        var postData = $('#form').lrGetFormData();        postData.StampChildType = $("#StampChildType").val();        var setInfos = [];        //$("#allcontainer > div").children().each(function () {        $("#StampChildType" + postData.StampChildType).children().each(function () {            for (var i = 0; i < classnames.length; i++) {                var setinfo = {};                if ($(this).attr('class').indexOf(classnames[i]) >= 0) {                    setinfo["XYNo"] = $(this).text();                    setinfo["CategoryId"] = i;                    setinfo["IsEmpty"] = 0;                    setInfos.push(setinfo);                }            }        });        if (!$('#form').lrValidform()) {            return false;        }        if (setInfos.length == 0) {            learun.alert.error('请选择跺型编号。');            return false;        }        postData.ProMaterCode = '';        postData.HWCountQty = 0;        postData.ProCode = '';        postData.BomCode = '';        postData.LayerCountQty = 1;        postData.Category = 3;        postData.StampType = 6;        postData.TpTypeCode = '2';        postData.TotalQty = $("#StampChildType" + postData.StampChildType + " .clickcircle").length;        if (postData.StampChildType == '4') {            postData.TpTypeCode = '1';        }        postData.Bomsetinfos = setInfos;                $.lrSaveForm(top.$.rootUrl + '/FJManager/BillBomSet/SaveExceptionForm?keyValue=' + keyValue, postData, function (res) {            // 保存成功后才回调            if (!!callBack) {                callBack();            }        });    };    page.init();}
 |