| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924 | 
							- 'use strict';
 
- /**
 
-  * 变更令上报和重新上报功能js
 
-  *
 
-  * @author EllisRan.
 
-  * @date 2018/11/22
 
-  * @version
 
-  */
 
- $(document).ready(() => {
 
-     // 编号排序,多重判断
 
-     function sortByCode(a, b) {
 
-         let code1 = a.code.split('-');
 
-         let code2 = b.code.split('-');
 
-         let code1length = code1.length;
 
-         let code2length = code2.length;
 
-         for (let i = 0; i < code1length; i ++) {
 
-             if (i+1 <= code2length) {
 
-                 if (code1[i] != code2[i]) {
 
-                     if (!/^\d+$/.test(code1[i])) {
 
-                         return code1[i].charCodeAt() - code2[i].charCodeAt();
 
-                     } else {
 
-                         return parseInt(code1[i]) - parseInt(code2[i]);
 
-                     }
 
-                 } else if (i+1 == code1length && code1[i] == code2[i]) {
 
-                     if (code1length == code2length) {
 
-                         return 0;
 
-                     } else {
 
-                         return code1length - code2length;
 
-                     }
 
-                 }
 
-             } else {
 
-                 if (i+1 >= code1length) {
 
-                     return 1;
 
-                 } else {
 
-                     return -1;
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     gclGatherModel.loadLedgerData(ledger);
 
-     gclGatherModel.loadPosData(pos);
 
-     const gclGatherData = gclGatherModel.gatherGclData();
 
-     for (const ggd in gclGatherData) {
 
-         gclGatherData[ggd].code = gclGatherData[ggd].b_code;
 
-     }
 
-     // 数组去重
 
-     for (const db of gclGatherData) {
 
-         const exist_index = dealBillList.findIndex(function (item) {
 
-             return item.code === db.code && item.name === db.name && item.unit === db.unit && item.unit_price === db.unit_price;
 
-         });
 
-         if (exist_index !== -1) {
 
-             dealBillList.splice(exist_index, 1);
 
-         }
 
-     }
 
-     const changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
 
-     console.log(changeListData);
 
-     // 先加载台账数据
 
-     let listHtml = '';
 
-     let list_index = 1;
 
-     let gcl_index = 0;
 
-     for (const gcl of changeListData) {
 
-         const unit = gcl.unit !== undefined && gcl.unit !== null ? gcl.unit : '';
 
-         const quantity = gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? roundnum(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity) : 0;
 
-         const unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? gcl.unit_price : 0;
 
-         let gclhtml = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? ' data-gcl="' + gcl_index + '"': '';
 
-         gcl_index = gclhtml !== '' ? ++gcl_index : gcl_index;
 
-         const lid = gcl.leafXmjs !== undefined && gcl.leafXmjs !== null ? gcl.leafXmjs[0].gcl_id : gcl.id;
 
-         listHtml += '<tr data-lid="' + lid + '"'+ gclhtml +' data-index="' + list_index + '" data-bwmx="">' +
 
-             '<td>' + list_index + '</td>' +
 
-             '<td>' + gcl.code + '</td>' +
 
-             '<td>' + gcl.name + '</td>' +
 
-             '<td>' + unit + '</td>' +
 
-             '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
 
-             '<td>' + quantity + '</td>' +
 
-             // '<td>' + roundnum(parseFloat(gcl.unit_price).mul(parseFloat(gcl.quantity)), totalPriceUnit) + '</td>' +
 
-             '</tr>';
 
-         list_index++;
 
-     }
 
-     // // 再加载签约清单
 
-     // for (const db of dealBillList) {
 
-     //     const unit = db.unit !== undefined && db.unit !== null ? db.unit : '';
 
-     //     const quantity = db.quantity !== null && db.quantity !== undefined ? (unit !== '' ? roundnum(db.quantity, findDecimal(db.unit)) : db.quantity) : 0;
 
-     //     const unit_price = db.unit_price !== null && db.unit_price !== undefined ? db.unit_price : 0;
 
-     //     listHtml += '<tr data-lid="' + db.id + '" data-index="' + list_index + '" data-bwmx="">' +
 
-     //         '<td>' + list_index + '</td>' +
 
-     //         '<td>' + db.code + '</td>' +
 
-     //         '<td>' + db.name + '</td>' +
 
-     //         '<td>' + unit + '</td>' +
 
-     //         '<td>' + roundnum(unit_price, unitPriceUnit) + '</td>' +
 
-     //         '<td>' + quantity + '</td>' +
 
-     //         // '<td>' + roundnum(parseFloat(db.unit_price).mul(parseFloat(db.quantity)), totalPriceUnit) + '</td>' +
 
-     //         '</tr>';
 
-     //     list_index++;
 
-     // }
 
-     $('#table-list-select').html(listHtml);
 
-     tableDataRemake(changeListData);
 
-     // 上报时按钮点击
 
-     $('a[data-target="#sub-ap"]').on('click', function () {
 
-         let category = $(this).attr('data-category');
 
-         if (category === 'save_change') {
 
-             // 保存修改modal
 
-             $('.up-change').hide();
 
-             $('.save-change').show();
 
-         } else {
 
-             // 上报审批modal
 
-             $('.up-change').show();
 
-             $('.save-change').hide();
 
-         }
 
-     });
 
-     // 重新上报时按钮点击
 
-     $('a[data-target="#sub-sp2"]').on('click', function () {
 
-         let category = $(this).data('category');
 
-         if (category === 'save_change') {
 
-             // 保存修改modal
 
-             $('.up-change').hide();
 
-             $('.save-change').show();
 
-         } else {
 
-             // 上报审批modal
 
-             $('.up-change').show();
 
-             $('.save-change').hide();
 
-         }
 
-         $('#hideSp').attr('data-category', category);
 
-     });
 
-     // 提交表单
 
-     // 上报时按钮点击
 
-     $('button[data-sumbit="sumbit_change"]').on('click', function () {
 
-         let category = $(this).data('category');
 
-         if (category === 'save_change') {
 
-             // 保存修改modal
 
-             $('#changeStatus').val(2);
 
-             // 获取auditlist并填入input中
 
-             getAuditList();
 
-             if ($('input[name="code"]').val() === '') {
 
-                 toastr.error('申请编号不能为空!');
 
-                 return;
 
-             }
 
-             if ($('input[name="name"]').val() === '') {
 
-                 toastr.error('工程名称不能为空!');
 
-                 return;
 
-             }
 
-             $('#change_form').submit();
 
-         } else {
 
-             // 上报审批modal
 
-             $('#changeStatus').val(1);
 
-             getAuditList();
 
-             let returnFlag = false;
 
-             // 表单判断
 
-             if ($('input[name="code"]').val() === '') {
 
-                 toastr.error('申请编号不能为空!');
 
-                 returnFlag = true;
 
-             }
 
-             if ($('input[name="name"]').val() === '') {
 
-                 toastr.error('工程名称不能为空!');
 
-                 returnFlag = true;
 
-             }
 
-             if ($('textarea[name="content"]').val() === '') {
 
-                 toastr.error('工程变更理由及内容不能为空!');
 
-                 returnFlag = true;
 
-             }
 
-             if ($('#change-list').val() === '' && $('#change-whitelist').val() === '') {
 
-                 toastr.error('请添加变更清单!');
 
-                 returnFlag = true;
 
-             } else {
 
-                 let changeList = [];
 
-                 if ($('#change-list').val() !== '') {
 
-                     changeList = $('#change-list').val().split('^_^');
 
-                 }
 
-                 let changeWhiteList = [];
 
-                 if ($('#change-whitelist').val() !== '') {
 
-                     changeWhiteList = $('#change-whitelist').val().split('^_^');
 
-                 }
 
-                 changeList.push.apply(changeList, changeWhiteList);
 
-                 for (const [index, cl] of changeList.entries()) {
 
-                     const clInfo = cl.split(';');
 
-                     // if (clInfo[0] === '' || clInfo[1] === '' || clInfo[3] === '' || clInfo[4] === '' || clInfo[5] === '') {
 
-                     if (clInfo[0] === '' || clInfo[1] === '' || clInfo[5] === '') {
 
-                         toastr.error('变更清单第' + (index+1) + '行未完整填写数据(变更部位、变更详情、单位、单价可空)');
 
-                         returnFlag = true;
 
-                     }
 
-                 }
 
-             }
 
-             if ($('#changeaudit').val() === '') {
 
-                 toastr.error('请添加审批流程!');
 
-                 returnFlag = true;
 
-             }
 
-             if (returnFlag) {
 
-                 return;
 
-             }
 
-             $('#change_form').submit();
 
-             $(this).attr('disabled', true);
 
-         }
 
-     });
 
-     // 保存修改ajax提交(不刷新页面)
 
-     $('#save_change').on('click', function () {
 
-         // 保存修改modal
 
-         $('#changeStatus').val(2);
 
-         // 获取auditlist并填入input中
 
-         getAuditList();
 
-         if ($('input[name="code"]').val() === '') {
 
-             toastr.error('申请编号不能为空!');
 
-             return;
 
-         }
 
-         if ($('input[name="name"]').val() === '') {
 
-             toastr.error('工程名称不能为空!');
 
-             return;
 
-         }
 
-         $('#change_form').ajaxSubmit(function (result) {
 
-             if ( result.err === 0) {
 
-                 $('.reduction-code').attr('data-code', $('input[name="code"]').val());
 
-                 toastr.success(result.msg);
 
-                 $('#show-save-btn').hide();
 
-                 $('.title-main').removeClass('bg-warning');
 
-                 $('#back-change-list').val($('#change-list').val());
 
-                 $('#back-change-whitelist').val($('#change-whitelist').val());
 
-                 back_changeInfo = Object.assign({}, changeInfo);
 
-             } else {
 
-                 toastr.error(result.msg);
 
-             }
 
-         });
 
-         return false;
 
-     });
 
-     $('#cancel_change').on('click', function () {
 
-         $('#show-save-btn').hide();
 
-         $('.title-main').removeClass('bg-warning');
 
-         if (!isObjEqual(changeInfo, back_changeInfo)) {
 
-             changeFormRemake();
 
-         }
 
-         if ($('#change-list').val() !== $('#back-change-list').val() ||  $('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
 
-             $('#change-list').val($('#back-change-list').val());
 
-             $('#change-whitelist').val($('#back-change-whitelist').val());
 
-             tableDataRemake(changeListData);
 
-             // 重新绘制table
 
-             maketablelist();
 
-             if(!$('#bills').hasClass('first-bill-pane') && !$('a[aria-controls="bills"]').hasClass('active')) {
 
-                 $('#bills').addClass('first-bill-pane');
 
-             }
 
-         }
 
-         toastr.success('已还原到上次保存状态');
 
-     });
 
-     // 审批人分组选择
 
-     $('#account_group').change(function () {
 
-         let account_html = '<option value="0">选择审批人</option>';
 
-         for (const account of accountList) {
 
-             if (parseInt($(this).val()) === 0 || parseInt($(this).val()) === account.account_group) {
 
-                 const role = account.role !== '' ? '(' + account.role + ')' : '';
 
-                 const company = account.company !== '' ? ' -' + account.company : '';
 
-                 account_html += '<option value="' + account.id + '">' + account.name + role + company + '</option>';
 
-             }
 
-         }
 
-         $('#account_list').html(account_html);
 
-     });
 
-     $('#hideSp').click(function () {
 
-        $('#sub-sp2').modal('hide');
 
-     });
 
-     // 添加到审批流程中
 
-     $('body').on('change', '#account_list', function () {
 
-         let id = $(this).val();
 
-         id = parseInt(id);
 
-         if (id !== 0) {
 
-             let auditListIdData = [];
 
-             $('#auditList li').each(function () {
 
-                 let aid = $(this).data('auditid');
 
-                 auditListIdData.push(aid);
 
-             });
 
-             if (!in_array(auditListIdData, id)) {
 
-                 const accountInfo = accountList.find(function (item) {
 
-                     return item.id === id;
 
-                 });
 
-                 const user = accountInfo.id + '/%/' + accountInfo.name + '/%/' + accountInfo.role + '/%/' + accountInfo.company;
 
-                 const addhtml = '<li class="list-group-item" data-auditmsg="' + user + '"' +
 
-                     'data-auditid="' + accountInfo.id + '" >' +
 
-                     '<a href="javascript:void(0);" class="text-danger pull-right remove_audit_btn">移除</a>' +
 
-                     '<span>' + (auditListIdData.length+1) + '</span> ' + accountInfo.name + '  <small class="text-muted">' + accountInfo.role + '</small>' +
 
-                     '<p class="m-0 ml-2"><small class="text-muted">' + accountInfo.company + '</small></p>' +
 
-                     '</li>';
 
-                 $('#auditList').append(addhtml);
 
-                 // 重新上报时。令其它的审批人流程图标转换
 
-                 $('#shenpi-audit-list li i').removeClass('fa-stop-circle').addClass('fa-chevron-circle-down');
 
-                 $('#shenpi-audit-list2 li i').removeClass('fa-stop-circle').addClass('fa-chevron-circle-down');
 
-                 // 添加新审批人
 
-                 const addhtml1 = '<li class="list-group-item" data-auditid="' + accountInfo.id + '" >' +
 
-                     '<i class="fa fa-stop-circle"></i> ' +
 
-                     accountInfo.name + ' <small class="text-muted">' + accountInfo.role + '</small><span class="pull-right">终审</span>' +
 
-                     '</li>';
 
-                 const addhtml2 = '<li class="list-group-item" data-auditid="' + accountInfo.id + '" >' +
 
-                     '<h5 class="card-title"><i class="fa fa-stop-circle"></i> ' +
 
-                     accountInfo.name + ' <small class="text-muted">' + accountInfo.role + '</small><span class="pull-right">终审</span>' +
 
-                     '</h5></li>';
 
-                 for (let i = 0; i < $('#shenpi-audit-list li').length; i++) {
 
-                     $('#shenpi-audit-list li').eq(i).find('.pull-right').text(transFormToChinese(i) + '审');
 
-                     $('#shenpi-audit-list2 li').eq(i).find('.pull-right').text(transFormToChinese(i) + '审');
 
-                 }
 
-                 $('#shenpi-audit-list li').eq(0).find('.pull-right').text('原报');
 
-                 $('#shenpi-audit-list2 li').eq(0).find('.pull-right').text('原报');
 
-                 $('#shenpi-audit-list li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 
-                 $('#shenpi-audit-list2 li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 
-                 $('#shenpi-audit-list').append(addhtml1);
 
-                 $('#shenpi-audit-list2').append(addhtml2);
 
-             } else {
 
-                 toastr.error('审批流程中已存在该用户!');
 
-             }
 
-         }
 
-     });
 
-     // 移除审批流程的审批人
 
-     $('body').on('click', '.remove_audit_btn', function () {
 
-         const uid = $(this).parents('li').attr('data-auditid');
 
-         $(this).parents('li').remove();
 
-         let index = 1;
 
-         $('#auditList li').each(function () {
 
-             $(this).children('span').text(index);
 
-             index++;
 
-         });
 
-         if (index === 1) {
 
-             $('#account_list').val(0);
 
-         }
 
-         // 重新上报时。移除审批流程
 
-         // 令最后一个图标转换
 
-         $('#shenpi-audit-list li[data-auditid="' + uid + '"]').remove();
 
-         $('#shenpi-audit-list2 li[data-auditid="' + uid + '"]').remove();
 
-         if ($('#shenpi-audit-list li').length !== 0 && !$('#shenpi-audit-list li i').hasClass('fa-stop-circle')) {
 
-             $('#shenpi-audit-list li').eq($('#shenpi-audit-list li').length-1).children('i')
 
-                 .removeClass('fa-chevron-circle-down').addClass('fa-stop-circle');
 
-             $('#shenpi-audit-list2 li').eq($('#shenpi-audit-list2 li').length-1).children('i')
 
-                 .removeClass('fa-chevron-circle-down').addClass('fa-stop-circle');
 
-         }
 
-         for (let i = 0; i < $('#shenpi-audit-list li').length; i++) {
 
-             $('#shenpi-audit-list li').eq(i).find('.pull-right').text((i+1 === $('#shenpi-audit-list li').length ? '终' : transFormToChinese(i+1)) + '审');
 
-             $('#shenpi-audit-list2 li').eq(i).find('.pull-right').text((i+1 === $('#shenpi-audit-list2 li').length ? '终' : transFormToChinese(i+1)) + '审');
 
-         }
 
-         $('#shenpi-audit-list li').eq(0).find('.pull-right').text('原报');
 
-         $('#shenpi-audit-list2 li').eq(0).find('.pull-right').text('原报');
 
-         $('#shenpi-audit-list li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 
-         $('#shenpi-audit-list2 li i').eq(0).removeClass('fa-chevron-circle-down').addClass('fa-play-circle');
 
-     });
 
-     // 打开签约清单modal并删除之前的操作
 
-     $('#open-list-modal').click(function () {
 
-         // tableDataRemake(changeListData);
 
-     });
 
-     // 清单选中和移除
 
-     $('body').on('click', '#table-list-select tr', function () {
 
-         $('#table-list-select tr').removeClass('table-warning');
 
-         $(this).addClass('table-warning');
 
-         const isCheck = $(this).hasClass('table-success') ? true : false;
 
-         const data_bwmx = $(this).attr('data-bwmx').split('$#$');
 
-         const isDeal = $(this).data('gcl') !== undefined ? true : false;
 
-         let codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'"><td colspan="4" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox"></td></tr>';
 
-         if (isDeal) {
 
-             const gcl = gclGatherData[$(this).data('gcl')];
 
-             codeHtml = '';
 
-             for (const leaf of gcl.leafXmjs) {
 
-                 const quantity = leaf.quantity !== undefined && leaf.quantity !== null ? leaf.quantity : 0;
 
-                 const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : '';
 
-                 const isChecked = data_bwmx.indexOf(leaf.code + '_' + bwmx + ';' + quantity) !== -1 && isCheck ? 'checked' : '';
 
-                 codeHtml += '<tr quantity="' + quantity + '"><td>' + leaf.code + '</td>' +
 
-                     '<td>' + leaf.jldy + '</td>' +
 
-                     '<td>' + bwmx + '</td>' +
 
-                     '<td>' + roundnum(quantity, findDecimal(gcl.unit)) + '</td>' +
 
-                     '<td><input type="checkbox"' + isChecked +
 
-                     '></td></tr>';
 
-             }
 
-         } else if (!isDeal && isCheck) {
 
-             codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'"><td colspan="4" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox" checked></td></tr>';
 
-         }
 
-         $('#code-list').attr('data-index', $(this).children('td').eq(0).text());
 
-         $('#code-list').html(codeHtml);
 
-     });
 
-     // 右边项目节选择
 
-     $('body').on('click', '#code-list input', function () {
 
-         let index = $('#code-list').attr('data-index');
 
-         if ($(this).is(':checked')) {
 
-             // 去除其它可能已选的checked
 
-             // $('#code-list input').prop('checked', false);
 
-             $(this).prop('checked', true);
 
-             // 左边表单传值并添加class
 
-             $('#table-list-select tr[data-index="' + index + '"]').addClass('table-success');
 
-             // 去除部分data-detail值
 
-             let data_bwmx = [];
 
-             $('#code-list input:checked').each(function () {
 
-                 const tr = $(this).parents('tr');
 
-                 const length = tr.children('td').length;
 
-                 const bwmx = length === 5 ? tr.children('td').eq(0).text() + '_' + tr.children('td').eq(2).text() : '0';
 
-                 const quantity = tr.attr('quantity');
 
-                 const de_qu = bwmx + ';' + quantity;
 
-                 data_bwmx.push(de_qu);
 
-             });
 
-             data_bwmx = data_bwmx.join('$#$');
 
-             $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', data_bwmx);
 
-         } else {
 
-             // 判断还有无选中项目节编号
 
-             if ($('#code-list input').is(':checked')) {
 
-                 // 去除部分data-detail值
 
-                 let data_bwmx = [];
 
-                 $('#code-list input:checked').each(function () {
 
-                     const tr = $(this).parents('tr');
 
-                     const length = tr.children('td').length;
 
-                     const bwmx = length === 5 ? tr.children('td').eq(0).text() + '_' + tr.children('td').eq(2).text() : '0';
 
-                     const quantity = tr.attr('quantity');
 
-                     const de_qu = bwmx + ';' + quantity;
 
-                     data_bwmx.push(de_qu);
 
-                 });
 
-                 data_bwmx = data_bwmx.join('$#$');
 
-                 $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', data_bwmx);
 
-             } else {
 
-                 $('#table-list-select tr[data-index="' + index + '"]').removeClass('table-success');
 
-                 $('#table-list-select tr[data-index="' + index + '"]').attr('data-bwmx', '');
 
-             }
 
-         }
 
-     });
 
-     // 添加空白清单or签约清单
 
-     $('.add-list-btn').on('click', function () {
 
-         //生成table清单
 
-         if($(this).hasClass('btn-outline-primary')){
 
-             maketablelist('addwhite');
 
-         }else{
 
-             maketablelist();
 
-         }
 
-         $('#addlist').modal('hide');
 
-     });
 
-     // 添加空白清单
 
-     $('#add-white-btn').on('click', function () {
 
-         maketablelist('addwhite');
 
-     });
 
-     // 选中input所有值
 
-     $('body').on('focus', ".clist input", function() {
 
-         $(this).select();
 
-     });
 
-     // 取消选中清单
 
-     $('#cancel-list-btn').click(function () {
 
-         // $('#table-list-select tr').removeClass('table-success');
 
-         // $('#table-list-select tr').attr('data-bwmx', '');
 
-         // $('#code-list').html('');
 
-         tableDataRemake(changeListData);
 
-     });
 
-     // 移除已选清单并重新编号
 
-     $('body').on('click', '#list td a', function () {
 
-         const index = $(this).parents('tr').data('index');
 
-         const lid = $(this).parents('tr').data('lid');
 
-         // 判断属于空白还是普通清单,并删除对应的index值
 
-         const changelist = isNaN(lid) ? $('#change-list').val().split('^_^') : $('#change-whitelist').val().split('^_^');
 
-         if($.trim(changelist) != ''){
 
-             changelist.splice(index, 1);
 
-             if (isNaN(lid)) {
 
-                 $('#change-list').val(changelist.join('^_^'));
 
-             } else {
 
-                 $('#change-whitelist').val(changelist.join('^_^'));
 
-             }
 
-         }
 
-         tableDataRemake(changeListData);
 
-         // 重新绘制table
 
-         maketablelist();
 
-     });
 
-     // 清单输入监控并更新
 
-     $('body').on('valuechange', '.clist input', function (e, previous) {
 
-         const index = $(this).parents('tr').data('index');
 
-         const lid = $(this).parents('tr').data('lid');
 
-         const isWhite = !isNaN(lid) ? true : false;
 
-         const tr = $('#list tr[data-lid="' + lid + '"]').eq(0);
 
-         const site = parseInt($(this).parents('td').data('site'));
 
-         switch (site) {
 
-             case 0:
 
-             case 1:
 
-             case 2:
 
-             case 3:
 
-             case 5:
 
-                 tr.children('td[data-site="' + site + '"]').children('input').val($(this).val());
 
-                 break;
 
-             case 6:
 
-             case 8:
 
-             default:
 
-                 break;
 
-         }
 
-         const code = $.trim(tr.children('td[data-site="0"]').children('input').val()) || $.trim(tr.children('td[data-site="0"]').text());
 
-         const name = $.trim(tr.children('td[data-site="1"]').children('input').val()) || $.trim(tr.children('td[data-site="1"]').text());
 
-         const bwmx = $.trim(tr.children('td[data-site="2"]').children('input').val()) || $.trim(tr.children('td[data-site="2"]').text());
 
-         const unit = tr.children('td[data-site="4"]').children('select').val() === '' ? tr.children('td[data-site="4"]').children('select').val() : $.trim(tr.children('td[data-site="4"]').children('select').val()) || $.trim(tr.children('td[data-site="4"]').text());
 
-         const price = (tr.children('td[data-site="5"]').children('input').val() != '-' ? tr.children('td[data-site="5"]').children('input').val() : '') || tr.children('td[data-site="5"]').text();
 
-         const oamount = (tr.children('td[data-site="6"]').children('input').val() != '-' ? tr.children('td[data-site="6"]').children('input').val() : '') || tr.children('td[data-site="6"]').text();
 
-         const scnum = tr.children('td[data-site="8"]').children('input').val() != '-' ? tr.children('td[data-site="8"]').children('input').val() : '';
 
-         const detail = $.trim(tr.children('td[data-site="3"]').children('input').val());
 
-         const trlist = [code,name,bwmx,unit,price,oamount,scnum,detail];
 
-         if (isWhite) {
 
-             let changelist = $('#change-whitelist').val().split('^_^');
 
-             trlist.push(0);
 
-             changelist.splice(index, 1, trlist.join(';'));
 
-             $('#change-whitelist').val(changelist.join('^_^'));
 
-         } else {
 
-             let changelist = $('#change-list').val().split('^_^');
 
-             trlist.push(lid.split('_')[0]);
 
-             changelist.splice(index, 1, trlist.join(';'));
 
-             $('#change-list').val(changelist.join('^_^'));
 
-         }
 
-         tr.children('td[data-site="7"]').text(price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),totalPriceUnit) : '');
 
-         tr.children('td[data-site="9"]').text(price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),totalPriceUnit) : '');
 
-         totalamount(totalPriceUnit);
 
-     });
 
-     // 空白清单单位选择监控并更新小数位数
 
-     $('body').on("change", '.clist select', function () {
 
-         const index = $(this).parents('tr').data('index');
 
-         const tr = $('#list tr[data-lid="' + index + '"]');
 
-         const code = $.trim(tr.children('td[data-site="0"]').children('input').val());
 
-         const name = $.trim(tr.children('td[data-site="1"]').children('input').val());
 
-         const bwmx = $.trim(tr.children('td[data-site="2"]').children('input').val());
 
-         const unit = $(this).val();
 
-         tr.children('td[data-site="4"]').children('select').val($(this).val());
 
-         const price = tr.children('td[data-site="5"]').children('input').val() != '-' ? tr.children('td[data-site="5"]').children('input').val() : '';
 
-         let oamount = tr.children('td[data-site="6"]').children('input').val() != '-' ? tr.children('td[data-site="6"]').children('input').val() : '';
 
-         let scnum = tr.children('td[data-site="8"]').children('input').val() != '-' ? tr.children('td[data-site="8"]').children('input').val() : '';
 
-         const detail = $.trim(tr.children('td[data-site="3"]').children('input').val());
 
-         // 根据单位更新数量位数和合计
 
-         const numdecimal = findDecimal(unit);
 
-         oamount = roundnum(oamount, numdecimal);
 
-         scnum = roundnum(scnum, numdecimal);
 
-         tr.children('td[data-site="6"]').children('input').val(oamount);
 
-         tr.children('td[data-site="6"]').children('input').attr('onkeyup','RegNum(this,event,'+ numdecimal +')');
 
-         tr.children('td[data-site="8"]').children('input').val(scnum);
 
-         tr.children('td[data-site="8"]').children('input').attr('onkeyup','RegNum(this,event,'+ numdecimal +')');
 
-         const trlist = [code,name,bwmx,unit,price,oamount,scnum,detail,0];
 
-         let changelist = $('#change-whitelist').val().split('^_^');
 
-         changelist.splice(index, 1, trlist.join(';'));
 
-         $('#change-whitelist').val(changelist.join('^_^'));
 
-         tr.children('td[data-site="7"]').text(price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),totalPriceUnit) : '');
 
-         tr.children('td[data-site="9"]').text(price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),totalPriceUnit) : '');
 
-         totalamount(totalPriceUnit);
 
-     });
 
-     // 自动编号
 
-     $('.reduction-code').click(function () {
 
-        const code = $(this).attr('data-code');
 
-        $('input[name="code"]').val(code);
 
-     });
 
-     // 记录变更信息操作
 
-     $('body').on('valuechange', '#change_form input[type="text"]', function (e, previous) {
 
-         changeInfo[$(this).attr('name')] = $(this).val();
 
-         judgeChange();
 
-     });
 
-     $('body').on('valuechange', '#change_form textarea', function (e, previous) {
 
-         changeInfo[$(this).attr('name')] = $(this).val().replace(/[\r\n]/g, '<br><br>');
 
-         judgeChange();
 
-     });
 
-     $('body').on('change', '#change_form select', function (e, previous) {
 
-         changeInfo[$(this).attr('name')] = $(this).val();
 
-         judgeChange();
 
-     });
 
-     $('body').on('click', '#change_form input[type="radio"]', function (e, previous) {
 
-         changeInfo[$(this).attr('name')] = $(this).val();
 
-         judgeChange();
 
-     });
 
-     $('body').on('click', '#change_form input[type="checkbox"]', function (e, previous) {
 
-         const typecheck = [];
 
-         $.each($('#change_form input[name="type[]"]:checked'), function () {
 
-             typecheck.push($(this).val());
 
-         });
 
-         changeInfo.type = typecheck.join(',');
 
-         judgeChange();
 
-     });
 
- });
 
