|  | @@ -140,7 +140,7 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          gclGatherData = gclGatherModel.gatherGclData();
 | 
	
		
			
				|  |  |          console.log(gclGatherData);
 | 
	
		
			
				|  |  |          const hadBillsidList = _.uniq(_.map(gclList, 'gcl_id'));
 | 
	
		
			
				|  |  | -        console.log(hadBillsidList);
 | 
	
		
			
				|  |  | +        console.log(hadBillsidList, materialChecklistData);
 | 
	
		
			
				|  |  |          // 对比清单设置和调差清单,还要和台账对比,显示已选清单列表 不同则更新到清单设置页中
 | 
	
		
			
				|  |  |          const pushData = [];
 | 
	
		
			
				|  |  |          const updateData = [];
 | 
	
	
		
			
				|  | @@ -160,20 +160,24 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          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 });
 | 
	
		
			
				|  |  | +            console.log(gcl);
 | 
	
		
			
				|  |  |              // 判断是否已不存在工料清单,台账修改过后删除之
 | 
	
		
			
				|  |  |              if (!gcl) {
 | 
	
		
			
				|  |  |                  removeData.push(mc.id);
 | 
	
		
			
				|  |  |              } else {
 | 
	
		
			
				|  |  | +                const gcl_ids = gcl.leafXmjs ? _.uniq(_.map(gcl.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | +                const jiaoji = _.intersection(gcl_ids, hadBillsidList);
 | 
	
		
			
				|  |  | +                // const leafXmjs = gcl.leafXmjs ? gcl.leafXmjs.filter(item => item.gather_qty) : [];
 | 
	
		
			
				|  |  |                  // 更新had_bills值
 | 
	
		
			
				|  |  |                  const updateObj = { id: mc.id };
 | 
	
		
			
				|  |  |                  if (mc.had_bills === 1) {
 | 
	
		
			
				|  |  | -                    if (_.indexOf(hadBillsidList, gcl.leafXmjs ? gcl.leafXmjs[0].gcl_id : null) === -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 (_.indexOf(hadBillsidList, gcl.leafXmjs ? gcl.leafXmjs[0].gcl_id: null) !== -1) {
 | 
	
		
			
				|  |  | +                    if (jiaoji.length !== 0) {
 | 
	
		
			
				|  |  |                          updateObj.had_bills = 1;
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -259,10 +263,11 @@ $(document).ready(() => {
 | 
	
		
			
				|  |  |          //     return item.qc_qty || item.contract_qty
 | 
	
		
			
				|  |  |          // }) : null;
 | 
	
		
			
				|  |  |          if (gcl && gcl.leafXmjs) {
 | 
	
		
			
				|  |  | -            const xmj2 = gcl.leafXmjs[iLXmjRow];
 | 
	
		
			
				|  |  | +            const gcl_ids = gcl.leafXmjs ? _.uniq(_.map(gcl.leafXmjs, 'gcl_id')) : [];
 | 
	
		
			
				|  |  | +            // const xmj2 = gcl.leafXmjs[iLXmjRow];
 | 
	
		
			
				|  |  |              materialList = [];
 | 
	
		
			
				|  |  |              const newMaterialList = _.uniqBy(_.filter(gclList, function (m) {
 | 
	
		
			
				|  |  | -                return xmj2 && m.gcl_id === xmj2.gcl_id;
 | 
	
		
			
				|  |  | +                return _.indexOf(gcl_ids, m.gcl_id) !== -1;
 | 
	
		
			
				|  |  |              }), 'mb_id');
 | 
	
		
			
				|  |  |              for(const m of newMaterialList) {
 | 
	
		
			
				|  |  |                  const bills = _.find(materialBillsData, { id: m.mb_id });
 |