懒羊羊
2023-11-14 abb175b29054b9708af27136c035b1b7351dcd20
提交 | 用户 | 时间
92cffc 1
2 layui.use(['table'], function () {
3     var $ = layui.jquery;
4     var table = layui.table;
5
6     /**
7      * 物料信息管理
8      */
9     var MaterialInfo = {
10         tableId: "materialInfoTable"
11     };
12
13     var materialType = parent.materialType;
14
15     $('#serch').click(function(){
16         var queryData = {};
17         queryData['typeZ'] = materialType;
18         queryData['materialName'] = $("#materialName").val();
19         queryData['materialCode'] = $("#materialCode").val();
20         table.reload(MaterialInfo.tableId, {
21             where: queryData, page: {curr: 1}
22         });
23     });
24     /**
25      * 缺料报警初始化表格的列
26      */
27     MaterialInfo.initColumn = function () {
28         return [[
29             {type: 'radio'},
30             {field: 'id', hide: true, title: '主键id'},
31             {field: 'materialCode', sort: true, title: '产品编号'},
32             {field: 'materialName', sort: true, title: '产品名称'},
abb175 33             {field: 'typeL', sort: true, title: '类型'},
92cffc 34         ]];
35     };
36
37     table =  $.extend(table, {config: {checkName: 'checked'}});
38
39     var queryData = {};
abb175 40     queryData['typeL'] = materialType;
92cffc 41     var tableResult = table.render({
42         elem: '#' + MaterialInfo.tableId,
43         url: Feng.ctxPath + '/materialInfo/list',
44         page: true,
45         where:queryData,
46         cellMinWidth: 80,
47         cols: MaterialInfo.initColumn()
48     });
49     let Msg='';
50     table.on('row(materialInfoTable)',function (data) {
51         Msg = data.data;
52     })
53     $('#btnSubmit').click(function(){
54         clearType();
55         if (Msg !=='' ){
56             // 判断是否点击的是确定
57             var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
58             window.localStorage.setItem('message',JSON.stringify(Msg));
59             parent.layer.close(index);
60         }
61         else {
62             Feng.error("请选择一条数据!")
63         }
64     });
65
66     $('#reset').click(function(){
67         clearType();
68         Msg = "";
69         window.localStorage.clear();
70     });
71
72     function clearType(){
73         parent.materialType="";
74     }
75
76 });