|  | @@ -156,6 +156,7 @@ $(document).ready(() => {
 | 
												
													
														
															|  |          return item.qc_qty || item.contract_qty
 |  |          return item.qc_qty || item.contract_qty
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  |      calculateJiaCha(gclGatherData);
 |  |      calculateJiaCha(gclGatherData);
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |      // let gclGatherData = gclGatherModel.gatherGclData()
 |  |      // let gclGatherData = gclGatherModel.gatherGclData()
 | 
												
													
														
															|  |      // 获取项目节数据
 |  |      // 获取项目节数据
 | 
												
													
														
															|  |      function loadLeafXmjData(iGclRow) {
 |  |      function loadLeafXmjData(iGclRow) {
 | 
												
											
												
													
														
															|  | @@ -225,10 +226,10 @@ $(document).ready(() => {
 | 
												
													
														
															|  |      const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
 |  |      const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
 | 
												
													
														
															|  |      const materialSpreadSetting = {
 |  |      const materialSpreadSetting = {
 | 
												
													
														
															|  |          cols: [
 |  |          cols: [
 | 
												
													
														
															|  | -            {title: '清单调差工料|编号', colSpan: '4|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
 |  | 
 | 
												
													
														
															|  | 
 |  | +            {title: '清单工料含量|编号', colSpan: '4|1', rowSpan: '1|1', field: 'code', hAlign: 0, width: 80, formatter: '@', readOnly: true},
 | 
												
													
														
															|  |              {title: '|名称', colSpan: '|1', rowSpan: '|1', field: 'name', hAlign: 0, width: 100, formatter: '@', readOnly: true},
 |  |              {title: '|名称', colSpan: '|1', rowSpan: '|1', field: 'name', hAlign: 0, width: 100, formatter: '@', readOnly: true},
 | 
												
													
														
															|  |              {title: '|单位', colSpan: '|1', rowSpan: '|1', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true},
 |  |              {title: '|单位', colSpan: '|1', rowSpan: '|1', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: true},
 | 
												
													
														
															|  | -            {title: '|数量 �', colSpan: '1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 80, type: 'Number', readOnly: 'readOnly.isEdit'},
 |  | 
 | 
												
													
														
															|  | 
 |  | +            {title: '|数量 �', colSpan: '1', rowSpan: '|1', field: 'quantity', hAlign: 2, width: 120, type: 'Number', readOnly: 'readOnly.isEdit'},
 | 
												
													
														
															|  |          ],
 |  |          ],
 | 
												
													
														
															|  |          emptyRows: 0,
 |  |          emptyRows: 0,
 | 
												
													
														
															|  |          headRows: 2,
 |  |          headRows: 2,
 | 
												
											
												
													
														
															|  | @@ -248,10 +249,11 @@ $(document).ready(() => {
 | 
												
													
														
															|  |      const materialCol = {
 |  |      const materialCol = {
 | 
												
													
														
															|  |          readOnly: {
 |  |          readOnly: {
 | 
												
													
														
															|  |              isEdit: function (data) {
 |  |              isEdit: function (data) {
 | 
												
													
														
															|  | -                const sheet = leafXmjSpread.getActiveSheet();
 |  | 
 | 
												
													
														
															|  | -                const select = SpreadJsObj.getSelectObject(sheet);
 |  | 
 | 
												
													
														
															|  | -                const notx = findNotJoinLeafXmj(select);
 |  | 
 | 
												
													
														
															|  | -                return !(!readOnly && notx === undefined && materialBase.isEdit(data));
 |  | 
 | 
												
													
														
															|  | 
 |  | +                // const sheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                // const select = SpreadJsObj.getSelectObject(sheet);
 | 
												
													
														
															|  | 
 |  | +                // const notx = findNotJoinLeafXmj(select);
 | 
												
													
														
															|  | 
 |  | +                // return !(!readOnly && notx === undefined && materialBase.isEdit(data));
 | 
												
													
														
															|  | 
 |  | +                return !(!readOnly && materialBase.isEdit(data));
 | 
												
													
														
															|  |              },
 |  |              },
 | 
												
													
														
															|  |          },
 |  |          },
 | 
												
													
														
															|  |      };
 |  |      };
 | 
												
											
												
													
														
															|  | @@ -335,22 +337,50 @@ $(document).ready(() => {
 | 
												
													
														
															|  |          const leafXmjSheet = leafXmjSpread.getActiveSheet();
 |  |          const leafXmjSheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  |          const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
 |  |          const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
 | 
												
													
														
															|  |          const gcl = gclGatherData[index].leafXmjs;
 |  |          const gcl = gclGatherData[index].leafXmjs;
 | 
												
													
														
															|  | -        const leafXmjIndex = gcl.indexOf(leafXmjSelect);
 |  | 
 | 
												
													
														
															|  | -        const xmj = gcl[leafXmjIndex];
 |  | 
 | 
												
													
														
															|  | -        const data = {
 |  | 
 | 
												
													
														
															|  | -            xmj_id: xmj.id,
 |  | 
 | 
												
													
														
															|  | -            gcl_id: xmj.gcl_id,
 |  | 
 | 
												
													
														
															|  | -            mx_id: xmj.mx_id !== undefined ? xmj.mx_id : '',
 |  | 
 | 
												
													
														
															|  | -            mb_id: mb_id,
 |  | 
 | 
												
													
														
															|  | -            gather_qty: xmj.gather_qty,
 |  | 
 | 
												
													
														
															|  | -        };
 |  | 
 | 
												
													
														
															|  | 
 |  | +        // const leafXmjIndex = gcl.indexOf(leafXmjSelect);
 | 
												
													
														
															|  | 
 |  | +        // const xmj = gcl[leafXmjIndex];
 | 
												
													
														
															|  | 
 |  | +        // const data = {
 | 
												
													
														
															|  | 
 |  | +        //     xmj_id: xmj.id,
 | 
												
													
														
															|  | 
 |  | +        //     gcl_id: xmj.gcl_id,
 | 
												
													
														
															|  | 
 |  | +        //     mx_id: xmj.mx_id !== undefined ? xmj.mx_id : '',
 | 
												
													
														
															|  | 
 |  | +        //     mb_id: mb_id,
 | 
												
													
														
															|  | 
 |  | +        //     gather_qty: xmj.gather_qty,
 | 
												
													
														
															|  | 
 |  | +        // };
 | 
												
													
														
															|  | 
 |  | +        const datas = [];
 | 
												
													
														
															|  | 
 |  | +        for (const xmj of gcl) {
 | 
												
													
														
															|  | 
 |  | +            const notx = findNotJoinLeafXmj(xmj);
 | 
												
													
														
															|  | 
 |  | +            const data = {
 | 
												
													
														
															|  | 
 |  | +                xmj_id: xmj.id,
 | 
												
													
														
															|  | 
 |  | +                gcl_id: xmj.gcl_id,
 | 
												
													
														
															|  | 
 |  | +                mx_id: xmj.mx_id !== undefined ? xmj.mx_id : '',
 | 
												
													
														
															|  | 
 |  | +                gather_qty: xmj.gather_qty,
 | 
												
													
														
															|  | 
 |  | +                is_join: notx === undefined ? 1 : 0,
 | 
												
													
														
															|  | 
 |  | +            };
 | 
												
													
														
															|  | 
 |  | +            datas.push(data);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |          // 上传到数据库
 |  |          // 上传到数据库
 | 
												
													
														
															|  | -        postData(window.location.pathname + '/save', {type: 'add', postData: data}, function (result) {
 |  | 
 | 
												
													
														
															|  | -            // 添加到materialList里
 |  | 
 | 
												
													
														
															|  | 
 |  | +        console.log(datas, gcl);
 | 
												
													
														
															|  | 
 |  | +        postData(window.location.pathname + '/save', {type: 'adds', postData: {xmjs: datas, mbIds: mb_id}}, function (result) {
 | 
												
													
														
															|  |              materialListData = result;
 |  |              materialListData = result;
 | 
												
													
														
															|  | -            loadMaterialData(index, leafXmjIndex);
 |  | 
 | 
												
													
														
															|  | 
 |  | +            // toastr.success('已成功应用');
 | 
												
													
														
															|  | 
 |  | +            calculateJiaCha(gclGatherData);
 | 
												
													
														
															|  | 
 |  | +            // const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +            loadLeafXmjData(index);
 | 
												
													
														
															|  | 
 |  | +            const xmjSheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +            const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 | 
												
													
														
															|  | 
 |  | +            const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 | 
												
													
														
															|  | 
 |  | +            loadMaterialData(index, xmjIndex);
 | 
												
													
														
															|  | 
 |  | +            SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 | 
												
													
														
															|  |              $('#addgl').modal('hide');
 |  |              $('#addgl').modal('hide');
 | 
												
													
														
															|  |          });
 |  |          });
 | 
												
													
														
															|  | 
 |  | +        // postData(window.location.pathname + '/save', {type: 'add', postData: data}, function (result) {
 | 
												
													
														
															|  | 
 |  | +            // // 添加到materialList里
 | 
												
													
														
															|  | 
 |  | +            // materialListData = result;
 | 
												
													
														
															|  | 
 |  | +            // loadMaterialData(index, leafXmjIndex);
 | 
												
													
														
															|  | 
 |  | +            // $('#addgl').modal('hide');
 | 
												
													
														
															|  | 
 |  | +        // });
 | 
												
													
														
															|  |          $('#materialBills').find('input:disabled').prop('checked', true);
 |  |          $('#materialBills').find('input:disabled').prop('checked', true);
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  |      if (!readOnly) {
 |  |      if (!readOnly) {
 | 
												
											
												
													
														
															|  | @@ -444,23 +474,48 @@ $(document).ready(() => {
 | 
												
													
														
															|  |          // material-spread右键功能
 |  |          // material-spread右键功能
 | 
												
													
														
															|  |          const materialSpreadObj = {
 |  |          const materialSpreadObj = {
 | 
												
													
														
															|  |              del: function () {
 |  |              del: function () {
 | 
												
													
														
															|  | -                const sheet = materialSpread.getActiveSheet();
 |  | 
 | 
												
													
														
															|  | 
 |  | +                const materialSheet = materialSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                const materialSelect = SpreadJsObj.getSelectObject(materialSheet);
 | 
												
													
														
															|  | 
 |  | +                const sheet = ledgerSpread.getActiveSheet();
 | 
												
													
														
															|  |                  const select = SpreadJsObj.getSelectObject(sheet);
 |  |                  const select = SpreadJsObj.getSelectObject(sheet);
 | 
												
													
														
															|  | -                postData(window.location.pathname + '/save', {type: 'del', id: select.id, mb_id: select.mb_id}, function (result) {
 |  | 
 | 
												
													
														
															|  | -                    const index = materialList.indexOf(select);
 |  | 
 | 
												
													
														
															|  | -                    materialList.splice(index, 1);
 |  | 
 | 
												
													
														
															|  | -                    sheet.deleteRows(index, 1);
 |  | 
 | 
												
													
														
															|  | -                    SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
 |  | 
 | 
												
													
														
															|  | -                    const sel = sheet.getSelections();
 |  | 
 | 
												
													
														
															|  | -                    sheet.setSelection(index > 0 ? index - 1 : 0, sel.length > 0 ? sel[0].col : 0, 1, 1);
 |  | 
 | 
												
													
														
															|  | -                    const materialListIndex = materialListData.indexOf(select);
 |  | 
 | 
												
													
														
															|  | -                    materialListData.splice(materialListIndex, 1);
 |  | 
 | 
												
													
														
															|  | -                    const [iGclRow, iRow, lsheet, lselect] = leafXmjSpreadObj.getSelect();
 |  | 
 | 
												
													
														
															|  | -                    gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 |  | 
 | 
												
													
														
															|  | -                    calculateJiaCha(gclGatherData, iGclRow)
 |  | 
 | 
												
													
														
															|  | -                    SpreadJsObj.reLoadRowData(lsheet, iRow);
 |  | 
 | 
												
													
														
															|  | -                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                const index = gclGatherData.indexOf(select);
 | 
												
													
														
															|  | 
 |  | +                const gcl = gclGatherData[index].leafXmjs;
 | 
												
													
														
															|  | 
 |  | +                const datas = [];
 | 
												
													
														
															|  | 
 |  | +                for (const xmj of gcl) {
 | 
												
													
														
															|  | 
 |  | +                    const data = {
 | 
												
													
														
															|  | 
 |  | +                        xmj_id: xmj.id,
 | 
												
													
														
															|  | 
 |  | +                        gcl_id: xmj.gcl_id,
 | 
												
													
														
															|  | 
 |  | +                        mx_id: xmj.mx_id !== undefined ? xmj.mx_id : '',
 | 
												
													
														
															|  | 
 |  | +                    };
 | 
												
													
														
															|  | 
 |  | +                    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) {
 | 
												
													
														
															|  | 
 |  | +                    materialListData = result;
 | 
												
													
														
															|  | 
 |  | +                    calculateJiaCha(gclGatherData);
 | 
												
													
														
															|  | 
 |  | +                    // const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +                    loadLeafXmjData(index);
 | 
												
													
														
															|  | 
 |  | +                    const xmjSheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                    const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 | 
												
													
														
															|  | 
 |  | +                    const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 | 
												
													
														
															|  | 
 |  | +                    loadMaterialData(index, xmjIndex);
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  | 
 |  | +                // postData(window.location.pathname + '/save', {type: 'del', id: select.id, mb_id: select.mb_id}, function (result) {
 | 
												
													
														
															|  | 
 |  | +                    // const index = materialList.indexOf(select);
 | 
												
													
														
															|  | 
 |  | +                    // materialList.splice(index, 1);
 | 
												
													
														
															|  | 
 |  | +                    // sheet.deleteRows(index, 1);
 | 
												
													
														
															|  | 
 |  | +                    // SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
 | 
												
													
														
															|  | 
 |  | +                    // const sel = sheet.getSelections();
 | 
												
													
														
															|  | 
 |  | +                    // sheet.setSelection(index > 0 ? index - 1 : 0, sel.length > 0 ? sel[0].col : 0, 1, 1);
 | 
												
													
														
															|  | 
 |  | +                    // const materialListIndex = materialListData.indexOf(select);
 | 
												
													
														
															|  | 
 |  | +                    // materialListData.splice(materialListIndex, 1);
 | 
												
													
														
															|  | 
 |  | +                    // const [iGclRow, iRow, lsheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
												
													
														
															|  | 
 |  | +                    // gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
												
													
														
															|  | 
 |  | +                    // calculateJiaCha(gclGatherData, iGclRow);
 | 
												
													
														
															|  | 
 |  | +                    // SpreadJsObj.reLoadRowData(lsheet, iRow);
 | 
												
													
														
															|  | 
 |  | +                    // SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
												
													
														
															|  | 
 |  | +                // });
 | 
												
													
														
															|  |              },
 |  |              },
 | 
												
													
														
															|  |              deletePress: function (sheet) {
 |  |              deletePress: function (sheet) {
 | 
												
													
														
															|  |                  return;
 |  |                  return;
 | 
												
											
												
													
														
															|  | @@ -491,21 +546,48 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                          }
 |  |                          }
 | 
												
													
														
															|  |                      }
 |  |                      }
 | 
												
													
														
															|  |                      // 更新至服务器
 |  |                      // 更新至服务器
 | 
												
													
														
															|  | -                    postData(window.location.pathname + '/save', { type:'update', updateData: { id:select.id, quantity: validText, mb_id: select.mb_id } }, function (result) {
 |  | 
 | 
												
													
														
															|  | -                        const materialListIndex = materialListData.indexOf(select);
 |  | 
 | 
												
													
														
															|  | -                        const index = materialList.indexOf(select);
 |  | 
 | 
												
													
														
															|  | -                        select[col.field] = validText;
 |  | 
 | 
												
													
														
															|  | -                        materialListData.splice(materialListIndex, 1, select);
 |  | 
 | 
												
													
														
															|  | -                        materialList.indexOf(index, 1, select);
 |  | 
 | 
												
													
														
															|  | -                        SpreadJsObj.reLoadRowData(info.sheet, info.row);
 |  | 
 | 
												
													
														
															|  | -                        const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 |  | 
 | 
												
													
														
															|  | -                        gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 |  | 
 | 
												
													
														
															|  | -                        calculateJiaCha(gclGatherData, iGclRow)
 |  | 
 | 
												
													
														
															|  | -                        SpreadJsObj.reLoadRowData(sheet, iRow);
 |  | 
 | 
												
													
														
															|  | -                        SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    const ledgerSheet = ledgerSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                    const ledgerSelect = SpreadJsObj.getSelectObject(ledgerSheet);
 | 
												
													
														
															|  | 
 |  | +                    const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +                    const gcl = gclGatherData[index].leafXmjs;
 | 
												
													
														
															|  | 
 |  | +                    const datas = [];
 | 
												
													
														
															|  | 
 |  | +                    for (const xmj of gcl) {
 | 
												
													
														
															|  | 
 |  | +                        const data = {
 | 
												
													
														
															|  | 
 |  | +                            xmj_id: xmj.id,
 | 
												
													
														
															|  | 
 |  | +                            gcl_id: xmj.gcl_id,
 | 
												
													
														
															|  | 
 |  | +                            mx_id: xmj.mx_id !== undefined ? xmj.mx_id : '',
 | 
												
													
														
															|  | 
 |  | +                        };
 | 
												
													
														
															|  | 
 |  | +                        datas.push(data);
 | 
												
													
														
															|  | 
 |  | +                    }
 | 
												
													
														
															|  | 
 |  | +                    console.log(validText, datas, select.mb_id);
 | 
												
													
														
															|  | 
 |  | +                    postData(window.location.pathname + '/save', { type:'updates', updateData: { xmjs: datas, quantity: validText, mb_id: select.mb_id } }, function (result) {
 | 
												
													
														
															|  | 
 |  | +                        materialListData = result;
 | 
												
													
														
															|  | 
 |  | +                        calculateJiaCha(gclGatherData);
 | 
												
													
														
															|  | 
 |  | +                        // const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +                        loadLeafXmjData(index);
 | 
												
													
														
															|  | 
 |  | +                        const xmjSheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                        const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 | 
												
													
														
															|  | 
 |  | +                        const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 | 
												
													
														
															|  | 
 |  | +                        loadMaterialData(index, xmjIndex);
 | 
												
													
														
															|  | 
 |  | +                        SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 | 
												
													
														
															|  |                      }, function () {
 |  |                      }, function () {
 | 
												
													
														
															|  |                          SpreadJsObj.reLoadRowData(info.sheet, info.row);
 |  |                          SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
												
													
														
															|  |                      });
 |  |                      });
 | 
												
													
														
															|  | 
 |  | +                    // postData(window.location.pathname + '/save', { type:'update', updateData: { id:select.id, quantity: validText, mb_id: select.mb_id } }, function (result) {
 | 
												
													
														
															|  | 
 |  | +                    //     const materialListIndex = materialListData.indexOf(select);
 | 
												
													
														
															|  | 
 |  | +                    //     const index = materialList.indexOf(select);
 | 
												
													
														
															|  | 
 |  | +                    //     select[col.field] = validText;
 | 
												
													
														
															|  | 
 |  | +                    //     materialListData.splice(materialListIndex, 1, select);
 | 
												
													
														
															|  | 
 |  | +                    //     materialList.indexOf(index, 1, select);
 | 
												
													
														
															|  | 
 |  | +                    //     SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
												
													
														
															|  | 
 |  | +                    //     const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
												
													
														
															|  | 
 |  | +                    //     gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
												
													
														
															|  | 
 |  | +                    //     calculateJiaCha(gclGatherData, iGclRow)
 | 
												
													
														
															|  | 
 |  | +                    //     SpreadJsObj.reLoadRowData(sheet, iRow);
 | 
												
													
														
															|  | 
 |  | +                    //     SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
												
													
														
															|  | 
 |  | +                    // }, function () {
 | 
												
													
														
															|  | 
 |  | +                    //     SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
												
													
														
															|  | 
 |  | +                    // });
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  |              },
 |  |              },
 | 
												
													
														
															|  |              clipboardPasted(e, info) {
 |  |              clipboardPasted(e, info) {
 | 
												
											
												
													
														
															|  | @@ -576,17 +658,44 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                      SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 |  |                      SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 | 
												
													
														
															|  |                      return;
 |  |                      return;
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  | 
 |  | +                const ledgerSheet = ledgerSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                const ledgerSelect = SpreadJsObj.getSelectObject(ledgerSheet);
 | 
												
													
														
															|  | 
 |  | +                const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +                const gcl = gclGatherData[index].leafXmjs;
 | 
												
													
														
															|  | 
 |  | +                const datas = [];
 | 
												
													
														
															|  | 
 |  | +                for (const xmj of gcl) {
 | 
												
													
														
															|  | 
 |  | +                    const data2 = {
 | 
												
													
														
															|  | 
 |  | +                        xmj_id: xmj.id,
 | 
												
													
														
															|  | 
 |  | +                        gcl_id: xmj.gcl_id,
 | 
												
													
														
															|  | 
 |  | +                        mx_id: xmj.mx_id !== undefined ? xmj.mx_id : '',
 | 
												
													
														
															|  | 
 |  | +                    };
 | 
												
													
														
															|  | 
 |  | +                    datas.push(data2);
 | 
												
													
														
															|  | 
 |  | +                }
 | 
												
													
														
															|  | 
 |  | +                console.log(data, datas);
 | 
												
													
														
															|  |                  // 更新至服务器
 |  |                  // 更新至服务器
 | 
												
													
														
															|  | -                postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
 |  | 
 | 
												
													
														
															|  | 
 |  | +                postData(window.location.pathname + '/save', { type:'pastes', updateData: { xmjs: datas, pasteData: data } }, function (result) {
 | 
												
													
														
															|  |                      materialListData = result;
 |  |                      materialListData = result;
 | 
												
													
														
															|  | -                    const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 |  | 
 | 
												
													
														
															|  | -                    gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 |  | 
 | 
												
													
														
															|  | -                    calculateJiaCha(gclGatherData, iGclRow)
 |  | 
 | 
												
													
														
															|  | -                    SpreadJsObj.reLoadRowData(sheet, iRow);
 |  | 
 | 
												
													
														
															|  | -                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    calculateJiaCha(gclGatherData);
 | 
												
													
														
															|  | 
 |  | +                    // const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +                    loadLeafXmjData(index);
 | 
												
													
														
															|  | 
 |  | +                    const xmjSheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +                    const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 | 
												
													
														
															|  | 
 |  | +                    const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 | 
												
													
														
															|  | 
 |  | +                    loadMaterialData(index, xmjIndex);
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 | 
												
													
														
															|  |                  }, function () {
 |  |                  }, function () {
 | 
												
													
														
															|  | -                    SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                    SpreadJsObj.reLoadRowData(info.sheet, info.row);
 | 
												
													
														
															|  |                  });
 |  |                  });
 | 
												
													
														
															|  | 
 |  | +                // postData(window.location.pathname + '/save', { type:'paste', updateData: data }, function (result) {
 | 
												
													
														
															|  | 
 |  | +                //     materialListData = result;
 | 
												
													
														
															|  | 
 |  | +                //     const [iGclRow, iRow, sheet, lselect] = leafXmjSpreadObj.getSelect();
 | 
												
													
														
															|  | 
 |  | +                //     gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
 | 
												
													
														
															|  | 
 |  | +                //     calculateJiaCha(gclGatherData, iGclRow);
 | 
												
													
														
															|  | 
 |  | +                //     SpreadJsObj.reLoadRowData(sheet, iRow);
 | 
												
													
														
															|  | 
 |  | +                //     SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
 | 
												
													
														
															|  | 
 |  | +                // }, function () {
 | 
												
													
														
															|  | 
 |  | +                //     SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
 | 
												
													
														
															|  | 
 |  | +                // });
 | 
												
													
														
															|  |              },
 |  |              },
 | 
												
													
														
															|  |          };
 |  |          };
 | 
												
													
														
															|  |          materialSpread.bind(spreadNS.Events.EditEnded, materialSpreadObj.editEnded);
 |  |          materialSpread.bind(spreadNS.Events.EditEnded, materialSpreadObj.editEnded);
 | 
												
											
												
													
														
															|  | @@ -614,19 +723,20 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                  toastr.warning('没有需要应用调差工料的其它清单明细');
 |  |                  toastr.warning('没有需要应用调差工料的其它清单明细');
 | 
												
													
														
															|  |                  return false;
 |  |                  return false;
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  | 
 |  | +            console.log(needAddList, materialList);
 | 
												
													
														
															|  |              // 更新至服务器
 |  |              // 更新至服务器
 | 
												
													
														
															|  | -            postData(window.location.pathname + '/save', { type:'useOther', postData: { addXmj: needAddList, materialBills: materialList } }, function (result) {
 |  | 
 | 
												
													
														
															|  | -                materialListData = result;
 |  | 
 | 
												
													
														
															|  | -                toastr.success('已成功应用');
 |  | 
 | 
												
													
														
															|  | -                calculateJiaCha(gclGatherData);
 |  | 
 | 
												
													
														
															|  | -                const index = gclGatherData.indexOf(ledgerSelect);
 |  | 
 | 
												
													
														
															|  | -                loadLeafXmjData(index);
 |  | 
 | 
												
													
														
															|  | -                const xmjSheet = leafXmjSpread.getActiveSheet();
 |  | 
 | 
												
													
														
															|  | -                const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 |  | 
 | 
												
													
														
															|  | -                const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 |  | 
 | 
												
													
														
															|  | -                loadMaterialData(index, xmjIndex);
 |  | 
 | 
												
													
														
															|  | -                SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 |  | 
 | 
												
													
														
															|  | -            });
 |  | 
 | 
												
													
														
															|  | 
 |  | +            // postData(window.location.pathname + '/save', { type:'useOther', postData: { addXmj: needAddList, materialBills: materialList } }, function (result) {
 | 
												
													
														
															|  | 
 |  | +            //     materialListData = result;
 | 
												
													
														
															|  | 
 |  | +            //     toastr.success('已成功应用');
 | 
												
													
														
															|  | 
 |  | +            //     calculateJiaCha(gclGatherData);
 | 
												
													
														
															|  | 
 |  | +            //     const index = gclGatherData.indexOf(ledgerSelect);
 | 
												
													
														
															|  | 
 |  | +            //     loadLeafXmjData(index);
 | 
												
													
														
															|  | 
 |  | +            //     const xmjSheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  | 
 |  | +            //     const xmjSelect = SpreadJsObj.getSelectObject(xmjSheet);
 | 
												
													
														
															|  | 
 |  | +            //     const xmjIndex = gclGatherData[index].leafXmjs.indexOf(xmjSelect);
 | 
												
													
														
															|  | 
 |  | +            //     loadMaterialData(index, xmjIndex);
 | 
												
													
														
															|  | 
 |  | +            //     SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), index);
 | 
												
													
														
															|  | 
 |  | +            // });
 | 
												
													
														
															|  |          });
 |  |          });
 | 
												
													
														
															|  |          $.contextMenu({
 |  |          $.contextMenu({
 | 
												
													
														
															|  |              selector: '#material-spread',
 |  |              selector: '#material-spread',
 | 
												
											
												
													
														
															|  | @@ -646,15 +756,16 @@ $(document).ready(() => {
 | 
												
													
														
															|  |                      disabled: function (key, opt) {
 |  |                      disabled: function (key, opt) {
 | 
												
													
														
															|  |                          const sheet = leafXmjSpread.getActiveSheet();
 |  |                          const sheet = leafXmjSpread.getActiveSheet();
 | 
												
													
														
															|  |                          const select = SpreadJsObj.getSelectObject(sheet);
 |  |                          const select = SpreadJsObj.getSelectObject(sheet);
 | 
												
													
														
															|  | -                        const notx = findNotJoinLeafXmj(select);
 |  | 
 | 
												
													
														
															|  | 
 |  | +                        // const notx = findNotJoinLeafXmj(select);
 | 
												
													
														
															|  |                          if (!select) {
 |  |                          if (!select) {
 | 
												
													
														
															|  |                              return true;
 |  |                              return true;
 | 
												
													
														
															|  |                          }
 |  |                          }
 | 
												
													
														
															|  | -                        if (!readOnly && notx === undefined) {
 |  | 
 | 
												
													
														
															|  | -                            return false;
 |  | 
 | 
												
													
														
															|  | -                        } else {
 |  | 
 | 
												
													
														
															|  | -                            return true;
 |  | 
 | 
												
													
														
															|  | -                        }
 |  | 
 | 
												
													
														
															|  | 
 |  | +                        // if (!readOnly && notx === undefined) {
 | 
												
													
														
															|  | 
 |  | +                        //     return false;
 | 
												
													
														
															|  | 
 |  | +                        // } else {
 | 
												
													
														
															|  | 
 |  | +                        //     return true;
 | 
												
													
														
															|  | 
 |  | +                        // }
 | 
												
													
														
															|  | 
 |  | +                        return readOnly;
 | 
												
													
														
															|  |                      }
 |  |                      }
 | 
												
													
														
															|  |                  },
 |  |                  },
 | 
												
													
														
															|  |                  'delete': {
 |  |                  'delete': {
 | 
												
											
												
													
														
															|  | @@ -763,4 +874,53 @@ $(document).ready(() => {
 | 
												
													
														
															|  |              materialSpread.refresh();
 |  |              materialSpread.refresh();
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |      });
 |  |      });
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    $.divResizer({
 | 
												
													
														
															|  | 
 |  | +        select: '#right-spr',
 | 
												
													
														
															|  | 
 |  | +        callback: function () {
 | 
												
													
														
															|  | 
 |  | +            ledgerSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +            leafXmjSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +            materialSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +            const width = (($('#right-view').width()/$('#right-view').parent('div').width())*100).toFixed();
 | 
												
													
														
															|  | 
 |  | +            setLocalCache('material_list_' + materialID, width);
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +    });
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  | 
 |  | +    // 展开收起月信息价并浏览器记住本期展开收起
 | 
												
													
														
															|  | 
 |  | +    $('a', '.right-nav').bind('click', function () {
 | 
												
													
														
															|  | 
 |  | +        //const main = $('#main-view'), tool = $('#tools-view');
 | 
												
													
														
															|  | 
 |  | +        const tab = $(this), tabPanel = $(tab.attr('content'));
 | 
												
													
														
															|  | 
 |  | +        if (!tab.hasClass('active')) {
 | 
												
													
														
															|  | 
 |  | +            $('a', '.side-menu').removeClass('active');
 | 
												
													
														
															|  | 
 |  | +            $('.tab-content .tab-select-show').removeClass('active');
 | 
												
													
														
															|  | 
 |  | +            tab.addClass('active');
 | 
												
													
														
															|  | 
 |  | +            tabPanel.addClass('active');
 | 
												
													
														
															|  | 
 |  | +            showSideTools(tab.hasClass('active'));
 | 
												
													
														
															|  | 
 |  | +            if (tab.attr('content') === '#material-tab') {
 | 
												
													
														
															|  | 
 |  | +                const width = (($('#right-view').width()/$('#right-view').parent('div').width())*100).toFixed();
 | 
												
													
														
															|  | 
 |  | +                setLocalCache('material_list_' + materialID, width);
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +        } else {
 | 
												
													
														
															|  | 
 |  | +            removeLocalCache('material_list_' + materialID);
 | 
												
													
														
															|  | 
 |  | +            tab.removeClass('active');
 | 
												
													
														
															|  | 
 |  | +            tabPanel.removeClass('active');
 | 
												
													
														
															|  | 
 |  | +            showSideTools(tab.hasClass('active'));
 | 
												
													
														
															|  | 
 |  | +        }
 | 
												
													
														
															|  | 
 |  | +        ledgerSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +        leafXmjSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +        materialSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +    });
 | 
												
													
														
															|  | 
 |  | +    // 根据浏览器记录展开收起
 | 
												
													
														
															|  | 
 |  | +    if (getLocalCache('material_list_' + materialID)) {
 | 
												
													
														
															|  | 
 |  | +        const tab = $('.right-nav a[content="#material-tab"]'), tabPanel = $(tab.attr('content'));
 | 
												
													
														
															|  | 
 |  | +        $('a', '.side-menu').removeClass('active');
 | 
												
													
														
															|  | 
 |  | +        $('.tab-content .tab-select-show').removeClass('active');
 | 
												
													
														
															|  | 
 |  | +        tab.addClass('active');
 | 
												
													
														
															|  | 
 |  | +        tabPanel.addClass('active');
 | 
												
													
														
															|  | 
 |  | +        $('#right-view').width(getLocalCache('material_list_' + materialID) + '%');
 | 
												
													
														
															|  | 
 |  | +        showSideTools(tab.hasClass('active'));
 | 
												
													
														
															|  | 
 |  | +        ledgerSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +        leafXmjSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +        materialSpread.refresh();
 | 
												
													
														
															|  | 
 |  | +    }
 | 
												
													
														
															|  |  });
 |  |  });
 |