- function tableDataRemake(changeListData) {
 
-     $('#table-list-select tr').removeClass('table-warning');
 
-     $('#table-list-select tr').removeClass('table-success');
 
-     $('#table-list-select tr').attr('data-bwmx', '');
 
-     $('#code-list').html('');
 
-     // 根据已添加的清单显示
 
-     const changeList = $('#change-list').val().split('^_^');
 
-     if (changeList.length > 0 && changeList[0]) {
 
-         for (const [index,cl] of changeList.entries()) {
 
-             const clinfo = cl.split(';');
 
-             // const listinfo = changeListData[clinfo[8] - 1];
 
-             let listinfo = changeListData.find(function (item) {
 
-                 return (item.id !== undefined && item.id == clinfo[8]) || (item.id === undefined && item.leafXmjs !== undefined && item.leafXmjs.length !== 0 && item.leafXmjs[0].gcl_id == clinfo[8]);
 
-             });
 
-             // if (listinfo === undefined) {
 
-             //     toastr.warning('台账清单列表已不存在'+ clinfo[0] +',故删除之');
 
-             //     continue;
 
-             // }
 
-             if (listinfo === undefined) {
 
-                 // 针对旧数据获取清单信息
 
-                 listinfo = changeListData[clinfo[8] - 1];
 
-                 if (listinfo === undefined) {
 
-                     toastr.warning('台账清单列表已不存在'+ clinfo[0] +',请手动删除,并重新添加修订后的清单');
 
-                     changeList.splice(index, 1);
 
-                     continue;
 
-                 }
 
-                 $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').addClass('table-success');
 
-                 let pushbwmx = '0;0';
 
-                 if (listinfo.leafXmjs !== undefined) {
 
-                     const leafInfo = listinfo.leafXmjs.find(function (item) {
 
-                         return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
 
-                     });
 
-                     pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
 
-                 } else {
 
-                     pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
 
-                 }
 
-                 const bwmx = $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx');
 
-                 if (bwmx) {
 
-                     const bwmxArray = bwmx.split('$#$');
 
-                     bwmxArray.push(pushbwmx);
 
-                     $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
 
-                 } else {
 
-                     $('#table-list-select tr[data-index="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
 
-                 }
 
-             } else {
 
-                 $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').addClass('table-success');
 
-                 let pushbwmx = '0;0';
 
-                 if (listinfo.leafXmjs !== undefined) {
 
-                     const leafInfo = listinfo.leafXmjs.find(function (item) {
 
-                         return (item.bwmx === undefined || item.bwmx === clinfo[2]) && item.quantity === parseFloat(clinfo[5]);
 
-                     });
 
-                     pushbwmx = leafInfo.code + '_' + (leafInfo.bwmx !== undefined ? leafInfo.bwmx : '') + ';' + leafInfo.quantity;
 
-                 } else {
 
-                     pushbwmx = '0;' + (listinfo.quantity !== null ? listinfo.quantity : 0);
 
-                 }
 
-                 const bwmx = $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx');
 
-                 if (bwmx) {
 
-                     const bwmxArray = bwmx.split('$#$');
 
-                     bwmxArray.push(pushbwmx);
 
-                     $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
 
-                 } else {
 
-                     $('#table-list-select tr[data-lid="'+ clinfo[8] +'"]').attr('data-bwmx', pushbwmx);
 
-                 }
 
-             }
 
-         }
 
-         $('#change-list').val(changeList.join('^_^'));
 
-     }
 
- }
 
- function changeFormRemake() {
 
-     changeInfo = Object.assign({}, back_changeInfo);
 
-     $('#change_form input[name="code"]').val(changeInfo.code);
 
-     $('#change_form input[name="name"]').val(changeInfo.name);
 
-     $('#change_form input[name="peg"]').val(changeInfo.peg);
 
-     $('#change_form input[name="org_name"]').val(changeInfo.org_name);
 
-     $('#change_form input[name="org_code"]').val(changeInfo.org_code);
 
-     $('#change_form input[name="new_name"]').val(changeInfo.new_name);
 
-     $('#change_form input[name="new_code"]').val(changeInfo.new_code);
 
-     $('#change_form textarea[name="content"]').val(changeInfo.content.replace(/<br><br>/g, '\r\n'));
 
-     $('#change_form textarea[name="basis"]').val(changeInfo.basis.replace(/<br><br>/g, '\r\n'));
 
-     $('#change_form textarea[name="expr"]').val(changeInfo.expr.replace(/<br><br>/g, '\r\n'));
 
-     $('#change_form textarea[name="memo"]').val(changeInfo.memo.replace(/<br><br>/g, '\r\n'));
 
-     $('#change_form select[name="type"]').val(changeInfo.type);
 
-     $('#change_form select[name="class"]').val(changeInfo.class);
 
-     $('#change_form select[name="quality"]').val(changeInfo.quality);
 
-     $('#change_form select[name="company"]').val(changeInfo.company);
 
-     $('#change_form input[name="charge"][value="'+ changeInfo.charge +'"]').prop('checked', true);
 
-     $('#change_form input[name="type[]"]').prop('checked', false);
 
-     const typecheck = changeInfo.type.split(',');
 
-     for (const type of typecheck) {
 
-         $('#change_form input[name="type[]"][value="'+ type +'"]').prop('checked', true);
 
-     }
 
- }
 
- //判断元素是否在数组中,相当于php的in_array();
 
- function in_array(arr, obj) {
 
-     let i = arr.length;
 
-     while (i--) {
 
-         if (arr[i] == obj) {
 
-             return true;
 
-         }
 
-     }
 
-     return false;
 
- }
 
- // 获取审批流程中审批人列表数据
 
- function getAuditList() {
 
-     if ($('#auditList li').length === 0) {
 
-         $('#changeaudit').val('');
 
-     } else {
 
-         let auditInfoArray = [];
 
-         $('#auditList li').each(function () {
 
-             const aMsg = $(this).data('auditmsg');
 
-             auditInfoArray.push(aMsg);
 
-         });
 
-         $('#changeaudit').val(auditInfoArray.join(','));
 
-     }
 
- }
 
- // 重新生成清单
 
- function maketablelist(status){
 
-     // 金额位数
 
-     const decimal = totalPriceUnit;
 
-     // 单价位数
 
-     const updecimal = unitPriceUnit;
 
-     let html = '';
 
-     // 原有清单(不含空白清单)
 
-     let radionList = $('#change-list').val() !== '' ? $('#change-list').val().split('^_^') : [];
 
-     const newTableList = [];
 
-     // 获取选中的签约清单判断并插入到原有清单中
 
-     $('#table-list-select .table-success').each(function(){
 
-         let code = $(this).children('td').eq(1).text();
 
-         let name = $(this).children('td').eq(2).text();
 
-         let unit = $(this).children('td').eq(3).text();
 
-         let price = $(this).children('td').eq(4).text();
 
-         // let oamount = $(this).children('td').eq(5).text();
 
-         // 根据单位获取数量的位数,并得出
 
-         // let numdecimal = findDecimal(unit);
 
-         // let scnum = makedecimalzero(numdecimal);
 
-         let scnum = 0;
 
-         // let detail = $(this).attr('data-detail') != 0 ? $(this).attr('data-detail').split('_')[1] : '';
 
-         let lid = $(this).data('lid');
 
-         let lindex = $(this).data('index');
 
-         // 原清单和数量改变
 
-         let data_bwmx = $(this).attr('data-bwmx').split('$#$');
 
-         for (const b of data_bwmx) {
 
-             const oamount = b.split(';')[1];
 
-             let bwmx = b.split(';')[0] != 0 ? b.split(';')[0].split('_')[1] : '';
 
-             let trlist = [code, name, bwmx, unit, price, oamount, scnum, '', lid];
 
-             const radionInfo = radionList.find(function (item) {
 
-                 const info = item.split(';');
 
-                 return info[0] === code && (info[8] == lid || parseInt(info[8]) === parseInt(lindex)) && info[2] === bwmx;
 
-             });
 
-             if (radionInfo) {
 
-                 trlist[6] = radionInfo.split(';')[6];
 
-                 trlist[7] = radionInfo.split(';')[7];
 
-             }
 
-             newTableList.push(trlist.join(';'));
 
-         }
 
-     });
 
-     // 排序
 
-     // radionList.sort();
 
-     let index = 0;
 
-     let whiteIndex = 0;
 
-     let deteletr = '<td><a class="text-danger">移除</a></td>';
 
-     for (const radion of newTableList) {
 
-         const radionArray = radion.split(';');
 
-         let code = radionArray[0];
 
-         let name = radionArray[1];
 
-         let bwmx = radionArray[2];
 
-         let unit = radionArray[3];
 
-         let price = radionArray[4];
 
-         let oamount = radionArray[5];
 
-         let scnum = radionArray[6];
 
-         let detail = radionArray[7];
 
-         let lid = radionArray[8];
 
-         let sctotal = scnum !== '' && scnum !== '-' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),decimal) : '';
 
-         // 根据单位获取数量的位数,并得出
 
-         let numdecimal = findDecimal(unit);
 
-         html += '<tr class="clist clid" data-lid="' + lid + '_' + index + '" data-index="' + index + '">' +
 
-             '<td data-site="0">'+ code +'</td>' +
 
-             '<td data-site="1">'+ name +'</td>' +
 
-             '<td data-site="2">'+ bwmx +'</td>' +
 
-             '<td data-site="3"><input class="form-control form-control-sm" type="text" placeholder="变更详情" value="' + detail + '"></td>' +
 
-             '<td data-site="4">'+ unit +'</td>' +
 
-             '<td data-site="5">'+ roundnum(price, updecimal) +'</td>' +
 
-             '<td data-site="6">'+ roundnum(oamount, numdecimal) +'</td>' +
 
-             '<td data-site="7">'+ roundnum(parseFloat(price).mul(parseFloat(oamount)),decimal) +'</td>' +
 
-             '<td data-site="8"><input class="form-control form-control-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" placeholder="请输入变更数量" value="'+ (scnum != '-' ? roundnum(scnum, numdecimal) : '') +'"></td>' +
 
-             '<td data-site="9">'+ sctotal +'</td>'+
 
-             deteletr +'</tr>';
 
-         index ++;
 
-     }
 
