| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057 | 
							- 'use strict';
 
- /**
 
-  * 变更令详细页js
 
-  *
 
-  * @author EllisRan.
 
-  * @date 2018/11/22
 
-  * @version
 
-  */
 
- // 编号排序,多重判断
 
- 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]) && /^\d+$/.test(code2[i])) {
 
-                     return parseInt(code1[i]) - parseInt(code2[i]);
 
-                 } else if (!/^\d+$/.test(code1[i]) && /^\d+$/.test(code2[i])) {
 
-                     return 1;
 
-                 } else if (/^\d+$/.test(code1[i]) && !/^\d+$/.test(code2[i])) {
 
-                     return -1;
 
-                 } else {
 
-                     const str1length = code1[i].length;
 
-                     const str2length = code2[i].length;
 
-                     for (let j = 0; j < str1length; j++) {
 
-                         if (j+1 <= str2length) {
 
-                             if (code1[i].charAt(j) != code2[i].charAt(j)) {
 
-                                 return code1[i].charAt(j).charCodeAt() - code2[i].charAt(j).charCodeAt();
 
-                             }  else if (j+1 == str1length && code1[i].charAt(j) == code2[i].charAt(j)) {
 
-                                 if (str1length == str2length) {
 
-                                     return 0;
 
-                                 } else {
 
-                                     return str1length - str2length;
 
-                                 }
 
-                             }
 
-                         } else {
 
-                             if (j+1 >= str1length) {
 
-                                 return 1;
 
-                             } else {
 
-                                 return -1;
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-             } 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;
 
-             }
 
-         }
 
-     }
 
- }
 
- $.event.special.valuechange = {
 
-     teardown: function (namespaces) {
 
-         $(this).unbind('.valuechange');
 
-     },
 
-     handler: function (e) {
 
-         $.event.special.valuechange.triggerChanged($(this));
 
-     },
 
-     add: function (obj) {
 
-         $(this).on('keyup.valuechange cut.valuechange paste.valuechange input.valuechange', obj.selector, $.event.special.valuechange.handler)
 
-     },
 
-     triggerChanged: function (element) {
 
-         var current = element[0].contentEditable === 'true' ? element.html() : element.val()
 
-             , previous = typeof element.data('previous') === 'undefined' ? element[0].defaultValue : element.data('previous');
 
-         if (current !== previous) {
 
-             element.trigger('valuechange', [element.data('previous')]);
 
-             element.data('previous', current);
 
-         }
 
-     }
 
- };
 
