懒羊羊
2023-11-14 abb175b29054b9708af27136c035b1b7351dcd20
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
 
layui.use(['table'], function () {
    var $ = layui.jquery;
    var table = layui.table;
 
    /**
     * 物料信息管理
     */
    var MaterialInfo = {
        tableId: "materialInfoTable"
    };
 
    var materialType = parent.materialType;
 
    $('#serch').click(function(){
        var queryData = {};
        queryData['typeZ'] = materialType;
        queryData['materialName'] = $("#materialName").val();
        queryData['materialCode'] = $("#materialCode").val();
        table.reload(MaterialInfo.tableId, {
            where: queryData, page: {curr: 1}
        });
    });
    /**
     * 缺料报警初始化表格的列
     */
    MaterialInfo.initColumn = function () {
        return [[
            {type: 'radio'},
            {field: 'id', hide: true, title: '主键id'},
            {field: 'materialCode', sort: true, title: '产品编号'},
            {field: 'materialName', sort: true, title: '产品名称'},
            {field: 'typeL', sort: true, title: '类型'},
        ]];
    };
 
    table =  $.extend(table, {config: {checkName: 'checked'}});
 
    var queryData = {};
    queryData['typeL'] = materialType;
    var tableResult = table.render({
        elem: '#' + MaterialInfo.tableId,
        url: Feng.ctxPath + '/materialInfo/list',
        page: true,
        where:queryData,
        cellMinWidth: 80,
        cols: MaterialInfo.initColumn()
    });
    let Msg='';
    table.on('row(materialInfoTable)',function (data) {
        Msg = data.data;
    })
    $('#btnSubmit').click(function(){
        clearType();
        if (Msg !=='' ){
            // 判断是否点击的是确定
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            window.localStorage.setItem('message',JSON.stringify(Msg));
            parent.layer.close(index);
        }
        else {
            Feng.error("请选择一条数据!")
        }
    });
 
    $('#reset').click(function(){
        clearType();
        Msg = "";
        window.localStorage.clear();
    });
 
    function clearType(){
        parent.materialType="";
    }
 
});