|
@@ -20,6 +20,63 @@ function loadUpdateMaterials(newMaterial, fields) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// function DatePickerCellType() {
|
|
|
+// }
|
|
|
+// DatePickerCellType.prototype = new GC.Spread.Sheets.CellTypes.Base();
|
|
|
+// DatePickerCellType.prototype.createEditorElement = function () {
|
|
|
+// //Create input presenter.
|
|
|
+// var input = document.createElement("input");
|
|
|
+// return input;
|
|
|
+// };
|
|
|
+// DatePickerCellType.prototype.activateEditor = function (editorContext, cellStyle, cellRect) {
|
|
|
+// //Initialize input editor.
|
|
|
+// if (editorContext) {
|
|
|
+// const $editor = $(editorContext);
|
|
|
+// GC.Spread.Sheets.CellTypes.Base.prototype.activateEditor.apply(this, arguments);
|
|
|
+// $editor.datepicker({
|
|
|
+// language: 'zh',
|
|
|
+// });
|
|
|
+// $editor.css("position", "absolute");
|
|
|
+// $editor.attr("gcUIElement", "gcEditingInput");
|
|
|
+// $(".ui-datepicker").attr("gcUIElement", "gcEditingInput");
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // DatePickerCellType.prototype.deactivateEditor = function (editorContext) {
|
|
|
+// // //Remove input editor when end editor status.
|
|
|
+// // if (editorContext) {
|
|
|
+// // var element = editorContext;
|
|
|
+// // $(element).datepicker().data('datepicker').hide();
|
|
|
+// // $(element).datepicker().data('datepicker').destroy();
|
|
|
+// // // $(element).datepicker("hide");
|
|
|
+// // // $(element).datepicker("destroy");
|
|
|
+// // }
|
|
|
+// // GC.Spread.Sheets.CellTypes.Base.prototype.deactivateEditor.apply(this, arguments)
|
|
|
+// // };
|
|
|
+// // DatePickerCellType.prototype.setEditorValue = function (editor, value) {
|
|
|
+// // //Sync value from Cell value to editor value.
|
|
|
+// // console.log($(editor), value);
|
|
|
+// // // $(editor).datepicker("setDate", value);
|
|
|
+// // $(editor).datepicker().data('datepicker').selectDate(value);
|
|
|
+// // };
|
|
|
+// // DatePickerCellType.prototype.getEditorValue = function (editor) {
|
|
|
+// // //Sync value from editor value to cell value.
|
|
|
+// // $(editor).datepicker({
|
|
|
+// // onSelect: function onSelect(fd, date) {
|
|
|
+// // console.log(fd);
|
|
|
+// // $(editor).val(fd);
|
|
|
+// // }
|
|
|
+// // });
|
|
|
+// // // return $(editor).datepicker("getDate");
|
|
|
+// // return $(editor).val();
|
|
|
+// // };
|
|
|
+// DatePickerCellType.prototype.updateEditor = function (editorContext, cellStyle, cellRect) {
|
|
|
+// if (editorContext) {
|
|
|
+// const $editor = $(editorContext);
|
|
|
+// $editor.css("width", cellRect.width - 1);
|
|
|
+// $editor.css("height", cellRect.height - 3);
|
|
|
+// }
|
|
|
+// };
|
|
|
+
|
|
|
function resetTpTable() {
|
|
|
const rate = $('#changeRate').val();
|
|
|
const bqhs = ZhCalc.round(ZhCalc.mul(m_tp, 1+rate/100), 2);
|
|
@@ -34,12 +91,12 @@ $(document).ready(() => {
|
|
|
const materialSpread = SpreadJsObj.createNewSpread($('#material-spread')[0]);
|
|
|
const materialSpreadSetting = {
|
|
|
cols: [
|
|
|
- {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 0, width: 80, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
+ {title: '调差类型', colSpan: '1', rowSpan: '2', field: 't_type', hAlign: 1, width: 80, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.t_type, cellTypeKey: 1},
|
|
|
{title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '规格', colSpan: '1', rowSpan: '2', field: 'spec', hAlign: 0, width: 180, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
|
- {title: '工料分类', colSpan: '1', rowSpan: '2', field: 'm_type', hAlign: 0, width: 60, readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.m_type, cellTypeKey: 2},
|
|
|
+ {title: '工料分类', colSpan: '1', rowSpan: '2', field: 'm_type', hAlign: 1, width: 60, readOnly: 'readOnly.isEdit', cellType: 'customizeCombo', comboItems: materialType.m_type, cellTypeKey: 2},
|
|
|
{title: '本期应耗数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 100, type: 'Number', readOnly: true},
|
|
|
{title: '基准价', colSpan: '1', rowSpan: '2', field: 'basic_price', hAlign: 2, width: 60, type: 'Number', readOnly: 'readOnly.isEdit'},
|
|
|
{title: '基准时间', colSpan: '1', rowSpan: '2', field: 'basic_times', hAlign: 0, width: 60, formatter: '@', readOnly: 'readOnly.isEdit'},
|
|
@@ -71,6 +128,7 @@ $(document).ready(() => {
|
|
|
// return !readOnly && data.t_type === 2 && data.mid === materialID;
|
|
|
return data.t_type === 2;
|
|
|
};
|
|
|
+
|
|
|
materialSpreadSetting.imageClick = function (data) {
|
|
|
if (data.t_type === 2) {
|
|
|
$('#bcyy').modal('show');
|
|
@@ -267,12 +325,55 @@ $(document).ready(() => {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ // clipboardPasting(e, info) {
|
|
|
+ // if (info.sheet.zh_setting) {
|
|
|
+ // const sortData = info.sheet.zh_data;
|
|
|
+ // const range = info.cellRange;
|
|
|
+ // const validField = ['code', 'name', 'unit', 'spec', 'basic_price', 'basic_times', 'msg_tp', 'msg_times', 'm_up_risk', 'm_down_risk', 'remark'];
|
|
|
+ // for (let iCol = range.col; iCol < range.col + range.colCount; iCol++) {
|
|
|
+ // const col = info.sheet.zh_setting.cols[iCol];
|
|
|
+ // // if (col.type === 'Number') {
|
|
|
+ // // const num = _.toNumber(newData[col.field]);
|
|
|
+ // // if (num) {
|
|
|
+ // // newData[col.field] = num;
|
|
|
+ // // } else {
|
|
|
+ // // try {
|
|
|
+ // // newData[col.field] = math.evaluate(transExpr(newData[col.field]));
|
|
|
+ // // } catch(err) {
|
|
|
+ // // toastr.error('输入的表达式非法');
|
|
|
+ // // stagePosSpreadObj.loadCurPosData();
|
|
|
+ // // return;
|
|
|
+ // //
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // if (validField.indexOf(col.field) === -1) {
|
|
|
+ // toastr.error('不可修改此数据');
|
|
|
+ // info.cancel = true;
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // clipboardPasted(e, info) {
|
|
|
+ // // console.log(e, info);
|
|
|
+ // },
|
|
|
setReadOnly: function(readOnly) {
|
|
|
SpreadJsObj.resetFieldReadOnly(materialSpread.getActiveSheet(), 'msg_spread', 'm_spread', 'm_tp', 'pre_tp', readOnly);
|
|
|
}
|
|
|
};
|
|
|
materialSpreadObj.refreshActn();
|
|
|
materialSpread.bind(spreadNS.Events.SelectionChanged, materialSpreadObj.selectionChanged);
|
|
|
+ // materialSpread.bind(spreadNS.Events.ClipboardPasting, materialSpreadObj.clipboardPasting);
|
|
|
+ // materialSpread.bind(spreadNS.Events.ClipboardPasted, materialSpreadObj.clipboardPasted);
|
|
|
+ // const sheet = materialSpread.getActiveSheet();
|
|
|
+ // sheet.suspendPaint();
|
|
|
+ // var range = sheet.getRange(-1, 8, -1, 1);
|
|
|
+ // console.log(range);
|
|
|
+ // range.cellType(new DatePickerCellType());
|
|
|
+ // // range.formatter("yyyy-MM-dd");
|
|
|
+ // sheet.resumePaint();
|
|
|
+
|
|
|
if (!readOnly) {
|
|
|
$('#add').click(materialSpreadObj.add);
|
|
|
$('#del').click(materialSpreadObj.del);
|