- $(document).ready(() => {
 
-     const changeSpreadSetting = {
 
-         cols: [
 
-             {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit'},
 
-             {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
 
-             {title: '变更部位', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 120, formatter: '@', readOnly: 'readOnly.isEdit'},
 
-             {title: '变更详情', colSpan: '1', rowSpan: '2', field: 'detail', hAlign: 0, width: 120, formatter: '@', readOnly: false},
 
-             {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'unit', comboItems: changeUnits},
 
-             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.unit_price'},
 
-             {title: '原设计|数量', colSpan: '2|1', rowSpan: '1|1', field: 'oamount', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit', getValue: 'getValue.oamount'},
 
-             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'oa_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.oa_tp'},
 
-             {title: '申请变更增(+)减(-)|数量', colSpan: '2|1', rowSpan: '1|1', field: 'camount', hAlign: 2, width: 60, type: 'Number', readOnly: false, getValue: 'getValue.camount'},
 
-             {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'ca_tp', hAlign: 2, width: 80, type: 'Number', readOnly: true, getValue: 'getValue.ca_tp'},
 
-             {title: '操作', colSpan: '1', rowSpan: '2', field: 'del_list', hAlign: 1, width: 40, readOnly: true, cellType: 'mouseTouch', getValue: 'getValue.del_list'},
 
-         ],
 
-         emptyRows: 0,
 
-         headRows: 2,
 
-         headRowHeight: [25, 25],
 
-         defaultRowHeight: 21,
 
-         headerFont: '12px 微软雅黑',
 
-         font: '12px 微软雅黑',
 
-         readOnly: readOnly,
 
-         rowHeader:[
 
-             {
 
-                 rowHeaderType: 'circle',
 
-                 setting: {
 
-                     size: 5,
 
-                     indent: 16,
 
-                     getColor: function (index, data) {
 
-                         if (!data) return;
 
-                         if(data.lid != 0) return;
 
-                         return '#007bff';
 
-                     }
 
-                 },
 
-             },
 
-         ],
 
-     };
 
-     const changeCol = {
 
-         getValue: {
 
-             unit_price: function(data) {
 
-                 return ZhCalc.round(data.unit_price, unitPriceUnit);
 
-             },
 
-             oa_tp: function (data) {
 
-                 return ZhCalc.round(ZhCalc.mul(data.unit_price, data.oamount), totalPriceUnit);
 
-             },
 
-             ca_tp: function (data) {
 
-                 return ZhCalc.round(ZhCalc.mul(data.unit_price, data.camount), totalPriceUnit);
 
-             },
 
-             oamount: function (data) {
 
-                 return ZhCalc.round(data.oamount, findDecimal(data.unit));
 
-             },
 
-             camount: function (data) {
 
-                 return ZhCalc.round(data.camount, findDecimal(data.unit));
 
-             },
 
-             del_list: function (data) {
 
-                 return '移除';
 
-             }
 
-         },
 
-         readOnly: {
 
-             isEdit: function (data) {
 
-                 return !readOnly && data.lid != 0;
 
-             },
 
-         },
 
-     };
 
-     const changeSpreadObj = {
 
-         makeSjsFooter: function () {
 
-             // 增加汇总行并设为锁定禁止编辑状态
 
-             changeSpreadSheet.addRows(changeSpreadSheet.getRowCount(), 1);
 
-             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 0, '合计');
 
-             changeSpreadSheet.setStyle(changeSpreadSheet.getRowCount() - 1, -1, style1);
 
-             changeSpreadObj.countSum();
 
-         },
 
-         countSum: function() {
 
-             const rowCount = changeSpreadSheet.getRowCount();
 
-             let oSum = 0,
 
-                 cSum = 0;
 
-             for(var i = 0; i < rowCount - 1; i++){
 
-                 oSum = ZhCalc.add(oSum, changeSpreadSheet.getValue(i, 7));
 
-                 cSum = ZhCalc.add(cSum, changeSpreadSheet.getValue(i, 9));
 
-             }
 
-             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 7, oSum !== 0 ? oSum : null);
 
-             changeSpreadSheet.setValue(changeSpreadSheet.getRowCount() - 1, 9, cSum !== 0 ? cSum : null);
 
-         },
 
-         add: function () {
 
-             postData(window.location.pathname + '/save', {type: 'add'}, function (result) {
 
-                 if (result) {
 
-                     changeList.push(result);
 
-                     changeSpreadSheet.addRows(changeList.length - 1, 1);
 
-                     SpreadJsObj.reLoadRowData(changeSpreadSheet, changeList.length - 1);
 
-                     changeSpreadSheet.setStyle(changeSpreadSheet.getRowCount() - 1, -1, style1);
 
-                     changeSpreadSheet.setSelection(changeList.length - 1, 0, 1, 1);
 
-                     changeSpreadObj.resetXmjSpread();
 
-                 }
 
-             });
 
-         },
 
-         del: function () {
 
-             const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
 
-             const index = changeList.indexOf(select);
 
-             if (index > -1) {
 
-                 postData(window.location.pathname + '/save', {type: 'del', id: select.id}, function (result) {
 
-                     changeList.splice(index, 1);
 
-                     changeSpreadSheet.deleteRows(index, 1);
 
-                     const sel = changeSpreadSheet.getSelections();
 
-                     changeSpreadSheet.setSelection(0, 0, 1, 1);
 
-                     changeSpreadObj.resetXmjSpread(SpreadJsObj.getSelectObject(changeSpreadSheet));
 
-                     if (select.lid != 0) {
 
-                         tableDataRemake(changeListData);
 
-                     }
 
-                     changeSpreadObj.countSum();
 
-                 });
 
-             }
 
-         },
 
-         resetXmjSpread: function(data = null) {
 
-             const xmj = [];
 
-             if (data && data.lid != 0 && data.xmj_code !== '' && data.xmj_code !== null) {
 
-                 const newData = JSON.parse(JSON.stringify(data));
 
-                 if (newData.bwmx === newData.xmj_jldy) {
 
-                     newData.bwmx = '';
 
-                 }
 
-                 xmj.push(newData);
 
-             }
 
-             SpreadJsObj.loadSheetData(xmjSpread.getActiveSheet(), SpreadJsObj.DataType.Data, xmj);
 
-         },
 
-         selectionChanged: function (e, info) {
 
-             const sel = info.sheet.getSelections()[0];
 
-             const col = info.sheet.zh_setting.cols[sel.col];
 
-             const data = SpreadJsObj.getSelectObject(info.sheet);
 
-             if (col && col.field === 'del_list') {
 
-                 changeSpreadObj.del();
 
-             }
 
-             changeSpreadObj.resetXmjSpread(data);
 
-         },
 
-         deletePress: function (sheet) {
 
-             return;
 
-         },
 
-         editEnded: function (e, info) {
 
-             if (info.sheet.zh_setting) {
 
-                 const select = SpreadJsObj.getSelectObject(info.sheet);
 
-                 const col = info.sheet.zh_setting.cols[info.col];
 
-                 if (col.field === 'del_list') {
 
-                     return;
 
-                 }
 
-                 // 未改变值则不提交
 
-                 let validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : '');
 
-                 const orgValue = select[col.field];
 
-                 if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
 
-                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
 
-                     return;
 
-                 }
 
-                 // 判断部分值是否输入的是数字判断和数据计算
 
-                 if (col.type === 'Number') {
 
-                     if (isNaN(validText)) {
 
-                         toastr.error('不能输入其它非数字类型字符');
 
-                         SpreadJsObj.reLoadRowData(info.sheet, info.row);
 
-                         return;
 
-                     }
 
-                     if (col.field === 'unit_price') {
 
-                         validText = ZhCalc.round(validText, unitPriceUnit);
 
-                     } else {
 
-                         validText = ZhCalc.round(validText, findDecimal(select.unit)) || 0;
 
-                     }
 
-                 }
 
-                 if (col.field === 'unit') {
 
-                     select.camount = ZhCalc.round(select.camount, findDecimal(validText)) || 0;
 
-                     select.oamount = ZhCalc.round(select.oamount, findDecimal(validText)) || 0;
 
-                 }
 
-                 select[col.field] = validText;
 
-                 if(col.field === 'camount') {
 
-                     select.spamount = ZhCalc.round(select.camount, findDecimal(select.unit)) || 0;
 
-                 }
 
-                 console.log(select);
 
-                 // 更新至服务器
 
-                 postData(window.location.pathname + '/save', { type:'update', updateData: select }, function (result) {
 
-                     changeList.splice(info.row, 1, select);
 
-                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
 
-                     changeSpreadObj.countSum();
 
-                 }, function () {
 
-                     select[col.field] = orgValue;
 
-                     if(col.field === 'camount') {
 
-                         select.spamount = orgValue;
 
-                     }
 
-                     SpreadJsObj.reLoadRowData(info.sheet, info.row);
 
-                 });
 
-             }
 
-         },
 
-         clipboardPasted(e, info) {
 
-             const hint = {
 
-                 cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
 
-                 numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
 
-             };
 
-             const range = info.cellRange;
 
-             const sortData = info.sheet.zh_data || [];
 
-             if (info.cellRange.row + info.cellRange.rowCount > sortData.length) {
 
-                 toastMessageUniq(hint.cellError);
 
-                 // SpreadJsObj.loadSheetData(materialSpread.getActiveSheet(), SpreadJsObj.DataType.Data, materialBillsData);
 
-                 SpreadJsObj.reLoadSheetHeader(changeSpreadSheet);
 
-                 SpreadJsObj.reLoadSheetData(changeSpreadSheet);
 
-                 changeSpreadObj.makeSjsFooter();
 
-                 return;
 
-             }
 
-             if (sortData.length > 0 && range.col + range.colCount > 10) {
 
-                 toastMessageUniq(hint.cellError);
 
-                 SpreadJsObj.reLoadSheetHeader(changeSpreadSheet);
 
-                 SpreadJsObj.reLoadSheetData(changeSpreadSheet);
 
-                 changeSpreadObj.makeSjsFooter();
 
-                 return;
 
-             }
 
-             const data = [];
 
-             // const rowData = [];
 
-             for (let iRow = 0; iRow < range.rowCount; iRow++) {
 
-                 let bPaste = true;
 
-                 const curRow = range.row + iRow;
 
-                 // const materialData = JSON.parse(JSON.stringify(sortData[curRow]));
 
-                 const cLData = { id: sortData[curRow].id };
 
-                 const hintRow = range.rowCount > 1 ? curRow : '';
 
-                 let sameCol = 0;
 
-                 for (let iCol = 0; iCol < range.colCount; iCol++) {
 
-                     const curCol = range.col + iCol;
 
-                     const colSetting = info.sheet.zh_setting.cols[curCol];
 
-                     if (!colSetting) continue;
 
-                     let validText = info.sheet.getText(curRow, curCol);
 
-                     validText = is_numeric(validText) ? parseFloat(validText) : (validText ? trimInvalidChar(validText) : '');
 
-                     const orgValue = sortData[curRow][colSetting.field];
 
-                     if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
 
-                         sameCol++;
 
-                         if (range.colCount === sameCol)  {
 
-                             bPaste = false;
 
-                         }
 
-                         continue;
 
-                     }
 
-                     if (colSetting.type === 'Number') {
 
-                         if (isNaN(validText)) {
 
-                             toastMessageUniq(getPasteHint(hint.numberExpr, hintRow));
 
-                             bPaste = false;
 
-                             continue;
 
-                         }
 
-                         if (colSetting.field === 'unit_price') {
 
-                             validText = ZhCalc.round(validText, unitPriceUnit);
 
-                         } else {
 
-                             validText = ZhCalc.round(validText, findDecimal(sortData[curRow].unit)) || 0;
 
-                         }
 
-                     }
 
-                     if (colSetting.field === 'unit') {
 
-                         //粘贴内容要为下拉列表里所有的单位,不然为空
 
-                         if (changeUnits.indexOf(validText) === -1) {
 
-                             validText = '';
 
-                         }
 
-                         cLData.camount = ZhCalc.round(sortData[curRow].camount, findDecimal(validText)) || 0;
 
-                         cLData.oamount = ZhCalc.round(sortData[curRow].oamount, findDecimal(validText)) || 0;
 
-                     }
 
-                     cLData[colSetting.field] = validText;
 
-                     sortData[curRow][colSetting.field] = validText;
 
-                     cLData.spamount = ZhCalc.round(sortData[curRow].camount, findDecimal(validText)) || 0;
 
-                 }
 
-                 if (bPaste) {
 
-                     data.push(cLData);
 
-                     // rowData.push(curRow);
 
-                 } else {
 
-                     SpreadJsObj.reLoadRowData(info.sheet, curRow);
 
-                 }
 
-             }
 
-             if (data.length === 0) {
 
-                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 
-                 return;
 
-             }
 
-             console.log(data);
 
-             // 更新至服务器
 
-             postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
 
-                 changeList = result;
 
-                 SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
 
-                 changeSpreadObj.makeSjsFooter();
 
-                 changeSpreadObj.resetXmjSpread(SpreadJsObj.getSelectObject(changeSpreadSheet));
 
-             }, function () {
 
-                 SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 
-                 return;
 
-             });
 
