|  | @@ -43,8 +43,9 @@ function getMpSpreadByMBData(id) {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  function getMaterialListByLeafXmj(gcl_id, xmj_id, mx_id = '') {
 | 
	
		
			
				|  |  |      const list = [];
 | 
	
		
			
				|  |  | +    const ms_id = isStageSelf ? parseInt($('#myTab').find('.active').data('msid')) : null;
 | 
	
		
			
				|  |  |      for (const ml of materialListData) {
 | 
	
		
			
				|  |  | -        if (gcl_id === ml.gcl_id && xmj_id === ml.xmj_id && (mx_id === '' || mx_id === ml.mx_id)) {
 | 
	
		
			
				|  |  | +        if (gcl_id === ml.gcl_id && xmj_id === ml.xmj_id && (mx_id === '' || mx_id === ml.mx_id) && (ms_id === null || ms_id === ml.ms_id)) {
 | 
	
		
			
				|  |  |              list.push(ml);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -232,113 +233,256 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              },
 | 
	
		
			
				|  |  |          ],
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  | -    // 加载清单数据 - 暂时统一加载,如有需要,切换成动态加载并缓存
 | 
	
		
			
				|  |  | -    postData(window.location.pathname + '/load', {}, async function (result) {
 | 
	
		
			
				|  |  | -        ledger = result.ledger;
 | 
	
		
			
				|  |  | -        curLedgerData = result.curLedgerData;
 | 
	
		
			
				|  |  | -        pos = result.pos;
 | 
	
		
			
				|  |  | -        curPosData = result.curPosData;
 | 
	
		
			
				|  |  | -        materialListData = result.materialListData;
 | 
	
		
			
				|  |  | -        gclList = result.gclList;
 | 
	
		
			
				|  |  | -        notJoinList = result.materialNotJoinListData;
 | 
	
		
			
				|  |  | -        selfList = result.materialSelfListData;
 | 
	
		
			
				|  |  | -        materialChecklistData = result.materialChecklistData;
 | 
	
		
			
				|  |  | -        // 解析清单汇总数据
 | 
	
		
			
				|  |  | -        gclGatherModel.loadLedgerData(ledger, curLedgerData);
 | 
	
		
			
				|  |  | -        gclGatherModel.loadPosData(pos, curPosData);
 | 
	
		
			
				|  |  | -        gclGatherData = gclGatherModel.gatherGclData();
 | 
	
		
			
				|  |  | -        console.log(gclGatherData);
 | 
	
		
			
				|  |  | -        if (openMaterialChecklist) {
 | 
	
		
			
				|  |  | -            const hadBillsidList = _.uniq(_.map(gclList, 'gcl_id'));
 | 
	
		
			
				|  |  | -            console.log(hadBillsidList);
 | 
	
		
			
				|  |  | -            // 判断是否有修订影响到本次数据,并有几率修改清单设置页的值
 | 
	
		
			
				|  |  | -            const pushData = [];
 | 
	
		
			
				|  |  | -            const updateData = [];
 | 
	
		
			
				|  |  | -            for (const hb of hadBillsidList) {
 | 
	
		
			
				|  |  | -                const gcl = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | -                    return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, { gcl_id : hb }) !== -1;
 | 
	
		
			
				|  |  | +    const needUpdateArray = ['quantity', 'msg_tp', 'msg_times', 'msg_spread', 'm_spread', 'm_tp', 'm_tax_tp', 'is_summary', 'remark'];
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function getGclList() {
 | 
	
		
			
				|  |  | +        if (gclGatherListData) {
 | 
	
		
			
				|  |  | +            return gclGatherListData;
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            const newGclGatherListData = [];
 | 
	
		
			
				|  |  | +            for (const [index,s] of ledgerListData.entries()) {
 | 
	
		
			
				|  |  | +                console.log(index, s);
 | 
	
		
			
				|  |  | +                gclGatherModel.loadLedgerData(ledger, s);
 | 
	
		
			
				|  |  | +                gclGatherModel.loadPosData(pos, posListData[index]);
 | 
	
		
			
				|  |  | +                const oneGclGatherData = gclGatherModel.gatherGclData().filter(item => {
 | 
	
		
			
				|  |  | +                    return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  |                  });
 | 
	
		
			
				|  |  | -                if (gcl) {
 | 
	
		
			
				|  |  | -                    const mc = _.find(materialChecklistData, { b_code: gcl.b_code, name: gcl.name, unit: gcl.unit, unit_price: gcl.unit_price });
 | 
	
		
			
				|  |  | -                    // const newOrder = _.indexOf(gclGatherData, gcl);
 | 
	
		
			
				|  |  | -                    // console.log(newOrder);
 | 
	
		
			
				|  |  | -                    if (!mc && _.findIndex(pushData, { b_code: gcl.b_code, name: gcl.name, unit: gcl.unit, unit_price: gcl.unit_price }) === -1) {
 | 
	
		
			
				|  |  | -                        pushData.push({ b_code: gcl.b_code, name: gcl.name, unit: gcl.unit, unit_price: gcl.unit_price, quantity: (gcl.quantity ? gcl.quantity : null), total_price: (gcl.total_price ? gcl.total_price : null), had_bills: 1 });
 | 
	
		
			
				|  |  | +                newGclGatherListData.push(oneGclGatherData);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            return newGclGatherListData;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    let first = true;
 | 
	
		
			
				|  |  | +    function setListsData(sid = null, ms_id = null) {
 | 
	
		
			
				|  |  | +        if (first) {
 | 
	
		
			
				|  |  | +            // 加载清单数据 - 暂时统一加载,如有需要,切换成动态加载并缓存
 | 
	
		
			
				|  |  | +            postData(window.location.pathname + '/load', {sid}, async function (result) {
 | 
	
		
			
				|  |  | +                ledger = result.ledger;
 | 
	
		
			
				|  |  | +                curLedgerData = result.curLedgerData;
 | 
	
		
			
				|  |  | +                pos = result.pos;
 | 
	
		
			
				|  |  | +                curPosData = result.curPosData;
 | 
	
		
			
				|  |  | +                materialListData = result.materialListData;
 | 
	
		
			
				|  |  | +                gclList = result.gclList;
 | 
	
		
			
				|  |  | +                notJoinList = result.materialNotJoinListData;
 | 
	
		
			
				|  |  | +                selfList = result.materialSelfListData;
 | 
	
		
			
				|  |  | +                materialChecklistData = result.materialChecklistData;
 | 
	
		
			
				|  |  | +                if (isStageSelf) {
 | 
	
		
			
				|  |  | +                    updateBillsData(ms_id);
 | 
	
		
			
				|  |  | +                    const newGclGatherListData = [];
 | 
	
		
			
				|  |  | +                    for (const [index, s] of result.ledgerListData.entries()) {
 | 
	
		
			
				|  |  | +                        gclGatherModel.loadLedgerData(ledger, s);
 | 
	
		
			
				|  |  | +                        gclGatherModel.loadPosData(pos, result.posListData[index]);
 | 
	
		
			
				|  |  | +                        const oneGclGatherData = gclGatherModel.gatherGclData().filter(item => {
 | 
	
		
			
				|  |  | +                            return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                        newGclGatherListData.push(oneGclGatherData);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                    gclGatherListData = newGclGatherListData;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            const removeData = [];
 | 
	
		
			
				|  |  | -            for (const mc of materialChecklistData) {
 | 
	
		
			
				|  |  | -                const gcl = _.find(gclGatherData, { b_code: mc.b_code, name: mc.name, unit: mc.unit, unit_price: mc.unit_price });
 | 
	
		
			
				|  |  | -                // 判断是否已不存在工料清单,台账修改过后删除之
 | 
	
		
			
				|  |  | -                if (!gcl) {
 | 
	
		
			
				|  |  | -                    removeData.push(mc.id);
 | 
	
		
			
				|  |  | -                } else {
 | 
	
		
			
				|  |  | -                    // 更新had_bills值
 | 
	
		
			
				|  |  | -                    const updateObj = { id: mc.id };
 | 
	
		
			
				|  |  | -                    const gcl_ids = gcl.leafXmjs ? _.uniq(_.map(gcl.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | -                    const jiaoji = _.intersection(gcl_ids, hadBillsidList);
 | 
	
		
			
				|  |  | -                    if (mc.had_bills === 1) {
 | 
	
		
			
				|  |  | -                        if (jiaoji.length === 0) {
 | 
	
		
			
				|  |  | -                            updateObj.mid = materialID;
 | 
	
		
			
				|  |  | -                            updateObj.had_bills = 0;
 | 
	
		
			
				|  |  | -                            // updateData.push({ id: mc.id, mid: materialID, had_bills: 0 });
 | 
	
		
			
				|  |  | +                // 解析清单汇总数据
 | 
	
		
			
				|  |  | +                gclGatherModel.loadLedgerData(ledger, curLedgerData);
 | 
	
		
			
				|  |  | +                gclGatherModel.loadPosData(pos, curPosData);
 | 
	
		
			
				|  |  | +                gclGatherData = gclGatherModel.gatherGclData();
 | 
	
		
			
				|  |  | +                console.log(gclGatherData);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                if (openMaterialChecklist) {
 | 
	
		
			
				|  |  | +                    const hadBillsidList = _.uniq(_.map(gclList, 'gcl_id'));
 | 
	
		
			
				|  |  | +                    console.log(hadBillsidList);
 | 
	
		
			
				|  |  | +                    // 判断是否有修订影响到本次数据,并有几率修改清单设置页的值
 | 
	
		
			
				|  |  | +                    const pushData = [];
 | 
	
		
			
				|  |  | +                    const updateData = [];
 | 
	
		
			
				|  |  | +                    for (const hb of hadBillsidList) {
 | 
	
		
			
				|  |  | +                        const gcl = _.find(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                            return item.leafXmjs && item.leafXmjs.length > 0 && _.findIndex(item.leafXmjs, {gcl_id: hb}) !== -1;
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                        if (gcl) {
 | 
	
		
			
				|  |  | +                            const mc = _.find(materialChecklistData, {
 | 
	
		
			
				|  |  | +                                b_code: gcl.b_code,
 | 
	
		
			
				|  |  | +                                name: gcl.name,
 | 
	
		
			
				|  |  | +                                unit: gcl.unit,
 | 
	
		
			
				|  |  | +                                unit_price: gcl.unit_price
 | 
	
		
			
				|  |  | +                            });
 | 
	
		
			
				|  |  | +                            // const newOrder = _.indexOf(gclGatherData, gcl);
 | 
	
		
			
				|  |  | +                            // console.log(newOrder);
 | 
	
		
			
				|  |  | +                            if (!mc && _.findIndex(pushData, {
 | 
	
		
			
				|  |  | +                                b_code: gcl.b_code,
 | 
	
		
			
				|  |  | +                                name: gcl.name,
 | 
	
		
			
				|  |  | +                                unit: gcl.unit,
 | 
	
		
			
				|  |  | +                                unit_price: gcl.unit_price
 | 
	
		
			
				|  |  | +                            }) === -1) {
 | 
	
		
			
				|  |  | +                                pushData.push({
 | 
	
		
			
				|  |  | +                                    b_code: gcl.b_code,
 | 
	
		
			
				|  |  | +                                    name: gcl.name,
 | 
	
		
			
				|  |  | +                                    unit: gcl.unit,
 | 
	
		
			
				|  |  | +                                    unit_price: gcl.unit_price,
 | 
	
		
			
				|  |  | +                                    quantity: (gcl.quantity ? gcl.quantity : null),
 | 
	
		
			
				|  |  | +                                    total_price: (gcl.total_price ? gcl.total_price : null),
 | 
	
		
			
				|  |  | +                                    had_bills: 1
 | 
	
		
			
				|  |  | +                                });
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | -                    } else if (mc.had_bills === 0) {
 | 
	
		
			
				|  |  | -                        if (jiaoji.length !== 0) {
 | 
	
		
			
				|  |  | -                            updateObj.had_bills = 1;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                    const removeData = [];
 | 
	
		
			
				|  |  | +                    for (const mc of materialChecklistData) {
 | 
	
		
			
				|  |  | +                        const gcl = _.find(gclGatherData, {
 | 
	
		
			
				|  |  | +                            b_code: mc.b_code,
 | 
	
		
			
				|  |  | +                            name: mc.name,
 | 
	
		
			
				|  |  | +                            unit: mc.unit,
 | 
	
		
			
				|  |  | +                            unit_price: mc.unit_price
 | 
	
		
			
				|  |  | +                        });
 | 
	
		
			
				|  |  | +                        // 判断是否已不存在工料清单,台账修改过后删除之
 | 
	
		
			
				|  |  | +                        if (!gcl) {
 | 
	
		
			
				|  |  | +                            removeData.push(mc.id);
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            // 更新had_bills值
 | 
	
		
			
				|  |  | +                            const updateObj = {id: mc.id};
 | 
	
		
			
				|  |  | +                            const gcl_ids = gcl.leafXmjs ? _.uniq(_.map(gcl.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | +                            const jiaoji = _.intersection(gcl_ids, hadBillsidList);
 | 
	
		
			
				|  |  | +                            if (mc.had_bills === 1) {
 | 
	
		
			
				|  |  | +                                if (jiaoji.length === 0) {
 | 
	
		
			
				|  |  | +                                    updateObj.mid = materialID;
 | 
	
		
			
				|  |  | +                                    updateObj.had_bills = 0;
 | 
	
		
			
				|  |  | +                                    // updateData.push({ id: mc.id, mid: materialID, had_bills: 0 });
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            } else if (mc.had_bills === 0) {
 | 
	
		
			
				|  |  | +                                if (jiaoji.length !== 0) {
 | 
	
		
			
				|  |  | +                                    updateObj.had_bills = 1;
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            // 更新工程量及台账金额
 | 
	
		
			
				|  |  | +                            if (mc.quantity !== (gcl.quantity ? gcl.quantity : null)) {
 | 
	
		
			
				|  |  | +                                updateObj.quantity = gcl.quantity ? gcl.quantity : null;
 | 
	
		
			
				|  |  | +                                updateObj.total_price = gcl.total_price ? gcl.total_price : null;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                            if (!_.isEqual(updateObj, {id: mc.id})) updateData.push(updateObj);
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    // 更新工程量及台账金额
 | 
	
		
			
				|  |  | -                    if (mc.quantity !== (gcl.quantity ? gcl.quantity : null)) {
 | 
	
		
			
				|  |  | -                        updateObj.quantity = gcl.quantity ? gcl.quantity : null;
 | 
	
		
			
				|  |  | -                        updateObj.total_price = gcl.total_price ? gcl.total_price : null;
 | 
	
		
			
				|  |  | +                    console.log(pushData, removeData, updateData);
 | 
	
		
			
				|  |  | +                    if (pushData.length > 0 || removeData.length > 0 || updateData.length > 0) {
 | 
	
		
			
				|  |  | +                        // materialChecklistData = await postDataAsync('/tender/'+ tenderID +'/measure/material/'+ stage_order +'/checklist/save', { type: 'resetChecklist', pushData, removeData, updateData })
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | -                    if(!_.isEqual(updateObj,{ id: mc.id })) updateData.push(updateObj);
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            console.log(pushData, removeData, updateData);
 | 
	
		
			
				|  |  | -            if (pushData.length > 0 || removeData.length > 0 || updateData.length > 0) {
 | 
	
		
			
				|  |  | -                // materialChecklistData = await postDataAsync('/tender/'+ tenderID +'/measure/material/'+ stage_order +'/checklist/save', { type: 'resetChecklist', pushData, removeData, updateData })
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            gclGatherData = gclGatherData.filter(item => {
 | 
	
		
			
				|  |  | -                return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | -            // 取交集
 | 
	
		
			
				|  |  | -            const selfListGcl = _.uniq(_.map(selfList, 'gcl_id'));
 | 
	
		
			
				|  |  | -            gclGatherData = _.filter(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | -                if(_.find(materialChecklistData, { b_code: item.b_code, name: item.name, unit: item.unit, unit_price: item.unit_price })) {
 | 
	
		
			
				|  |  | -                    return true;
 | 
	
		
			
				|  |  | +                    gclGatherData = gclGatherData.filter(item => {
 | 
	
		
			
				|  |  | +                        return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  | +                    // 取交集
 | 
	
		
			
				|  |  | +                    const selfListGcl = _.uniq(_.map(selfList, 'gcl_id'));
 | 
	
		
			
				|  |  | +                    gclGatherData = _.filter(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                        if (_.find(materialChecklistData, {
 | 
	
		
			
				|  |  | +                            b_code: item.b_code,
 | 
	
		
			
				|  |  | +                            name: item.name,
 | 
	
		
			
				|  |  | +                            unit: item.unit,
 | 
	
		
			
				|  |  | +                            unit_price: item.unit_price
 | 
	
		
			
				|  |  | +                        })) {
 | 
	
		
			
				|  |  | +                            return true;
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            const gcl_ids = item.leafXmjs ? _.uniq(_.map(item.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | +                            const jiaoji = _.intersection(gcl_ids, selfListGcl);
 | 
	
		
			
				|  |  | +                            if (jiaoji.length > 0) {
 | 
	
		
			
				|  |  | +                                return true;
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  |                  } else {
 | 
	
		
			
				|  |  | -                    const gcl_ids = item.leafXmjs ? _.uniq(_.map(item.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | -                    const jiaoji = _.intersection(gcl_ids, selfListGcl);
 | 
	
		
			
				|  |  | -                    if (jiaoji.length > 0) {
 | 
	
		
			
				|  |  | -                        return true;
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | +                    gclGatherData = gclGatherData.filter(item => {
 | 
	
		
			
				|  |  | +                        return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | +                    });
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                calculateJiaCha(gclGatherData);
 | 
	
		
			
				|  |  | +                SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
 | 
	
		
			
				|  |  | +                // 加载清单数据
 | 
	
		
			
				|  |  | +                SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
 | 
	
		
			
				|  |  | +                loadLeafXmjData(0);
 | 
	
		
			
				|  |  | +                loadMaterialData(0);
 | 
	
		
			
				|  |  | +                loadXmjMaterialData(0, 0);
 | 
	
		
			
				|  |  | +                const sheet = materialSpread.getActiveSheet();
 | 
	
		
			
				|  |  | +                sheet.suspendPaint();
 | 
	
		
			
				|  |  | +                sheet.setCellType(1, 3, new TipCellType(), spreadNS.SheetArea.colHeader);
 | 
	
		
			
				|  |  | +                sheet.resumePaint();
 | 
	
		
			
				|  |  | +                const selfSheet = materialSelfSpread.getActiveSheet();
 | 
	
		
			
				|  |  | +                selfSheet.suspendPaint();
 | 
	
		
			
				|  |  | +                selfSheet.setCellType(1, 3, new TipCellType(), spreadNS.SheetArea.colHeader);
 | 
	
		
			
				|  |  | +                selfSheet.resumePaint();
 | 
	
		
			
				|  |  | +                checkNotJoinMaterialData();
 | 
	
		
			
				|  |  | +                first = false;
 | 
	
		
			
				|  |  |              });
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  | -            gclGatherData = gclGatherData.filter(item => {
 | 
	
		
			
				|  |  | -                return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | -            });
 | 
	
		
			
				|  |  | +            // 解析清单汇总数据
 | 
	
		
			
				|  |  | +            // const ms_id = $('#myTab').find('.active').data('msid');
 | 
	
		
			
				|  |  | +            updateBillsData(ms_id);
 | 
	
		
			
				|  |  | +            const i = _.findIndex(materialStageData, { sid });
 | 
	
		
			
				|  |  | +            gclGatherData = gclGatherListData[i];
 | 
	
		
			
				|  |  | +            if (openMaterialChecklist) {
 | 
	
		
			
				|  |  | +                gclGatherData = gclGatherData.filter(item => {
 | 
	
		
			
				|  |  | +                    return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +                // 取交集
 | 
	
		
			
				|  |  | +                const selfListGcl = _.uniq(_.map(selfList, 'gcl_id'));
 | 
	
		
			
				|  |  | +                gclGatherData = _.filter(gclGatherData, function (item) {
 | 
	
		
			
				|  |  | +                    if (_.find(materialChecklistData, {
 | 
	
		
			
				|  |  | +                        b_code: item.b_code,
 | 
	
		
			
				|  |  | +                        name: item.name,
 | 
	
		
			
				|  |  | +                        unit: item.unit,
 | 
	
		
			
				|  |  | +                        unit_price: item.unit_price
 | 
	
		
			
				|  |  | +                    })) {
 | 
	
		
			
				|  |  | +                        return true;
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        const gcl_ids = item.leafXmjs ? _.uniq(_.map(item.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | +                        const jiaoji = _.intersection(gcl_ids, selfListGcl);
 | 
	
		
			
				|  |  | +                        if (jiaoji.length > 0) {
 | 
	
		
			
				|  |  | +                            return true;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                gclGatherData = gclGatherData.filter(item => {
 | 
	
		
			
				|  |  | +                    return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  | +                });
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            console.log(gclGatherData);
 | 
	
		
			
				|  |  | +            calculateJiaCha(gclGatherData);
 | 
	
		
			
				|  |  | +            SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
 | 
	
		
			
				|  |  | +            // 加载清单数据
 | 
	
		
			
				|  |  | +            SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
 | 
	
		
			
				|  |  | +            loadLeafXmjData(0);
 | 
	
		
			
				|  |  | +            loadMaterialData(0);
 | 
	
		
			
				|  |  | +            loadXmjMaterialData(0, 0);
 | 
	
		
			
				|  |  | +            const sheet = materialSpread.getActiveSheet();
 | 
	
		
			
				|  |  | +            sheet.suspendPaint();
 | 
	
		
			
				|  |  | +            sheet.setCellType(1, 3, new TipCellType(), spreadNS.SheetArea.colHeader);
 | 
	
		
			
				|  |  | +            sheet.resumePaint();
 | 
	
		
			
				|  |  | +            const selfSheet = materialSelfSpread.getActiveSheet();
 | 
	
		
			
				|  |  | +            selfSheet.suspendPaint();
 | 
	
		
			
				|  |  | +            selfSheet.setCellType(1, 3, new TipCellType(), spreadNS.SheetArea.colHeader);
 | 
	
		
			
				|  |  | +            selfSheet.resumePaint();
 | 
	
		
			
				|  |  | +            checkNotJoinMaterialData();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | -        calculateJiaCha(gclGatherData);
 | 
	
		
			
				|  |  | -        SpreadJsObj.initSheet(leafXmjSpread.getActiveSheet(), leafXmjSpreadSetting);
 | 
	
		
			
				|  |  | -        // 加载清单数据
 | 
	
		
			
				|  |  | -        SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Data, gclGatherData);
 | 
	
		
			
				|  |  | -        loadLeafXmjData(0);
 | 
	
		
			
				|  |  | -        loadMaterialData(0);
 | 
	
		
			
				|  |  | -        loadXmjMaterialData(0, 0);
 | 
	
		
			
				|  |  | -        const sheet = materialSpread.getActiveSheet();
 | 
	
		
			
				|  |  | -        sheet.suspendPaint();
 | 
	
		
			
				|  |  | -        sheet.setCellType(1, 3, new TipCellType(), spreadNS.SheetArea.colHeader);
 | 
	
		
			
				|  |  | -        sheet.resumePaint();
 | 
	
		
			
				|  |  | -        const selfSheet = materialSelfSpread.getActiveSheet();
 | 
	
		
			
				|  |  | -        selfSheet.suspendPaint();
 | 
	
		
			
				|  |  | -        selfSheet.setCellType(1, 3, new TipCellType(), spreadNS.SheetArea.colHeader);
 | 
	
		
			
				|  |  | -        selfSheet.resumePaint();
 | 
	
		
			
				|  |  | -        checkNotJoinMaterialData();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    function updateBillsData(ms_id) {
 | 
	
		
			
				|  |  | +        const msbList = _.filter(materialStageBillsData, { ms_id });
 | 
	
		
			
				|  |  | +        for (const mb of materialBillsData) {
 | 
	
		
			
				|  |  | +            mb.ms_id = ms_id;
 | 
	
		
			
				|  |  | +            const msbInfo = _.find(msbList, { mb_id: mb.id });
 | 
	
		
			
				|  |  | +            for (const nu of needUpdateArray) {
 | 
	
		
			
				|  |  | +                mb[nu] = msbInfo[nu];
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    setListsData(isStageSelf ? materialStageData[0].sid : null, isStageSelf ? materialStageData[0].id : null);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // 期切换
 | 
	
		
			
				|  |  | +    $('#myTab a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
 | 
	
		
			
				|  |  | +        e.preventDefault();
 | 
	
		
			
				|  |  | +        const ms_id = $('#myTab').find('.active').data('msid');
 | 
	
		
			
				|  |  | +        const msInfo = _.find(materialStageData, { id: ms_id });
 | 
	
		
			
				|  |  | +        showWaitingView();
 | 
	
		
			
				|  |  | +        setTimeout(function () {
 | 
	
		
			
				|  |  | +            setListsData(msInfo.sid, ms_id);
 | 
	
		
			
				|  |  | +            closeWaitingView();
 | 
	
		
			
				|  |  | +        }, 500);
 | 
	
		
			
				|  |  |      });
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // const leafXmjCol = {
 | 
	
		
			
				|  |  |      //     getValue: {
 | 
	
		
			
				|  |  |      //         jiacha: function (data) {
 | 
	
	
		
			
				|  | @@ -485,8 +629,9 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              console.log(xmj, iLXmjRow);
 | 
	
		
			
				|  |  |              materialListSelf = [];
 | 
	
		
			
				|  |  |              if (_.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: (xmj.mx_id ? xmj.mx_id : '') }) != -1) {
 | 
	
		
			
				|  |  | +                const ms_id = isStageSelf ? parseInt($('#myTab').find('.active').data('msid')) : null;
 | 
	
		
			
				|  |  |                  for (const m of materialListData) {
 | 
	
		
			
				|  |  | -                    if (m.gcl_id === xmj.gcl_id && m.xmj_id === xmj.id && ((xmj.mx_id !==undefined && m.mx_id === xmj.mx_id) || xmj.mx_id === undefined)) {
 | 
	
		
			
				|  |  | +                    if (m.gcl_id === xmj.gcl_id && m.xmj_id === xmj.id && ((xmj.mx_id !==undefined && m.mx_id === xmj.mx_id) || xmj.mx_id === undefined) && (ms_id === null || ms_id === m.ms_id)) {
 | 
	
		
			
				|  |  |                          materialListSelf.push(m);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -576,6 +721,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |              const select = SpreadJsObj.getSelectObject(sheet);
 | 
	
		
			
				|  |  |              const index = gclGatherData.indexOf(select);
 | 
	
		
			
				|  |  |              const gcl = gclGatherData[index].leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
 | 
	
		
			
				|  |  | +            const ms_id = isStageSelf ? parseInt($('#myTab').find('.active').data('msid')) : null;
 | 
	
		
			
				|  |  |              const datas = [];
 | 
	
		
			
				|  |  |              for (const xmj of gcl) {
 | 
	
		
			
				|  |  |                  const notx = findNotJoinLeafXmj(xmj);
 | 
	
	
		
			
				|  | @@ -586,10 +732,35 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      gather_qty: xmj.gather_qty,
 | 
	
		
			
				|  |  |                      is_join: notx === undefined ? 1 : 0,
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  | +                if (ms_id) data.ms_id = ms_id;
 | 
	
		
			
				|  |  |                  datas.push(data);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            if (isStageSelf) {
 | 
	
		
			
				|  |  | +                // 取所有的gclGatherData才行,然后获取下的值
 | 
	
		
			
				|  |  | +                const gclData = gclGatherData[index];
 | 
	
		
			
				|  |  | +                for (const [index, ms] of materialStageData.entries()) {
 | 
	
		
			
				|  |  | +                    if (ms.id !== ms_id) {
 | 
	
		
			
				|  |  | +                        const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
 | 
	
		
			
				|  |  | +                        if (gclOther) {
 | 
	
		
			
				|  |  | +                            const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
 | 
	
		
			
				|  |  | +                            for (const xmj of leafXmjs) {
 | 
	
		
			
				|  |  | +                                const notx = findNotJoinLeafXmj(xmj);
 | 
	
		
			
				|  |  | +                                const data = {
 | 
	
		
			
				|  |  | +                                    xmj_id: xmj.id,
 | 
	
		
			
				|  |  | +                                    gcl_id: xmj.gcl_id,
 | 
	
		
			
				|  |  | +                                    mx_id: xmj.mx_id ? xmj.mx_id : '',
 | 
	
		
			
				|  |  | +                                    gather_qty: xmj.gather_qty,
 | 
	
		
			
				|  |  | +                                    is_join: notx === undefined ? 1 : 0,
 | 
	
		
			
				|  |  | +                                    ms_id: ms.id,
 | 
	
		
			
				|  |  | +                                };
 | 
	
		
			
				|  |  | +                                datas.push(data);
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              console.log(datas, gcl, mb_id);
 | 
	
		
			
				|  |  | -            postData(window.location.pathname + '/save', {type: 'adds', postData: {xmjs: datas, mbIds: mb_id}}, function (result) {
 | 
	
		
			
				|  |  | +            postData(window.location.pathname + '/save', {type: 'adds', postData: {xmjs: datas, mbIds: mb_id} }, function (result) {
 | 
	
		
			
				|  |  |                  materialListData = result.materialListData;
 | 
	
		
			
				|  |  |                  gclList = result.gclList;
 | 
	
		
			
				|  |  |                  // toastr.success('已成功应用');
 | 
	
	
		
			
				|  | @@ -623,7 +794,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  is_join: notx === undefined ? 1 : 0,
 | 
	
		
			
				|  |  |              };
 | 
	
		
			
				|  |  |              console.log(data);
 | 
	
		
			
				|  |  | -            postData(window.location.pathname + '/save', {type: 'add', postData: data}, function (result) {
 | 
	
		
			
				|  |  | +            postData(window.location.pathname + '/save', {type: 'add', postData: data, ms_id: $('#myTab').find('.active').data('msid') || null }, function (result) {
 | 
	
		
			
				|  |  |                  // 添加到materialList里
 | 
	
		
			
				|  |  |                  materialListData = result;
 | 
	
		
			
				|  |  |                  loadXmjMaterialData(index, leafXmjIndex);
 | 
	
	
		
			
				|  | @@ -654,6 +825,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  const data = {
 | 
	
		
			
				|  |  |                      type: type,
 | 
	
		
			
				|  |  |                      select: type === 'join' ? findNotJoinLeafXmj(select) : select,
 | 
	
		
			
				|  |  | +                    ms_id: $('#myTab').find('.active').data('msid') || null,
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  // 添加到
 | 
	
		
			
				|  |  |                  postData(window.location.pathname + '/save', data, function (result) {
 | 
	
	
		
			
				|  | @@ -677,6 +849,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  const data = {
 | 
	
		
			
				|  |  |                      type: type,
 | 
	
		
			
				|  |  |                      select: type === 'noself' ? findSelfLeafXmj(select) : select,
 | 
	
		
			
				|  |  | +                    ms_id: $('#myTab').find('.active').data('msid') || null,
 | 
	
		
			
				|  |  |                  };
 | 
	
		
			
				|  |  |                  // 添加到
 | 
	
		
			
				|  |  |                  postData(window.location.pathname + '/save', data, function (result) {
 | 
	
	
		
			
				|  | @@ -816,8 +989,31 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      };
 | 
	
		
			
				|  |  |                      datas.push(data);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                if (isStageSelf) {
 | 
	
		
			
				|  |  | +                    const ms_id = isStageSelf ? parseInt($('#myTab').find('.active').data('msid')) : null;
 | 
	
		
			
				|  |  | +                    // 取所有的gclGatherData才行,然后获取下的值
 | 
	
		
			
				|  |  | +                    const gclData = gclGatherData[index];
 | 
	
		
			
				|  |  | +                    for (const [index, ms] of materialStageData.entries()) {
 | 
	
		
			
				|  |  | +                        if (ms.id !== ms_id) {
 | 
	
		
			
				|  |  | +                            const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
 | 
	
		
			
				|  |  | +                            if (gclOther) {
 | 
	
		
			
				|  |  | +                                const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
 | 
	
		
			
				|  |  | +                                for (const xmj of leafXmjs) {
 | 
	
		
			
				|  |  | +                                    const data = {
 | 
	
		
			
				|  |  | +                                        xmj_id: xmj.id,
 | 
	
		
			
				|  |  | +                                        gcl_id: xmj.gcl_id,
 | 
	
		
			
				|  |  | +                                        mx_id: xmj.mx_id ? xmj.mx_id : '',
 | 
	
		
			
				|  |  | +                                    };
 | 
	
		
			
				|  |  | +                                    if (_.indexOf(datas, data) === -1) {
 | 
	
		
			
				|  |  | +                                        datas.push(data);
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  console.log(datas, materialSelect.mb_id);
 | 
	
		
			
				|  |  | -                postData(window.location.pathname + '/save', {type: 'dels', postData: { xmjs: datas, mb_id: materialSelect.mb_id }}, function (result) {
 | 
	
		
			
				|  |  | +                postData(window.location.pathname + '/save', {type: 'dels', postData: { xmjs: datas, mb_id: materialSelect.mb_id }, ms_id: $('#myTab').find('.active').data('msid') || null}, function (result) {
 | 
	
		
			
				|  |  |                      materialListData = result.materialListData;
 | 
	
		
			
				|  |  |                      gclList = result.gclList;
 | 
	
		
			
				|  |  |                      calculateJiaCha(gclGatherData);
 | 
	
	
		
			
				|  | @@ -918,8 +1114,31 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                          };
 | 
	
		
			
				|  |  |                          datas.push(data);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  | +                    if (isStageSelf) {
 | 
	
		
			
				|  |  | +                        const ms_id = isStageSelf ? parseInt($('#myTab').find('.active').data('msid')) : null;
 | 
	
		
			
				|  |  | +                        // 取所有的gclGatherData才行,然后获取下的值
 | 
	
		
			
				|  |  | +                        const gclData = gclGatherData[index];
 | 
	
		
			
				|  |  | +                        for (const [index, ms] of materialStageData.entries()) {
 | 
	
		
			
				|  |  | +                            if (ms.id !== ms_id) {
 | 
	
		
			
				|  |  | +                                const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
 | 
	
		
			
				|  |  | +                                if (gclOther) {
 | 
	
		
			
				|  |  | +                                    const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
 | 
	
		
			
				|  |  | +                                    for (const xmj of leafXmjs) {
 | 
	
		
			
				|  |  | +                                        const data = {
 | 
	
		
			
				|  |  | +                                            xmj_id: xmj.id,
 | 
	
		
			
				|  |  | +                                            gcl_id: xmj.gcl_id,
 | 
	
		
			
				|  |  | +                                            mx_id: xmj.mx_id ? xmj.mx_id : '',
 | 
	
		
			
				|  |  | +                                        };
 | 
	
		
			
				|  |  | +                                        if (_.indexOf(datas, data) === -1) {
 | 
	
		
			
				|  |  | +                                            datas.push(data);
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                      console.log(exprQuantity, datas, select.mb_id);
 | 
	
		
			
				|  |  | -                    postData(window.location.pathname + '/save', { type:'updates', updateData: { xmjs: datas, expr: exprQuantity.expr, quantity: exprQuantity.quantity, mb_id: select.mb_id } }, function (result) {
 | 
	
		
			
				|  |  | +                    postData(window.location.pathname + '/save', { type:'updates', updateData: { xmjs: datas, expr: exprQuantity.expr, quantity: exprQuantity.quantity, mb_id: select.mb_id }, ms_id: $('#myTab').find('.active').data('msid') || null }, function (result) {
 | 
	
		
			
				|  |  |                          materialListData = result.materialListData;
 | 
	
		
			
				|  |  |                          gclList = result.gclList;
 | 
	
		
			
				|  |  |                          calculateJiaCha(gclGatherData);
 | 
	
	
		
			
				|  | @@ -1047,9 +1266,33 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      };
 | 
	
		
			
				|  |  |                      datas.push(data2);
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  | +                if (isStageSelf) {
 | 
	
		
			
				|  |  | +                    const ms_id = isStageSelf ? parseInt($('#myTab').find('.active').data('msid')) : null;
 | 
	
		
			
				|  |  | +                    // 取所有的gclGatherData才行,然后获取下的值
 | 
	
		
			
				|  |  | +                    const gclData = gclGatherData[index];
 | 
	
		
			
				|  |  | +                    for (const [index, ms] of materialStageData.entries()) {
 | 
	
		
			
				|  |  | +                        if (ms.id !== ms_id) {
 | 
	
		
			
				|  |  | +                            const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
 | 
	
		
			
				|  |  | +                            console.log(gclOther);
 | 
	
		
			
				|  |  | +                            if (gclOther) {
 | 
	
		
			
				|  |  | +                                const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
 | 
	
		
			
				|  |  | +                                for (const xmj of leafXmjs) {
 | 
	
		
			
				|  |  | +                                    const data = {
 | 
	
		
			
				|  |  | +                                        xmj_id: xmj.id,
 | 
	
		
			
				|  |  | +                                        gcl_id: xmj.gcl_id,
 | 
	
		
			
				|  |  | +                                        mx_id: xmj.mx_id ? xmj.mx_id : '',
 | 
	
		
			
				|  |  | +                                    };
 | 
	
		
			
				|  |  | +                                    if (_.indexOf(datas, data) === -1) {
 | 
	
		
			
				|  |  | +                                        datas.push(data);
 | 
	
		
			
				|  |  | +                                    }
 | 
	
		
			
				|  |  | +                                }
 | 
	
		
			
				|  |  | +                            }
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  |                  console.log(data, datas);
 | 
	
		
			
				|  |  |                  // 更新至服务器
 | 
	
		
			
				|  |  | -                postData(window.location.pathname + '/save', { type:'pastes', updateData: { xmjs: datas, pasteData: data } }, function (result) {
 | 
	
		
			
				|  |  | +                postData(window.location.pathname + '/save', { type:'pastes', updateData: { xmjs: datas, pasteData: data }, ms_id: $('#myTab').find('.active').data('msid') || null }, function (result) {
 | 
	
		
			
				|  |  |                      materialListData = result.materialListData;
 | 
	
		
			
				|  |  |                      gclList = result.gclList;
 | 
	
		
			
				|  |  |                      calculateJiaCha(gclGatherData);
 | 
	
	
		
			
				|  | @@ -1211,7 +1454,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                  const sheet = materialSelfSpread.getActiveSheet();
 | 
	
		
			
				|  |  |                  const select = SpreadJsObj.getSelectObject(sheet);
 | 
	
		
			
				|  |  |                  console.log(select);
 | 
	
		
			
				|  |  | -                postData(window.location.pathname + '/save', {type: 'del', id: select.id, mb_id: select.mb_id}, function (result) {
 | 
	
		
			
				|  |  | +                postData(window.location.pathname + '/save', {type: 'del', id: select.id, mb_id: select.mb_id, ms_id: $('#myTab').find('.active').data('msid') || null}, function (result) {
 | 
	
		
			
				|  |  |                      const index = materialListSelf.indexOf(select);
 | 
	
		
			
				|  |  |                      materialListSelf.splice(index, 1);
 | 
	
		
			
				|  |  |                      sheet.deleteRows(index, 1);
 | 
	
	
		
			
				|  | @@ -1286,7 +1529,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                      // 更新至服务器
 | 
	
		
			
				|  |  |                      console.log(exprQuantity, select.mb_id);
 | 
	
		
			
				|  |  | -                    postData(window.location.pathname + '/save', { type:'update', updateData: { id: select.id, expr: exprQuantity.expr, quantity: exprQuantity.quantity, mb_id: select.mb_id } }, function (result) {
 | 
	
		
			
				|  |  | +                    postData(window.location.pathname + '/save', { type:'update', updateData: { id: select.id, expr: exprQuantity.expr, quantity: exprQuantity.quantity, mb_id: select.mb_id }, ms_id: $('#myTab').find('.active').data('msid') || null }, function (result) {
 | 
	
		
			
				|  |  |                          const materialListIndex = materialListData.indexOf(select);
 | 
	
		
			
				|  |  |                          const index = materialList.indexOf(select);
 | 
	
		
			
				|  |  |                          select.quantity = exprQuantity.quantity;
 | 
	
	
		
			
				|  | @@ -1387,7 +1630,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |                      return;
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  console.log(data);
 | 
	
		
			
				|  |  | -                postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
 | 
	
		
			
				|  |  | +                postData(window.location.pathname + '/save', { type:'paste', updateData: data, ms_id: $('#myTab').find('.active').data('msid') || null }, function (result) {
 | 
	
		
			
				|  |  |                      materialListData = result;
 | 
	
		
			
				|  |  |                      const [iGclRow, iRow, nRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
	
		
			
				|  |  |                      gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
	
	
		
			
				|  | @@ -1677,10 +1920,12 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |      $.divResizer({
 | 
	
		
			
				|  |  |          select: '#main-resize',
 | 
	
		
			
				|  |  |          callback: function () {
 | 
	
		
			
				|  |  | -            materialSpread.refresh();
 | 
	
		
			
				|  |  | -            ledgerSpread.refresh();
 | 
	
		
			
				|  |  |              let bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
 | 
	
		
			
				|  |  | +            const cutHeight = isStageSelf ? getObjHeight($('#myTab')) : 0;
 | 
	
		
			
				|  |  | +            $('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight);
 | 
	
		
			
				|  |  |              $(".sp-wrap").height(bcontent-30);
 | 
	
		
			
				|  |  | +            materialSpread.refresh();
 | 
	
		
			
				|  |  | +            ledgerSpread.refresh();
 | 
	
		
			
				|  |  |              leafXmjSpread.refresh();
 | 
	
		
			
				|  |  |              materialSelfSpread.refresh();
 | 
	
		
			
				|  |  |              const height = $('.bcontent-wrap').height();
 | 
	
	
		
			
				|  | @@ -1725,16 +1970,21 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          // leafXmjSpread.refresh();
 | 
	
		
			
				|  |  |          materialSpread.refresh();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    const cutHeight = isStageSelf ? getObjHeight($('#myTab')) : 0;
 | 
	
		
			
				|  |  |      if (getLocalCache('material_list2_' + materialID)) {
 | 
	
		
			
				|  |  |          $('.bcontent-wrap').height(getLocalCache('material_list2_' + materialID));
 | 
	
		
			
				|  |  |          const cHeader = getObjHeight($(".c-header"));
 | 
	
		
			
				|  |  |          const bcontent = $(".bcontent-wrap") ? $(".bcontent-wrap").height() : 0;
 | 
	
		
			
				|  |  |          $(".sp-wrap").height(bcontent-30);
 | 
	
		
			
				|  |  |          $('.sjs-height-1').height($(window).height()-cHeader-bcontent-90+53);
 | 
	
		
			
				|  |  | +        $('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight);
 | 
	
		
			
				|  |  |          materialSpread.refresh();
 | 
	
		
			
				|  |  |          ledgerSpread.refresh();
 | 
	
		
			
				|  |  |          leafXmjSpread.refresh();
 | 
	
		
			
				|  |  |          materialSelfSpread.refresh();
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +        $('.sjs-height-material').height($('.sjs-height-1').height() - cutHeight);
 | 
	
		
			
				|  |  | +        ledgerSpread.refresh();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      function getObjHeight(select) {
 | 
	
		
			
				|  |  |          return select.length > 0 ? select.height() : 0;
 |