machinAccept.js 2.3 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14

layui.config({
    base: basePath,
    version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'jquery', 'winui', 'form'], function (exports) {
    winui.renderColor();
    var index = parent.layer.getFrameIndex(window.name);
    var $ = layui.$,
        form = layui.form;

    var id = GetUrlParam("id");
    var machinMation;
doc_wei's avatar
doc_wei 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

    loadData();
    function loadData() {
        var loadAcceptanceBtn = false;
        AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) {
            machinMation = json.bean;
            $.each(json.bean.machinChildList, function(i, item) {
                item.unitPrice = parseFloat(item.unitPrice).toFixed(2);
                item.quantityNum = item.acceptNum - item.belowNum;
                item.stateName = skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("machinChildStateEnum", 'id', item.state, 'name');
                if (item.state == 'waitForCheckig' && !loadAcceptanceBtn) {
                    loadAcceptanceBtn = true;
                    if (i == (json.bean.machinChildList.length - 1)) {
                        item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal acceptance" rowId="' + item.id + '" subType="2">工序验收</button>';
                    } else {
                        item.operator = '<button type="button" class="layui-btn layui-btn-xs layui-btn-normal acceptance" rowId="' + item.id + '" subType="1">工序验收</button>';
                    }
doc_wei's avatar
doc_wei 已提交
32
                }
doc_wei's avatar
doc_wei 已提交
33 34 35 36
            });
            $("#showForm").html(getDataUseHandlebars($("#useTemplate").html(), json));
        }});
}
doc_wei's avatar
doc_wei 已提交
37 38 39 40 41 42 43 44 45 46 47 48

    // 工序验收
    $("body").on("click", ".acceptance", function() {
        var id = $(this).attr('rowId');
        var subType = $(this).attr('subType');
        _openNewWindows({
            url: "../../tpl/erpMachin/erpMachinAcceptance.html?id=" + id + '&subType=' + subType + '&needNum=' + machinMation.needNum,
            title: '工序验收',
            pageId: "acceptance",
            area: ['90vw', '90vh'],
            callBack: function (refreshCode) {
                winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
doc_wei's avatar
doc_wei 已提交
49
                loadData();
doc_wei's avatar
doc_wei 已提交
50 51 52 53
            }});
    });

});