-     $('#change-list').val(newTableList.join('^_^'));
 
-     let radionWhiteList = $('#change-whitelist').val() !== '' ? $('#change-whitelist').val().split('^_^') : [];
 
-     //判断是否添加空白清单
 
-     if(status == 'addwhite'){
 
-         let trlist = ['','','','','',makedecimalzero(findDecimal(3)),makedecimalzero(findDecimal(3)),'',0];
 
-         radionWhiteList.push(trlist.join(';'));
 
-     }
 
-     for (const rw of radionWhiteList) {
 
-         const radionArray = rw.split(';');
 
-         let code = radionArray[0];
 
-         let name = radionArray[1];
 
-         let bwmx = radionArray[2];
 
-         let unit = radionArray[3];
 
-         let price = radionArray[4];
 
-         let oamount = radionArray[5];
 
-         let scnum = radionArray[6];
 
-         let detail = radionArray[7];
 
-         let ototal = price != '' && oamount != '' ? roundnum(parseFloat(price).mul(parseFloat(oamount)),decimal) : '';
 
-         let sctotal = price != '' && scnum != '' ? roundnum(parseFloat(price).mul(parseFloat(scnum)),decimal) : '';
 
-         let optionlist = '<option></option>';
 
-         for (const j in changeUnits) {
 
-             if (changeUnits[j].unit !== undefined && changeUnits[j].unit === unit) {
 
-                 optionlist += '<option selected="selected">'+ changeUnits[j].unit +'</option>';
 
-             } else if(changeUnits[j].unit !== undefined) {
 
-                 optionlist += '<option>'+ changeUnits[j].unit +'</option>';
 
-             }
 
-         }
 
-         // 根据单位获取数量的位数,并得出
 
-         let numdecimal = findDecimal(unit);
 
-         html += '<tr class="clist" data-lid="' + whiteIndex + '" data-index="' + whiteIndex + '">' +
 
-             '<td data-site="0"><input class="form-control form-control-sm" type="text" value="'+ code +'" placeholder="清单编号"></td>' +
 
-             '<td data-site="1"><input class="form-control form-control-sm" type="text" value="'+ name +'" placeholder="名称"></td>' +
 
-             '<td data-site="2"><input class="form-control form-control-sm" type="text" value="'+ bwmx +'" placeholder="变更部位"></td>' +
 
-             '<td data-site="3"><input class="form-control form-control-sm" type="text" value="'+ detail +'" placeholder="变更详情"></td>' +
 
-             '<td data-site="4"><select class="form-control form-control-sm">'+ optionlist +'</select></td>' +
 
-             '<td data-site="5"><input class="form-control form-control-sm" type="text" onkeyup="RegNum(this,event,'+ updecimal +')" value="'+ roundnum(price, updecimal) +'" placeholder="请输入单价"></td>' +
 
-             '<td data-site="6"><input class="form-control form-control-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" value="'+ roundnum(oamount, numdecimal) +'" placeholder="请输入数量"></td>' +
 
-             '<td data-site="7">'+ ototal +'</td>' +
 
-             '<td data-site="8"><input class="form-control form-control-sm" type="text" onkeyup="RegNum(this,event,'+ numdecimal +')" value="'+ roundnum(scnum, numdecimal) +'" placeholder="请输入变更数量"></td>' +
 
-             '<td data-site="9">'+ sctotal +'</td>'+
 
-             deteletr +'</tr>';
 
-         whiteIndex ++;
 
-     }
 
