username@email.com
2024-06-26 7f26cd7c3e492062418cdc7dbe9d7ce14cbe5f05
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<title>库存操作详情表</title>
<!--当前位置开始-->
<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
        </script>
    </div>
</div>
<!--当前位置结束-->
<style>
    /* 重写样式 */
</style>
<script type="text/html" template lay-type="Post" lay-url="{{ layui.setter.apiUrl }}Api/CoreCmsStockLog/GetIndex" lay-done="layui.data.done(d);">
    
</script>
 
<script type="text/html" id="LAY-app-CoreCmsStockLog-toolbar">
    <div class="layui-form coreshop-toolbar-search-form">
        <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="stockId" placeholder="请输入关联单号" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="sn" placeholder="请输入货品编码" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="bn" placeholder="请输入商品编码" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" name="goodsName" placeholder="请输入商品名称" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <select name="type">
                        <option value="">请选择类型</option>
                        {{# layui.each(indexData.stockType, function(index, item){ }}
                        <option value="{{ item.value }}">{{ item.description }}</option>
                        {{# }); }}
                    </select>
                </div>
            </div>
 
            <div class="layui-inline">
                <div class="layui-input-inline core-time-input">
                    <input type="text" name="createTime" id="searchTime-CoreCmsStock-createTime" placeholder="请输入时间段" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsStockLog-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
            </div>
        </div>
    </div>
</script>
 
<div class="table-body">
    <table id="LAY-app-CoreCmsStockLog-tableBox" lay-filter="LAY-app-CoreCmsStockLog-tableBox"></table>
</div>
 
<script>
    var indexData;
    var debug = layui.setter.debug;
    layui.data.done = function (d) {
        //开启调试情况下获取接口赋值数据
        if (debug) { console.log(d); }
 
        indexData = d.data;
        layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
            function () {
                var $ = layui.$
                    , admin = layui.admin
                    , table = layui.table
                    , form = layui.form
                    , laydate = layui.laydate
                    , setter = layui.setter
                    , coreHelper = layui.coreHelper
                    , util = layui.util
                    , view = layui.view;
 
 
                //重载form
                form.render();
                var searchwhere;
                //监听搜索
                form.on('submit(LAY-app-CoreCmsStockLog-search)',
                    function (data) {
                        var field = data.field;
                        searchwhere = field;
                        //执行重载
                        table.reloadData('LAY-app-CoreCmsStockLog-tableBox', { where: field });
                    });
                //数据绑定
                table.render({
                    elem: '#LAY-app-CoreCmsStockLog-tableBox',
                    url: layui.setter.apiUrl + 'Api/CoreCmsStockLog/GetPageList',
                    method: 'POST',
                    toolbar: '#LAY-app-CoreCmsStockLog-toolbar',
                    defaultToolbar: ['filter', 'print', 'exports'],
                    height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
                    page: true,
                    limit: 30,
                    limits: [10, 15, 20, 25, 30, 50, 100, 200],
                    text: { none: '暂无相关数据' },
                    cols: [
                        [
                            { field: 'id', title: '序列', width: 40, sort: false },
                            { field: 'stockId', title: '关联单号', sort: false, width: 150 },
                            { field: 'memo', title: '备注', sort: false, width: 250 },
                            { field: 'goodsName', title: '商品名称', sort: false },
                            { field: 'spesDesc', title: '货品规格', sort: false },
                            //{ field: 'productId', title: '货品序列', sort: false, width: 105 },
                            //{ field: 'goodsId', title: '商品序列', sort: false, width: 105 },
                            {
                                field: 'type', title: '操作类型', sort: false, width: 105, templet: function (data) {
                                    for (var i = 0; i < d.data.stockType.length; i++) {
                                        if (data.type == d.data.stockType[i].value) {
                                            return d.data.stockType[i].description;
                                        }
                                    }
                                    return "";
                                }
                            },
                            { field: 'sn', title: '货品编码', sort: false, width: 130 },
                            { field: 'bn', title: '商品编码', sort: false, width: 130 },
                            { field: 'nums', title: '数量', sort: false, width: 105 },
                            { field: 'createTime', title: '时间', sort: false, width: 130 },
                        ]
                    ]
                });
                //监听排序事件
                table.on('sort(LAY-app-CoreCmsStockLog-tableBox)', function (obj) {
                    table.reloadData('LAY-app-CoreCmsStockLog-tableBox', {
                        initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
                        where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
                            orderField: obj.field, //排序字段
                            orderDirection: obj.type //排序方式
                        }
                    });
                });
                
                laydate.render({
                    elem: '#searchTime-CoreCmsStock-createTime',
                    type: 'datetime',
                    range: '到',
                });
            });
    };
</script>