|
@@ -525,7 +525,7 @@ $(document).ready(() => {
|
|
|
// 是否本期添加的工料
|
|
|
// return data.order === stage_order && !openMaterialChecklist;
|
|
|
let flag = true;
|
|
|
- if (type === 'del') {
|
|
|
+ if (type === 'del' || !editListPermission) {
|
|
|
flag = data.order === stage_order;
|
|
|
}
|
|
|
return flag && !openMaterialChecklist;
|
|
@@ -599,7 +599,7 @@ $(document).ready(() => {
|
|
|
// 是否本期添加的工料
|
|
|
// return data.order === stage_order && !openMaterialChecklist;
|
|
|
let flag = true;
|
|
|
- if (type === 'del') {
|
|
|
+ if (type === 'del' || !editListPermission) {
|
|
|
flag = data.order === stage_order;
|
|
|
}
|
|
|
return flag;
|
|
@@ -613,7 +613,7 @@ $(document).ready(() => {
|
|
|
// const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
// const notx = findNotJoinLeafXmj(select);
|
|
|
// return !(!readOnly && notx === undefined && materialBase.isEdit(data));
|
|
|
- return !(!readOnly && materialSelfBase.isEdit(data));
|
|
|
+ return openMaterialSelf && !(!readOnly && materialSelfBase.isEdit(data));
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -804,171 +804,237 @@ $(document).ready(() => {
|
|
|
}
|
|
|
$('#materialBills').find('input:disabled').prop('checked', true);
|
|
|
});
|
|
|
- if (!readOnly) {
|
|
|
- const leafXmjSpreadObj = {
|
|
|
- getSelect : function () {
|
|
|
- const sheet = ledgerSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- const index = gclGatherData.indexOf(select);
|
|
|
- const leafXmjSheet = leafXmjSpread.getActiveSheet();
|
|
|
- const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
|
|
|
- const iRow = gclGatherData[index].leafXmjs.indexOf(leafXmjSelect);
|
|
|
- const leafXmjs = gclGatherData[index].leafXmjs.filter(item => {
|
|
|
- return item.qc_qty || item.contract_qty
|
|
|
- });
|
|
|
- const nRow = leafXmjs.indexOf(leafXmjSelect);
|
|
|
- const leafXmjColor = findNotJoinLeafXmj(leafXmjSelect) ? '#d6d8db' : '';
|
|
|
- return [index, iRow, nRow, leafXmjSheet, leafXmjSelect, leafXmjColor];
|
|
|
- },
|
|
|
- checkJoinMaterial: function (type) {
|
|
|
- const [iGclRow, iRow, nRow, sheet, select] = leafXmjSpreadObj.getSelect();
|
|
|
- const color = type === 'join' ? '' : '#d6d8db';
|
|
|
- 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) {
|
|
|
- if (type === 'join') {
|
|
|
- const index = findNotJoinLeafXmj(select, 'index');
|
|
|
- notJoinList.splice(index, 1);
|
|
|
- } else {
|
|
|
- notJoinList.push(result);
|
|
|
- }
|
|
|
- gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
|
|
|
- calculateJiaCha(gclGatherData, iGclRow);
|
|
|
- SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
- sheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
- loadMaterialData(iGclRow);
|
|
|
- SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
- });
|
|
|
- },
|
|
|
- checkSelfMaterial: function (type) {
|
|
|
- const [iGclRow, iRow, nRow, sheet, select, color] = leafXmjSpreadObj.getSelect();
|
|
|
- // const color = type === 'self' ? '' : '#d6d8db';
|
|
|
- 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) {
|
|
|
- if (type === 'noself') {
|
|
|
- const index = findSelfLeafXmj(select, 'index');
|
|
|
- selfList.splice(index, 1);
|
|
|
- materialListData = result;
|
|
|
- $('#cancel-self').modal('hide');
|
|
|
- } else {
|
|
|
- selfList.push(result);
|
|
|
- }
|
|
|
- gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
|
|
|
- calculateJiaCha(gclGatherData, iGclRow);
|
|
|
- SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
- sheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
- loadXmjMaterialData(iGclRow, nRow);
|
|
|
- SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
- });
|
|
|
- },
|
|
|
- }
|
|
|
- // leafXmj右键功能
|
|
|
- $.contextMenu({
|
|
|
- selector: '#leaf-xmj-spread',
|
|
|
- build: function ($trigger, e) {
|
|
|
- const target = SpreadJsObj.safeRightClickSelection($trigger, e, leafXmjSpread);
|
|
|
- return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
- },
|
|
|
- items: {
|
|
|
- 'stop': {
|
|
|
- name: '不参与调差',
|
|
|
- icon: 'fa-remove',
|
|
|
- callback: function (key, opt) {
|
|
|
- leafXmjSpreadObj.checkJoinMaterial('notjoin');
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- const sheet = leafXmjSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
- if (!select || sel.rowCount !== 1) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const notx = findNotJoinLeafXmj(select);
|
|
|
- if (!readOnly && select && notx === undefined) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ const leafXmjSpreadObj = {
|
|
|
+ getSelect : function () {
|
|
|
+ const sheet = ledgerSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const index = gclGatherData.indexOf(select);
|
|
|
+ const leafXmjSheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
|
|
|
+ const iRow = gclGatherData[index].leafXmjs.indexOf(leafXmjSelect);
|
|
|
+ const leafXmjs = gclGatherData[index].leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty
|
|
|
+ });
|
|
|
+ const nRow = leafXmjs.indexOf(leafXmjSelect);
|
|
|
+ const leafXmjColor = findNotJoinLeafXmj(leafXmjSelect) ? '#d6d8db' : '';
|
|
|
+ return [index, iRow, nRow, leafXmjSheet, leafXmjSelect, leafXmjColor];
|
|
|
+ },
|
|
|
+ checkJoinMaterial: function (type) {
|
|
|
+ const [iGclRow, iRow, nRow, sheet, select] = leafXmjSpreadObj.getSelect();
|
|
|
+ const color = type === 'join' ? '' : '#d6d8db';
|
|
|
+ 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) {
|
|
|
+ if (type === 'join') {
|
|
|
+ const index = findNotJoinLeafXmj(select, 'index');
|
|
|
+ notJoinList.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ notJoinList.push(result);
|
|
|
+ }
|
|
|
+ gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
|
|
|
+ calculateJiaCha(gclGatherData, iGclRow);
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
+ sheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
+ loadMaterialData(iGclRow);
|
|
|
+ SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ checkSelfMaterial: function (type) {
|
|
|
+ const [iGclRow, iRow, nRow, sheet, select, color] = leafXmjSpreadObj.getSelect();
|
|
|
+ // const color = type === 'self' ? '' : '#d6d8db';
|
|
|
+ const data = {
|
|
|
+ type: type,
|
|
|
+ select: type === 'noself' ? findSelfLeafXmj(select) : select,
|
|
|
+ ms_id: $('#myTab').find('.active').data('msid') || null,
|
|
|
+ };
|
|
|
+ if (type === 'noself') {
|
|
|
+ if (isStageSelf) {
|
|
|
+ data.select.gather_qty = {};
|
|
|
+ const ledgerSheet = ledgerSpread.getActiveSheet();
|
|
|
+ const ledgerSelect = SpreadJsObj.getSelectObject(ledgerSheet);
|
|
|
+ const index = gclGatherData.indexOf(ledgerSelect);
|
|
|
+ // 取所有的gclGatherData才行,然后获取下的值
|
|
|
+ const gclData = gclGatherData[index];
|
|
|
+ for (const [index, ms] of materialStageData.entries()) {
|
|
|
+ const gclOther = _.find(gclGatherListData[index], { b_code: gclData.b_code, name: gclData.name, unit: gclData.unit, unit_price: gclData.unit_price });
|
|
|
+ let gather_qty = null;
|
|
|
+ if (gclOther) {
|
|
|
+ const leafXmjs = gclOther.leafXmjs.filter(item => item.gather_qty !== null && item.gather_qty !== undefined);
|
|
|
+ const oneXmj = _.find(leafXmjs, function (item) {
|
|
|
+ return item.gcl_id === select.gcl_id && item.id === select.id && (select.mx_id === undefined || item.mx_id === select.mx_id);
|
|
|
+ });
|
|
|
+ if (oneXmj) gather_qty = oneXmj.gather_qty;
|
|
|
}
|
|
|
+ data.select.gather_qty['ms_id_' + ms.id] = gather_qty;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ data.select.gather_qty = select.gather_qty ? select.gather_qty : null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ // 添加到
|
|
|
+ postData(window.location.pathname + '/save', data, function (result) {
|
|
|
+ if (type === 'noself') {
|
|
|
+ const index = findSelfLeafXmj(select, 'index');
|
|
|
+ selfList.splice(index, 1);
|
|
|
+ materialListData = result;
|
|
|
+ $('#cancel-self').modal('hide');
|
|
|
+ } else {
|
|
|
+ selfList.push(result.info);
|
|
|
+ materialListData = result.materialListData;
|
|
|
+ }
|
|
|
+ gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(select);
|
|
|
+ calculateJiaCha(gclGatherData, iGclRow);
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
+ sheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
+ loadXmjMaterialData(iGclRow, nRow);
|
|
|
+ SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ }
|
|
|
+ if (!readOnly) {
|
|
|
+ // leafXmj右键功能
|
|
|
+ if (!editForAudit) {
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#leaf-xmj-spread',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, leafXmjSpread);
|
|
|
+ return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
},
|
|
|
- 'start': {
|
|
|
- name: '参与调差',
|
|
|
- icon: 'fa-sign-in',
|
|
|
- callback: function (key, opt) {
|
|
|
- leafXmjSpreadObj.checkJoinMaterial('join');
|
|
|
- },
|
|
|
- visible: function (key, opt) {
|
|
|
- const sheet = leafXmjSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
- if (!select || sel.rowCount !== 1) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const notx = findNotJoinLeafXmj(select);
|
|
|
- if (!readOnly && select && notx === undefined) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
+ items: {
|
|
|
+ 'stop': {
|
|
|
+ name: '不参与调差',
|
|
|
+ icon: 'fa-remove',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ leafXmjSpreadObj.checkJoinMaterial('notjoin');
|
|
|
+ },
|
|
|
+ visible: function (key, opt) {
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!select || sel.rowCount !== 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const notx = findNotJoinLeafXmj(select);
|
|
|
+ if (!readOnly && select && notx === undefined) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- },
|
|
|
- 'self': {
|
|
|
- name: '单独添加工料',
|
|
|
- icon: 'fa-sign-in',
|
|
|
- callback: function (key, opt) {
|
|
|
- leafXmjSpreadObj.checkSelfMaterial('self');
|
|
|
+ 'start': {
|
|
|
+ name: '参与调差',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ leafXmjSpreadObj.checkJoinMaterial('join');
|
|
|
+ },
|
|
|
+ visible: function (key, opt) {
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!select || sel.rowCount !== 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const notx = findNotJoinLeafXmj(select);
|
|
|
+ if (!readOnly && select && notx === undefined) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
- visible: function (key, opt) {
|
|
|
- const sheet = leafXmjSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
- if (!select || sel.rowCount !== 1) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const notx = findSelfLeafXmj(select);
|
|
|
- if (!readOnly && select && notx === undefined) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
+ 'self': {
|
|
|
+ name: '单独添加工料',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ leafXmjSpreadObj.checkSelfMaterial('self');
|
|
|
+ },
|
|
|
+ visible: function (key, opt) {
|
|
|
+ if (!openMaterialSelf) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!select || sel.rowCount !== 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const notx = findSelfLeafXmj(select);
|
|
|
+ if (!readOnly && select && notx === undefined) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- },
|
|
|
- 'noself': {
|
|
|
- name: '取消单独添加工料',
|
|
|
- icon: 'fa-remove',
|
|
|
- callback: function (key, opt) {
|
|
|
- $('#cancel-self').modal('show');
|
|
|
- // leafXmjSpreadObj.checkSelfMaterial('noself');
|
|
|
},
|
|
|
- visible: function (key, opt) {
|
|
|
- const sheet = leafXmjSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- const sel = sheet.getSelections()[0];
|
|
|
- if (!select || sel.rowCount !== 1) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- const notx = findSelfLeafXmj(select);
|
|
|
- if (!readOnly && select && notx === undefined) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
+ 'noself': {
|
|
|
+ name: '取消单独添加工料',
|
|
|
+ icon: 'fa-remove',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ $('#cancel-self').modal('show');
|
|
|
+ // leafXmjSpreadObj.checkSelfMaterial('noself');
|
|
|
+ },
|
|
|
+ visible: function (key, opt) {
|
|
|
+ if (!openMaterialSelf) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ const sel = sheet.getSelections()[0];
|
|
|
+ if (!select || sel.rowCount !== 1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const notx = findSelfLeafXmj(select);
|
|
|
+ if (!readOnly && select && notx === undefined) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ // const sheet = ledgerSpread.getActiveSheet();
|
|
|
+ // const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ // const index = gclGatherData.indexOf(select);
|
|
|
+ // const leafXmjSheet = leafXmjSpread.getActiveSheet();
|
|
|
+ // const leafXmjSelect = SpreadJsObj.getSelectObject(leafXmjSheet);
|
|
|
+ // const iRow = gclGatherData[index].leafXmjs.indexOf(leafXmjSelect);
|
|
|
+ // const leafXmjs = gclGatherData[index].leafXmjs.filter(item => {
|
|
|
+ // return item.qc_qty || item.contract_qty
|
|
|
+ // });
|
|
|
+ // const nRow = leafXmjs.indexOf(leafXmjSelect);
|
|
|
+ // const leafXmjColor = findNotJoinLeafXmj(leafXmjSelect) ? '#d6d8db' : '';
|
|
|
+ // return [index, iRow, nRow, leafXmjSheet, leafXmjSelect, leafXmjColor];
|
|
|
+ const [iGclRow, iRow, nRow, sheet, select, color] = leafXmjSpreadObj.getSelect();
|
|
|
+ const gcl = gclGatherData[iGclRow];
|
|
|
+ const leafXmjs = gcl && gcl.leafXmjs ? gcl.leafXmjs.filter(item => {
|
|
|
+ return item.qc_qty || item.contract_qty
|
|
|
+ }) : null;
|
|
|
+ let flag = false;
|
|
|
+ if (leafXmjs) {
|
|
|
+ const xmj = leafXmjs[nRow];
|
|
|
+ if (_.findIndex(selfList, { gcl_id: xmj.gcl_id, xmj_id: xmj.id, mx_id: (xmj.mx_id ? xmj.mx_id : '') }) != -1) {
|
|
|
+ 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) && m.order !== stage_order) {
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ },
|
|
|
},
|
|
|
- },
|
|
|
- }
|
|
|
- });
|
|
|
- $('#cancelSelfBtn').click(function () {
|
|
|
- leafXmjSpreadObj.checkSelfMaterial('noself');
|
|
|
- });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#cancelSelfBtn').click(function () {
|
|
|
+ leafXmjSpreadObj.checkSelfMaterial('noself');
|
|
|
+ });
|
|
|
+ }
|
|
|
// material-spread右键功能
|
|
|
const materialSpreadObj = {
|
|
|
del: function () {
|
|
@@ -1450,148 +1516,66 @@ $(document).ready(() => {
|
|
|
materialSpread.bind(spreadNS.Events.ClipboardPasted, materialSpreadObj.clipboardPasted);
|
|
|
SpreadJsObj.addDeleteBind(materialSpread, materialSpreadObj.deletePress);
|
|
|
// material-spread右键功能
|
|
|
- const materialSelfSpreadObj = {
|
|
|
- del: function () {
|
|
|
- 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, ms_id: $('#myTab').find('.active').data('msid') || null}, function (result) {
|
|
|
- const index = materialListSelf.indexOf(select);
|
|
|
- materialListSelf.splice(index, 1);
|
|
|
- sheet.deleteRows(index, 1);
|
|
|
- SpreadJsObj.reLoadSheetData(materialSelfSpread.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, nRow, lsheet, lselect, color] = leafXmjSpreadObj.getSelect();
|
|
|
- gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
|
|
|
- calculateJiaCha(gclGatherData, iGclRow);
|
|
|
- SpreadJsObj.reLoadRowData(lsheet, nRow);
|
|
|
- lsheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
- SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
- });
|
|
|
- },
|
|
|
- deletePress: function (sheet) {
|
|
|
- return;
|
|
|
- },
|
|
|
- editStarting: function (e, info) {
|
|
|
- const col = info.sheet.zh_setting.cols[info.col];
|
|
|
- const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
- if (col.field === 'quantity') {
|
|
|
- if (select.expr && select.expr !== '') {
|
|
|
- info.sheet.getCell(info.row, info.col).text(select.expr);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- editEnded: function (e, info) {
|
|
|
- if (info.sheet.zh_setting) {
|
|
|
- const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
- const col = info.sheet.zh_setting.cols[info.col];
|
|
|
- // 未改变值则不提交
|
|
|
- // const validText = info.editingText ? (typeof(info.editingText) === 'String' ? info.editingText.replace('\n', '') : info.editingText) : null;
|
|
|
- // const validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
|
|
|
- // let orgValue = select[col.field];
|
|
|
- const validText = info.editingText ? info.editingText.replace('\n', '') : null;
|
|
|
- let orgValue;
|
|
|
- if (col.field === 'quantity') {
|
|
|
- orgValue = validText && validText !== ''
|
|
|
- ? _.toNumber(validText) ? select.quantity : select.expr
|
|
|
- : (select.expr && select.expr !== '') ? select.expr : select.quantity;
|
|
|
- } else {
|
|
|
- orgValue = select[col.field];
|
|
|
- }
|
|
|
- if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === '' || validText === null))) {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- const exprQuantity = {
|
|
|
- expr: '',
|
|
|
- quantity: 0,
|
|
|
- };
|
|
|
- const [valid, msg] = materialSpreadObj._checkExpr(validText, exprQuantity);
|
|
|
- if (!valid) {
|
|
|
- toastr.error(msg);
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- if (isNaN(exprQuantity.quantity)) {
|
|
|
- toastr.error('不能输入其它非数字类型字符');
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- return;
|
|
|
- }
|
|
|
- const num = parseFloat(exprQuantity.quantity);
|
|
|
- if (num < 0 || !/^\d+(\.\d{1,6})?$/.test(num)) {
|
|
|
- // toastr.error('数量值必须大于0并且小于6位小数的浮点数');
|
|
|
- // SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- // return;
|
|
|
- toastr.warning('已保留6位小数');
|
|
|
- exprQuantity.quantity = ZhCalc.round(num, 6);
|
|
|
- }
|
|
|
- // 更新至服务器
|
|
|
- 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 }, ms_id: $('#myTab').find('.active').data('msid') || null }, function (result) {
|
|
|
+ if (openMaterialSelf) {
|
|
|
+ const materialSelfSpreadObj = {
|
|
|
+ del: function () {
|
|
|
+ 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,
|
|
|
+ ms_id: $('#myTab').find('.active').data('msid') || null
|
|
|
+ }, function (result) {
|
|
|
+ const index = materialListSelf.indexOf(select);
|
|
|
+ materialListSelf.splice(index, 1);
|
|
|
+ sheet.deleteRows(index, 1);
|
|
|
+ SpreadJsObj.reLoadSheetData(materialSelfSpread.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);
|
|
|
- const index = materialList.indexOf(select);
|
|
|
- select.quantity = exprQuantity.quantity;
|
|
|
- select.expr = exprQuantity.expr;
|
|
|
- materialListData.splice(materialListIndex, 1, select);
|
|
|
- materialList.indexOf(index, 1, select);
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
- const [iGclRow, iRow, nRow, sheet, lselect, color] = leafXmjSpreadObj.getSelect();
|
|
|
+ materialListData.splice(materialListIndex, 1);
|
|
|
+ const [iGclRow, iRow, nRow, lsheet, lselect, color] = leafXmjSpreadObj.getSelect();
|
|
|
gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
|
|
|
calculateJiaCha(gclGatherData, iGclRow);
|
|
|
- SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
- console.log(lselect, color);
|
|
|
- sheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
+ SpreadJsObj.reLoadRowData(lsheet, nRow);
|
|
|
+ lsheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
- }, function () {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
});
|
|
|
- }
|
|
|
- },
|
|
|
- clipboardPasted(e, info) {
|
|
|
- const hint = {
|
|
|
- cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
|
|
|
- numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
|
|
|
- numberCan: {type: 'warning', msg: '已保留6位小数'},
|
|
|
- };
|
|
|
- const range = info.cellRange;
|
|
|
- const sortData = info.sheet.zh_data || [];
|
|
|
- if (range.row + range.rowCount > sortData.length) {
|
|
|
- toastMessageUniq(hint.cellError);
|
|
|
- SpreadJsObj.reLoadSheetHeader(materialSpread.getActiveSheet());
|
|
|
- SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
|
|
|
- return;
|
|
|
- }
|
|
|
- if (sortData.length > 0 && range.col + range.colCount > 5) {
|
|
|
- toastMessageUniq(hint.cellError);
|
|
|
- SpreadJsObj.reLoadSheetHeader(materialSpread.getActiveSheet());
|
|
|
- SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
|
|
|
+ },
|
|
|
+ deletePress: function (sheet) {
|
|
|
return;
|
|
|
- }
|
|
|
- const data = [];
|
|
|
- for (let iRow = 0; iRow < range.rowCount; iRow++) {
|
|
|
- let bPaste = true;
|
|
|
- const curRow = range.row + iRow;
|
|
|
- const materialData = { id: sortData[curRow].id, mb_id: sortData[curRow].mb_id };
|
|
|
- const hintRow = range.rowCount > 1 ? curRow : '';
|
|
|
- let sameCol = 0;
|
|
|
- for (let iCol = 0; iCol < range.colCount; iCol++) {
|
|
|
- const curCol = range.col + iCol;
|
|
|
- const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
- if (!colSetting) continue;
|
|
|
-
|
|
|
- // let validText = info.sheet.getText(curRow, curCol);
|
|
|
- // validText = is_numeric(validText) ? parseFloat(validText) : (validText ? trimInvalidChar(validText) : null);
|
|
|
- const validText = info.sheet.getText(curRow, curCol).replace('\n', '');
|
|
|
- const orgValue = sortData[curRow][colSetting.field];
|
|
|
- if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
|
|
|
- sameCol++;
|
|
|
- if (range.colCount === sameCol) {
|
|
|
- bPaste = false;
|
|
|
- }
|
|
|
- continue;
|
|
|
+ },
|
|
|
+ editStarting: function (e, info) {
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ if (col.field === 'quantity') {
|
|
|
+ if (select.expr && select.expr !== '') {
|
|
|
+ info.sheet.getCell(info.row, info.col).text(select.expr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ editEnded: function (e, info) {
|
|
|
+ if (info.sheet.zh_setting) {
|
|
|
+ const select = SpreadJsObj.getSelectObject(info.sheet);
|
|
|
+ const col = info.sheet.zh_setting.cols[info.col];
|
|
|
+ // 未改变值则不提交
|
|
|
+ // const validText = info.editingText ? (typeof(info.editingText) === 'String' ? info.editingText.replace('\n', '') : info.editingText) : null;
|
|
|
+ // const validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
|
|
|
+ // let orgValue = select[col.field];
|
|
|
+ const validText = info.editingText ? info.editingText.replace('\n', '') : null;
|
|
|
+ let orgValue;
|
|
|
+ if (col.field === 'quantity') {
|
|
|
+ orgValue = validText && validText !== ''
|
|
|
+ ? _.toNumber(validText) ? select.quantity : select.expr
|
|
|
+ : (select.expr && select.expr !== '') ? select.expr : select.quantity;
|
|
|
+ } else {
|
|
|
+ orgValue = select[col.field];
|
|
|
+ }
|
|
|
+ if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === '' || validText === null))) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
}
|
|
|
const exprQuantity = {
|
|
|
expr: '',
|
|
@@ -1599,56 +1583,213 @@ $(document).ready(() => {
|
|
|
};
|
|
|
const [valid, msg] = materialSpreadObj._checkExpr(validText, exprQuantity);
|
|
|
if (!valid) {
|
|
|
- toastMessageUniq(getPasteHint(msg, hintRow));
|
|
|
- bPaste = false;
|
|
|
- continue;
|
|
|
+ toastr.error(msg);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
}
|
|
|
if (isNaN(exprQuantity.quantity)) {
|
|
|
- toastMessageUniq(getPasteHint(hint.numberExpr, hintRow));
|
|
|
- bPaste = false;
|
|
|
- continue;
|
|
|
+ toastr.error('不能输入其它非数字类型字符');
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ return;
|
|
|
}
|
|
|
const num = parseFloat(exprQuantity.quantity);
|
|
|
if (num < 0 || !/^\d+(\.\d{1,6})?$/.test(num)) {
|
|
|
- toastMessageUniq(getPasteHint(hint.numberCan, hintRow));
|
|
|
- // bPaste = false;
|
|
|
- // continue;
|
|
|
+ // toastr.error('数量值必须大于0并且小于6位小数的浮点数');
|
|
|
+ // SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ // return;
|
|
|
+ toastr.warning('已保留6位小数');
|
|
|
exprQuantity.quantity = ZhCalc.round(num, 6);
|
|
|
}
|
|
|
- // materialData[colSetting.field] = validText;
|
|
|
- materialData.expr = exprQuantity.expr;
|
|
|
- materialData.quantity = exprQuantity.quantity;
|
|
|
+ // 更新至服务器
|
|
|
+ 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
|
|
|
+ },
|
|
|
+ ms_id: $('#myTab').find('.active').data('msid') || null
|
|
|
+ }, function (result) {
|
|
|
+ const materialListIndex = materialListData.indexOf(select);
|
|
|
+ const index = materialList.indexOf(select);
|
|
|
+ select.quantity = exprQuantity.quantity;
|
|
|
+ select.expr = exprQuantity.expr;
|
|
|
+ materialListData.splice(materialListIndex, 1, select);
|
|
|
+ materialList.indexOf(index, 1, select);
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ const [iGclRow, iRow, nRow, sheet, lselect, color] = leafXmjSpreadObj.getSelect();
|
|
|
+ gclGatherData[iGclRow].leafXmjs[iRow].jiacha = calcOneBQJC(lselect);
|
|
|
+ calculateJiaCha(gclGatherData, iGclRow);
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
+ console.log(lselect, color);
|
|
|
+ sheet.getRange(nRow, -1, 1, -1).backColor(color);
|
|
|
+ SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.row);
|
|
|
+ });
|
|
|
}
|
|
|
- if (bPaste) {
|
|
|
- data.push(materialData);
|
|
|
- // rowData.push(curRow);
|
|
|
- } else {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
+ },
|
|
|
+ clipboardPasted(e, info) {
|
|
|
+ const hint = {
|
|
|
+ cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
|
|
|
+ numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
|
|
|
+ numberCan: {type: 'warning', msg: '已保留6位小数'},
|
|
|
+ };
|
|
|
+ const range = info.cellRange;
|
|
|
+ const sortData = info.sheet.zh_data || [];
|
|
|
+ if (range.row + range.rowCount > sortData.length) {
|
|
|
+ toastMessageUniq(hint.cellError);
|
|
|
+ SpreadJsObj.reLoadSheetHeader(materialSpread.getActiveSheet());
|
|
|
+ SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (sortData.length > 0 && range.col + range.colCount > 5) {
|
|
|
+ toastMessageUniq(hint.cellError);
|
|
|
+ SpreadJsObj.reLoadSheetHeader(materialSpread.getActiveSheet());
|
|
|
+ SpreadJsObj.reLoadSheetData(materialSpread.getActiveSheet());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const data = [];
|
|
|
+ for (let iRow = 0; iRow < range.rowCount; iRow++) {
|
|
|
+ let bPaste = true;
|
|
|
+ const curRow = range.row + iRow;
|
|
|
+ const materialData = {id: sortData[curRow].id, mb_id: sortData[curRow].mb_id};
|
|
|
+ const hintRow = range.rowCount > 1 ? curRow : '';
|
|
|
+ let sameCol = 0;
|
|
|
+ for (let iCol = 0; iCol < range.colCount; iCol++) {
|
|
|
+ const curCol = range.col + iCol;
|
|
|
+ const colSetting = info.sheet.zh_setting.cols[curCol];
|
|
|
+ if (!colSetting) continue;
|
|
|
+
|
|
|
+ // let validText = info.sheet.getText(curRow, curCol);
|
|
|
+ // validText = is_numeric(validText) ? parseFloat(validText) : (validText ? trimInvalidChar(validText) : null);
|
|
|
+ const validText = info.sheet.getText(curRow, curCol).replace('\n', '');
|
|
|
+ const orgValue = sortData[curRow][colSetting.field];
|
|
|
+ if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
|
|
|
+ sameCol++;
|
|
|
+ if (range.colCount === sameCol) {
|
|
|
+ bPaste = false;
|
|
|
+ }
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ const exprQuantity = {
|
|
|
+ expr: '',
|
|
|
+ quantity: 0,
|
|
|
+ };
|
|
|
+ const [valid, msg] = materialSpreadObj._checkExpr(validText, exprQuantity);
|
|
|
+ if (!valid) {
|
|
|
+ toastMessageUniq(getPasteHint(msg, hintRow));
|
|
|
+ bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (isNaN(exprQuantity.quantity)) {
|
|
|
+ toastMessageUniq(getPasteHint(hint.numberExpr, hintRow));
|
|
|
+ bPaste = false;
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ const num = parseFloat(exprQuantity.quantity);
|
|
|
+ if (num < 0 || !/^\d+(\.\d{1,6})?$/.test(num)) {
|
|
|
+ toastMessageUniq(getPasteHint(hint.numberCan, hintRow));
|
|
|
+ // bPaste = false;
|
|
|
+ // continue;
|
|
|
+ exprQuantity.quantity = ZhCalc.round(num, 6);
|
|
|
+ }
|
|
|
+ // materialData[colSetting.field] = validText;
|
|
|
+ materialData.expr = exprQuantity.expr;
|
|
|
+ materialData.quantity = exprQuantity.quantity;
|
|
|
+ }
|
|
|
+ if (bPaste) {
|
|
|
+ data.push(materialData);
|
|
|
+ // rowData.push(curRow);
|
|
|
+ } else {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, curRow);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (data.length === 0) {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ postData(window.location.pathname + '/save', {
|
|
|
+ type: 'paste',
|
|
|
+ updateData: data,
|
|
|
+ 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);
|
|
|
+ calculateJiaCha(gclGatherData, iGclRow);
|
|
|
+ SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
+ SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
+ loadXmjMaterialData(iGclRow, nRow);
|
|
|
+ }, function () {
|
|
|
+ SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ };
|
|
|
+ materialSelfSpread.bind(spreadNS.Events.EditStarting, materialSelfSpreadObj.editStarting);
|
|
|
+ materialSelfSpread.bind(spreadNS.Events.EditEnded, materialSelfSpreadObj.editEnded);
|
|
|
+ materialSelfSpread.bind(spreadNS.Events.ClipboardPasted, materialSelfSpreadObj.clipboardPasted);
|
|
|
+ SpreadJsObj.addDeleteBind(materialSelfSpread, materialSelfSpreadObj.deletePress);
|
|
|
+
|
|
|
+ if (!editForAudit) {
|
|
|
+ $.contextMenu({
|
|
|
+ selector: '#material-self-spread',
|
|
|
+ build: function ($trigger, e) {
|
|
|
+ const target = SpreadJsObj.safeRightClickSelection($trigger, e, materialSelfSpread);
|
|
|
+ return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
+ },
|
|
|
+ items: {
|
|
|
+ 'create': {
|
|
|
+ name: '添加工料',
|
|
|
+ icon: 'fa-sign-in',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ // 获取已选清单
|
|
|
+ changeMaterialTable('self');
|
|
|
+ $('#add_type').val('self');
|
|
|
+ $('#addgl').modal('show');
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const sheet = leafXmjSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ // const notx = findNotJoinLeafXmj(select);
|
|
|
+ if (!select) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // if (!readOnly && notx === undefined) {
|
|
|
+ // return false;
|
|
|
+ // } else {
|
|
|
+ // return true;
|
|
|
+ // }
|
|
|
+ return readOnly;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ 'delete': {
|
|
|
+ name: '删除工料',
|
|
|
+ icon: 'fa-remove',
|
|
|
+ callback: function (key, opt) {
|
|
|
+ materialSelfSpreadObj.del(materialSelfSpread.getActiveSheet());
|
|
|
+ },
|
|
|
+ disabled: function (key, opt) {
|
|
|
+ const sheet = materialSelfSpread.getActiveSheet();
|
|
|
+ const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
+ if (!select) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ if (!readOnly && select && materialSelfBase.isEdit(select, 'del')) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
- }
|
|
|
- if (data.length === 0) {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
- return;
|
|
|
- }
|
|
|
- console.log(data);
|
|
|
- postData(window.location.pathname + '/save', { type:'paste', updateData: data, 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);
|
|
|
- calculateJiaCha(gclGatherData, iGclRow);
|
|
|
- SpreadJsObj.reLoadRowData(sheet, nRow);
|
|
|
- SpreadJsObj.reLoadRowData(ledgerSpread.getActiveSheet(), iGclRow);
|
|
|
- loadXmjMaterialData(iGclRow, nRow);
|
|
|
- }, function () {
|
|
|
- SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
|
|
|
});
|
|
|
- },
|
|
|
- };
|
|
|
- materialSelfSpread.bind(spreadNS.Events.EditStarting, materialSelfSpreadObj.editStarting);
|
|
|
- materialSelfSpread.bind(spreadNS.Events.EditEnded, materialSelfSpreadObj.editEnded);
|
|
|
- materialSelfSpread.bind(spreadNS.Events.ClipboardPasted, materialSelfSpreadObj.clipboardPasted);
|
|
|
- SpreadJsObj.addDeleteBind(materialSelfSpread, materialSelfSpreadObj.deletePress);
|
|
|
- if (!openMaterialChecklist) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!openMaterialChecklist && !editForAudit) {
|
|
|
$.contextMenu({
|
|
|
selector: '#material-spread',
|
|
|
build: function ($trigger, e) {
|
|
@@ -1702,58 +1843,6 @@ $(document).ready(() => {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- $.contextMenu({
|
|
|
- selector: '#material-self-spread',
|
|
|
- build: function ($trigger, e) {
|
|
|
- const target = SpreadJsObj.safeRightClickSelection($trigger, e, materialSelfSpread);
|
|
|
- return target.hitTestType === GC.Spread.Sheets.SheetArea.viewport || target.hitTestType === GC.Spread.Sheets.SheetArea.rowHeader;
|
|
|
- },
|
|
|
- items: {
|
|
|
- 'create': {
|
|
|
- name: '添加工料',
|
|
|
- icon: 'fa-sign-in',
|
|
|
- callback: function (key, opt) {
|
|
|
- // 获取已选清单
|
|
|
- changeMaterialTable('self');
|
|
|
- $('#add_type').val('self');
|
|
|
- $('#addgl').modal('show');
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- const sheet = leafXmjSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- // const notx = findNotJoinLeafXmj(select);
|
|
|
- if (!select) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- // if (!readOnly && notx === undefined) {
|
|
|
- // return false;
|
|
|
- // } else {
|
|
|
- // return true;
|
|
|
- // }
|
|
|
- return readOnly;
|
|
|
- }
|
|
|
- },
|
|
|
- 'delete': {
|
|
|
- name: '删除工料',
|
|
|
- icon: 'fa-remove',
|
|
|
- callback: function (key, opt) {
|
|
|
- materialSelfSpreadObj.del(materialSelfSpread.getActiveSheet());
|
|
|
- },
|
|
|
- disabled: function (key, opt) {
|
|
|
- const sheet = materialSelfSpread.getActiveSheet();
|
|
|
- const select = SpreadJsObj.getSelectObject(sheet);
|
|
|
- if (!select) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (!readOnly && select) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- }
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
// 应用调差工料至其他清单明细
|