-     $('#change-whitelist').val(radionWhiteList.join('^_^'));
 
-     if (table) {
 
-         table.destroy();
 
-     }
 
-     $('#list').html(html);
 
-     table = $('#tablelist').removeAttr('width').DataTable({
 
-         columnDefs: [
 
-             { className: 'allwidth1', width: 100, targets: 0 },
 
-             { className: 'allwidth2', width: 150, targets: [1,2,3] },
 
-             { className: 'allwidth4', width: 40, targets: 10 },
 
-             { className: 'allwidth5', width: 60, targets: 4 },
 
-             { className: 'allwidth3',width: 80, targets: '_all' }
 
-         ],
 
-         fixedColumns: {
 
-             leftColumns: 6
 
-         }
 
-     });
 
-     // 判断是否显示变更详情
 
-     if (!$('.change-detail-checkbox').is(':checked')) {
 
-         const column = table.column(3);
 
-         column.visible(!column.visible());
 
-     }
 
-     totalamount(decimal);
 
-     // $('#table-list-select tr').removeClass('table-success');
 
- }
 
- //统计合计金额
 
- function totalamount(decimal){
 
-     let zero = makedecimalzero(decimal);
 
-     let ctotalnum = 0;
 
-     let ototalnum = 0;
 
-     $('.clist').each(function(){
 
-         let ctotal = $(this).children('td[data-site="9"]').text();
 
-         ctotalnum = ctotal != '' ? parseFloat(ctotalnum).add(parseFloat(ctotal)) : parseFloat(ctotalnum);
 
-         let ototal = $(this).children('td[data-site="7"]').text();
 
-         ototalnum = ototal != '' ? parseFloat(ototalnum).add(parseFloat(ototal)) : parseFloat(ototalnum);
 
-     });
 
-     $('.ctatalamount').eq(1).text(ctotalnum != 0 ? roundnum(ctotalnum,decimal) : zero);
 
-     $('.otatalamount').eq(1).text(ototalnum != 0 ? roundnum(ototalnum,decimal) : zero);
 
-     judgeChange();
 
- }
 