-         },
 
-     };
 
-     const preUrl = window.location.pathname.split('/').slice(0, 4).join('/');
 
-     let changeListData;
 
-     let gclGatherData;
 
-     postData(preUrl + '/defaultBills', {}, function (result) {
 
-         gclGatherModel.loadLedgerData(result.bills);
 
-         gclGatherModel.loadPosData(result.pos);
 
-         gclGatherData = gclGatherModel.gatherGclData();
 
-         gclGatherData = _.filter(gclGatherData, function (item) {
 
-             return item.leafXmjs && item.leafXmjs.length !== 0;
 
-         });
 
-         for (const ggd in gclGatherData) {
 
-             if (gclGatherData[ggd].leafXmjs && gclGatherData[ggd].leafXmjs.length === 0) {
 
-                 gclGatherData.splice(ggd, 1);
 
-             }
 
-             gclGatherData[ggd].code = gclGatherData[ggd].b_code;
 
-         }
 
-         // 数组去重
 
-         const dealBillList = result.dealBills;
 
-         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);
 
-             }
 
-         }
 
-         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 !== 0 && gcl.quantity !== null && gcl.quantity !== undefined ? (unit !== '' ? ZhCalc.round(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.length !== 0 ? gcl.leafXmjs[0].gcl_id : false) : gcl.id;
 
-             if (lid) {
 
-                 listHtml += '<tr data-lid="' + lid + '"' + gclhtml + ' data-index="' + list_index + '" data-bwmx="">' +
 
-                     '<td class="text-center">' + list_index + '</td>' +
 
-                     '<td>' + gcl.code + '</td>' +
 
-                     '<td class="text-left">' + gcl.name + '</td>' +
 
-                     '<td class="text-center">' + unit + '</td>' +
 
-                     '<td class="text-right">' + (ZhCalc.round(unit_price, unitPriceUnit) ? ZhCalc.round(unit_price, unitPriceUnit) : 0) + '</td>' +
 
-                     '<td class="text-right">' + quantity + '</td>' +
 
-                     '</tr>';
 
-                 list_index++;
 
-             }
 
-         }
 
