| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 | 
							- 'use strict';
 
- /**
 
-  * 变更令-审批页js
 
-  *
 
-  * @author EllisRan.
 
-  * @date 2018/11/22
 
-  * @version
 
-  */
 
- $(document).ready(() => {
 
-     $('#sp-back input[name="status"]').click(function (e) {
 
-         if($(e.target).is('label')){
 
-             return;
 
-         }
 
-         if (parseInt($(this).val()) === 4) {
 
-             $('.change-approval-stop').show();
 
-             $('.change-approval-back').hide();
 
-         } else {
 
-             $('.change-approval-stop').hide();
 
-             $('.change-approval-back').show();
 
-         }
 
-     });
 
-     // 清单输入监控并更新
 
-     $('body').on('valuechange', '.clist input', function (e, previous) {
 
-         const amount = $(this).val();
 
-         const lid = $(this).parents('tr').data('lid');
 
-         const tr = $('#list tr[data-lid="' + lid + '"]').eq(0);
 
-         const unitprice = tr.children('td[data-site="5"]').text();
 
-         tr.children('.amount_cost').text(amount != '' ?
 
-             roundnum(parseFloat(unitprice).mul(parseFloat(amount)),totalPriceUnit) : '');
 
-         // 统计总金额
 
-         let totalcost = 0;
 
-         $('.clist').each(function(){
 
-             const utotal = $(this).find('.amount_cost').text();
 
-             totalcost = utotal != '' ? parseFloat(totalcost)+parseFloat(utotal) : parseFloat(totalcost);
 
-         });
 
-         $('.amount_totalcost').eq(1).text(totalcost !== 0 ? roundnum(totalcost, totalPriceUnit) : '');
 
-     });
 
-     // 选中input所有值
 
-     $('body').on('focus', ".clist input", function() {
 
-         $(this).select();
 
-     });
 
-     // 审批提交与判断
 
-     $('.approval-btn').on('click', function () {
 
-         // 判断审批状态
 
-         let returnflag = true;
 
-         if ($(this).hasClass('btn-success')) {
 
-             const sdesc = $('#success-approval').find('textarea').val();
 
-             if (sdesc === '') {
 
-                 toastr.error('审批意见不能为空!');
 
-                 returnflag = false;
 
-             }
 
-             if ($('input[name="p_code"]').val() === '') {
 
-                 toastr.error('变更令号(批复编号)不能为空!');
 
-                 returnflag = false;
 
-             }
 
-             // 判断并提交变更清单表格数据到表单中
 
-             const clist = [];
 
-             $('.clist input').each(function(k, v){
 
-                 const value = $(this).val();
 
-                 const lid = $(this).parents('tr').data('lid');
 
-                 if (value === '') {
 
-                     toastr.error('清单第' + (k+1) + '行审批变更数量不能为空');
 
-                     returnflag = false;
 
-                 }
 
-                 clist.push(lid+'_'+value);
 
-             });
 
-             $('#change-list-approval').val(clist.join(','));
 
-             if(returnflag) {
 
-                 $('input[name="w_code"]').val($('#w_code').val());
 
-                 $('#success-approval').submit();
 
-             }
 
-         } else {
 
-             const sdesc = $('#fail-approval').find('textarea').val();
 
-             if (sdesc === '') {
 
-                 toastr.error('审批意见不能为空!');
 
-                 returnflag = false;
 
-             }
 
-             const type = $('#fail-approval').find('input[name="status"]:checked').val();
 
-             if (type === undefined) {
 
-                 toastr.error('请选择退回类型!');
 
-                 returnflag = false;
 
-             }
 
-             if(returnflag) {
 
-                 $('input[name="w_code"]').val($('#w_code').val());
 
-                 $('#fail-approval').submit();
 
-             }
 
-         }
 
-     })
 
- });
 
 
  |