123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <div class="modal fade" id="batch-replace" data-backdrop="static">
- <div class="modal-dialog" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">批量替换清单</h5>
- </div>
- <div class="modal-body">
- 原清单:
- <table class="table table-bordered">
- <tr class="text-center"><th width="25%">编号</th><th width="40%">名称</th><th width="15%">单位</th><th width="20%">单价</th></tr>
- <tr><td id="br-org-code"></td><td id="br-org-name"></td><td class="text-center" id="br-org-unit"></td><td class="text-right" id="br-org-up">单价</td></tr>
- </table>
- 替换为:
- <table class="table table-bordered">
- <tr class="text-center"><th width="25%">编号</th><th width="40%">名称</th><th width="15%">单位</th><th width="20%">单价</th></tr>
- <tr>
- <td><input id="br-new-code" type="text" class="form-control form-control-sm"></td>
- <td><input id="br-new-name" type="text" class="form-control form-control-sm"></td>
- <td><input id="br-new-unit" type="text" class="form-control form-control-sm text-center"></td>
- <td><input id="br-new-up" type="text" class="form-control form-control-sm text-right"></td></tr>
- </table>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-sm btn-secondary" data-dismiss="modal">关闭</button>
- <a href="javascript: void(0);" class="btn btn-sm btn-primary" id="batch-replace-ok">确定</a>
- </div>
- </div>
- </div>
- </div>
- <script>
- const BatchReplace = (function() {
- const orgValue = { code: '', name: '', unit: '', unit_price: 0 };
- let doReplace;
- const load = function(code, name, unit, unit_price, callback) {
- orgValue.code = code || '';
- orgValue.name = name || '';
- orgValue.unit = unit || '';
- orgValue.unit_price = unit_price || 0;
- $('#br-org-code').html(orgValue.code);
- $('#br-org-name').html(orgValue.name);
- $('#br-org-unit').html(orgValue.unit);
- $('#br-org-up').html(orgValue.unit_price || '');
- $('#br-new-code').val(orgValue.code);
- $('#br-new-name').val(orgValue.name);
- $('#br-new-unit').val(orgValue.unit);
- $('#br-new-up').val(orgValue.unit_price || '');
- doReplace = callback;
- $('#batch-replace').modal('show');
- }
- $('#batch-replace-ok').click(function() {
- if (doReplace) {
- const newValue = { code: $('#br-new-code').val(), name: $('#br-new-name').val(), unit: $('#br-new-unit').val(), unit_price: parseFloat($('#br-new-up').val()), };
- doReplace(orgValue, newValue);
- }
- $('#batch-replace').modal('hide');
- });
- return { load };
- })();
- </script>
|