-         $('#table-list-select').html(listHtml);
 
-         tableDataRemake(changeListData);
 
-         SpreadJsObj.initSpreadSettingEvents(changeSpreadSetting, changeCol);
 
-         SpreadJsObj.initSheet(changeSpreadSheet, changeSpreadSetting);
 
-         SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
 
-         // changeSpreadSheet.options.protectionOptions = {
 
-         //     allowSort: true,
 
-         //     allowFilter: true
 
-         // };
 
-         // var option = changeSpreadSheet.options.protectionOptions;
 
-         // changeSpreadSheet.rowFilter(new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(-1, 0, -1, changeSpreadSetting.cols.length)));
 
-         // // changeSpreadSheet.rowFilter(new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(-1, 0, -1, 3)));
 
-         // const filter = changeSpreadSheet.rowFilter();
 
-         // filter.filterButtonVisible(false);
 
-         // filter.filterButtonVisible(0, true);
 
-         // filter.filterButtonVisible(2, true);
 
-         // filter.filterDialogVisibleInfo({
 
-         //     sortByValue: true,         //SortByValue item is visible.
 
-         //     sortByColor: false,          //SortByColor item is visible.
 
-         //     filterByColor: false,        //FilterByColor item is visible.
 
-         //     filterByValue: false,        //FilterByValue item is visible.
 
-         //     listFilterArea: false       //ListFilterArea item is visible.
 
-         // });
 
-         // function compareList(obj1, obj2) {
 
-         //     console.log(obj1, obj2);
 
-         //     var list = ["", '204-1-b', '合计'];
 
-         //     var index1 = list.indexOf(obj1), index2 = list.indexOf(obj2);
 
-         //     if (index1 > index2) {
 
-         //         return 1;
 
-         //     } else if (index1 < index2) {
 
-         //         return -1;
 
-         //     } else {
 
-         //         return 0;
 
-         //     }
 
-         // }
 
-         // changeSpreadSheet.sortRange(0, 0, changeSpreadSetting.cols.length, 1, true, [{index: 0, ascending: true, compareFunction: compareList}]);
 
-         // changeSpreadSheet.bind(GC.Spread.Sheets.Events.RangeSorting, function (e, info) {
 
-         //     info.compareFunction = compareList;
 
-         // });
 