- // 找出单位对应的小数位数值
 
- function findDecimal(unit) {
 
-     let value = precision.other.value;
 
-     const changeUnits = precision;
 
-     for (const d in changeUnits) {
 
-         if (changeUnits[d].unit !== undefined && changeUnits[d].unit === unit) {
 
-             value = changeUnits[d].value;
 
-             break;
 
-         }
 
-     }
 
-     return value;
 
- }
 
- // 判断是否有更改过
 
- function judgeChange() {
 
-     let change = false;
 
-     if ($('#change-list').val() !== $('#back-change-list').val()) {
 
-         change = true;
 
-     }
 
-     if ($('#change-whitelist').val() !== $('#back-change-whitelist').val()) {
 
-         change = true;
 
-     }
 
-     if (!isObjEqual(changeInfo, back_changeInfo)) {
 
-         change = true;
 
-     }
 
-     if (change) {
 
-         $('#show-save-btn').show();
 
-         $('.title-main').addClass('bg-warning');
 
-     } else {
 
-         $('#show-save-btn').hide();
 
-         $('.title-main').removeClass('bg-warning');
 
-     }
 
- }
 
- function isObjEqual(o1,o2){
 
-     var props1 = Object.getOwnPropertyNames(o1);
 
-     var props2 = Object.getOwnPropertyNames(o2);
 
-     if (props1.length != props2.length) {
 
-         return false;
 
-     }
 
-     for (var i = 0,max = props1.length; i < max; i++) {
 
-         var propName = props1[i];
 
-         if (o1[propName] !== o2[propName]) {
 
-             return false;
 
-         }
 
-     }
 
-     return true;
 
- }
 
 
  |