懒羊羊
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
layui.use(['table', 'admin', 'ax', 'func'], function () {
    var $ = layui.$;
    var table = layui.table;
    var $ax = layui.ax;
    var admin = layui.admin;
    var func = layui.func;
 
    /**
     * 物料信息管理
     */
    var MaterialInfo = {
        tableId: "materialInfoTable"
    };
 
    /**
     * 初始化表格的列
     */
    MaterialInfo.initColumn = function () {
        return [[
            {type: 'checkbox'},
            {field: 'id', hide: true, title: '主键id'},
            {field: 'materialCode', sort: true, title: '物料编号',width:130},
            {field: 'materialName', sort: true, title: '物料名称',width:180},
            {field: 'materialView', sort: true, title: '视图'},
            {field: 'typeZ', sort: true, title: '种类'},
            {field: 'typeL', sort: true, title: '类型'},
            {field: 'unit', sort: true, title: '单位'},
            {field: 'matterVersion', sort: true, title: '版本'},
            {field: 'remarks', sort: true, title: '备注'},
            {field: 'createUser', sort: true, title: '创建用户',width:120},
            {field: 'createTime', sort: true, title: '创建时间',width:160},
            {field: 'updateUser', sort: true, title: '更改用户',width:120},
            {field: 'updateTime', sort: true, title: '更改时间',width:160},
        ]];
    };
 
    /**
     * 点击查询按钮
     */
    MaterialInfo.search = function () {
        var queryData = {};
 
        queryData['materialCode'] = $('#materialCode').val();
        queryData['materialName'] = $('#materialName').val();
        queryData['materialView'] = $('#materialView').val();
        queryData['typeL'] = $('#typeL').val();
 
        table.reload(MaterialInfo.tableId, {
            where: queryData, page: {curr: 1}
        });
    };
 
    // 渲染表格
    var tableResult = table.render({
        elem: '#' + MaterialInfo.tableId,
        url: Feng.ctxPath + '/materialInfo/list',
        page: true,
        height: "full-158",
        cellMinWidth: 100,
        cols: MaterialInfo.initColumn()
    });
 
    // 搜索按钮点击事件
    $('#btnSearch').click(function () {
        MaterialInfo.search();
    });
 
    /**
     * 点击查询按钮
     */
    MaterialInfo.search = function () {
        var queryData = {};
 
        queryData['materialCode'] = $('#materialCode').val();
        queryData['materialName'] = $('#materialName').val();
        queryData['materialView'] = $('#materialView').val();
        queryData['typeL'] = $('#typeL').val();
 
        table.reload(MaterialInfo.tableId, {
            where: queryData, page: {curr: 1}
        });
    };
 
    let Msg='';
    table.on('row(materialInfoTable)',function (data) {
        Msg = data.data;
    })
 
    $('#btnSubmit').focus(function(){
        if (Msg !='' ){
            // 判断是否点击的是确定
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            window.localStorage.setItem('message',JSON.stringify(Msg));
            parent.layer.close(index);
        }
        else {
            Feng.error("请选择一条数据!")
        }
    });
});