-         // filter.sortColumn(0, true);
 
-         changeSpreadObj.makeSjsFooter();
 
-         changeSpreadObj.resetXmjSpread(SpreadJsObj.getSelectObject(changeSpreadSheet));
 
-     });
 
-     if (!readOnly) {
 
-         $('#add-white-btn').click(changeSpreadObj.add);
 
-         changeSpread.bind(spreadNS.Events.EditEnded, changeSpreadObj.editEnded);
 
-         changeSpread.bind(spreadNS.Events.SelectionChanged, changeSpreadObj.selectionChanged);
 
-         changeSpread.bind(spreadNS.Events.ClipboardPasted, changeSpreadObj.clipboardPasted);
 
-         SpreadJsObj.addDeleteBind(changeSpread, changeSpreadObj.deletePress);
 
-         changeSpreadSheet.getCell(-1, 10).foreColor('#dc3545');
 
-         // 右键菜单
 
-         $.contextMenu({
 
-             selector: '#change-spread',
 
-             build: function ($trigger, e) {
 
-                 const target = SpreadJsObj.safeRightClickSelection($trigger, e, changeSpread);
 
-                 return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
 
-             },
 
-             items: {
 
-                 'createList': {
 
-                     name: '添加台账清单',
 
-                     icon: 'fa-sign-in',
 
-                     callback: function (key, opt) {
 
-                         $('#addlist').modal('show');
 
-                     },
 
-                 },
 
-                 'createAdd': {
 
-                     name: '添加空白清单',
 
-                     icon: 'fa-sign-in',
 
-                     callback: function (key, opt) {
 
-                         changeSpreadObj.add(changeSpreadSheet);
 
-                     },
 
-                 },
 
-                 'delete': {
 
-                     name: '删除',
 
-                     icon: 'fa-remove',
 
-                     callback: function (key, opt) {
 
-                         changeSpreadObj.del(changeSpreadSheet);
 
-                     },
 
-                     disabled: function (key, opt) {
 
-                         const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
 
-                         const sel = changeSpreadSheet.getSelections()[0];
 
-                         changeSpreadObj.resetXmjSpread(select);
 
-                         console.log(select, sel);
 
-                         if (!readOnly && select && sel.row !== changeSpreadSheet.getRowCount() - 1) {
 
-                             return false;
 
-                         } else {
 
-                             return true;
 
-                         }
 
-                     }
 
-                 },
 
-             }
 
-         });
 
-     }
 
-     // 清单选中和移除
 
-     $('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() +'" gcl_id=""><td colspan="7" class="colspan_1"> </td><td class="colspan_2"><input type="checkbox"></td></tr>';
 
-         if (isDeal) {
 
-             const lid = $(this).data('lid');
 
-             let gcl = _.find(gclGatherData, function (item) {
 
-                 return item.leafXmjs && item.leafXmjs[0].gcl_id === lid;
 
-             });
 
-             if (!gcl) {
 
-                 gcl = gclGatherData[$(this).data('gcl')];
 
-             }
 
-             codeHtml = '';
 
-             for (const leaf of gcl.leafXmjs) {
 
-                 const quantity = leaf.quantity !== undefined && leaf.quantity !== null ? leaf.quantity : 0;
 
-                 const gcl_id = leaf.gcl_id ? leaf.gcl_id : '';
 
-                 const bwmx = leaf.bwmx !== undefined ? leaf.bwmx : '';
 
-                 const isChecked = data_bwmx.indexOf(
 
-                     leaf.code + '!_!' + (leaf.jldy ? leaf.jldy : '') + '!_!' +
 
-                     (leaf.dwgc ? leaf.dwgc : '') + '!_!' + (leaf.fbgc ? leaf.fbgc : '') + '!_!' + (leaf.fxgc ? leaf.fxgc : '')
 
-                     + '!_!' + (leaf.gcl_id ? leaf.gcl_id : '0') + '!_!' +
 
-                     (bwmx !== '' ? bwmx : leaf.jldy ? leaf.jldy : '') + '*;*' + quantity) !== -1 && isCheck ?
 
-                     'checked' : '';
 
-                 codeHtml += '<tr quantity="' + quantity + '" gcl_id="' + gcl_id + '"><td>' + leaf.code + '</td>' +
 
-                     '<td>' + (leaf.jldy ? leaf.jldy: '') + '</td>' +
 
-                     '<td>' + (leaf.dwgc ? leaf.dwgc : '') + '</td>' +
 
-                     '<td>' + (leaf.fbgc ? leaf.fbgc : '') + '</td>' +
 
-                     '<td>' + (leaf.fxgc ? leaf.fxgc : '') + '</td>' +
 
-                     '<td>' + bwmx + '</td>' +
 
-                     '<td class="text-right">' + (ZhCalc.round(quantity, findDecimal(gcl.unit)) ? ZhCalc.round(quantity, findDecimal(gcl.unit)) : 0) + '</td>' +
 
-                     '<td class="text-center"><input type="checkbox"' + isChecked +
 
-                     '></td></tr>';
 
-             }
 
-         } else if (!isDeal && isCheck) {
 
-             codeHtml = '<tr quantity="'+ $(this).children('td').eq(5).text() +'" gcl_id=""><td colspan="7" 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-input').val('');
 
-         $('#code-input').siblings('a').hide();
 
-         $('#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 gcl_id = tr.attr('gcl_id');
 
-                 const bwmx = length === 8 ?
 
-                     tr.children('td').eq(0).text() + '!_!' +
 
-                     tr.children('td').eq(1).text() + '!_!' +
 
-                     tr.children('td').eq(2).text() + '!_!' +
 
-                     tr.children('td').eq(3).text() + '!_!' +
 
-                     tr.children('td').eq(4).text() + '!_!' + gcl_id + '!_!' +
 
-                     (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).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 gcl_id = tr.attr('gcl_id');
 
-                     const bwmx = length === 8 ?
 
-                         tr.children('td').eq(0).text() + '!_!' +
 
-                         tr.children('td').eq(1).text() + '!_!' +
 
-                         tr.children('td').eq(2).text() + '!_!' +
 
-                         tr.children('td').eq(3).text() + '!_!' +
 
-                         tr.children('td').eq(4).text() + '!_!' + gcl_id + '!_!' +
 
-                         (tr.children('td').eq(5).text() !== '' ? tr.children('td').eq(5).text() : tr.children('td').eq(1).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 () {
 
-         const newLedgerList = remakeChangeSpread();
 
-         // 更新至服务器
 
-         postData(window.location.pathname + '/save', { type:'ledger_list', updateData: newLedgerList }, function (result) {
 
-             changeList = result;
 
-             SpreadJsObj.loadSheetData(changeSpreadSheet, SpreadJsObj.DataType.Data, changeList);
 
-             changeSpreadObj.makeSjsFooter();
 
-             const select = SpreadJsObj.getSelectObject(changeSpreadSheet);
 
-             changeSpreadObj.resetXmjSpread(select);
 
-             $('#addlist').modal('hide');
 
-         }, function () {
 
-             $('#addlist').modal('hide');
 
-         });
 
-     });
 
-     // 选中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);
 
-     });
 
