王佳豪
2021-05-14 27a6c44642cd3328f9b2afa4f52a4c4b65624d0f
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
156
157
158
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <title>库存明细详情</title>
    <link rel="stylesheet" href="../../static/layui/css/layui.css" media="all">
    <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script>
    <script type="text/javascript" src="../../static/js/handlebars/handlebars-v4.5.3.js"></script>
    <style>
        .form-box {
            padding: 15px 5px 5px 5px;
            font-size: 16px;
            text-align: center;
        }
 
        .form-item {
            margin-bottom: 10px;
        }
 
        .form-box span {
            display: inline-block;
            text-align: right;
        }
        .form-box input {
            width: 160px;
            padding-left: 5px;
            height: 30px;
            border: 1px solid #777777;
            overflow:hidden;
            white-space:nowrap;
            text-overflow:ellipsis;
        }
 
        .number-tool {
            margin-left: 10px;
            padding: 1px 0 1px 5px;
            display: inline-block;
            width: 120px;
        }
        .number-tool:after {
            clear: both;
            content: "";
            display: table;
        }
        .number-tool button {
            background-color: #fff;
            margin-top: 3px;
            font-size: 16px;
            height: 25px;
            float: left;
            width: 25px;
            border: 1px solid #777777;
        }
        .number-tool input {
            text-align: center;
            height: 30px;
            float: left;
            margin: 0 5px;
            width: 40px;
            padding: 0;
        }
 
        .form-button {
            margin: 5px 10px 0 10px;
            padding: 5px 15px;
        }
    </style>
</head>
<body>
<div class="form-box">
    <div class="form-item">
        <table style="display: inline">
            <tr>
                <td>
                    <span style="width: 35px; margin-right: 5px">库位</span>
                </td>
                <td style="text-align: left">
                    <input id="locNo" type="text" disabled="disabled">
                </td>
            </tr>
        </table>
    </div>
    <div class="form-item">
        <table style="display: inline">
            <tr>
                <td>
                    <span style="width: 35px; margin-right: 5px">编码</span>
                </td>
                <td style="text-align: left">
                    <input id="matnr" type="text" disabled="disabled">
                </td>
            </tr>
        </table>
    </div>
    <div class="form-item">
        <table style="display: inline">
            <tr>
                <td style="vertical-align: top">
                    <span style="width: 35px; margin-right: 5px">名称</span>
                </td>
                <td style="text-align: left">
                    <textarea rows="4" style="width: 165px; resize: none" id="maktx" type="text" disabled="disabled" readonly="readonly"></textarea>
                </td>
            </tr>
        </table>
    </div>
    <div class="form-item">
        <span style="vertical-align: middle">数量</span>
        <div class="number-tool" style="vertical-align: middle">
            <button onclick="reduce()">-</button>
            <input id="count" type="number">
<!--            <button onclick="add()">+</button>-->
        </div>
    </div>
    <button class="form-button" id="save" onclick="save()">保存</button>
    <button class="form-button" id="remove" onclick="remove()">移除</button>
</div>
</body>
<script>
    var countDom = $('#count');
 
    function save() {
        console.log(countDom.val())
        if (countDom.val() < 1) {
            return;
        }
        parent.updateTableData({
            locNo: $('#locNo').val(),
            matnr: $('#matnr').val(),
            maktx: $('#maktx').val(),
            count: countDom.val()
        })
        parent.layer.closeAll();
    }
 
    function remove() {
        parent.removeTableData({
            locNo: $('#locNo').val(),
            matnr: $('#matnr').val(),
        })
        parent.layer.closeAll();
    }
 
    function add() {
        countDom.val(Number(countDom.val()) + 1);
    }
    function reduce() {
        if (countDom.val() <= 1) {
            return;
        }
        countDom.val(countDom.val() - 1);
    }
</script>
</html>