-     // 自动编号
 
-     $('.reduction-code').click(function () {
 
-         const code = $(this).attr('data-code');
 
-         $('input[name="code"]').val(code);
 
-     });
 
-     $('#list-input').on('valuechange', function (e, previous) {
 
-         const value = $(this).val();
 
-         let showListData = changeListData;
 
-         if (value !== '') {
 
-             $(this).siblings('a').show();
 
-             showListData = _.filter(changeListData, function (c) {
 
-                 return (c.code && c.code.indexOf(value) !== -1) || (c.name && c.name.indexOf(value) !== -1);
 
-             });
 
-         } else {
 
-             $(this).siblings('a').hide();
 
-         }
 
-         makeListTable(changeListData, showListData);
 
-         $('#table-list-select tr').removeClass('table-warning');
 
-         $('#code-input').val('');
 
-         $('#code-input').siblings('a').hide();
 
-         $('#code-list').html('');
 
-     });
 
-     $('#code-input').on('valuechange', function (e, previous) {
 
-         const value = $(this).val();
 
-         if (value !== '') {
 
-             $(this).siblings('a').show();
 
-         } else {
 
-             $(this).siblings('a').hide();
 
-         }
 
-         makeCodeTable($(this).val());
 
-     });
 
-     $('.remove-btn').on('click', function () {
 
-         $(this).hide();
 
-         $(this).siblings('input').val('');
 
-         if ($(this).data('btn') === 'list') {
 
-             makeListTable(changeListData);
 
-             $('#table-list-select tr').removeClass('table-warning');
 
-             $('#code-list').html('');
 
-         } else {
 
-             makeCodeTable();
 
-         }
 
-     });
 
-     // 记录变更信息操作
 
-     $('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();
 
-     });
 
-     // 保存修改ajax提交(不刷新页面)
 
-     $('.save_change_btn').on('click', function () {
 
-         // 保存修改modal
 
-         if ($('input[name="code"]').val() === '') {
 
-             toastr.error('申请编号不能为空!');
 
-             return;
 
-         }
 
-         if ($('input[name="name"]').val() === '') {
 
-             toastr.error('工程名称不能为空!');
 
-             return;
 
-         }
 
-         // 更新至服务器
 
-         postData(window.location.pathname + '/save', { type:'info', updateData: changeInfo }, function (result) {
 
-             $('.reduction-code').attr('data-code', $('input[name="code"]').val());
 
-             toastr.success(result);
 
-             $('#show-save-btn').hide();
 
-             $('#sp-btn').show();
 
-             $('.title-main').removeClass('bg-warning');
 
-             back_changeInfo = Object.assign({}, changeInfo);
 
-         });
 
-         return false;
 
-     });
 
-     $('#cancel_change').on('click', function () {
 
-         $('#show-save-btn').hide();
 
-         $('#sp-btn').show();
 
-         $('.title-main').removeClass('bg-warning');
 
-         if (!isObjEqual(changeInfo, back_changeInfo)) {
 
-             changeFormRemake();
 
-         }
 
-         toastr.success('已还原到上次保存状态');
 
-     });
 
- });
 
- function checkChangeFrom() {
 
-     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 (changeList.length === 0) {
 
-         toastr.error('请添加变更清单!');
 
-         returnFlag = true;
 
-     } else {
 
-         for (const [i,cl] of changeList.entries()) {
 
-             if (cl.code === '' || cl.name === '' || cl.oamount === '') {
 
-                 toastr.error('变更清单第' + (i+1) + '行未完整填写数据(变更部位、变更详情、单位、单价可空)');
 
-                 returnFlag = true;
 
-             }
 
-         }
 
-     }
 
-     if(!checkAuditorFrom ()) {
 
-         returnFlag = true;
 
-     }
 
-     if (returnFlag) {
 
-         return false;
 
-     }
 
- }
 
- // 检查上报情况
 
- function checkAuditorFrom () {
 
-     if ($('#auditList li').length === 0) {
 
-         if(shenpi_status === shenpiConst.sp_status.gdspl) {
 
-             toastr.error('请联系管理员添加审批人');
 
-         } else {
 
-             toastr.error('请先选择审批人,再上报数据');
 
-         }
 
-         return false;
 
-     }
 
-     return true;
 
- }
 
- 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('');
 
-     // 根据已添加的清单显示
 
-     if (changeList.length > 0 && changeList[0]) {
 
-         const removeList = [];
 
-         for (const [index,clinfo] of changeList.entries()) {
 
-             if (clinfo.lid != 0) {
 
-                 let listinfo = changeListData.find(function (item) {
 
-                     return (item.id !== undefined && item.id == clinfo.lid) || (item.id === undefined && item.leafXmjs !== undefined && item.leafXmjs.length !== 0 && item.leafXmjs[0].gcl_id == clinfo.lid);
 
-                 });
 
-                 if (listinfo === undefined) {
 
-                     // 针对旧数据获取清单信息
 
-                     listinfo = changeListData[clinfo.lid - 1];
 
-                     if (listinfo === undefined) {
 
-                         toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
 
-                         // changeList.splice(index, 1);
 
-                         removeList.push(clinfo);
 
-                         continue;
 
-                     }
 
-                     $('#table-list-select tr[data-index="'+ clinfo.lid +'"]').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.bwmx) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
 
-                         });
 
-                         console.log(leafInfo);
 
-                         if (leafInfo) {
 
-                             pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
 
-                                 (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
 
-                                 (leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
 
-                                 (leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
 
-                                 (leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
 
-                                 (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy !== undefined ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
 
-                         } else {
 
-                             toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
 
-                             // changeList.splice(index, 1);
 
-                             removeList.push(clinfo);
 
-                             continue;
 
-                         }
 
-                     } else {
 
-                         pushbwmx = '0*;*' + (listinfo.quantity !== null ? listinfo.quantity : 0);
 
-                     }
 
-                     const bwmx = $('#table-list-select tr[data-index="'+ clinfo.lid +'"]').attr('data-bwmx');
 
-                     if (bwmx) {
 
-                         const bwmxArray = bwmx.split('$#$');
 
-                         bwmxArray.push(pushbwmx);
 
-                         $('#table-list-select tr[data-index="'+ clinfo.lid +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
 
-                     } else {
 
-                         $('#table-list-select tr[data-index="'+ clinfo.lid +'"]').attr('data-bwmx', pushbwmx);
 
-                     }
 
-                 } else {
 
-                     $('#table-list-select tr[data-lid="'+ clinfo.lid +'"]').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.bwmx || item.jldy === clinfo.bwmx) && (item.quantity !== null ? item.quantity === parseFloat(clinfo.oamount) : 0 === parseFloat(clinfo.oamount));
 
-                         });
 
-                         if (leafInfo) {
 
-                             pushbwmx = leafInfo.code + '!_!' + (leafInfo.jldy !== undefined ? leafInfo.jldy : '') + '!_!' +
 
-                                 (leafInfo.dwgc ? leafInfo.dwgc : '') + '!_!' +
 
-                                 (leafInfo.fbgc ? leafInfo.fbgc : '') + '!_!' +
 
-                                 (leafInfo.fxgc ? leafInfo.fxgc : '') + '!_!' +
 
-                                 (leafInfo.gcl_id ? leafInfo.gcl_id : '') + '!_!' +
 
-                                 (leafInfo.bwmx !== undefined ? leafInfo.bwmx : (leafInfo.jldy !== undefined ? leafInfo.jldy : '')) + '*;*' + (leafInfo.quantity !== null ? leafInfo.quantity : 0);
 
-                         } else {
 
-                             toastr.warning('台账清单列表已不存在'+ clinfo.code +',已更新变更清单列表');
 
-                             // changeList.splice(index, 1);
 
-                             removeList.push(clinfo);
 
-                             continue;
 
-                         }
 
-                     } else {
 
-                         pushbwmx = '0*;*' + (listinfo.quantity !== null ? listinfo.quantity : 0);
 
-                     }
 
-                     const bwmx = $('#table-list-select tr[data-lid="'+ clinfo.lid +'"]').attr('data-bwmx');
 
-                     if (bwmx) {
 
-                         const bwmxArray = bwmx.split('$#$');
 
-                         bwmxArray.push(pushbwmx);
 
-                         $('#table-list-select tr[data-lid="'+ clinfo.lid +'"]').attr('data-bwmx', bwmxArray.join('$#$'));
 
-                     } else {
 
-                         $('#table-list-select tr[data-lid="'+ clinfo.lid +'"]').attr('data-bwmx', pushbwmx);
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         if(removeList.length > 0) {
 
-             _.pullAll(changeList, removeList);
 
-             postData(window.location.pathname + '/save', { type:'remove_list', updateData: removeList }, function (result) {
 
-             }, function () {
 
-             });
 
-         }
 
-     }
 
- }
 
- // 清单搜索隐藏清单table部分值
 
- function makeListTable(changeListData, showListData = changeListData) {
 
-     // 先加载台账数据
 
-     let listHtml = '';
 
-     let list_index = 1;
 
-     let gcl_index = 0;
 
-     for (const [index,gcl] of changeListData.entries()) {
 
-         const isShow = _.find(showListData, gcl);
 
-         $('#table-list-select tr').eq(index).css('display', (isShow ? 'table-row' : 'none'));
 
-     }
 
- }
 
- // 项目节搜索隐藏code-table部分值
 
- function makeCodeTable(search = '') {
 
-     if (search === '') {
 
-         $('#code-list tr').css('display', 'table-row');
 
-         return;
 
-     }
 
-     for(let i = 0; i < $('#code-list tr').length; i++) {
 
-         const length = $('#code-list tr').eq(i).children('td').length;
 
-         if (length === 8) {
 
-             const code = $('#code-list tr').eq(i).children('td').eq(0).text();
 
-             const name = $('#code-list tr').eq(i).children('td').eq(1).text();
 
-             const jldy = $('#code-list tr').eq(i).children('td').eq(5).text();
 
-             const isShow = code.indexOf(search) !== -1 || name.indexOf(search) !== -1 || jldy.indexOf(search) !== -1;
 
-             $('#code-list tr').eq(i).css('display', (isShow ? 'table-row' : 'none'));
 
-         } else {
 
-             return;
 
-         }
 
-     }
 
- }
 
- function remakeChangeSpread() {
 
-     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] != '' ? b.split('*;*')[1] : 0;
 
-             let bwmx = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[6] : '';
 
-             let xmj_code = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[0] : '';
 
-             let xmj_jldy = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[1] : '';
 
-             let xmj_dwgc = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[2] : '';
 
-             let xmj_fbgc = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[3] : '';
 
-             let xmj_fxgc = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[4] : '';
 
-             let gcl_id = b.split('*;*')[0] != 0 ? b.split('*;*')[0].split('!_!')[5] : '';
 
-             let trlist = {
 
-                 code,
 
-                 name,
 
-                 bwmx,
 
-                 unit,
 
-                 unit_price: price,
 
-                 oamount,
 
-                 camount: scnum,
 
-                 detail: '',
 
-                 lid,
 
-                 xmj_code,
 
-                 xmj_jldy,
 
-                 xmj_dwgc,
 
-                 xmj_fbgc,
 
-                 xmj_fxgc,
 
-                 gcl_id,
 
-             };
 
-             const radionInfo = changeList.find(function (info) {
 
-                 return info.code === code && (info.lid == lid || parseInt(info.lid) === parseInt(lindex)) && gcl_id == info.gcl_id && info.bwmx === bwmx;
 
-             });
 
-             if (radionInfo) {
 
-                 trlist.camount = radionInfo.camount;
 
-                 trlist.detail = radionInfo.detail;
 
-             }
 
-             newTableList.push(trlist);
 
-         }
 
-     });
 
-     // const changeWhiteList = _.filter(changeList, function (item) {
 
-     //     return item.lid == 0;
 
-     // });
 
-     // console.log(newTableList);
 
-     // changeList = newTableList.concat(changeWhiteList);
 
-     return newTableList;
 
- }
 
- //判断元素是否在数组中,相当于php的in_array();
 
- function in_array(arr, obj) {
 
-     let i = arr.length;
 
-     while (i--) {
 
-         if (arr[i] == obj) {
 
-             return true;
 
-         }
 
-     }
 
-     return false;
 
- }
 
- 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;
 
- }
 
- // 判断是否有更改过
 
- function judgeChange() {
 
-     let change = false;
 
-     if (!isObjEqual(changeInfo, back_changeInfo)) {
 
-         change = true;
 
-     }
 
-     if (change) {
 
-         $('#show-save-btn').show();
 
-         $('#sp-btn').hide();
 
-         $('.title-main').addClass('bg-warning');
 
-     } else {
 
-         $('#show-save-btn').hide();
 
-         $('#sp-btn').show();
 
-         $('.title-main').removeClass('bg-warning');
 
-     }
 
- }
 
- 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);
 
-     }
 
- }
 
 
  |